diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 00000000..71fa229f --- /dev/null +++ b/.editorconfig @@ -0,0 +1,3 @@ +# C# files +[*.cs] +indent_style = tab \ No newline at end of file diff --git a/.gitmodules b/.gitmodules index c33b06a3..e8fea3d9 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,6 +1,9 @@ [submodule "Assets/Scripts/Libraries/BinarySerializer"] path = Assets/Scripts/Libraries/BinarySerializer url = https://github.com/BinarySerializer/BinarySerializer -[submodule "Assets/Scripts/Libraries/BinarySerializer.OpenSpace"] - path = Assets/Scripts/Libraries/BinarySerializer.OpenSpace - url = https://github.com/BinarySerializer/BinarySerializer.OpenSpace +[submodule "Assets/Scripts/Libraries/BinarySerializer.PS1"] + path = Assets/Scripts/Libraries/BinarySerializer.PS1 + url = https://github.com/BinarySerializer/BinarySerializer.PS1 +[submodule "Assets/Scripts/Libraries/BinarySerializer.Nintendo"] + path = Assets/Scripts/Libraries/BinarySerializer.Nintendo + url = https://github.com/BinarySerializer/BinarySerializer.Nintendo diff --git a/Assets/Scripts/Libraries/BinarySerializer.OpenSpace.meta b/Assets/Plugins/ImageMagick.meta similarity index 77% rename from Assets/Scripts/Libraries/BinarySerializer.OpenSpace.meta rename to Assets/Plugins/ImageMagick.meta index 7c81d0d4..645d9c9c 100644 --- a/Assets/Scripts/Libraries/BinarySerializer.OpenSpace.meta +++ b/Assets/Plugins/ImageMagick.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: 2767e713106b0024abb8e884264de38d +guid: 87acd640fa4018942813314d9d360662 folderAsset: yes DefaultImporter: externalObjects: {} diff --git a/Assets/Plugins/ImageMagick/Linux.meta b/Assets/Plugins/ImageMagick/Linux.meta new file mode 100644 index 00000000..10ef2386 --- /dev/null +++ b/Assets/Plugins/ImageMagick/Linux.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 6a52f429475338447a4b8dc90cbaf7ed +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/ImageMagick/Linux/Magick.Native-Q8-x64.dll.so b/Assets/Plugins/ImageMagick/Linux/Magick.Native-Q8-x64.dll.so new file mode 100644 index 00000000..85cb6b6b Binary files /dev/null and b/Assets/Plugins/ImageMagick/Linux/Magick.Native-Q8-x64.dll.so differ diff --git a/Assets/Plugins/ImageMagick/Linux/Magick.Native-Q8-x64.dll.so.meta b/Assets/Plugins/ImageMagick/Linux/Magick.Native-Q8-x64.dll.so.meta new file mode 100644 index 00000000..710aa56f --- /dev/null +++ b/Assets/Plugins/ImageMagick/Linux/Magick.Native-Q8-x64.dll.so.meta @@ -0,0 +1,63 @@ +fileFormatVersion: 2 +guid: cbe51ffffdb3cc64bb45527ab1485441 +PluginImporter: + externalObjects: {} + serializedVersion: 2 + iconMap: {} + executionOrder: {} + defineConstraints: [] + isPreloaded: 0 + isOverridable: 0 + isExplicitlyReferenced: 0 + validateReferences: 1 + platformData: + - first: + : Any + second: + enabled: 0 + settings: + Exclude Editor: 0 + Exclude Linux64: 0 + Exclude OSXUniversal: 1 + Exclude Win: 0 + Exclude Win64: 0 + - first: + Any: + second: + enabled: 1 + settings: {} + - first: + Editor: Editor + second: + enabled: 1 + settings: + CPU: AnyCPU + DefaultValueInitialized: true + OS: AnyOS + - first: + Standalone: Linux64 + second: + enabled: 1 + settings: + CPU: x86_64 + - first: + Standalone: OSXUniversal + second: + enabled: 0 + settings: + CPU: None + - first: + Standalone: Win + second: + enabled: 1 + settings: + CPU: x86 + - first: + Standalone: Win64 + second: + enabled: 1 + settings: + CPU: x86_64 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/ImageMagick/Magick.NET-Q8-AnyCPU.dll b/Assets/Plugins/ImageMagick/Magick.NET-Q8-AnyCPU.dll new file mode 100644 index 00000000..11351c72 Binary files /dev/null and b/Assets/Plugins/ImageMagick/Magick.NET-Q8-AnyCPU.dll differ diff --git a/Assets/Plugins/ImageMagick/Magick.NET-Q8-AnyCPU.dll.meta b/Assets/Plugins/ImageMagick/Magick.NET-Q8-AnyCPU.dll.meta new file mode 100644 index 00000000..56467585 --- /dev/null +++ b/Assets/Plugins/ImageMagick/Magick.NET-Q8-AnyCPU.dll.meta @@ -0,0 +1,33 @@ +fileFormatVersion: 2 +guid: 8f4dd7c1de7fd1a449add628c02f21d2 +PluginImporter: + externalObjects: {} + serializedVersion: 2 + iconMap: {} + executionOrder: {} + defineConstraints: [] + isPreloaded: 0 + isOverridable: 0 + isExplicitlyReferenced: 0 + validateReferences: 1 + platformData: + - first: + Any: + second: + enabled: 1 + settings: {} + - first: + Editor: Editor + second: + enabled: 0 + settings: + DefaultValueInitialized: true + - first: + Windows Store Apps: WindowsStoreApps + second: + enabled: 0 + settings: + CPU: AnyCPU + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/ImageMagick/Magick.NET.Core.dll b/Assets/Plugins/ImageMagick/Magick.NET.Core.dll new file mode 100644 index 00000000..a55f13ad Binary files /dev/null and b/Assets/Plugins/ImageMagick/Magick.NET.Core.dll differ diff --git a/Assets/Plugins/ImageMagick/Magick.NET.Core.dll.meta b/Assets/Plugins/ImageMagick/Magick.NET.Core.dll.meta new file mode 100644 index 00000000..88f43e7b --- /dev/null +++ b/Assets/Plugins/ImageMagick/Magick.NET.Core.dll.meta @@ -0,0 +1,33 @@ +fileFormatVersion: 2 +guid: 4abc39d42f3a1b44ea4a562bc2035603 +PluginImporter: + externalObjects: {} + serializedVersion: 2 + iconMap: {} + executionOrder: {} + defineConstraints: [] + isPreloaded: 0 + isOverridable: 0 + isExplicitlyReferenced: 0 + validateReferences: 1 + platformData: + - first: + Any: + second: + enabled: 1 + settings: {} + - first: + Editor: Editor + second: + enabled: 0 + settings: + DefaultValueInitialized: true + - first: + Windows Store Apps: WindowsStoreApps + second: + enabled: 0 + settings: + CPU: AnyCPU + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/ImageMagick/OSX.meta b/Assets/Plugins/ImageMagick/OSX.meta new file mode 100644 index 00000000..45b39866 --- /dev/null +++ b/Assets/Plugins/ImageMagick/OSX.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 62f37c2c674c5ce459f6fc1ca51208b1 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/ImageMagick/OSX/Magick.Native-Q8-x64.dll.dylib b/Assets/Plugins/ImageMagick/OSX/Magick.Native-Q8-x64.dll.dylib new file mode 100644 index 00000000..9d6fab0f Binary files /dev/null and b/Assets/Plugins/ImageMagick/OSX/Magick.Native-Q8-x64.dll.dylib differ diff --git a/Assets/Plugins/ImageMagick/OSX/Magick.Native-Q8-x64.dll.dylib.meta b/Assets/Plugins/ImageMagick/OSX/Magick.Native-Q8-x64.dll.dylib.meta new file mode 100644 index 00000000..96f44c8b --- /dev/null +++ b/Assets/Plugins/ImageMagick/OSX/Magick.Native-Q8-x64.dll.dylib.meta @@ -0,0 +1,32 @@ +fileFormatVersion: 2 +guid: 8e04d6724cbc2ba4181d87e390dcd3c1 +PluginImporter: + externalObjects: {} + serializedVersion: 2 + iconMap: {} + executionOrder: {} + defineConstraints: [] + isPreloaded: 0 + isOverridable: 0 + isExplicitlyReferenced: 0 + validateReferences: 1 + platformData: + - first: + Any: + second: + enabled: 0 + settings: {} + - first: + Editor: Editor + second: + enabled: 1 + settings: + DefaultValueInitialized: true + - first: + Standalone: OSXUniversal + second: + enabled: 1 + settings: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/ImageMagick/Windows.meta b/Assets/Plugins/ImageMagick/Windows.meta new file mode 100644 index 00000000..f85479e4 --- /dev/null +++ b/Assets/Plugins/ImageMagick/Windows.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 02e660924babb0d4395cdb4b8562f096 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/ImageMagick/Windows/Magick.Native-Q8-x64.dll b/Assets/Plugins/ImageMagick/Windows/Magick.Native-Q8-x64.dll new file mode 100644 index 00000000..dfae09fe Binary files /dev/null and b/Assets/Plugins/ImageMagick/Windows/Magick.Native-Q8-x64.dll differ diff --git a/Assets/Plugins/ImageMagick/Windows/Magick.Native-Q8-x64.dll.meta b/Assets/Plugins/ImageMagick/Windows/Magick.Native-Q8-x64.dll.meta new file mode 100644 index 00000000..6a480a31 --- /dev/null +++ b/Assets/Plugins/ImageMagick/Windows/Magick.Native-Q8-x64.dll.meta @@ -0,0 +1,63 @@ +fileFormatVersion: 2 +guid: 49a25ea1af128ce4aa4f7ade4d2f9587 +PluginImporter: + externalObjects: {} + serializedVersion: 2 + iconMap: {} + executionOrder: {} + defineConstraints: [] + isPreloaded: 0 + isOverridable: 0 + isExplicitlyReferenced: 0 + validateReferences: 1 + platformData: + - first: + : Any + second: + enabled: 0 + settings: + Exclude Editor: 0 + Exclude Linux64: 0 + Exclude OSXUniversal: 0 + Exclude Win: 1 + Exclude Win64: 0 + - first: + Any: + second: + enabled: 1 + settings: {} + - first: + Editor: Editor + second: + enabled: 1 + settings: + CPU: AnyCPU + DefaultValueInitialized: true + OS: AnyOS + - first: + Standalone: Linux64 + second: + enabled: 1 + settings: + CPU: x86_64 + - first: + Standalone: OSXUniversal + second: + enabled: 1 + settings: + CPU: x86_64 + - first: + Standalone: Win + second: + enabled: 0 + settings: + CPU: None + - first: + Standalone: Win64 + second: + enabled: 1 + settings: + CPU: x86_64 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Prefabs/Environments.meta b/Assets/Prefabs/Environments.meta new file mode 100644 index 00000000..31f89750 --- /dev/null +++ b/Assets/Prefabs/Environments.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 77fe73da2a2ba9d46802d2d408e09e46 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Prefabs/Environments/CPA_Environment.prefab b/Assets/Prefabs/Environments/CPA_Environment.prefab new file mode 100644 index 00000000..f9745bc1 --- /dev/null +++ b/Assets/Prefabs/Environments/CPA_Environment.prefab @@ -0,0 +1,54 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!1 &3651640777840233375 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 3651640777840233373} + - component: {fileID: 3651640777840233374} + m_Layer: 0 + m_Name: CPA_Environment + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &3651640777840233373 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 3651640777840233375} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 0} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!114 &3651640777840233374 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 3651640777840233375} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: c841a7481bfd7b14581c14279d447df3, type: 3} + m_Name: + m_EditorClassIdentifier: + MaterialVisualOpaque: {fileID: 2100000, guid: 4c445331ca6381a44bb772fa126abb28, + type: 2} + MaterialVisualTransparent: {fileID: 2100000, guid: f72b6a2550e50034d9212047304245fa, + type: 2} + MaterialVisualLight: {fileID: 2100000, guid: 40617402911ef9f44ae1a9c1afcf7359, type: 2} + MaterialCollision: {fileID: 2100000, guid: e38ecf128dbf8a1418eeefae3b11261b, type: 2} + MaterialCollisionTransparent: {fileID: 2100000, guid: dc307f54a9487d047a739edf6c860657, + type: 2} diff --git a/Assets/Prefabs/Environments/CPA_Environment.prefab.meta b/Assets/Prefabs/Environments/CPA_Environment.prefab.meta new file mode 100644 index 00000000..fb0e360d --- /dev/null +++ b/Assets/Prefabs/Environments/CPA_Environment.prefab.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: fcd3413973d6ae843b2ad798a13b0eab +PrefabImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scenes/MapViewer.unity b/Assets/Scenes/MapViewer.unity index ebf392cf..66db49b8 100644 --- a/Assets/Scenes/MapViewer.unity +++ b/Assets/Scenes/MapViewer.unity @@ -151,6 +151,7 @@ RectTransform: m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} m_LocalPosition: {x: 0, y: 0, z: 0} m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 m_Children: - {fileID: 1444678344} m_Father: {fileID: 1109753676} @@ -243,9 +244,10 @@ Transform: m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} m_LocalPosition: {x: 0, y: 0, z: 0} m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 m_Children: [] m_Father: {fileID: 0} - m_RootOrder: 4 + m_RootOrder: 5 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} --- !u!1 &469719538 GameObject: @@ -288,9 +290,10 @@ Transform: m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} m_LocalPosition: {x: 0, y: 0, z: 0} m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 m_Children: [] m_Father: {fileID: 0} - m_RootOrder: 6 + m_RootOrder: 7 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} --- !u!1 &486948329 GameObject: @@ -334,9 +337,10 @@ Transform: m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} m_LocalPosition: {x: 0, y: 0, z: 0} m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 m_Children: [] m_Father: {fileID: 0} - m_RootOrder: 5 + m_RootOrder: 6 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} --- !u!1 &549858797 GameObject: @@ -427,6 +431,7 @@ Transform: m_LocalRotation: {x: 0.40821788, y: -0.23456968, z: 0.10938163, w: 0.8754261} m_LocalPosition: {x: 0, y: 3, z: 0} m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 m_Children: [] m_Father: {fileID: 0} m_RootOrder: 1 @@ -459,6 +464,7 @@ RectTransform: m_LocalRotation: {x: 0, y: 0.7071068, z: -0.7071068, w: 0} m_LocalPosition: {x: 0, y: 0, z: 0} m_LocalScale: {x: 80, y: 0, z: 60} + m_ConstrainProportionsScale: 0 m_Children: [] m_Father: {fileID: 878624506} m_RootOrder: 0 @@ -479,6 +485,7 @@ MeshRenderer: m_CastShadows: 0 m_ReceiveShadows: 0 m_DynamicOccludee: 0 + m_StaticShadowCaster: 0 m_MotionVectors: 1 m_LightProbeUsage: 1 m_ReflectionProbeUsage: 1 @@ -524,7 +531,7 @@ LightingSettings: m_PrefabInstance: {fileID: 0} m_PrefabAsset: {fileID: 0} m_Name: Settings.lighting - serializedVersion: 3 + serializedVersion: 4 m_GIWorkflowMode: 0 m_EnableBakedLightmaps: 0 m_EnableRealtimeLightmaps: 0 @@ -537,7 +544,7 @@ LightingSettings: m_LightmapMaxSize: 1024 m_BakeResolution: 40 m_Padding: 2 - m_TextureCompression: 1 + m_LightmapCompression: 2 m_AO: 0 m_AOMaxDistance: 1 m_CompAOExponent: 1 @@ -578,6 +585,7 @@ LightingSettings: m_PVRFilteringAtrousPositionSigmaDirect: 0.5 m_PVRFilteringAtrousPositionSigmaIndirect: 2 m_PVRFilteringAtrousPositionSigmaAO: 1 + m_PVRTiledBaking: 0 --- !u!1 &878624502 GameObject: m_ObjectHideFlags: 0 @@ -650,11 +658,12 @@ RectTransform: m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} m_LocalPosition: {x: 0, y: 0, z: 0} m_LocalScale: {x: 0, y: 0, z: 0} + m_ConstrainProportionsScale: 0 m_Children: - {fileID: 669531108} - {fileID: 1781294053} m_Father: {fileID: 0} - m_RootOrder: 7 + m_RootOrder: 8 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0, y: 0} m_AnchorMax: {x: 0, y: 0} @@ -689,6 +698,7 @@ RectTransform: m_LocalRotation: {x: -0, y: 0.7071068, z: -0.7071068, w: 0} m_LocalPosition: {x: 0, y: 0, z: 0} m_LocalScale: {x: 40.000034, y: 0, z: 30.000013} + m_ConstrainProportionsScale: 0 m_Children: [] m_Father: {fileID: 1781294053} m_RootOrder: 1 @@ -709,6 +719,7 @@ MeshRenderer: m_CastShadows: 0 m_ReceiveShadows: 0 m_DynamicOccludee: 0 + m_StaticShadowCaster: 0 m_MotionVectors: 1 m_LightProbeUsage: 1 m_ReflectionProbeUsage: 1 @@ -747,6 +758,52 @@ MeshFilter: m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 977189304} m_Mesh: {fileID: 10209, guid: 0000000000000000e000000000000000, type: 0} +--- !u!1 &1053010137 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1053010138} + - component: {fileID: 1053010139} + m_Layer: 0 + m_Name: LoadController + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &1053010138 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1053010137} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 1327253820} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!114 &1053010139 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1053010137} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: f7bcc5590936f7f47b649330a9e963f9, type: 3} + m_Name: + m_EditorClassIdentifier: + GeneralController: {fileID: 1327253821} + LoadingScreen: {fileID: 1109753673} --- !u!1 &1060248221 GameObject: m_ObjectHideFlags: 0 @@ -775,6 +832,7 @@ Transform: m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} m_LocalPosition: {x: 0, y: 0, z: 0} m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 m_Children: [] m_Father: {fileID: 1488385698} m_RootOrder: 0 @@ -923,10 +981,11 @@ RectTransform: m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} m_LocalPosition: {x: 0, y: 0, z: 0} m_LocalScale: {x: 0, y: 0, z: 0} + m_ConstrainProportionsScale: 0 m_Children: - {fileID: 206473931} m_Father: {fileID: 0} - m_RootOrder: 8 + m_RootOrder: 9 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0, y: 0} m_AnchorMax: {x: 0, y: 0} @@ -961,6 +1020,7 @@ RectTransform: m_LocalRotation: {x: -0, y: 0.7071068, z: -0.7071068, w: 0} m_LocalPosition: {x: 0, y: 0, z: 0} m_LocalScale: {x: 40.000034, y: 0, z: 30.000013} + m_ConstrainProportionsScale: 0 m_Children: [] m_Father: {fileID: 1781294053} m_RootOrder: 3 @@ -981,6 +1041,7 @@ MeshRenderer: m_CastShadows: 0 m_ReceiveShadows: 0 m_DynamicOccludee: 0 + m_StaticShadowCaster: 0 m_MotionVectors: 1 m_LightProbeUsage: 1 m_ReflectionProbeUsage: 1 @@ -1047,6 +1108,7 @@ RectTransform: m_LocalRotation: {x: -0, y: 0.7071068, z: -0.7071068, w: 0} m_LocalPosition: {x: 0, y: 0, z: 0} m_LocalScale: {x: 40.000034, y: 0, z: 30.000013} + m_ConstrainProportionsScale: 0 m_Children: [] m_Father: {fileID: 1781294053} m_RootOrder: 2 @@ -1067,6 +1129,7 @@ MeshRenderer: m_CastShadows: 0 m_ReceiveShadows: 0 m_DynamicOccludee: 0 + m_StaticShadowCaster: 0 m_MotionVectors: 1 m_LightProbeUsage: 1 m_ReflectionProbeUsage: 1 @@ -1105,6 +1168,54 @@ MeshFilter: m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 1162811862} m_Mesh: {fileID: 10209, guid: 0000000000000000e000000000000000, type: 0} +--- !u!1 &1327253819 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1327253820} + - component: {fileID: 1327253821} + m_Layer: 0 + m_Name: GeneralController + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &1327253820 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1327253819} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: + - {fileID: 1053010138} + - {fileID: 1526339981} + m_Father: {fileID: 0} + m_RootOrder: 2 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!114 &1327253821 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1327253819} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 96b90063245454341acec5c8c125079e, type: 3} + m_Name: + m_EditorClassIdentifier: + LoadController: {fileID: 1053010139} + EnvironmentController: {fileID: 1526339982} --- !u!1 &1372588407 GameObject: m_ObjectHideFlags: 0 @@ -1133,6 +1244,7 @@ RectTransform: m_LocalRotation: {x: -0, y: 0.7071068, z: -0.7071068, w: 0} m_LocalPosition: {x: 0, y: 0, z: 0} m_LocalScale: {x: 40.000034, y: 0, z: 30.000013} + m_ConstrainProportionsScale: 0 m_Children: [] m_Father: {fileID: 1781294053} m_RootOrder: 0 @@ -1153,6 +1265,7 @@ MeshRenderer: m_CastShadows: 0 m_ReceiveShadows: 0 m_DynamicOccludee: 0 + m_StaticShadowCaster: 0 m_MotionVectors: 1 m_LightProbeUsage: 1 m_ReflectionProbeUsage: 1 @@ -1261,6 +1374,7 @@ RectTransform: m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} m_LocalPosition: {x: 0, y: 0, z: 0} m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 m_Children: [] m_Father: {fileID: 206473931} m_RootOrder: 0 @@ -1425,6 +1539,7 @@ Transform: m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} m_LocalPosition: {x: 0, y: 1, z: -10} m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 m_Children: - {fileID: 1060248222} m_Father: {fileID: 0} @@ -1566,10 +1681,59 @@ Transform: m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} m_LocalPosition: {x: 0, y: 0, z: 0} m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 m_Children: [] m_Father: {fileID: 0} - m_RootOrder: 3 + m_RootOrder: 4 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!1 &1526339980 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1526339981} + - component: {fileID: 1526339982} + m_Layer: 0 + m_Name: EnvironmentController + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &1526339981 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1526339980} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 1327253820} + m_RootOrder: 1 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!114 &1526339982 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1526339980} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: a32d85486c07ec94c87f74cf1afb8496, type: 3} + m_Name: + m_EditorClassIdentifier: + GeneralController: {fileID: 1327253821} + Environments: + - Key: CPA + Value: {fileID: 3651640777840233374, guid: fcd3413973d6ae843b2ad798a13b0eab, type: 3} --- !u!1 &1701416320 GameObject: m_ObjectHideFlags: 0 @@ -1584,7 +1748,7 @@ GameObject: - component: {fileID: 1701416324} - component: {fileID: 1701416325} m_Layer: 0 - m_Name: Loader + m_Name: LegacyController m_TagString: Untagged m_Icon: {fileID: 0} m_NavMeshLayer: 0 @@ -1597,11 +1761,12 @@ MonoBehaviour: m_PrefabInstance: {fileID: 0} m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 1701416320} - m_Enabled: 1 + m_Enabled: 0 m_EditorHideFlags: 0 m_Script: {fileID: 11500000, guid: 5af587f4a54f84c42ae16a9378ca8d57, type: 3} m_Name: m_EditorClassIdentifier: + LoadController: {fileID: 1053010139} baseMaterial: {fileID: 2100000, guid: 4c445331ca6381a44bb772fa126abb28, type: 2} baseTransparentMaterial: {fileID: 2100000, guid: f72b6a2550e50034d9212047304245fa, type: 2} @@ -1613,7 +1778,6 @@ MonoBehaviour: lightManager: {fileID: 1503682888} graphManager: {fileID: 486948330} portalManager: {fileID: 469719539} - loadingScreen: {fileID: 1109753673} selector: {fileID: 1701416324} communicator: {fileID: 1701416323} recordingToolPrefab: {fileID: 1480293497455159104, guid: 48ea7c4467298b14d8d04c8030a417f3, @@ -1637,9 +1801,10 @@ Transform: m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} m_LocalPosition: {x: 0, y: 0, z: 0} m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 m_Children: [] m_Father: {fileID: 0} - m_RootOrder: 2 + m_RootOrder: 3 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} --- !u!114 &1701416323 MonoBehaviour: @@ -1719,6 +1884,7 @@ RectTransform: m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} m_LocalPosition: {x: 0, y: 0, z: 0} m_LocalScale: {x: 1, y: -1, z: 1} + m_ConstrainProportionsScale: 0 m_Children: - {fileID: 1372588408} - {fileID: 977189305} @@ -1742,7 +1908,7 @@ PrefabInstance: - target: {fileID: 2063525992950823175, guid: b83e6f5b0086e0a4496f62d4407247d7, type: 3} propertyPath: m_RootOrder - value: 9 + value: 10 objectReference: {fileID: 0} - target: {fileID: 2063525992950823175, guid: b83e6f5b0086e0a4496f62d4407247d7, type: 3} diff --git a/Assets/Scripts/BinarySerializer.meta b/Assets/Scripts/BinarySerializer.meta new file mode 100644 index 00000000..c01099df --- /dev/null +++ b/Assets/Scripts/BinarySerializer.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 0fa39e2f3d53b9d4596897541d166fd8 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/BinarySerializer/ContextExtensions.cs b/Assets/Scripts/BinarySerializer/ContextExtensions.cs new file mode 100644 index 00000000..d8e69998 --- /dev/null +++ b/Assets/Scripts/BinarySerializer/ContextExtensions.cs @@ -0,0 +1,14 @@ +using BinarySerializer; + +namespace Raymap { + public static class ContextExtensions { + public static MapViewerSettings GetMapViewerSettings(this SerializerObject s) => s.Context.GetMapViewerSettings(); + public static MapViewerSettings GetMapViewerSettings(this Context c) => c.GetSettings(); + + public static Unity_Level GetUnityLevel(this SerializerObject s) => s.Context.GetUnityLevel(); + public static Unity_Level GetUnityLevel(this Context c) => c.GetStoredObject(Unity_Level.ContextKey, throwIfNotFound: true); + + public static Unity_Environment GetUnityEnvironment(this SerializerObject s) => s.Context.GetUnityEnvironment(); + public static Unity_Environment GetUnityEnvironment(this Context c) => c.GetStoredObject(Unity_Environment.ContextKey, throwIfNotFound: true); + } +} diff --git a/Assets/Scripts/OpenSpace/General/Settings.cs.meta b/Assets/Scripts/BinarySerializer/ContextExtensions.cs.meta similarity index 83% rename from Assets/Scripts/OpenSpace/General/Settings.cs.meta rename to Assets/Scripts/BinarySerializer/ContextExtensions.cs.meta index 6600e839..e2c7f3fa 100644 --- a/Assets/Scripts/OpenSpace/General/Settings.cs.meta +++ b/Assets/Scripts/BinarySerializer/ContextExtensions.cs.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: e7f62941384993d418e322fe9e5cec2f +guid: 67dc5fcee34ea1640983fddcb4e501ac MonoImporter: externalObjects: {} serializedVersion: 2 diff --git a/Assets/Scripts/BinarySerializer/MapViewerContext.cs b/Assets/Scripts/BinarySerializer/MapViewerContext.cs new file mode 100644 index 00000000..971b9cca --- /dev/null +++ b/Assets/Scripts/BinarySerializer/MapViewerContext.cs @@ -0,0 +1,29 @@ +using BinarySerializer; +using BinarySerializer.Unity; + +namespace Raymap +{ + public class MapViewerContext : Context { + + public MapViewerContext(string basePath, MapViewerSettings settings, bool log = true) : base( + basePath: basePath, // Pass in the base path + settings: new MapViewerSerializerSettings(), // Pass in the settings + serializerLog: log ? new MapViewerSerializerLog() : null, // Use map viewer serializer log for logging to a file + fileManager: new MapViewerFileManager(), // Use map viewer file manager for use with FileSystem + logger: new UnityLogger()) // Use Unity logger + { + // Add the game settings + AddSettings(settings); + + // Add an editor GUI serializer config + this.AddEditorGUISerializerConfig(new EditorGUISerializerConfig()); + + // Add settings and pointers from the current manager + settings.GetGameManager.AddContextSettings(this); + settings.GetGameManager.AddContextPointers(this); + } + public MapViewerContext(MapViewerSettings settings, bool log = true) : this(settings.GameDirectory, settings, log: log) { } + + public MapViewerSettings GameSettings => GetSettings(); + } +} \ No newline at end of file diff --git a/Assets/Scripts/Libraries/UnityConverters/Helpers/NullableAttributes.cs.meta b/Assets/Scripts/BinarySerializer/MapViewerContext.cs.meta similarity index 83% rename from Assets/Scripts/Libraries/UnityConverters/Helpers/NullableAttributes.cs.meta rename to Assets/Scripts/BinarySerializer/MapViewerContext.cs.meta index 568a25b8..5360e003 100644 --- a/Assets/Scripts/Libraries/UnityConverters/Helpers/NullableAttributes.cs.meta +++ b/Assets/Scripts/BinarySerializer/MapViewerContext.cs.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: 6d204313f888a2e4d9ce61192bb09b2c +guid: 7df285140500aa347a21b4de1e56a5c5 MonoImporter: externalObjects: {} serializedVersion: 2 diff --git a/Assets/Scripts/BinarySerializer/MapViewerFileManager.cs b/Assets/Scripts/BinarySerializer/MapViewerFileManager.cs new file mode 100644 index 00000000..95e15e0a --- /dev/null +++ b/Assets/Scripts/BinarySerializer/MapViewerFileManager.cs @@ -0,0 +1,26 @@ +using System.IO; +using System.Threading.Tasks; +using BinarySerializer; +using BinarySerializer.Unity; + +namespace Raymap +{ + public class MapViewerFileManager : IFileManager + { + public PathSeparatorChar SeparatorCharacter => PathSeparatorChar.ForwardSlash; + + public bool DirectoryExists(string path) => FileSystem.DirectoryExists(path); + + public bool FileExists(string path) => FileSystem.FileExists(path); + + public Stream GetFileReadStream(string path) => FileSystem.GetFileReadStream(path); + + public Stream GetFileWriteStream(string path, bool recreateOnWrite = true) => FileSystem.GetFileWriteStream(path, recreateOnWrite); + + public async Task FillCacheForReadAsync(long length, Reader reader) + { + if (reader.BaseStream.InnerStream is PartialHttpStream httpStream) + await httpStream.FillCacheForRead(length); + } + } +} \ No newline at end of file diff --git a/Assets/Scripts/BinarySerializer/MapViewerFileManager.cs.meta b/Assets/Scripts/BinarySerializer/MapViewerFileManager.cs.meta new file mode 100644 index 00000000..f2d6beb9 --- /dev/null +++ b/Assets/Scripts/BinarySerializer/MapViewerFileManager.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 91d7f53202d10a248871cd4c3744257b +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/BinarySerializer/MapViewerSerializerLog.cs b/Assets/Scripts/BinarySerializer/MapViewerSerializerLog.cs new file mode 100644 index 00000000..0bbe36f0 --- /dev/null +++ b/Assets/Scripts/BinarySerializer/MapViewerSerializerLog.cs @@ -0,0 +1,36 @@ +using System.IO; +using System.Text; +using BinarySerializer; + +namespace Raymap +{ + public class MapViewerSerializerLog : ISerializerLog + { + public bool IsEnabled => UnitySettings.Log; + + private StreamWriter _logWriter; + + protected StreamWriter LogWriter => _logWriter ??= GetFile(); + + public string OverrideLogPath { get; set; } + public string LogFile => OverrideLogPath ?? UnitySettings.LogFile; + public int BufferSize => 0x8000000; // 1 GB + + public StreamWriter GetFile() + { + return new StreamWriter(File.Open(LogFile, FileMode.Create, FileAccess.Write, FileShare.ReadWrite), Encoding.UTF8, BufferSize); + } + + public void Log(object obj) + { + if (IsEnabled) + LogWriter.WriteLine(obj != null ? obj.ToString() : ""); + } + + public void Dispose() + { + _logWriter?.Dispose(); + _logWriter = null; + } + } +} \ No newline at end of file diff --git a/Assets/Scripts/BinarySerializer/MapViewerSerializerLog.cs.meta b/Assets/Scripts/BinarySerializer/MapViewerSerializerLog.cs.meta new file mode 100644 index 00000000..552ad611 --- /dev/null +++ b/Assets/Scripts/BinarySerializer/MapViewerSerializerLog.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 58b6026330683d647ac93c6034785910 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/BinarySerializer/MapViewerSerializerSettings.cs b/Assets/Scripts/BinarySerializer/MapViewerSerializerSettings.cs new file mode 100644 index 00000000..fcd4842d --- /dev/null +++ b/Assets/Scripts/BinarySerializer/MapViewerSerializerSettings.cs @@ -0,0 +1,36 @@ +using System.Text; +using BinarySerializer; +using OpenSpace; + +namespace Raymap +{ + public class MapViewerSerializerSettings : ISerializerSettings + { + /// + /// The default string encoding to use when none is specified + /// + public Encoding DefaultStringEncoding => Encoding.GetEncoding(1252); + + /// + /// Indicates if a backup file should be created when writing to a file + /// + public bool CreateBackupOnWrite => UnitySettings.BackupFiles; + + /// + /// Indicates if pointers should be saved in the Memory Map for relocation + /// + public bool SavePointersForRelocation => false; + + /// + /// Indicates if caching read objects should be ignored + /// + public bool IgnoreCacheOnRead => false; + + /// + /// The pointer size to use when logging a . Set to to dynamically determine the appropriate size. + /// + public PointerSize? LoggingPointerSize => PointerSize.Pointer32; + + public Endian DefaultEndianness => Endian.Little; + } +} \ No newline at end of file diff --git a/Assets/Scripts/BinarySerializer/MapViewerSerializerSettings.cs.meta b/Assets/Scripts/BinarySerializer/MapViewerSerializerSettings.cs.meta new file mode 100644 index 00000000..4441f9b8 --- /dev/null +++ b/Assets/Scripts/BinarySerializer/MapViewerSerializerSettings.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 478fd5087947f8b428692aeb6ba0a7e7 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/BinarySerializer/UnityLogger.cs b/Assets/Scripts/BinarySerializer/UnityLogger.cs new file mode 100644 index 00000000..d3b3c010 --- /dev/null +++ b/Assets/Scripts/BinarySerializer/UnityLogger.cs @@ -0,0 +1,13 @@ +using System; +using UnityEngine; +using ILogger = BinarySerializer.ILogger; + +namespace Raymap +{ + public class UnityLogger : ILogger + { + public void Log(object log, params object[] args) => Debug.Log(String.Format(log?.ToString() ?? String.Empty, args)); + public void LogWarning(object log, params object[] args) => Debug.LogWarning(String.Format(log?.ToString() ?? String.Empty, args)); + public void LogError(object log, params object[] args) => Debug.LogError(String.Format(log?.ToString() ?? String.Empty, args)); + } +} \ No newline at end of file diff --git a/Assets/Scripts/BinarySerializer/UnityLogger.cs.meta b/Assets/Scripts/BinarySerializer/UnityLogger.cs.meta new file mode 100644 index 00000000..6752bebd --- /dev/null +++ b/Assets/Scripts/BinarySerializer/UnityLogger.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 4e2eddebb57d59e4695da3a47cdae0b4 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Editor/CETableBuilder.cs b/Assets/Scripts/Editor/CETableBuilder.cs index 5cf74219..0f1b1ffb 100644 --- a/Assets/Scripts/Editor/CETableBuilder.cs +++ b/Assets/Scripts/Editor/CETableBuilder.cs @@ -30,12 +30,12 @@ private static string VarTypeToString(CEVarType type) public struct TableEntry { public string Name; - public Pointer Address; + public LegacyPointer Address; public CEVarType Type; public bool ShowAsHex; public List Children; - public TableEntry(string name, Pointer address, CEVarType type, bool showAsHex) : this() + public TableEntry(string name, LegacyPointer address, CEVarType type, bool showAsHex) : this() { Name = name; Address = address; diff --git a/Assets/Scripts/Editor/Dropdowns/GameModeSelectionDropdown.cs b/Assets/Scripts/Editor/Dropdowns/GameModeSelectionDropdown.cs index 96d02282..90f92770 100644 --- a/Assets/Scripts/Editor/Dropdowns/GameModeSelectionDropdown.cs +++ b/Assets/Scripts/Editor/Dropdowns/GameModeSelectionDropdown.cs @@ -1,5 +1,6 @@ using BinarySerializer; -using OpenSpace; +using BinarySerializer.Unity; +using Raymap; using System.Linq; using UnityEditor.IMGUI.Controls; using UnityEngine; @@ -10,29 +11,40 @@ public GameModeSelectionDropdown(AdvancedDropdownState state) : base(state) { } protected override AdvancedDropdownItem BuildRoot() { - var modes = EnumHelpers.GetValues().Select(x => new { - Mode = x, - Settings = Settings.GetSettings(x) - }).GroupBy(x => x.Settings.engineVersion); + var modes = EnumHelpers.GetValues().Select(x => new { + GameModeSelection = x, + GameModeAttribute = x.GetAttribute(), + EngineCategoryAttribute = x.GetAttribute() + .Category.GetAttribute(), + EngineAttribute = x.GetAttribute() + .Category.GetAttribute() + .Engine.GetAttribute(), + + }) + .GroupBy(x => x.GameModeAttribute.Category) + .GroupBy(x => x.FirstOrDefault().EngineCategoryAttribute.Engine); var root = new AdvancedDropdownItem("Game"); - foreach (var mode in modes) { - var group = new AdvancedDropdownItem(mode.Key.ToString()) { + foreach (var engineGroup in modes) { + var engineNode = new AdvancedDropdownItem(engineGroup.Key.GetAttribute().DisplayName) { id = -1 }; - foreach (var selectionGroup in mode.GroupBy(x => x.Settings.game)) { - foreach (var selection in selectionGroup) { - group.AddChild(new AdvancedDropdownItem(selection.Settings.DisplayName) { - id = (int)selection.Mode + foreach (var categoryGroup in engineGroup) { + var categoryNode = new AdvancedDropdownItem(categoryGroup.Key.GetAttribute().DisplayName) { + id = -1 + }; + foreach (var mode in categoryGroup) { + categoryNode.AddChild(new AdvancedDropdownItem(mode.GameModeAttribute.DisplayName) { + id = (int)mode.GameModeSelection }); } - - group.AddSeparator(); + // engineNode.AddSeparator(); + engineNode.AddChild(categoryNode); } - root.AddChild(group); + root.AddChild(engineNode); } return root; @@ -41,14 +53,14 @@ protected override AdvancedDropdownItem BuildRoot() { protected override void ItemSelected(AdvancedDropdownItem item) { base.ItemSelected(item); - if (item.id != -1 && ((Settings.Mode)item.id != Selection)) { - Selection = (Settings.Mode)item.id; - SelectionName = Selection.GetDescription(); + if (item.id != -1 && ((GameModeSelection)item.id != Selection)) { + Selection = (GameModeSelection)item.id; + SelectionName = Selection.GetAttribute().DisplayName; HasChanged = true; } } public bool HasChanged { get; set; } - public Settings.Mode Selection { get; set; } = UnitySettings.GameMode; - public string SelectionName { get; set; } = UnitySettings.GameMode.GetDescription(); + public GameModeSelection Selection { get; set; } = UnitySettings.SelectedGameMode; + public string SelectionName { get; set; } = UnitySettings.SelectedGameMode.GetAttribute().DisplayName; } \ No newline at end of file diff --git a/Assets/Scripts/Editor/Dropdowns/MapSelectionDropdown.cs b/Assets/Scripts/Editor/Dropdowns/MapSelectionDropdown.cs index 8b249317..b5b2bbd6 100644 --- a/Assets/Scripts/Editor/Dropdowns/MapSelectionDropdown.cs +++ b/Assets/Scripts/Editor/Dropdowns/MapSelectionDropdown.cs @@ -1,159 +1,92 @@ - -using UnityEditor.IMGUI.Controls; +using Raymap; +using System; using System.Collections.Generic; using System.Linq; -using OpenSpace; -using System.IO; +using UnityEditor.IMGUI.Controls; using UnityEngine; -using OpenSpace.Loader; - -class MapSelectionDropdown : AdvancedDropdown { - public static string[] filterPaths = new string[] { - "fix", - /*"ani0", - "ani1", - "ani2", - "ani3", - "ani4", - "ani5", - "ani6", - "ani7", - "ani8", - "ani9", - "ani10",*/ - }; - public string selection = null; - public string directory; - public Settings.Mode mode; - public string[] files; - public string[] translatedFiles; - public string name; - //public SerializedProperty property; - - public MapSelectionDropdown(AdvancedDropdownState state) : base(state) { - minimumSize = new UnityEngine.Vector2(50, 400f); - } - public MapSelectionDropdown(AdvancedDropdownState state, string directory) : this(state) { - this.directory = directory; - BuildFileList(); - } - - private void BuildFileList() { - List filesUnprocessed = FindFiles(); - List filesSorted = filesUnprocessed; - if (UnitySettings.UseLevelTranslation && Settings.s.levelTranslation != null) { - filesSorted = Settings.s.levelTranslation.Sort(filesSorted); - translatedFiles = Settings.s.levelTranslation.Translate(filesSorted).ToArray(); - } - files = filesSorted.ToArray(); - } - - private List FindFiles() { - // Create the output - var output = new List(); - - // If the directory does not exist, return the empty list - if (!Directory.Exists(directory)) - return output; - - // Add the found files containing the correct file extension - string extension = null; - string[] levels; - switch (Settings.s.platform) { - case Settings.Platform.PC: - case Settings.Platform.iOS: - case Settings.Platform.GC: - case Settings.Platform.Xbox: - case Settings.Platform.Xbox360: - case Settings.Platform.PS3: - case Settings.Platform.MacOS: - if (Settings.s.engineVersion < Settings.EngineVersion.R3) { - extension = "*.sna"; - } else { - extension = "*.lvl"; - } - break; - case Settings.Platform.DC: extension = "*.DAT"; break; - case Settings.Platform.PS2: - if (Settings.s.engineVersion < Settings.EngineVersion.R3) { - if (Settings.s.engineVersion < Settings.EngineVersion.R2) { - extension = "*.sna"; - } else { - extension = "*.lv2"; - } - } else { - extension = "*.lvl"; - } - break; - case Settings.Platform.PS1: - MapLoader.Reset(); - R2PS1Loader l1 = MapLoader.Loader as R2PS1Loader; - l1.gameDataBinFolder = directory; - levels = l1.LoadLevelList(); - MapLoader.Reset(); - output.AddRange(levels); - break; - case Settings.Platform.DS: - case Settings.Platform.N64: - case Settings.Platform._3DS: - MapLoader.Reset(); - R2ROMLoader lr = MapLoader.Loader as R2ROMLoader; - lr.gameDataBinFolder = directory; - levels = lr.LoadLevelList(); - MapLoader.Reset(); - output.AddRange(levels); - break; - } - if (extension != null) { - output.AddRange( - from file in Directory.EnumerateFiles(directory, extension, SearchOption.AllDirectories) - let filename = Path.GetFileNameWithoutExtension(file) - let dirname = new DirectoryInfo(file).Parent.Name - where ((!filterPaths.Contains(filename.ToLower())) - && dirname.ToLower() == filename.ToLower()) - select dirname - - ); - } - //Debug.Log(string.Join("\n",output)); - - // Return the output - return output; - } - - protected override AdvancedDropdownItem BuildRoot() { - var root = new AdvancedDropdownItem(name); - for (int i = 0; i < files.Length; i++) { - Add(root, files[i], files[i], translatedFiles?[i], i); - } - - return root; - } - - protected void Add(AdvancedDropdownItem parent, string path, string fullPath, string translation, int id) { - if (path.Contains("/")) { - // Folder - string folder = path.Substring(0, path.IndexOf("/")); - string rest = path.Substring(path.IndexOf("/") + 1); - AdvancedDropdownItem folderNode = parent.children.FirstOrDefault(c => c.name == folder); - if (folderNode == null) { - folderNode = new AdvancedDropdownItem(folder); - parent.AddChild(folderNode); - } - Add(folderNode, rest, fullPath, translation, id); - } else { - // File - parent.AddChild(new AdvancedDropdownItem(translation ?? path) { - id = id - }); - } - } - - protected override void ItemSelected(AdvancedDropdownItem item) { - base.ItemSelected(item); - if (item.children.Count() == 0 && files != null && files.Length > item.id) { - selection = files[item.id]; - //property.stringValue = selection; - } - } -} + +public class MapSelectionDropdown : AdvancedDropdown { + public MapSelectionDropdown(AdvancedDropdownState state, MapTreeNode mapTree) : base(state) { + MapTree = mapTree; + FlattenedMapTree = MapTree.GetMaps().ToArray(); + SelectedMap = FlattenedMapTree.FirstOrDefault(t => t.Id.ToLower() == UnitySettings.MapName.ToLower()); + if(SelectedMap == null) SelectedMap = FlattenedMapTree.FirstOrDefault(); + + minimumSize = new Vector2(50, 400f); + } + + protected override AdvancedDropdownItem BuildRoot() { + var root = new AdvancedDropdownItem("Map"); + + foreach (var node in MapTree.Children) { + AddNode(root, node); + } + + return root; + } + + public string GetName(MapTreeNode node) { + if (node.Id == null) { + return node.DisplayName; + } else if (node.DisplayName == null || node.DisplayName == node.Id) { + return node.Id; + } else { + return $"{node.Id} - {node.DisplayName}"; + } + } + + protected AdvancedDropdownItem AddNode(AdvancedDropdownItem parent, MapTreeNode node) { + AdvancedDropdownItem curDropdownItem = new MapSelectionDropdownItem(GetName(node), node); + if (node.Children == null) { + curDropdownItem.id = Array.IndexOf(FlattenedMapTree, node); + } else { + curDropdownItem.id = -1; + } + parent.AddChild(curDropdownItem); + if (node.Children != null) { + foreach (var child in node.Children) AddNode(curDropdownItem, child); + } + + return parent; + } + + protected override void ItemSelected(AdvancedDropdownItem item) { + base.ItemSelected(item); + + if (item.id == -1 || !(item is MapSelectionDropdownItem mapItem) || !mapItem.IsMap) + return; + + SelectedMap = mapItem.MapTreeNode; + HasChanged = true; + } + + public void NextMap() { + if(FlattenedMapTree == null || FlattenedMapTree.Length == 0) return; + var index = (Array.IndexOf(FlattenedMapTree, SelectedMap) + 1) % FlattenedMapTree.Length; + SelectedMap = FlattenedMapTree[index]; + HasChanged = true; + } + + public void PreviousMap() { + if (FlattenedMapTree == null || FlattenedMapTree.Length == 0) return; + var index = (Array.IndexOf(FlattenedMapTree, SelectedMap) - 1 + FlattenedMapTree.Length) % FlattenedMapTree.Length; + SelectedMap = FlattenedMapTree[index]; + HasChanged = true; + } + + public MapTreeNode MapTree { get; set; } + public MapTreeNode[] FlattenedMapTree { get; set; } + + public bool HasChanged { get; set; } + + public MapTreeNode SelectedMap { get; set; } + + public class MapSelectionDropdownItem : AdvancedDropdownItem { + public MapSelectionDropdownItem(string name, MapTreeNode mapTreeNode) : base(name) { + MapTreeNode = mapTreeNode; + } + + public MapTreeNode MapTreeNode { get; set; } + public bool IsMap => MapTreeNode.Children == null || !MapTreeNode.Children.Any(); + } +} \ No newline at end of file diff --git a/Assets/Scripts/Editor/Dropdowns/PS1ActorSelectionDropdown.cs b/Assets/Scripts/Editor/Dropdowns/PS1ActorSelectionDropdown.cs index 2c508f52..22e5d564 100644 --- a/Assets/Scripts/Editor/Dropdowns/PS1ActorSelectionDropdown.cs +++ b/Assets/Scripts/Editor/Dropdowns/PS1ActorSelectionDropdown.cs @@ -9,13 +9,13 @@ class PS1ActorSelectionDropdown : AdvancedDropdown { public string selection = null; - public Settings.Mode mode; + public Legacy_Settings.Mode mode; public string name; public string[] actors; public int actorIndex; //public SerializedProperty property; - public PS1ActorSelectionDropdown(AdvancedDropdownState state, Settings.Mode mode, int actorIndex) : base(state) { + public PS1ActorSelectionDropdown(AdvancedDropdownState state, Legacy_Settings.Mode mode, int actorIndex) : base(state) { this.mode = mode; this.actorIndex = actorIndex; minimumSize = new UnityEngine.Vector2(50, 300f); diff --git a/Assets/Scripts/Editor/DsgVarComponentEditor.cs b/Assets/Scripts/Editor/DsgVarComponentEditor.cs index ea8ddb70..6359ea1f 100644 --- a/Assets/Scripts/Editor/DsgVarComponentEditor.cs +++ b/Assets/Scripts/Editor/DsgVarComponentEditor.cs @@ -70,7 +70,7 @@ public override void OnInspectorGUI() { DsgMem dsgMem = c.dsgMem; foreach (DsgVarComponent.DsgVarEditableEntry dsgVarEntry in c.editableEntries) { - Pointer offsetOfValue = (dsgMem.memBuffer + dsgVarEntry.entry.offsetInBuffer); + LegacyPointer offsetOfValue = (dsgMem.memBuffer + dsgVarEntry.entry.offsetInBuffer); printResult += dsgVarEntry.entry.NiceVariableName + " " + offsetOfValue +Environment.NewLine; } @@ -83,7 +83,7 @@ public override void OnInspectorGUI() { DsgMem dsgMem = c.dsgMem; foreach (DsgVarComponent.DsgVarEditableEntry dsgVarEntry in c.editableEntries) { - Pointer offsetOfValue = (dsgMem.memBuffer + dsgVarEntry.entry.offsetInBuffer); + LegacyPointer offsetOfValue = (dsgMem.memBuffer + dsgVarEntry.entry.offsetInBuffer); string variableType; switch (dsgVarEntry.Type) { diff --git a/Assets/Scripts/Editor/PointerTraceMenu.cs b/Assets/Scripts/Editor/PointerTraceMenu.cs index e2da5c83..b2b18489 100644 --- a/Assets/Scripts/Editor/PointerTraceMenu.cs +++ b/Assets/Scripts/Editor/PointerTraceMenu.cs @@ -16,7 +16,7 @@ public class PointerTraceWindow : EditorWindow Vector2 scrollPos = new Vector2(); string searchString = ""; - private List> results; + private List> results; private bool searched = false; private int resultCount = 0; private static int resultLimit = 1000; @@ -36,7 +36,7 @@ void OnGUI() EditorGUILayout.HelpBox("To use this window, enable \"Trace Pointers\" in the settings window.", MessageType.Info); return; } - if (!EditorApplication.isPlaying || Settings.s == null) + if (!EditorApplication.isPlaying || Legacy_Settings.s == null) { EditorGUILayout.HelpBox("Please start the scene to use this window.", MessageType.Info); return; diff --git a/Assets/Scripts/Editor/RecordingToolMenu.cs b/Assets/Scripts/Editor/RecordingToolMenu.cs index 25b9d018..123e9f30 100644 --- a/Assets/Scripts/Editor/RecordingToolMenu.cs +++ b/Assets/Scripts/Editor/RecordingToolMenu.cs @@ -25,7 +25,7 @@ public static void Init() void OnGUI() { - if (!EditorApplication.isPlaying || Settings.s == null) { + if (!EditorApplication.isPlaying || Legacy_Settings.s == null) { EditorGUILayout.HelpBox("Please start the scene to use this window.", MessageType.Info); t = null; return; diff --git a/Assets/Scripts/Editor/ReferencesMenu.cs b/Assets/Scripts/Editor/ReferencesMenu.cs index f3fb7027..55c831db 100644 --- a/Assets/Scripts/Editor/ReferencesMenu.cs +++ b/Assets/Scripts/Editor/ReferencesMenu.cs @@ -59,7 +59,7 @@ public static void Init() void OnGUI() { - if (!EditorApplication.isPlaying || Settings.s == null) { + if (!EditorApplication.isPlaying || Legacy_Settings.s == null) { EditorGUILayout.HelpBox("Please start the scene to use this window.", MessageType.Info); hasResults = false; return; diff --git a/Assets/Scripts/Editor/TreeView/DsgVarsTreeView.cs b/Assets/Scripts/Editor/TreeView/DsgVarsTreeView.cs index fc29ee5a..f03193ac 100644 --- a/Assets/Scripts/Editor/TreeView/DsgVarsTreeView.cs +++ b/Assets/Scripts/Editor/TreeView/DsgVarsTreeView.cs @@ -79,7 +79,9 @@ public enum Columns Name, CurrentValue, InitialValue, - ModelValue + ModelValue, + SaveType, + InitType } public static void TreeToList (TreeViewItem root, IList result) @@ -210,6 +212,12 @@ void CellGUI (Rect cellRect, TreeViewItem item, Columns colu case Columns.ModelValue: DsgVarComponentEditor.DrawDsgVarModel(cellRect, item.data.entry, item.data.arrayIndex); break; + case Columns.SaveType: + GUI.Label(cellRect, new GUIContent(item.data.entry.SaveType), EditorStyles.miniLabel); + break; + case Columns.InitType: + GUI.Label(cellRect, new GUIContent(item.data.entry.InitType), EditorStyles.miniLabel); + break; } } @@ -293,6 +301,28 @@ public static MultiColumnHeaderState CreateDefaultMultiColumnHeaderState(float t autoResize = true, allowToggleVisibility = false }, + new MultiColumnHeaderState.Column + { + headerContent = new GUIContent("SaveType", ""), + headerTextAlignment = TextAlignment.Left, + canSort = false, + width = 60, + minWidth = 40, + maxWidth = 120, + autoResize = true, + allowToggleVisibility = false + }, + new MultiColumnHeaderState.Column + { + headerContent = new GUIContent("InitType", ""), + headerTextAlignment = TextAlignment.Left, + canSort = false, + width = 60, + minWidth = 40, + maxWidth = 120, + autoResize = true, + allowToggleVisibility = false + }, }; Assert.AreEqual(columns.Length, Enum.GetValues(typeof(Columns)).Length, "Number of columns should match number of enum values: You probably forgot to update one of them."); diff --git a/Assets/Scripts/Editor/Windows/UnityWindow.cs b/Assets/Scripts/Editor/Windows/UnityWindow.cs index 0bfadac4..8387ead2 100644 --- a/Assets/Scripts/Editor/Windows/UnityWindow.cs +++ b/Assets/Scripts/Editor/Windows/UnityWindow.cs @@ -7,6 +7,7 @@ using UnityEditor; using UnityEngine; using BinarySerializer; +using BinarySerializer.Unity; public class UnityWindow : EditorWindow { public Rect GetNextRect(ref float yPos, float padding = 4f, float height = 0f, float vPadding = 0f, float vPaddingBottom = 0f, bool ignoreIndent = false) { @@ -81,14 +82,16 @@ public string FileField(Rect rect, string title, string value, bool save, string string directory = ""; string defaultName = ""; - if (!string.IsNullOrEmpty(value)) { + if (!String.IsNullOrEmpty(value)) { directory = Path.GetFileName(Path.GetFullPath(value)); defaultName = Path.GetFileName(value); } - var file = save ? EditorUtility.SaveFilePanel(title, directory, defaultName, extension) : EditorUtility.OpenFilePanel(title, directory, extension); + var file = save + ? EditorUtility.SaveFilePanel(title, directory, defaultName, extension) + : EditorUtility.OpenFilePanel(title, directory, extension); - if (!string.IsNullOrEmpty(file)) { + if (!String.IsNullOrEmpty(file)) { GUI.FocusControl("Button " + title); value = file; Dirty = true; @@ -97,7 +100,14 @@ public string FileField(Rect rect, string title, string value, bool save, string rect = new Rect(rect.x, rect.y, rect.width - ButtonWidth, rect.height); - value = !includeLabel ? EditorGUI.TextField(rect, value) : EditorGUI.TextField(rect, new GUIContent(title), value); + BrowseButton(rect, title, EditorGUIUtility.IconContent("UpArrow"), () => { + if (File.Exists(value)) + Process.Start(value); + }, ButtonWidth); + + rect = new Rect(rect.x, rect.y, rect.width - ButtonWidth, rect.height); + + value = !includeLabel ? EditorGUI.TextField(rect, value) : EditorGUI.TextField(rect, new GUIContent(title, title), value); return value; } diff --git a/Assets/Scripts/Editor/Windows/UnityWindowSearch.cs b/Assets/Scripts/Editor/Windows/UnityWindowSearch.cs index c032418a..9d829111 100644 --- a/Assets/Scripts/Editor/Windows/UnityWindowSearch.cs +++ b/Assets/Scripts/Editor/Windows/UnityWindowSearch.cs @@ -28,10 +28,10 @@ private void OnEnable() { protected override void UpdateEditorFields() { - if (!EditorApplication.isPlaying || Settings.s == null) { + if (!EditorApplication.isPlaying || Legacy_Settings.s == null) { Results = null; } - if (EditorApplication.isPlaying && Settings.s != null) { + if (EditorApplication.isPlaying && Legacy_Settings.s != null) { Rect rect = GetNextRect(ref YPos); string newSearchString = EditorGUI.TextField(rect, SearchString, EditorStyles.toolbarSearchField); if (newSearchString != SearchString || Results == null) { @@ -68,7 +68,7 @@ protected override void UpdateEditorFields() { private List Search(string query) { - if (!EditorApplication.isPlaying || Settings.s == null) return new List(); + if (!EditorApplication.isPlaying || Legacy_Settings.s == null) return new List(); var results = new List(); return MapLoader.Loader?.searchableStrings.Where(s => s.String.ToLower().Contains(query.ToLower())).ToList() ?? new List(); diff --git a/Assets/Scripts/Editor/Windows/UnityWindowSettings.cs b/Assets/Scripts/Editor/Windows/UnityWindowSettings.cs index 52378796..58218e57 100644 --- a/Assets/Scripts/Editor/Windows/UnityWindowSettings.cs +++ b/Assets/Scripts/Editor/Windows/UnityWindowSettings.cs @@ -4,8 +4,11 @@ using System.IO; using System.Linq; using BinarySerializer; +using BinarySerializer.Unity; +using Cysharp.Threading.Tasks; using OpenSpace; using OpenSpace.Exporter; +using Raymap; using UnityEditor; using UnityEditor.IMGUI.Controls; using UnityEngine; @@ -28,21 +31,40 @@ protected override void UpdateEditorFields() { fileMode = FileSystem.Mode.Web; } + bool refreshGameActions = (GameModeDropdown?.HasChanged ?? false) || (MapSelectionDropdown?.HasChanged ?? false); + // Increase label width due to it being cut off otherwise EditorGUIUtility.labelWidth = 192; - if (CategorizedGameModes == null) - CategorizedGameModes = EnumHelpers.GetValues().Select(x => Settings.GetSettings(x)) - .GroupBy(x => x.engineVersion).ToDictionary( - x => x.Key, - x => x - .GroupBy(y => y.game) - .ToDictionary(y => y.Key, y => y.ToArray()) - ); + if (CategorizedGameModes == null) { + var modes = EnumHelpers.GetValues().Select(x => new { + GameModeSelection = x, + GameModeAttribute = x.GetAttribute(), + EngineCategoryAttribute = x.GetAttribute() + .Category.GetAttribute(), + EngineAttribute = x.GetAttribute() + .Category.GetAttribute() + .Engine.GetAttribute(), + + }) + .GroupBy(x => x.GameModeAttribute.Category) + .GroupBy(x => x.FirstOrDefault().EngineCategoryAttribute.Engine); + CategorizedGameModes = modes.ToDictionary( + engineGroup => engineGroup.Key, + engineGroup => engineGroup.ToDictionary( + categoryGroup => categoryGroup.Key, + categoryGroup => categoryGroup.Select(x => x.GameModeSelection))); + } EditorGUI.BeginChangeCheck(); + + + if (fileMode == FileSystem.Mode.Web) { + EditorGUI.HelpBox(GetNextRect(ref YPos, height: 40f), "Your build target is configured as WebGL. Raymap will attempt to load from the server. Make sure the caps in the map name are correct.", MessageType.Warning); + } + // Game Mode DrawHeader(ref YPos, "Mode"); @@ -54,59 +76,76 @@ protected override void UpdateEditorFields() { if (EditorGUI.DropdownButton(rbutton, new GUIContent(GameModeDropdown.SelectionName), FocusType.Passive)) GameModeDropdown.Show(rectTemp); - if (GameModeDropdown != null && GameModeDropdown.HasChanged) { - UnitySettings.GameMode = GameModeDropdown.Selection; - GameModeDropdown.HasChanged = false; - Dirty = true; - } - // Scene file DrawHeader(ref YPos, "Map"); - string buttonString = "No map selected"; - if (!string.IsNullOrEmpty(UnitySettings.MapName)) { - buttonString = UnitySettings.MapName; - if (UnitySettings.UseLevelTranslation && Settings.settingsDict[UnitySettings.GameMode].levelTranslation != null) { - buttonString = Settings.settingsDict[UnitySettings.GameMode].levelTranslation.Translate(UnitySettings.MapName); - } - } - Rect rect = GetNextRect(ref YPos, vPaddingBottom: 4f); - rect = EditorGUI.PrefixLabel(rect, new GUIContent("Map name")); - if (fileMode == FileSystem.Mode.Web) { - UnitySettings.MapName = EditorGUI.TextField(rect, UnitySettings.MapName); - EditorGUI.HelpBox(GetNextRect(ref YPos, height: 40f), "Your build target is configured as WebGL. Raymap will attempt to load from the server. Make sure the caps in the map name are correct.", MessageType.Warning); - } else { - - EditorGUI.BeginDisabledGroup(UnitySettings.LoadFromMemory); - if (EditorGUI.DropdownButton(rect, new GUIContent(buttonString), FocusType.Passive)) { - // Initialize settings - Settings.Init(UnitySettings.GameMode); - string directory = CurrentGameDataDir; - /*string directory = (UnitySettings.CurrentGameDataDir + "/" + Settings.s.ITFDirectory).Replace(Path.DirectorySeparatorChar, '/'); - if (!directory.EndsWith("/")) directory += "/"; - while (directory.Contains("//")) directory = directory.Replace("//", "/"); - string extension = "*.isc"; - if (Settings.s.cooked) { - extension += ".ckd"; - }*/ - - if (MapDropdown == null || MapDropdown.directory != directory || MapDropdown.mode != UnitySettings.GameMode) { - MapDropdown = new MapSelectionDropdown(new UnityEditor.IMGUI.Controls.AdvancedDropdownState(), directory) { - name = "Maps", - mode = UnitySettings.GameMode - }; + + Rect rect; + string buttonString; + + if (fileMode == FileSystem.Mode.Normal) { + rectTemp = GetNextRect(ref YPos); + rbutton = EditorGUI.PrefixLabel(rectTemp, new GUIContent("Map")); + rectTemp = new Rect(rbutton.x + rbutton.width - Mathf.Max(400f, rbutton.width), rbutton.y, Mathf.Max(400f, rbutton.width), rbutton.height); + + // Map selection dropdown + if (MapSelectionDropdown == null || GameModeDropdown.HasChanged) { + if (GameModeDropdown.HasChanged) { + UnitySettings.SelectedGameMode = GameModeDropdown.Selection; + GameModeDropdown.HasChanged = false; + Dirty = true; + } + + MapTreeNode mapTree; + + try { + var manager = UnitySettings.GetGameManager; + var settings = UnitySettings.GetGameSettings; + + mapTree = manager.GetLevels(settings); + } catch (Exception ex) { + mapTree = new MapTreeNode(null,null); + Debug.LogWarning(ex.Message); } - MapDropdown.Show(rect); + + MapSelectionDropdown = new MapSelectionDropdown(new AdvancedDropdownState(), mapTree); + + // Debug.Log($"Map selection updated with {volumes.Length} volumes"); } - EditorGUI.EndDisabledGroup(); - } - if (MapDropdown != null && MapDropdown.selection != null) { - UnitySettings.MapName = MapDropdown.selection; - MapDropdown.selection = null; - Dirty = true; + + // Next & previous map buttons + BrowseButton(rbutton, "Next map", EditorGUIUtility.IconContent("Profiler.NextFrame"), () => { + MapSelectionDropdown.NextMap(); + }, ButtonWidth); + rbutton = new Rect(rbutton.x, rbutton.y, rbutton.width - ButtonWidth, rbutton.height); + BrowseButton(rbutton, "Previous map", EditorGUIUtility.IconContent("Profiler.PrevFrame"), () => { + MapSelectionDropdown.PreviousMap(); + }, ButtonWidth); + rbutton = new Rect(rbutton.x, rbutton.y, rbutton.width - ButtonWidth, rbutton.height); + + // Map selection dropdown button + buttonString = "No map selected"; + if (!string.IsNullOrEmpty(UnitySettings.MapName)) { + buttonString = UnitySettings.MapName; + } + if (MapSelectionDropdown.SelectedMap != null) { + buttonString = MapSelectionDropdown.GetName(MapSelectionDropdown.SelectedMap); + } + if (EditorGUI.DropdownButton(rbutton, new GUIContent(buttonString), FocusType.Passive)) + MapSelectionDropdown.Show(rectTemp); + } else if (fileMode == FileSystem.Mode.Web) { + if (GameModeDropdown.HasChanged) { + UnitySettings.SelectedGameMode = GameModeDropdown.Selection; + GameModeDropdown.HasChanged = false; + Dirty = true; + } + UnitySettings.MapName = EditorField("Map", UnitySettings.MapName); } - if (Settings.settingsDict[UnitySettings.GameMode].platform == Settings.Platform.PS1) { - OpenSpace.PS1.PS1GameInfo.Games.TryGetValue(UnitySettings.GameMode, out OpenSpace.PS1.PS1GameInfo game); + + var managerTmp = UnitySettings.SelectedGameMode.GetManager(); + if (managerTmp is CPA_PS1Manager ps1manager) { + var LegacyMode = ps1manager.GetLegacyMode(UnitySettings.GetGameSettings); + OpenSpace.PS1.PS1GameInfo.Games.TryGetValue(LegacyMode, out OpenSpace.PS1.PS1GameInfo game); if (game != null && game.actors?.Where(a => a.isSelectable).Count() > 0) { int mapIndex = Array.IndexOf(game.maps.Select(s => s.ToLower()).ToArray(), UnitySettings.MapName.ToLower()); if (mapIndex != -1 && game.files.FirstOrDefault(f => f.type == OpenSpace.PS1.PS1GameInfo.File.Type.Map).memoryBlocks[mapIndex].isActorSelectable) { @@ -122,8 +161,8 @@ protected override void UpdateEditorFields() { } else { EditorGUI.BeginDisabledGroup(UnitySettings.LoadFromMemory); if (EditorGUI.DropdownButton(rect, new GUIContent(buttonString), FocusType.Passive)) { - if (ActorDropdown1 == null || ActorDropdown1.mode != UnitySettings.GameMode) { - ActorDropdown1 = new PS1ActorSelectionDropdown(new UnityEditor.IMGUI.Controls.AdvancedDropdownState(), UnitySettings.GameMode, 0) { + if (ActorDropdown1 == null || ActorDropdown1.mode != LegacyMode) { + ActorDropdown1 = new PS1ActorSelectionDropdown(new UnityEditor.IMGUI.Controls.AdvancedDropdownState(), LegacyMode, 0) { name = "Actors" }; } @@ -149,8 +188,8 @@ protected override void UpdateEditorFields() { } else { EditorGUI.BeginDisabledGroup(UnitySettings.LoadFromMemory); if (EditorGUI.DropdownButton(rect, new GUIContent(buttonString), FocusType.Passive)) { - if (ActorDropdown2 == null || ActorDropdown2.mode != UnitySettings.GameMode) { - ActorDropdown2 = new PS1ActorSelectionDropdown(new UnityEditor.IMGUI.Controls.AdvancedDropdownState(), UnitySettings.GameMode, 1) { + if (ActorDropdown2 == null || ActorDropdown2.mode != LegacyMode) { + ActorDropdown2 = new PS1ActorSelectionDropdown(new UnityEditor.IMGUI.Controls.AdvancedDropdownState(), LegacyMode, 1) { name = "Actors" }; } @@ -167,7 +206,7 @@ protected override void UpdateEditorFields() { } } - UnitySettings.ExportPS1Files = EditorGUI.Toggle(GetNextRect(ref YPos), new GUIContent("Export PS1 Files"), UnitySettings.ExportPS1Files); + UnitySettings.ExportPS1Files = EditorField("Export PS1 Files", UnitySettings.ExportPS1Files); } if (fileMode != FileSystem.Mode.Web) { rect = GetNextRect(ref YPos); @@ -186,44 +225,28 @@ protected override void UpdateEditorFields() { // Directories DrawHeader(ref YPos, "Directories" + (fileMode == FileSystem.Mode.Web ? " (Web)" : "")); - foreach (var modeCategory in CategorizedGameModes) { - UnitySettings.HideDirectories[modeCategory.Key] = !EditorGUI.Foldout(GetNextRect(ref YPos), !UnitySettings.HideDirectories.TryGetItem(modeCategory.Key, true), $"Directories ({modeCategory.Key})", true); - - if (!UnitySettings.HideDirectories[modeCategory.Key]) { - foreach (var engine in modeCategory.Value) { - YPos += 8; - - var modes = engine.Value; + foreach (var engine in CategorizedGameModes) { + UnitySettings.HideDirectoriesEngine[engine.Key] = !EditorGUI.Foldout(GetNextRect(ref YPos), !UnitySettings.HideDirectoriesEngine.TryGetItem(engine.Key, true), $"Directories ({engine.Key.GetAttribute().DisplayName})", true); + if (UnitySettings.HideDirectoriesEngine[engine.Key]) continue; + foreach (var category in engine.Value) { + IndentLevel++; + UnitySettings.HideDirectoriesCategory[category.Key] = !EditorGUI.Foldout(GetNextRect(ref YPos), !UnitySettings.HideDirectoriesCategory.TryGetItem(category.Key, true), $"Directories ({category.Key.GetAttribute().DisplayName})", true); + IndentLevel--; + if(UnitySettings.HideDirectoriesCategory[category.Key]) continue; + YPos += 4; + foreach (var mode in category.Value) { + //YPos += 8; + var displayName = mode.GetAttribute().DisplayName; if (fileMode == FileSystem.Mode.Web) { - foreach (var mode in modes) { - UnitySettings.GameDirectoriesWeb[mode.mode] = EditorField(mode.DisplayName ?? "N/A", UnitySettings.GameDirectoriesWeb.TryGetItem(mode.mode, String.Empty)); - } + UnitySettings.GameDirectoriesWeb[mode] = EditorField(displayName ?? "N/A", UnitySettings.GameDirectoriesWeb.TryGetItem(mode, String.Empty)); } else { - foreach (var mode in modes) { - UnitySettings.GameDirectories[mode.mode] = DirectoryField(GetNextRect(ref YPos), mode.DisplayName ?? "N/A", UnitySettings.GameDirectories.TryGetItem(mode.mode, String.Empty)); - } + UnitySettings.GameDirectories[mode] = DirectoryField(GetNextRect(ref YPos), displayName ?? "N/A", UnitySettings.GameDirectories.TryGetItem(mode, String.Empty)); } } YPos += 8; } } - /*Settings.Mode[] modes = (Settings.Mode[])Enum.GetValues(typeof(Settings.Mode)); - if (fileMode == FileSystem.Mode.Web) { - foreach (Settings.Mode mode in modes) { - UnitySettings.GameDirectoriesWeb[mode] = EditorGUI.TextField(GetNextRect(ref YPos), mode.GetDescription(), UnitySettings.GameDirectoriesWeb.ContainsKey(mode) ? UnitySettings.GameDirectoriesWeb[mode] : ""); - } - } else { - foreach (Settings.Mode mode in modes) { - UnitySettings.GameDirectories[mode] = DirectoryField(GetNextRect(ref YPos), mode.GetDescription(), UnitySettings.GameDirectories.ContainsKey(mode) ? UnitySettings.GameDirectories[mode] : ""); - } - }*/ - /*if (GUILayout.Button("Update available scenes")) { - string path = EditorUtility.OpenFilePanel("Scene files", "", "isc.ckd"); - if (path.Length != 0) { - //UbiCanvasSettings.SelectedLevelFile = AvailableFiles.ElementAtOrDefault(SelectedLevelFileIndex); - } - }*/ // Serialization @@ -239,13 +262,54 @@ protected override void UpdateEditorFields() { if (UnitySettings.Log) UnitySettings.LogFile = FileField(rect, "Serialization log File", UnitySettings.LogFile, true, "txt", includeLabel: false); + + // Game Tools + + DrawHeader("Game Tools"); + + // Only update if previous values don't match + if (CurrentGameActions == null || refreshGameActions) { + if (fileMode != FileSystem.Mode.Web) { + MapSelectionDropdown.HasChanged = false; + UnitySettings.MapName = MapSelectionDropdown.SelectedMap?.Id ?? UnitySettings.MapName; + } + Dirty = true; + CurrentGameActions = UnitySettings.GetGameManager.GetGameActions(UnitySettings.GetGameSettings); + } + + // Add every game action + foreach (GameAction action in CurrentGameActions) { + if (EditorButton(action.DisplayName)) { + // Get the directories + string inputDir = action.RequiresInputDir ? EditorUtility.OpenFolderPanel("Select input directory", null, "") : null; + + if (string.IsNullOrEmpty(inputDir) && action.RequiresInputDir) + return; + + string outputDir = action.RequiresOutputDir ? EditorUtility.OpenFolderPanel("Select output directory", null, "") : null; + + if (string.IsNullOrEmpty(outputDir) && action.RequiresOutputDir) + return; + + async UniTask ExecuteGameAction(GameAction action) { + try { + BinarySerializer.Unity.TimeController.StartStopwatch(); + // Run the action + await action.GameActionFunc(inputDir, outputDir); + } catch (Exception ex) { + Debug.LogError(ex.ToString()); + } finally { + BinarySerializer.Unity.TimeController.StopStopwatch(); + } + } + _ = ExecuteGameAction(action); + } + } + + // Export DrawHeader(ref YPos, "Export Settings"); - rect = GetNextRect(ref YPos); - rect = EditorGUI.PrefixLabel(rect, new GUIContent("Export After Load")); - bool export = UnitySettings.ExportAfterLoad; - rect = PrefixToggle(rect, ref export); - UnitySettings.ExportAfterLoad = export; + UnitySettings.ExportAfterLoad = EditorField("Export After Load", UnitySettings.ExportAfterLoad); rect = GetNextRect(ref YPos); rect = EditorGUI.PrefixLabel(rect, new GUIContent("Export Flags")); @@ -254,19 +318,6 @@ protected override void UpdateEditorFields() { UnitySettings.ExportFlags = (MapExporter.ExportFlags) exportFlags; UnitySettings.ExportPath = DirectoryField(GetNextRect(ref YPos), "Export Path", UnitySettings.ExportPath); - - if (GUI.Button(GetNextRect(ref YPos), "Copy export commands for all levels to clipboard...")) { - GUIUtility.systemCopyBuffer = GenerateExportScript((f) => $"Raymap.exe -batchmode " + - $"--export {UnitySettings.ExportPath} " + - $"--flags {(int) UnitySettings.ExportFlags} " + - $"--mode {UnitySettings.GameMode} " + - $"--dir \"{UnitySettings.GameDirectories[UnitySettings.GameMode]}\" " + - $"--level {f}"); - } - - if (GUI.Button(GetNextRect(ref YPos), "Copy blend export commands for all levels to clipboard...")) { - GUIUtility.systemCopyBuffer = GenerateExportScript((f) => $"blender --background --python generate_maps_blend.py -- {UnitySettings.ExportPath} {f} {UnitySettings.ExportPath}/BlendFiles/Levels"); - } UnitySettings.ScreenshotAfterLoad = (UnitySettings.ScreenshotAfterLoadSetting)EditorGUI.EnumPopup(GetNextRect(ref YPos), new GUIContent("Screenshot After Load"), UnitySettings.ScreenshotAfterLoad); @@ -282,18 +333,6 @@ protected override void UpdateEditorFields() { UnitySettings.HighlightObjectsTextFormat = EditorGUI.TextField(GetNextRect(ref YPos), "Highlight format string", UnitySettings.HighlightObjectsTextFormat); EditorGUI.LabelField(GetNextRect(ref YPos), "($f=family, $m=model, $i=instance name, $c=count)"); - if (GUI.Button(GetNextRect(ref YPos), "Copy screenshot commands for all levels to clipboard...")) { - GUIUtility.systemCopyBuffer = GenerateExportScript((f) => $"Raymap.exe -batchmode " + - $"--mode {UnitySettings.GameMode} " + - $"--dir \"{UnitySettings.GameDirectories[UnitySettings.GameMode]}\" " + - $"--level {f} " + - $"--ScreenshotPath \"{UnitySettings.ScreenshotPath}\" " + - $"--ScreenshotAfterLoad {UnitySettings.ScreenshotAfterLoad} " + - $"--ScreenshotScale {UnitySettings.ScreenshotScale} " + - $"--HighlightObjectsFilter \"{UnitySettings.HighlightObjectsFilter}\" " + - $"--HighlightObjectsTextFormat \"{UnitySettings.HighlightObjectsTextFormat}\""); - } - /*if (UnitySettings.ExportAfterLoad) { UnitySettings.ExportPath = DirectoryField(rect, "Export Path", UnitySettings.ExportPath, includeLabel: false); }*/ @@ -301,16 +340,15 @@ protected override void UpdateEditorFields() { // Misc DrawHeader(ref YPos, "Miscellaneous Settings"); UnitySettings.ScreenshotPath = DirectoryField(GetNextRect(ref YPos), "Screenshot Path", UnitySettings.ScreenshotPath); - UnitySettings.AllowDeadPointers = EditorGUI.Toggle(GetNextRect(ref YPos), new GUIContent("Allow Dead Pointers"), UnitySettings.AllowDeadPointers); - UnitySettings.ForceDisplayBackfaces = EditorGUI.Toggle(GetNextRect(ref YPos), new GUIContent("Force Display Backfaces"), UnitySettings.ForceDisplayBackfaces); - UnitySettings.BlockyMode = EditorGUI.Toggle(GetNextRect(ref YPos), new GUIContent("Blocky Mode"), UnitySettings.BlockyMode); - UnitySettings.TracePointers = EditorGUI.Toggle(GetNextRect(ref YPos), new GUIContent("Trace Pointers (slow!)"), UnitySettings.TracePointers); - UnitySettings.SaveTextures = EditorGUI.Toggle(GetNextRect(ref YPos), new GUIContent("Save Textures"), UnitySettings.SaveTextures); - UnitySettings.ExportText = EditorGUI.Toggle(GetNextRect(ref YPos), new GUIContent("Export Text"), UnitySettings.ExportText); - UnitySettings.UseLevelTranslation = EditorGUI.Toggle(GetNextRect(ref YPos), new GUIContent("Use Level Translation"), UnitySettings.UseLevelTranslation); - UnitySettings.VisualizeSectorBorders = EditorGUI.Toggle(GetNextRect(ref YPos), new GUIContent("Visualize Sector Borders"), UnitySettings.VisualizeSectorBorders); - UnitySettings.CreateFamilyGameObjects = EditorGUI.Toggle(GetNextRect(ref YPos), new GUIContent("Create Family GameObjects"), UnitySettings.CreateFamilyGameObjects); - UnitySettings.ShowCollisionDataForNoCollisionObjects = EditorGUI.Toggle(GetNextRect(ref YPos), new GUIContent("Show Collision Data For NoCollision SPOs"), UnitySettings.ShowCollisionDataForNoCollisionObjects); + UnitySettings.AllowDeadPointers = EditorField("Allow Dead Pointers", UnitySettings.AllowDeadPointers); + UnitySettings.ForceDisplayBackfaces = EditorField("Force Display Backfaces", UnitySettings.ForceDisplayBackfaces); + UnitySettings.BlockyMode = EditorField("Blocky Mode", UnitySettings.BlockyMode); + UnitySettings.TracePointers = EditorField("Trace Pointers (slow!)", UnitySettings.TracePointers); + UnitySettings.SaveTextures = EditorField("Save Textures", UnitySettings.SaveTextures); + UnitySettings.ExportText = EditorField("Export Text", UnitySettings.ExportText); + UnitySettings.VisualizeSectorBorders = EditorField("Visualize Sector Borders", UnitySettings.VisualizeSectorBorders); + UnitySettings.CreateFamilyGameObjects = EditorField("Create Family GameObjects", UnitySettings.CreateFamilyGameObjects); + UnitySettings.ShowCollisionDataForNoCollisionObjects = EditorField("Show Collision Data For NoCollision SPOs", UnitySettings.ShowCollisionDataForNoCollisionObjects); if (EditorGUI.EndChangeCheck() || Dirty) { #if UNITY_EDITOR @@ -319,26 +357,6 @@ protected override void UpdateEditorFields() { Dirty = false; } } - - private string GenerateExportScript(Func lineDelegate) - { - Settings.Init(UnitySettings.GameMode); - string commands = ""; - - var tempDropDown = - new MapSelectionDropdown(new UnityEditor.IMGUI.Controls.AdvancedDropdownState(), CurrentGameDataDir) - { - name = "Maps", - mode = UnitySettings.GameMode - }; - - foreach (var f in tempDropDown.files) { - commands += lineDelegate.Invoke(f) + Environment.NewLine; - } - - return commands; - } - #endregion #region Properties @@ -349,22 +367,24 @@ private string GenerateExportScript(Func lineDelegate) private int SelectedLevelFileIndex { get; set; } // Categorized game modes - public Dictionary> CategorizedGameModes { get; set; } + public Dictionary>> CategorizedGameModes { get; set; } + + private GameAction[] CurrentGameActions { get; set; } /// /// The file selection dropdown /// private GameModeSelectionDropdown GameModeDropdown { get; set; } - private MapSelectionDropdown MapDropdown { get; set; } + private MapSelectionDropdown MapSelectionDropdown { get; set; } private PS1ActorSelectionDropdown ActorDropdown1 { get; set; } private PS1ActorSelectionDropdown ActorDropdown2 { get; set; } private string CurrentGameDataDir { get { - Dictionary GameDirs = + Dictionary GameDirs = EditorUserBuildSettings.activeBuildTarget == BuildTarget.WebGL ? UnitySettings.GameDirectoriesWeb : UnitySettings.GameDirectories; - if (GameDirs.ContainsKey(UnitySettings.GameMode)) { - return (GameDirs[UnitySettings.GameMode] ?? ""); + if (GameDirs.ContainsKey(UnitySettings.SelectedGameMode)) { + return (GameDirs[UnitySettings.SelectedGameMode] ?? ""); } else { return ""; } diff --git a/Assets/Scripts/Games.meta b/Assets/Scripts/Games.meta new file mode 100644 index 00000000..1129378a --- /dev/null +++ b/Assets/Scripts/Games.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 5ab778dbcf8870a47ba2bd04115415f8 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Games/Base.meta b/Assets/Scripts/Games/Base.meta new file mode 100644 index 00000000..0e34909c --- /dev/null +++ b/Assets/Scripts/Games/Base.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 3310936108743784cb058e1da9f8c467 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Games/Base/Environment.meta b/Assets/Scripts/Games/Base/Environment.meta new file mode 100644 index 00000000..8b0148c0 --- /dev/null +++ b/Assets/Scripts/Games/Base/Environment.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: f29352151f57116469558676cc5a08fc +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Games/Base/Environment/Unity_Environment.cs b/Assets/Scripts/Games/Base/Environment/Unity_Environment.cs new file mode 100644 index 00000000..b5d5ba08 --- /dev/null +++ b/Assets/Scripts/Games/Base/Environment/Unity_Environment.cs @@ -0,0 +1,19 @@ +using BinarySerializer; +using UnityEngine; + +namespace Raymap { + public abstract class Unity_Environment : MonoBehaviour { + public Context Context { get; private set; } + + public abstract void Init(); + public abstract void OnDataLoaded(); + + + public void Register(Context context) { + Context = context; + Context.StoreObject(ContextKey, this); + } + + public static string ContextKey => nameof(Unity_Environment); + } +} diff --git a/Assets/Scripts/Games/Base/Environment/Unity_Environment.cs.meta b/Assets/Scripts/Games/Base/Environment/Unity_Environment.cs.meta new file mode 100644 index 00000000..97a09ca9 --- /dev/null +++ b/Assets/Scripts/Games/Base/Environment/Unity_Environment.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 33c876bbfc333d3428477411b60e2e96 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Games/Base/Manager.meta b/Assets/Scripts/Games/Base/Manager.meta new file mode 100644 index 00000000..cad4a2da --- /dev/null +++ b/Assets/Scripts/Games/Base/Manager.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: fa3a821ccdb584a419bbbc867a91c1f6 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Games/Base/Manager/BaseGameManager.cs b/Assets/Scripts/Games/Base/Manager/BaseGameManager.cs new file mode 100644 index 00000000..9b06acab --- /dev/null +++ b/Assets/Scripts/Games/Base/Manager/BaseGameManager.cs @@ -0,0 +1,55 @@ +using BinarySerializer; +using Cysharp.Threading.Tasks; + +namespace Raymap { + /// + /// Defines a generic game manager + /// + public abstract class BaseGameManager { + /// + /// Gets the levels for each world + /// + /// The game settings + /// The levels + public abstract MapTreeNode GetLevels(MapViewerSettings settings); + + /// + /// Gets the available game actions + /// + /// The game settings + /// The game actions + public virtual GameAction[] GetGameActions(MapViewerSettings settings) => new GameAction[0]; + + /// + /// Loads the level specified by the settings for the editor + /// + /// The serialization context + /// The level + public abstract UniTask LoadAsync(Context context); + + /// + /// Saves the loaded level + /// + /// The serialization context + /// The level + public virtual UniTask SaveLevelAsync(Context context, Unity_Level level) => throw new System.NotImplementedException(); + + /// + /// Preloads all the necessary files into the context + /// + /// The serialization context + public virtual UniTask LoadFilesAsync(Context context) => UniTask.CompletedTask; + + /// + /// Allows additional settings objects to be added to the context on creation + /// + /// The newly created context + public virtual void AddContextSettings(Context context) { } + + /// + /// Allows pre-defined pointers to be added to the context on creation + /// + /// The newly created context + public virtual void AddContextPointers(Context context) { } + } +} \ No newline at end of file diff --git a/Assets/Scripts/Games/Base/Manager/BaseGameManager.cs.meta b/Assets/Scripts/Games/Base/Manager/BaseGameManager.cs.meta new file mode 100644 index 00000000..acd5d2a0 --- /dev/null +++ b/Assets/Scripts/Games/Base/Manager/BaseGameManager.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 0ce952137634c2e438871f60a5b9c9b3 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Games/Base/Manager/GameAction.cs b/Assets/Scripts/Games/Base/Manager/GameAction.cs new file mode 100644 index 00000000..7974416d --- /dev/null +++ b/Assets/Scripts/Games/Base/Manager/GameAction.cs @@ -0,0 +1,60 @@ +using System; +using Cysharp.Threading.Tasks; + +namespace Raymap { + /// + /// A game action + /// + public class GameAction { + /// + /// Constructor for an asynchronous action + /// + /// The action display name + /// Indicates if the action requires an input directory + /// Indicates if the action requires an output directory + /// The game action function + public GameAction(string displayName, bool requiresInputDir, bool requiresOutputDir, Func gameActionFunc) { + DisplayName = displayName; + RequiresInputDir = requiresInputDir; + RequiresOutputDir = requiresOutputDir; + GameActionFunc = gameActionFunc; + } + + /// + /// Constructor for a synchronous action + /// + /// The action display name + /// Indicates if the action requires an input directory + /// Indicates if the action requires an output directory + /// The game action function + public GameAction(string displayName, bool requiresInputDir, bool requiresOutputDir, Action gameActionFunc) { + DisplayName = displayName; + RequiresInputDir = requiresInputDir; + RequiresOutputDir = requiresOutputDir; + GameActionFunc = (input, output) => { + gameActionFunc(input, output); + return UniTask.CompletedTask; + }; + } + + /// + /// The action display name + /// + public string DisplayName { get; } + + /// + /// Indicates if the action requires an input directory + /// + public bool RequiresInputDir { get; } + + /// + /// Indicates if the action requires an output directory + /// + public bool RequiresOutputDir { get; } + + /// + /// The game action function + /// + public Func GameActionFunc { get; } + } +} \ No newline at end of file diff --git a/Assets/Scripts/Games/Base/Manager/GameAction.cs.meta b/Assets/Scripts/Games/Base/Manager/GameAction.cs.meta new file mode 100644 index 00000000..5c382933 --- /dev/null +++ b/Assets/Scripts/Games/Base/Manager/GameAction.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 2f793c03491a8f64bb57083a4f6a2517 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Games/Base/Manager/MapTreeNode.cs b/Assets/Scripts/Games/Base/Manager/MapTreeNode.cs new file mode 100644 index 00000000..6b9585bb --- /dev/null +++ b/Assets/Scripts/Games/Base/Manager/MapTreeNode.cs @@ -0,0 +1,25 @@ +using System.Collections.Generic; + +namespace Raymap { + public class MapTreeNode { + public MapTreeNode(string id, string displayName) { + Id = id; + DisplayName = displayName; + } + + public string Id { get; set; } + + public string DisplayName { get; set; } + + public MapTreeNode[] Children { get; set; } + + public IEnumerable GetMaps() { + if(Id != null) yield return this; + if (Children != null) { + foreach (var child in Children) { + foreach (var x in child.GetMaps()) yield return x; + } + } + } + } +} \ No newline at end of file diff --git a/Assets/Scripts/Games/Base/Manager/MapTreeNode.cs.meta b/Assets/Scripts/Games/Base/Manager/MapTreeNode.cs.meta new file mode 100644 index 00000000..0af46ea8 --- /dev/null +++ b/Assets/Scripts/Games/Base/Manager/MapTreeNode.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 17b0951f85c049b44ab5c82ac703946d +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Games/Base/Unity.meta b/Assets/Scripts/Games/Base/Unity.meta new file mode 100644 index 00000000..cb98b9c1 --- /dev/null +++ b/Assets/Scripts/Games/Base/Unity.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: d352e43a8f81de74388c01eab76b364f +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Games/Base/Unity_Data.cs b/Assets/Scripts/Games/Base/Unity_Data.cs new file mode 100644 index 00000000..65e31249 --- /dev/null +++ b/Assets/Scripts/Games/Base/Unity_Data.cs @@ -0,0 +1,27 @@ +using BinarySerializer; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Raymap { + public abstract class Unity_Data { + public Unity_Level Level { get; protected set; } + public Context Context => Level.Context; + + protected object _LinkedObject { get; private set; } + + protected void Init(Unity_Level level, object linkedObject) { + Level = level; + _LinkedObject = linkedObject; + } + } + public abstract class Unity_Data : Unity_Data { + public T LinkedObject => (T)_LinkedObject; + + public void Init(Unity_Level level, T linkedObject) { + base.Init(level, linkedObject); + } + } +} diff --git a/Assets/Scripts/Games/Base/Unity_Data.cs.meta b/Assets/Scripts/Games/Base/Unity_Data.cs.meta new file mode 100644 index 00000000..982be374 --- /dev/null +++ b/Assets/Scripts/Games/Base/Unity_Data.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: f3b81095e1ddd0d4180c1b942ef942df +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Games/Base/Unity_Level.cs b/Assets/Scripts/Games/Base/Unity_Level.cs new file mode 100644 index 00000000..5960d2e9 --- /dev/null +++ b/Assets/Scripts/Games/Base/Unity_Level.cs @@ -0,0 +1,32 @@ +using BinarySerializer; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Raymap { + public abstract class Unity_Level { + public Context Context { get; protected set; } + + public abstract string EnvironmentKey { get; } + public abstract void Init(); + + public void Register(Context context) { + Context = context; + Context.StoreObject(ContextKey, this); + } + + public static string ContextKey => nameof(Unity_Level); + + protected Dictionary UnityDataDictionary { get; set; } = new Dictionary(); + public T GetUnityData(U obj) where T : Unity_Data, new() { + if (!UnityDataDictionary.ContainsKey(obj)) { + var data = new T(); + data.Init(this, obj); + UnityDataDictionary[obj] = data; + } + return (T)UnityDataDictionary[obj]; + } + } +} diff --git a/Assets/Scripts/Games/Base/Unity_Level.cs.meta b/Assets/Scripts/Games/Base/Unity_Level.cs.meta new file mode 100644 index 00000000..2beb10ca --- /dev/null +++ b/Assets/Scripts/Games/Base/Unity_Level.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: c671b315ee8bf3943aecf537a77deb08 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Games/CPA.meta b/Assets/Scripts/Games/CPA.meta new file mode 100644 index 00000000..f54f230b --- /dev/null +++ b/Assets/Scripts/Games/CPA.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 212a9e92b1867fa45805786705d6d2f0 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Games/CPA/Base.meta b/Assets/Scripts/Games/CPA/Base.meta new file mode 100644 index 00000000..bbc753a4 --- /dev/null +++ b/Assets/Scripts/Games/CPA/Base.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 7ac2e1b9c59a20648a5b65f0b6373a2a +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Games/CPA/Base/Manager.meta b/Assets/Scripts/Games/CPA/Base/Manager.meta new file mode 100644 index 00000000..f6e3b8d0 --- /dev/null +++ b/Assets/Scripts/Games/CPA/Base/Manager.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 2c0071f8647da9c4a994fc94272b1d62 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Games/CPA/Base/Manager/CPA_BaseManager.cs b/Assets/Scripts/Games/CPA/Base/Manager/CPA_BaseManager.cs new file mode 100644 index 00000000..3a08d7c4 --- /dev/null +++ b/Assets/Scripts/Games/CPA/Base/Manager/CPA_BaseManager.cs @@ -0,0 +1,87 @@ +using BinarySerializer; +using BinarySerializer.Ubisoft.CPA; +using System; + +namespace Raymap { + public abstract class CPA_BaseManager : BaseGameManager { + public override void AddContextSettings(Context context) { + base.AddContextSettings(context); + var settings = context.GetMapViewerSettings(); + var cpaMode = GetCPAMode(settings); + var cpaSettings = CPA_Settings_Defines.GetSettings(cpaMode); + context.AddSettings(cpaSettings); + } + + protected CPA_GameMode GetCPAMode(MapViewerSettings settings) { + return settings.GameModeSelection switch { + + GameModeSelection.Rayman2PC => CPA_GameMode.Rayman2PC, + GameModeSelection.Rayman2PCDemo_1999_08_18 => CPA_GameMode.Rayman2PCDemo_1999_08_18, + GameModeSelection.Rayman2PCDemo_1999_09_04 => CPA_GameMode.Rayman2PCDemo_1999_09_04, + GameModeSelection.Rayman2DC => CPA_GameMode.Rayman2DC, + GameModeSelection.Rayman2IOS => CPA_GameMode.Rayman2IOS, + GameModeSelection.Rayman2IOSDemo => CPA_GameMode.Rayman2IOSDemo, + GameModeSelection.Rayman2PS1 => CPA_GameMode.Rayman2PS1, + GameModeSelection.Rayman2PS1Demo => CPA_GameMode.Rayman2PS1Demo, + GameModeSelection.Rayman2PS1Demo_SLUS_90095 => CPA_GameMode.Rayman2PS1Demo_SLUS_90095, + GameModeSelection.Rayman2PS2 => CPA_GameMode.Rayman2PS2, + GameModeSelection.Rayman2N64 => CPA_GameMode.Rayman2N64, + GameModeSelection.Rayman2DS => CPA_GameMode.Rayman2DS, + GameModeSelection.Rayman23DS => CPA_GameMode.Rayman23DS, + + GameModeSelection.RaymanMPC => CPA_GameMode.RaymanMPC, + GameModeSelection.RaymanMPS2 => CPA_GameMode.RaymanMPS2, + GameModeSelection.RaymanMPS2Demo_2001_07_25 => CPA_GameMode.RaymanMPS2Demo_2001_07_25, + GameModeSelection.RaymanArenaPC => CPA_GameMode.RaymanArenaPC, + GameModeSelection.RaymanArenaPS2 => CPA_GameMode.RaymanArenaPS2, + GameModeSelection.RaymanArenaGC => CPA_GameMode.RaymanArenaGC, + GameModeSelection.RaymanArenaGCDemo_2002_03_07 => CPA_GameMode.RaymanArenaGCDemo_2002_03_07, + GameModeSelection.RaymanArenaXbox => CPA_GameMode.RaymanArenaXbox, + GameModeSelection.RaymanRushPS1 => CPA_GameMode.RaymanRushPS1, + + GameModeSelection.Rayman3PC => CPA_GameMode.Rayman3PC, + GameModeSelection.Rayman3PCDemo_2002_10_01 => CPA_GameMode.Rayman3PCDemo_2002_10_01, + GameModeSelection.Rayman3PCDemo_2002_10_21 => CPA_GameMode.Rayman3PCDemo_2002_10_21, + GameModeSelection.Rayman3PCDemo_2002_12_09 => CPA_GameMode.Rayman3PCDemo_2002_12_09, + GameModeSelection.Rayman3PCDemo_2003_01_06 => CPA_GameMode.Rayman3PCDemo_2003_01_06, + GameModeSelection.Rayman3MacOS => CPA_GameMode.Rayman3MacOS, + GameModeSelection.Rayman3GC => CPA_GameMode.Rayman3GC, + GameModeSelection.Rayman3PS2 => CPA_GameMode.Rayman3PS2, + GameModeSelection.Rayman3PS2Demo_2002_05_17 => CPA_GameMode.Rayman3PS2Demo_2002_05_17, + GameModeSelection.Rayman3PS2Demo_2002_08_07 => CPA_GameMode.Rayman3PS2Demo_2002_08_07, + GameModeSelection.Rayman3PS2DevBuild_2002_09_06 => CPA_GameMode.Rayman3PS2DevBuild_2002_09_06, + GameModeSelection.Rayman3PS2Demo_2002_10_29 => CPA_GameMode.Rayman3PS2Demo_2002_10_29, + GameModeSelection.Rayman3PS2Demo_2002_12_18 => CPA_GameMode.Rayman3PS2Demo_2002_12_18, + GameModeSelection.Rayman3Xbox => CPA_GameMode.Rayman3Xbox, + GameModeSelection.Rayman3Xbox360 => CPA_GameMode.Rayman3Xbox360, + GameModeSelection.Rayman3PS3 => CPA_GameMode.Rayman3PS3, + + GameModeSelection.RaymanRavingRabbidsDS => CPA_GameMode.RaymanRavingRabbidsDS, + GameModeSelection.RaymanRavingRabbidsDSDevBuild_2006_05_25 => CPA_GameMode.RaymanRavingRabbidsDSDevBuild_2006_05_25, + + GameModeSelection.TonicTroublePC => CPA_GameMode.TonicTroublePC, + GameModeSelection.TonicTroubleSEPC => CPA_GameMode.TonicTroubleSEPC, + GameModeSelection.TonicTroubleN64 => CPA_GameMode.TonicTroubleN64, + + GameModeSelection.DonaldDuckPC => CPA_GameMode.DonaldDuckPC, + GameModeSelection.DonaldDuckPCDemo => CPA_GameMode.DonaldDuckPCDemo, + GameModeSelection.DonaldDuckDC => CPA_GameMode.DonaldDuckDC, + GameModeSelection.DonaldDuckN64 => CPA_GameMode.DonaldDuckN64, + GameModeSelection.DonaldDuckPS1 => CPA_GameMode.DonaldDuckPS1, + GameModeSelection.DonaldDuckPKGC => CPA_GameMode.DonaldDuckPKGC, + GameModeSelection.DinosaurPC => CPA_GameMode.DinosaurPC, + GameModeSelection.LargoWinchPC => CPA_GameMode.LargoWinchPC, + GameModeSelection.JungleBookPS1 => CPA_GameMode.JungleBookPS1, + + GameModeSelection.PlaymobilHypePC => CPA_GameMode.PlaymobilHypePC, + GameModeSelection.PlaymobilLauraPC => CPA_GameMode.PlaymobilLauraPC, + GameModeSelection.PlaymobilAlexPC => CPA_GameMode.PlaymobilAlexPC, + + GameModeSelection.VIPPS1 => CPA_GameMode.VIPPS1, + GameModeSelection.RedPlanetPC => CPA_GameMode.RedPlanetPC, + + _ => throw new Exception($"GameModeSelection value {settings.GameModeSelection} is not a valid CPA mode") + }; + } + } +} diff --git a/Assets/Scripts/Games/CPA/Base/Manager/CPA_BaseManager.cs.meta b/Assets/Scripts/Games/CPA/Base/Manager/CPA_BaseManager.cs.meta new file mode 100644 index 00000000..fee131e8 --- /dev/null +++ b/Assets/Scripts/Games/CPA/Base/Manager/CPA_BaseManager.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: da18c4243113129438a1ebe8cfb64bf0 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Games/CPA/CPA_Legacy.meta b/Assets/Scripts/Games/CPA/CPA_Legacy.meta new file mode 100644 index 00000000..33a588c7 --- /dev/null +++ b/Assets/Scripts/Games/CPA/CPA_Legacy.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: e17940f3823ff9d4eb9c67c0e94f5e44 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Games/CPA/CPA_Legacy/Manager.meta b/Assets/Scripts/Games/CPA/CPA_Legacy/Manager.meta new file mode 100644 index 00000000..e9ee4300 --- /dev/null +++ b/Assets/Scripts/Games/CPA/CPA_Legacy/Manager.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 9c32f2550baadf44a9a99c3ed6c47de2 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Games/CPA/CPA_Legacy/Manager/LegacyGameManager.cs b/Assets/Scripts/Games/CPA/CPA_Legacy/Manager/LegacyGameManager.cs new file mode 100644 index 00000000..48eb9d93 --- /dev/null +++ b/Assets/Scripts/Games/CPA/CPA_Legacy/Manager/LegacyGameManager.cs @@ -0,0 +1,204 @@ +using BinarySerializer; +using Cysharp.Threading.Tasks; +using OpenSpace; +using OpenSpace.Loader; +using System; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Raymap { + public class LegacyGameManager : CPA_BaseManager { + public override MapTreeNode GetLevels(MapViewerSettings settings) { + var files = FindFiles(settings); + var translation = GetSettings(settings)?.levelTranslation?.SortAndTranslate(files); + + MapTreeNode root = new MapTreeNode(null, null); + + if (translation != null) { + root.Children = translation.Select(tr => new MapTreeNode(tr.Item1, tr.Item2)).ToArray(); + } else { + root.Children = files.Select(filename => new MapTreeNode(filename, filename)).ToArray(); + } + return root; + } + + public override async UniTask LoadAsync(Context context) { + await UniTask.CompletedTask; + throw new NotImplementedException(); + } + + protected virtual List FindFiles(MapViewerSettings settings) { + var directory = settings.GameDirectory; + + // Create the output + var output = new List(); + + // If the directory does not exist, return the empty list + if (!Directory.Exists(directory)) + return output; + + string[] filterPaths = new string[] { + "fix", + /*"ani0", + "ani1", + "ani2", + "ani3", + "ani4", + "ani5", + "ani6", + "ani7", + "ani8", + "ani9", + "ani10",*/ + }; + + + var cpaMode = GetCPAMode(settings); + var cpaSettings = BinarySerializer.Ubisoft.CPA.CPA_Settings_Defines.GetSettings(cpaMode); + + // Add the found files containing the correct file extension + string extension = null; + string[] levels; + switch (cpaSettings.Platform) { + case BinarySerializer.Ubisoft.CPA.Platform.PC: + case BinarySerializer.Ubisoft.CPA.Platform.iOS: + case BinarySerializer.Ubisoft.CPA.Platform.GC: + case BinarySerializer.Ubisoft.CPA.Platform.Xbox: + case BinarySerializer.Ubisoft.CPA.Platform.Xbox360: + case BinarySerializer.Ubisoft.CPA.Platform.PS3: + case BinarySerializer.Ubisoft.CPA.Platform.MacOS: + if (!cpaSettings.EngineVersionTree.HasParent(BinarySerializer.Ubisoft.CPA.EngineVersion.CPA_3)) { + extension = "*.sna"; + } else { + extension = "*.lvl"; + } + break; + case BinarySerializer.Ubisoft.CPA.Platform.DC: extension = "*.DAT"; break; + case BinarySerializer.Ubisoft.CPA.Platform.PS2: + if (!cpaSettings.EngineVersionTree.HasParent(BinarySerializer.Ubisoft.CPA.EngineVersion.CPA_3)) { + if (!cpaSettings.EngineVersionTree.HasParent(BinarySerializer.Ubisoft.CPA.EngineVersion.CPA_Montreal)) { + extension = "*.sna"; + } else { + extension = "*.lv2"; + } + } else { + extension = "*.lvl"; + } + break; + case BinarySerializer.Ubisoft.CPA.Platform.PS1: + Legacy_Settings.Init(GetSettings(settings)); + MapLoader.Reset(); + R2PS1Loader l1 = MapLoader.Loader as R2PS1Loader; + l1.gameDataBinFolder = directory; + levels = l1.LoadLevelList(); + MapLoader.Reset(); + output.AddRange(levels); + Legacy_Settings.s = null; + break; + case BinarySerializer.Ubisoft.CPA.Platform.DS: + case BinarySerializer.Ubisoft.CPA.Platform.N64: + case BinarySerializer.Ubisoft.CPA.Platform._3DS: + Legacy_Settings.Init(GetSettings(settings)); + MapLoader.Reset(); + R2ROMLoader lr = MapLoader.Loader as R2ROMLoader; + lr.gameDataBinFolder = directory; + levels = lr.LoadLevelList(); + MapLoader.Reset(); + output.AddRange(levels); + Legacy_Settings.s = null; + break; + } + if (extension != null) { + output.AddRange( + from file in Directory.EnumerateFiles(directory, extension, SearchOption.AllDirectories) + let filename = Path.GetFileNameWithoutExtension(file) + let dirname = new DirectoryInfo(file).Parent.Name + where ((!filterPaths.Contains(filename.ToLower())) + && dirname.ToLower() == filename.ToLower()) + select dirname + + ); + } + //Debug.Log(string.Join("\n",output)); + + // Return the output + return output; + } + public void CreateSettings(MapViewerSettings settings) { + Legacy_Settings.Init(GetSettings(settings)); + } + + public Legacy_Settings GetSettings(MapViewerSettings settings) { + Legacy_Settings.Mode Mode = GetLegacyMode(settings); + return Legacy_Settings.GetSettings(Mode); + } + + public Legacy_Settings.Mode GetLegacyMode(MapViewerSettings settings) { + var raymapMode = settings.GameModeSelection; + Legacy_Settings.Mode legacyMode = raymapMode switch { + GameModeSelection.Rayman2PC => Legacy_Settings.Mode.Rayman2PC, + GameModeSelection.Rayman2PCDemo_1999_08_18 => Legacy_Settings.Mode.Rayman2PCDemo_1999_08_18, + GameModeSelection.Rayman2PCDemo_1999_09_04 => Legacy_Settings.Mode.Rayman2PCDemo_1999_09_04, + GameModeSelection.Rayman2DC => Legacy_Settings.Mode.Rayman2DC, + GameModeSelection.Rayman2IOS => Legacy_Settings.Mode.Rayman2IOS, + GameModeSelection.Rayman2IOSDemo => Legacy_Settings.Mode.Rayman2IOSDemo, + GameModeSelection.Rayman2PS1 => Legacy_Settings.Mode.Rayman2PS1, + GameModeSelection.Rayman2PS1Demo => Legacy_Settings.Mode.Rayman2PS1Demo, + GameModeSelection.Rayman2PS1Demo_SLUS_90095 => Legacy_Settings.Mode.Rayman2PS1Demo_SLUS_90095, + GameModeSelection.Rayman2PS2 => Legacy_Settings.Mode.Rayman2PS2, + GameModeSelection.Rayman2N64 => Legacy_Settings.Mode.Rayman2N64, + GameModeSelection.Rayman2DS => Legacy_Settings.Mode.Rayman2DS, + GameModeSelection.Rayman23DS => Legacy_Settings.Mode.Rayman23DS, + GameModeSelection.RaymanMPC => Legacy_Settings.Mode.RaymanMPC, + GameModeSelection.RaymanMPS2 => Legacy_Settings.Mode.RaymanMPS2, + GameModeSelection.RaymanMPS2Demo_2001_07_25 => Legacy_Settings.Mode.RaymanMPS2Demo_2001_07_25, + GameModeSelection.RaymanArenaPC => Legacy_Settings.Mode.RaymanArenaPC, + GameModeSelection.RaymanArenaPS2 => Legacy_Settings.Mode.RaymanArenaPS2, + GameModeSelection.RaymanArenaGC => Legacy_Settings.Mode.RaymanArenaGC, + GameModeSelection.RaymanArenaGCDemo_2002_03_07 => Legacy_Settings.Mode.RaymanArenaGCDemo_2002_03_07, + GameModeSelection.RaymanArenaXbox => Legacy_Settings.Mode.RaymanArenaXbox, + GameModeSelection.RaymanRushPS1 => Legacy_Settings.Mode.RaymanRushPS1, + GameModeSelection.Rayman3PC => Legacy_Settings.Mode.Rayman3PC, + GameModeSelection.Rayman3PCDemo_2002_10_01 => Legacy_Settings.Mode.Rayman3PCDemo_2002_10_01, + GameModeSelection.Rayman3PCDemo_2002_10_21 => Legacy_Settings.Mode.Rayman3PCDemo_2002_10_21, + GameModeSelection.Rayman3PCDemo_2002_12_09 => Legacy_Settings.Mode.Rayman3PCDemo_2002_12_09, + GameModeSelection.Rayman3PCDemo_2003_01_06 => Legacy_Settings.Mode.Rayman3PCDemo_2003_01_06, + GameModeSelection.Rayman3MacOS => Legacy_Settings.Mode.Rayman3MacOS, + GameModeSelection.Rayman3GC => Legacy_Settings.Mode.Rayman3GC, + GameModeSelection.Rayman3PS2 => Legacy_Settings.Mode.Rayman3PS2, + GameModeSelection.Rayman3PS2Demo_2002_05_17 => Legacy_Settings.Mode.Rayman3PS2Demo_2002_05_17, + GameModeSelection.Rayman3PS2Demo_2002_08_07 => Legacy_Settings.Mode.Rayman3PS2Demo_2002_08_07, + GameModeSelection.Rayman3PS2DevBuild_2002_09_06 => Legacy_Settings.Mode.Rayman3PS2DevBuild_2002_09_06, + GameModeSelection.Rayman3PS2Demo_2002_10_29 => Legacy_Settings.Mode.Rayman3PS2Demo_2002_10_29, + GameModeSelection.Rayman3PS2Demo_2002_12_18 => Legacy_Settings.Mode.Rayman3PS2Demo_2002_12_18, + GameModeSelection.Rayman3Xbox => Legacy_Settings.Mode.Rayman3Xbox, + GameModeSelection.Rayman3Xbox360 => Legacy_Settings.Mode.Rayman3Xbox360, + GameModeSelection.Rayman3PS3 => Legacy_Settings.Mode.Rayman3PS3, + GameModeSelection.RaymanRavingRabbidsDS => Legacy_Settings.Mode.RaymanRavingRabbidsDS, + GameModeSelection.RaymanRavingRabbidsDSDevBuild_2006_05_25 => Legacy_Settings.Mode.RaymanRavingRabbidsDSDevBuild_2006_05_25, + GameModeSelection.TonicTroublePC => Legacy_Settings.Mode.TonicTroublePC, + GameModeSelection.TonicTroubleSEPC => Legacy_Settings.Mode.TonicTroubleSEPC, + GameModeSelection.TonicTroubleN64 => Legacy_Settings.Mode.TonicTroubleN64, + GameModeSelection.DonaldDuckPC => Legacy_Settings.Mode.DonaldDuckPC, + GameModeSelection.DonaldDuckPCDemo => Legacy_Settings.Mode.DonaldDuckPCDemo, + GameModeSelection.DonaldDuckDC => Legacy_Settings.Mode.DonaldDuckDC, + GameModeSelection.DonaldDuckN64 => Legacy_Settings.Mode.DonaldDuckN64, + GameModeSelection.DonaldDuckPS1 => Legacy_Settings.Mode.DonaldDuckPS1, + GameModeSelection.DonaldDuckPKGC => Legacy_Settings.Mode.DonaldDuckPKGC, + GameModeSelection.PlaymobilHypePC => Legacy_Settings.Mode.PlaymobilHypePC, + GameModeSelection.PlaymobilLauraPC => Legacy_Settings.Mode.PlaymobilLauraPC, + GameModeSelection.PlaymobilAlexPC => Legacy_Settings.Mode.PlaymobilAlexPC, + GameModeSelection.DinosaurPC => Legacy_Settings.Mode.DinosaurPC, + GameModeSelection.LargoWinchPC => Legacy_Settings.Mode.LargoWinchPC, + GameModeSelection.JungleBookPS1 => Legacy_Settings.Mode.JungleBookPS1, + GameModeSelection.VIPPS1 => Legacy_Settings.Mode.VIPPS1, + GameModeSelection.RedPlanetPC => Legacy_Settings.Mode.RedPlanetPC, + _ => throw new Exception($"Could not match Mode {raymapMode} with any CPA mode.") + }; + return legacyMode; + } + } +} diff --git a/Assets/Scripts/Games/CPA/CPA_Legacy/Manager/LegacyGameManager.cs.meta b/Assets/Scripts/Games/CPA/CPA_Legacy/Manager/LegacyGameManager.cs.meta new file mode 100644 index 00000000..30bfe762 --- /dev/null +++ b/Assets/Scripts/Games/CPA/CPA_Legacy/Manager/LegacyGameManager.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 13a9fb68b5b1ae5498512c1419d476af +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Games/CPA/CPA_Main.meta b/Assets/Scripts/Games/CPA/CPA_Main.meta new file mode 100644 index 00000000..4a246403 --- /dev/null +++ b/Assets/Scripts/Games/CPA/CPA_Main.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 2027dab4127b03842a46102dfc7ca194 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Games/CPA/CPA_Main/Manager.meta b/Assets/Scripts/Games/CPA/CPA_Main/Manager.meta new file mode 100644 index 00000000..cc2858b2 --- /dev/null +++ b/Assets/Scripts/Games/CPA/CPA_Main/Manager.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: f78bc179ac23fde479a1d0fe922e0f6e +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Games/CPA/CPA_Main/Manager/CPA_Montreal_Manager.cs b/Assets/Scripts/Games/CPA/CPA_Main/Manager/CPA_Montreal_Manager.cs new file mode 100644 index 00000000..d4963bcf --- /dev/null +++ b/Assets/Scripts/Games/CPA/CPA_Main/Manager/CPA_Montreal_Manager.cs @@ -0,0 +1,25 @@ +using BinarySerializer; +using BinarySerializer.Ubisoft.CPA; +using BinarySerializer.Unity; +using Cysharp.Threading.Tasks; +using System; +using System.Collections.Generic; +using System.IO; + +namespace Raymap { + public class CPA_Montreal_Manager : CPA_SNAManager { + public override async UniTask LoadDSC(Context context) { + // The DSC file contains information about directories which we need to load the files + GlobalLoadState.DetailedState = "Loading DSC"; + await TimeController.WaitIfNecessary(); + + var cpaGlobals = (CPA_Globals_Montreal)context.GetCPAGlobals(); + cpaGlobals.GameDSB_Montreal = FileFactory.Read>(context, CPA_Path.GameDSC.ToString()); + + // Test: + //await context.AddLinearFileAsync($"World/Levels/{context.GetMapViewerSettings().Map}/{context.GetMapViewerSettings().Map}pgb.bin"); + //SNA_File LevelPGB = FileFactory.Read>(context, $"World/Levels/{context.GetMapViewerSettings().Map}/{context.GetMapViewerSettings().Map}pgb.bin"); + } + public override void InitGlobals(Context context) => new CPA_Globals_Montreal(context, context.GetMapViewerSettings().Map); + } +} diff --git a/Assets/Scripts/Games/CPA/CPA_Main/Manager/CPA_Montreal_Manager.cs.meta b/Assets/Scripts/Games/CPA/CPA_Main/Manager/CPA_Montreal_Manager.cs.meta new file mode 100644 index 00000000..79b0c524 --- /dev/null +++ b/Assets/Scripts/Games/CPA/CPA_Main/Manager/CPA_Montreal_Manager.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 8a4007780a3de1e4586b44432f548019 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Games/CPA/CPA_Main/Manager/CPA_SNAManager.cs b/Assets/Scripts/Games/CPA/CPA_Main/Manager/CPA_SNAManager.cs new file mode 100644 index 00000000..251ed40e --- /dev/null +++ b/Assets/Scripts/Games/CPA/CPA_Main/Manager/CPA_SNAManager.cs @@ -0,0 +1,197 @@ +using BinarySerializer; +using BinarySerializer.Ubisoft.CPA; +using BinarySerializer.Unity; +using Cysharp.Threading.Tasks; +using System; +using System.Collections.Generic; +using System.IO; + +namespace Raymap { + // TODO: This will be the equivalent of the R2Loader + public class CPA_SNAManager : LegacyGameManager { + + #region Game actions + public override GameAction[] GetGameActions(MapViewerSettings settings) => new GameAction[] { + new GameAction("Export Relocation Table BigFile", false, true, (input, output) => ExportPTCAsync(settings, output)), + }; + public async UniTask ExportPTCAsync(MapViewerSettings settings, string outputDir) { + using (var context = new MapViewerContext(settings)) { + // Get the deserializer + var s = context.Deserializer; + + // Load the ROM + await LoadFilesAsync(context); + + // Download all possible files + await LoadPathsAsync(context); + + // Load DSC & bigfile + await LoadDSC(context); + + var bigFile = ((CPA_Globals_SNA)s.GetCPAGlobals()).RelocationBigFile; + + for (int occurIndex = 0; occurIndex < bigFile.OccurCount; occurIndex++) { + for (int mapIndex = 0; mapIndex < bigFile.RelocationTablesCount / 4; mapIndex++) { + await TimeController.WaitIfNecessary(); + for (int relocType = 0; relocType < 4; relocType++) { + SNA_RelocationTable table = await bigFile.SerializeRelocationTable(s, default, occurIndex, mapIndex, (SNA_RelocationType)relocType); + var relPath = Path.Combine($"Occur_{occurIndex}", $"Map_{mapIndex}", $"Map_{mapIndex}.{SNA_RelocationTable.GetExtension((SNA_RelocationType)relocType)}"); + var filePath = Path.Combine(outputDir, relPath); + + // Create and open the output file + Directory.CreateDirectory(Path.GetDirectoryName(filePath)); + using (var outputStream = File.Create(filePath)) { + // Create a context + using (var writeContext = new MapViewerContext(outputDir, settings, log: false)) { + // Create a key + const string writeKey = "rt"; + + // Add the file to the context + writeContext.AddFile(new StreamFile(writeContext, writeKey, outputStream)); + + // Write the data + FileFactory.Write(writeContext, writeKey, table); + } + } + } + } + } + + } + + UnityEngine.Debug.Log("Finished exporting PTC"); + } + #endregion + + protected override List FindFiles(MapViewerSettings settings) { + return base.FindFiles(settings); + // TODO + } + + public async UniTask LoadPathsAsync(Context context) { + // Init globals if it doesn't exist yet, we need that to get access to the paths + if (context.GetCPAGlobals(throwIfNotFound: false) == null) { + InitGlobals(context); + } + + Endian endian = context.GetCPASettings().GetEndian; + var cpaSettings = context.GetCPASettings(); + + var cpaGlobals = context.GetCPAGlobals(); + var paths = cpaGlobals.Paths; + + foreach (var p in paths) { + if(p.Value == null) continue; + var path = HackPath(p.Value); // Temporary hack: remove "GameData" from start of path. + + if(context.FileExists(path)) continue; + switch (p.Key) { + case CPA_Path.RelocationBigFile: + var bigf = await context.AddLinearFileAsync(path, endian, bigFileCacheLength: 0); + UnityEngine.Debug.Log($"{p.Key}: {path}"); + if (bigf != null) bigf.Alias = p.Key.ToString(); + break; + default: + var linf = await context.AddLinearFileAsync(path, endian); + UnityEngine.Debug.Log($"{p.Key}: {path}"); + if(linf != null) linf.Alias = p.Key.ToString(); + break; + } + } + } + + private string HackPath(string path) { + // Temporary hack: remove "GameData" from start of path. + // Later we'll change the configured paths in raymap so they point to where the exe is. + if (path.ToLower().StartsWith("gamedata/")) { + path = path.Substring("gamedata/".Length); + } else if (path.ToLower().StartsWith("/gamedata/")) { + path = path.Substring("/gamedata/".Length); + } else { + path = $"../{path}"; + } + return path; + } + + public async UniTask LoadBigFile(Context context) { + GlobalLoadState.DetailedState = "Loading BigFile"; + await TimeController.WaitIfNecessary(); + + var cpaGlobals = (CPA_Globals_SNA)context.GetCPAGlobals(); + var relocBigfilePath = HackPath(context.NormalizePath(cpaGlobals.RelocationBigFilePath, false)); + //if (context.FileManager.FileExists(context.GetAbsoluteFilePath(relocBigfilePath))) { + var bigf = await context.AddLinearFileAsync(relocBigfilePath, context.GetCPASettings().GetEndian, bigFileCacheLength: 0); + UnityEngine.Debug.Log(relocBigfilePath); + if (bigf != null) bigf.Alias = CPA_Path.RelocationBigFile.ToString(); + //} + if (context.FileExists(CPA_Path.RelocationBigFile.ToString())) { + var s = context.Deserializer; + s.Goto(context.FilePointer(CPA_Path.RelocationBigFile.ToString())); + await s.FillCacheForReadAsync(PTC_BigFileEncoder.KeysSize + SNA_RelocationBigFile.MainHeaderSize); + + s.DoAt(context.FilePointer(CPA_Path.RelocationBigFile.ToString()), () => { + cpaGlobals.RelocationBigFile = FileFactory.Read(context, CPA_Path.RelocationBigFile.ToString()); + }); + } + } + + public virtual async UniTask LoadDSC(Context context) { + // The DSC file contains information about directories which we need to load the files + GlobalLoadState.DetailedState = "Loading DSC"; + await TimeController.WaitIfNecessary(); + + var cpaGlobals = (CPA_Globals_SNA)context.GetCPAGlobals(); + cpaGlobals.GameDSB = FileFactory.Read>(context, CPA_Path.GameDSC.ToString()); + + // Also load relocation bigfile here + await LoadBigFile(context); + } + + public async UniTask LoadFix(Context context) { + GlobalLoadState.DetailedState = "Loading fix"; + await TimeController.WaitIfNecessary(); + + SNA_File sna = FileFactory.Read>(context, CPA_Path.FixSNA.ToString()); + SNA_PointerFile rtb = FileFactory.Read>(context, CPA_Path.FixRTB.ToString()); + } + + public async UniTask LoadLevel(Context context, string levelName) { + GlobalLoadState.DetailedState = "Loading level"; + await TimeController.WaitIfNecessary(); + + var cpaGlobals = (CPA_Globals_SNA)context.GetCPAGlobals(); + SNA_File sna = FileFactory.Read>(context, CPA_Path.LevelSNA.ToString()); + if (cpaGlobals.RelocationBigFile != null) { + var mapIndex = cpaGlobals?.MapIndex; + if(!mapIndex.HasValue) + throw new Exception($"Map {cpaGlobals?.Map} does not occur in Game.DSB and cannot be loaded"); + SNA_RelocationTable rtb = await cpaGlobals.RelocationBigFile.SerializeRelocationTable(context.Deserializer, default, 0, mapIndex.Value, SNA_RelocationType.SNA); + } else { + SNA_PointerFile rtb = FileFactory.Read>(context, CPA_Path.LevelRTB.ToString()); + } + + throw new NotImplementedException(); + } + + public virtual void InitGlobals(Context context) => new CPA_Globals_SNA(context, context.GetMapViewerSettings().Map); + + public override async UniTask LoadAsync(Context context) { + // Download all possible files + await LoadPathsAsync(context); + + // Load DSC + await LoadDSC(context); + + // Now that the DSC is loaded, download other files + await LoadPathsAsync(context); + + // Load fix + await LoadFix(context); + + // Load level + await LoadLevel(context, context.GetMapViewerSettings().Map); + + throw new NotImplementedException(); + } + } +} diff --git a/Assets/Scripts/Games/CPA/CPA_Main/Manager/CPA_SNAManager.cs.meta b/Assets/Scripts/Games/CPA/CPA_Main/Manager/CPA_SNAManager.cs.meta new file mode 100644 index 00000000..aade1029 --- /dev/null +++ b/Assets/Scripts/Games/CPA/CPA_Main/Manager/CPA_SNAManager.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 94336cac30006214e9c3dfef6749efa8 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Games/CPA/CPA_Main/Manager/CPA_TTPC_Manager.cs b/Assets/Scripts/Games/CPA/CPA_Main/Manager/CPA_TTPC_Manager.cs new file mode 100644 index 00000000..8766dd14 --- /dev/null +++ b/Assets/Scripts/Games/CPA/CPA_Main/Manager/CPA_TTPC_Manager.cs @@ -0,0 +1,21 @@ +using BinarySerializer; +using BinarySerializer.Ubisoft.CPA; +using BinarySerializer.Unity; +using Cysharp.Threading.Tasks; +using System; +using System.Collections.Generic; +using System.IO; + +namespace Raymap { + public class CPA_TTPC_Manager : CPA_SNAManager { + public override async UniTask LoadDSC(Context context) { + // The DSC file contains information about directories which we need to load the files + GlobalLoadState.DetailedState = "Loading DSC"; + await TimeController.WaitIfNecessary(); + + var cpaGlobals = (CPA_Globals_TTPC)context.GetCPAGlobals(); + cpaGlobals.GameDSB_TTPC = FileFactory.Read>(context, CPA_Path.GameDSC.ToString()); + } + public override void InitGlobals(Context context) => new CPA_Globals_TTPC(context, context.GetMapViewerSettings().Map); + } +} diff --git a/Assets/Scripts/Games/CPA/CPA_Main/Manager/CPA_TTPC_Manager.cs.meta b/Assets/Scripts/Games/CPA/CPA_Main/Manager/CPA_TTPC_Manager.cs.meta new file mode 100644 index 00000000..91fa0a33 --- /dev/null +++ b/Assets/Scripts/Games/CPA/CPA_Main/Manager/CPA_TTPC_Manager.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 864a336e86368974ab5dcf2c05d876db +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Games/CPA/CPA_PS1.meta b/Assets/Scripts/Games/CPA/CPA_PS1.meta new file mode 100644 index 00000000..6ae5c3f0 --- /dev/null +++ b/Assets/Scripts/Games/CPA/CPA_PS1.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 9e67b3f3385312c479fe395868c9acb1 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Games/CPA/CPA_PS1/Helpers.meta b/Assets/Scripts/Games/CPA/CPA_PS1/Helpers.meta new file mode 100644 index 00000000..ab90322b --- /dev/null +++ b/Assets/Scripts/Games/CPA/CPA_PS1/Helpers.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: d9a682741c2ee9e49a63e50bab94c633 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Games/CPA/CPA_PS1/Helpers/PS1Helpers.cs b/Assets/Scripts/Games/CPA/CPA_PS1/Helpers/PS1Helpers.cs new file mode 100644 index 00000000..31cd90fa --- /dev/null +++ b/Assets/Scripts/Games/CPA/CPA_PS1/Helpers/PS1Helpers.cs @@ -0,0 +1,226 @@ +using BinarySerializer; +using BinarySerializer.PS1; +using System; +using System.Linq; +using BinarySerializer.Unity; +using UnityEngine; + +namespace Raymap +{ + public static class PS1Helpers + { + public static void FillTexture( + this PS1_VRAM vram, + Texture2D tex, + int width, int height, + PS1_TIM.TIM_ColorFormat colorFormat, + int texX, int texY, + int clutX, int clutY, + int texturePageOriginX = 0, int texturePageOriginY = 0, + int texturePageOffsetX = 0, int texturePageOffsetY = 0, + int texturePageX = 0, int texturePageY = 0, + bool flipX = false, bool flipY = false, + bool useDummyPal = false) + { + var dummyPal = useDummyPal ? PaletteHelpers.CreateDummyPalette(colorFormat == PS1_TIM.TIM_ColorFormat.BPP_8 ? 256 : 16) : null; + + texturePageOriginX *= 2; + + for (int y = 0; y < height; y++) + { + for (int x = 0; x < width; x++) + { + byte paletteIndex; + + if (colorFormat == PS1_TIM.TIM_ColorFormat.BPP_8) + { + paletteIndex = vram.GetPixel8(texturePageX, texturePageY, + texturePageOriginX + texturePageOffsetX + x, + texturePageOriginY + texturePageOffsetY + y); + } + else if (colorFormat == PS1_TIM.TIM_ColorFormat.BPP_4) + { + paletteIndex = vram.GetPixel8(texturePageX, texturePageY, + texturePageOriginX + (texturePageOffsetX + x) / 2, + texturePageOriginY + texturePageOffsetY + y); + + if (x % 2 == 0) + paletteIndex = (byte)BitHelpers.ExtractBits(paletteIndex, 4, 0); + else + paletteIndex = (byte)BitHelpers.ExtractBits(paletteIndex, 4, 4); + } + else + { + throw new Exception($"Non-supported color format"); + } + + // Get the color from the palette + var c = useDummyPal ? dummyPal[paletteIndex] : vram.GetColor1555(0, 0, clutX + paletteIndex, clutY); + + // http://hitmen.c02.at/files/docs/psx/psx.pdf page 31 + if (c.Red == 0 && c.Green == 0 && c.Blue == 0 && c.Alpha == 0) + continue; + + c.Alpha = 1; + + var texOffsetX = flipX ? width - x - 1 : x; + var texOffsetY = flipY ? height - y - 1 : y; + + // Set the pixel + tex.SetPixel(texX + texOffsetX, tex.height - (texY + texOffsetY) - 1, c.GetColor()); + } + } + } + + public static Texture2D GetTexture( + this PS1_VRAM vram, + int width, int height, + PS1_TSB tsb, PS1_CBA cba, + int x, int y, + bool flipX = false, bool flipY = false) + { + Texture2D tex = TextureHelpers.CreateTexture2D(width, height, clear: true); + + FillTexture( + vram: vram, + tex: tex, + width: width, height: height, + colorFormat: tsb.TP switch + { + PS1_TSB.TexturePageTP.CLUT_4Bit => PS1_TIM.TIM_ColorFormat.BPP_4, + PS1_TSB.TexturePageTP.CLUT_8Bit => PS1_TIM.TIM_ColorFormat.BPP_8, + //PS1_TSB.TexturePageTP.Direct_15Bit => , + _ => throw new ArgumentOutOfRangeException() + }, + texX: 0, texY: 0, + clutX: cba.ClutX * 16, clutY: cba.ClutY, + texturePageOriginX: 0, texturePageOriginY: 0, + texturePageOffsetX: x, texturePageOffsetY: y, + texturePageX: tsb.TX, texturePageY: tsb.TY, + flipX: flipX, flipY: flipY); + + tex.Apply(); + + return tex; + } + + public static Texture2D FillMapTexture(this PS1_VRAM vram, PS1_TIM tim, PS1_CEL cel, PS1_BGD map, Texture2D tex = null) + { + tex ??= TextureHelpers.CreateTexture2D(map.MapWidth * map.CellWidth, map.MapHeight * map.CellHeight, clear: true); + + for (int mapY = 0; mapY < map.MapHeight; mapY++) + { + for (int mapX = 0; mapX < map.MapWidth; mapX++) + { + var cellIndex = map.Map[mapY * map.MapWidth + mapX]; + + if (cellIndex == 0xFF) + continue; + + var cell = cel.Cells[cellIndex]; + + if (cell.ABE) + Debug.LogWarning($"CEL ABE flag is set!"); + + vram.FillTexture( + tex: tex, + width: map.CellWidth, + height: map.CellHeight, + colorFormat: tim.ColorFormat, + texX: mapX * map.CellWidth, + texY: mapY * map.CellHeight, + clutX: cell.ClutX * 16, + clutY: cell.ClutY, + texturePageOriginX: tim.Region.XPos, + texturePageOriginY: tim.Region.YPos, + texturePageOffsetX: cell.XOffset, + texturePageOffsetY: cell.YOffset); + } + } + + tex.Apply(); + + return tex; + } + + public static Texture2D GetTexture(this PS1_TIM tim, bool flipTextureY = true, Color[] palette = null, bool onlyFirstTransparent = false, bool noPal = false) + { + if (tim.Region.XPos == 0 && tim.Region.YPos == 0) + return null; + + var pal = noPal ? null : palette ?? tim.Clut?.Palette?.GetColors().ToArray(); + + if (onlyFirstTransparent && pal != null) + for (int i = 0; i < pal.Length; i++) + pal[i].a = i == 0 ? 0 : 1; + + return GetTexture(tim.ImgData, pal, tim.Region.Width, tim.Region.Height, tim.ColorFormat, flipTextureY); + } + + public static Texture2D GetTexture(byte[] imgData, Color[] pal, int width, int height, PS1_TIM.TIM_ColorFormat colorFormat, bool flipTextureY = true) + { + Util.TileEncoding encoding; + + int palLength; + + switch (colorFormat) + { + case PS1_TIM.TIM_ColorFormat.BPP_4: + width *= 2 * 2; + encoding = Util.TileEncoding.Linear_4bpp; + palLength = 16; + break; + + case PS1_TIM.TIM_ColorFormat.BPP_8: + width *= 2; + encoding = Util.TileEncoding.Linear_8bpp; + palLength = 256; + break; + + default: + throw new ArgumentOutOfRangeException(); + } + + pal ??= PaletteHelpers.CreateDummyPalette(palLength).GetColors().ToArray(); + + var tex = TextureHelpers.CreateTexture2D(width, height); + + tex.FillRegion( + imgData: imgData, + imgDataOffset: 0, + pal: pal, + encoding: encoding, + regionX: 0, + regionY: 0, + regionWidth: tex.width, + regionHeight: tex.height, + flipTextureY: flipTextureY); + + tex.Apply(); + + return tex; + } + + /// + /// Exports the v-ram as an image + /// + /// The VRAM + /// The path to export to + public static void ExportToFile(this PS1_VRAM vram, string outputPath) + { + Texture2D vramTex = TextureHelpers.CreateTexture2D(16 * 128, 2 * 256); + + for (int x = 0; x < 16 * 128; x++) + { + for (int y = 0; y < 2 * 256; y++) + { + byte val = vram.GetPixel8(0, y / 256, x, y % 256); + vramTex.SetPixel(x, (2 * 256) - 1 - y, new Color(val / 255f, val / 255f, val / 255f)); + } + } + + vramTex.Apply(); + Util.ByteArrayToFile(outputPath, vramTex.EncodeToPNG()); + } + } +} \ No newline at end of file diff --git a/Assets/Scripts/Games/CPA/CPA_PS1/Helpers/PS1Helpers.cs.meta b/Assets/Scripts/Games/CPA/CPA_PS1/Helpers/PS1Helpers.cs.meta new file mode 100644 index 00000000..fb868a60 --- /dev/null +++ b/Assets/Scripts/Games/CPA/CPA_PS1/Helpers/PS1Helpers.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 6598d8854365c5c4ca9dd82cfa689b15 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Games/CPA/CPA_PS1/Manager.meta b/Assets/Scripts/Games/CPA/CPA_PS1/Manager.meta new file mode 100644 index 00000000..34bbce2d --- /dev/null +++ b/Assets/Scripts/Games/CPA/CPA_PS1/Manager.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 0caa88f318e9bd143bb7e760c1ebb59a +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Games/CPA/CPA_PS1/Manager/CPA_PS1Manager.cs b/Assets/Scripts/Games/CPA/CPA_PS1/Manager/CPA_PS1Manager.cs new file mode 100644 index 00000000..774b25d5 --- /dev/null +++ b/Assets/Scripts/Games/CPA/CPA_PS1/Manager/CPA_PS1Manager.cs @@ -0,0 +1,582 @@ +using System; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using BinarySerializer; +using BinarySerializer.PS1; +using BinarySerializer.Ubisoft.CPA; +using BinarySerializer.Ubisoft.CPA.PS1; +using BinarySerializer.Unity; +using Cysharp.Threading.Tasks; +using UnityEditor; +using UnityEngine; +using Debug = UnityEngine.Debug; +using PS1GameInfo = OpenSpace.PS1.PS1GameInfo; // TODO: Remove this +using Reader = BinarySerializer.Reader; +using Util = BinarySerializer.Unity.Util; + +namespace Raymap +{ + public class CPA_PS1Manager : LegacyGameManager + { + #region Private Constants + + private const ushort SectorSize = 0x800; + private const string LevelHeaderFileName = "level.sys"; + private const string LevelDataFileName = "level.img"; + + #endregion + + #region Game actions + + public override GameAction[] GetGameActions(MapViewerSettings settings) => new GameAction[] + { + new GameAction("Export Big Files", false, true, (input, output) => ExportBigFiles(settings, output)), + new GameAction("Export UI/AGO Textures", false, true, (input, output) => ExportUIAndAGOTextures(settings, output)), + }; + + public async UniTask ExportBigFiles(MapViewerSettings settings, string outputDir) + { + PS1GameInfo gameInfo = GetGameInfo(settings); + + using var context = new MapViewerContext(settings); + + await LoadFilesAsync(context); + + foreach (PS1GameInfo.File fileInfo in gameInfo.files) + await ExportBigFile(context, outputDir, gameInfo, fileInfo); + + Debug.Log("Finished exporting data"); + } + + public async UniTask ExportBigFile(Context context, string outputDir, PS1GameInfo gameInfo, PS1GameInfo.File fileInfo) + { + BinaryDeserializer s = context.Deserializer; + BinaryFile binaryFile = s.Context.GetFile(fileInfo.BigFilePath); + CPA_Settings settings = context.GetCPASettings(); + + // Get the DAT memory blocks to export + PS1GameInfo.File.MemoryBlock[] memoryBlocks = fileInfo.memoryBlocks; + + string exportDir = Path.Combine(outputDir, fileInfo.bigfile); + PS1GameInfo.File.Type type = fileInfo.type; + + // Enumerate every memory block + for (int i = 0; i < memoryBlocks.Length; i++) + { + PS1GameInfo.File.MemoryBlock b = memoryBlocks[i]; + + string lvlExportDir; + + if (type == PS1GameInfo.File.Type.Map) + { + lvlExportDir = Path.Combine(exportDir, i < gameInfo.maps.Length + ? gameInfo.maps[i] + : $"{fileInfo.bigfile}_{i}"); + } + else + { + lvlExportDir = Path.Combine(exportDir, $"{i}"); + } + + byte[][] packedFiles = await ReadPackedFilesAsync(s, binaryFile, fileInfo, b.main_compressed); + + PackedFileType[] fileTypes = GetPackedFileTypes(settings, fileInfo, b); + + for (int fileIndex = 0; fileIndex < packedFiles.Length; fileIndex++) + { + PackedFileType fileType = fileTypes[fileIndex]; + byte[] fileData = packedFiles[fileIndex]; + + switch (fileType) + { + case PackedFileType.TIM: + Util.ByteArrayToFile(Path.Combine(lvlExportDir, "vignette.tim"), fileData); + break; + + case PackedFileType.TIM_Demo1: + Util.ByteArrayToFile(Path.Combine(lvlExportDir, "vignette_demo1.tim"), fileData); + break; + + case PackedFileType.TIM_Demo2: + Util.ByteArrayToFile(Path.Combine(lvlExportDir, "vignette_demo2.tim"), fileData); + break; + + case PackedFileType.TIM_Demo3: + Util.ByteArrayToFile(Path.Combine(lvlExportDir, "vignette_demo3.tim"), fileData); + break; + + case PackedFileType.TIM_Demo4: + Util.ByteArrayToFile(Path.Combine(lvlExportDir, "vignette_demo4.tim"), fileData); + break; + + case PackedFileType.VB: + { + Util.ByteArrayToFile(Path.Combine(lvlExportDir, "sounds.vb"), fileData); + using MemoryStream ms = new MemoryStream(fileData); + using Reader r = new Reader(ms); + int soundIndex = 0; + while (r.BaseStream.Position < r.BaseStream.Length) + { + int numSamples = r.ReadInt32(); + byte[] bs = r.ReadBytes(numSamples * 8); + Util.ByteArrayToFile(Path.Combine(lvlExportDir, $"sounds_{soundIndex}.vb"), bs); + soundIndex++; + } + break; + } + + case PackedFileType.XTP: + Util.ByteArrayToFile(Path.Combine(lvlExportDir, "vram.xtp"), fileData); + break; + + case PackedFileType.SYS: + Util.ByteArrayToFile(Path.Combine(lvlExportDir, "level.sys"), fileData); + break; + + case PackedFileType.PXE_Code: + // The data file always appears after the main exe file + byte[] exe = fileData; + fileIndex++; + byte[] exeData = packedFiles[fileIndex]; + + int exeLength = exe.Length; + Array.Resize(ref exe, exeLength + exeData.Length); + Array.Copy(exeData, 0, exe, exeLength, exeData.Length); + + Util.ByteArrayToFile(Path.Combine(lvlExportDir, "executable.pxe"), exe); + break; + + //case PackedFileType.PXE_1: + // break; + + case PackedFileType.IMG: + if (type == PS1GameInfo.File.Type.Map) + Util.ByteArrayToFile(Path.Combine(lvlExportDir, "level.img"), fileData); + else if (type == PS1GameInfo.File.Type.Actor) + Util.ByteArrayToFile(Path.Combine(lvlExportDir, "actor.img"), fileData); + break; + + default: + throw new ArgumentOutOfRangeException(); + } + + await TimeController.WaitIfNecessary(); + } + + Util.ByteArrayToFile(Path.Combine(lvlExportDir, "overlay_game.img"), + await ReadDataBlockAsync(s, binaryFile, fileInfo, b.overlay_game)); + Util.ByteArrayToFile(Path.Combine(lvlExportDir, "overlay_cine.img"), + await ReadDataBlockAsync(s, binaryFile, fileInfo, b.overlay_cine)); + + await TimeController.WaitIfNecessary(); + + for (int j = 0; j < b.cutscenes.Length; j++) + { + byte[] cutsceneAudioBlk = await ReadDataBlockAsync(s, binaryFile, fileInfo, b.cutscenes[j]); + + if (cutsceneAudioBlk == null) + continue; + + Util.ByteArrayToFile(Path.Combine(lvlExportDir, $"stream_full_{j}.blk"), cutsceneAudioBlk); + SplitCutsceneStream(context, cutsceneAudioBlk, out byte[] cutsceneAudio, out byte[] cutsceneFrames); + Util.ByteArrayToFile(Path.Combine(lvlExportDir, $"stream_audio_{j}.blk"), cutsceneAudio); + Util.ByteArrayToFile(Path.Combine(lvlExportDir, $"stream_frames_{j}.blk"), cutsceneFrames); + } + + Debug.Log($"Exported memory block {i + 1}/{memoryBlocks.Length} for {fileInfo.BigFilePath}"); + await TimeController.WaitIfNecessary(); + } + } + + public async UniTask ExportUIAndAGOTextures(MapViewerSettings settings, string outputDir) + { + PS1GameInfo gameInfo = GetGameInfo(settings); + + using var context = new MapViewerContext(settings); + + await LoadFilesAsync(context); + + CPA_Settings cpaSettings = context.GetCPASettings(); + BinaryDeserializer s = context.Deserializer; + PS1GameInfo.File mainFileInfo = gameInfo.files.First(x => x.fileID == 0); + + int memBlockIndex = 0; + + foreach (PS1GameInfo.File.MemoryBlock memBlock in mainFileInfo.memoryBlocks) + { + // Read the packed files + Dictionary packedFiles = await ReadAndCategorizePackedFilesAsync( + s: s, + binaryFile: s.Context.GetFile(mainFileInfo.BigFilePath), + fileInfo: mainFileInfo, + memBlock: memBlock); + + GAM_Level_PS1 Level = new GAM_Level_PS1(context); + + Level.VRAM = LoadVRAM(cpaSettings, packedFiles[PackedFileType.XTP]); + + // Load the level memory + LoadLevelMemory(context, packedFiles[PackedFileType.IMG], memBlock); + + // Load the Global Pointer Table + GAM_GlobalPointerTable gpt = LoadGlobalPointerTable(context, packedFiles[PackedFileType.SYS]); + + string levelName = gameInfo.maps[memBlockIndex]; + + // Export UI textures + for (int i = 0; i < gpt.UITexturesCount; i++) + { + string name = gpt.UITexturesNames[i].Value.Name; + int width = gpt.UITexturesWidths[i]; + int height = gpt.UITexturesHeights[i]; + PS1_TSB tsb = gpt.UITexturesTSB[i]; + PS1_CBA cba = gpt.UITexturesCBA[i]; + byte x = gpt.UITexturesX[i]; + byte y = gpt.UITexturesY[i]; + + Texture2D tex = Level.VRAM.GetTexture(width, height, tsb, cba, x, y); + + tex.Export(Path.Combine(outputDir, "UI", levelName, name)); + } + + // Export AGO textures + for (int i = 0; i < gpt.AGOTexturesCount; i++) + { + int width = gpt.Rush_AGOTexturesWidths?[i] ?? -1; + int height = gpt.Rush_AGOTexturesHeights?[i] ?? -1; + PS1_TSB tsb = gpt.AGOTexturesTSB[i]; + PS1_CBA cba = gpt.AGOTexturesCBA[i]; + byte x = gpt.AGOTexturesX[i]; + byte y = gpt.AGOTexturesY[i]; + + if (width != -1 && height != -1) + { + Texture2D tex = Level.VRAM.GetTexture(width, height, tsb, cba, x, y); + tex.Export(Path.Combine(outputDir, "AGO", levelName, $"{i}")); + } + else + { + int pageW = tsb.TP switch + { + PS1_TSB.TexturePageTP.CLUT_8Bit => 128, + PS1_TSB.TexturePageTP.CLUT_4Bit => 256, + _ => 64 + }; + + int maxW = pageW - x; + int maxH = 256 - y; + + for (int xx = 0; xx < 5; xx++) + { + ushort w = (ushort)(0x10 << xx); + + if (w > maxW) + continue; + + for (int yy = 0; yy < 5; yy++) + { + ushort h = (ushort)(0x10 << yy); + + if (h > maxH) + continue; + + try + { + Texture2D tex = Level.VRAM.GetTexture(w, h, tsb, cba, x, y); + tex.Export(Path.Combine(outputDir, "AGO", levelName, $"{i}_{w}x{h}")); + } + catch { } + } + } + } + } + + context.RemoveFile(LevelHeaderFileName); + context.RemoveFile(LevelDataFileName); + + memBlockIndex++; + } + + Debug.Log("Finished exporting textures"); + } + + // TODO: Refactor to use BinarySerializer + public void SplitCutsceneStream(Context context, byte[] cutsceneData, out byte[] cutsceneAudio, out byte[] cutsceneFrames) + { + List cutsceneAudioList = new List(); + List cutsceneFramesList = new List(); + + using (MemoryStream ms = new MemoryStream(cutsceneData)) + { + using Reader reader = new Reader(ms, context.GetCPASettings().GetEndian == Endian.Little); + + uint size_frame_packet = 1; + while (reader.BaseStream.Position < reader.BaseStream.Length && size_frame_packet > 0) + { + size_frame_packet = reader.ReadUInt32(); + + if (size_frame_packet == 0xFFFFFFFF) + continue; + + reader.BaseStream.Position -= 4; + cutsceneFramesList.Add(reader.ReadBytes((int)size_frame_packet + 4)); + bool readParts = true; + while (readParts && reader.BaseStream.Position < reader.BaseStream.Length) + { + uint size = reader.ReadUInt32(); + + if (size == 0xFFFFFFFE) + { + readParts = false; + if (reader.BaseStream.Position % SectorSize > 0) + { + reader.BaseStream.Position = SectorSize * ((reader.BaseStream.Position / SectorSize) + 1); + } + } + else + { + bool isNull = (size & 0x80000000) != 0; + size = size & 0x7FFFFFFF; + cutsceneAudioList.Add(isNull + ? Enumerable.Repeat((byte)0x0, (int)size).ToArray() + : reader.ReadBytes((int)size)); + } + } + } + } + cutsceneAudio = cutsceneAudioList.SelectMany(i => i).ToArray(); + cutsceneFrames = cutsceneFramesList.SelectMany(i => i).ToArray(); + } + + #endregion + + #region Manager Methods + + public override void AddContextSettings(Context context) + { + base.AddContextSettings(context); + + EditorGUISerializerConfig editorConfig = context.GetEditorGUISerializerConfig(); + editorConfig.AddObjectHandler( + (obj, name) => EditorGUILayout.Vector3Field(name, new Vector3(obj.X, obj.Y, obj.Z)), + (obj, value) => + { + obj.X = value.x; + obj.Y = value.y; + obj.Z = value.z; + }); + } + + protected override List FindFiles(MapViewerSettings settings) => GetGameInfo(settings).maps.ToList(); + + public override async UniTask LoadAsync(Context context) + { + // Get properties + CPA_Settings cpaSettings = context.GetCPASettings(); + MapViewerSettings settings = context.GetMapViewerSettings(); + BinaryDeserializer s = context.Deserializer; + GAM_Level_PS1 Level = new GAM_Level_PS1(context); + + PS1GameInfo gameInfo = GetGameInfo(settings); + PS1GameInfo.File mainFileInfo = gameInfo.files.First(x => x.fileID == 0); + PS1GameInfo.File.MemoryBlock levelMemBlock = mainFileInfo.memoryBlocks[Array.IndexOf(gameInfo.maps, settings.Map)]; + + GlobalLoadState.DetailedState = $"Loading files"; + await TimeController.WaitIfNecessary(); + + // TODO: Load actor files + + // Read the packed files + Dictionary packedFiles = await ReadAndCategorizePackedFilesAsync( + s: s, + binaryFile: s.Context.GetFile(mainFileInfo.BigFilePath), + fileInfo: mainFileInfo, + memBlock: levelMemBlock); + + GlobalLoadState.DetailedState = $"Loading VRAM"; + await TimeController.WaitIfNecessary(); + + // Load the VRAM + Level.VRAM = LoadVRAM(cpaSettings, packedFiles[PackedFileType.XTP]); + + GlobalLoadState.DetailedState = $"Loading level"; + await TimeController.WaitIfNecessary(); + + // Load the level memory + LoadLevelMemory(context, packedFiles[PackedFileType.IMG], levelMemBlock); + + var sw = System.Diagnostics.Stopwatch.StartNew(); + + // Load the level header + Level.GlobalPointerTable = LoadGlobalPointerTable(context, packedFiles[PackedFileType.SYS]); + + // TODO: Load overlays & cutscene data + + sw.Stop(); + Debug.Log($"Loaded level header in {sw.ElapsedMilliseconds} ms"); + + Unity_Level_CPAPS1 unityLevel = new Unity_Level_CPAPS1() { + LevelData = Level + }; + + return unityLevel; + } + + public PS1GameInfo GetGameInfo(MapViewerSettings settings) => + // TODO: Re-implement game info. It will most likely have to remain hard-coded as some games like DD have most of the values + // set from the load function rather than data tables. + PS1GameInfo.Games[GetLegacyMode(settings)]; + + public async UniTask ReadPackedFilesAsync(BinaryDeserializer s, BinaryFile binaryFile, PS1GameInfo.File fileInfo, PS1GameInfo.File.LBA lba) + { + if (lba.lba < fileInfo.baseLBA || lba.size <= 0) + return null; + + // Get the length of the archive + long length = lba.size * SectorSize; + + // Go to the archive + s.Goto(new Pointer((lba.lba - fileInfo.baseLBA) * SectorSize, binaryFile)); + + // Fill cache + await s.FillCacheForReadAsync(length); + + // Read the archive + PackedFileArchive archive = s.SerializeObject(default, x => x.Pre_MaxLength = length, name: "PackedFiles"); + + // Return the file data + return archive.Files.Select(x => x.GetFileBytes()).Where(x => x != null).ToArray(); + } + + public async UniTask> ReadAndCategorizePackedFilesAsync(BinaryDeserializer s, BinaryFile binaryFile, PS1GameInfo.File fileInfo, PS1GameInfo.File.MemoryBlock memBlock) + { + byte[][] packedFileDatas = await ReadPackedFilesAsync(s, binaryFile, fileInfo, memBlock.main_compressed); + PackedFileType[] fileTypes = GetPackedFileTypes(s.GetCPASettings(), fileInfo, memBlock); + return packedFileDatas. + Select((x, i) => new { Data = x, Type = fileTypes[i] }). + ToDictionary(x => x.Type, x => x.Data); + } + + public async UniTask ReadDataBlockAsync(BinaryDeserializer s, BinaryFile file, PS1GameInfo.File fileInfo, PS1GameInfo.File.LBA lba) + { + if (lba.lba < fileInfo.baseLBA || lba.size <= 0) + return null; + + // Go to the data + s.Goto(new Pointer((lba.lba - fileInfo.baseLBA) * SectorSize, file)); + + // Fill cache + await s.FillCacheForReadAsync((int)lba.size); + + // Read and return the data + return s.SerializeArray(default, lba.size, name: "Data"); + } + + public PackedFileType[] GetPackedFileTypes(CPA_Settings settings, PS1GameInfo.File fileInfo, PS1GameInfo.File.MemoryBlock b) + { + var types = new List(); + + if (fileInfo.type == PS1GameInfo.File.Type.Map) + { + // TODO: Potentially find a better, less hacky, way of dealing with multiple vignette files? + if (settings.Mode is CPA_GameMode.Rayman2PS1Demo or CPA_GameMode.Rayman2PS1Demo_SLUS_90095) + { + types.Add(PackedFileType.TIM_Demo1); + types.Add(PackedFileType.TIM_Demo2); + types.Add(PackedFileType.TIM_Demo3); + + if (b.vignettes == 4) + types.Add(PackedFileType.TIM_Demo4); + } + else if (settings.EngineVersion != EngineVersion.RaymanRush_PS1 && !b.exeOnly) + { + types.Add(PackedFileType.TIM); + } + + if (!b.exeOnly && b.inEngine) + { + if (b.hasSoundEffects) + types.Add(PackedFileType.VB); + + types.Add(PackedFileType.XTP); + types.Add(PackedFileType.SYS); + } + + types.Add(PackedFileType.PXE_Code); + types.Add(PackedFileType.PXE_Data); + + if (!b.exeOnly && b.inEngine) + types.Add(PackedFileType.IMG); + } + else if (fileInfo.type == PS1GameInfo.File.Type.Actor) + { + types.Add(PackedFileType.XTP); + types.Add(PackedFileType.IMG); + } + else if (fileInfo.type == PS1GameInfo.File.Type.Sound) + { + types.Add(PackedFileType.VB); + } + + return types.ToArray(); + } + + public PS1_VRAM LoadVRAM(CPA_Settings settings, byte[] xtp) + { + PS1_VRAM vram = new PS1_VRAM(); + + int startXPage = settings.EngineVersion != EngineVersion.JungleBook_PS1 ? 5 : 8; + vram.CurrentXPage = startXPage; + + int width = Mathf.CeilToInt(xtp.Length / (float)(PS1_VRAM.PageHeight * 2)); + vram.AddData(xtp, width); + + return vram; + } + + public void LoadLevelMemory(Context context, byte[] data, PS1GameInfo.File.MemoryBlock memBlock) + { + // Add the level data as a memory mapped file. The header references data here. + context.AddMemoryMappedStreamFile(LevelDataFileName, data, memBlock.address, context.GetCPASettings().GetEndian); + } + + public GAM_GlobalPointerTable LoadGlobalPointerTable(Context context, byte[] data) + { + // Add the level header file as a linear file as it doesn't matter where it's allocated in memory. This will parse the level data. + context.AddStreamFile(LevelHeaderFileName, data, context.GetCPASettings().GetEndian); + return FileFactory.Read(context, LevelHeaderFileName); + } + + public override async UniTask LoadFilesAsync(Context context) + { + Endian endian = context.GetCPASettings().GetEndian; + PS1GameInfo gameInfo = GetGameInfo(context.GetMapViewerSettings()); + + // TODO: Don't always load all files + foreach (PS1GameInfo.File fileInfo in gameInfo.files) + await context.AddLinearFileAsync(fileInfo.BigFilePath, endian, bigFileCacheLength: SectorSize); + } + + #endregion + + #region Data Types + + public enum PackedFileType + { + TIM, // Vignette + TIM_Demo1, // Vignette + TIM_Demo2, // Vignette + TIM_Demo3, // Vignette + TIM_Demo4, // Vignette + VB, // Sound + XTP, // VRAM + SYS, // Level header + PXE_Code, // Executable + PXE_Data, // Executable data + IMG, // Level data + } + + #endregion + } +} \ No newline at end of file diff --git a/Assets/Scripts/Games/CPA/CPA_PS1/Manager/CPA_PS1Manager.cs.meta b/Assets/Scripts/Games/CPA/CPA_PS1/Manager/CPA_PS1Manager.cs.meta new file mode 100644 index 00000000..310ebc66 --- /dev/null +++ b/Assets/Scripts/Games/CPA/CPA_PS1/Manager/CPA_PS1Manager.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 74ec79ecf5858674d803dbe9abab355f +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Games/CPA/CPA_PS1/Unity_Level_CPAPS1.cs b/Assets/Scripts/Games/CPA/CPA_PS1/Unity_Level_CPAPS1.cs new file mode 100644 index 00000000..5d676d2e --- /dev/null +++ b/Assets/Scripts/Games/CPA/CPA_PS1/Unity_Level_CPAPS1.cs @@ -0,0 +1,31 @@ +using System; +using BinarySerializer.Ubisoft.CPA.PS1; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using BinarySerializer; + +namespace Raymap { + public class Unity_Level_CPAPS1 : Unity_Level { + public GAM_Level_PS1 LevelData { get; set; } + + // Added by Init + public List SuperObjects { get; set; } = new List(); // To use when SuperObjectComponent is added to GetGameObject + + public override string EnvironmentKey => Unity_Environment_CPA.Key; + + public override void Init() { + // Collect all superobjects + ProcessSuperObject(LevelData?.GlobalPointerTable?.DynamicWorld, "Dynamic world"); + ProcessSuperObject(LevelData?.GlobalPointerTable?.FatherSector, "Father sector"); + ProcessSuperObject(LevelData?.GlobalPointerTable?.InactiveDynamicWorld, "Inactive dynamic world"); + + } + + private void ProcessSuperObject(HIE_SuperObject spo, string name) { + if(spo == null) return; + var gao = spo.GetGameObject(); + if(gao != null) gao.name = name; + } + } +} diff --git a/Assets/Scripts/Games/CPA/CPA_PS1/Unity_Level_CPAPS1.cs.meta b/Assets/Scripts/Games/CPA/CPA_PS1/Unity_Level_CPAPS1.cs.meta new file mode 100644 index 00000000..c0550697 --- /dev/null +++ b/Assets/Scripts/Games/CPA/CPA_PS1/Unity_Level_CPAPS1.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: a1518e6591166de4abef0d8305d3107f +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Games/CPA/CPA_U64.meta b/Assets/Scripts/Games/CPA/CPA_U64.meta new file mode 100644 index 00000000..9d1bdbb8 --- /dev/null +++ b/Assets/Scripts/Games/CPA/CPA_U64.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 4c3c341eb4620384b80b846ead57f0ec +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Games/CPA/CPA_U64/Manager.meta b/Assets/Scripts/Games/CPA/CPA_U64/Manager.meta new file mode 100644 index 00000000..df39bc27 --- /dev/null +++ b/Assets/Scripts/Games/CPA/CPA_U64/Manager.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 2fc2358e95449fb48b9e6e4c22d69bb4 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Games/CPA/CPA_U64/Manager/CPA_R23DS_Manager.cs b/Assets/Scripts/Games/CPA/CPA_U64/Manager/CPA_R23DS_Manager.cs new file mode 100644 index 00000000..0264f624 --- /dev/null +++ b/Assets/Scripts/Games/CPA/CPA_U64/Manager/CPA_R23DS_Manager.cs @@ -0,0 +1,22 @@ + + +using Cysharp.Threading.Tasks; + +namespace Raymap { + public class CPA_R23DS_Manager : CPA_U64Manager { + + public override async UniTask ExportTexturesAsync(MapViewerSettings settings, string outputDir) { + await base.ExportTexturesAsync(settings, outputDir); + + // Stored separately + /*for (int i = 1; i < 25; i++) { + ExportEtcFile("LoadingAnimation/Course_" + i.ToString("D2") + ".etc", 64, 64, false); + } + ExportEtcFile("LoadingAnimation/home.etc", 64, 64, true); + foreach (string file in Directory.EnumerateFiles(gameDataBinFolder + "/vignette")) { + string fileName = file.Substring((gameDataBinFolder + "/vignette\\").Length); + ExportEtcFile("vignette/" + fileName, 512, 256, false); + }*/ + } + } +} diff --git a/Assets/Scripts/Games/CPA/CPA_U64/Manager/CPA_R23DS_Manager.cs.meta b/Assets/Scripts/Games/CPA/CPA_U64/Manager/CPA_R23DS_Manager.cs.meta new file mode 100644 index 00000000..22bd0312 --- /dev/null +++ b/Assets/Scripts/Games/CPA/CPA_U64/Manager/CPA_R23DS_Manager.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: c1761e49d16c75943bd6b0471e485d44 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Games/CPA/CPA_U64/Manager/CPA_R2DS_Manager.cs b/Assets/Scripts/Games/CPA/CPA_U64/Manager/CPA_R2DS_Manager.cs new file mode 100644 index 00000000..3a447993 --- /dev/null +++ b/Assets/Scripts/Games/CPA/CPA_U64/Manager/CPA_R2DS_Manager.cs @@ -0,0 +1,44 @@ + + +using Cysharp.Threading.Tasks; + +namespace Raymap { + public class CPA_R2DS_Manager : CPA_U64Manager { + + public override async UniTask ExportTexturesAsync(MapViewerSettings settings, string outputDir) { + await base.ExportTexturesAsync(settings, outputDir); + + /*PAL palette = new PAL(gameDataBinFolder + "hud/objpal.bin"); + ExportNBFC("hud/sprlums1.nbfc", 4, 4, palette.palette); + ExportNBFC("hud/sprcage1.nbfc", 4, 4, palette.palette); + ExportNBFC("hud/sprraym1.nbfc", 4, 4, palette.palette); + ExportNBFC("hud/sprraym2.nbfc", 4, 4, palette.palette); + ExportNBFC("hud/sprenmy1.nbfc", 4, 4, palette.palette); + ExportNBFC("hud/sprnumb0.nbfc", 2, 2, palette.palette); + ExportNBFC("hud/sprnumb1.nbfc", 2, 2, palette.palette); + ExportNBFC("hud/sprnumb2.nbfc", 2, 2, palette.palette); + ExportNBFC("hud/sprnumb3.nbfc", 2, 2, palette.palette); + ExportNBFC("hud/sprnumb4.nbfc", 2, 2, palette.palette); + ExportNBFC("hud/sprnumb5.nbfc", 2, 2, palette.palette); + ExportNBFC("hud/sprnumb6.nbfc", 2, 2, palette.palette); + ExportNBFC("hud/sprnumb7.nbfc", 2, 2, palette.palette); + ExportNBFC("hud/sprnumb8.nbfc", 2, 2, palette.palette); + ExportNBFC("hud/sprnumb9.nbfc", 2, 2, palette.palette); + ExportNBFC("hud/sprslash.nbfc", 2, 2, palette.palette); + ExportNBFC("hud/spbars.nbfc", 1, 9, palette.palette); + ExportNBFC("hud/stick.nbfc", 4, 4, palette.palette); + ExportNBFC("hud/stickbase.nbfc", 8, 8, palette.palette); + ExportNBFC("hud/sprspark.nbfc", 1, 1, palette.palette); + ExportNBFC("hud/ok.nbfc", 4, 4, palette.palette); + ExportNBFC("hud/smaller.nbfc", 4, 4, palette.palette); + ExportNBFC("hud/bigger.nbfc", 4, 4, palette.palette); + ExportNBFC("hud/starhi.nbfc", 2, 2, palette.palette); + ExportNBFC("hud/starmed.nbfc", 2, 2, palette.palette); + ExportNBFC("hud/starlow.nbfc", 2, 2, palette.palette); + ExportNBFC("hud/slider.nbfc", 4, 4, palette.palette); + ExportNBFC("hud/slider.nbfc", 4, 4, palette.palette); + ExportGFX("hud/bgcalib.gfx", "hud/bgcalib.map", "hud/bgcalib.pal", 32, 32); // tiles: 768 + ExportGFX("hud/mainbg.gfx", "hud/mainbg.map", "hud/mainbg.pal", 32, 32); // tiles: 864*/ + } + } +} diff --git a/Assets/Scripts/Games/CPA/CPA_U64/Manager/CPA_R2DS_Manager.cs.meta b/Assets/Scripts/Games/CPA/CPA_U64/Manager/CPA_R2DS_Manager.cs.meta new file mode 100644 index 00000000..7319651b --- /dev/null +++ b/Assets/Scripts/Games/CPA/CPA_U64/Manager/CPA_R2DS_Manager.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: cd826a616f0cc5f4da1193fac906527a +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Games/CPA/CPA_U64/Manager/CPA_RRRDS_Manager.cs b/Assets/Scripts/Games/CPA/CPA_U64/Manager/CPA_RRRDS_Manager.cs new file mode 100644 index 00000000..1dad84fc --- /dev/null +++ b/Assets/Scripts/Games/CPA/CPA_U64/Manager/CPA_RRRDS_Manager.cs @@ -0,0 +1,196 @@ + + +using Cysharp.Threading.Tasks; + +namespace Raymap { + public class CPA_RRRDS_Manager : CPA_U64Manager { + + string[] rrrMapBackgrounds = new string[] { + "Background_MM_Default", + "Background_MM_R1", + "Background_MM_R2", + "Background_MM_A1", + "Background_MM_A2", + "Background_MM_A3", + "Background_MM_B1", + "Background_MM_B2", + "Background_MM_B3", + "Background_MM_C1", + "Background_MM_C2", + "Background_MM_C3", + "Background_MM_D1", + "Background_MM_D2", + "bg_sfx_0A", + "bg_sfx_0B", + "bg_sfx_1A", + "bg_sfx_1B", + "bg_sfx_2A", + "bg_sfx_2B", + "bg_sfx_3A", + "bg_sfx_3B", + "Interface_Ray", + "bg_MapE_2_2", + "bg_MapE_1_1", + "bg_loading0", + "bg_loading1", + "bg_loading2", + "bg_loading3", + "bg_loading4", + "Interface", + "Interface_Ray", + "Interface_Gar", + "Interface_RayGear", + "bg_com", + "bg_rayman", + "bg_gardien", + "bg_MM_Default", + }; + + string[] rrrPalettes = new string[] { + "0.pal", + "Jauge_2.pal", + "Jauge_Plt_1.pal", + "Circle_Icone.pal", + "RM_Icone.pal", + "XP_Icone.pal", + "Icone_Missile.pal", + "GT_Icone.pal", + "GF_Icone.pal", + "GV_Icone.pal", + "GG_Icone.pal", + "lums_01.pal", + "Cage_Ico1.pal", + "Wind_Icon1.pal", + "Serpent_Icon.pal", + "DG_Icone.pal", + "lap1.pal", + "lap2.pal", + "MapTermine.pal", + "Cage_Ico.pal", + "Icone_Ok.pal", + "MM_pastillejaune.pal", + "one.pal", + "trophe_chiffre.pal", + "Icone_Ok_1.pal", + "MM_cadna.pal", + }; + + RRRPalettedTextureReference[] rrrTexRefs = new RRRPalettedTextureReference[] { + new RRRPalettedTextureReference(1, 8, 0x10, 0x8000, 1, "Jauge_8.bgc"), + new RRRPalettedTextureReference(1, 8, 0x10, 0x8000, 1, "Jauge_2.bgc"), + new RRRPalettedTextureReference(1, 8, 0x10, 0x8000, 1, "Jauge_R.bgc"), + new RRRPalettedTextureReference(1, 8, 0x10, 0x8000, 1, "Jauge_Fond_8.bgc"), + new RRRPalettedTextureReference(1, 8, 0x10, 0x8000, 1, "Jauge_Fond_R.bgc"), + new RRRPalettedTextureReference(1, 8, 0x10, 0x8000, 1, "Jauge_Fond_L.bgc"), + new RRRPalettedTextureReference(1, 8, 8, 0, 2, "Jauge_Plt_1.bgc"), + new RRRPalettedTextureReference(1, 8, 0x10, 0x8000, 0, "slash.bgc"), + new RRRPalettedTextureReference(1, 8, 0x10, 0x8000, 0, "0.bgc"), + new RRRPalettedTextureReference(1, 8, 0x10, 0x8000, 0, "1.bgc"), + new RRRPalettedTextureReference(1, 8, 0x10, 0x8000, 0, "2.bgc"), + new RRRPalettedTextureReference(1, 8, 0x10, 0x8000, 0, "3.bgc"), + new RRRPalettedTextureReference(1, 8, 0x10, 0x8000, 0, "4.bgc"), + new RRRPalettedTextureReference(1, 8, 0x10, 0x8000, 0, "5.bgc"), + new RRRPalettedTextureReference(1, 8, 0x10, 0x8000, 0, "6.bgc"), + new RRRPalettedTextureReference(1, 8, 0x10, 0x8000, 0, "7.bgc"), + new RRRPalettedTextureReference(1, 8, 0x10, 0x8000, 0, "8.bgc"), + new RRRPalettedTextureReference(1, 8, 0x10, 0x8000, 0, "9.bgc"), + new RRRPalettedTextureReference(6, 0x20, 0x20, 0x80000000, 4, "RM_Icone.bgc"), + new RRRPalettedTextureReference(2, 0x20, 0x20, 0x80000000, 5, "XP_Icone.bgc"), + new RRRPalettedTextureReference(1, 0x20, 0x20, 0x80000000, 6, "Icone_Missile.bgc"), + new RRRPalettedTextureReference(1, 0x20, 0x20, 0x80000000, 4, "MissBB_Icone.bgc"), + new RRRPalettedTextureReference(1, 0x40, 0x40, 0xC0000000, 3, "Circle_Icone.bgc"), + new RRRPalettedTextureReference(4, 0x20, 0x20, 0x80000000, 7, "GT_Icone.bgc"), + new RRRPalettedTextureReference(4, 0x20, 0x20, 0x80000000, 8, "GF_Icone.bgc"), + new RRRPalettedTextureReference(4, 0x20, 0x20, 0x80000000, 9, "GV_Icone.bgc"), + new RRRPalettedTextureReference(4, 0x20, 0x20, 0x80000000, 0xA, "GG_Icone.bgc"), + new RRRPalettedTextureReference(1, 0x20, 0x20, 0x80000000, 0xB, "lums_01.bgc"), + new RRRPalettedTextureReference(1, 0x20, 0x20, 0x80000000, 0xB, "lums_02.bgc"), + new RRRPalettedTextureReference(1, 0x20, 0x20, 0x80000000, 0xB, "lums_03.bgc"), + new RRRPalettedTextureReference(4, 0x20, 0x20, 0x80000000, 0xC, "Cage_Ico.bgc"), + new RRRPalettedTextureReference(4, 0x20, 0x20, 0x80000000, 0xC, "Cage_Ico1.bgc"), + new RRRPalettedTextureReference(4, 0x20, 0x20, 0x80000000, 0xC, "Cage_Ico2.bgc"), + new RRRPalettedTextureReference(4, 0x20, 0x20, 0x80000000, 0xC, "Cage_Ico3.bgc"), + new RRRPalettedTextureReference(4, 0x20, 0x20, 0x80000000, 0xD, "Wind_Icon1.bgc"), + new RRRPalettedTextureReference(4, 0x20, 0x20, 0x80000000, 0xD, "Wind_Icon2.bgc"), + new RRRPalettedTextureReference(4, 0x20, 0x20, 0x80000000, 0xD, "Wind_Icon3.bgc"), + new RRRPalettedTextureReference(4, 0x20, 0x20, 0x80000000, 0xE, "Serpent_Icon.bgc"), + new RRRPalettedTextureReference(1, 8, 8, 0, 3, "hud_Map_Ind.bgc"), + new RRRPalettedTextureReference(4, 0x20, 0x20, 0x80000000, 4, "RM_Icone_Map.bgc"), + new RRRPalettedTextureReference(4, 0x20, 0x20, 0x80000000, 0xC, "Cage_Ico_Map.bgc"), + new RRRPalettedTextureReference(4, 0x20, 0x20, 0x80000000, 0xF, "DG_Icone.bgc"), + new RRRPalettedTextureReference(2, 0x20, 0x40, 0xC0008000, 0x10, "lap1.bgc"), + new RRRPalettedTextureReference(2, 0x20, 0x40, 0xC0008000, 0x11, "lap2.bgc"), + new RRRPalettedTextureReference(8, 0x20, 0x20, 0x80000000, 0x12, "MapTermine.bgc"), + new RRRPalettedTextureReference(8, 0x20, 0x20, 0x80000000, 0x13, "Cage_Ico.bgc"), + new RRRPalettedTextureReference(8, 0x20, 0x20, 0x80000000, 0x14, "Icone_Ok.bgc"), + new RRRPalettedTextureReference(8, 0x10, 0x10, 0x40000000, 0x15, "MM_pastillejaune.bgc"), + new RRRPalettedTextureReference(8, 0x20, 0x20, 0x80000000, 0x16, "one.bgc"), + new RRRPalettedTextureReference(8, 0x20, 0x20, 0x80000000, 0x16, "seven.bgc"), + new RRRPalettedTextureReference(8, 0x20, 0x20, 0x80000000, 0x16, "twintyfive.bgc"), + new RRRPalettedTextureReference(8, 0x20, 0x20, 0x80000000, 0x16, "fourtysix.bgc"), + new RRRPalettedTextureReference(8, 0x20, 0x20, 0x80000000, 0x16, "nintyn.bgc"), + new RRRPalettedTextureReference(8, 0x40, 0x40, 0xC0000000, 0x17, "trophe_chiffre.bgc"), + new RRRPalettedTextureReference(8, 0x20, 0x20, 0x80000000, 0x18, "Icone_Ok_1.bgc"), + new RRRPalettedTextureReference(8, 0x20, 0x20, 0x80000000, 4, "RM_Icone.bgc"), + new RRRPalettedTextureReference(8, 0x20, 0x20, 0x80000000, 0x19, "MM_cadna.bgc") + }; + + private struct RRRPalettedTextureReference { + public string name; + public byte width; + public byte height; + public byte palette; + public RRRPalettedTextureReference(uint unk, byte width, byte height, uint unk2, byte palette, string name) { + this.name = name; + this.width = width; + this.height = height; + this.palette = palette; + } + } + + public override async UniTask ExportTexturesAsync(MapViewerSettings settings, string outputDir) { + await base.ExportTexturesAsync(settings, outputDir); + + /*foreach (string bg in rrrMapBackgrounds) { + ExportGFX("hud/" + bg + ".bgc", "hud/" + bg + ".scr", "hud/" + bg + ".pal", 32, 32); + } + PAL[] palettes = rrrPalettes.Select(p => new PAL(gameDataBinFolder + "hud/" + p)).ToArray(); + foreach (RRRPalettedTextureReference texRef in rrrTexRefs) { + ExportNBFC("hud/" + texRef.name, texRef.width / 8, texRef.height / 8, palettes[texRef.palette].palette, i4: true); + } + ExportNBFC("hud/Cage_Icone.bgc", 4, 4, new PAL(gameDataBinFolder + "hud/Cage_Icone.pal").palette, i4: true); + ExportNBFC("hud/Etoile_Icone.bgc", 4, 4, new PAL(gameDataBinFolder + "hud/Etoile_Icone.pal").palette, i4: true); + ExportNBFC("hud/hud_map_corner.bgc", 2, 2, new PAL(gameDataBinFolder + "hud/hud_Map_Ind.pal").palette, i4: true); + ExportNBFC("hud/ICO_Wind_NZ.bgc", 4, 4, new PAL(gameDataBinFolder + "hud/ICO_Wind_NZ.pal").palette, i4: true); + ExportNBFC("hud/Jauge_Block.bgc", 1, 1, new PAL(gameDataBinFolder + "hud/Jauge_Block.pal").palette, i4: true); + ExportNBFC("hud/Jauge_Fond.bgc", 2, 2, new PAL(gameDataBinFolder + "hud/Jauge_Block.pal").palette, i4: true); + ExportNBFC("hud/Jauge_Quart.bgc", 1, 1, new PAL(gameDataBinFolder + "hud/Jauge_Block.pal").palette, i4: true); + ExportNBFC("hud/lums_jaune.bgc", 4, 4, new PAL(gameDataBinFolder + "hud/lums_jaune.pal").palette, i4: true); + ExportNBFC("hud/Map2d_blocage.bgc", 1, 2, new PAL(gameDataBinFolder + "hud/Map2d_blocage.pal").palette, i4: true); + ExportNBFC("hud/Map2d_Cage.bgc", 2, 2, new PAL(gameDataBinFolder + "hud/Map2d_blocage.pal").palette, i4: true); + ExportNBFC("hud/Map2d_Crystal.bgc", 2, 4, new PAL(gameDataBinFolder + "hud/Map2d_blocage.pal").palette, i4: true); + ExportNBFC("hud/Map2d_Gard_Pris.bgc", 4, 4, new PAL(gameDataBinFolder + "hud/Map2d_blocage.pal").palette, i4: true); + ExportNBFC("hud/Map2d_Mont_Or.bgc", 2, 2, new PAL(gameDataBinFolder + "hud/Map2d_blocage.pal").palette, i4: true); + ExportNBFC("hud/Map2d_Teleport.bgc", 2, 2, new PAL(gameDataBinFolder + "hud/Map2d_blocage.pal").palette, i4: true); + ExportNBFC("hud/Panneau1.bgc", 4, 4, new PAL(gameDataBinFolder + "hud/Panneau1.pal").palette, i4: true); + ExportNBFC("hud/Panneau2.bgc", 4, 4, new PAL(gameDataBinFolder + "hud/Panneau2.pal").palette, i4: true); + ExportNBFC("hud/Panneau3.bgc", 4, 4, new PAL(gameDataBinFolder + "hud/Panneau3.pal").palette, i4: true); + ExportNBFC("hud/Ray_Fnt_0.bgc", 2, 2, new PAL(gameDataBinFolder + "hud/Ray_Fnt_0.pal").palette, i4: true); + ExportNBFC("hud/Ray_Fnt_1.bgc", 2, 2, new PAL(gameDataBinFolder + "hud/Ray_Fnt_0.pal").palette, i4: true); + ExportNBFC("hud/Ray_Fnt_2.bgc", 2, 2, new PAL(gameDataBinFolder + "hud/Ray_Fnt_0.pal").palette, i4: true); + ExportNBFC("hud/Ray_Fnt_3.bgc", 2, 2, new PAL(gameDataBinFolder + "hud/Ray_Fnt_0.pal").palette, i4: true); + ExportNBFC("hud/Ray_Fnt_4.bgc", 2, 2, new PAL(gameDataBinFolder + "hud/Ray_Fnt_0.pal").palette, i4: true); + ExportNBFC("hud/Ray_Fnt_5.bgc", 2, 2, new PAL(gameDataBinFolder + "hud/Ray_Fnt_0.pal").palette, i4: true); + ExportNBFC("hud/Ray_Fnt_6.bgc", 2, 2, new PAL(gameDataBinFolder + "hud/Ray_Fnt_0.pal").palette, i4: true); + ExportNBFC("hud/Ray_Fnt_7.bgc", 2, 2, new PAL(gameDataBinFolder + "hud/Ray_Fnt_0.pal").palette, i4: true); + ExportNBFC("hud/Ray_Fnt_8.bgc", 2, 2, new PAL(gameDataBinFolder + "hud/Ray_Fnt_0.pal").palette, i4: true); + ExportNBFC("hud/Ray_Fnt_9.bgc", 2, 2, new PAL(gameDataBinFolder + "hud/Ray_Fnt_0.pal").palette, i4: true); + ExportNBFC("hud/Ray_Fnt_slash.bgc", 2, 2, new PAL(gameDataBinFolder + "hud/Ray_Fnt_0.pal").palette, i4: true); + ExportNBFC("hud/trophee.bgc", 2, 2, new PAL(gameDataBinFolder + "hud/trophee.pal").palette, i4: true); + ExportNBFC("hud/wifi_level_0.bgc", 2, 2, new PAL(gameDataBinFolder + "hud/wifi_level_0.pal").palette, i4: true); + ExportNBFC("hud/wifi_level_1.bgc", 2, 2, new PAL(gameDataBinFolder + "hud/wifi_level_0.pal").palette, i4: true); + ExportNBFC("hud/wifi_level_2.bgc", 2, 2, new PAL(gameDataBinFolder + "hud/wifi_level_0.pal").palette, i4: true); + ExportNBFC("hud/wifi_level_3.bgc", 2, 2, new PAL(gameDataBinFolder + "hud/wifi_level_0.pal").palette, i4: true);*/ + } + } +} diff --git a/Assets/Scripts/Games/CPA/CPA_U64/Manager/CPA_RRRDS_Manager.cs.meta b/Assets/Scripts/Games/CPA/CPA_U64/Manager/CPA_RRRDS_Manager.cs.meta new file mode 100644 index 00000000..1c05effc --- /dev/null +++ b/Assets/Scripts/Games/CPA/CPA_U64/Manager/CPA_RRRDS_Manager.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 8978148d04aaa6444a7ada6e84a8cfe1 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Games/CPA/CPA_U64/Manager/CPA_U64Manager.cs b/Assets/Scripts/Games/CPA/CPA_U64/Manager/CPA_U64Manager.cs new file mode 100644 index 00000000..006efeeb --- /dev/null +++ b/Assets/Scripts/Games/CPA/CPA_U64/Manager/CPA_U64Manager.cs @@ -0,0 +1,436 @@ +using BinarySerializer; +using BinarySerializer.Ubisoft.CPA; +using BinarySerializer.Ubisoft.CPA.U64; +using BinarySerializer.Unity; +using Cysharp.Threading.Tasks; +using Newtonsoft.Json; +using OpenSpace; +using OpenSpace.Loader; +using System; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using UnityEngine; + +namespace Raymap { + public class CPA_U64Manager : LegacyGameManager { + public string FatFilePath => "fat.bin"; + public string DataFilePath => "data.bin"; + public string AnimsFilePath => "anims.bin"; + public string ShortAnimsFilePath => "shAnims.bin"; + public string AnimsCutTableFilePath => "cuttable.bin"; + + #region Game actions + public override GameAction[] GetGameActions(MapViewerSettings settings) => new GameAction[] { + new GameAction("Export Blocks", false, true, (input, output) => ExportBlocksAsync(settings, output)), + new GameAction("Export Backgrounds", false, true, (input, output) => ExportBackgroundsAsync(settings, output)), + new GameAction("Export Textures", false, true, (input, output) => ExportTexturesAsync(settings, output)), + new GameAction("Export Localization", false, true, (input, output) => ExportLocalizationAsync(settings, output)), + + }; + public async UniTask ExportBlocksAsync(MapViewerSettings settings, string outputDir) { + using (var context = new MapViewerContext(settings)) { + // Get the deserializer + var s = context.Deserializer; + + // Load the ROM + await LoadFilesAsync(context); + + await LoadFix(context); + + var loader = s.GetLoader(); + foreach(var l in loader.Fat.Levels) l.SerializeFat(s); + + HashSet allStructPointers = new HashSet(); + Pointer[] orderedStructs; + HashSet exportedStructs = new HashSet(); + void AddFat(LDR_Fat fat) { + foreach (var e in fat.Fat.Value.Entries) { + allStructPointers.Add(loader.GetStructPointer(e)); + } + } + AddFat(loader.Fat.FixFix); + AddFat(loader.Fat.FixLevels); + for (int i = 0; i < loader.Fat.Levels.Length; i++) { + AddFat(loader.Fat.Levels[i]); + } + orderedStructs = allStructPointers.OrderBy(p => p.AbsoluteOffset).ToArray(); + + async UniTask ExportFat(LDR_Fat fat, string dirName) { + await TimeController.WaitIfNecessary(); + foreach (var e in fat.Fat.Value.Entries) { + var ptr = loader.GetStructPointer(e); + if(exportedStructs.Contains(ptr)) continue; + exportedStructs.Add(ptr); + int index = orderedStructs.FindItemIndex(p => p == ptr); + long size = 0; + if (index+1 < orderedStructs.Length) { + size = orderedStructs[index+1].AbsoluteOffset - orderedStructs[index].AbsoluteOffset; + } else { + var f = orderedStructs[index].File; + size = f.BaseAddress + f.Length - orderedStructs[index].AbsoluteOffset; + } + + var type = U64_StructType_Defines.GetType(context, e.Type); + var typeIndex = e.Type; + var typeString = $"{typeIndex}"; + if(type.HasValue) typeString = $"{typeIndex} - {type.Value}"; + + s.DoAt(ptr, () => { + byte[] Bytes = null; + Bytes = s.SerializeArray(Bytes, size, name: nameof(Bytes)); + BinarySerializer.Unity.Util.ByteArrayToFile(Path.Combine(outputDir, dirName, $"{typeString}", $"{e.Index:X4}.bin"), Bytes); + }); + } + } + await ExportFat(loader.Fat.FixFix, "FixFix"); + await ExportFat(loader.Fat.FixLevels, "FixLevels"); + for (int i = 0; i < loader.Fat.Levels.Length; i++) { + var dirname = $"{i}"; + var levelName = loader.Fix?.Value?.LevelsNameList?.Value?.FirstOrDefault( + l => BitHelpers.ExtractBits(l.Level.Index,15, 0) == i)?.Name; + if(levelName != null) + dirname = $"{i} - {levelName}"; + + await ExportFat(loader.Fat.Levels[i], dirname); + } + } + + UnityEngine.Debug.Log("Finished exporting structs"); + } + + public async UniTask ExportBackgroundsAsync(MapViewerSettings settings, string outputDir) { + using (var context = new MapViewerContext(settings)) { + // Get the deserializer + var s = context.Deserializer; + + // Load the ROM + await LoadFilesAsync(context); + + await LoadFix(context); + + // Load menu (level index 0) + var loader = s.GetLoader(); + var levels = loader.Fix.Value.LevelsNameList.Value; + GAM_LevelsNameList ChosenLevel = levels[0]; + await LoadLevel(context, ChosenLevel.Name); + + /*loader.DscMiscInfo = new U64_Reference(context, 0); + loader.DscMiscInfo.Resolve(s); + await LoadLevel(context, loader.DscMiscInfo.Value.FirstLevelName);*/ + + ExportForLookup(loader.Fat.FixFix.Fat?.Value?.EntriesLookup); + ExportForLookup(loader.Fat.Levels[loader.LevelIndex.Value]?.Fat?.Value?.EntriesLookup); + void ExportForLookup(Dictionary> lookup) { + if (lookup?.ContainsKey(U64_StructType.BackgroundInfo) ?? false) { + foreach (var bkgInfoId in lookup[U64_StructType.BackgroundInfo].Keys) { + try { + U64_Reference bkgInfo = + new U64_Reference(context, bkgInfoId) + ?.Resolve(s, isInFixFixFat: true); + + for (int i = 0; i < bkgInfo.Value.PalettesCount; i++) { + var bkg = bkgInfo?.Value?.Background?.Value; + var pal = bkgInfo?.Value?.Palettes?.Value?[i].Entry?.Value?.Palette; + + var tex = TextureHelpers.CreateTexture2D((int)bkg.ScreenWidth, (int)bkg.ScreenHeight); + tex.FillRegion(bkg.Bitmap, 0, pal.GetColors().ToArray(), + BinarySerializer.Unity.Util.TileEncoding.Linear_8bpp, + 0, 0, tex.width, tex.height, flipRegionY: true); + tex.Apply(); + + tex.Export(Path.Combine(outputDir, $"{bkgInfo?.Index:X4}_{i}")); + } + } catch (Exception ex) { + s.LogWarning(ex.ToString()); + } + } + } + } + } + + UnityEngine.Debug.Log("Finished exporting backgrounds"); + } + + public virtual async UniTask ExportTexturesAsync(MapViewerSettings settings, string outputDir) { + + using (var context = new MapViewerContext(settings)) { + // Get the deserializer + var s = context.Deserializer; + + // Load the ROM + await LoadFilesAsync(context); + + await LoadFix(context); + + var loader = s.GetLoader(); + var levels = loader.Fix.Value.LevelsNameList.Value; + + HashSet texturesExported = new HashSet(); + + async UniTask ExportForFat(LDR_Fat fat, bool isFixFix = false) { + var lookup = fat?.Fat?.Value?.EntriesLookup.TryGetItem(U64_StructType.BitmapInfo); + if(lookup == null) return; + + foreach (var bitmapInfoRef in lookup) { + var ptr = loader.GetStructPointer(bitmapInfoRef.Value); + if(texturesExported.Contains(ptr)) continue; + texturesExported.Add(ptr); + U64_Reference bitmapInfo = new U64_Reference(context, bitmapInfoRef.Key); + bitmapInfo?.Resolve(s, isInFixFixFat: isFixFix); + Texture2D tex = bitmapInfo?.Value?.GetTexture(flip: context?.GetCPASettings().Platform != Platform.N64); + tex.Export(Path.Combine(outputDir, $"{ptr.AbsoluteOffset:X8}")); + } + await TimeController.WaitIfNecessary(); + } + + // Export for fix fats + // Set level index + loader.LevelIndex = BitHelpers.ExtractBits(levels[0].Level.Index, 15, 0); + // Load Level FAT + loader.Fat.Levels[loader.LevelIndex.Value].SerializeFat(s); + + await ExportForFat(loader.Fat.FixFix, isFixFix: true); + await ExportForFat(loader.Fat.FixLevels, isFixFix: false); + + // Export for level fats + for (int i = 0; i < levels.Length; i++) { + if (i > 0) { + // Set level index + loader.LevelIndex = BitHelpers.ExtractBits(levels[i].Level.Index, 15, 0); + // Load Level FAT + loader.Fat.Levels[loader.LevelIndex.Value].SerializeFat(s); + } + + await ExportForFat(loader.Fat.Levels[loader.LevelIndex.Value]); + } + // + //loader.Data.MainTablesDictionary[U64_StructType.BitmapCI4]; + } + // Textures in data.bin + /*texturesTableSeen = new bool[texturesTable.Length]; + for (int i = 0; i < fatTables.Length; i++) { + for (int j = 0; j < fatTables[i].entries.Length; j++) { + if (fatTables[i].entries[j].EntryType != FATEntry.Type.TextureInfo) continue; + LegacyPointer ptr = new LegacyPointer(fatTables[i].entries[j].off_data, files_array[SMem.Data]); + TextureInfo texInfo = new TextureInfo(); + texInfo.Init(ptr, fatTables[i].entries[j].index); + texInfo.Read(reader); + } + } + for (int i = 0; i < texturesTable.Length; i++) { + if (!texturesTableSeen[i]) { + print("Unused Texture: " + i + " - " + texturesTable[i] + ". Est. length: " + (texturesTable[i + 1].offset - texturesTable[i].offset)); + uint size = (texturesTable[i + 1].offset - texturesTable[i].offset); + float logSize = Mathf.Log(size, 2); + if (i < ind_textureTable_i8) { + // I4 + for (int w = 3; w < 15; w++) { + for (int h = 3; h < 15; h++) { + if (w + h == (int)logSize + 1) { + GF64 gf = new GF64(reader, texturesTable[i], 1 << w, 1 << h, GF64.Format.I4, null, 16); + Util.ByteArrayToFile(gameDataBinFolder + "/textures/unused/" + GF64.Format.I4 + "_T" + (i - ind_textureTable_i4) + "_" + gf.texture.width + "x" + gf.texture.height + ".png", gf.texture.EncodeToPNG()); + } + } + } + } else if (i < ind_textureTable_rgba) { + // I8 + for (int w = 3; w < 15; w++) { + for (int h = 3; h < 15; h++) { + if (w + h == (int)logSize) { + GF64 gf = new GF64(reader, texturesTable[i], 1 << w, 1 << h, GF64.Format.I8, null, 32); + Util.ByteArrayToFile(gameDataBinFolder + "/textures/unused/" + GF64.Format.I8 + "_T" + (i - ind_textureTable_i8) + "_" + gf.texture.width + "x" + gf.texture.height + ".png", gf.texture.EncodeToPNG()); + } + } + } + } else { + // RGBA16 + for (int w = 3; w < 15; w++) { + for (int h = 3; h < 15; h++) { + if (w + h == (int)logSize - 1) { + GF64 gf = new GF64(reader, texturesTable[i], 1 << w, 1 << h, GF64.Format.RGBA, null, 32); + Util.ByteArrayToFile(gameDataBinFolder + "/textures/unused/" + GF64.Format.RGBA + "_T" + (i - ind_textureTable_rgba) + "_" + gf.texture.width + "x" + gf.texture.height + ".png", gf.texture.EncodeToPNG()); + } + } + } + } + } + }*/ + await UniTask.CompletedTask; + } + + public virtual async UniTask ExportLocalizationAsync(MapViewerSettings settings, string outputDir) { + + using (var context = new MapViewerContext(settings)) { + // Get the deserializer + var s = context.Deserializer; + + // Load the ROM + await LoadFilesAsync(context); + + await LoadFix(context); + + // Load menu (level index 0) + var loader = s.GetLoader(); + var levels = loader.Fix.Value.LevelsNameList.Value; + GAM_LevelsNameList ChosenLevel = levels[0]; + await LoadLevel(context, ChosenLevel.Name); + + // Export loc + string filePath = Path.Combine(outputDir, $"localization_{context.GetCPASettings().Mode}.json"); + if (loader?.Languages != null) { + var output = Enumerable.Range(0, loader.Languages.Length).Select(ind => new { + Language = loader.Languages?[ind]?.Value?.LanguageName ?? ("Language " + ind), + Text = loader.Languages?[ind]?.Value?.StringList.List?.Value?.Select(str => str?.Entry?.Value?.String?.Value?.Value?.StringValue ?? ""), + StringLength = loader.Languages?[ind]?.Value?.StringLengthList?.List?.Value?.Select(str => str?.Entry?.Value?.Length ?? 0), + }); + string json = JsonConvert.SerializeObject(output, Formatting.Indented); + BinarySerializer.Unity.Util.ByteArrayToFile(filePath, Encoding.UTF8.GetBytes(json)); + } + } + } + #endregion + + protected override List FindFiles(MapViewerSettings settings) { + List levelsList = new List(); + using (var context = new MapViewerContext(settings, log: false)) { + // Add files + Endian endian = context.GetCPASettings().GetEndian; + context.AddFile(new LinearFile(context, FatFilePath, endian)); + context.AddFile(new LinearFile(context, DataFilePath, endian)); + + // Create loader + LDR_Loader loader = new LDR_Loader(context); + + var s = context.Deserializer; + + // Load fat & fix + loader.Data = FileFactory.Read(context, DataFilePath); + loader.Fat = FileFactory.Read(context, FatFilePath); + loader.Fix = new U64_Reference(context, 0).Resolve(s, isInFixFixFat: true); + + var levels = loader.Fix.Value.LevelsNameList.Value; + foreach(var l in levels) levelsList.Add(l.Name); + } + return levelsList; + } + + public override async UniTask LoadFilesAsync(Context context) { + Endian endian = context.GetCPASettings().GetEndian; + await context.AddLinearFileAsync(FatFilePath, endianness: endian); + // TODO: change this to bigfile later? + await context.AddLinearFileAsync(DataFilePath, endianness: endian); + + // Animations + await context.AddLinearFileAsync(AnimsFilePath, endianness: endian); + await context.AddLinearFileAsync(ShortAnimsFilePath, endianness: endian); + await context.AddLinearFileAsync(AnimsCutTableFilePath, endianness: endian); + } + + public async UniTask LoadAnimations(Context context) { + var loader = context.GetLoader(); + + var animsFile = FileFactory.Read(context, AnimsFilePath); + loader.AnimationsFile = animsFile; + for (int i = 0; i < animsFile.AnimationsCount; i++) { + if (i % 16 != 0) continue; // This is just a test + if (i % 256 == 0) { + GlobalLoadState.DetailedState = $"Loading animations: anims ({i + 1}/{animsFile.AnimationsCount})"; + await TimeController.WaitIfNecessary(); + } + animsFile.LoadAnimation(context.Deserializer, i); + } + var shAnimsFile = FileFactory.Read(context, ShortAnimsFilePath); + var cutTableFile = FileFactory.Read(context, AnimsCutTableFilePath); + } + + public async UniTask LoadFix(Context context) { + // Create loader + var dataPointer = context.FilePointer(DataFilePath); + LDR_Loader loader = new LDR_Loader(context); + + GlobalLoadState.DetailedState = "Loading fix"; + await TimeController.WaitIfNecessary(); + + var s = context.Deserializer; + + // Load Data + loader.Data = FileFactory.Read(context, DataFilePath); + + // Load fat + loader.Fat = FileFactory.Read(context, FatFilePath); + + // Load fix + loader.Fix = new U64_Reference(context, 0).Resolve(s, isInFixFixFat: true); + + await UniTask.CompletedTask; + } + + public async UniTask LoadLevel(Context context, string levelName) { + GlobalLoadState.DetailedState = "Loading level"; + await TimeController.WaitIfNecessary(); + + var loader = context.GetLoader(); + var s = context.Deserializer; + + // Determine level index + var levels = loader.Fix.Value.LevelsNameList.Value; + GAM_LevelsNameList ChosenLevel = null; + foreach (var level in levels) { + if (level.Name.ToLower() == levelName.ToLower()) { + ChosenLevel = level; + break; + } + } + if (ChosenLevel == null) + throw new Exception($"Invalid map: {levelName}"); + + // Set level index + loader.LevelIndex = BitHelpers.ExtractBits(ChosenLevel.Level.Index, 15, 0); + // Load Level FAT + loader.Fat.Levels[loader.LevelIndex.Value].SerializeFat(s); + + // Serialize additional references in fix + loader.Fix?.Value?.ResolveLevelReferences(s); + + loader.FixPreloadSection = new U64_Reference(context, 0); + loader.FixPreloadSection.Resolve(s); + + loader.Level?.Resolve(s); + + // FON: Localization table + loader.LanguagesCount = new U64_Reference(context, 0); + loader.LanguagesCount.Resolve(s); + loader.Languages = new U64_Reference[loader.LanguagesCount?.Value?.LanguagesCount ?? 0]; + for (ushort i = 0; i < loader.Languages.Length; i++) { + GlobalLoadState.DetailedState = $"Loading language table {i+1}/{loader.Languages.Length}"; + await TimeController.WaitIfNecessary(); + loader.Languages[i] = new U64_Reference(context, i)?.Resolve(s); + if (loader.Languages[i]?.Value != null) { + context.Logger?.Log(loader.Languages[i]?.Value.LanguageName); + } + } + + // DscMiscInfo + loader.DscMiscInfo = new U64_Reference(context, 0); + loader.DscMiscInfo.Resolve(s); + } + + public override async UniTask LoadAsync(Context context) { + // Load fix + await LoadFix(context); + + // Load level + await LoadLevel(context, context.GetMapViewerSettings().Map); + + // TODO: Load remaining unreferenced elements: objectTables, wayPoints, graphs, + + // Load animations + await LoadAnimations(context); + + throw new NotImplementedException(); + } + } +} diff --git a/Assets/Scripts/Games/CPA/CPA_U64/Manager/CPA_U64Manager.cs.meta b/Assets/Scripts/Games/CPA/CPA_U64/Manager/CPA_U64Manager.cs.meta new file mode 100644 index 00000000..3274f889 --- /dev/null +++ b/Assets/Scripts/Games/CPA/CPA_U64/Manager/CPA_U64Manager.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: eaf162c63ecae0c4bb58e0c37cbd5966 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Games/CPA/DataTypes.meta b/Assets/Scripts/Games/CPA/DataTypes.meta new file mode 100644 index 00000000..972a3907 --- /dev/null +++ b/Assets/Scripts/Games/CPA/DataTypes.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 6c63063ff176fc04c8891ea07f083e0a +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Games/CPA/DataTypes/Extensions.meta b/Assets/Scripts/Games/CPA/DataTypes/Extensions.meta new file mode 100644 index 00000000..3e6efa27 --- /dev/null +++ b/Assets/Scripts/Games/CPA/DataTypes/Extensions.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 73c4373583a90fe4980125315e49296d +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Games/CPA/DataTypes/Extensions/MAT.meta b/Assets/Scripts/Games/CPA/DataTypes/Extensions/MAT.meta new file mode 100644 index 00000000..1a9f61b2 --- /dev/null +++ b/Assets/Scripts/Games/CPA/DataTypes/Extensions/MAT.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 24f9f99d4ff5b5b439e2c824549275e4 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Games/CPA/DataTypes/Extensions/MAT/MAT_TransformationExtensions.cs b/Assets/Scripts/Games/CPA/DataTypes/Extensions/MAT/MAT_TransformationExtensions.cs new file mode 100644 index 00000000..cbf80b32 --- /dev/null +++ b/Assets/Scripts/Games/CPA/DataTypes/Extensions/MAT/MAT_TransformationExtensions.cs @@ -0,0 +1,11 @@ +using UnityEngine; + +namespace BinarySerializer.Ubisoft.CPA { + public static class MAT_TransformationExtensions { + public static void Apply(this MAT_Transformation mat, GameObject gao) { + gao.transform.localPosition = mat.Position.GetUnityVector(convertAxes: true); + gao.transform.localRotation = mat.Rotation.GetUnityQuaternion(convertAxes: true); + gao.transform.localScale = mat.Scale.GetUnityVector(convertAxes: true); + } + } +} diff --git a/Assets/Scripts/Games/CPA/DataTypes/Extensions/MAT/MAT_TransformationExtensions.cs.meta b/Assets/Scripts/Games/CPA/DataTypes/Extensions/MAT/MAT_TransformationExtensions.cs.meta new file mode 100644 index 00000000..95682123 --- /dev/null +++ b/Assets/Scripts/Games/CPA/DataTypes/Extensions/MAT/MAT_TransformationExtensions.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: e1ce332f2a6a3154e976ba4f3f784dc3 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Games/CPA/DataTypes/Extensions/MTH.meta b/Assets/Scripts/Games/CPA/DataTypes/Extensions/MTH.meta new file mode 100644 index 00000000..228afb19 --- /dev/null +++ b/Assets/Scripts/Games/CPA/DataTypes/Extensions/MTH.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 72493225633da6f4f9aaaa76850c7f10 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Games/CPA/DataTypes/Extensions/MTH/MTH2D.meta b/Assets/Scripts/Games/CPA/DataTypes/Extensions/MTH/MTH2D.meta new file mode 100644 index 00000000..0e1547d0 --- /dev/null +++ b/Assets/Scripts/Games/CPA/DataTypes/Extensions/MTH/MTH2D.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 007791617bb8d314ebe88f613d40a5a2 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Games/CPA/DataTypes/Extensions/MTH/MTH2D/MTH2D_VectorExtensions.cs b/Assets/Scripts/Games/CPA/DataTypes/Extensions/MTH/MTH2D/MTH2D_VectorExtensions.cs new file mode 100644 index 00000000..9d3dd1b7 --- /dev/null +++ b/Assets/Scripts/Games/CPA/DataTypes/Extensions/MTH/MTH2D/MTH2D_VectorExtensions.cs @@ -0,0 +1,9 @@ +using UnityEngine; + +namespace BinarySerializer.Ubisoft.CPA { + public static class MTH2D_VectorExtensions { + public static Vector2 GetUnityVector(this MTH2D_Vector v) { + return new Vector2(v.X, v.Y); + } + } +} diff --git a/Assets/Scripts/Games/CPA/DataTypes/Extensions/MTH/MTH2D/MTH2D_VectorExtensions.cs.meta b/Assets/Scripts/Games/CPA/DataTypes/Extensions/MTH/MTH2D/MTH2D_VectorExtensions.cs.meta new file mode 100644 index 00000000..68ccd486 --- /dev/null +++ b/Assets/Scripts/Games/CPA/DataTypes/Extensions/MTH/MTH2D/MTH2D_VectorExtensions.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: bc2027188ccb9ff438256f87b3374b0d +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Games/CPA/DataTypes/Extensions/MTH/MTH3D.meta b/Assets/Scripts/Games/CPA/DataTypes/Extensions/MTH/MTH3D.meta new file mode 100644 index 00000000..de8d3014 --- /dev/null +++ b/Assets/Scripts/Games/CPA/DataTypes/Extensions/MTH/MTH3D.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 383c56c9f9bc9f84b9c99164b3b5c168 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Games/CPA/DataTypes/Extensions/MTH/MTH3D/MTH3D_VectorExtensions.cs b/Assets/Scripts/Games/CPA/DataTypes/Extensions/MTH/MTH3D/MTH3D_VectorExtensions.cs new file mode 100644 index 00000000..d4f04d66 --- /dev/null +++ b/Assets/Scripts/Games/CPA/DataTypes/Extensions/MTH/MTH3D/MTH3D_VectorExtensions.cs @@ -0,0 +1,13 @@ +using UnityEngine; + +namespace BinarySerializer.Ubisoft.CPA { + public static class MTH3D_VectorExtensions { + public static Vector3 GetUnityVector(this MTH3D_Vector v, bool convertAxes = false) { + if (convertAxes) { + return new Vector3(v.X, v.Z, v.Y); + } else { + return new Vector3(v.X, v.Y, v.Z); + } + } + } +} diff --git a/Assets/Scripts/Games/CPA/DataTypes/Extensions/MTH/MTH3D/MTH3D_VectorExtensions.cs.meta b/Assets/Scripts/Games/CPA/DataTypes/Extensions/MTH/MTH3D/MTH3D_VectorExtensions.cs.meta new file mode 100644 index 00000000..8e53f86f --- /dev/null +++ b/Assets/Scripts/Games/CPA/DataTypes/Extensions/MTH/MTH3D/MTH3D_VectorExtensions.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: fcefaf7b2e4988148aacfaab381e0058 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Games/CPA/DataTypes/Extensions/MTH/MTH4D.meta b/Assets/Scripts/Games/CPA/DataTypes/Extensions/MTH/MTH4D.meta new file mode 100644 index 00000000..74561fe7 --- /dev/null +++ b/Assets/Scripts/Games/CPA/DataTypes/Extensions/MTH/MTH4D.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 7af822028e0a7684f88fd1ec9ee6b4ae +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Games/CPA/DataTypes/Extensions/MTH/MTH4D/MTH4D_VectorExtensions.cs b/Assets/Scripts/Games/CPA/DataTypes/Extensions/MTH/MTH4D/MTH4D_VectorExtensions.cs new file mode 100644 index 00000000..7461df15 --- /dev/null +++ b/Assets/Scripts/Games/CPA/DataTypes/Extensions/MTH/MTH4D/MTH4D_VectorExtensions.cs @@ -0,0 +1,16 @@ +using UnityEngine; + +namespace BinarySerializer.Ubisoft.CPA { + public static class MTH4D_VectorExtensions { + public static Vector4 GetUnityVector(this MTH4D_Vector v) { + return new Vector4(v.X, v.Y, v.Z, v.W); + } + public static Quaternion GetUnityQuaternion(this MTH4D_Vector v, bool convertAxes = false) { + if (convertAxes) { + return new Quaternion(v.X, v.Z, v.Y, -v.W); + } else { + return new Quaternion(v.X, v.Y, v.Z, v.W); + } + } + } +} diff --git a/Assets/Scripts/Games/CPA/DataTypes/Extensions/MTH/MTH4D/MTH4D_VectorExtensions.cs.meta b/Assets/Scripts/Games/CPA/DataTypes/Extensions/MTH/MTH4D/MTH4D_VectorExtensions.cs.meta new file mode 100644 index 00000000..3d171c51 --- /dev/null +++ b/Assets/Scripts/Games/CPA/DataTypes/Extensions/MTH/MTH4D/MTH4D_VectorExtensions.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 6cc10d0288494f441b30864487cd9ffc +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Games/CPA/DataTypes/Extensions/PS1.meta b/Assets/Scripts/Games/CPA/DataTypes/Extensions/PS1.meta new file mode 100644 index 00000000..224d84c3 --- /dev/null +++ b/Assets/Scripts/Games/CPA/DataTypes/Extensions/PS1.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: b6d2c10b90f2c75409bc9a2fbb774061 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Games/CPA/DataTypes/Extensions/PS1/COL.meta b/Assets/Scripts/Games/CPA/DataTypes/Extensions/PS1/COL.meta new file mode 100644 index 00000000..c4fd7788 --- /dev/null +++ b/Assets/Scripts/Games/CPA/DataTypes/Extensions/PS1/COL.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: a7040c635fa46604b88dfe91f24b890d +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Games/CPA/DataTypes/Extensions/PS1/COL/COL_GeometricObjectCollideExtensions.cs b/Assets/Scripts/Games/CPA/DataTypes/Extensions/PS1/COL/COL_GeometricObjectCollideExtensions.cs new file mode 100644 index 00000000..c190a47f --- /dev/null +++ b/Assets/Scripts/Games/CPA/DataTypes/Extensions/PS1/COL/COL_GeometricObjectCollideExtensions.cs @@ -0,0 +1,134 @@ +using Raymap; +using System; +using System.Collections.Generic; +using System.Linq; +using BinarySerializer.Unity; +using UnityEngine; + +namespace BinarySerializer.Ubisoft.CPA.PS1 { + public static class COL_GeometricObjectCollideExtensions { + public static GameObject GetGameObject(this COL_GeometricObjectCollide geo) { + GameObject parentGao = new GameObject(geo.Offset.ToString()); + parentGao.AddBinarySerializableData(geo); + + // First pass + Dictionary> elementsDict = new Dictionary>(); + void Process(COL_GeometricObjectCollidePolygon poly) { + byte gmi = poly.GameMaterial; + if (!elementsDict.ContainsKey(gmi)) elementsDict[gmi] = new List(); + elementsDict[gmi].Add(poly); + } + GMT_GameMaterial GetMaterial(int index) => geo.Context.GetLevel().GlobalPointerTable.GameMaterials[index]; + + if(geo.Triangles != null) + foreach (COL_GeometricObjectCollidePolygon t in geo.Triangles) Process(t); + if(geo.Quads != null) + foreach (COL_GeometricObjectCollidePolygon q in geo.Quads) Process(q); + + // Second pass + byte[] elements = elementsDict.Keys.ToArray(); + for (int i = 0; i < elements.Length; i++) { + byte gmi = elements[i]; + GMT_GameMaterial gmt = GetMaterial(gmi); + var cmt = gmt?.CollideMaterial?.Value; + + COL_GeometricObjectCollidePolygon pf = elementsDict[gmi].FirstOrDefault(); + GameObject gao = new GameObject(geo.Offset.ToString()); + gao.AddBinarySerializableData(geo); + if (cmt != null) { + /*+ " - " + i + + " - " + pf?.Offset*/ + gao.name += " - " + cmt.ZoneType + + "|" + string.Format("{0:X2}", cmt.Identifier); + } + gao.transform.SetParent(parentGao.transform); + gao.transform.localPosition = Vector3.zero; + gao.layer = LayerMask.NameToLayer("Collide"); + MeshFilter mf = gao.AddComponent(); + MeshRenderer mr = gao.AddComponent(); + + List vertIndices = new List(); + List triIndices = new List(); + List normalIndices = new List(); + List normals2 = new List(); + foreach (COL_GeometricObjectCollidePolygon p in elementsDict[gmi]) { + int currentCount = vertIndices.Count; + vertIndices.Add(p.V0); + vertIndices.Add(p.V1); + vertIndices.Add(p.V2); + + normalIndices.Add(p.Normal); + normalIndices.Add(p.Normal); + normalIndices.Add(p.Normal); + + // First triangle + triIndices.Add(currentCount); + triIndices.Add(currentCount + 1); + triIndices.Add(currentCount + 2); + + if (p.Pre_IsQuad) { + vertIndices.Add(p.V3); + normalIndices.Add(p.Normal); + + // Second triangle + triIndices.Add(currentCount + 2); + triIndices.Add(currentCount + 1); + triIndices.Add(currentCount + 3); + } + } + COL_GeometricObjectCollideVector[] v = vertIndices.Select(vi => geo.Vertices[vi]).ToArray(); + COL_GeometricObjectCollideVector[] n = normalIndices.Select(ni => geo.Normals[ni]).ToArray(); + Mesh m = new Mesh(); + m.vertices = v.Select(s => s.Vector.GetUnityVector(convertAxes: true)).ToArray(); + //m.vertices = verts2.ToArray(); + m.normals = n.Select(s => s.Vector.GetUnityVector(convertAxes: true)).ToArray(); + /*for(int j = 0; j < m.normals.Length; j++) { + GameObject g = GameObject.CreatePrimitive(PrimitiveType.Sphere); + g.transform.parent = gao.transform; + g.transform.localPosition = m.vertices[j] + m.normals[j]; + g.transform.localScale = Vector3.one * 0.1f; + Load.print(m.normals[j].magnitude); + }*/ + //m.SetUVs(0, uvs.Select(s => new Vector4(s.x, s.y, alpha, 0f)).ToList()); + m.triangles = triIndices.ToArray(); + + Vector2[] uvs = new Vector2[m.vertexCount]; + + // Generate simple UVs for collision checkerboard (basically a box projection) + for (int j = 0; j < m.vertexCount; j++) { + Vector3 normal = m.normals[j]; + normal = new Vector3(Mathf.Abs(normal.x), Mathf.Abs(normal.y), Mathf.Abs(normal.z)); + float biggestNorm = Mathf.Max(normal.x, normal.y, normal.z); + + float uvX = (m.vertices[j].x / 20.0f); + float uvY = (m.vertices[j].y / 20.0f); + float uvZ = (m.vertices[j].z / 20.0f); + + //Debug.Log("Norms: " + normal.x+","+normal.y+","+normal.z); + //Debug.Log("Biggest norm: " + biggestNorm); + if (biggestNorm == Mathf.Abs(normal.x)) { + uvs[j] = new Vector2(uvY, uvZ); + } else if (biggestNorm == Mathf.Abs(normal.y)) { + uvs[j] = new Vector2(uvX, uvZ); + } else if (biggestNorm == Mathf.Abs(normal.z)) { + uvs[j] = new Vector2(uvX, uvY); + } else { + Debug.LogError("HALP"); + } + } + m.uv = uvs; + + mf.mesh = m; + + mr.material = gmt.CreateMaterial(); + + try { + MeshCollider mc = gao.AddComponent(); + //mc.cookingOptions = MeshColliderCookingOptions.None; + //mc.sharedMesh = mf.sharedMesh; + } catch (Exception) { } + } + return parentGao; + } + } +} diff --git a/Assets/Scripts/Games/CPA/DataTypes/Extensions/PS1/COL/COL_GeometricObjectCollideExtensions.cs.meta b/Assets/Scripts/Games/CPA/DataTypes/Extensions/PS1/COL/COL_GeometricObjectCollideExtensions.cs.meta new file mode 100644 index 00000000..ddd0a187 --- /dev/null +++ b/Assets/Scripts/Games/CPA/DataTypes/Extensions/PS1/COL/COL_GeometricObjectCollideExtensions.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 66afbbd3286a9a44b96a55f488599fb2 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Games/CPA/DataTypes/Extensions/PS1/CS.meta b/Assets/Scripts/Games/CPA/DataTypes/Extensions/PS1/CS.meta new file mode 100644 index 00000000..3df393c4 --- /dev/null +++ b/Assets/Scripts/Games/CPA/DataTypes/Extensions/PS1/CS.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: a5c72dfd77ddde94bbf10026c3cc48b1 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Games/CPA/DataTypes/Extensions/PS1/CS/CS_PhysicalObjectCollisionExtensions.cs b/Assets/Scripts/Games/CPA/DataTypes/Extensions/PS1/CS/CS_PhysicalObjectCollisionExtensions.cs new file mode 100644 index 00000000..d6cb3165 --- /dev/null +++ b/Assets/Scripts/Games/CPA/DataTypes/Extensions/PS1/CS/CS_PhysicalObjectCollisionExtensions.cs @@ -0,0 +1,15 @@ +using BinarySerializer.Unity; +using Raymap; +using UnityEngine; + +namespace BinarySerializer.Ubisoft.CPA.PS1 { + public static class CS_PhysicalObjectCollisionExtensions { + public static GameObject GetGameObject(this CS_PhysicalObjectCollision cs) { + GameObject parentGao = new GameObject(cs.Offset.ToString()); + parentGao.AddBinarySerializableData(cs); + var gao = cs.GeoCollide?.GetGameObject(); + gao.transform.SetParent(parentGao.transform, false); + return parentGao; + } + } +} diff --git a/Assets/Scripts/Games/CPA/DataTypes/Extensions/PS1/CS/CS_PhysicalObjectCollisionExtensions.cs.meta b/Assets/Scripts/Games/CPA/DataTypes/Extensions/PS1/CS/CS_PhysicalObjectCollisionExtensions.cs.meta new file mode 100644 index 00000000..547d3c0b --- /dev/null +++ b/Assets/Scripts/Games/CPA/DataTypes/Extensions/PS1/CS/CS_PhysicalObjectCollisionExtensions.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: e5c07938218f1a347b8314cbceb7cca6 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Games/CPA/DataTypes/Extensions/PS1/GEO.meta b/Assets/Scripts/Games/CPA/DataTypes/Extensions/PS1/GEO.meta new file mode 100644 index 00000000..d2f4bd05 --- /dev/null +++ b/Assets/Scripts/Games/CPA/DataTypes/Extensions/PS1/GEO.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: aaf543900bc200d41a565da1f40c657a +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Games/CPA/DataTypes/Extensions/PS1/GEO/GEO_DeformationBoneExtensions.cs b/Assets/Scripts/Games/CPA/DataTypes/Extensions/PS1/GEO/GEO_DeformationBoneExtensions.cs new file mode 100644 index 00000000..da973196 --- /dev/null +++ b/Assets/Scripts/Games/CPA/DataTypes/Extensions/PS1/GEO/GEO_DeformationBoneExtensions.cs @@ -0,0 +1,41 @@ +using BinarySerializer.Unity; +using Raymap; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using UnityEngine; + +namespace BinarySerializer.Ubisoft.CPA.PS1 { + public static class GEO_DeformationBoneExtensions { + public static GameObject GetGameObject(this GEO_DeformationBone bone, GameObject parent) { + + GameObject gao = new GameObject($"Bone @ {bone.Offset}"); + gao.AddBinarySerializableData(bone); + gao.transform.parent = parent.transform; + + // Visualization for debugging + /*MeshRenderer mr = gao.AddComponent(); + MeshFilter mf = gao.AddComponent(); + Mesh mesh = Util.CreateBox(0.05f); + mf.mesh = mesh; + mr.material = MapLoader.Loader.collideMaterial;*/ + + bone.Apply(gao); + + return gao; + } + + public static void Apply(this GEO_DeformationBone bone, GameObject gao) { + if (gao == null) return; + gao.transform.localPosition = bone.TranslationVector.GetUnityVector(convertAxes: true); + gao.transform.localRotation = bone.RotationMatrix.InvertedMatrix.GetRotation().GetUnityQuaternion(convertAxes: true); + gao.transform.localScale = Vector3.one; + } + + public static BoneWeight GetUnityWeight(this GEO_DeformationVertexWeightSet dvw) { + return dvw.Context.GetUnityLevel().GetUnityData(dvw).UnityWeight; + } + } +} diff --git a/Assets/Scripts/Games/CPA/DataTypes/Extensions/PS1/GEO/GEO_DeformationBoneExtensions.cs.meta b/Assets/Scripts/Games/CPA/DataTypes/Extensions/PS1/GEO/GEO_DeformationBoneExtensions.cs.meta new file mode 100644 index 00000000..44ec3ea2 --- /dev/null +++ b/Assets/Scripts/Games/CPA/DataTypes/Extensions/PS1/GEO/GEO_DeformationBoneExtensions.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: be7aa688cee3b0940bc814bd80affbb3 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Games/CPA/DataTypes/Extensions/PS1/GEO/GEO_GeometricObjectExtensions.cs b/Assets/Scripts/Games/CPA/DataTypes/Extensions/PS1/GEO/GEO_GeometricObjectExtensions.cs new file mode 100644 index 00000000..a849d03c --- /dev/null +++ b/Assets/Scripts/Games/CPA/DataTypes/Extensions/PS1/GEO/GEO_GeometricObjectExtensions.cs @@ -0,0 +1,350 @@ +using BinarySerializer.Unity; +using Raymap; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using UnityEngine; + +namespace BinarySerializer.Ubisoft.CPA.PS1 { + public static class GEO_GeometricObjectExtensions { + + + public static GameObject GetGameObject(this GEO_GeometricObject geo, out GameObject[] boneGaos, GEO_GeometricObject morphObject = null, float morphProgress = 0f) { + GameObject parentGao = new GameObject(geo.Offset.ToString()); + parentGao.AddBinarySerializableData(geo); + + // Bones + boneGaos = null; + if (geo.Bones != null && geo.Bones.Length > 0) { + GameObject rootBone = new GameObject("Root bone"); + boneGaos = new GameObject[] { rootBone }; + boneGaos[0].transform.SetParent(parentGao.transform); + boneGaos[0].transform.localPosition = Vector3.zero; + boneGaos[0].transform.localRotation = Quaternion.identity; + boneGaos[0].transform.localScale = Vector3.one; + boneGaos = boneGaos.Concat(geo.Bones.Select(b => b.GetGameObject(parentGao))).ToArray(); + } + + // Morph + Vector3[] mainVertices = geo.Vertices.Select(s => s.Position.GetUnityVector(convertAxes: true)).ToArray(); + Color[] mainColors = geo.Vertices.Select(s => new Color( + s.Color.R / (float)0x80, + s.Color.G / (float)0x80, + s.Color.B / (float)0x80, + 1f)).ToArray(); + if (morphProgress > 0f && morphObject != null && morphObject.Vertices.Length == geo.Vertices.Length) { + Vector3[] morphVertices = morphObject.Vertices.Select(s => s.Position.GetUnityVector(convertAxes: true)).ToArray(); + Color[] morphColors = morphObject.Vertices.Select(s => new Color( + s.Color.R / (float)0x80, + s.Color.G / (float)0x80, + s.Color.B / (float)0x80, + 1f)).ToArray(); + for (int i = 0; i < geo.Vertices.Length; i++) { + mainVertices[i] = Vector3.Lerp(mainVertices[i], morphVertices[i], morphProgress); + mainColors[i] = Color.Lerp(mainColors[i], morphColors[i], morphProgress); + } + } + + // First pass + Dictionary> textured = new Dictionary>(); + List untextured = new List(); + for (int i = 0; i < geo.PolygonLists.Length; i++) { + GEO_PolygonList polys = geo.PolygonLists[i]; + if (polys.Polygons != null) { + foreach (GEO_IPS1Polygon p in polys.Polygons) { + if (p is GEO_QuadLOD && (p as GEO_QuadLOD).Quads?.Length > 0) { + GEO_Quad[] quads = (p as GEO_QuadLOD).Quads; + foreach (GEO_Quad q in quads) { + GLI_VisualMaterial b = q.Material; + if (b == null) { + untextured.Add(q); + } else { + if (!textured.ContainsKey(b)) textured[b] = new List(); + textured[b].Add(q); + } + } + } else { + GLI_VisualMaterial b = p.Material; + if (b == null) { + untextured.Add(p); + } else { + if (!textured.ContainsKey(b)) textured[b] = new List(); + textured[b].Add(p); + } + } + } + } + } + + // Second pass + GLI_VisualMaterial[] textures = textured.Keys.ToArray(); + for (int i = 0; i < textures.Length; i++) { + GLI_VisualMaterial vm = textures[i]; + GLI_Texture b = vm.Texture; + + float alpha = 1f; + //if (!vm.IsLight) { + /*switch (vm.BlendMode) { + case VisualMaterial.SemiTransparentMode.Point25: + alpha = 0.25f * 4f; + break; + case VisualMaterial.SemiTransparentMode.Point5: + alpha = 0.5f * 4f; + break; + }*/ + //} + + GEO_IPS1Polygon pf = textured[vm].FirstOrDefault(); + GameObject gao = new GameObject(geo.Offset.ToString() + + " - " + i + + " - " + pf?.Offset + + " - " + pf?.GetType() + + " - " + string.Format("{0:X2}", vm.MaterialFlags) + + "|" + string.Format("{0:X2}", vm.Scroll) + + " - " + vm.BlendMode); + gao.transform.SetParent(parentGao.transform); + gao.layer = LayerMask.NameToLayer("Visual"); + gao.transform.localPosition = Vector3.zero; + + List vertIndices = new List(); + List triIndices = new List(); + List uvs = new List(); + foreach (GEO_IPS1Polygon p in textured[vm]) { + int currentCount = vertIndices.Count; + switch (p) { + case GEO_Triangle t: + vertIndices.Add(t.V0); + vertIndices.Add(t.V1); + vertIndices.Add(t.V2); + + uvs.Add(b.CalculateUV(t.X0, t.Y0).GetUnityVector()); + uvs.Add(b.CalculateUV(t.X1, t.Y1).GetUnityVector()); + uvs.Add(b.CalculateUV(t.X2, t.Y2).GetUnityVector()); + /*Vector2 uv0 = b.CalculateUV(t.x0, t.y0); + Vector2 uv1 = b.CalculateUV(t.x1, t.y1); + Vector2 uv2 = b.CalculateUV(t.x2, t.y2); + uvs.Add(uv0); + uvs.Add(uv1); + uvs.Add(uv2);*/ + + triIndices.Add(currentCount); + triIndices.Add(currentCount + 1); + triIndices.Add(currentCount + 2); + break; + case GEO_Quad q: + vertIndices.Add(q.V0); + vertIndices.Add(q.V1); + vertIndices.Add(q.V2); + vertIndices.Add(q.V3); + + uvs.Add(b.CalculateUV(q.X0, q.Y0).GetUnityVector()); + uvs.Add(b.CalculateUV(q.X1, q.Y1).GetUnityVector()); + uvs.Add(b.CalculateUV(q.X2, q.Y2).GetUnityVector()); + uvs.Add(b.CalculateUV(q.X3, q.Y3).GetUnityVector()); + + triIndices.Add(currentCount); + triIndices.Add(currentCount + 1); + triIndices.Add(currentCount + 2); + + triIndices.Add(currentCount + 2); + triIndices.Add(currentCount + 1); + triIndices.Add(currentCount + 3); + break; + case GEO_Sprite s: + + GameObject spr_gao = new GameObject("Sprite"); + spr_gao.transform.SetParent(gao.transform); + spr_gao.transform.localPosition = mainVertices[s.V0]; + BillboardBehaviour billboard = spr_gao.AddComponent(); + billboard.mode = BillboardBehaviour.LookAtMode.ViewRotation; + MeshFilter sprites_mf = spr_gao.AddComponent(); + MeshRenderer sprites_mr = spr_gao.AddComponent(); + + spr_gao.layer = LayerMask.NameToLayer("Visual"); + + //Material unityMat = sprites[i].visualMaterial.MaterialBillboard; + + sprites_mr.receiveShadows = false; + sprites_mr.material = vm.CreateMaterial(); + + var meshUnity = new Mesh(); + Vector3[] vertices = new Vector3[4]; + + float scale_x = 1.0f; + float scale_y = 1.0f; + + scale_x = ((float)s.Height / geo.Context.GetLevel().CoordinateFactor) / 2.0f; + scale_y = ((float)s.Width / geo.Context.GetLevel().CoordinateFactor) / 2.0f; + + BoxCollider bc = spr_gao.AddComponent(); + bc.size = new Vector3(0, scale_y * 2, scale_x * 2); + + vertices[0] = new Vector3(0, -scale_y, -scale_x); + vertices[1] = new Vector3(0, -scale_y, scale_x); + vertices[2] = new Vector3(0, scale_y, -scale_x); + vertices[3] = new Vector3(0, scale_y, scale_x); + Vector3[] normals = new Vector3[4]; + normals[0] = Vector3.forward; + normals[1] = Vector3.forward; + normals[2] = Vector3.forward; + normals[3] = Vector3.forward; + Vector3[] sprite_uvs = new Vector3[4]; + + bool mirrorX = false; + bool mirrorY = false; + + sprite_uvs[0] = new Vector3(0, 0 - (mirrorY ? 1 : 0), alpha); + sprite_uvs[1] = new Vector3(1 + (mirrorX ? 1 : 0), 0 - (mirrorY ? 1 : 0), alpha); + sprite_uvs[2] = new Vector3(0, 1, alpha); + sprite_uvs[3] = new Vector3(1 + (mirrorX ? 1 : 0), 1, alpha); + int[] triangles = new int[] { 0, 2, 1, 1, 2, 3 }; + + meshUnity.vertices = vertices; + meshUnity.normals = normals; + meshUnity.triangles = triangles; + meshUnity.SetUVs(0, sprite_uvs.ToList()); + sprites_mf.sharedMesh = meshUnity; + + break; + } + } + //Vertex[] v = vertIndices.Select(vi => vertices[vi]).ToArray(); + BoneWeight[] w = null; + if (geo.Bones != null && geo.Bones.Length > 0 && geo.BoneWeights != null) { + w = new BoneWeight[vertIndices.Count]; + for (int vi = 0; vi < w.Length; vi++) { + GEO_DeformationVertexWeightSet dvw = geo.BoneWeights.FirstOrDefault(bw => bw.VertexIndex == vertIndices[vi]); + if (dvw != null) { + w[vi] = dvw.GetUnityWeight(); + } else { + w[vi] = new BoneWeight() { boneIndex0 = 0, weight0 = 1f }; + } + } + } + if (vertIndices.Any()) { + MeshFilter mf = gao.AddComponent(); + gao.AddComponent(); + MeshRenderer mr = null; + SkinnedMeshRenderer smr = null; + Matrix4x4[] bindPoses = null; + if (geo.Bones == null || geo.Bones.Length <= 0) { + mr = gao.AddComponent(); + } else { + smr = gao.AddComponent(); + //smr = (SkinnedMeshRenderer)mr; + smr.bones = boneGaos.Select(bo => bo.transform).ToArray(); + bindPoses = new Matrix4x4[smr.bones.Length]; + for (int bi = 0; bi < smr.bones.Length; bi++) { + bindPoses[bi] = smr.bones[bi].worldToLocalMatrix * parentGao.transform.localToWorldMatrix; + } + smr.rootBone = smr.bones[0]; + } + + Mesh m = new Mesh(); + m.vertices = vertIndices.Select(vi => mainVertices[vi]).ToArray(); + m.colors = vertIndices.Select(vi => mainColors[vi]).ToArray(); + m.SetUVs(0, uvs.Select(s => new Vector4(s.x, s.y, alpha, 0f)).ToList()); + m.triangles = triIndices.ToArray(); + m.RecalculateNormals(); + if (w != null) { + m.boneWeights = w; + m.bindposes = bindPoses; + } + mf.mesh = m; + + if (mr != null) { + mr.material = vm.CreateMaterial(); + } else if (smr != null) { + smr.material = vm.CreateMaterial(); + smr.sharedMesh = m; + } + try { + MeshCollider mc = gao.AddComponent(); + mc.isTrigger = false; + //mc.cookingOptions = MeshColliderCookingOptions.None; + //mc.sharedMesh = mesh; + } catch (Exception) { } + } + } + + // Untextured (some skyboxes, etc) + if (untextured.Count > 0) { + GameObject gao = new GameObject(geo.Offset.ToString() + " - Untextured"); + gao.transform.SetParent(parentGao.transform); + gao.layer = LayerMask.NameToLayer("Visual"); + gao.transform.localPosition = Vector3.zero; + MeshFilter mf = gao.AddComponent(); + gao.AddComponent(); + MeshRenderer mr = gao.AddComponent(); + List vertIndices = new List(); + List triIndices = new List(); + + foreach (GEO_IPS1Polygon p in untextured) { + int currentCount = vertIndices.Count; + switch (p) { + case GEO_TriangleNoTexture t: + vertIndices.Add(t.V0); + vertIndices.Add(t.V1); + vertIndices.Add(t.V2); + + triIndices.Add(currentCount); + triIndices.Add(currentCount + 1); + triIndices.Add(currentCount + 2); + break; + case GEO_QuadNoTexture q: + vertIndices.Add(q.V0); + vertIndices.Add(q.V1); + vertIndices.Add(q.V2); + vertIndices.Add(q.V3); + + triIndices.Add(currentCount); + triIndices.Add(currentCount + 1); + triIndices.Add(currentCount + 2); + + triIndices.Add(currentCount + 2); + triIndices.Add(currentCount + 1); + triIndices.Add(currentCount + 3); + break; + default: + Debug.LogWarning(p.GetType()); break; + } + } + //Vertex[] v = vertIndices.Select(vi => vertices[vi]).ToArray(); + Mesh m = new Mesh(); + m.vertices = vertIndices.Select(vi => mainVertices[vi]).ToArray(); + m.colors = vertIndices.Select(vi => mainColors[vi]).ToArray(); + m.SetUVs(0, vertIndices.Select(s => new Vector4(0.5f, 0.5f, 1f, 1f)).ToList()); + m.triangles = triIndices.ToArray(); + m.RecalculateNormals(); + mf.mesh = m; + + Material baseMaterial; + /*if (m.colors.Any(c => c.a != 1f)) { + baseMaterial = Load.baseTransparentMaterial; + } else {*/ + baseMaterial = ((Unity_Environment_CPA)geo.Context.GetUnityEnvironment()).MaterialVisualOpaque; + //} + Material mat = new Material(baseMaterial); + mat.SetInt("_NumTextures", 1); + string textureName = "_Tex0"; + Texture2D tex = TextureHelpers.GrayTexture(); + mat.SetTexture(textureName, tex); + mat.SetVector("_AmbientCoef", Vector4.one); + mat.SetFloat("_Prelit", 1f); + mr.material = mat; + + try { + MeshCollider mc = gao.AddComponent(); + mc.isTrigger = false; + //mc.cookingOptions = MeshColliderCookingOptions.None; + //mc.sharedMesh = mesh; + } catch (Exception) { } + } + + + return parentGao; + } + } +} diff --git a/Assets/Scripts/Games/CPA/DataTypes/Extensions/PS1/GEO/GEO_GeometricObjectExtensions.cs.meta b/Assets/Scripts/Games/CPA/DataTypes/Extensions/PS1/GEO/GEO_GeometricObjectExtensions.cs.meta new file mode 100644 index 00000000..c9bd3838 --- /dev/null +++ b/Assets/Scripts/Games/CPA/DataTypes/Extensions/PS1/GEO/GEO_GeometricObjectExtensions.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 5a849e61bde86ea47b182ba6ec08ad12 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Games/CPA/DataTypes/Extensions/PS1/GEO/GEO_UnityDeformationWeight.cs b/Assets/Scripts/Games/CPA/DataTypes/Extensions/PS1/GEO/GEO_UnityDeformationWeight.cs new file mode 100644 index 00000000..3676ccf3 --- /dev/null +++ b/Assets/Scripts/Games/CPA/DataTypes/Extensions/PS1/GEO/GEO_UnityDeformationWeight.cs @@ -0,0 +1,54 @@ +using Raymap; +using System; +using System.Collections.Generic; +using System.Linq; +using UnityEngine; + +namespace BinarySerializer.Ubisoft.CPA.PS1 { + public class GEO_UnityDeformationWeight : Unity_Data { + private bool unityWeightCalculated = false; + private BoneWeight unityWeight; + public BoneWeight UnityWeight { + get { + if (!unityWeightCalculated) { + unityWeight = new BoneWeight(); + unityWeight.boneIndex0 = 0; + unityWeight.boneIndex1 = 0; + unityWeight.boneIndex2 = 0; + unityWeight.boneIndex3 = 0; + unityWeight.weight0 = 0; + unityWeight.weight1 = 0; + unityWeight.weight2 = 0; + unityWeight.weight3 = 0; + List> sortedWeights = LinkedObject.Weights.Select(w => new KeyValuePair((ushort)(w.Bone + 1), w.Weight)).OrderByDescending(w => w.Value).ToList(); + UInt16 sortedWeightsSum = (UInt16)sortedWeights.Select(w => (Int32)(w.Value)).Sum(); + if (sortedWeightsSum < UInt16.MaxValue) { + sortedWeights.Add(new KeyValuePair(0, (ushort)(UInt16.MaxValue - sortedWeightsSum))); + } + sortedWeights = sortedWeights.OrderByDescending(w => w.Value).ToList(); + if (sortedWeights.Count > 0) { + unityWeight.boneIndex0 = sortedWeights[0].Key; + unityWeight.weight0 = (float)sortedWeights[0].Value / (float)UInt16.MaxValue; + } + if (sortedWeights.Count > 1) { + unityWeight.boneIndex1 = sortedWeights[1].Key; + unityWeight.weight1 = (float)sortedWeights[1].Value / (float)UInt16.MaxValue; + } + if (sortedWeights.Count > 2) { + unityWeight.boneIndex2 = sortedWeights[2].Key; + unityWeight.weight2 = (float)sortedWeights[2].Value / (float)UInt16.MaxValue; + } + if (sortedWeights.Count > 3) { + unityWeight.boneIndex3 = sortedWeights[3].Key; + unityWeight.weight3 = (float)sortedWeights[3].Value / (float)UInt16.MaxValue; + } + if (sortedWeights.Count > 4) { + UnityEngine.Debug.Log("Unity does not support more than 4 bones affecting a vertex at once."); + } + unityWeightCalculated = true; + } + return unityWeight; + } + } + } +} diff --git a/Assets/Scripts/Games/CPA/DataTypes/Extensions/PS1/GEO/GEO_UnityDeformationWeight.cs.meta b/Assets/Scripts/Games/CPA/DataTypes/Extensions/PS1/GEO/GEO_UnityDeformationWeight.cs.meta new file mode 100644 index 00000000..ab53da76 --- /dev/null +++ b/Assets/Scripts/Games/CPA/DataTypes/Extensions/PS1/GEO/GEO_UnityDeformationWeight.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 988bd33ac4b8aa3499fa10107c9f1aa5 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Games/CPA/DataTypes/Extensions/PS1/GLI.meta b/Assets/Scripts/Games/CPA/DataTypes/Extensions/PS1/GLI.meta new file mode 100644 index 00000000..69386330 --- /dev/null +++ b/Assets/Scripts/Games/CPA/DataTypes/Extensions/PS1/GLI.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 4fd5cd960ac06bf4e9da0f7c5d356100 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Games/CPA/DataTypes/Extensions/PS1/GLI/GLI_TextureExtensions.cs b/Assets/Scripts/Games/CPA/DataTypes/Extensions/PS1/GLI/GLI_TextureExtensions.cs new file mode 100644 index 00000000..49daa238 --- /dev/null +++ b/Assets/Scripts/Games/CPA/DataTypes/Extensions/PS1/GLI/GLI_TextureExtensions.cs @@ -0,0 +1,21 @@ +using BinarySerializer.Unity; +using Raymap; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using UnityEngine; +using static BinarySerializer.Ubisoft.CPA.PS1.GLI_VisualMaterial; + +namespace BinarySerializer.Ubisoft.CPA.PS1 { + public static class GLI_TextureExtensions { + public static bool IsTransparent(this GLI_Texture tb) { + return tb.Context.GetUnityLevel().GetUnityData(tb).IsTransparent; + } + + public static Texture2D GetTexture(this GLI_Texture tb) { + return tb.Context.GetUnityLevel().GetUnityData(tb).Texture; + } + } +} diff --git a/Assets/Scripts/Games/CPA/DataTypes/Extensions/PS1/GLI/GLI_TextureExtensions.cs.meta b/Assets/Scripts/Games/CPA/DataTypes/Extensions/PS1/GLI/GLI_TextureExtensions.cs.meta new file mode 100644 index 00000000..c20d4601 --- /dev/null +++ b/Assets/Scripts/Games/CPA/DataTypes/Extensions/PS1/GLI/GLI_TextureExtensions.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 2583de25e6f61e342bc9cb7c206ecd8f +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Games/CPA/DataTypes/Extensions/PS1/GLI/GLI_UnityTexture.cs b/Assets/Scripts/Games/CPA/DataTypes/Extensions/PS1/GLI/GLI_UnityTexture.cs new file mode 100644 index 00000000..89fc9313 --- /dev/null +++ b/Assets/Scripts/Games/CPA/DataTypes/Extensions/PS1/GLI/GLI_UnityTexture.cs @@ -0,0 +1,28 @@ +using BinarySerializer.Unity; +using Raymap; +using System.Linq; +using UnityEngine; + +namespace BinarySerializer.Ubisoft.CPA.PS1 { + public class GLI_UnityTexture : Unity_Data { + private Texture2D CachedTexture { get; set; } + public Texture2D Texture { + get { + if (CachedTexture == null) { + CachedTexture = Context.GetLevel().VRAM.GetTexture(LinkedObject.Width, LinkedObject.Height, LinkedObject.TSB, LinkedObject.CBA, LinkedObject.xMin, LinkedObject.yMin); + } + return CachedTexture; + } + } + private bool? CachedIsTransparent { get; set;} + public bool IsTransparent { + get { + if (!CachedIsTransparent.HasValue) { + var tex = Texture; + CachedIsTransparent = tex?.IsTransparent(); + } + return CachedIsTransparent.Value; + } + } + } +} diff --git a/Assets/Scripts/Games/CPA/DataTypes/Extensions/PS1/GLI/GLI_UnityTexture.cs.meta b/Assets/Scripts/Games/CPA/DataTypes/Extensions/PS1/GLI/GLI_UnityTexture.cs.meta new file mode 100644 index 00000000..fe52c264 --- /dev/null +++ b/Assets/Scripts/Games/CPA/DataTypes/Extensions/PS1/GLI/GLI_UnityTexture.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: bc38b92b01d29344da69b47503041bea +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Games/CPA/DataTypes/Extensions/PS1/GLI/GLI_VisualMaterialExtensions.cs b/Assets/Scripts/Games/CPA/DataTypes/Extensions/PS1/GLI/GLI_VisualMaterialExtensions.cs new file mode 100644 index 00000000..74d3b559 --- /dev/null +++ b/Assets/Scripts/Games/CPA/DataTypes/Extensions/PS1/GLI/GLI_VisualMaterialExtensions.cs @@ -0,0 +1,48 @@ +using UnityEngine; +using Raymap; +using static BinarySerializer.Ubisoft.CPA.PS1.GLI_VisualMaterial; + +namespace BinarySerializer.Ubisoft.CPA.PS1 { + public static class GLI_VisualMaterialExtensions { + public static Material CreateMaterial(this GLI_VisualMaterial vm) { + GLI_Texture b = vm.Texture; + Material baseMaterial; + SemiTransparentMode stMode = vm.BlendMode; + var env = (Unity_Environment_CPA)vm.Context.GetUnityEnvironment(); + if (vm.IsLight || stMode == SemiTransparentMode.MinusOne) { + baseMaterial = env.MaterialVisualLight; + } else if ((vm?.Texture?.IsTransparent() ?? false) || stMode != SemiTransparentMode.One) { + baseMaterial = env.MaterialVisualTransparent; + } else { + baseMaterial = env.MaterialVisualOpaque; + } + // TODO: Figure out transparency for these games + //if (Settings.s.game == Settings.Game.JungleBook || Settings.s.game == Settings.Game.DD) { + // baseMaterial = MapLoader.Loader.baseMaterial; + //} + Material mat = new Material(baseMaterial); + mat.SetInt("_NumTextures", 1); + string textureName = "_Tex0"; + Texture2D tex = b.GetTexture(); + if (vm.ScrollingEnabled) tex.wrapMode = TextureWrapMode.Repeat; + mat.SetTexture(textureName, tex); + + mat.SetVector(textureName + "Params", new Vector4(0, + vm.ScrollingEnabled ? 1f : 0f, + 0f, 0f)); + mat.SetVector(textureName + "Params2", new Vector4( + 0f, 0f, + vm.ScrollX, vm.ScrollY)); + mat.SetVector("_AmbientCoef", Vector4.one); + mat.SetFloat("_Prelit", 1f); + switch (stMode) { + case SemiTransparentMode.MinusOne: + mat.SetInt("_BlendOp", (int)UnityEngine.Rendering.BlendOp.ReverseSubtract); + mat.SetInt("_SrcBlendMode", (int)UnityEngine.Rendering.BlendMode.One); + mat.SetInt("_DstBlendMode", (int)UnityEngine.Rendering.BlendMode.One); + break; + } + return mat; + } + } +} diff --git a/Assets/Scripts/Games/CPA/DataTypes/Extensions/PS1/GLI/GLI_VisualMaterialExtensions.cs.meta b/Assets/Scripts/Games/CPA/DataTypes/Extensions/PS1/GLI/GLI_VisualMaterialExtensions.cs.meta new file mode 100644 index 00000000..28070454 --- /dev/null +++ b/Assets/Scripts/Games/CPA/DataTypes/Extensions/PS1/GLI/GLI_VisualMaterialExtensions.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 7c41947c80c81554eaf377d193475e68 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Games/CPA/DataTypes/Extensions/PS1/GMT.meta b/Assets/Scripts/Games/CPA/DataTypes/Extensions/PS1/GMT.meta new file mode 100644 index 00000000..81a07bb4 --- /dev/null +++ b/Assets/Scripts/Games/CPA/DataTypes/Extensions/PS1/GMT.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 105cda623ddb82b4084fea598aa93f58 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Games/CPA/DataTypes/Extensions/PS1/GMT/GMT_CollisionMaterialExtensions.cs b/Assets/Scripts/Games/CPA/DataTypes/Extensions/PS1/GMT/GMT_CollisionMaterialExtensions.cs new file mode 100644 index 00000000..735633d8 --- /dev/null +++ b/Assets/Scripts/Games/CPA/DataTypes/Extensions/PS1/GMT/GMT_CollisionMaterialExtensions.cs @@ -0,0 +1,43 @@ +using UnityEngine; +using Raymap; +using static BinarySerializer.Ubisoft.CPA.PS1.GLI_VisualMaterial; +using Colors = OpenSpace.Collide.CollideMaterial.Colors; + +namespace BinarySerializer.Ubisoft.CPA.PS1 { + public static class GMT_CollisionMaterialExtensions { + public static Material CreateMaterial(this GMT_CollideMaterial cmt) { + var env = ((Unity_Environment_CPA)cmt.Context.GetUnityEnvironment()); + Material mat = new Material(env.MaterialCollision); + // TODO: use col types + var colTypes = cmt.Context.GetCPASettings().COLTypes; + /*if (NoCollision) { + mat = new Material(env.MaterialCollisionTransparent); + //mat.SetTexture("_MainTex", Util.CreateDummyCheckerTexture()); + mat.color = Colors.NoCollision; + } + if (Slide) mat.color = Colors.Slide; + if (Water) { + mat = new Material(env.MaterialCollisionTransparent); + //mat.SetTexture("_MainTex", Util.CreateDummyCheckerTexture()); + mat.color = Colors.Water; + } + if (WaterSplash) { + mat.color = Colors.Water; + } + if (ClimbableWall || HangableCeiling) { + mat.color = Colors.Climbable; + } + if (LavaDeathWarp || DeathWarp) { + mat.color = Colors.DeathWarp; + } + if (HurtTrigger) mat.color = Colors.HurtTrigger; + //if (FallTrigger) mat.color = Colors.FallTrigger; + if (Trampoline) mat.color = Colors.Trampoline; + if (Electric) mat.color = Colors.Electric; + if (Wall) mat.color = Colors.Wall; + if (GrabbableLedge) mat.color = Colors.GrabbableLedge; + if (FlagUnk2) mat.color = Colors.FlagUnknown;*/ + return mat; + } + } +} diff --git a/Assets/Scripts/Games/CPA/DataTypes/Extensions/PS1/GMT/GMT_CollisionMaterialExtensions.cs.meta b/Assets/Scripts/Games/CPA/DataTypes/Extensions/PS1/GMT/GMT_CollisionMaterialExtensions.cs.meta new file mode 100644 index 00000000..e8bc6b56 --- /dev/null +++ b/Assets/Scripts/Games/CPA/DataTypes/Extensions/PS1/GMT/GMT_CollisionMaterialExtensions.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 68fca2a12c0d4bd48afec09d03105260 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Games/CPA/DataTypes/Extensions/PS1/GMT/GMT_GameMaterialExtensions.cs b/Assets/Scripts/Games/CPA/DataTypes/Extensions/PS1/GMT/GMT_GameMaterialExtensions.cs new file mode 100644 index 00000000..c04f99b5 --- /dev/null +++ b/Assets/Scripts/Games/CPA/DataTypes/Extensions/PS1/GMT/GMT_GameMaterialExtensions.cs @@ -0,0 +1,13 @@ +using UnityEngine; +using Raymap; +using static BinarySerializer.Ubisoft.CPA.PS1.GLI_VisualMaterial; + +namespace BinarySerializer.Ubisoft.CPA.PS1 { + public static class GMT_GameMaterialExtensions { + public static Material CreateMaterial(this GMT_GameMaterial gmt) { + if (gmt.CollideMaterial?.Value != null) return gmt.CollideMaterial.Value.CreateMaterial(); + Material mat = new Material(((Unity_Environment_CPA)gmt.Context.GetUnityEnvironment()).MaterialCollision); + return mat; + } + } +} diff --git a/Assets/Scripts/Games/CPA/DataTypes/Extensions/PS1/GMT/GMT_GameMaterialExtensions.cs.meta b/Assets/Scripts/Games/CPA/DataTypes/Extensions/PS1/GMT/GMT_GameMaterialExtensions.cs.meta new file mode 100644 index 00000000..13f2b92a --- /dev/null +++ b/Assets/Scripts/Games/CPA/DataTypes/Extensions/PS1/GMT/GMT_GameMaterialExtensions.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: e02122ea505d84446bd6918f98fc2780 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Games/CPA/DataTypes/Extensions/PS1/HIE.meta b/Assets/Scripts/Games/CPA/DataTypes/Extensions/PS1/HIE.meta new file mode 100644 index 00000000..d66c6ed6 --- /dev/null +++ b/Assets/Scripts/Games/CPA/DataTypes/Extensions/PS1/HIE.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 954e413dc2e52fe41a647d5f0de73523 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Games/CPA/DataTypes/Extensions/PS1/HIE/HIE_SuperObjectExtensions.cs b/Assets/Scripts/Games/CPA/DataTypes/Extensions/PS1/HIE/HIE_SuperObjectExtensions.cs new file mode 100644 index 00000000..fd11c9d9 --- /dev/null +++ b/Assets/Scripts/Games/CPA/DataTypes/Extensions/PS1/HIE/HIE_SuperObjectExtensions.cs @@ -0,0 +1,77 @@ +using BinarySerializer.Unity; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using UnityEngine; + +namespace BinarySerializer.Ubisoft.CPA.PS1 { + public static class HIE_SuperObjectExtensions { + public static GameObject GetGameObject(this HIE_SuperObject spo) { + GameObject gao = new GameObject($"{spo.Type} @ {spo.Offset}"); + gao.AddBinarySerializableData(spo); + + if (FileSystem.mode == FileSystem.Mode.Web) { + gao.name = $"{spo.Type}"; + } + + /*SuperObjectComponent soc = gao.AddComponent(); + gao.layer = LayerMask.NameToLayer("SuperObject"); + soc.soPS1 = spo;*/ + + spo.ApplyMatrix(gao); + GAM_GlobalPointerTable gpt = spo.Context.GetLevel().GlobalPointerTable; + if (spo.Type == HIE_ObjectType_98.InstanciatedPhysicalObject) { + PhysicalObjectComponent poc = gao.AddComponent(); + int ind = (spo.DataIndex >> 1); + if (ind >= gpt.StaticGeometricObjects.Entries.Length) throw new Exception("IPO SPO data index was too high! " + gpt.StaticGeometricObjects.Entries.Length + " - " + spo.DataIndex); + gao.name = gao.name + " - " + ind; + GameObject g = gpt.StaticGeometricObjects.GetGameObject(ind, null, out _); + if (g != null) { + poc.visual = g; + g.transform.SetParent(gao.transform, false); + } + if (gpt.IpoCollision != null && gpt.IpoCollision.Length > ind) { + GameObject c = gpt.IpoCollision[ind].GetGameObject(); + if (c != null) { + poc.collide = c; + c.transform.SetParent(gao.transform, false); } + } + //poc.Init(OpenSpace.MapLoader.Loader.controller); + } else if (spo.Type == HIE_ObjectType_98.Character) { + PERSO_Perso p = (PERSO_Perso)spo.LinkedObject; + if (spo.DataIndex >= gpt.Persos.Length) throw new Exception("Perso SPO data index was too high! " + gpt.Persos.Length + " - " + spo.DataIndex); + gao.name = gao.name + " - " + spo.DataIndex; + /*PS1PersoBehaviour ps1Perso = h.persos[dataIndex].GetGameObject(gao); + ps1Perso.superObject = this;*/ + } else if (spo.Type == HIE_ObjectType_98.Sector) { + SECT_Sector s = (SECT_Sector)spo.LinkedObject; + if (spo.DataIndex >= gpt.Sectors.Length) throw new Exception("Sector SPO data index was too high! " + gpt.Sectors.Length + " - " + spo.DataIndex); + gao.name = gao.name + " - " + spo.DataIndex; + //SectorComponent sect = h.sectors[dataIndex].GetGameObject(gao); + } + if (spo.Children != null) { + foreach (HIE_SuperObject spoChild in spo.Children) { + if (spoChild != null) { + GameObject gao_spoChild = spoChild.GetGameObject(); + if (gao_spoChild != null) { + //soc.Children.Add(gao_spoChild.GetComponent()); + gao_spoChild.transform.SetParent(gao.transform, false); + } + } + } + } + return gao; + } + + public static void ApplyMatrix(this HIE_SuperObject spo, GameObject gao) { + if (spo.Type != HIE_ObjectType_98.InstanciatedPhysicalObject) { + spo.LocalMatrix?.Value?.Apply(gao); + } else { + gao.transform.localPosition = Vector3.zero; + gao.transform.localRotation = Quaternion.identity; + } + } + } +} diff --git a/Assets/Scripts/Games/CPA/DataTypes/Extensions/PS1/HIE/HIE_SuperObjectExtensions.cs.meta b/Assets/Scripts/Games/CPA/DataTypes/Extensions/PS1/HIE/HIE_SuperObjectExtensions.cs.meta new file mode 100644 index 00000000..e6b93e5d --- /dev/null +++ b/Assets/Scripts/Games/CPA/DataTypes/Extensions/PS1/HIE/HIE_SuperObjectExtensions.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 6451f1f7e3fe0f446992fb3689251482 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Games/CPA/DataTypes/Extensions/PS1/MTH.meta b/Assets/Scripts/Games/CPA/DataTypes/Extensions/PS1/MTH.meta new file mode 100644 index 00000000..23a5cd4e --- /dev/null +++ b/Assets/Scripts/Games/CPA/DataTypes/Extensions/PS1/MTH.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 0bbf8ff3d9bee774aae174d9f4297ec2 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Games/CPA/DataTypes/Extensions/PS1/MTH/MTH3D.meta b/Assets/Scripts/Games/CPA/DataTypes/Extensions/PS1/MTH/MTH3D.meta new file mode 100644 index 00000000..5a4f9203 --- /dev/null +++ b/Assets/Scripts/Games/CPA/DataTypes/Extensions/PS1/MTH/MTH3D.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 01cacfb11c8289148acaa5fe6a7bddf0 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Games/CPA/DataTypes/Extensions/PS1/MTH/MTH3D/MTH3D_Vector_PS1Extensions.cs b/Assets/Scripts/Games/CPA/DataTypes/Extensions/PS1/MTH/MTH3D/MTH3D_Vector_PS1Extensions.cs new file mode 100644 index 00000000..687c0675 --- /dev/null +++ b/Assets/Scripts/Games/CPA/DataTypes/Extensions/PS1/MTH/MTH3D/MTH3D_Vector_PS1Extensions.cs @@ -0,0 +1,20 @@ +using UnityEngine; + +namespace BinarySerializer.Ubisoft.CPA.PS1 { + public static class MTH3D_Vector_PS1Extensions { + public static Vector3 GetUnityVector(this MTH3D_Vector_PS1_Short v, bool convertAxes = false) { + if (convertAxes) { + return new Vector3(v.X, v.Z, v.Y); + } else { + return new Vector3(v.X, v.Y, v.Z); + } + } + public static Vector3 GetUnityVector(this MTH3D_Vector_PS1_Int v, bool convertAxes = false) { + if (convertAxes) { + return new Vector3(v.X, v.Z, v.Y); + } else { + return new Vector3(v.X, v.Y, v.Z); + } + } + } +} diff --git a/Assets/Scripts/Games/CPA/DataTypes/Extensions/PS1/MTH/MTH3D/MTH3D_Vector_PS1Extensions.cs.meta b/Assets/Scripts/Games/CPA/DataTypes/Extensions/PS1/MTH/MTH3D/MTH3D_Vector_PS1Extensions.cs.meta new file mode 100644 index 00000000..72a62669 --- /dev/null +++ b/Assets/Scripts/Games/CPA/DataTypes/Extensions/PS1/MTH/MTH3D/MTH3D_Vector_PS1Extensions.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 0998ecaf135e7b647be2fd205d768ea2 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Games/CPA/DataTypes/Extensions/PS1/PO.meta b/Assets/Scripts/Games/CPA/DataTypes/Extensions/PS1/PO.meta new file mode 100644 index 00000000..cdd37be6 --- /dev/null +++ b/Assets/Scripts/Games/CPA/DataTypes/Extensions/PS1/PO.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 1829f96104c586341abec653454f1eee +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Games/CPA/DataTypes/Extensions/PS1/PO/PO_ObjectsTableExtensions.cs b/Assets/Scripts/Games/CPA/DataTypes/Extensions/PS1/PO/PO_ObjectsTableExtensions.cs new file mode 100644 index 00000000..5d4ba9e1 --- /dev/null +++ b/Assets/Scripts/Games/CPA/DataTypes/Extensions/PS1/PO/PO_ObjectsTableExtensions.cs @@ -0,0 +1,51 @@ +using BinarySerializer.Unity; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using UnityEngine; + +namespace BinarySerializer.Ubisoft.CPA.PS1 { + public static class PO_ObjectsTableExtensions { + public static GameObject GetGameObject(this PO_ObjectsTable poTable, int i, CS_PhysicalObjectCollisionMapping[] collision, out GameObject[] bones, int? morphI = null, float morphProgress = 0f) { + bones = null; + if (i < 0 || i >= poTable.Entries.Length) return null; + return poTable.Entries[i]?.GetGameObject( + collision, + out bones, + morphPO: ((morphI != null && morphI.Value >= 0 && morphI.Value < poTable.Entries.Length) ? poTable.Entries[morphI.Value] : null), + morphProgress: morphProgress); + } + + public static GameObject GetGameObject(this PO_PhysicalObject po, CS_PhysicalObjectCollisionMapping[] collision, out GameObject[] bones, PO_PhysicalObject morphPO = null, float morphProgress = 0f) { + bones = null; + GameObject gao = po.GeometricObject?.GetGameObject(out bones, morphObject: morphPO?.GeometricObject, morphProgress: morphProgress); + if (gao != null) { + GameObject wrapper = new GameObject(gao.name + " - Wrapper"); + if (morphProgress > 0 || morphPO != null) { + gao.name += " - Morph Progress: " + morphProgress; + } + gao.transform.SetParent(wrapper.transform); + gao.transform.localPosition = Vector3.zero; + gao.transform.localRotation = Quaternion.identity; + gao.transform.localScale = Vector3.one; + PhysicalObjectComponent poc = wrapper.AddComponent(); + poc.visual = gao; + if (collision != null) { + CS_PhysicalObjectCollisionMapping cm = collision.FirstOrDefault(c => c.POListEntryPointer == po.Offset); + if (cm != null && cm.Collision != null) { + GameObject cgao = cm.Collision.GetGameObject(); + cgao.transform.SetParent(wrapper.transform); + cgao.transform.localPosition = Vector3.zero; + cgao.transform.localRotation = Quaternion.identity; + cgao.transform.localScale = Vector3.one; + poc.collide = cgao; + } + } + //poc.Init(OpenSpace.MapLoader.Loader.controller); + return wrapper; + } else return gao; + } + } +} diff --git a/Assets/Scripts/Games/CPA/DataTypes/Extensions/PS1/PO/PO_ObjectsTableExtensions.cs.meta b/Assets/Scripts/Games/CPA/DataTypes/Extensions/PS1/PO/PO_ObjectsTableExtensions.cs.meta new file mode 100644 index 00000000..caca1deb --- /dev/null +++ b/Assets/Scripts/Games/CPA/DataTypes/Extensions/PS1/PO/PO_ObjectsTableExtensions.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: fb085e83881175a4fa1e82056d59993e +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Games/CPA/DataTypes/Extensions/U64.meta b/Assets/Scripts/Games/CPA/DataTypes/Extensions/U64.meta new file mode 100644 index 00000000..ad1c957c --- /dev/null +++ b/Assets/Scripts/Games/CPA/DataTypes/Extensions/U64.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 8eea5b0ed06c6274bbdc2d00f5e62300 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Games/CPA/DataTypes/Extensions/U64/GLI.meta b/Assets/Scripts/Games/CPA/DataTypes/Extensions/U64/GLI.meta new file mode 100644 index 00000000..ee36496e --- /dev/null +++ b/Assets/Scripts/Games/CPA/DataTypes/Extensions/U64/GLI.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 56a2889ad6047b242968d92f294bc3a6 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Games/CPA/DataTypes/Extensions/U64/GLI/GLI_BitmapInfoExtensions.cs b/Assets/Scripts/Games/CPA/DataTypes/Extensions/U64/GLI/GLI_BitmapInfoExtensions.cs new file mode 100644 index 00000000..b6870981 --- /dev/null +++ b/Assets/Scripts/Games/CPA/DataTypes/Extensions/U64/GLI/GLI_BitmapInfoExtensions.cs @@ -0,0 +1,87 @@ +using BinarySerializer.Unity; +using Raymap; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using UnityEngine; +using static BinarySerializer.Ubisoft.CPA.PS1.GLI_VisualMaterial; + +namespace BinarySerializer.Ubisoft.CPA.U64 { + public static class GLI_BitmapInfoExtensions { + public static Texture2D GetTexture(this GLI_BitmapInfo bi, bool flip = false) { + if (bi.Context?.GetCPASettings().Platform == Platform._3DS) { + throw new NotImplementedException($"Not yet implemented for 3DS"); + } + var w = bi.Texture?.Value?.Width ?? bi.Alpha?.Value?.Width ?? 0; + var h = bi.Texture?.Value?.Height ?? bi.Alpha?.Value?.Height ?? 0; + var tex = TextureHelpers.CreateTexture2D(w, h); + + GLI_PaletteRGBA16 pal; + if (bi.Context?.GetCPASettings().Platform == Platform.N64) { + pal = bi.PaletteN64?.Value; + } else { + pal = bi.Palette?.Value; + } + GLI_BitmapCI4 alpha = bi.Alpha?.Value; + GLI_Bitmap main = bi.Texture?.Value; + BaseColor[] palette = pal?.Palette; + Util.TileEncoding enc4bpp = (bi.Context?.GetCPASettings().Platform == Platform.N64) + ? Util.TileEncoding.Linear_4bpp_ReverseOrder + : Util.TileEncoding.Linear_4bpp; + + if (main != null) { + switch (main) { + case GLI_BitmapCI8 mainCI8: + switch (bi.Type) { + case GLI_BitmapInfo.BitmapType.Alpha3i5: + if (palette == null) palette = PaletteHelpers.CreateDummyPalette(32, firstTransparent: false); + tex.FillRegion(mainCI8.Bitmap, 0, palette.GetColors(), Util.TileEncoding.Linear_8bpp_A3i5, 0, 0, w, h, flipTextureY: flip); + break; + case GLI_BitmapInfo.BitmapType.Alpha5i3: + if (palette == null) palette = PaletteHelpers.CreateDummyPalette(8, firstTransparent: false); + tex.FillRegion(mainCI8.Bitmap, 0, palette.GetColors(), Util.TileEncoding.Linear_8bpp_A5i3, 0, 0, w, h, flipTextureY: flip); + break; + default: + if (palette == null) palette = PaletteHelpers.CreateDummyPalette(256, firstTransparent: false); + tex.FillRegion(mainCI8.Bitmap, 0, palette.GetColors(), Util.TileEncoding.Linear_8bpp, 0, 0, w, h, flipTextureY: flip); + break; + } + break; + case GLI_BitmapCI4 mainCI4: + if (palette == null) palette = PaletteHelpers.CreateDummyPalette(16, firstTransparent: false); + tex.FillRegion(mainCI4.Bitmap, 0, palette.GetColors(), enc4bpp, 0, 0, w, h, flipTextureY: flip); + break; + case GLI_BitmapRGBA16 mainRGBA16: + tex.FillRegion(mainRGBA16.Bitmap, 0, 0, 0, w, h, flipTextureY: flip); + break; + } + } else { + for (int x = 0; x < w; x++) { + for (int y = 0; y < h; y++) { + tex.SetPixel(x, y, Color.white); + } + } + } + + if (alpha != null) { + tex.Apply(); + Texture2D at = TextureHelpers.CreateTexture2D(w, h); + at.FillRegion(alpha.Bitmap, 0, PaletteHelpers.CreateDummyPalette(16, firstTransparent: false).GetColors(), enc4bpp, 0, 0, w, h, flipTextureY: flip); + at.Apply(); + var texPixels = tex.GetPixels(); + var alphaPixels = at.GetPixels(); + for (int i = 0; i < texPixels.Length; i++) { + texPixels[i] = new Color(texPixels[i].r, texPixels[i].g, texPixels[i].b, alphaPixels[i].r); + } + tex.SetPixels(texPixels); + } + + + tex.Apply(); + return tex; + //return tb.Context.GetUnityLevel().GetUnityData(tb).Texture; + } + } +} diff --git a/Assets/Scripts/Games/CPA/DataTypes/Extensions/U64/GLI/GLI_BitmapInfoExtensions.cs.meta b/Assets/Scripts/Games/CPA/DataTypes/Extensions/U64/GLI/GLI_BitmapInfoExtensions.cs.meta new file mode 100644 index 00000000..f38bb44b --- /dev/null +++ b/Assets/Scripts/Games/CPA/DataTypes/Extensions/U64/GLI/GLI_BitmapInfoExtensions.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: ba9203fccc93ec24e8a5976e43bff926 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Games/CPA/DataTypes/MAT.meta b/Assets/Scripts/Games/CPA/DataTypes/MAT.meta new file mode 100644 index 00000000..9b1859e7 --- /dev/null +++ b/Assets/Scripts/Games/CPA/DataTypes/MAT.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 3dd4bb61133d86d4a9d03a848814c536 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Games/CPA/DataTypes/MTH.meta b/Assets/Scripts/Games/CPA/DataTypes/MTH.meta new file mode 100644 index 00000000..de4e06ba --- /dev/null +++ b/Assets/Scripts/Games/CPA/DataTypes/MTH.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 181f03fe97aba26428d987f22178d021 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Games/CPA/Environment.meta b/Assets/Scripts/Games/CPA/Environment.meta new file mode 100644 index 00000000..d865b8ea --- /dev/null +++ b/Assets/Scripts/Games/CPA/Environment.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 42e47b75531dad140922014dd513231c +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Games/CPA/Environment/Unity_Environment_CPA.cs b/Assets/Scripts/Games/CPA/Environment/Unity_Environment_CPA.cs new file mode 100644 index 00000000..5a6662c1 --- /dev/null +++ b/Assets/Scripts/Games/CPA/Environment/Unity_Environment_CPA.cs @@ -0,0 +1,23 @@ +using UnityEngine; + +namespace Raymap { + public class Unity_Environment_CPA : Unity_Environment { + public const string Key = "CPA"; + + // Set in inspector + public Material MaterialVisualOpaque; + public Material MaterialVisualTransparent; + public Material MaterialVisualLight; + public Material MaterialCollision; + public Material MaterialCollisionTransparent; + + public override void Init() { + // TODO: Initialize monobehaviours etc + //throw new System.NotImplementedException(); + } + + public override void OnDataLoaded() { + //throw new System.NotImplementedException(); + } + } +} diff --git a/Assets/Scripts/Games/CPA/Environment/Unity_Environment_CPA.cs.meta b/Assets/Scripts/Games/CPA/Environment/Unity_Environment_CPA.cs.meta new file mode 100644 index 00000000..9fe17961 --- /dev/null +++ b/Assets/Scripts/Games/CPA/Environment/Unity_Environment_CPA.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: c841a7481bfd7b14581c14279d447df3 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Libraries/BinarySerializer b/Assets/Scripts/Libraries/BinarySerializer index ef9ae50c..6d61b3a2 160000 --- a/Assets/Scripts/Libraries/BinarySerializer +++ b/Assets/Scripts/Libraries/BinarySerializer @@ -1 +1 @@ -Subproject commit ef9ae50c8b4c19e33456b97304ea00d915fef0c8 +Subproject commit 6d61b3a2aa50ce1c209fe961c37146490de032a0 diff --git a/Assets/Scripts/Libraries/BinarySerializer.Nintendo b/Assets/Scripts/Libraries/BinarySerializer.Nintendo new file mode 160000 index 00000000..d8dd5c25 --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Nintendo @@ -0,0 +1 @@ +Subproject commit d8dd5c25be84098f74b80a44da3118af4748c567 diff --git a/Assets/Scripts/Libraries/BinarySerializer.Nintendo.meta b/Assets/Scripts/Libraries/BinarySerializer.Nintendo.meta new file mode 100644 index 00000000..01c95984 --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Nintendo.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 6ef9015d92b824341a42426d8fd488da +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Libraries/BinarySerializer.OpenSpace b/Assets/Scripts/Libraries/BinarySerializer.OpenSpace deleted file mode 160000 index 4238382a..00000000 --- a/Assets/Scripts/Libraries/BinarySerializer.OpenSpace +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 4238382a7ab28d8a73679be942886e0c0c892e71 diff --git a/Assets/Scripts/Libraries/BinarySerializer.PS1 b/Assets/Scripts/Libraries/BinarySerializer.PS1 new file mode 160000 index 00000000..2aa4d996 --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.PS1 @@ -0,0 +1 @@ +Subproject commit 2aa4d9964b8cacbc46e0ef27191594ac12c3ebae diff --git a/Assets/Scripts/Libraries/BinarySerializer.PS1.meta b/Assets/Scripts/Libraries/BinarySerializer.PS1.meta new file mode 100644 index 00000000..27cbfa51 --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.PS1.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 034b94519b6601e4789f8d08038734e7 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA.meta b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA.meta new file mode 100644 index 00000000..29a96971 --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 83422cfbed0d0a24e8dc64a7d89330bd +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/.editorconfig b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/.editorconfig new file mode 100644 index 00000000..71fa229f --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/.editorconfig @@ -0,0 +1,3 @@ +# C# files +[*.cs] +indent_style = tab \ No newline at end of file diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src.meta b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src.meta new file mode 100644 index 00000000..90836019 --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: bd76d1577c119b9499c87feaa7ae6bdd +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/BinarySerializer.Ubisoft.CPA.csproj b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/BinarySerializer.Ubisoft.CPA.csproj new file mode 100644 index 00000000..65721e5d --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/BinarySerializer.Ubisoft.CPA.csproj @@ -0,0 +1,12 @@ + + + + netstandard2.0 + 8 + + + + + + + \ No newline at end of file diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/BinarySerializer.Ubisoft.CPA.csproj.meta b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/BinarySerializer.Ubisoft.CPA.csproj.meta new file mode 100644 index 00000000..39e40dc1 --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/BinarySerializer.Ubisoft.CPA.csproj.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: 9fbf96604d4ac654bbd76e25ea9ddae8 +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes.meta b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes.meta new file mode 100644 index 00000000..7dfc0898 --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: ba719c329a84ba848835f204a3813b76 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/AI.meta b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/AI.meta new file mode 100644 index 00000000..9ff8bbb9 --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/AI.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: d66bddb729e84c3478c26de048864b19 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/AI/Enums.meta b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/AI/Enums.meta new file mode 100644 index 00000000..b0eff5fd --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/AI/Enums.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: c41a9e0f0bb3eac4c9b73565eafa94f8 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/AI/Enums/Attributes.meta b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/AI/Enums/Attributes.meta new file mode 100644 index 00000000..9a7c4581 --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/AI/Enums/Attributes.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 4e06d52d7907791459b1798c55d42bee +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/AI/Enums/Attributes/AI_DefinitionAttribute.cs b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/AI/Enums/Attributes/AI_DefinitionAttribute.cs new file mode 100644 index 00000000..51774e2b --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/AI/Enums/Attributes/AI_DefinitionAttribute.cs @@ -0,0 +1,28 @@ +using System; + +namespace BinarySerializer.Ubisoft.CPA { + [AttributeUsage(AttributeTargets.Field)] + public sealed class AI_DefinitionAttribute : Attribute { + public string ScriptName { get; } + public string English { get; } + public string French { get; } + public string Type { get; } + public AI_DefinitionAttribute( + string SCR = null, + string EN = null, + string FR = null, + string ED = null, + string Type = null + ) { + ScriptName = SCR; + if (ED != null) { + English = ED; + French = ED; + } else { + English = EN; + French = FR; + } + this.Type = Type; + } + } +} \ No newline at end of file diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/AI/Enums/Attributes/AI_DefinitionAttribute.cs.meta b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/AI/Enums/Attributes/AI_DefinitionAttribute.cs.meta new file mode 100644 index 00000000..de8f3387 --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/AI/Enums/Attributes/AI_DefinitionAttribute.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 255de17b3ee054340be49c48158b6b5b +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/AI/Enums/Definitions.meta b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/AI/Enums/Definitions.meta new file mode 100644 index 00000000..d70c4255 --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/AI/Enums/Definitions.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 0c9c205870c4cee4aad644a3a58ef2bf +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/AI/Enums/Definitions/AI_Condition.cs b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/AI/Enums/Definitions/AI_Condition.cs new file mode 100644 index 00000000..2cadb3f6 --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/AI/Enums/Definitions/AI_Condition.cs @@ -0,0 +1,392 @@ +namespace BinarySerializer.Ubisoft.CPA { + // Regex for NP++: + // Find: (NU_)?M_DEFINE_[^ \t\(]*[ \t]*\([ \t]*e[^_]*_([^ \t,]*)[ \t]*,[ \t]*([^ \t,]*)[ \t]*,([ \t]*([^ \t,]*)[ \t]*,)?[ \t]*([^ \t,]*)[ \t]*,[ \t]*fn_.* + // eCond , FR , EN , SCR + // Replace: \[Definition\(SCR: \6, EN: \5, FR: \3\)] \2, + // Then replace " EN: ," with "" + public enum AI_Condition { + Placeholder, + + #region DefCond + // + // 1. DefCond + // + ///******************************************************************************************************************************************************************************************************************************************************* + // Boolean conditions + [AI_Definition(SCR: "Cond_And", EN: "And", FR: "Et")] Et, + [AI_Definition(SCR: "Cond_Or", EN: "Or", FR: "Ou")] Ou, + [AI_Definition(SCR: "Cond_Not", EN: "Not", FR: "Non")] Not, + [AI_Definition(SCR: "Cond_XOr", EN: "XOr", FR: "OuExclusif")] XOr, + ///******************************************************************************************************************************************************************************************************************************************************* + // Comparison conditions + [AI_Definition(SCR: "Cond_Equal", EN: "=", FR: "=")] Equal, + [AI_Definition(SCR: "Cond_Different", EN: "<>", FR: "<>")] Different, + [AI_Definition(SCR: "Cond_Lesser", EN: "<", FR: "<")] Lesser, + [AI_Definition(SCR: "Cond_Greater", EN: ">", FR: ">")] Greater, + [AI_Definition(SCR: "Cond_LesserOrEqual", EN: "<=", FR: "<=")] LesserOrEqual, + [AI_Definition(SCR: "Cond_GreaterOrEqual", EN: ">=", FR: ">=")] GreaterOrEqual, + ///******************************************************************************************************************************************************************************************************************************************************* + // ZDD conditions + [AI_Definition(SCR: "Cond_CollidePersoZDDWithPerso", EN: "COL_CollidePersoZDDWithPerso", FR: "Col_CollisionZDDPersoAvecPerso")] CollidePersoZDDNoWithPerso, + [AI_Definition(SCR: "Cond_CollideModuleZDDWithPerso", EN: "COL_CollideModuleZDDWithPerso", FR: "Col_CollisionZDDModuleAvecPerso")] CollideModuleZDDNoWithPerso, + [AI_Definition(SCR: "Cond_CollidePersoAllZDDWithPersoAllZDD", EN: "COL_CollidePersoAllZDDWithPersoAllZDD", FR: "Col_CollisionPersoTouteZDDAvecPerso")] CollidePersoAllZDDWithPerso, + [AI_Definition(SCR: "Cond_CollidePersoZDDWithAnyPErso", EN: "COL_CollidePersoZDDWithAnyPErso", FR: "Col_CollisionZDDPersoAvecNimporteQuelPerso")] CollidePersoZDDWithAnyPerso, + [AI_Definition(SCR: "Cond_CollideModuleZDDWithAnyPerso", EN: "COL_CollideModuleZDDWithAnyPerso", FR: "Col_CollisionZDDModuleAvecNimporteQuelPerso")] CollideModuleZDDWithAnyPerso, + // ZDE conditions + [AI_Definition(SCR: "Cond_CollidePersoZDEWithPersoZDE", EN: "COL_CollidePersoZDEWithPersoZDE", FR: "Col_CollisionZDEPersoAvecZDEPerso")] CollidePersoZDENoWithPersoZDENo, + [AI_Definition(SCR: "Cond_CollideModuleZDEWithPersoZDE", EN: "COL_CollideModuleZDEWithPersoZDE", FR: "Col_CollisionZDEModuleAvecZDEPerso")] CollideModuleZDENoWithPersoZDENo, + [AI_Definition(SCR: "Cond_CollidePersoZDEWithModuleZDE", EN: "COL_CollidePersoZDEWithModuleZDE", FR: "Col_CollisionZDEPersoAvecZDEModule")] CollidePersoZDENoWithModuleZDENo, + [AI_Definition(SCR: "Cond_CollideModuleZDEWithModuleZDE", EN: "COL_CollideModuleZDEWithModuleZDE", FR: "Col_CollisionZDEModuleAvecZDEModule")] CollideModuleZDENoWithModuleZDENo, + [AI_Definition(SCR: "Cond_CollidePersoZDEWithPersoTypeZDE", EN: "COL_CollidePersoZDEWithPersoTypeZDE", FR: "Col_CollisionZDEPersoAvecPersoTypeZDE")] CollidePersoZDENoWithPersoTypeZDE, + [AI_Definition(SCR: "Cond_CollideModuleZDEWithPersoTypeZDE", EN: "COL_CollideModuleZDEWithPersoTypeZDE", FR: "Col_CollisionZDEModuleAvecPersoTypeZDE")] CollideModuleZDENoWithPersoTypeZDE, + [AI_Definition(SCR: "Cond_CollidePersoTypeZDEWithPersoTypeZDE", EN: "COL_CollidePersoTypeZDEWithPersoTypeZDE", FR: "Col_CollisionPersoTypeZDEAvecPersoTypeZDE")] CollidePersoTypeZDEWithPersoTypeZDE, + [AI_Definition(SCR: "Cond_CollidePersoAllZDEWithPersoAllZDE", EN: "COL_CollidePersoAllZDEWithPersoAllZDE", FR: "Col_CollisionPersoTouteZDEAvecPersoTouteZDE")] CollidePersoAllZDEWithPersoAllZDE, + [AI_Definition(SCR: "Cond_CollidePersoTypeZDEWithPersoAllZDE", EN: "COL_CollidePersoTypeZDEWithPersoAllZDE", FR: "Col_CollisionPersoTypeZDEAvecPersoTouteZDE")] CollidePersoTypeZDEWithPersoAllZDE, + [AI_Definition(SCR: "Cond_CollidePersoAllZDEWithPersoTypeZDE", EN: "COL_CollidePersoAllZDEWithPersoTypeZDE", FR: "Col_CollisionPersoTouteZDEAvecPersoTypeZDE")] CollidePersoAllZDEWithPersoTypeZDE, + [AI_Definition(SCR: "Cond_CollidePersoZDENoWithTypeZDE", EN: "COL_CollidePersoZDENoWithTypeZDE", FR: "Col_CollisionPersoZDEAvecTypeZDE")] CollidePersoZDENoWithTypeZDE, + [AI_Definition(SCR: "Cond_CollideModuleZDENoWithTypeZDE", EN: "COL_CollideModuleZDENoWithTypeZDE", FR: "Col_CollisionModuleZDEAvecTypeZDE")] CollideModuleZDENoWithTypeZDE, + // ZDM Collision Test + [AI_Definition(SCR: "Cond_CollideMovingZDM", FR: "Col_CollisionAvecZDMDeplacee")] CollideMovingZDM, + // Collision conditions : ULTRA + [AI_Definition(SCR: "Cond_CollideWithGround", EN: "COL_CollideWithGround", FR: "Col_CollisionAvecSol")] CollideWithGround, + [AI_Definition(SCR: "Cond_CollideWithWall", EN: "COL_CollideWithWall", FR: "Col_CollisionAvecMur")] CollideWithWall, + [AI_Definition(SCR: "Cond_CollideWithNothing", EN: "COL_CollideWithNothing", FR: "Col_PasDeCollision")] CollideWithNothing, + [AI_Definition(SCR: "Cond_CollideWithCeiling", EN: "COL_CollideWithCeiling", FR: "Col_CollisionAvecPlafond")] CollideWithCeiling, + [AI_Definition(SCR: "Cond_CollideWithPerso", EN: "COL_CollideWithPerso", FR: "Col_CollisionAvecPerso")] CollideWithPerso, + [AI_Definition(SCR: "Cond_CollideWithWater", EN: "COL_CollideWithWater", FR: "Col_CollisionAvecEau")] CollideWithWater, + + [AI_Definition(SCR: "Cond_CollideWithThisPerso", EN: "COL_CollideWithThisPerso", FR: "Col_CollisionAvecCePerso")] CollideWithThisPerso, + + //ANNECY BBB + [AI_Definition(SCR: "Cond_CollideWithTrap", FR: "Col_CollisionAvecTrappe")] CollideWithTrap, + [AI_Definition(SCR: "Cond_CollideWithSlope", FR: "Col_CollisionAvecPente")] CollideWithSlope, + [AI_Definition(SCR: "Cond_CollideWithAttic", FR: "Col_CollisionAvecMansarde")] CollideWithAttic, + + // ZDM Collision conditions : ULTRA + [AI_Definition(SCR: "Cond_ZDMCollideWithGround", EN: "COL_ZDMCollideWithGround", FR: "Col_ZDMCollisionAvecSol")] ZDMCollideWithGround, + [AI_Definition(SCR: "Cond_ZDMCollideWithWall", EN: "COL_ZDMCollideWithWall", FR: "Col_ZDMCollisionAvecMur")] ZDMCollideWithWall, + [AI_Definition(SCR: "Cond_ZDMCollideWithNothing", EN: "COL_ZDMCollideWithNothing", FR: "Col_ZDMPasDeCollision")] ZDMCollideWithNothing, + [AI_Definition(SCR: "Cond_ZDMCollideWithCeiling", EN: "COL_ZDMCollideWithCeiling", FR: "Col_ZDMCollisionAvecPlafond")] ZDMCollideWithCeiling, + + [AI_Definition(SCR: "Cond_ZDMCollideWithSlope", FR: "Col_ZDMCollisionAvecPente")] ZDMCollideWithSlope, + [AI_Definition(SCR: "Cond_ZDMCollideWithAttic", FR: "Col_ZDMCollisionAvecMansarde")] ZDMCollideWithAttic, + ///******************************************************************************************************************************************************************************************************************************************************* + // List conditions + [AI_Definition(SCR: "Cond_IsPersoInList", EN: "LST_IsPersoInList", FR: "LST_PersoExisteDansListe")] IsPersoInList, + [AI_Definition(SCR: "Cond_IsModelInList", EN: "LST_IsModelInList", FR: "LST_ModeleExisteDansListe")] IsModelInList, + [AI_Definition(SCR: "Cond_IsFamilyInList", EN: "LST_IsFamilyInList", FR: "LST_FamilleExisteDansListe")] IsFamilyInList, + [AI_Definition(SCR: "Cond_ListEmptyTest", EN: "LST_ListEmptyTest", FR: "LST_ListeVide")] ListEmptyTest, + ///******************************************************************************************************************************************************************************************************************************************************* + // UserEvent + [AI_Definition(SCR: "Cond_UserEvent_IsSet", EN: "UserEvent_IsSet", FR: "UserEvent_IsSet")] UserEvent_IsSet, + [AI_Definition(SCR: "Cond_UserEvent_IsSet2", EN: "UserEvent_IsSet2", FR: "UserEvent_IsSet2")] UserEvent_IsSet2, + ///******************************************************************************************************************************************************************************************************************************************************* + // NO FAMILY + [AI_Definition(SCR: "Cond_PressedBut", EN: "BUT_PressedBut", FR: "BoutonAppuye")] PressedBut, + [AI_Definition(SCR: "Cond_JustPressedBut", EN: "BUT_JustPressedBut", FR: "BoutonJusteAppuye")] JustPressedBut, + [AI_Definition(SCR: "Cond_ReleasedBut", EN: "BUT_ReleasedBut", FR: "BoutonRelache")] ReleasedBut, + [AI_Definition(SCR: "Cond_JustReleasedBut", EN: "BUT_JustReleasedBut", FR: "BoutonJusteRelache")] JustReleasedBut, + + ///******************************************************************************************************************************************************************************************************************************************************* + // Time conditions + [AI_Definition(SCR: "Cond_IsTimeElapsed", EN: "TIME_IsTimeElapsed", FR: "TempsDepasse")] IsTimeElapsed, + + ///******************************************************************************************************************************************************************************************************************************************************* + // Validity condition + [AI_Definition(SCR: "Cond_IsValidObject", EN: "SPO_IsValidObject", FR: "ObjetValide")] IsValidObject, + [AI_Definition(SCR: "Cond_IsValidWayPoint", EN: "NET_IsValidWayPoint", FR: "Reseau_WayPointValide")] IsValidWayPoint, + [AI_Definition(SCR: "Cond_IsValidGMT", EN: "GMT_IsValidGMT", FR: "GMTValide")] IsValidGMT, + [AI_Definition(SCR: "Cond_IsValidAction", EN: "ACT_IsValidAction", FR: "ActionValide")] IsValidAction, + [AI_Definition(SCR: "Cond_IsValidText", EN: "TEXT_IsValidText", FR: "TexteValide")] IsValidText, + ///******************************************************************************************************************************************************************************************************************************************************* + // Lips_Synchro : ULTRA + [AI_Definition(SCR: "Cond_IsSpeechOver", EN: "SPEEK_IsSpeechOver", FR: "DiscoursTermine")] IsSpeechOver, + ///******************************************************************************************************************************************************************************************************************************************************* + // Sector : ULTRA for eCond_SeePerso + [AI_Definition(SCR: "Cond_SeePerso", EN: "ACT_SeePerso", FR: "VoitPerso")] SeePerso, + ///******************************************************************************************************************************************************************************************************************************************************* + // activation + [AI_Definition(SCR: "Cond_IsActivable", EN: "ACT_IsActivable", FR: "EstActivable")] IsActivable, + ///******************************************************************************************************************************************************************************************************************************************************* + // traitement + [AI_Definition(SCR: "Cond_IsAlreadyHandled", EN: "ACT_IsAlreadyHandled", FR: "ACT_EstDejaTraite")] IsAlreadyHandled, + ///******************************************************************************************************************************************************************************************************************************************************* + // Always condition + [AI_Definition(SCR: "Cond_Alw_IsMain", EN: "ALW_IsMain", FR: "Alw_EstAMoi")] Alw_IsMine, + ///******************************************************************************************************************************************************************************************************************************************************* + // Lights + [AI_Definition(SCR: "Cond_IsPersoLightOn", EN: "LIGHT_IsPersoLightOn", FR: "LumierePersoAllumee")] IsPersoLightOn, + [AI_Definition(SCR: "Cond_IsPersoLightPulseOn", EN: "LIGHT_IsPersoLightPulseOn", FR: "PulseLumierePersoAllumee")] IsPersoLightPulseOn, + [AI_Definition(SCR: "Cond_IsPersoLightGyroPhareOn", EN: "LIGHT_IsPersoLightGyroPhareOn", FR: "GyroPhareLumierePersoAllumee")] IsPersoLightGyroPhareOn, + + ///******************************************************************************************************************************************************************************************************************************************************* + //RRR DS: New AI Functions + [AI_Definition(SCR: "Cond_DS_StyletJustPressed", EN: "DS_StyletJustPressed", FR: "DS_StyletJustPressed")] StyletJustPressed, + [AI_Definition(SCR: "Cond_DS_StyletPressed", EN: "DS_StyletPressed", FR: "DS_StyletPressed")] StyletPressed, + [AI_Definition(SCR: "Cond_DS_StyletJustReleased", EN: "DS_StyletJustReleased", FR: "DS_StyletJustReleased")] StyletJustReleased, + [AI_Definition(SCR: "Cond_DS_StyletSlice", EN: "DS_StyletSlice", FR: "DS_StyletSlice")] StyletSlice, + [AI_Definition(SCR: "Cond_DS_CheckStyletRotation", EN: "CheckStyletRotation", FR: "DS_CheckStyletRotation")] StyletRotation, + [AI_Definition(SCR: "Cond_DS_CheckStyletGratter", EN: "CheckStyletGratter", FR: "DS_CheckStyletGratter")] StyletGratter, + #endregion + + #region DefCond1 + ///******************************************************************************************************************************************************************************************************************************************************* + // + // 2. DefCond1 + // + ///******************************************************************************************************************************************************************************************************************************************************* + //******************************************************************************************************************************************************************************************************************************************************** + [AI_Definition(SCR: "Cond_ZDMCollideWithObstacle", EN: "ZON_ZDMCollideWithObstacle", FR: "ZON_ZDMCollisionAvecObstacle")] IsZDMCollideWithObstacle, + [AI_Definition(SCR: "Cond_IsZDMCollideWithWall", EN: "ZON_IsZDMCollideWithWall", FR: "ZON_ZDMContreMur")] IsZDMCollideWithWall, + [AI_Definition(SCR: "Cond_IsZDMCollideWithGround", EN: "ZON_IsZDMCollideWithGround", FR: "ZON_ZDMContreSol")] IsZDMCollideWithGround, + [AI_Definition(SCR: "Cond_IsZDMCollideWithCeiling", EN: "ZON_IsZDMCollideWithCeiling", FR: "ZON_ZDMContrePlafond")] IsZDMCollideWithCeiling, + //******************************************************************************************************************************************************************************************************************************************************** + // collision communication management : NOT ULTRA + [AI_Definition(SCR: "Cond_CmtIdentifierContainsMask", EN: "COL_CmtIdentifierContainsMask", FR: "COL_TesteCmtContreMasque")] CmtIdentifierContainsMask, + [AI_Definition(SCR: "Cond_HitByCollider", EN: "COL_HitByCollider", FR: "COL_CollisionneurTouche")] HitByCollider, + [AI_Definition(SCR: "Cond_IsTypeOfGMTCollide", EN: "COL_IsTypeOfGMTCollide", FR: "TypeGMTCollision")] IsTypeOfGMTCollide, + + [AI_Definition(SCR: "Cond_IsInComport", EN: "ACT_IsInComport", FR: "EstDansComportement")] IsInComport, + [AI_Definition(SCR: "Cond_IsInReflexComport", EN: "ACT_IsInReflexComport", FR: "EstDansComportementReflexe")] IsInReflexComport, + [AI_Definition(SCR: "Cond_IsInAction", EN: "ACT_IsInAction", FR: "EstDansAction")] IsInAction, + [AI_Definition(SCR: "Cond_ChangeActionEnable", EN: "ACT_ChangeActionEnable", FR: "ChangeActionPossible")] ChangeActionEnable, + [AI_Definition(SCR: "Cond_EngineReinitRequested", EN: "ReinitMoteurDemande", FR: "ReinitMoteurDemande")] EngineReinitRequested, + [AI_Definition(SCR: "Cond_IsThereMechEvent", EN: "MEC__IsThereMechEvent", FR: "EvenementMecanique")] IsThereMechEvent, + [AI_Definition(SCR: "Cond_CollisionWP", EN: "COL_CollisionWP", FR: "COL_CollisionWP")] CollisionWP, + //******************************************************************************************************************************************************************************************************************************************************** + // Acteurs + [AI_Definition(SCR: "Cond_IsCustomBitSet", EN: "ACT_IsCustomBitSet", FR: "ACT_TestCustomBit")] IsCustomBitSet, + [AI_Definition(SCR: "Cond_IsPersoActive", EN: "ACT_IsPersoActive", FR: "ACT_EstActif")] IsPersoActive, + [AI_Definition(SCR: "Cond_CheckActionEnd", EN: "ACT_CheckActionEnd", FR: "ACT_TestFinAction")] CheckActionEnd, + [AI_Definition(SCR: "Cond_IsCurrentStateCustomBitSet", EN: "ACT_IsCurrentStateCustomBitSet", FR: "ACT_TestCustomBitDEtatCourant")] IsCurrentStateCustomBitSet, + + //******************************************************************************************************************************************************************************************************************************************************** + // Meca + [AI_Definition(SCR: "Cond_GiBlock", EN: "MEC_GiBlock", FR: "MEC_GiBloque")] IsGiBlock, + [AI_Definition(SCR: "Cond_MechanicBlock", EN: "MEC_MechanicBlock", FR: "MEC_MecaniqueBloque")] IsMechanicBlock, + [AI_Definition(SCR: "Cond_IsMechanicAnimatino", EN: "MEC_IsMechanicAnimatino", FR: "MEC_OptionAnimation")] IsMechanicAnimation, + [AI_Definition(SCR: "Cond_IsMechanicCollide", EN: "MEC_IsMechanicCollide", FR: "MEC_OptionCollision")] IsMechanicCollide, + [AI_Definition(SCR: "Cond_IsMechanicGravity", EN: "MEC_IsMechanicGravity", FR: "MEC_OptionGravite")] IsMechanicGravity, + [AI_Definition(SCR: "Cond_IsMechanicTilt", EN: "MEC_IsMechanicTilt", FR: "MEC_OptionTilt")] IsMechanicTilt, + [AI_Definition(SCR: "Cond_IsMechanicGi", EN: "MEC_IsMechanicGi", FR: "MEC_OptionGi")] IsMechanicGi, + [AI_Definition(SCR: "Cond_IsMechanicClimb", EN: "MEC_IsMechanicClimb", FR: "MEC_OptionVarappe")] IsMechanicClimb, + [AI_Definition(SCR: "Cond_IsMechanicOnGround", EN: "MEC_IsMechanicOnGround", FR: "MEC_OptionPlaqueAuSol")] IsMechanicOnGround, + [AI_Definition(SCR: "Cond_IsMechanicSpider", EN: "MEC_IsMechanicSpider", FR: "MEC_OptionAraignee")] IsMechanicSpider, + [AI_Definition(SCR: "Cond_IsMechanicShoot", EN: "MEC_IsMechanicShoot", FR: "MEC_OptionShoot")] IsMechanicShoot, + [AI_Definition(SCR: "Cond_IsMechanicSwim", EN: "MEC_IsMechanicSwim", FR: "MEC_OptionNage")] IsMechanicSwim, + [AI_Definition(SCR: "Cond_IsMechanicNeverFall", EN: "MEC_IsMechanicNeverFall", FR: "MEC_OptionNeTombePas")] IsMechanicNeverFall, + [AI_Definition(SCR: "Cond_IsMechanicCollisionControl", EN: "MEC_IsMechanicCollisionControl", FR: "MEC_OptionControleCollision")] IsMechanicCollisionControl, + [AI_Definition(SCR: "Cond_IsMechanicKeepSpeedZ", EN: "MEC_IsMechanicKeepSpeedZ", FR: "MEC_OptionConserveVitesseZ")] IsMechanicKeepSpeedZ, + [AI_Definition(SCR: "Cond_IsMechanicSpeedLimit", EN: "MEC_IsMechanicSpeedLimit", FR: "MEC_OptionLimiteVitesse")] IsMechanicSpeedLimit, + [AI_Definition(SCR: "Cond_IsMechanicInertia", EN: "MEC_IsMechanicInertia", FR: "MEC_OptionInertie")] IsMechanicInertia, + [AI_Definition(SCR: "Cond_IsMechanicStream", EN: "MEC_IsMechanicStream", FR: "MEC_OptionFlux")] IsMechanicStream, + [AI_Definition(SCR: "Cond_IsMechanicStickOnPlatform", EN: "MEC_IsMechanicStickOnPlatform", FR: "MEC_OptionCollerAuxPlateformes")] IsMechanicStickOnPlatform, + [AI_Definition(SCR: "Cond_MechanicPatformCrash", EN: "MEC_MechanicPatformCrash", FR: "MEC_EcraseParPlateforme")] IsMechanicPatformCrash, + [AI_Definition(SCR: "Cond_IsMechanicScale", EN: "MEC_IsMechanicScale", FR: "MEC_OptionScale")] IsMechanicScale, + [AI_Definition(SCR: "Cond_IsMechanicExec", EN: "MEC_IsMechanicExec", FR: "MEC_Execution")] IsMechanicExec, + [AI_Definition(SCR: "Cond_CanFall", EN: "MEC_CanFall", FR: "MEC_PeutTomber")] CanFall, + [AI_Definition(SCR: "Cond_MainActorCrashed", EN: "MEC_IsMainActorCrashed", FR: "MEC_ActeurPrincipalEcrase")] IsMechanicCrash, + //******************************************************************************************************************************************************************************************************************************************************** + [AI_Definition(SCR: "Cond_NullVector", EN: "VEC_NullVector", FR: "VEC_VecteurNul")] IsNullVector, + //******************************************************************************************************************************************************************************************************************************************************** + // Hierarchy - Platform + [AI_Definition(SCR: "Cond_HierIsSonOfActor", EN: "HIER_HierIsSonOfActor", FR: "HIER_EstFils_acteur")] HierIsSonOfActor, + //******************************************************************************************************************************************************************************************************************************************************** + [AI_Definition(SCR: "Cond_IsMorphing", EN: "MOD_IsMorphing", FR: "MOD_MorphingEnCours")] IsMorphing, + //******************************************************************************************************************************************************************************************************************************************************** + [AI_Definition(SCR: "Cond_CheckAnimEnd", EN: "ANI_CheckAnimEnd", FR: "ANI_TestFinAnim")] CheckAnimEnd, + //******************************************************************************************************************************************************************************************************************************************************** + [AI_Definition(SCR: "Cond_HasTheCapability", EN: "CAPS_HasTheCapability", FR: "Caps_ALaCapacite")] HasTheCapability, + [AI_Definition(SCR: "Cond_HasOneOfTheCapabilities", EN: "CAPS_HasOneOfTheCapabilities", FR: "Caps_AUneDesCapacites")] HasOneOfTheCapabilities, + [AI_Definition(SCR: "Cond_HasTheCapabilityNumber", EN: "CAPS_HasTheCapabilityNumber", FR: "Caps_ALaCapaciteNumero")] HasTheCapabilityNumber, + [AI_Definition(SCR: "Cond_PersoHasTheCapability", EN: "CAPS_PersoHasTheCapability", FR: "Caps_PersoALaCapacite")] PersoHasTheCapability, + [AI_Definition(SCR: "Cond_PersoHasOneOfTheCapabilities", EN: "CAPS_PersoHasOneOfTheCapabilities", FR: "Caps_PersoAUneDesCapacites")] PersoHasOneOfTheCapabilities, + [AI_Definition(SCR: "Cond_PersoHasTheCapabilityNumber", EN: "CAPS_PersoHasTheCapabilityNumber", FR: "Caps_PersoALaCapaciteNumero")] PersoHasTheCapabilityNumber, + //******************************************************************************************************************************************************************************************************************************************************** + [AI_Definition(SCR: "Cond_IsMagnetActivated", EN: "MAGNET_IsMagnetActivated", FR: "Magnet_EstActif")] MagnetIsActivated, + //******************************************************************************************************************************************************************************************************************************************************** + // Collision Flags + [AI_Definition(SCR: "Cond_IsNotInCollWithMap", EN: "ACT_IsNotInCollWithMap", FR: "ACT_NEstPasEnCollisionAvecMap")] NEstPasEnCollisionAvecMap, + [AI_Definition(SCR: "Cond_IsNotInCollWithProj", EN: "ACT_IsNotInCollWithProj", FR: "ACT_NEstPasEnCollisionAvecProjectiles")] NEstPasEnCollisionAvecProjectile, + [AI_Definition(SCR: "Cond_IsNotInColWithSecondCharact", EN: "ACT_IsNotInColWithSecondCharact", FR: "ACT_NEstPasEnCollisionAvecActeursSecondaires")] NEstPasEnCollisionAvecSecondCharact, + [AI_Definition(SCR: "Cond_IsNotInColWithMainCharact", EN: "ACT_IsNotInColWithMainCharact", FR: "ACT_NEstPasEnCollisionAvecActeurPrincipal")] NEstPasEnCollisionAvecMainCharact, + [AI_Definition(SCR: "Cond_IsNotInColWithOtherSectors", EN: "ACT_IsNotInColWithOtherSectors", FR: "ACT_NEstPasEnCollisionAvecAutresSecteurs")] NEstPasEnCollisionAvecAutresSecteurs, + //******************************************************************************************************************************************************************************************************************************************************** + [AI_Definition(SCR: "Cond_IsOfFamily", EN: "ACT_IsOfFamily", FR: "ACT_EstDeFamille")] IsInFamily, + [AI_Definition(SCR: "Cond_IsOfModel", EN: "ACT_IsOfModel", FR: "ACT_EstDeModele")] IsInModel, + //******************************************************************************************************************************************************************************************************************************************************** + [AI_Definition(SCR: "Cond_AJoypadIsConnected", EN: "IPT_AJoypadIsConnected", FR: "IPT_AJoypadIsConnected")] AJoypadIsConnected, + [AI_Definition(SCR: "Cond_AKeyJustPressed", EN: "IPT_AKeyJustPressed", FR: "IPT_AKeyJustPressed")] AKeyJustPressed, + [AI_Definition(SCR: "Cond_AButtonPadJustPressed", EN: "IPT_AButtonPadJustPressed", FR: "IPT_AButtonPadJustPressed")] AButtonPadJustPressed, + + //******************************************************************************************************************************************************************************************************************************************************** + // demos + [AI_Definition(SCR: "Cond_IsInDemoMode", EN: "IsInDemoMode", FR: "EstDansDemoMode")] IsInDemoMode, + + //******************************************************************************************************************************************************************************************************************************************************** + [AI_Definition(SCR: "Cond_IsInStereoMode", EN: "SOUND_IsInStereoMode", FR: "SOUND_IsInStereoMode")] IsInStereoMode, + [AI_Definition(SCR: "Cond_IsMusicPlaying", EN: "SOUND_IsMusicPlaying", FR: "SOUND_IsMusicPlaying")] IsMusicPlaying, + + //******************************************************************************************************************************************************************************************************************************************************** + + [AI_Definition(SCR: "Cond_IsShapnessMax", EN: "VID_IsShapnessMax", FR: "VID_IsShapnessMax")] IsShapnessMax, + [AI_Definition(SCR: "COND_IsDataCorrupt", EN: "SLOT_IsDataCorrupt", FR: "SLOT_IsDataCorrupt")] IsSlotDataCorrupt, + [AI_Definition(SCR: "COND_IsCheatMenu", EN: "CHEAT_IsCheatMenu", FR: "CHEAT_IsCheatMenu")] IsCheatMenu, + [AI_Definition(SCR: "COND_IsUSBuild", EN: "COND_IsUSBuild", FR: "COND_IsUSBuild")] IsUSBuild, + #endregion + + #region DefConCa + [AI_Definition(SCR: "Cond_Cam_IsActive", EN: "Cam_IsActive", FR: "Cam_IsActive")] Cam_IsActive, + [AI_Definition(SCR: "Cond_Cam_IsViewportOwner", EN: "Cam_IsViewportOwner", FR: "Cam_IsViewportOwner")] Cam_IsViewportOwner, + // IA FLAGS + [AI_Definition(SCR: "Cond_Cam_IsFlagNoDynamicTarget", EN: "Cam_IsFlagNoDynamicTarget", FR: "Cam_IsFlagNoDynamicTarget")] Cam_IsFlagNoDynamicTarget, + [AI_Definition(SCR: "Cond_Cam_IsFlagNoAverageMoveTgtPerso", EN: "Cam_IsFlagNoAverageMoveTgtPerso", FR: "Cam_IsFlagNoAverageMoveTgtPerso")] Cam_IsFlagNoAverageMoveTgtPerso, + [AI_Definition(SCR: "Cond_Cam_IsFlagNoParseCutAngle", EN: "Cam_IsFlagNoParseCutAngle", FR: "Cam_IsFlagNoParseCutAngle")] Cam_IsFlagNoParseCutAngle, + [AI_Definition(SCR: "Cond_Cam_IsFlagNoVisibility", EN: "Cam_IsFlagNoVisibility", FR: "Cam_IsFlagNoVisibility")] Cam_IsFlagNoVisibility, + [AI_Definition(SCR: "Cond_Cam_IsFlagNoVisibilityWithDynHie", EN: "Cam_IsFlagNoVisibilityWithDynHie", FR: "Cam_IsFlagNoVisibilityWithDynHie")] Cam_IsFlagNoVisibilityWithDynHie, + [AI_Definition(SCR: "Cond_Cam_IsFlagNoDynChangeTheta", EN: "Cam_IsFlagNoDynChangeTheta", FR: "Cam_IsFlagNoDynChangeTheta")] Cam_IsFlagNoDynChangeTheta, + [AI_Definition(SCR: "Cond_Cam_IsFlagNoShiftUntilPosReached", EN: "Cam_IsFlagNoShiftUntilPosReached", FR: "Cam_IsFlagNoShiftUntilPosReached")] Cam_IsFlagNoShiftUntilPosReached, + [AI_Definition(SCR: "Cond_Cam_IsFlagNoDynSpeed", EN: "Cam_IsFlagNoDynSpeed", FR: "Cam_IsFlagNoDynSpeed")] Cam_IsFlagNoDynSpeed, + // DNM FLAGS + [AI_Definition(SCR: "Cond_Cam_IsFlagNoLinearParsing", EN: "Cam_IsFlagNoLinearParsing", FR: "Cam_IsFlagNoLinearParsing")] Cam_IsFlagNoLinearParsing, + [AI_Definition(SCR: "Cond_Cam_IsFlagNoLinearInertia", EN: "Cam_IsFlagNoLinearInertia", FR: "Cam_IsFlagNoLinearInertia")] Cam_IsFlagNoLinearInertia, + [AI_Definition(SCR: "Cond_Cam_IsFlagNoAngularParsing", EN: "Cam_IsFlagNoAngularParsing", FR: "Cam_IsFlagNoAngularParsing")] Cam_IsFlagNoAngularParsing, + [AI_Definition(SCR: "Cond_Cam_IsFlagNoAngularInertia", EN: "Cam_IsFlagNoAngularInertia", FR: "Cam_IsFlagNoAngularInertia")] Cam_IsFlagNoAngularInertia, + [AI_Definition(SCR: "Cond_Cam_IsFlagNoTargetParsing", EN: "Cam_IsFlagNoTargetParsing", FR: "Cam_IsFlagNoTargetParsing")] Cam_IsFlagNoTargetParsing, + [AI_Definition(SCR: "Cond_Cam_IsFlagNoTargetInertia", EN: "Cam_IsFlagNoTargetInertia", FR: "Cam_IsFlagNoTargetInertia")] Cam_IsFlagNoTargetInertia, + [AI_Definition(SCR: "Cond_Cam_IsFlagNoObstacle", EN: "Cam_IsFlagNoObstacle", FR: "Cam_IsFlagNoObstacle")] Cam_IsFlagNoObstacle, + [AI_Definition(SCR: "Cond_Cam_IsFlagFixedOrientation", EN: "Cam_IsFlagFixedOrientation", FR: "Cam_IsFlagFixedOrientation")] Cam_IsFlagFixedOrientation, + + [AI_Definition(SCR: "Cond_Cam_IsFlagForcedPosition", EN: "Cam_IsFlagForcedPosition", FR: "Cam_IsFlagForcedPosition")] Cam_IsFlagForcedPosition, + [AI_Definition(SCR: "Cond_Cam_IsFlagForcedTarget", EN: "Cam_IsFlagForcedTarget", FR: "Cam_IsFlagForcedTarget")] Cam_IsFlagForcedTarget, + [AI_Definition(SCR: "Cond_Cam_IsFlagForcedAxis", EN: "Cam_IsFlagForcedAxis", FR: "Cam_IsFlagForcedAxis")] Cam_IsFlagForcedAxis, + + #endregion + + #region Hype PC & PS2 + [AI_Definition(SCR: "Cond_CollideWithPoint")] CollideWithPoint, + [AI_Definition(SCR: "Cond_CollideWithTriangle")] CollideWithTriangle, + [AI_Definition(SCR: "Cond_CollideWithEdge")] CollideWithEdge, + [AI_Definition(SCR: "Cond_CollideWithSphere")] CollideWithSphere, + [AI_Definition(SCR: "Cond_CollideWithAlignedBox")] CollideWithAlignedBox, + + [AI_Definition(SCR: "Cond_InEnvironmentAir")] InEnvironmentAir, + [AI_Definition(SCR: "Cond_InEnvironmentWater")] InEnvironmentWater, + [AI_Definition(SCR: "Cond_InEnvironmentFire")] InEnvironmentFire, + + [AI_Definition(SCR: "Cond_IsInReflex")] IsInReflex, + [AI_Definition(SCR: "Cond_WallIsTypeOfGMTCollide")] WallIsTypeOfGMTCollide, + [AI_Definition(SCR: "Cond_ObstacleIsTypeOfGMTCollide")] ObstacleIsTypeOfGMTCollide, + [AI_Definition(SCR: "Cond_IsValidWay")] IsValidWay, + [AI_Definition(SCR: "Cond_InTopOfJump")] InTopOfJump, + [AI_Definition(SCR: "Cond_CanSwim")] CanSwim, + [AI_Definition(SCR: "Cond_CanSwimOnSurface")] CanSwimOnSurface, + [AI_Definition(SCR: "Cond_CanSwimUnderWater")] CanSwimUnderWater, + [AI_Definition(SCR: "Cond_IsNotOutOfDepth")] IsNotOutOfDepth, + [AI_Definition(SCR: "Cond_IsCompletelyOutOfWater")] IsCompletelyOutOfWater, + [AI_Definition(SCR: "Cond_LSY_IsSpeechOver")] LSY_IsSpeechOver, + [AI_Definition(SCR: "Cond_SeePosition")] SeePosition, + [AI_Definition(SCR: "Cond_SeePositionWithOffset")] SeePositionWithOffset, + [AI_Definition(SCR: "Cond_SeePersoWithOffset")] SeePersoWithOffset, + [AI_Definition(SCR: "Cond_IsSectorInTranslation")] IsSectorInTranslation, + [AI_Definition(SCR: "Cond_IsSectorInRotation")] IsSectorInRotation, + [AI_Definition(SCR: "Condition_Camera_IsInState")] IsCameraInState, + [AI_Definition(SCR: "Condition_Camera_IsInInitialState")] IsCameraInInitialState, + [AI_Definition(SCR: "Condition_Camera_IsActive")] IsCameraActive, + [AI_Definition(SCR: "Condition_Camera_IsViewportOwner")] IsCameraViewportOwner, + [AI_Definition(SCR: "Condition_Camera_IsCameraTargetVisible")] IsCameraTargetVisible, + [AI_Definition(SCR: "Condition_Camera_IsCameraTargetMoving")] IsCameraTargetMoving, + [AI_Definition(SCR: "Cond_Camera_IsCamReachedItsOptPos")] IsCameraReachedItsOptPos, + [AI_Definition(SCR: "Cond_Camera_IsCamInAlphaOrientation")] IsCameraInAlphaOrientation, + [AI_Definition(SCR: "Cond_Camera_IsCamInTetaOrientation")] IsCameraInTetaOrientation, + [AI_Definition(SCR: "Cond_IsSurfaceHeightMoving")] IsSurfaceHeightMoving, + [AI_Definition(SCR: "Cond_TestPower")] TestPower, + [AI_Definition(SCR: "Cond_IsAtLeftOfPerso")] HasAtLeft, + [AI_Definition(SCR: "Cond_IsAtRightOfPerso")] HasAtRight, + [AI_Definition(SCR: "Cond_IsBehindPerso")] HasBehind, + [AI_Definition(SCR: "Cond_IsInFrontOfPerso")] HasInFront, + [AI_Definition(SCR: "Cond_IsAbovePerso")] HasAbove, + [AI_Definition(SCR: "Cond_IsBelowPerso")] HasBelow, + + [AI_Definition(SCR: "Cond_GetAction")] GetAction, + [AI_Definition(SCR: "Cond_Inv_InventoryIsFull")] Inv_InventairePlein, + [AI_Definition(SCR: "Cond_Inv_FindObject")] Inv_TrouverObjet, + [AI_Definition(SCR: "Cond_GetDialogStatus")] GetDialogStatus, + [AI_Definition(SCR: "Cond_DLG_IsDialogOver")] DLG_IsDialogOver, + [AI_Definition(SCR: "Cond_DLG_IsScrollingOver")] DLG_IsScrollingOver, + [AI_Definition(SCR: "Cond_ActionFinished")] ActionFinished, + [AI_Definition(SCR: "SCT_ActorInSector")] SCT_ActorInSector, + [AI_Definition(SCR: "Cond_CollisionSphereSphere")] CollisionSphereSphere, + [AI_Definition(SCR: "Cond_SectorActive")] SectorActive, + [AI_Definition(SCR: "Cond_SND_IsSonFinished")] IsSoundFinished, + #endregion + + #region R3 PS2 + [AI_Definition(SCR: "Cond_UserEvent_IsSet3")] UserEvent_IsSet3, + [AI_Definition(SCR: "Cond_IsValidVMT")] IsValidVMT, + [AI_Definition(SCR: "Cond_IsValidSuperObject")] IsValidSPO, + [AI_Definition(SCR: "Cond_IsGraphValid")] IsValidGraph, + [AI_Definition(SCR: "Cond_IsRLITransitionInProgress")] IsRLITransitionInProgress, + [AI_Definition(SCR: "Cond_ALWACT_IsInAlwaysActiveList")] IsInAlwaysActiveList, + [AI_Definition(SCR: "Cond_ALWACT_IsAlwaysActive")] IsAlwaysActive, + [AI_Definition(SCR: "PAD2_IsAnActivePad")] IsAnActivePad, + [AI_Definition(SCR: "IsMultitap")] IsMultitap, + [AI_Definition(SCR: "Cond_SAV2_IsValid")] SAV2_IsValid, + [AI_Definition(SCR: "IsWidescreen")] IsWidescreen, + EngineIsInPAL, + CheckAnimSmooth, + [AI_Definition(SCR: "Cond_IsTooFar")] IsTooFar, + [AI_Definition(SCR: "Cond_CheckSubAnimEnd")] IsSubAnimPlaying, + [AI_Definition(SCR: "Cond_CheckCustomBitSubAnim")] TestCBSubAnim, + [AI_Definition(SCR: "Cond_IsInSubAnim")] IsInSubAnim, + IsSubAnimNearEnd, + [AI_Definition(SCR: "Cond_EqualitySPO")] IsSameSPO, + [AI_Definition(SCR: "Cond_AnalJoyPressedBut")] PressedPadBut, + [AI_Definition(SCR: "Cond_AnalJoyJustPressedBut")] JustPressedPadBut, + [AI_Definition(SCR: "Cond_AnalJoyReleasedBut")] ReleasedPadBut, + [AI_Definition(SCR: "Cond_AnalJoyJustReleasedBut")] JustReleasedPadBut, + [AI_Definition(SCR: "Func_CineIsPlaying")] IsCinePlaying, + LoadInProgress, + [AI_Definition(SCR: "Cond_SAV2_LastError")] SAV2LastError, + [AI_Definition(SCR: "Cond_SAV2_CheckMCStatus")] CheckMCStatus, + [AI_Definition(SCR: "Cond_IsInStereoMode")] SND_IsInStereoMode, // Redefinition of version without SND_ from R2 + [AI_Definition(SCR: "Cond_IsMusicPlaying")] SND_IsMusicPlaying, // Redefinition of version without SND_ from R2 + SND_IsVoicePlaying, + SND_IsEventValid, + #endregion + + #region RA PS2 (Custom name, SCR from the ELF) + [AI_Definition(SCR: "Func_NetNeedDataDescription")] NetNeedDataDescription, + [AI_Definition(SCR: "Func_NetWasUpdated")] NetWasUpdated, + [AI_Definition(SCR: "Func_NetWasBooleanUpdated")] NetWasBooleanUpdated, + [AI_Definition(SCR: "Func_NetWasPersoUpdated")] NetWasPersoUpdated, + [AI_Definition(SCR: "Func_NetWasIntegerUpdated")] NetWasIntegerUpdated, + [AI_Definition(SCR: "Func_NetWasVectorUpdated")] NetWasVectorUpdated, + [AI_Definition(SCR: "Func_NetWasRealUpdated")] NetWasRealUpdated, + [AI_Definition(SCR: "Func_NetGetEvent")] NetGetEvent, + [AI_Definition(SCR: "Func_NetIsPlayerConnected")] NetIsPlayerConnected, + #endregion + + #region TT:SE PC + [AI_Definition(SCR: "Cond_CanIAddObjectInInventory")] CanIAddObjectInInventory, + #endregion + + #region Largo (Custom name) + AKeyJustPressedAlphanumeric, + #endregion + + #region R2 iOS & DC + IsInternetAvailable, + IsRumblePakInPort1, + IsRumblePakInPort2, + IsRumblePakInPort1_Active, + IsRumblePakInPort2_Active, + IsStartButtonPressed, + DC_IsNTSC, + DC_OptionLoaded1, + DC_OptionLoaded2, + DC_Video1, + DC_Video2, + #endregion + } +} \ No newline at end of file diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/AI/Enums/Definitions/AI_Condition.cs.meta b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/AI/Enums/Definitions/AI_Condition.cs.meta new file mode 100644 index 00000000..3dad1f7e --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/AI/Enums/Definitions/AI_Condition.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 7f81e6b827118644a946b028af673492 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/AI/Enums/Definitions/AI_DsgVarType.cs b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/AI/Enums/Definitions/AI_DsgVarType.cs new file mode 100644 index 00000000..b205fd87 --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/AI/Enums/Definitions/AI_DsgVarType.cs @@ -0,0 +1,55 @@ +namespace BinarySerializer.Ubisoft.CPA { + public enum AI_DsgVarType { + None, + + [AI_Definition(SCR: "Boolean", FR: "Booleen", EN: "Boolean")] Boolean, + [AI_Definition(SCR: "_128To127", FR: "Entier_128To127", EN: "_128To127")] SByte, + [AI_Definition(SCR: "0To255", FR: "Entier0To255", EN: "0To255")] UByte, + [AI_Definition(SCR: "_32768To32767", FR: "Entier_32768To32767", EN: "_32768To32767")] Short, + [AI_Definition(SCR: "0To65535", FR: "Entier0To65535", EN: "0To65535")] UShort, + [AI_Definition(SCR: "Integer", FR: "Entier", EN: "Integer")] Int, + [AI_Definition(SCR: "PositiveInteger", FR: "EntierPositif", EN: "PositiveInteger")] UInt, + [AI_Definition(SCR: "Float", FR: "Reel", EN: "Float")] Float, + [AI_Definition(SCR: "WayPoint", FR: "WayPoint", EN: "WayPoint")] WayPoint, + [AI_Definition(SCR: "Way", FR: "Way", EN: "Way")] Way, + [AI_Definition(SCR: "Perso", FR: "Perso", EN: "Perso")] Perso, + [AI_Definition(SCR: "List", FR: "Liste", EN: "List")] List, + [AI_Definition(SCR: "Vector", FR: "TypeVecteur", EN: "Vector")] Vector, + [AI_Definition(SCR: "Comport", FR: "TypeComportement", EN: "Comport")] Comport, + [AI_Definition(SCR: "Action", FR: "TypeAction", EN: "Action")] Action, + [AI_Definition(SCR: "Text", FR: "Texte", EN: "Text")] Text, + [AI_Definition(SCR: "GameMaterial", FR: "TypeMateriauJeu", EN: "GameMaterial")] GameMaterial, + [AI_Definition(SCR: "Caps", FR: "TypeCapacite", EN: "Capability")] Caps, + [AI_Definition(SCR: "Graph", FR: "TypeReseau", EN: "Graph")] Graph, + [AI_Definition(SCR: "PersoArray", FR: "TypeTableauPerso", EN: "PersoArray")] PersoArray, + [AI_Definition(SCR: "VectorArray", FR: "TypeTableauVecteur", EN: "VectorArray")] VectorArray, + [AI_Definition(SCR: "FloatArray", FR: "TypeTableauReel", EN: "FloatArray")] FloatArray, + [AI_Definition(SCR: "IntegerArray", FR: "TypeTableauEntier", EN: "IntegerArray")] IntegerArray, + [AI_Definition(SCR: "WayPointArray", FR: "TypeTableauWayPoint", EN: "WayPointArray")] WayPointArray, + [AI_Definition(SCR: "TextArray", FR: "TypeTableauTexte", EN: "TextArray")] TextArray, + [AI_Definition(SCR: "SuperObject", FR: "TypeSuperObjet", EN: "SuperObject")] SuperObject, + + #region R3 PS2 + Input, + SoundEvent, + Light, + VisualMaterial, + SOLinks, + GraphArray, + SuperObjectArray, + SOLinksArray, + SoundEventArray, + VisualMatArray, + #endregion + + TextRefArray, + ActionArray, // Hype + + Placeholder__R2PS2__Type2E, + Placeholder__UnknownArray, + Module, + Placeholder__Largo__Type2F, + Placeholder__Largo__Type30, + ObjectTable, + } +} \ No newline at end of file diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/AI/Enums/Definitions/AI_DsgVarType.cs.meta b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/AI/Enums/Definitions/AI_DsgVarType.cs.meta new file mode 100644 index 00000000..45fc9b39 --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/AI/Enums/Definitions/AI_DsgVarType.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 0fca9c33dc1df704ab10395335eb3b88 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/AI/Enums/Definitions/AI_Field.cs b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/AI/Enums/Definitions/AI_Field.cs new file mode 100644 index 00000000..bfd69fb8 --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/AI/Enums/Definitions/AI_Field.cs @@ -0,0 +1,58 @@ +namespace BinarySerializer.Ubisoft.CPA { + // Find: (NU_)?M_DEFINE_[^ \t\(]*[ \t]*\([ \t]*e[^_]*_([^ \t,]*)[ \t]*,[ \t]*([^ \t,]*)[ \t]*,([ \t]*([^ \t,]*)[ \t]*,)?[ \t]*([^ \t,]*)[ \t]*,[ \t]*eFieldType_([^ \t,]*)[ \t]*,[ \t]*fn_.* + // Replace: \[Definition\(SCR: \6, EN: \5, FR: \3, Type: "\7"\)] \2, + public enum AI_Field { + #region DefFild + //******************************************************************************************************************************************************************************************************************************************************** + // Affect the Perso + [AI_Definition(SCR: "Position", EN: "Position", FR: "Position", Type: "Vector")] Position, + + [AI_Definition(SCR: "Orientation", EN: "Orientation", FR: "Orientation", Type: "Vector")] Orientation, + [AI_Definition(SCR: "Speed", EN: "Speed", FR: "Speed", Type: "Vector")] Speed, + [AI_Definition(SCR: "NormSpeed", EN: "NormSpeed", FR: "NormSpeed", Type: "Float")] NormSpeed, + //******************************************************************************************************************************************************************************************************************************************************** + [AI_Definition(SCR: "SightAxis", FR: "AxeDeVue", Type: "Vector")] SightAxis, + [AI_Definition(SCR: "FirstCompAxis", FR: "AxeComplementaire1", Type: "Vector")] FirstCompAxis, + [AI_Definition(SCR: "SecondCompAxis", FR: "AxeComplementaire2", Type: "Vector")] SecondCompAxis, + + [AI_Definition(SCR: "AbsoluteAxisX", EN: "AbsoluteAxisX", FR: "AxeXEnAbsolu", Type: "Vector")] AbsoluteAxisX, + [AI_Definition(SCR: "AbsoluteAxisY", EN: "AbsoluteAxisY", FR: "AxeYEnAbsolu", Type: "Vector")] AbsoluteAxisY, + [AI_Definition(SCR: "AbsoluteAxisZ", EN: "AbsoluteAxisZ", FR: "AxeZEnAbsolu", Type: "Vector")] AbsoluteAxisZ, + //******************************************************************************************************************************************************************************************************************************************************** + [AI_Definition(SCR: "PrevComportIntell", EN: "PrevComportIntell", FR: "ComportIntelPrec", Type: "Comport")] PrevComportIntell, + [AI_Definition(SCR: "PrevComportReflex", EN: "PrevComportReflex", FR: "ComportReflexePrec", Type: "Comport")] PrevComportReflex, + //******************************************************************************************************************************************************************************************************************************************************** + [AI_Definition(SCR: "CollisionFlag", FR: "CollisionFlag", Type: "0To255")] CollisionFlag, + //******************************************************************************************************************************************************************************************************************************************************** + [AI_Definition(SCR: "ShadowScaleX", EN: "ShadowScaleX", FR: "ShadowScaleX", Type: "Float")] ShadowScaleX, + [AI_Definition(SCR: "ShadowScaleY", EN: "ShadowScaleY", FR: "ShadowScaleY", Type: "Float")] ShadowScaleY, + #endregion + + #region R3 PS2 + PadGlobalVector, + PadHorizontalAxis, + PadVerticalAxis, + PadAnalogForce, + PadTrueAnalogForce, + PadRotationAngle, + PadSector, + SystemData, + SystemTime, + #endregion + + #region R2 iOS + CameraOffsetX, + MenuIndex, + MenuItem_Index, + HoldItem_Index, + SoundEffectVolume, + MusicVolume, + bGotoIGM, + TempFunction, + bMotionSensor, + bCameraLook, + bHoldCamera, + CheatEnable, + #endregion + } +} \ No newline at end of file diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/AI/Enums/Definitions/AI_Field.cs.meta b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/AI/Enums/Definitions/AI_Field.cs.meta new file mode 100644 index 00000000..59c5a93f --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/AI/Enums/Definitions/AI_Field.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 9cbdd4c20b307e24cad564aa9dfe4c51 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/AI/Enums/Definitions/AI_Function.cs b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/AI/Enums/Definitions/AI_Function.cs new file mode 100644 index 00000000..b8fc70b4 --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/AI/Enums/Definitions/AI_Function.cs @@ -0,0 +1,968 @@ +namespace BinarySerializer.Ubisoft.CPA { + // Regex for NP++: + // Find: (NU_)?M_DEFINE_[^ \t\(]*[ \t]*\([ \t]*e[^_]*_([^ \t,]*)[ \t]*,[ \t]*([^ \t,]*)[ \t]*,([ \t]*([^ \t,]*)[ \t]*,)?[ \t]*([^ \t,]*)[ \t]*,[ \t]*fn_.* + // eCond , FR , EN , SCR + // Replace: \[AI_Definition\(SCR: \6, EN: \5, FR: \3\)] \2, + // Then replace " EN: ," with "" + public enum AI_Function { + #region DefFunc + //******************************************************************************************************************************************************************************************************************************************************** + // Acthor + [AI_Definition(SCR: "Func_GetPersoAbsolutePosition", EN: "ACT_GetPersoAbsolutePosition", FR: "ACT_PositionAbsoluePerso")] GetPersoAbsolutePosition, + [AI_Definition(SCR: "Func_GetMyAbsolutePosition", EN: "ACT_GetMyAbsolutePosition", FR: "ACT_MaPositionAbsolue")] GetMyAbsolutePosition, + [AI_Definition(SCR: "Func_GetAngleAroundZToPerso", EN: "ACT_GetAngleAroundZToPerso", FR: "ACT_AngleAutourZVersPerso")] GetAngleAroundZToPerso, + [AI_Definition(SCR: "Func_DistanceToPerso", EN: "ACT_DistanceToPerso", FR: "ACT_DistanceAuPerso")] DistanceToPerso, + [AI_Definition(SCR: "Func_DistanceXToPerso", EN: "ACT_DistanceXToPerso", FR: "ACT_DistanceXAuPerso")] DistanceXToPerso, + [AI_Definition(SCR: "Func_DistanceYToPerso", EN: "ACT_DistanceYToPerso", FR: "ACT_DistanceYAuPerso")] DistanceYToPerso, + [AI_Definition(SCR: "Func_DistanceZToPerso", EN: "ACT_DistanceZToPerso", FR: "ACT_DistanceZAuPerso")] DistanceZToPerso, + [AI_Definition(SCR: "Func_DistanceXYToPerso", EN: "ACT_DistanceXYToPerso", FR: "ACT_DistanceXYAuPerso")] DistanceXYToPerso, + [AI_Definition(SCR: "Func_DistanceXZToPerso", EN: "ACT_DistanceXZToPerso", FR: "ACT_DistanceXZAuPerso")] DistanceXZToPerso, + [AI_Definition(SCR: "Func_DistanceYZToPerso", EN: "ACT_DistanceYZToPerso", FR: "ACT_DistanceYZAuPerso")] DistanceYZToPerso, + [AI_Definition(SCR: "Func_DistanceToPersoCenter", EN: "ACT_DistanceToPersoCenter", FR: "ACT_DistanceAuCentrePerso")] DistanceToPersoCenter, + [AI_Definition(SCR: "Func_DistanceXToPersoCenter", EN: "ACT_DistanceXToPersoCenter", FR: "ACT_DistanceXAuCentrePerso")] DistanceXToPersoCenter, + [AI_Definition(SCR: "Func_DistanceYToPersoCenter", EN: "ACT_DistanceYToPersoCenter", FR: "ACT_DistanceYAuCentrePerso")] DistanceYToPersoCenter, + [AI_Definition(SCR: "Func_DistanceZToPersoCenter", EN: "ACT_DistanceZToPersoCenter", FR: "ACT_DistanceZAuCentrePerso")] DistanceZToPersoCenter, + [AI_Definition(SCR: "Func_DistanceXYToPersoCenter", EN: "ACT_DistanceXYToPersoCenter", FR: "ACT_DistanceXYAuCentrePerso")] DistanceXYToPersoCenter, + [AI_Definition(SCR: "Func_DistanceXZToPersoCenter", EN: "ACT_DistanceXZToPersoCenter", FR: "ACT_DistanceXZAuCentrePerso")] DistanceXZToPersoCenter, + [AI_Definition(SCR: "Func_DistanceYZToPersoCenter", EN: "ACT_DistanceYZToPersoCenter", FR: "ACT_DistanceYZAuCentrePerso")] DistanceYZToPersoCenter, + //******************************************************************************************************************************************************************************************************************************************************** + // Reseau + [AI_Definition(SCR: "Func_DistanceToWP", EN: "NETWORK_DistanceToWP", FR: "Reseau_DistanceAuWP")] DistanceToWP, + [AI_Definition(SCR: "Func_GetWPAbsolutePosition", EN: "NETWORK_GetWPAbsolutePosition", FR: "Reseau_PositionAbsolueWP")] GetWPAbsolutePosition, + //******************************************************************************************************************************************************************************************************************************************************** + // Math Functions + [AI_Definition(SCR: "Func_Int", EN: "MATH_Int", FR: "Math_ConversionEnEntier")] Int, + [AI_Definition(SCR: "Func_RandomInt", EN: "MATH_RandomInt", FR: "Math_EntierAuHasard")] RandomInt, + [AI_Definition(SCR: "Func_Real", EN: "MATH_Real", FR: "Math_ConversionEnReel")] Real, + [AI_Definition(SCR: "Func_Sinus", EN: "MATH_Sinus", FR: "Math_Sinus")] Sinus, + [AI_Definition(SCR: "Func_Cosinus", EN: "MATH_Cosinus", FR: "Math_Cosinus")] Cosinus, + [AI_Definition(SCR: "Func_Square", EN: "MATH_Square", FR: "Math_Carre")] Square, + [AI_Definition(SCR: "Func_SquareRoot", EN: "MATH_SquareRoot", FR: "Math_Racine")] SquareRoot, + [AI_Definition(SCR: "Func_RandomReal", EN: "MATH_RandomReal", FR: "Math_ReelAuHasard")] RandomReal, + [AI_Definition(SCR: "Func_MinimumReal", EN: "MATH_MinimumReal", FR: "Math_MinimumReel")] MinimumReal, + [AI_Definition(SCR: "Func_MaximumReal", EN: "MATH_MaximumReal", FR: "Math_MaximumReel")] MaximumReal, + [AI_Definition(SCR: "Func_DegreeToRadian", EN: "MATH_DegreeToRadian", FR: "Math_ConversionDegreEnRadian")] DegreeToRadian, + [AI_Definition(SCR: "Func_RadianToDegree", EN: "MATH_RadianToDegree", FR: "Math_ConversionRadianEnDegre")] RadianToDegree, + [AI_Definition(SCR: "Func_AbsoluteValue", EN: "MATH_AbsoluteValue", FR: "Math_ValeurAbsolue")] AbsoluteValue, + [AI_Definition(SCR: "Func_LimitRealInRange", EN: "MATH_LimitRealInRange", FR: "Math_ReelBorne")] LimitRealInRange, + [AI_Definition(SCR: "Func_Sign", EN: "MATH_Sign", FR: "Math_Signe")] Sign, + [AI_Definition(SCR: "Func_Cube", EN: "MATH_Cube", FR: "Math_Cube")] Cube, + [AI_Definition(SCR: "Func_Modulo", EN: "MATH_Modulo", FR: "Math_Modulo")] Modulo, + [AI_Definition(SCR: "Func_TernInf", EN: "MATH_TernInf", FR: "Math_TernInf")] TernInf, + [AI_Definition(SCR: "Func_TernSup", EN: "MATH_TernSup", FR: "Math_TernSup")] TernSup, + [AI_Definition(SCR: "Func_TernEq", EN: "MATH_TernEq", FR: "Math_TernEq")] TernEq, + [AI_Definition(SCR: "Func_TernInfEq", EN: "MATH_TernInfEq", FR: "Math_TernInfEq")] TernInfEq, + [AI_Definition(SCR: "Func_TernSupEq", EN: "MATH_TernSupEq", FR: "Math_TernSupEq")] TernSupEq, + [AI_Definition(SCR: "Func_TernOp", EN: "MATH_TernOp", FR: "Math_TernOp")] TernOp, + [AI_Definition(SCR: "Func_TemporalRealCombination", EN: "MATH_TemporalRealCombination", FR: "Math_CombinaisonTemporelleReel")] TemporalRealCombination, + + //******************************************************************************************************************************************************************************************************************************************************** + // HitPoints & HitPointsMax Functions + [AI_Definition(SCR: "Func_GetHitPoints", EN: "ACT_GetHitPoints", FR: "ACT_LitPointsDeVie")] GetHitPoints, + [AI_Definition(SCR: "Func_AddAndGetHitPoints", EN: "ACT_AddAndGetHitPoints", FR: "ACT_AjouteEtLitPointsDeVie")] AddAndGetHitPoints, + [AI_Definition(SCR: "Func_SubAndGetHitPoints", EN: "ACT_SubAndGetHitPoints", FR: "ACT_EnleveEtLitPointsDeVie")] SubAndGetHitPoints, + [AI_Definition(SCR: "Func_GetHitPointsMax", EN: "ACT_GetHitPointsMax", FR: "ACT_LitPointsDeVieMax")] GetHitPointsMax, + [AI_Definition(SCR: "Func_AddAndGetHitPointsMax", EN: "ACT_AddAndGetHitPointsMax", FR: "ACT_AjouteEtLitPointsDeVieMax")] AddAndGetHitPointsMax, + [AI_Definition(SCR: "Func_SubAndGetHitPointsMax", EN: "ACT_SubAndGetHitPointsMax", FR: "ACT_EnleveEtLitPointsDeVieMax")] SubAndGetHitPointsMax, + //******************************************************************************************************************************************************************************************************************************************************** + // List Functions + [AI_Definition(SCR: "Func_ListSize", EN: "LST_ListSize", FR: "LST_TailleDeListe")] ListSize, + [AI_Definition(SCR: "Func_GivePersoInList", EN: "LST_GivePersoInList", FR: "LST_PrendPersoDansListe")] GivePersoInList, + //******************************************************************************************************************************************************************************************************************************************************** + // Vector + [AI_Definition(SCR: "Func_AbsoluteVector", EN: "VEC_AbsoluteVector", FR: "VEC_VecteurAbsolu")] AbsoluteVector, + [AI_Definition(SCR: "Func_RelativeVector", EN: "VEC_RelativeVector", FR: "VEC_VecteurRelatif")] RelativeVector, + [AI_Definition(SCR: "Func_VectorLocalToGlobal", EN: "VEC_VectorLocalToGlobal", FR: "VEC_VecteurLocalToGlobal")] VecteurLocalToGlobal, + [AI_Definition(SCR: "Func_VectorGlobalToLocal", EN: "VEC_VectorGlobalToLocal", FR: "VEC_VecteurGlobalToLocal")] VecteurGlobalToLocal, + //******************************************************************************************************************************************************************************************************************************************************** + // Magnet MGT functions + [AI_Definition(SCR: "Func_MAGNETGetStrength", EN: "MAGNET_GetStrength", FR: "Magnet_GetStrength")] GetMagnetStrength, + [AI_Definition(SCR: "Func_MAGNETGetFar", EN: "MAGNET_GetFar", FR: "Magnet_GetFar")] GetMagnetFar, + [AI_Definition(SCR: "Func_MAGNETGetNear", EN: "MAGNET_GetNear", FR: "Magnet_GetNear")] GetMagnetNear, + [AI_Definition(SCR: "Func_MAGNETGetDuration", EN: "MAGNET_GetDuration", FR: "Magnet_GetDuration")] GetMagnetDuration, + //******************************************************************************************************************************************************************************************************************************************************** + // to change SPO draw mask + [AI_Definition(SCR: "Func_SPO_GetDrawFlag", EN: "SPO_GetDrawFlag", FR: "SPO_GetDrawFlag")] SPO_GetDrawFlag, + //******************************************************************************************************************************************************************************************************************************************************** + // Time Functions + [AI_Definition(SCR: "Func_GetTime", EN: "TIME_GetTime", FR: "Temps_Obtenir")] GetTime, + [AI_Definition(SCR: "Func_ElapsedTime", EN: "TIME_ElapsedTime", FR: "Temps_Ecoule")] GetElapsedTime, + [AI_Definition(SCR: "Func_GetDT", EN: "TIME_GetDT", FR: "Temps_LitDT")] GetDeltaT, + [AI_Definition(SCR: "Func_GetFrameLength", EN: "TIME_GetFrameLength", FR: "Temps_DureeTrame")] GetFrameLength, + + //******************************************************************************************************************************************************************************************************************************************************** + // Input analogic value Functions + [AI_Definition(SCR: "Func_GetInputAnalogicValue", EN: "PAD_GetInputAnalogicValue", FR: "PAD_LitValeurAnalogiqueEntree")] InputAnalogicValue, + [AI_Definition(SCR: "Func_VitessePadAnalogique", EN: "PAD_VitessePadAnalogique", FR: "PAD_VitessePadAnalogique")] VitessePadAnalogique, + //******************************************************************************************************************************************************************************************************************************************************** + // Misc + [AI_Definition(SCR: "Func_GenerateObject", EN: "ACT_GenerateObject", FR: "GenereObjet")] GenerateObject, + [AI_Definition(SCR: "Func_CountGeneratedObjects", EN: "ACT_CountGeneratedObjects", FR: "ACT_CompteObjetsGeneres")] CountGeneratedObjects, + [AI_Definition(SCR: "Func_GetGlobalCounter", EN: "MAP_GetGlobalCounter", FR: "MAP_LitCompteurGlobal")] GetGlobalCounter, + [AI_Definition(SCR: "Func_GetSubMapId", EN: "MAP_GetSubMapId", FR: "MAP_LitNumeroDeSousMap")] GetSubMapId, + //******************************************************************************************************************************************************************************************************************************************************** + // Color functions + [AI_Definition(SCR: "Func_AddColor", EN: "COLOR_AddColor", FR: "AjouteCouleur")] AddColor, + [AI_Definition(SCR: "Func_AddRed", EN: "COLOR_AddRed", FR: "AjouteRouge")] AddRed, + [AI_Definition(SCR: "Func_AddGreen", EN: "COLOR_AddGreen", FR: "AjouteVert")] AddGreen, + [AI_Definition(SCR: "Func_AddBlue", EN: "COLOR_AddBlue", FR: "AjouteBleu")] AddBlue, + [AI_Definition(SCR: "Func_AddAlpha", EN: "COLOR_AddAlpha", FR: "AjouteAlpha")] AddAlpha, + [AI_Definition(SCR: "Func_ColorRGBA", EN: "COLOR_ColorRGBA", FR: "CouleurRVBA")] ColorRedGreenBlueAlpha, + [AI_Definition(SCR: "Func_ColorRGB", EN: "COLOR_ColorRGB", FR: "CouleurRVB")] ColorRedGreenBlue, + [AI_Definition(SCR: "Func_ColorRed", EN: "COLOR_ColorRed", FR: "ComposanteRouge")] ColorRed, + [AI_Definition(SCR: "Func_ColorGreen", EN: "COLOR_ColorGreen", FR: "ComposanteVerte")] ColorGreen, + [AI_Definition(SCR: "Func_ColorBlue", EN: "COLOR_ColorBlue", FR: "ComposanteBleue")] ColorBlue, + [AI_Definition(SCR: "Func_ColorAlpha", EN: "COLOR_ColorAlpha", FR: "ComposanteAlpha")] ColorAlpha, + //******************************************************************************************************************************************************************************************************************************************************** + // Visual GMT functions + [AI_Definition(SCR: "Func_GetVisualGMTColor", EN: "GMT_GetVisualGMTColor", FR: "LitVisuelGMTCouleur")] GetVisualGMTColor, + [AI_Definition(SCR: "Func_GetVisualGMTSpecularCoef", EN: "GMT_GetVisualGMTSpecularCoef", FR: "LitVisuelGMTSpeculaireCoef")] GetVisualGMTSpecularCoef, + [AI_Definition(SCR: "Func_GetVisualGMTSpecularExponant", EN: "GMT_GetVisualGMTSpecularExponant", FR: "LitVisuelGMTSpeculaireCoef")] GetVisualGMTSpecularExponent, + [AI_Definition(SCR: "Func_GetVisualGMTDiffuseCoef", EN: "GMT_GetVisualGMTDiffuseCoef", FR: "LitVisuelGMTDiffusionCoef")] GetVisualGMTDiffuseCoef, + [AI_Definition(SCR: "Func_GetVisualGMTAmbientCoef", EN: "GMT_GetVisualGMTAmbientCoef", FR: "LitVisuelGMTAmbientCoef")] GetVisualGMTAmbientCoef, + [AI_Definition(SCR: "Func_GetVisualGMTTextureScrollingCoefU", EN: "GMT_GetVisualGMTTextureScrollCoefU", FR: "LitVisuelGMTTextureScrollingCoefU")] GetVisualGMTTextureScrollingCoefU, + [AI_Definition(SCR: "Func_GetVisualGMTTextureScrollingCoefV", EN: "GMT_GetVisualGMTTextureScrollCoefV", FR: "LitVisuelGMTTextureScrollingCoefV")] GetVisualGMTTextureScrollingCoefV, + [AI_Definition(SCR: "Func_GetVisualGMTFrame", EN: "GMT_GetVisualGMTFrame", FR: "LitNoImageVisuelGMT")] GetVisualGMTFrame, + [AI_Definition(SCR: "Func_GetVisualGMTNumberOfFrames", EN: "GMT_GetVisualGMTNumberOfFrames", FR: "LitNbImagesVisuelGMT")] GetVisualGMTNumberOfFrames, + //******************************************************************************************************************************************************************************************************************************************************** + // Function for savegames + [AI_Definition(SCR: "Func_SaveGame", EN: "GAME_SaveGame", FR: "SauvePartie")] SaveGame, + [AI_Definition(SCR: "Func_LoadGame", EN: "GAME_LoadGame", FR: "ChargePartie")] LoadGame, + [AI_Definition(SCR: "Func_EraseGame", EN: "GAME_EraseGame", FR: "EffacePartie")] EraseGame, + [AI_Definition(SCR: "Func_GetCurrentSlotNumber", EN: "GAME_GetCurrentSlotNumber", FR: "LitNumeroSlotCourant")] GetCurrentSlot, + [AI_Definition(SCR: "Func_IsAValidSlotName", EN: "OPTION_IsAValidSlotName", FR: "OPTION_IsAValidSlotName")] IsAValidSlotName, + [AI_Definition(SCR: "Func_RepairCorruption", EN: "GAME_RepairCorruption", FR: "GAME_RepairCorruption")] RepairCorruptSlot, + + //******************************************************************************************************************************************************************************************************************************************************** + //KWN : Add a New AI Function + [AI_Definition(SCR: "Func_GetScreenCoordinates", EN: "ACT_ScreenCoordinates", FR: "ACT_GetScreenCoordinates")] GetScreenCoordinates, + [AI_Definition(SCR: "Func_GetScreenDSActif", EN: "ACT_GetScreenDSActif", FR: "ACT_GetScreenDSActif")] GetScreenDSActif, + [AI_Definition(SCR: "Func_GetStyletCordinates", EN: "ACT_GetStyletCordinates", FR: "ACT_GetStyletCordinates")] GetStyletCordinates, + //******************************************************************************************************************************************************************************************************************************************************** + + //MICRO + [AI_Definition(SCR: "Func_MICRO_GetSoufleValue", EN: "MICRO_GetSoufleValue", FR: "MICRO_GetSoufleValue")] MICRO_GetSoufleValue, + + #endregion + + #region FuncRay2 + //******************************************************************************************************************************************************************************************************************************************************** + // Management of magic points for Rayman + [AI_Definition(SCR: "Func_LitPointsDeMagie", EN: "RAY_GetMagicPoints", FR: "RAY_LitPointsDeMagie")] LitPointsDeMagie, + [AI_Definition(SCR: "Func_LitPointsDeMagieMax", EN: "RAY_GetMagicPointsMax", FR: "RAY_LitPointsDeMagieMax")] LitPointsDeMagieMax, + [AI_Definition(SCR: "Func_AjouteEtLitPointsDeMagie", EN: "RAY_AddAndGetMagicPoints", FR: "RAY_AjouteEtLitPointsDeMagie")] AjouteEtLitPointsDeMagie, + [AI_Definition(SCR: "Func_AjouteEtLitPointsDeMagieMax", EN: "RAY_AddAndGetMagicPointsMax", FR: "RAY_AjouteEtLitPointsDeMagieMax")] AjouteEtLitPointsDeMagieMax, + [AI_Definition(SCR: "Func_EnleveEtLitPointsDeMagie", EN: "RAY_RemoveAndGetMagicPoints", FR: "RAY_EnleveEtLitPointsDeMagie")] EnleveEtLitPointsDeMagie, + [AI_Definition(SCR: "Func_EnleveEtLitPointsDeMagieMax", EN: "RAY_RemoveAndGetMagicPointsMax", FR: "RAY_EnleveEtLitPointsDeMagieMax")] EnleveEtLitPointsDeMagieMax, + // Management of air points for Rayman + [AI_Definition(SCR: "Func_LitPointsDair", EN: "RAY_GetAirPoints", FR: "RAY_LitPointsDair")] LitPointsDair, + [AI_Definition(SCR: "Func_LitPointsDairMax", EN: "RAY_GetAirPointsMax", FR: "RAY_LitPointsDairMax")] LitPointsDairMax, + [AI_Definition(SCR: "Func_AjouteEtLitPointsDair", EN: "RAY_AddAndGetAirPoints", FR: "RAY_AjouteEtLitPointsDair")] AjouteEtLitPointsDair, + [AI_Definition(SCR: "Func_AjouteEtLitPointsDairMax", EN: "RAY_AddAndGetAirPointsMax", FR: "RAY_AjouteEtLitPointsDairMax")] AjouteEtLitPointsDairMax, + [AI_Definition(SCR: "Func_EnleveEtLitPointsDair", EN: "RAY_RemoveAndGetAirPoints", FR: "RAY_EnleveEtLitPointsDair")] EnleveEtLitPointsDair, + [AI_Definition(SCR: "Func_EnleveEtLitPointsDairMax", EN: "RAY_RemoveAndGetAirPointsMax", FR: "RAY_EnleveEtLitPointsDairMax")] EnleveEtLitPointsDairMax, + //******************************************************************************************************************************************************************************************************************************************************** + [AI_Definition(SCR: "Func_PersoLePlusProche", EN: "ACT_NearestActor", FR: "ACT_PersoLePlusProche")] PersoLePlusProche, + [AI_Definition(SCR: "Func_NearestActorInCurrentSector", EN: "ACT_NearestActorInCurrentSector", FR: "ACT_PersoLePlusProcheDansSecteurCourant")] PersoLePlusProcheDansSecteurCourant, + [AI_Definition(SCR: "Func_NearerActorInFieldOfVision", EN: "ACT_NearerActorInFieldOfVision", FR: "ACT_PersoLePlusProcheDansChampsDeVision")] NearerActorInFieldOfVision, + [AI_Definition(SCR: "Func_GetNbActivePerso", EN: "ACT_GetNbActivePerso", FR: "ACT_LitNbPersoActifs")] GetNbActivePerso, + [AI_Definition(SCR: "Func_CibleLaPlusProche", EN: "ACT_CibleLaPlusProche", FR: "ACT_CibleLaPlusProche")] CibleLaPlusProche, + [AI_Definition(SCR: "Func_CibleLaPlusProcheavecAngles", EN: "ACT_CibleLaPlusProcheAvecAngles", FR: "ACT_CibleLaPlusProcheAvecAngles")] CibleLaPlusProcheAvecAngles, + //******************************************************************************************************************************************************************************************************************************************************** + // Graph function management + + // To reach a graph before building a way (or to travel on a graph without building a way) + [AI_Definition(SCR: "Func_ReseauWPnLePlusProche", EN: "NETWORK_CloserWPn", FR: "Reseau_WPLePlusProche")] ReseauWPLePlusProche, + [AI_Definition(SCR: "Func_NetworkCloserWPOfType", EN: "NETWORK_CloserWPOfType", FR: "Reseau_WPDeTelTypeLePlusProche")] NetworkCloserWPOfType, + [AI_Definition(SCR: "Func_ReseauWPnLePlusDansLAxe", EN: "NETWORK_CloserWPnInAxis", FR: "Reseau_WPLePlusDansLAxe")] ReseauWPLePlusDansLAxe, + [AI_Definition(SCR: "Func_ReseauWPnLePlusDansLAxe2", EN: "NETWORK_CloserWPnInAxis2", FR: "Reseau_WPDeTelTypeLePlusDansLAxe")] ReseauWPLePlusDansLAxe2, + + // To travel on a graph without building a way + [AI_Definition(SCR: "eFunc_NetworkNextWPWithCapa", EN: "NETWORK_NextWPWithCapa", FR: "Reseau_ProchainWPJoignableAvecCapacite")] NetworkNextWPWithCapa, + [AI_Definition(SCR: "Func_NetworkAffectTypeOfConnectedWP", EN: "NETWORK_AffectTypeOfConnectedWP", FR: "Reseau_ChangeTypeDesWPJoignables")] NetworkAffectTypeOfConnectedWP, + [AI_Definition(SCR: "Func_NetworkAffectTypeOfConnectedWP2", EN: "NETWORK_AffectTypeOfConnectedWP2", FR: "Reseau_ChangeTypeDesWPJoignablesAvecCapacite")] NetworkAffectTypeOfConnectedWPWithCapa, + + // To build a way from a graph + [AI_Definition(SCR: "Func_ReseauCheminLePlusCourt", EN: "NETWORK_ShorterWay", FR: "Reseau_CheminLePlusCourt")] ReseauCheminLePlusCourt, + [AI_Definition(SCR: "Func_NetworkBuildOrderedPath", EN: "NETWORK_BuildOrderedPath", FR: "Reseau_ConstruitCheminOrdonne")] NetworkBuildOrderedPath, + [AI_Definition(SCR: "Func_NetworkBuildOrderedPathCircular", EN: "NETWORK_BuildOrderedPathCircular", FR: "Reseau_ConstruitCheminCirculaireOrdonne")] NetworkBuildOrderedPathCircular, + [AI_Definition(SCR: "Func_NetworkAllocateGraphToMSWay", EN: "NETWORK_AllocateGraphToMSWay", FR: "Reseau_AffecteGraphAChemin")] NetworkAllocateGraphToMSWay, + [AI_Definition(SCR: "Func_NetworkAllocateGraphToMSWayCircular", EN: "NETWORK_AllocateGraphToMSWay", FR: "Reseau_AffecteGraphACheminCirculaire")] NetworkAllocateGraphToMSWayCircular, + + // To travel on the way built (no graph in parameter, bicose everything is tested with the MsWay) + [AI_Definition(SCR: "Func_ReseauLitIndexCourant", EN: "NETWORK_GetCurrentIndex", FR: "Reseau_LitIndexCourant")] ReseauLitIndexCourant, + [AI_Definition(SCR: "Func_ReseauForceIndexCourant", EN: "NETWORK_SetCurrentIndex", FR: "Reseau_ForceIndexCourant")] ReseauForceIndexCourant, + [AI_Definition(SCR: "Func_ReseauLitPremierIndex", EN: "NETWORK_GetFirstIndex", FR: "Reseau_LitPremierIndex")] ReseauLitPremierIndex, + [AI_Definition(SCR: "Func_ReseauLitDernierIndex", EN: "NETWORK_GetLastIndex", FR: "Reseau_LitDernierIndex")] ReseauLitDernierIndex, + [AI_Definition(SCR: "Func_ReseauIncrementIndex", EN: "NETWORK_IncrementIndex", FR: "Reseau_IncrementIndex")] ReseauIncrementIndex, + [AI_Definition(SCR: "Func_ReseauDecrementIndex", EN: "NETWORK_DecrementIndex", FR: "Reseau_DecrementIndex")] ReseauDecrementIndex, + [AI_Definition(SCR: "Func_ReseauLitWPAIndex", EN: "NETWORK_GetWPAIndex", FR: "Reseau_LitWPAIndex")] ReseauLitWPAIndex, + + [AI_Definition(SCR: "Func_ReseauLitCapaciteLiaisonAIndex", EN: "NETWORK_GetLinkCapacityToIndex", FR: "Reseau_LitCapaciteLiaisonAIndex")] ReseauLitCapaciteLiaisonAIndex, + [AI_Definition(SCR: "Func_ReseauChangeCapaciteLiaisonAIndex", EN: "NETWORK_ChangeLinkCapacityToIndex", FR: "Reseau_ChangeCapaciteLiaisonAIndex")] ReseauChangeCapaciteLiaisonAIndex, + [AI_Definition(SCR: "Func_ReseauLitPoidsLiaisonAIndex", EN: "NETWORK_GetLinkWeightToIndex", FR: "Reseau_LitPoidsLiaisonAIndex")] ReseauLitPoidsLiaisonAIndex, + [AI_Definition(SCR: "Func_ReseauChangePoidsLiaisonAIndex", EN: "NETWORK_ChangeLinkWeightToIndex", FR: "Reseau_ChangePoidsLiaisonAIndex")] ReseauChangePoidsLiaisonAIndex, + + [AI_Definition(SCR: "Func_NetworkGetIndexOfWPInMSWay", EN: "NETWORK_GetIndexOfWPInMSWay", FR: "Reseau_ChercheIndiceDuWP")] NetworkGetIndexOfWPInMSWay, + [AI_Definition(SCR: "Func_NetworkForceWPToCurrent", EN: "NETWORK_ForceWPToCurrent", FR: "Reseau_ForceWPCourant")] NetworkForceWPToCurrent, + + [AI_Definition(SCR: "Func_ReseauTestExtremite", EN: "NETWORK_TestExtremite", FR: "Reseau_TestExtremities")] NetworkTestTheEnds, + + + // miscellaneous + [AI_Definition(SCR: "Func_ReseauLitCapaciteLiaisonDansGraph", EN: "NETWORK_GetLinkCapInGraph", FR: "Reseau_LitCapaciteLiaisonDansGraph")] ReseauLitCapaciteLiaisonDansGraph, + [AI_Definition(SCR: "Func_ReseauChangeCapaciteLiaisonDansGraph", EN: "NETWORK_SetLinkCapInGraph", FR: "Reseau_ChangeCapaciteLiaisonDansGraph")] ReseauChangeCapaciteLiaisonDansGraph, + [AI_Definition(SCR: "Func_ReseauLitPoidsLiaisonDansGraph", EN: "NETWORK_GetLinkWeightInGraph", FR: "Reseau_LitPoidsLiaisonDansGraph")] ReseauLitPoidsLiaisonDansGraph, + [AI_Definition(SCR: "Func_ReseauChangePoidsLiaisonDansGraph", EN: "NETWORK_SetLinkWeightInGraph", FR: "Reseau_ChangePoidsLiaisonDansGraph")] ReseauChangePoidsLiaisonDansGraph, + + [AI_Definition(SCR: "Func_NetworkGetTypeOfWP", EN: "NETWORK_GetTypeOfWP", FR: "Reseau_LitTypeDuWP")] NetworkGetTypeOfWP, + // Capability functions + [AI_Definition(SCR: "Func_CapsGetCapabilities", EN: "CAPS_GetCapabilities", FR: "Caps_LitCapacites")] GetCapabilities, + [AI_Definition(SCR: "Func_CapabilityAtBitNumber", EN: "CAPS_CapabilityAtBitNumber", FR: "Caps_CapaciteAuBitNumero")] CapabilityAtBitNumber, + + //******************************************************************************************************************************************************************************************************************************************************** + [AI_Definition(SCR: "Func_GetScrollSpeed", EN: "MAT_GetScrollSpeed", FR: "MAT_VitesseTexture")] GetScrollSpeed, + //******************************************************************************************************************************************************************************************************************************************************** + [AI_Definition(SCR: "Func_GetNbFrame", EN: "MAT_GetNbFrame", FR: "ANI_LitNbFrame")] GetNbFrame, + //******************************************************************************************************************************************************************************************************************************************************** + [AI_Definition(SCR: "Func_DotProduct", EN: "VEC_DotProduct", FR: "VEC_ProduitScalaire")] DotProduct, + [AI_Definition(SCR: "Func_CrossProduct", EN: "VEC_CrossProduct", FR: "VEC_ProduitVectoriel")] CrossProduct, + [AI_Definition(SCR: "Func_Normalize", EN: "VEC_Normalize", FR: "VEC_Normer")] Normalize, + //******************************************************************************************************************************************************************************************************************************************************** + [AI_Definition(SCR: "Func_GetSPOCoordinates", EN: "SPO_GetSPOCoordinates", FR: "SPO_LitCoordonnees")] GetSPOCoordinates, + //******************************************************************************************************************************************************************************************************************************************************** + [AI_Definition(SCR: "Func_ACTGetTractionFactor", EN: "ACT_GetTractionFactor", FR: "ACT_LitFacteurDeTraction")] GetTractionFactor, + //******************************************************************************************************************************************************************************************************************************************************** + [AI_Definition(SCR: "Func_GetCenterZDEType", EN: "ZON_GetCenterZDEType", FR: "ZON_LitCentreZDEType")] GetCenterZDEType, + [AI_Definition(SCR: "Func_GetCenterZDMType", EN: "ZON_GetCenterZDMType", FR: "ZON_LitCentreZDMType")] GetCenterZDMType, + [AI_Definition(SCR: "Func_GetCenterZDRType", EN: "ZON_GetCenterZDRType", FR: "ZON_LitCentreZDRType")] GetCenterZDRType, + [AI_Definition(SCR: "Func_GetCenterZDDType", EN: "ZON_GetCenterZDDType", FR: "ZON_LitCentreZDDType")] GetCenterZDDType, + //******************************************************************************************************************************************************************************************************************************************************** + [AI_Definition(SCR: "Func_TextAffiche", EN: "TEXT_DisplayText", FR: "TEXT_Affiche")] TextAffiche, + //******************************************************************************************************************************************************************************************************************************************************** + [AI_Definition(SCR: "Func_GetCPUCounter", EN: "DEBUG_GetCPUCounter", FR: "DEBUG_LitCompteurCPU")] GetCPUCounter, + #endregion + + #region DefFunc1 + //******************************************************************************************************************************************************************************************************************************************************** + [AI_Definition(SCR: "Func_VitesseHorizontaleDuPerso", EN: "ACT_HorizontalPersoSpeed", FR: "ACT_VitesseHorizontaleDuPerso")] VitesseHorizontaleDuPerso, + [AI_Definition(SCR: "Func_VitesseVerticaleDuPerso", EN: "ACT_VerticalPersoSpeed", FR: "ACT_VitesseVerticaleDuPerso")] VitesseVerticaleDuPerso, + [AI_Definition(SCR: "Func_GetPersoZoomFactor", EN: "ACT_GetPersoZoomFactor", FR: "ACT_DeformationPerso")] GetPersoZoomFactor, + [AI_Definition(SCR: "Func_GetPersoSighting", EN: "ACT_GetPersoSighting", FR: "ACT_ViseePerso")] GetPersoSighting, + [AI_Definition(SCR: "Func_GetPersoHorizon", EN: "ACT_GetPersoHorizon", FR: "ACT_HorizonPerso")] GetPersoHorizon, + [AI_Definition(SCR: "Func_GetPersoBanking", EN: "ACT_GetPersoBanking", FR: "ACT_AssiettePerso")] GetPersoBanking, + //******************************************************************************************************************************************************************************************************************************************************** + [AI_Definition(SCR: "Func_LitPositionZDM", EN: "ZON_GetZDMPosition", FR: "ZON_LitPositionZDM")] LitPositionZDM, + [AI_Definition(SCR: "Func_LitPositionZDE", EN: "ZON_GetZDEPosition", FR: "ZON_LitPositionZDE")] LitPositionZDE, + [AI_Definition(SCR: "Func_LitPositionZDD", EN: "ZON_GetZDDPosition", FR: "ZON_LitPositionZDD")] LitPositionZDD, + [AI_Definition(SCR: "Func_LitCentreZDM", EN: "ZON_GetZDMCenter", FR: "ZON_LitCentreZDM")] LitCentreZDM, + [AI_Definition(SCR: "Func_LitCentreZDE", EN: "ZON_GetZDECenter", FR: "ZON_LitCentreZDE")] LitCentreZDE, + [AI_Definition(SCR: "Func_LitCentreZDD", EN: "ZON_GetZDDCenter", FR: "ZON_LitCentreZDD")] LitCentreZDD, + [AI_Definition(SCR: "Func_LitAxeZDM", EN: "ZON_GetZDMAxis", FR: "ZON_LitAxeZDM")] LitAxeZDM, + [AI_Definition(SCR: "Func_LitAxeZDE", EN: "ZON_GetZDEAxis", FR: "ZON_LitAxeZDE")] LitAxeZDE, + [AI_Definition(SCR: "Func_LitAxeZDD", EN: "ZON_GetZDDAxis", FR: "ZON_LitAxeZDD")] LitAxeZDD, + [AI_Definition(SCR: "Func_LitDimensionZDM", EN: "ZON_GetZDMDimension", FR: "ZON_LitDimensionZDM")] LitDimensionZDM, + [AI_Definition(SCR: "Func_LitDimensionZDE", EN: "ZON_GetZDEDimension", FR: "ZON_LitDimensionZDE")] LitDimensionZDE, + [AI_Definition(SCR: "Func_LitDimensionZDD", EN: "ZON_GetZDDDimension", FR: "ZON_LitDimensionZDD")] LitDimensionZDD, + //******************************************************************************************************************************************************************************************************************************************************** + [AI_Definition(SCR: "Func_VecteurPointAxe", EN: "VEC_PointAxisVector", FR: "VEC_VecteurPointAxe")] VecteurPointAxe, + [AI_Definition(SCR: "Func_VecteurPointSegment", EN: "VEC_PointSegmentVector", FR: "VEC_VecteurPointSegment")] VecteurPointSegment, + [AI_Definition(SCR: "Func_VectorContribution", EN: "VEC_VectorContribution", FR: "VEC_ContributionVecteur")] VectorContribution, + [AI_Definition(SCR: "Func_VectorCombination", EN: "VEC_VectorCombination", FR: "VEC_CombinaisonVecteur")] VectorCombination, + [AI_Definition(SCR: "Func_TemporalVectorCombination", EN: "VEC_TemporalVectorCombination", FR: "VEC_CombinaisonTemporelleVecteur")] TemporalVectorCombination, + [AI_Definition(SCR: "Func_ScaledVector", EN: "VEC_ScaledVector", FR: "VEC_MulVecteurScalaire")] ScaledVector, + [AI_Definition(SCR: "Func_GetVectorNorm", EN: "VEC_GetVectorNorm", FR: "VEC_VecteurNorme")] GetVectorNorm, + [AI_Definition(SCR: "Func_RotateVector", EN: "VEC_RotateVector", FR: "VEC_TourneVecteur")] RotateVector, + [AI_Definition(SCR: "Func_VecteurAngle", EN: "VEC_AngleVector", FR: "VEC_VecteurAngle")] VectorAngle, + [AI_Definition(SCR: "Func_VecteurCos", EN: "VEC_CosVector", FR: "VEC_VecteurCos")] VectorCos, + [AI_Definition(SCR: "Func_VecteurSin", EN: "VEC_SinVector", FR: "VEC_VecteurSin")] VectorSin, + //******************************************************************************************************************************************************************************************************************************************************** + [AI_Definition(SCR: "Func_GetNormalCollideVector", EN: "COL_GetNormalCollideVector", FR: "COL_VecteurNormalCollision")] GetNormalCollideVector, + [AI_Definition(SCR: "Func_GetNormalCollideVector2", EN: "COL_GetNormalCollideVector2", FR: "COL_VecteurNormalCollision2")] GetNormalCollideVector2, + [AI_Definition(SCR: "Func_GetCollidePoint", EN: "COL_GetCollidePoint", FR: "COL_LitPointCollision")] GetCollidePoint, + [AI_Definition(SCR: "Func_GetCollidePoint2", EN: "COL_GetCollidePoint2", FR: "COL_LitPointCollision2")] GetCollidePoint2, + [AI_Definition(SCR: "Func_GetHandsCollidePoint", EN: "COL_GetHandsCollidePoint", FR: "COL_LitPointCollisionMains")] GetHandsCollidePoint, + [AI_Definition(SCR: "eFunc_GetCollideRate", EN: "COL_GetCollideRate", FR: "COL_LitTauxDePenetrationCollision")] GetCollideRate, + [AI_Definition(SCR: "Func_GetCollideRate2", EN: "COL_GetCollideRate2", FR: "COL_LitTauxDePenetrationCollision2")] GetCollideRate2, + [AI_Definition(SCR: "Func_GetCollideMaterialType", EN: "COL_GetCollideMaterialType", FR: "COL_LitTypeMateriauCollision")] GetCollideMaterialType, + [AI_Definition(SCR: "eFunc_GetCollideMaterialType2", EN: "COL_GetCollideMaterialType2", FR: "COL_LitTypeMateriauCollision2")] GetCollideMaterialType2, + //******************************************************************************************************************************************************************************************************************************************************** + [AI_Definition(SCR: "Func_CollisionPoint", EN: "COL_CollisionPoint", FR: "COL_PointCollision")] GetCollisionPoint, + [AI_Definition(SCR: "Func_CollisionNormalVector", EN: "COL_CollisionNormalVector", FR: "COL_NormaleCollision")] GetCollisionVector, + [AI_Definition(SCR: "Func_PersoCollisionne", EN: "COL_PersoCollisionne", FR: "COL_PersoCollisionne")] GetCollisionPerso, + [AI_Definition(SCR: "Func_CollisionPointMaterial", EN: "COL_CollisionPointMaterial", FR: "COL_PointCollisionAvecMateriau")] GetCollisionPointMaterial, + // GMT functions + [AI_Definition(SCR: "Func_GetLastTraversedMaterialType", EN: "COL_GetLastTraversedMaterialType", FR: "COL_TypeDernierMateriauTraverse")] GetLastTraversedMaterialType, + [AI_Definition(SCR: "Func_GetLastTraversedMaterial", EN: "COL_GetLastTraversedMaterial", FR: "COL_DernierMateriauTraverse")] GetLastTraversedMaterial, + [AI_Definition(SCR: "Func_GetCurrentCollidedGMT", EN: "COL_GetCurrentCollidedGMT", FR: "LitGMTCourant")] GetCurrentCollidedGMT, + // collision communication management : NOT ULTRA, because only the executed actor can read his information + [AI_Definition(SCR: "Func_GetColliderType", EN: "COL_GetColliderType", FR: "COL_LitTypeDeCollisionneur")] GetColliderType, + [AI_Definition(SCR: "Func_GetColliderVector", EN: "COL_GetColliderVector", FR: "COL_LitVecteurDeCollisionneur")] GetColliderVector, + [AI_Definition(SCR: "Func_GetColliderReal", EN: "COL_GetColliderReal", FR: "COL_LitReelDeCollisionneur")] GetColliderReal, + [AI_Definition(SCR: "Func_LitDernierPersoCollisione", EN: "COL_LitDernierPersoCollisione", FR: "COL_LitDernierPersoCollisione")] GetLastCollisionActor, + [AI_Definition(SCR: "Func_CalculVecteurRebond", EN: "COL_CalculVecteurRebond", FR: "COL_CalculVecteurRebond")] ComputeRebondVector, + //******************************************************************************************************************************************************************************************************************************************************** + // position management : ULTRA + [AI_Definition(SCR: "Func_GetModuleAbsolutePosition", EN: "MOD_GetModuleAbsolutePosition", FR: "MOD_PositionAbsolueModule")] GetModuleAbsolutePosition, + [AI_Definition(SCR: "Func_GetModuleRelativePosition", EN: "MOD_GetModuleRelativePosition", FR: "MOD_PositionRelativeModule")] GetModuleRelativePosition, + [AI_Definition(SCR: "Func_GetModuleZoomFactor", EN: "MOD_GetModuleZoomFactor", FR: "MOD_DeformationModule")] GetModuleZoomFactor, + [AI_Definition(SCR: "Func_GetModuleSighting", EN: "MOD_GetModuleSighting", FR: "MOD_ViseeModule")] GetModuleSighting, + [AI_Definition(SCR: "Func_CastIntegerToChannel", EN: "MOD_CastIntegerToChannel", FR: "MOD_ConversionEnModule")] CastIntegerToChannel, + //******************************************************************************************************************************************************************************************************************************************************** + // names and strings management + [AI_Definition(SCR: "Func_GetSlotDate", EN: "TEXT_GetSlotDate", FR: "TEXT_LitDateDuSlot")] GetSlotDate, + [AI_Definition(SCR: "Func_GetSlotName", EN: "TEXT_GetSlotName", FR: "TEXT_LitNomDuSlot")] GetSlotName, + [AI_Definition(SCR: "Func_GetSlotScore", EN: "TEXT_GetSlotScore", FR: "TEXT_LitScoreDuSlot")] GetSlotScore, + [AI_Definition(SCR: "Func_GetStringCharAt", EN: "TEXT_GetStringCharAt", FR: "TEXT_LettreDuTexteALaPosition")] GetStringCharAt, + [AI_Definition(SCR: "Func_GetFormattedTextInfo", EN: "TEXT_GetFormattedTextInfo", FR: "TEXT_LitInfoSurTexteFormate")] GetFormattedTextInfo, + [AI_Definition(SCR: "Func_GetInputEntryName", EN: "TEXT_GetInputEntryName", FR: "TEXT_LitNomDeLaTouche")] GetInputEntryName, + //******************************************************************************************************************************************************************************************************************************************************** + [AI_Definition(SCR: "Proc_GetMechanicGravityFactor", EN: "MEC_GetGravityFactor", FR: "MEC_LitGravite")] GetMechanicGravityFactor, + [AI_Definition(SCR: "Proc_GetMechanicSlide", EN: "MEC_GetSlide", FR: "MEC_LitGlissement")] GetMechanicSlide, + [AI_Definition(SCR: "Proc_GetMechanicRebound", EN: "MEC_GetRebound", FR: "MEC_LitRebond")] GetMechanicRebound, + [AI_Definition(SCR: "Proc_GetMechanicSlopeLimit", EN: "MEC_GetSlopeLimit", FR: "MEC_LitLimitePente")] GetMechanicSlopeLimit, + [AI_Definition(SCR: "Proc_GetMechanicInertiaX", EN: "MEC_GetInertiaX", FR: "MEC_LitInertieX")] GetMechanicInertiaX, + [AI_Definition(SCR: "Proc_GetMechanicInertiaY", EN: "MEC_GetInertiaY", FR: "MEC_LitInertieY")] GetMechanicInertiaY, + [AI_Definition(SCR: "Proc_GetMechanicInertiaZ", EN: "MEC_GetInertiaZ", FR: "MEC_LitInertieZ")] GetMechanicInertiaZ, + [AI_Definition(SCR: "Proc_GetMechanicTiltIntensity", EN: "MEC_GetTiltIntensity", FR: "MEC_LitIntensiteTilt")] GetMechanicTiltIntensity, + [AI_Definition(SCR: "Proc_GetMechanicTiltInertia", EN: "MEC_GetTiltInertia", FR: "MEC_LitInertieTilt")] GetMechanicTiltInertia, + [AI_Definition(SCR: "Proc_GetMechanicTiltOrigin", EN: "MEC_GetTiltOrigin", FR: "MEC_LitOrigineTilt")] GetMechanicTiltOrigin, + [AI_Definition(SCR: "Proc_GetMechanicMaxSpeed", EN: "MEC_GetMaxSpeed", FR: "MEC_LitVitesseMax")] GetMechanicMaxSpeed, + [AI_Definition(SCR: "Proc_GetMechanicStreamPriority", EN: "MEC_GetStreamPriority", FR: "MEC_LitPrioriteFlux")] GetMechanicStreamPriority, + [AI_Definition(SCR: "Proc_GetMechanicStreamSpeed", EN: "MEC_GetStreamSpeed", FR: "MEC_LitVitesseFlux")] GetMechanicStreamSpeed, + [AI_Definition(SCR: "Proc_GetMechanicStreamFactor", EN: "MEC_GetStreamFactor", FR: "MEC_LitFacteurDeFlux")] GetMechanicStreamFactor, + // slide coef + [AI_Definition(SCR: "Proc_GetSlideFactorX", EN: "MEC_GetSlideFactorX", FR: "MEC_LitCoefDeGlisseX")] GetSlideFactorX, + [AI_Definition(SCR: "Proc_GetSlideFactorY", EN: "MEC_GetSlideFactorY", FR: "MEC_LitCoefDeGlisseY")] GetSlideFactorY, + [AI_Definition(SCR: "Proc_GetSlideFactorZ", EN: "MEC_GetSlideFactorZ", FR: "MEC_LitCoefDeGlisseZ")] GetSlideFactorZ, + [AI_Definition(SCR: "Proc_JumpImpulsion", EN: "MEC_JumpImpulsion", FR: "MEC_ImpulsionSaut")] JumpImpulsion, + // anim speed + [AI_Definition(SCR: "Proc_GetSpeedAnim", EN: "MEC_GetSpeedAnim", FR: "MEC_LitVitesseAnimation")] GetSpeedAnim, + //******************************************************************************************************************************************************************************************************************************************************** + // Hierarchy - Platform + [AI_Definition(SCR: "proc_HIERGetFather", EN: "HIER_GetFather", FR: "HIER_MonPere")] HierGetFather, + //******************************************************************************************************************************************************************************************************************************************************** + // Zone Activation Privileged + [AI_Definition(SCR: "Func_LitActivationZDD", EN: "ZON_GetZDDActivation", FR: "ZON_LitActivationZDD")] GetActivationZDD, + [AI_Definition(SCR: "Func_LitActivationZDM", EN: "ZON_GetZDMActivation", FR: "ZON_LitActivationZDM")] GetActivationZDM, + [AI_Definition(SCR: "Func_LitActivationZDE", EN: "ZON_GetZDEActivation", FR: "ZON_LitActivationZDE")] GetActivationZDE, + [AI_Definition(SCR: "Func_LitActivationZDR", EN: "ZON_GetZDRActivation", FR: "ZON_LitActivationZDR")] GetActivationZDR, + //******************************************************************************************************************************************************************************************************************************************************** + // Computing collision frequency + // Computing Brain frequency + // Computing Light frequency + [AI_Definition(SCR: "Func_GetCollComputationFrequency", EN: "ACT_GetCollComputationFrequency", FR: "ACT_LitFrequenceCalculCollisions")] GetCollisionFrequency, + [AI_Definition(SCR: "Func_GetBrainComputationFrequency", EN: "ACT_GetBrainComputationFrequency", FR: "ACT_LitFrequenceCalculIA")] GetBrainFrequency, + [AI_Definition(SCR: "Func_GetLightComputationFrequency", EN: "ACT_GetLightComputationFrequency", FR: "ACT_LitFrequenceCalculLumieres")] GetLightFrequency, + //******************************************************************************************************************************************************************************************************************************************************** + [AI_Definition(SCR: "Func_GetBooleanInArray", EN: "ACT_GetBooleanInArray", FR: "ACT_LitBooleenDansTableau")] GetBooleanInArray, + [AI_Definition(SCR: "Func_GetNumberOfBooleanInArray", EN: "ACT_GetNumberOfBooleanInArray", FR: "ACT_LitNombreDeBooleensDansTableau")] GetNumberOfBooleanInArray, + //******************************************************************************************************************************************************************************************************************************************************** + [AI_Definition(SCR: "Func_GetButtonName", EN: "BUT_GetButtonName", FR: "BUT_GetButtonName")] GetButtonName, + //******************************************************************************************************************************************************************************************************************************************************** + [AI_Definition(SCR: "Func_GetDriversAvailable", EN: "VID_GetDriversAvailable", FR: "VID_GetDriversAvailable")] GetDriversAvailable, + //******************************************************************************************************************************************************************************************************************************************************** + [AI_Definition(SCR: "Func_GetCurrentLanguageId", EN: "TEXT_GetCurrentLanguageId", FR: "TEXT_GetCurrentLanguageId")] GetCurrentLanguageId, + //******************************************************************************************************************************************************************************************************************************************************** + [AI_Definition(SCR: "Func_GetNbLanguages", EN: "TEXT_GetNbLanguages", FR: "TEXT_GetNbLanguages")] GetNbLanguages, + //******************************************************************************************************************************************************************************************************************************************************** + [AI_Definition(SCR: "Func_GetLanguageText", EN: "TEXT_GetLanguageText", FR: "TEXT_GetLanguageText")] GetLanguageText, + //******************************************************************************************************************************************************************************************************************************************************** + [AI_Definition(SCR: "Func_TextToInt", EN: "TEXT_TextToInt", FR: "TEXT_TexteEnEntier")] TextToInt, + //******************************************************************************************************************************************************************************************************************************************************** + [AI_Definition(SCR: "Func_GetMusicVolume", EN: "OPTION_GetMusicVolume", FR: "Option_GetVolumeMusical")] GetMusicVolume, + [AI_Definition(SCR: "Func_GetSfxVolume", EN: "OPTION_GetSfxVolume", FR: "Option_GetVolumeEffets")] GetSfxVolume, + //******************************************************************************************************************************************************************************************************************************************************** + [AI_Definition(SCR: "Func_SlotIsValid", EN: "OPTION_SlotIsValid", FR: "Option_SlotIsValid")] SlotIsValid, + //******************************************************************************************************************************************************************************************************************************************************** + [AI_Definition(SCR: "Func_NbAvailableResolution", EN: "VID_NbAvailableResolution", FR: "VID_NbAvailableResolution")] NbAvailableResolution, + //******************************************************************************************************************************************************************************************************************************************************** + [AI_Definition(SCR: "Func_CurrentResolution", EN: "VID_CurrentResolution", FR: "VID_CurrentResolution")] CurrentResolution, + //******************************************************************************************************************************************************************************************************************************************************** + [AI_Definition(SCR: "Func_GetBrightness", EN: "VID_GetBrightness", FR: "VID_GetBrightness")] GetBrightness, + //******************************************************************************************************************************************************************************************************************************************************** + [AI_Definition(SCR: "Func_NameResolution", EN: "VID_NameResolution", FR: "VID_NameResolution")] NameResolution, + //******************************************************************************************************************************************************************************************************************************************************** + [AI_Definition(SCR: "Func_GetNbSlotsAvailable", EN: "OPTION_GetNbSlotsAvailable", FR: "OPTION_GetNbSlotsAvailable")] GetNbSlotsAvailable, + [AI_Definition(SCR: "Func_GetTextureFiltering", EN: "VID_GetTextureFiltering", FR: "VID_GetTextureFiltering")] GetTextureFiltering, + [AI_Definition(SCR: "Func_GetAntiAliasing", EN: "VID_GetAntiAliasing", FR: "VID_GetAntiAliasing")] GetAntiAliasing, + //******************************************************************************************************************************************************************************************************************************************************** + [AI_Definition(SCR: "Func_GetSaturationDistance", EN: "ACT_GetSaturationDistance", FR: "ACT_LitDistanceDeSaturation")] GetSaturationDistance, + [AI_Definition(SCR: "Func_GetBackGroundDistance", EN: "ACT_GetBackGroundDistance", FR: "ACT_LitDistanceDeBackground")] GetBackgroundDistance, + //******************************************************************************************************************************************************************************************************************************************************** + [AI_Definition(SCR: "Func_GetTooFarLimit", EN: "ACT_GetTooFarLimit", FR: "ACT_LitLimiteEloignement")] GetTooFarLimit, + [AI_Definition(SCR: "Func_GetTransparencyZoneMin", EN: "ACT_GetTransparencyZoneMin", FR: "ACT_LitZoneMinTransparence")] GetTransparencyZoneMin, + [AI_Definition(SCR: "Func_GetTransparencyZoneMax", EN: "ACT_GetTransparencyZoneMax", FR: "ACT_LitZoneMaxTransparence")] GetTransparencyZoneMax, + //******************************************************************************************************************************************************************************************************************************************************** + // ANNECY MT - 30/03/99 { PC Protection Code + [AI_Definition(SCR: "Func_ExecuteVariable", EN: "PRO_ExecuteVariable", FR: "PRO_ExecuteVariable")] ExecuteVariable, + [AI_Definition(SCR: "Func_ComputeProtectKey", EN: "ACT_ComputeProtectKey", FR: "ACT_CalculeClefProtection")] ComputeProtectKey, + [AI_Definition(SCR: "Func_Xor", EN: "MATH_Xor", FR: "MATH_Xor")] Xor, + // v These are only present on PC, not in the U64 project + [AI_Definition(SCR: "MATH_And", EN: "MATH_And", FR: "MATH_And")] And, + [AI_Definition(SCR: "Func_Or", EN: "MATH_Or", FR: "MATH_Or")] Or, + [AI_Definition(SCR: "Func_Not", EN: "MATH_Not", FR: "MATH_Not")] Not, + // ^ + [AI_Definition(SCR: "Func_DivU", EN: "MATH_DivU", FR: "MATH_DivU")] DivUnsigned, + [AI_Definition(SCR: "Func_MulU", EN: "MATH_MulU", FR: "MATH_MulU")] MulUnsigned, + [AI_Definition(SCR: "Func_AddU", EN: "MATH_AddU", FR: "MATH_AddU")] AddUnsigned, + [AI_Definition(SCR: "Func_SubU", EN: "MATH_SubU", FR: "MATH_SubU")] SubUnsigned, + [AI_Definition(SCR: "Func_MemoryValue", EN: "MATH_MemoryValue", FR: "MATH_ValeurMemoire")] GetMemoryValue, + + [AI_Definition(SCR: "Func_GetCheats", EN: "FUNC_GetCheats", FR: "FUNC_GetCheats")] GetCheats, + [AI_Definition(SCR: "Func_GetBacklight", EN: "FUNC_GetBacklight", FR: "FUNC_GetBacklight")] GetBacklight, + + [AI_Definition(SCR: "Func_DoneAnalogCalibration", EN: "FUNC_DoneAnalogCalibration", FR: "FUNC_DoneAnalogCalibration")] DoneAnalogCalibration, + #endregion + + #region DefFunCa + [AI_Definition(SCR: "Proc_Cam_GetShiftTarget", EN: "Cam_GetShiftTarget", FR: "Cam_GetShiftTarget")] Cam_GetShiftTarget, + [AI_Definition(SCR: "Proc_Cam_GetShiftPos", EN: "Cam_GetShiftPos", FR: "Cam_GetShiftPos")] Cam_GetShiftPos, + + [AI_Definition(SCR: "Fct_Cam_GetDistMin", EN: "Cam_GetDistMin", FR: "Cam_GetDistMin")] Cam_GetDistMin, + [AI_Definition(SCR: "Fct_Cam_GetDistMax", EN: "Cam_GetDistMax", FR: "Cam_GetDistMax")] Cam_GetDistMax, + [AI_Definition(SCR: "Fct_Cam_GetBoundDistMin", EN: "Cam_GetBoundDistMin", FR: "Cam_GetBoundDistMin")] Cam_GetBoundDistMin, + [AI_Definition(SCR: "Fct_Cam_GetBoundDistMax", EN: "Cam_GetBoundDistMax", FR: "Cam_GetBoundDistMax")] Cam_GetBoundDistMax, + [AI_Definition(SCR: "Fct_Cam_GetAngleAlpha", EN: "Cam_GetAngleAlpha", FR: "Cam_GetAngleAlpha")] Cam_GetAngleAlpha, + [AI_Definition(SCR: "Fct_Cam_GetAngleShiftAlpha", EN: "Cam_GetAngleShiftAlpha", FR: "Cam_GetAngleShiftAlpha")] Cam_GetAngleShiftAlpha, + [AI_Definition(SCR: "Fct_Cam_GetAngleTheta", EN: "Cam_GetAngleTheta", FR: "Cam_GetAngleTheta")] Cam_GetAngleTheta, + [AI_Definition(SCR: "Fct_Cam_GetAngleShiftTheta", EN: "Cam_GetAngleShiftTheta", FR: "Cam_GetAngleShiftTheta")] Cam_GetAngleShiftTheta, + [AI_Definition(SCR: "Fct_Cam_GetLinearSpeed", EN: "Cam_GetLinearSpeed", FR: "Cam_GetLinearSpeed")] Cam_GetLinearSpeed, + [AI_Definition(SCR: "Fct_Cam_GetLinearIncreaseSpeed", EN: "Cam_GetLinearIncreaseSpeed", FR: "Cam_GetLinearIncreaseSpeed")] Cam_GetLinearIncreaseSpeed, + [AI_Definition(SCR: "Fct_Cam_GetLinearDecreaseSpeed", EN: "Cam_GetLinearDecreaseSpeed", FR: "Cam_GetLinearDecreaseSpeed")] Cam_GetLinearDecreaseSpeed, + [AI_Definition(SCR: "Fct_Cam_GetAngularSpeed", EN: "Cam_GetAngularSpeed", FR: "Cam_GetAngularSpeed")] Cam_GetAngularSpeed, + [AI_Definition(SCR: "Fct_Cam_GetAngularIncreaseSpeed", EN: "Cam_GetAngularIncreaseSpeed", FR: "Cam_GetAngularIncreaseSpeed")] Cam_GetAngularIncreaseSpeed, + [AI_Definition(SCR: "Fct_Cam_GetAngularDecreaseSpeed", EN: "Cam_GetAngularDecreaseSpeed", FR: "Cam_GetAngularDecreaseSpeed")] Cam_GetAngularDecreaseSpeed, + [AI_Definition(SCR: "Fct_Cam_GetTargetSpeed", EN: "Cam_GetTargetSpeed", FR: "Cam_GetTargetSpeed")] Cam_GetTargetSpeed, + [AI_Definition(SCR: "Fct_Cam_GetTargetIncreaseSpeed", EN: "Cam_GetTargetIncreaseSpeed", FR: "Cam_GetTargetIncreaseSpeed")] Cam_GetTargetIncreaseSpeed, + [AI_Definition(SCR: "Fct_Cam_GetTargetDecreaseSpeed", EN: "Cam_GetTargetDecreaseSpeed", FR: "Cam_GetTargetDecreaseSpeed")] Cam_GetTargetDecreaseSpeed, + [AI_Definition(SCR: "Fct_Cam_GetFocal", EN: "Cam_GetFocal", FR: "Cam_GetFocal")] Cam_GetFocal, + [AI_Definition(SCR: "Fct_Cam_GetZMin", EN: "Cam_GetZMin", FR: "Cam_GetZMin")] Cam_GetZMin, + [AI_Definition(SCR: "Fct_Cam_GetZMax", EN: "Cam_GetZMax", FR: "Cam_GetZMax")] Cam_GetZMax, + + [AI_Definition(SCR: "Fct_Cam_GetTargetedSuperObject", EN: "Cam_GetTargetedSuperObject", FR: "Cam_GetTargetedSuperObject")] Cam_GetTargetedSuperObject, + [AI_Definition(SCR: "Fct_Cam_GetTypeOfViewport", EN: "Cam_GetTypeOfViewport", FR: "Cam_GetTypeOfViewport")] Cam_GetTypeOfViewport, + [AI_Definition(SCR: "Fct_Cam_GetCameraOfViewport", EN: "Cam_GetCameraOfViewport", FR: "Cam_GetCameraOfViewport")] Cam_GetCameraOfViewport, + [AI_Definition(SCR: "Fct_Cam_GetMainCamera", EN: "Cam_GetMainCamera", FR: "Cam_GetMainCamera")] Cam_GetMainCamera, + + [AI_Definition(SCR: "Fct_Cam_ComputeTargetWithTgtPerso", EN: "Cam_ComputeTargetWithTgtPerso", FR: "Cam_ComputeTargetWithTgtPerso")] Cam_ComputeTargetWithTgtPerso, + [AI_Definition(SCR: "Fct_Cam_ComputeCurrentTarget", EN: "Cam_ComputeCurrentTarget", FR: "Cam_ComputeCurrentTarget")] Cam_GetCurrentTargetPosition, + + + [AI_Definition(SCR: "Fct_Cam_GetSectorCameraType", EN: "Cam_GetSectorCameraType", FR: "Cam_GetSectorCameraType")] Cam_GetSectorCameraType, + [AI_Definition(SCR: "Fct_Cam_GetBestPos", EN: "Cam_GetBestPos", FR: "Cam_GetBestPos")] Cam_GetBestPos, + #endregion + + #region R3 PS2 (SCR from RA PS2) + [AI_Definition(SCR: "Func_GetRadiusWP")] GetRadiusWP, + [AI_Definition(SCR: "Func_InterpolationBt3WP")] CircularInterpolationBetween3WP, + BezierBetween3WP, + [AI_Definition(SCR: "Func_GetCollidedSPO")] GetSPO_GetCollidedSPO, + [AI_Definition(SCR: "Func_GetCollidedWallSPO")] GetSPO_GetCollidedWallSPO, + [AI_Definition(SCR: "Func_GetCollidedCeilingSPO")] GetSPO_GetCollidedCeilingSPO, + [AI_Definition(SCR: "PAD2_GetFirstActivePad")] GetFirstActivePad, + [AI_Definition(SCR: "PAD2_Func_GetInputAnalogicValueX")] InputAnalogicValueX, + InputRealAnalogicValueX, + [AI_Definition(SCR: "PAD2_Func_GetInputAnalogicValueY")] InputAnalogicValueY, + InputRealAnalogicValueY, + InputRealAnalogicValue, + [AI_Definition(SCR: "Func_GetVMTColor")] GetVMTColor, + [AI_Definition(SCR: "Func_GetVMTSpecularCoef")] GetVMTSpecularCoef, + [AI_Definition(SCR: "Func_GetVMTSpecularExponant")] GetVMTSpecularExponent, + [AI_Definition(SCR: "Func_GetVMTDiffuseCoef")] GetVMTDiffuseCoef, + [AI_Definition(SCR: "Func_GetVMTAmbientCoef")] GetVMTAmbientCoef, + [AI_Definition(SCR: "Func_GetVMTTextureScrollingCoefU")] GetVMTTextureScrollingCoefU, + [AI_Definition(SCR: "Func_GetVMTTextureScrollingCoefV")] GetVMTTextureScrollingCoefV, + [AI_Definition(SCR: "Func_GetVMTFrame")] GetVMTFrame, + [AI_Definition(SCR: "Func_GetVMTNumberOfFrames")] GetVMTNumberOfFrames, + [AI_Definition(SCR: "Func_MP_GetNumberOfPlayers")] MP_GetNumberOfPlayers, + [AI_Definition(SCR: "Func_MP_GetMaxNumberOfPlayers")] MP_GetMaxNumberOfPlayers, + [AI_Definition(SCR: "Func_MP_GetViewportNumberOfPlayer")] MP_GetViewPortOfPlayer, + [AI_Definition(SCR: "Func_MP_GetArrayOfActiveMainActors")] MP_GetActiveMainActors, + PAD_GetHorizontalInvertion, + PAD_GetVerticalInvertion, + [AI_Definition(SCR: "Func_GetRLITableIndex")] GetRLITableIndex, + [AI_Definition(SCR: "Func_PAD2_GetPadGlobalVector")] PAD2_GetGlobalVector, + [AI_Definition(SCR: "Func_PAD2_GetPadHorizontalAxis")] PAD2_GetHorizontalAxis, + [AI_Definition(SCR: "Func_PAD2_GetPadVerticalAxis")] PAD2_GetVerticalAxis, + [AI_Definition(SCR: "Func_PAD2_GetPadAnalogForce")] PAD2_GetAnalogForce, + [AI_Definition(SCR: "Func_PAD2_GetPadTrueAnalogForce")] PAD2_GetTrueAnalogForce, + [AI_Definition(SCR: "Func_PAD2_GetPadRotationAngle")] PAD2_GetRotationAngle, + [AI_Definition(SCR: "Func_PAD2_GetPadSector")] PAD2_GetPadSector, + PAD2_GetLongDescValue, + [AI_Definition(SCR: "Func_TXT_GetNumberOfLines")] TXT_GetNumberOfLines, + [AI_Definition(SCR: "PAD2_Func_GetInputAnalogicValue2")] InputAnalogicValue2, + [AI_Definition(SCR: "PAD2_Func_GetInputAnalogicValueV")] InputAnalogicValueV, + InputRealAnalogicValueV, + [AI_Definition(SCR: "PAD2_Func_GetInputAnalogicValueZ")] InputAnalogicValueZ, + InputRealAnalogicValueZ, + [AI_Definition(SCR: "Proc_SAV2_GetValue")] SAV2_GetValue, + [AI_Definition(SCR: "Proc_SAV2_GetValueIndex")] SAV2_GetValueIndex, + [AI_Definition(SCR: "Proc_SAV2_GetNumberOfExistingSave")] SAV2_GetNumberOfExistingSave, + [AI_Definition(SCR: "Proc_SAV2_GetTimeSaveGame")] SAV2_GetTimeSaveGame, + [AI_Definition(SCR: "Proc_SAV2_GetDateSaveGame")] SAV2_GetDateSaveGame, + GetTransitionSectorID, + [AI_Definition(SCR: "Func_FFB_PreCreateConstantEffect")] FFBPreCreateConstantEffect, + [AI_Definition(SCR: "Func_FFB_CreateAndLaunchConstantEffect")] FFBCreateAndLaunchConstantEffect, + [AI_Definition(SCR: "Func_FFB_StopEffectWithFade")] FFBStopEffectWithFade, + CreateCheapCharacterList, + TestCheapCharacterList, + GetClosestCheapCharacter, + GetFurthestCheapCharacter, + GetReactivateCheapCharacter, + [AI_Definition(SCR: "Func_PersoLePlusProche2")] PersoLePlusProcheExtended, + [AI_Definition(SCR: "Func_NearestActorInCurrentSector2")] PersoLePlusProcheDansSecteurCourantExtended, + [AI_Definition(SCR: "Func_NearerActorInFieldOfVision2")] NearerActorInFieldOfVisionExtended, + [AI_Definition(SCR: "Func_NearerActorOfFamilyInFieldOfVision")] NearerActorOfFamilyInFieldOfVision, + [AI_Definition(SCR: "Func_NearerActorOfFamilyInFieldOfVision2")] NearerActorOfFamilyInFieldOfVisionExtended, + [AI_Definition(SCR: "Func_NearerActorInFieldOfVisionWithOffset")] NearerActorInFieldOfVisionWithOffset, + [AI_Definition(SCR: "Func_NearerActorInFOVWithOffset2")] NearerActorInFieldOfVisionWithOffsetExtended, + [AI_Definition(SCR: "Func_NearerActorOfFamilyInFOVWithOffset")] NearerActorOfFamilyInFOVWithOffset, + [AI_Definition(SCR: "Func_NearerActorOfFamilyInFOVWithOffset2")] NearerActorOfFamilyInFOVWithOffsetExtended, + [AI_Definition(SCR: "Func_CibleLaPlusProche2")] CibleLaPlusProcheExtended, + [AI_Definition(SCR: "Func_CibleLaPlusProcheavecAngles2")] CibleLaPlusProcheAvecAnglesExtended, + [AI_Definition(SCR: "Func_GetCloserNetwork")] GetCloserNetwork, + [AI_Definition(SCR: "Func_NetworkCloserCollisionWP")] NetWorkCloserCollisionWP, + [AI_Definition(SCR: "Func_ReseauWPnLePlusProcheZPoids")] ReseauWPLePlusProcheZPoids, + [AI_Definition(SCR: "Func_NetworkCloserCollisionWPOfType")] NetworkCloserCollisionWPOfType, + [AI_Definition(SCR: "Func_NetworkCloserWPOfExactType")] NetworkCloserWPOfExactType, + [AI_Definition(SCR: "Func_ReseauWPnLePlusProcheAvecAngle")] ReseauWPLePlusProcheAvecAngle, + [AI_Definition(SCR: "eFunc_NetworkNextWPWithExactCapa")] NetworkNextWPWithExactCapa, + [AI_Definition(SCR: "eFunc_NetNextWPCapaOptimalWeight")] NetworkNextWPWithCapaOptimalWeight, + [AI_Definition(SCR: "eFunc_NetworkNextWPOfType")] NetworkNextWPOfType, + [AI_Definition(SCR: "eFunc_NetworkNextWPOfExactType")] NetworkNextWPOfExactType, + [AI_Definition(SCR: "Func_NetworkBuildRandomPath")] NetworkBuildRandomPath, + [AI_Definition(SCR: "Func_NetworkBuildRandomCircularPath")] NetworkBuildRandomCircularPath, + [AI_Definition(SCR: "Func_MTGetScrollSpeed")] MTGetScrollSpeed, + [AI_Definition(SCR: "Func_GetSPOSighting")] GetSPOSighting, + [AI_Definition(SCR: "Func_GetSPOHorizon")] GetSPOHorizon, + [AI_Definition(SCR: "Func_GetSPOBanking")] GetSPOBanking, + [AI_Definition(SCR: "Func_MP_TextAffiche")] MJTextAffiche, + [AI_Definition(SCR: "Func_TurnToPosition")] TurnToPosition, + [AI_Definition(SCR: "PS2_FormatMemoryCard")] FormatMemCard, + [AI_Definition(SCR: "PS2_GetDefaultLanguage")] GetDefaultLanguage, + [AI_Definition(SCR: "PS2_MagicBox")] PS2_MagicBox, + SAV2_DoVarsNeedToBeSet, + [AI_Definition(SCR: "Func_CINEGetGenerateEvent")] CINEGetGenerateEvent, + StringCompare, + EmptyString, + [AI_Definition(SCR: "Func_GetNormalSlopeVector")] GetNormalSlopeVector, + [AI_Definition(SCR: "Func_GetNormalSlopeVectorAndAngle")] GetNormalSlopeVectorAndAngle, + [AI_Definition(SCR: "Func_GetCollideMaterialDirection")] GetCollideMaterialDirection, + [AI_Definition(SCR: "Func_GetCollideMaterialCoeff")] GetCollideMaterialCoeff, + [AI_Definition(SCR: "Func_GetCollideMaterialTypeForAi")] GetCollideMaterialTypeForAi, + [AI_Definition(SCR: "Func_GetFirstCollisionInfo")] GetFirstCollisionInfo, + [AI_Definition(SCR: "Func_GetColliderActor")] GetColliderActor, + [AI_Definition(SCR: "Func_GetModuleHorizon")] GetModuleHorizon, + [AI_Definition(SCR: "Func_GetModuleBanking")] GetModuleBanking, + [AI_Definition(SCR: "Func_ScanAsciiKey")] ScanAsciiKey, + [AI_Definition(SCR: "Func_GetOneCustomFloat")] GetOneCustomFloat, + [AI_Definition(SCR: "Func_GetOneCustomLong")] GetOneCustomLong, + [AI_Definition(SCR: "Func_GetOneCustomVector")] GetOneCustomVector, + [AI_Definition(SCR: "Func_SaveResolution")] SaveResolution, + [AI_Definition(SCR: "Func_IsResolutionAvailable")] IsResolutionAvailable, + [AI_Definition(SCR: "Func_GetCurrentFrame")] GetCurrentFrame, + GetXBoxRegion, + CreditsBegin, + CreditsGetChapter, + CreditsGetPageFromCurrentChapter, + [AI_Definition(SCR: "Fct_Cam_GetTransparencyFlag")] Cam_GetTransparencyFlag, + [AI_Definition(SCR: "Fct_Cam_SetMirrorFlag")] Cam_SetMirrorFlag, + [AI_Definition(SCR: "Fct_Cam_GetMirrorFlag")] Cam_GetMirrorFlag, + [AI_Definition(SCR: "Func_CAM_GetViewportCoordinates")] CAM_GetViewportCoordinates, + [AI_Definition(SCR: "FUnc_BackMode")] CSHBackMode, + [AI_Definition(SCR: "Func_MarioMode")] CSHMarioMode, + [AI_Definition(SCR: "Func_StrafeLockMode")] CSHStrafeLockMode, + [AI_Definition(SCR: "Proc_GetViewFinderDistance")] GetViewFinderDistance, + [AI_Definition(SCR: "Func_LinkInit")] LinkInit, + [AI_Definition(SCR: "Func_LinkDoBehaviour")] LinkDoBehaviour, + [AI_Definition(SCR: "Func_LinkKill")] LinkKill, + [AI_Definition(SCR: "Func_LinkGetNoCutpoints")] LinkGetNoCutpoints, + [AI_Definition(SCR: "Func_LinkGetCutPoint")] LinkGetCutPoint, + [AI_Definition(SCR: "Func_FollowLinkDirection")] FollowLinkDirection, + [AI_Definition(SCR: "Func_SND_GetSoundHandle")] SND_GetSoundHandle, + [AI_Definition(SCR: "Func_SND_GetSendSoundRequestHandleState")] SND_GetSendSoundRequestHandleState, + [AI_Definition(SCR: "Func_SND_GetSendVoiceRequestHandleState")] SND_GetSendVoiceRequestHandleState, + [AI_Definition(SCR: "Func_SND_GetSendMusicRequestHandleState")] SND_GetSendMusicRequestHandleState, + [AI_Definition(SCR: "Func_SND_GetSendAmbianceRequestHandleSt")] SND_GetSendAmbianceRequestHandleState, + [AI_Definition(SCR: "Func_SND_GetSendMenuSndRequestHandleState")] SND_GetSendMenuSndRequestHandleState, + [AI_Definition(SCR: "Func_SND_GetSoundVolume")] SND_GetSoundVolume, + [AI_Definition(SCR: "Func_SND_GetVoiceVolume")] SND_GetVoiceVolume, + [AI_Definition(SCR: "Func_SND_GetMusicVolume")] SND_GetMusicVolume, + [AI_Definition(SCR: "Func_SND_GetAmbianceVolume")] SND_GetAmbianceVolume, + [AI_Definition(SCR: "Func_SND_GetMenuSndVolume")] SND_GetMenuSndVolume, + IsSoundPlaying, + SND_GetMusicMarker, + [AI_Definition(SCR: "Func_MonitoringSetVariable")] MonitoringSetVariable, + R3GetScore, + R3GetNbCage, + PS2DemoGetParameter, + GetScreenDisplayFrequency, + GetLastSaveGameOperationResult, + SinEffect_GetSinusPosition, + SFX_GetLightReflectionStatus, + SFX_GetWaterCirclesStatus, + SFX_IsLightReflectionPossible, + SFX_IsWaterCirclesPossible, + AGO_GetHandle, + IsMcValid, + FormatMc, + #endregion + + #region RA PS2 (custom name, SCR from ELF) + [AI_Definition(SCR: "Func_NetGetPersoRole")] NetGetPersoRole, + [AI_Definition(SCR: "Func_NetGetCreationTime")] NetGetCreationTime, + [AI_Definition(SCR: "Func_NetGetClientID")] NetGetClientID, + [AI_Definition(SCR: "Func_NetGetPlayerID")] NetGetPlayerID, + [AI_Definition(SCR: "Func_NetGetCurrentTime")] NetGetCurrentTime, + [AI_Definition(SCR: "Func_ActGetAlwaysGenerator")] ActGetAlwaysGenerator, + [AI_Definition(SCR: "Func_ActGetCurrentActionIndex")] ActGetCurrentActionIndex, + [AI_Definition(SCR: "Func_ActGetNumberOfGroups")] ActGetNumberOfGroups, + [AI_Definition(SCR: "Func_NetGetStatus")] NetGetStatus, + [AI_Definition(SCR: "Func_NetIsPlayerStillConnected")] NetIsPlayerStillConnected, + [AI_Definition(SCR: "Func_NetGetPing")] NetGetPing, + [AI_Definition(SCR: "Func_NetGetPlayerName")] NetGetPlayerName, + [AI_Definition(SCR: "Func_NetGetNumberOfPlayers")] NetGetNumberOfPlayers, + [AI_Definition(SCR: "Func_NetGetNetworkMode")] NetGetNetworkMode, + [AI_Definition(SCR: "Func_NetGetLANServerCount")] NetGetLANServerCount, + [AI_Definition(SCR: "Func_NetCreateAndConnectToLANServer")] NetCreateAndConnectToLANServer, + [AI_Definition(SCR: "Func_NetConnectToLANServer")] NetConnectToLANServer, + [AI_Definition(SCR: "Func_NetGetServerGameParam")] NetGetServerGameParam, + [AI_Definition(SCR: "Func_NetCloseLANServer")] NetCloseLANServer, + [AI_Definition(SCR: "Func_NetGetBandwidth")] NetGetBandwidth, + [AI_Definition(SCR: "Func_NetGetDiscarded")] NetGetDiscarded, + [AI_Definition(SCR: "Func_NetGetSendBandwidth")] NetGetSendBandwidth, + + [AI_Definition(SCR: "Func_ORB_Menu_GetCurrentPage")] ORB_Menu_GetCurrentPage, + [AI_Definition(SCR: "Func_ORB_Menu_GetCurrentWindow")] ORB_Menu_GetCurrentWindow, + [AI_Definition(SCR: "Func_ORB_Menu_GetCurrentOrbit")] ORB_Menu_GetCurrentOrbit, + [AI_Definition(SCR: "Func_ORB_Menu_GetCurrentDisc")] ORB_Menu_GetCurrentDisc, + [AI_Definition(SCR: "Func_ORB_Menu_GetCurrentButtonSet")] ORB_Menu_GetCurrentButtonSet, + [AI_Definition(SCR: "Func_ORB_Menu_GetCurrentButton")] ORB_Menu_GetCurrentButton, + [AI_Definition(SCR: "Func_ORB_Menu_GetFirstWindow")] ORB_Menu_GetFirstWindow, + [AI_Definition(SCR: "Func_ORB_Menu_GetNextWindow")] ORB_Menu_GetNextWindow, + [AI_Definition(SCR: "Func_ORB_Menu_GetPreviousWindow")] ORB_Menu_GetPreviousWindow, + [AI_Definition(SCR: "Func_ORB_Menu_GetLastWindow")] ORB_Menu_GetLastWindow, + [AI_Definition(SCR: "Func_ORB_Menu_GetNumberOfWindows")] ORB_Menu_GetNumberOfWindows, + [AI_Definition(SCR: "Func_ORB_Page_GetName")] ORB_Page_GetName, + [AI_Definition(SCR: "Func_ORB_Window_GetName")] ORB_Window_GetName, + [AI_Definition(SCR: "Func_ORB_Disc_GetName")] ORB_Disc_GetName, + [AI_Definition(SCR: "Func_ORB_Button_GetName")] ORB_Button_GetName, + [AI_Definition(SCR: "Func_ORB_Button_GetDescription")] ORB_Button_GetDescription, + [AI_Definition(SCR: "Func_ORB_Page_GetOrbit")] ORB_Page_GetOrbit, + [AI_Definition(SCR: "Func_ORB_Page_GetBackPage")] ORB_Page_GetBackPage, + [AI_Definition(SCR: "Func_ORB_Page_GetCameraWP")] ORB_Page_GetCameraWP, + [AI_Definition(SCR: "Func_ORB_Page_GetTargetWP")] ORB_Page_GetTargetWP, + [AI_Definition(SCR: "Func_ORB_Page_GetCenterWP")] ORB_Page_GetCenterWP, + [AI_Definition(SCR: "Func_ORB_Page_GetSideWP")] ORB_Page_GetSideWP, + [AI_Definition(SCR: "Func_ORB_Window_GetTopLeftCorner")] ORB_Window_GetTopLeftCorner, + [AI_Definition(SCR: "Func_ORB_Window_GetBottomRightCorner")] ORB_Window_GetBottomRightCorner, + [AI_Definition(SCR: "Func_ORB_Window_GetStatus")] ORB_Window_GetStatus, + [AI_Definition(SCR: "Func_ORB_Orbit_GetFirstDisc")] ORB_Orbit_GetFirstDisc, + [AI_Definition(SCR: "Func_ORB_Orbit_GetLastDisc")] ORB_Orbit_GetLastDisc, + [AI_Definition(SCR: "Func_ORB_Orbit_GetNextDisc")] ORB_Orbit_GetNextDisc, + [AI_Definition(SCR: "Func_ORB_Orbit_GetPreviousDisc")] ORB_Orbit_GetPreviousDisc, + [AI_Definition(SCR: "Func_ORB_Orbit_GetCurrentDisc")] ORB_Orbit_GetCurrentDisc, + [AI_Definition(SCR: "Func_ORB_Orbit_GetNumberOfDiscs")] ORB_Orbit_GetNumberOfDiscs, + [AI_Definition(SCR: "Func_ORB_Disc_GetFirstButtonSet")] ORB_Disc_GetFirstButtonSet, + [AI_Definition(SCR: "Func_ORB_Disc_GetLastButtonSet")] ORB_Disc_GetLastButtonSet, + [AI_Definition(SCR: "Func_ORB_Disc_GetNextButtonSet")] ORB_Disc_GetNextButtonSet, + [AI_Definition(SCR: "Func_ORB_Disc_GetPreviousButtonSet")] ORB_Disc_GetPreviousButtonSet, + [AI_Definition(SCR: "Func_ORB_Disc_GetCurrentButtonSet")] ORB_Disc_GetCurrentButtonSet, + [AI_Definition(SCR: "Func_ORB_Disc_GetNumberOfButtonSets")] ORB_Disc_GetNumberOfButtonSets, + [AI_Definition(SCR: "Func_ORB_ButtonSet_GetFirstButton")] ORB_ButtonSet_GetFirstButton, + [AI_Definition(SCR: "Func_ORB_ButtonSet_GetLastButton")] ORB_ButtonSet_GetLastButton, + [AI_Definition(SCR: "Func_ORB_ButtonSet_GetNextButton")] ORB_ButtonSet_GetNextButton, + [AI_Definition(SCR: "Func_ORB_ButtonSet_GetPreviousButton")] ORB_ButtonSet_GetPreviousButton, + [AI_Definition(SCR: "Func_ORB_ButtonSet_GetCurrentButton")] ORB_ButtonSet_GetCurrentButton, + [AI_Definition(SCR: "Func_ORB_ButtonSet_GetNumberOfButtons")] ORB_ButtonSet_GetNumberOfButtons, + [AI_Definition(SCR: "Func_ORB_ButtonSet_GetStartAngle")] ORB_ButtonSet_GetStartAngle, + [AI_Definition(SCR: "Func_ORB_Button_GetFather")] ORB_Button_GetFather, + [AI_Definition(SCR: "Func_ORB_Button_GetType")] ORB_Button_GetType, + [AI_Definition(SCR: "Func_ORB_Button_GetStatus")] ORB_Button_GetStatus, + [AI_Definition(SCR: "Func_ORB_Button_GetData")] ORB_Button_GetData, + [AI_Definition(SCR: "Func_ORB_Button_GetIconBasePoint")] ORB_Button_GetIconBasePoint, + [AI_Definition(SCR: "Func_ORB_Button_GetStatusFlag")] ORB_Button_GetStatusFlag, + [AI_Definition(SCR: "Func_ORB_Disc_GetSkin")] ORB_Disc_GetSkin, + [AI_Definition(SCR: "Func_ORB_ButtonSet_GetSeparator")] ORB_ButtonSet_GetSeparator, + #endregion + + #region Hype PS2 (SCR from PC demo) + [AI_Definition(SCR: "Func_GetAngleAroundZToPosition")] GetAngleAroundZToPosition, + [AI_Definition(SCR: "Func_CloserWP")] CloserWP, + [AI_Definition(SCR: "Func_DistanceToPosition")] DistanceToPosition, + [AI_Definition(SCR: "Func_AbsoluteInteger")] AbsoluteInteger, + [AI_Definition(SCR: "Func_DepthEnvironment")] DepthEnv, + [AI_Definition(SCR: "Func_AltitudeEnvironment")] AltitudeEnv, + [AI_Definition(SCR: "Func_GetFather")] GetFather, + [AI_Definition(SCR: "Function_Camera_GetCamera")] GetCamera, + [AI_Definition(SCR: "Function_Camera_GetMainCamera")] GetMainCamera, + [AI_Definition(SCR: "Function_Camera_GetDistanceCameraTarget")] GetDistanceCameraTarget, + [AI_Definition(SCR: "Function_Camera_GetTargetCamera")] GetTargetCamera, + [AI_Definition(SCR: "Function_Camera_GetDistMin")] GetDistMinCamera, + [AI_Definition(SCR: "Function_Camera_GetDistMax")] GetDistMaxCamera, + [AI_Definition(SCR: "Function_Camera_GetBoundDistMin")] GetBoundDistMin, + [AI_Definition(SCR: "Function_Camera_GetBoundDistMax")] GetBoundDistMax, + [AI_Definition(SCR: "Function_Camera_GetAlpha")] GetAlphaCamera, + [AI_Definition(SCR: "Function_Camera_GetShiftAlpha")] GetShiftAlphaCamera, + [AI_Definition(SCR: "Function_Camera_GetTeta")] GetTetaCamera, + [AI_Definition(SCR: "Function_Camera_GetShiftTeta")] GetShiftTetaCamera, + [AI_Definition(SCR: "Function_Camera_GetOrientationX")] GetOrientationXCamera, + [AI_Definition(SCR: "Function_Camera_GetOrientationY")] GetOrientationYCamera, + [AI_Definition(SCR: "Function_Camera_GetOrientationZ")] GetOrientationZCamera, + [AI_Definition(SCR: "Function_Camera_GetCamLinearSpeedMin")] GetCamLinearSpeedMin, + [AI_Definition(SCR: "Function_Camera_GetCamLinearSpeedMax")] GetCamLinearSpeedMax, + [AI_Definition(SCR: "Function_Camera_GetCamAngularSpeed")] GetCamAngularSpeed, + [AI_Definition(SCR: "Function_Camera_GetTgtLinearSpeed")] GetTgtLinearSpeed, + [AI_Definition(SCR: "Function_Camera_GetFocal")] GetFocalCamera, + [AI_Definition(SCR: "Function_Camera_GetState")] GetStateCamera, + [AI_Definition(SCR: "Function_Camera_GetFlag")] GetFlagCamera, + [AI_Definition(SCR: "Function_Camera_GetActivation")] GetActivationCamera, + [AI_Definition(SCR: "Function_Camera_GetShiftPerso")] GetShiftPersoCamera, + [AI_Definition(SCR: "Function_Camera_GetShiftVertex")] GetShiftVertexCamera, + [AI_Definition(SCR: "Function_Camera_GetLookVertex")] GetLookVertexCamera, + [AI_Definition(SCR: "Function_Camera_ComputeAlphaAngleCamTgt")] ComputeAlphaAngleCameraTarget, + [AI_Definition(SCR: "Function_Camera_ComputeTetaAngleCamTgt")] ComputeTetaAngleCameraTarget, + [AI_Definition(SCR: "Function_Camera_GetOrientationSpeed")] GetOrientationSpeed, + [AI_Definition(SCR: "Function_Camera_GetOrientationLimitX")] GetOrientationLimitX, + [AI_Definition(SCR: "Function_Camera_GetOrientationLimitY")] GetOrientationLimitY, + [AI_Definition(SCR: "Function_Camera_GetOrientationLimitZ")] GetOrientationLimitZ, + [AI_Definition(SCR: "Function_Camera_ComputeTargetPosition")] ComputeTargetPosition, + [AI_Definition(SCR: "Func_GetNormSpeed")] GetNormSpeed, + [AI_Definition(SCR: "Func_GetAlphaPas")] GetAlphaPas, + [AI_Definition(SCR: "Func_GetThetaPas")] GetThetaPas, + [AI_Definition(SCR: "Func_GetAlpha")] GetAlpha, + [AI_Definition(SCR: "Func_GetTheta")] GetTheta, + [AI_Definition(SCR: "Func_GetEnvironmentToxicity")] GetEnvironmentToxicity, + [AI_Definition(SCR: "Func_GetMechanicalGMTAdhesionCoef")] GetMechanicalGMTAdhesionCoef, + [AI_Definition(SCR: "Func_GetMechanicalGMTAbsorptionCoef")] GetMechanicalGMTAbsorptionCoef, + [AI_Definition(SCR: "Func_GetMechanicalGMTFrictionCoef")] GetMechanicalGMTFrictionCoef, + [AI_Definition(SCR: "Func_GetMechanicalGMTSlideCoef")] GetMechanicalGMTSlideCoef, + [AI_Definition(SCR: "Func_GetMechanicalGMTProgressionCoef")] GetMechanicalGMTProgressionCoef, + [AI_Definition(SCR: "Func_GetMechanicalGMTPenetrationCoef")] GetMechanicalGMTPenetrationCoef, + [AI_Definition(SCR: "Func_GetMechanicalGMTPenetrationMaxCoef")] GetMechanicalGMTPenetrationMaxCoef, + [AI_Definition(SCR: "Func_PersoLePlusProcheAvecAngle")] PersoLePlusProcheAvecAngle, + [AI_Definition(SCR: "Func_ReseauLitCapaciteLiaison")] ReseauLitCapaciteLiaison, + [AI_Definition(SCR: "Func_ReseauChangeCapaciteLiaison")] ReseauChangeCapaciteLiaison, + [AI_Definition(SCR: "Func_NetworkWPCloserOrientation")] NetworkWPCloserOrientation, + [AI_Definition(SCR: "Func_MTH_NormalizeVector")] NormalizeVector, + [AI_Definition(SCR: "Func_GetPlayerName")] GetPlayerName, + [AI_Definition(SCR: "Func_CalculVecteurRebond2")] ComputeRebondVector2, + [AI_Definition(SCR: "Func_GetNormalGroundVector")] GetNormalGroundVector, + [AI_Definition(SCR: "Func_PositionAbsolueCanal")] PositionAbsolueCanal, + [AI_Definition(SCR: "Func_DistancePersoToCanal")] DistancePersoToCanal, + [AI_Definition(SCR: "Func_CollisionRopeSphere")] CollisionRopeSphere, + [AI_Definition(SCR: "TBL_WayPointResearchInTable")] TBL_WayPointResearchInTable, + [AI_Definition(SCR: "TBL_PersoResearchInTable")] TBL_PersoResearchInTable, + [AI_Definition(SCR: "MTH_DotProduct")] MTH_DotProduct, + [AI_Definition(SCR: "GetRopeSpeedVector")] GetRopeSpeedVector, + [AI_Definition(SCR: "ChannelPosition")] GetRopeChannelPosition, + [AI_Definition(SCR: "MTH_RoundRealToInteger")] MTH_RoundRealToInteger, + [AI_Definition(SCR: "Func_GetCurrectAnimFrame")] GetCurrectAnimFrame, + [AI_Definition(SCR: "Func_PersoUnderCursor")] PersoUnderCursor, + [AI_Definition(SCR: "Func_XCoordOfCursor")] XCoordOfCursor, + [AI_Definition(SCR: "Func_YCoordOfCursor")] YCoordOfCursor, + [AI_Definition(SCR: "MTH_Power")] MTH_Puissance, + [AI_Definition(SCR: "MTH_Modulus")] MTH_Modulo, + [AI_Definition(SCR: "RelativeXPositionOfPerso")] RelativeXPositionOfPerso, + [AI_Definition(SCR: "RelativeYPositionOfPerso")] RelativeYPositionOfPerso, + [AI_Definition(SCR: "RelativeZPositionOfPerso")] RelativeZPositionOfPerso, + [AI_Definition(SCR: "RelativePositionOfPerso")] RelativePositionOfPerso, + [AI_Definition(SCR: "Func_DistanceCaracToWP")] DistanceCaracToWP, + [AI_Definition(SCR: "Func_GetGameState")] GetGameState, + [AI_Definition(SCR: "Func_Inv_AddObject")] Inv_AjouterObjet, + [AI_Definition(SCR: "Func_Inv_RemoveObject")] Inv_EnleverObjet, + [AI_Definition(SCR: "Func_Inv_GetGold")] Inv_LireOr, + [AI_Definition(SCR: "Func_Inv_AddGold")] Inv_AjouterOr, + [AI_Definition(SCR: "Func_Inv_SubGold")] Inv_EnleverOr, + [AI_Definition(SCR: "Func_Inv_GetWeapon")] Inv_LireArme, + [AI_Definition(SCR: "Func_Inv_ChangeWeapon")] Inv_ChangerArme, + [AI_Definition(SCR: "Func_Inv_GetMagic")] Inv_LireMagie, + [AI_Definition(SCR: "Func_Inv_ChangeMagic")] Inv_ChangerMagie, + [AI_Definition(SCR: "Func_Inv_GetObject")] Inv_LireObjet, + [AI_Definition(SCR: "Func_Inv_SelectObject")] Inv_SelectionnerObjet, + [AI_Definition(SCR: "Func_Inv_UseItem")] Inv_UtiliserItem, + [AI_Definition(SCR: "Func_Inv_GetObjectQuantity")] Inv_LireQuantiteObjet, + [AI_Definition(SCR: "Func_Inv_RemoveObjectQuantity")] Inv_EnleverQuantiteObjet, + [AI_Definition(SCR: "Func_Inv_GetObjectMaximumCapacity")] Inv_LireCapaciteMaximumObjet, + [AI_Definition(SCR: "Proc_GetLaserPointerDirection")] GetLaserPointerDirection, + [AI_Definition(SCR: "Proc_GetLaserPointerDistance")] GetLaserPointerDistance, + GetLaserPointerDistaneToStaticMap, + [AI_Definition(SCR: "Func_SpeedChannel")] SpeedChannel, + [AI_Definition(SCR: "Func_ExecuteFloorGame")] ExecuteFloorGame, + [AI_Definition(SCR: "Func_GPI_DifferentFromCurrentImage")] DifferentFromCurrentImage, + [AI_Definition(SCR: "Func_GPI_IsDrawn")] IsDrawn, + [AI_Definition(SCR: "Func_DLG_PersoTalks")] DLG_PersoParle, + [AI_Definition(SCR: "WP_IndexCloserWP")] WP_IndexOfClosestWPinArray, + [AI_Definition(SCR: "ReduceIndexOfVectorArray")] eReduceIndexOfVectorArray, + [AI_Definition(SCR: "Func_TBL_InitArray")] TBL_InitArray, + [AI_Definition(SCR: "SND_GetMicroPerso")] SND_GetMicroPerso, + SND_GetMicroOrientationPerso, + [AI_Definition(SCR: "Fight_RemoveHitPointsMainActorWithArmor")] FightRemoveHitPointsMainActorWithArmor, + [AI_Definition(SCR: "Fight_RemoveAndReadHitPointsEnemy")] FightRemoveAndReadHitPointsEnemy, + [AI_Definition(SCR: "Fight_ReadArmorResistance")] FightReadArmorResistance, + [AI_Definition(SCR: "Fight_ReadNumberOfArmors")] FightGetNumberOfArmors, + [AI_Definition(SCR: "Magic_ReadMagicPoints")] Magic_ReadMagicPoints, + [AI_Definition(SCR: "Magic_AddMagicPoints")] Magic_AddMagicPoints, + [AI_Definition(SCR: "Magic_RemoveMagicPoints")] Magic_RemoveMagicPoints, + [AI_Definition(SCR: "Magic_ReadMagicPointsMax")] Magic_ReadMagicPointsMax, + [AI_Definition(SCR: "Magic_ReadCurrentSpell")] Magic_ReadCurrentSpell, + [AI_Definition(SCR: "Dragon_ReadNbrDiamonds")] Dragon_ReadNbrDiamonds, + [AI_Definition(SCR: "Dragon_AddDiamonds")] Dragon_AddDiamonds, + [AI_Definition(SCR: "Dragon_RemoveDiamonds")] Dragon_RemoveDiamonds, + [AI_Definition(SCR: "Dragon_ReadNbrDiamondsMax")] Dragon_ReadNbrDiamondsMax, + [AI_Definition(SCR: "POS_GetChannelPosition")] POS_GetChannelPosition, + [AI_Definition(SCR: "Func_SendSoundRequest")] SendSoundRequest, + [AI_Definition(SCR: "Func_SendVoiceRequest")] SendVoiceRequest, + [AI_Definition(SCR: "Func_SendMusicRequest")] SendMusicRequest, + [AI_Definition(SCR: "GiveMeTheGround")] GiveMeTheGround, + #endregion + + #region Tonic Trouble SE + [AI_Definition(SCR: "Func_GetCurrentObjectInInventory")] GetCurrentObjectInInventory, + [AI_Definition(SCR: "Func_GetObjectNumberInInventory")] GetObjectNumberInInventory, + [AI_Definition(SCR: "Func_UseObjectFromInventory")] UseObjectFromInventory, + [AI_Definition(SCR: "Func_UseNObjectsFromInventory")] UseNObjectsFromInventory, + #endregion + + #region R2 PC & iOS (Custom names) & demos + [AI_Definition(SCR: "Func_NewGame", EN: "GAME_NewGame", FR: "NouvellePartie")] NewGame, + [AI_Definition(SCR: "Func_ReadCharAtKeyPosition")] ReadCharAtKeyPosition, // R2 deoo + #endregion + + #region Revolution & Largo + Placeholder__GetRevolutionStdGamePlusC, // Returns ((byte)(StdGame + 0xC) & 0x7F + Placeholder__R2PS2__SaveGame_0__UInt, + Placeholder__R2PS2__SaveGame_0b__UInt__LargoOnly, + Placeholder__R2PS2__SaveGame_1__UInt, + Placeholder__R2PS2__SaveGame_2__1P__String, + Placeholder__R2PS2__SaveGame_3__1P__UInt__NotInLargo, + Placeholder__R2PS2__SaveGame_4__1P__String, + Placeholder__R2PS2__SaveGame_5__UInt, + Placeholder__R2PS2__SaveGame_6__String, + Placeholder__R2PS2__SaveGame_7__UInt__NotInLargo, + Placeholder__R2PS2__SaveGame_8__String, + Placeholder__R2PS2__SaveGame_9__UInt, + Placeholder__R2PS2__SaveGame_9b__LargoOnly__Dummy, + Placeholder__R2PS2__SaveGame_9c__LargoOnly__Dummy, + Placeholder__R2PS2__SaveGame_9d__LargoOnly__Dummy, + Placeholder__R2PS2__SaveGame_10__UInt, + Placeholder__R2PS2__SaveGame_11__1P__UInt, + Placeholder__R2PS2__SaveGame_12__UInt, + Placeholder__R2PS2__SaveGame_13__UInt, + Placeholder__R2PS2__SaveGame_14__1P__UInt, + Placeholder__R2PS2__SaveGame_15__1P__UInt, + Placeholder__R2PS2__SaveGame_16__1P__UInt__LargoOnly, + Largo__GetFreeSpaceInKB, + Placeholder__R2PS2__SaveGame_18__1P__UInt__LargoOnly, + + CurrentNetworkGetTypeOfWP, // Largo only: Same as NetworkGetTypeOfWP, but without the first argument. Uses current perso (or ultra)'s current graph in MSWay instead + CurrentNetworkGetRadiusWP, // Largo only: Same as GetRadiusWP, but without the first argument. Uses current perso (or ultra)'s current graph in MSWay instead + + // TODO: What are these? + [AI_Definition(SCR: "Func_PAD2_GetPadGlobalVector_2")] PAD2_GetGlobalVector_2, + [AI_Definition(SCR: "Func_PAD2_GetPadHorizontalAxis_2")] PAD2_GetHorizontalAxis_2, + [AI_Definition(SCR: "Func_PAD2_GetPadVerticalAxis_2")] PAD2_GetVerticalAxis_2, + [AI_Definition(SCR: "Func_PAD2_GetPadAnalogForce_2")] PAD2_GetAnalogForce_2, + [AI_Definition(SCR: "Func_PAD2_GetPadTrueAnalogForce_2")] PAD2_GetTrueAnalogForce_2, + [AI_Definition(SCR: "Func_PAD2_GetPadRotationAngle_2")] PAD2_GetRotationAngle_2, + [AI_Definition(SCR: "Func_PAD2_GetPadSector_2")] PAD2_GetPadSector_2, + Placeholder__R2PS2__AfterGetButtonName_DummyFunction, + [AI_Definition(SCR: "Func_GetVoicesVolume", EN: "OPTION_GetVoicesVolume", FR: "Option_GetVolumeVoices")] GetVoicesVolume, + Placeholder__R2PS2__CheckPersoStdGamePlusC4_1__Float, + Placeholder__R2PS2__CheckPersoStdGamePlusC4_2__Float, + Placeholder__R2PS2__LargoOnly__AfterR2Placeholders_1__Vector, + Placeholder__R2PS2__LargoOnly__AfterR2Placeholders_2__UInt, + ModuloInt, // Largo only + Power, // Largo only + Factorial, // Largo only + + Placeholder__Largo__GameFunction__1, + Placeholder__Largo__GameFunction__2, + Placeholder__Largo__GameFunction__3, + Placeholder__Largo__GameFunction__4, + Placeholder__Largo__GameFunction__5, + Placeholder__Largo__GameFunction__6, + Placeholder__Largo__GameFunction__7, + Placeholder__Largo__GameFunction__8, + Placeholder__Largo__GameFunction__9, + Placeholder__Largo__GameFunction__10, + Placeholder__Largo__GameFunction__11, + Placeholder__Largo__GameFunction__12, + Placeholder__Largo__GameFunction__13, + Placeholder__Largo__GameFunction__14, + Placeholder__Largo__GameFunction__15, + Placeholder__Largo__GameFunction__16, + Placeholder__Largo__GameFunction__17, + Placeholder__Largo__GameFunction__18, + Placeholder__Largo__GameFunction__19, + Placeholder__Largo__GameFunction__20, + Placeholder__Largo__GameFunction__21, + Placeholder__Largo__GameFunction__22, + Placeholder__Largo__GameFunction__23, + Placeholder__Largo__GameFunction__24, + Placeholder__Largo__GameFunction__25, + Placeholder__Largo__GameFunction__26, + NetworkBuildComplexPath, + NetworkShortestPathRadius1, + NetworkShortestPathRadius2, + GetCurrentNetwork, + ReseauLitCapaciteLiaisonDansGraphCourant, // Same without graph parameter. Uses current network + ReseauChangeCapaciteLiaisonDansGraphCourant, // Same without graph parameter. Uses current network + ReseauLitPoidsLiaisonDansGraphCourant, // Same without graph parameter. Uses current network + ReseauChangePoidsLiaisonDansGraphCourant, // Same without graph parameter. Uses current network + CurrentNetworkGetNbOfArcsForWP, // Gets MSWay.Graph, finds WP in it, gets number of arcs defined for that graph node + CurrentNetworkGetWPAtArcIndexForWP, // Gets MSWay.Graph, finds WP in it, gets arc index i, gets WP for that graph node + #endregion + + #region R2 iOS & DC + CheckVmsStatus, // Get Visual Memory System status code. -1: Not connected, -3: Not enough room, 1: OK + SetActiveVms, + GetActiveVms, + SaveOptions, // Saves current game options + LoadOptions, + GetHighScoreDisc, + DC_MagicBox, // Is PS2_MagicBox is anything to go by this is a terrible function that does completely different things depending on the arguments + #endregion + + #region R3 GC + Placeholder__R3GetGCOnly, + Placeholder__R3GCOnly__LastFuncs_1, + Placeholder__R3GCOnly__LastFuncs_2, + Placeholder__R3GCOnly__LastFuncs_3, + Placeholder__R3GCOnly__LastFuncs_4, + Placeholder__R3GCOnly__LastFuncs_5, + Placeholder__R3GCOnly__LastFuncs_6, + Placeholder__R3GCOnly__LastFuncs_7, + Placeholder__R3GCOnly__LastFuncs_8, + Placeholder__R3GCOnly__LastFuncs_9, + Placeholder__R3GCOnly__LastFuncs_10, + Placeholder__R3GCOnly__LastFuncs_11, + Placeholder__R3GCOnly__LastFuncs_12, + Placeholder__R3GCOnly__LastFuncs_13, + Placeholder__R3GCOnly__LastFuncs_14, + Placeholder__R3GCOnly__LastFuncs_15, + Placeholder__R3GCOnly__LastFuncs_16, + Placeholder__R3GCOnly__LastFuncs_17, + Placeholder__R3GCOnly__LastFuncs_18, + Placeholder__R3GCOnly__LastFuncs_19, + Placeholder__R3GCOnly__LastFuncs_20, + Placeholder__R3GCOnly__LastFuncs_21, + Placeholder__R3GCOnly__LastFuncs_22, + Placeholder__R3GCOnly__LastFuncs_23, + Placeholder__R3GCOnly__LastFuncs_24, + Placeholder__R3GCOnly__LastFuncs_25, + Placeholder__R3GCOnly__LastFuncs_26, + Placeholder__R3GCOnly__LastFuncs_27, + Placeholder__R3GCOnly__LastFuncs_28, + Placeholder__R3GCOnly__LastFuncs_29, + Placeholder__R3GCOnly__LastFuncs_30, + Placeholder__R3GCOnly__LastFuncs_31, + Placeholder__R3GCOnly__LastFuncs_32, + Placeholder__R3GCOnly__LastFuncs_33, + Placeholder__R3GCOnly__LastFuncs_34, + Placeholder__R3GCOnly__LastFuncs_35, + Placeholder__R3GCOnly__LastFuncs_36, + #endregion + } +} \ No newline at end of file diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/AI/Enums/Definitions/AI_Function.cs.meta b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/AI/Enums/Definitions/AI_Function.cs.meta new file mode 100644 index 00000000..a3c713de --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/AI/Enums/Definitions/AI_Function.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 13a691c360368874c8ce4cffdb06020f +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/AI/Enums/Definitions/AI_InterpretType.cs b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/AI/Enums/Definitions/AI_InterpretType.cs new file mode 100644 index 00000000..08fe69e5 --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/AI/Enums/Definitions/AI_InterpretType.cs @@ -0,0 +1,67 @@ +namespace BinarySerializer.Ubisoft.CPA { + public enum AI_InterpretType { + Unknown, + KeyWord, + Condition, + Operator, + Function, + Procedure, + MetaAction, + BeginMacro, + EndMacro, + Field, + DsgVarRef, + Constant, + Real, + Button, + ConstantVector, + Vector, + Mask, + ModuleRef, + DsgVarId, + String, + LipsSynchroRef, + FamilyRef, + PersoRef, + ActionRef, + SuperObjectRef, + WayPointRef, + TextRef, + ComportRef, + SoundEventRef, + ObjectTableRef, + GameMaterialRef, + ParticleGenerator, + VisualMaterialRef, + ModelRef, + CustomBits, + Caps, + MacroRef__Subroutine, + Null, + GraphRef, + // Types below here added for engineversions < R2 + //ConstantRef, + //RealRef, + SurfaceRef, + Way, + DsgVar, + SectorRef, + EnvironmentRef, + FontRef, + Color, + Module, // Different from ModuleRef + //LightInfoRef, + + // R3: + EndTree, + SOLinksRef, + Light, + Graph, + CineRef, + + // Revo: + Placeholder__R2PS2__Type2E, + Placeholder__Largo__Type2F, + Placeholder__Largo__Type30, + }; +} diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/AI/Enums/Definitions/AI_InterpretType.cs.meta b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/AI/Enums/Definitions/AI_InterpretType.cs.meta new file mode 100644 index 00000000..a081211b --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/AI/Enums/Definitions/AI_InterpretType.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 7a248f18b53731b48acd128963be9858 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/AI/Enums/Definitions/AI_Keyword.cs b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/AI/Enums/Definitions/AI_Keyword.cs new file mode 100644 index 00000000..de59b0b5 --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/AI/Enums/Definitions/AI_Keyword.cs @@ -0,0 +1,79 @@ +namespace BinarySerializer.Ubisoft.CPA { + // Find: (NU_)?M_DEFINE_[^ \t\(]*[ \t]*\([ \t]*e[^_]*_([^ \t,]*)[ \t]*,[ \t]*([^ \t,]*)[ \t]*,([ \t]*([^ \t,]*)[ \t]*,)?[ \t]*([^ \t,]*)[ \t]*,[ \t]*fn_.* + // Replace: \[Definition\(SCR: \6, EN: \5, FR: \3\)] \2, + public enum AI_Keyword { + #region DefKey + [AI_Definition(SCR: "If", EN: "If", FR: "Si")] If, + [AI_Definition(SCR: "IfNot", EN: "IfNot", FR: "SiPas")] IfNot, + [AI_Definition(SCR: "If2", EN: "If2", FR: "Si2")] If2, + [AI_Definition(SCR: "If4", EN: "If4", FR: "Si4")] If4, + [AI_Definition(SCR: "If8", EN: "If8", FR: "Si8")] If8, + [AI_Definition(SCR: "If16", EN: "If16", FR: "Si16")] If16, + [AI_Definition(SCR: "IfDebug", EN: "IfDebug", FR: "SiDebug")] IfDebug, + [AI_Definition(SCR: "IfNotU64", EN: "IfNotU64", FR: "SiPasU64")] IfNotU64, + [AI_Definition(SCR: "Then", EN: "Then", FR: "Alors")] Then, + [AI_Definition(SCR: "Else", EN: "Else", FR: "Sinon")] Else, + //******************************************************************************************************************************************************************************************************************************************************** + [AI_Definition(SCR: "_EngineGoto", EN: "_EngineGoto", FR: "_EngineGoto")] EngineGoto, + //******************************************************************************************************************************************************************************************************************************************************** + [AI_Definition(SCR: "Me", EN: "Me", FR: "Moi")] Me, + [AI_Definition(SCR: "MainActor", EN: "MainActor", FR: "ActeurPrincipal")] MainActor, + [AI_Definition(SCR: "World", FR: "Monde")] World, + [AI_Definition(SCR: "Nobody", EN: "Nobody", FR: "Personne")] Nobody, + [AI_Definition(SCR: "NoSuperObject", EN: "NoSuperObject", FR: "SansSuperObjet")] NoSuperObject, + + [AI_Definition(SCR: "Nowhere", EN: "Nowhere", FR: "Nullepart")] Nowhere, + [AI_Definition(SCR: "EmptyText", EN: "EmptyText", FR: "TexteVide")] EmptyText, + + [AI_Definition(SCR: "CapaNull", EN: "CapaNull", FR: "CapaZero")] CapsNull, + [AI_Definition(SCR: "NoGraph", EN: "NoGraph", FR: "SansGraph")] NoGraph, + + [AI_Definition(SCR: "NoAction", EN: "NoAction", FR: "SansAction")] NoAction, + + // Editor + [AI_Definition(SCR: "NoComport", EN: "NoComport", FR: "SansComportement")] NoComport, + [AI_Definition(SCR: "Schedule", EN: "Schedule", FR: "EmploiTemps")] Schedule, + [AI_Definition(SCR: "InterruptRule", EN: "InterruptRule", FR: "RegleInterruption")] InterruptRule, + [AI_Definition(SCR: "Vector", EN: "Vector", FR: "Vecteur")] Vector, + [AI_Definition(SCR: "ConstantVector", EN: "ConstantVector", FR: "VecteurConstant")] ConstVector, + [AI_Definition(SCR: "Endif", EN: "Endif", FR: "FinSi")] Endif, + [AI_Definition(SCR: "Macro", EN: "Macro", FR: "Macro")] Macro, + [AI_Definition(SCR: "True", EN: "True", FR: "Vrai")] True, + [AI_Definition(SCR: "False", EN: "False", FR: "Faux")] False, + [AI_Definition(SCR: "StopEngine", EN: "StopEngine", FR: "BloquantMoteur")] StopEngine, + [AI_Definition(SCR: "StopRule", EN: "StopRule", FR: "BloquantRegle")] StopRule, + [AI_Definition(SCR: "NonStop", EN: "NonStop", FR: "NonBloquant")] NonStop, + #endregion + + #region R3 PS2 (No definitions) + [AI_Definition(SCR: "If32", EN: "If32", FR: "Si32")] If32, + [AI_Definition(SCR: "If64", EN: "If64", FR: "Si64")] If64, + [AI_Definition(SCR: "IfNot2", EN: "IfNot2", FR: "SiPas2")] IfNot2, + [AI_Definition(SCR: "IfNot4", EN: "IfNot4", FR: "SiPas4")] IfNot4, + [AI_Definition(SCR: "IfNot8", EN: "IfNot8", FR: "SiPas8")] IfNot8, + [AI_Definition(SCR: "IfNot16", EN: "IfNot16", FR: "SiPas16")] IfNot16, + [AI_Definition(SCR: "IfNot32", EN: "IfNot32", FR: "SiPas32")] IfNot32, + [AI_Definition(SCR: "IfNot64", EN: "IfNot64", FR: "SiPas64")] IfNot64, + + NoInput, + NoSoundEvent, + NoLight, + + NoSOL, + + NoGameMaterial, + NoVisualMaterial, + While, + BeginWhile, + EndWhile, + #endregion + + #region Hype PS2 + Noway, + #endregion + + #region R2 PS2 + NoModule, + #endregion + } +} \ No newline at end of file diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/AI/Enums/Definitions/AI_Keyword.cs.meta b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/AI/Enums/Definitions/AI_Keyword.cs.meta new file mode 100644 index 00000000..bfe846fa --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/AI/Enums/Definitions/AI_Keyword.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 835f2e9558ce98445a3d083fef522fa3 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/AI/Enums/Definitions/AI_MetaAction.cs b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/AI/Enums/Definitions/AI_MetaAction.cs new file mode 100644 index 00000000..f97d95b0 --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/AI/Enums/Definitions/AI_MetaAction.cs @@ -0,0 +1,100 @@ +namespace BinarySerializer.Ubisoft.CPA { + // Find: (NU_)?M_DEFINE_[^ \t\(]*[ \t]*\([ \t]*e[^_]*_([^ \t,]*)[ \t]*,[ \t]*([^ \t,]*)[ \t]*,([ \t]*([^ \t,]*)[ \t]*,)?[ \t]*([^ \t,]*)[ \t]*,[ \t]*fn_.* + // Replace: \[Definition\(SCR: \6, EN: \5, FR: \3\)] \2, + public enum AI_MetaAction { + Placeholder, + + #region DefAct + [AI_Definition(SCR: "Action_FrozenWait", EN: "TIME_FrozenWait", FR: "Temps_AttenteFigee")] FrozenWait, + [AI_Definition(SCR: "Action_ExecuteAction", EN: "ACTION_ExecuteAction", FR: "ExecuteAction")] ExecuteAction, + [AI_Definition(SCR: "Action_WaitEndOfAction", EN: "ACTION_WaitEndOfAction", FR: "AttendFinAction")] WaitEndOfAction, + [AI_Definition(SCR: "Action_WaitEndOfAnim", EN: "ACTION_WaitEndOfAnim", FR: "AttendFinAnim")] WaitEndOfAnim, + + [AI_Definition(SCR: "Action_SpeakAndWaitEnd", EN: "ACTION_SpeakAndWaitEnd", FR: "ParleEtAttendLaFin")] SpeakAndWaitEnd, + #endregion + + #region DefActCa + [AI_Definition(SCR: "Action_CAM_CineMoveAToBTgtC", EN: "CAM_CineMoveAToBTgtC", FR: "CAM_CineMoveAToBTgtC")] CamCineMoveAToBTgtC, + [AI_Definition(SCR: "Action_CAM_CineMoveAToBTgtAC", EN: "CAM_CineMoveAToBTgtAC", FR: "CAM_CineMoveAToBTgtAC")] CamCineMoveAToBTgtAC, + [AI_Definition(SCR: "Action_CAM_CinePosATgtB", EN: "CAM_CinePosATgtB", FR: "CAM_CinePosATgtB")] CamCinePosATgtB, + [AI_Definition(SCR: "Action_CAM_CinePosAMoveTgtBToC", EN: "CAM_CinePosAMoveTgtBToC", FR: "CAM_CinePosAMoveTgtBToC")] CamCinePosAMoveTgtBToC, + + [AI_Definition(SCR: "Action_CAM_CinePosATgtBTurnPosH", EN: "CAM_CinePosATgtBTurnPosH", FR: "CAM_CinePosATgtBTurnPosH")] CamCinePosATgtBTurnPosH, + [AI_Definition(SCR: "Action_CAM_CinePosATgtBTurnTgtH", EN: "CAM_CinePosATgtBTurnTgtH", FR: "CAM_CinePosATgtBTurnTgtH")] CamCinePosATgtBTurnTgtH, + [AI_Definition(SCR: "Action_CAM_CinePosATgtBTurnPosV", EN: "CAM_CinePosATgtBTurnPosV", FR: "CAM_CinePosATgtBTurnPosV")] CamCinePosATgtBTurnPosV, + [AI_Definition(SCR: "Action_CAM_CinePosATgtBTurnTgtV", EN: "CAM_CinePosATgtBTurnTgtV", FR: "CAM_CinePosATgtBTurnTgtV")] CamCinePosATgtBTurnTgtV, + #endregion + + #region R3 PS2 + [AI_Definition(SCR: "Action_ExecuteActionSmooth", EN: "ACTION_ExecuteActionSmooth", FR: "ExecuteActionSmooth")] ExecuteActionSmooth, + #endregion + + #region Hype PS2 (SCR definitions from TT SE) + [AI_Definition(SCR: "Action_IncrementalTurn2")] IncrementalTurn2, + [AI_Definition(SCR: "Action_IncrementalTurn")] IncrementalTurn, + [AI_Definition(SCR: "Action_Pursuit")] Pursuit, + [AI_Definition(SCR: "Action_DeltaPursuit")] DeltaPursuit, + [AI_Definition(SCR: "Action_ExecuteActionPerso")] ExecuteActionPerso, + [AI_Definition(SCR: "Action_WaitEndOfActionPerso")] WaitEndOfActionPerso, + [AI_Definition(SCR: "Action_WaitEndOfAnimPerso")] WaitEndOfAnimPerso, + [AI_Definition(SCR: "Action_LSY_SpeakPersoAndWaitEnd")] LSY_SpeakPersoAndWaitEnd, + [AI_Definition(SCR: "Action_ExecuteActionAndTakeObject")] ExecuteActionAndTakeObject, + [AI_Definition(SCR: "Action_ExecuteActionAndPutObject")] ExecuteActionAndPutObject, + [AI_Definition(SCR: "Action_ExecuteActionAndLaunchObject")] ExecuteActionAndLaunchObject, + [AI_Definition(SCR: "Action_ExecuteActionAndGenerateObject")] ExecuteActionAndGenerateObject, + [AI_Definition(SCR: "Action_AdjustPersoOnObjectAxes")] AdjustPersoOnObjectAxes, + [AI_Definition(SCR: "Action_AdjustPersoOnObject")] AdjustPersoOnObject, + [AI_Definition(SCR: "Action_RunAway")] RunAway, + [AI_Definition(SCR: "Action_IncrementalTurnPosition")] IncrementalTurnPosition, + [AI_Definition(SCR: "Action_IncrementalDeltaTurnPerso2")] IncrementalDeltaTurnPerso2, + [AI_Definition(SCR: "Action_IncrementalTurnPerso2")] IncrementalTurnPerso2, + [AI_Definition(SCR: "Action_IncrementalDeltaTurnPerso")] IncrementalDeltaTurnPerso, + [AI_Definition(SCR: "Action_IncrementalTurnPerso")] IncrementalTurnPerso, + [AI_Definition(SCR: "Action_RunAwayWP")] RunAwayWP, + [AI_Definition(SCR: "Action_GoToWP")] GoToWP, + [AI_Definition(SCR: "Action_GoToWPXY")] GoToWPXY, + [AI_Definition(SCR: "Action_GoOverWay")] GoOverWay, + [AI_Definition(SCR: "Action_GoOverWay3D")] GoOverWay3D, + [AI_Definition(SCR: "Action_GoOverWayBack")] GoOverWayBack, + [AI_Definition(SCR: "Action_GoToNextWPOfWay")] GoToNextWPOfWay, + [AI_Definition(SCR: "Action_GoToNextWPOfWayBack")] GoToNextWPOfWayBack, + [AI_Definition(SCR: "Action_GoToPosition")] GoToPosition, + [AI_Definition(SCR: "Action_GoToPositionXY")] GoToPositionXY, + [AI_Definition(SCR: "Action_GoOverShortestPath")] GoOverShortestPath, + [AI_Definition(SCR: "Action_GoOverShortestPathBezier")] GoOverShortestPathBezier, + [AI_Definition(SCR: "Action_MoveLift")] MoveLift, + [AI_Definition(SCR: "Action_Wait")] Wait, + [AI_Definition(SCR: "Action_WaitBoolean")] WaitBoolean, + [AI_Definition(SCR: "Action_WaitNextTime")] WaitNextTime, + [AI_Definition(SCR: "Action_WaitInteger")] WaitInteger, + [AI_Definition(SCR: "Action_WaitReal")] WaitReal, + [AI_Definition(SCR: "Action_IncrementalTurnPositionW")] IncrementalTurnPositionW, + [AI_Definition(SCR: "Action_IncrementalTurnPositionWPerso")] IncrementalTurnPositionWPerso, + [AI_Definition(SCR: "Action_IncrementalTurnPersoW")] IncrementalTurnPersoW, + [AI_Definition(SCR: "Action_IncrementalTurnPersoWPerso")] IncrementalTurnPersoWPerso, + [AI_Definition(SCR: "Action_IncrementalTurnPersoWPersoW")] IncrementalTurnPersoWPersoW, + [AI_Definition(SCR: "Action_IncrementalTurnPersoWPersoWPerso")] IncrementalTurnPersoWPersoWPerso, + [AI_Definition(SCR: "Action_Camera_GoToPosition")] Camera_GoToPosition, + [AI_Definition(SCR: "Action_Camera_GoToWP")] Camera_GoToWP, + [AI_Definition(SCR: "Action_Camera_GoOverWay")] Camera_GoOverWay, + [AI_Definition(SCR: "Action_Camera_GoOverWayBack")] Camera_GoOverWayBack, + [AI_Definition(SCR: "Action_Camera_GoToNextWPOfWay")] Camera_GoToNextWPOfWay, + [AI_Definition(SCR: "Action_Camera_GoToNextWPOfWayBack")] Camera_GoToNextWPOfWayBack, + [AI_Definition(SCR: "Action_Camera_StayInWay")] Camera_StayInWay, + [AI_Definition(SCR: "Action_Camera_GoToFromTarget")] Camera_GoToFromTarget, + [AI_Definition(SCR: "Action_Camera_Shake")] Camera_Shake, + [AI_Definition(SCR: "Action_Camera_WaitUntil")] Camera_WaitUntil, + [AI_Definition(SCR: "Action_RotateModule")] RotateModule, + [AI_Definition(SCR: "Action_RotateModuleToPerso")] RotateModuleToPerso, + [AI_Definition(SCR: "Action_SwimToSurface")] SwimToSurface, + [AI_Definition(SCR: "Action_WaitEndOfFade")] WaitEndOfFade, + [AI_Definition(SCR: "Action_SendSoundRequestAndWait")] SendSoundRequestAndWait, + [AI_Definition(SCR: "Action_SendVoiceRequestAndWait")] SendVoiceRequestAndWait, + [AI_Definition(SCR: "Action_SendVoiceRequestPersoAndWait")] SendVoiceRequestPersoAndWait, + [AI_Definition(SCR: "Action_GoToPosition2")] GoToPosition2, + [AI_Definition(SCR: "Action_IncrementalTurnAbsDirection")] IncrementalTurnAbsDirection, + [AI_Definition(SCR: "Action_IncTurnPersoAbsDirection")] IncTurnPersoAbsDirection, + [AI_Definition(SCR: "Action_WaitNbFrames")] WaitNbFrames, + #endregion + } +} \ No newline at end of file diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/AI/Enums/Definitions/AI_MetaAction.cs.meta b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/AI/Enums/Definitions/AI_MetaAction.cs.meta new file mode 100644 index 00000000..a5f76aa4 --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/AI/Enums/Definitions/AI_MetaAction.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 0319addef8b8a6248af4db91d9e57697 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/AI/Enums/Definitions/AI_Operator.cs b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/AI/Enums/Definitions/AI_Operator.cs new file mode 100644 index 00000000..bd6f53ee --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/AI/Enums/Definitions/AI_Operator.cs @@ -0,0 +1,64 @@ +namespace BinarySerializer.Ubisoft.CPA { + // Find: (NU_)?M_DEFINE_[^ \t\(]*[ \t]*\([ \t]*e[^_]*_([^ \t,]*)[ \t]*,[ \t]*([^ \t,]*)[ \t]*,[ \t]*([^ \t,]*)[ \t]*,[ \t]*fn_.* + // Replace: \[Definition\(SCR: \4, ED: \3\)] \2, + public enum AI_Operator { + #region DefOper + //******************************************************************************************************************************************************************************************************************************************************** + // Math operator + [AI_Definition(SCR: "Operator_Plus", ED: "+")] ScalarPlusScalar, + [AI_Definition(SCR: "Operator_Minus", ED: "-")] ScalarMinusScalar, + [AI_Definition(SCR: "Operator_Mul", ED: "*")] ScalarMulScalar, + [AI_Definition(SCR: "Operator_Div", ED: "/")] ScalarDivScalar, + [AI_Definition(SCR: "Operator_UnaryMinus", ED: "_")] ScalarUnaryMinus, + //******************************************************************************************************************************************************************************************************************************************************** + // Affect operator + [AI_Definition(SCR: "Operator_PlusAffect", ED: "+=")] PlusAffect, + [AI_Definition(SCR: "Operator_MinusAffect", ED: "-=")] MinusAffect, + [AI_Definition(SCR: "Operator_MulAffect", ED: "*=")] MulAffect, + [AI_Definition(SCR: "Operator_DivAffect", ED: "/=")] DivAffect, + [AI_Definition(SCR: "Operator_PlusPlusAffect", ED: "++")] PlusPlusAffect, + [AI_Definition(SCR: "Operator_MinusMinusAffect", ED: "--")] MinusMinusAffect, + [AI_Definition(SCR: "Operator_Affect", ED: ":=")] Affect, + //******************************************************************************************************************************************************************************************************************************************************** + // Dot operator + [AI_Definition(SCR: "Operator_Dot", ED: ".")] Dot, + //******************************************************************************************************************************************************************************************************************************************************** + // Vector Dot operator + [AI_Definition(SCR: ".X", ED: ".X")] GetVectorX, + [AI_Definition(SCR: ".Y", ED: ".Y")] GetVectorY, + [AI_Definition(SCR: ".Z", ED: ".Z")] GetVectorZ, + //******************************************************************************************************************************************************************************************************************************************************** + // Vector operator + [AI_Definition(SCR: "Operator_VectorPlusVector", ED: "v+")] VectorPlusVector, + [AI_Definition(SCR: "Operator_VectorMinusVector", ED: "v-")] VectorMinusVector, + [AI_Definition(SCR: "Operator_VectorMulScalar", ED: "v*")] VectorMulScalar, + [AI_Definition(SCR: "Operator_VectorDivScalar", ED: "v/")] VectorDivScalar, + [AI_Definition(SCR: "Operator_VectorUnaryMinus", ED: "v_")] VectorUnaryMinus, + //******************************************************************************************************************************************************************************************************************************************************** + // Vector Affect operator + [AI_Definition(SCR: ".X:=", ED: ".X:=")] SetVectorX, + [AI_Definition(SCR: ".Y:=", ED: ".Y:=")] SetVectorY, + [AI_Definition(SCR: ".Z:=", ED: ".Z:=")] SetVectorZ, + //******************************************************************************************************************************************************************************************************************************************************** + // Ultra Operator + [AI_Definition(SCR: "Operator_Ultra", ED: "..")] Ultra, + //******************************************************************************************************************************************************************************************************************************************************** + // Model Cast Operator + [AI_Definition(SCR: "Operator_ModelCast", ED: "@")] ModelCast, + //******************************************************************************************************************************************************************************************************************************************************** + // Array Operator + [AI_Definition(SCR: "Operator_Array", ED: "[")] Array, + //******************************************************************************************************************************************************************************************************************************************************** + // Affect Array Operator + [AI_Definition(SCR: "Operator_AffectArray", ED: ":={")] AffectArray, + #endregion + + #region R3 PS2 + [AI_Definition(SCR: "Operator_Modulo", ED: "%")] ScalarModulo, + #endregion + + #region R2 iOS (Custiom names and SCR) + [AI_Definition(SCR: "Operator_DivAllowZero", ED: "_/")] ScalarDivScalarAllowZero, // Allow division by zero? + #endregion + } +} \ No newline at end of file diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/AI/Enums/Definitions/AI_Operator.cs.meta b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/AI/Enums/Definitions/AI_Operator.cs.meta new file mode 100644 index 00000000..50e5b468 --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/AI/Enums/Definitions/AI_Operator.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: a3464ffbeded6b34d81e611a47d587d2 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/AI/Enums/Definitions/AI_Procedure.cs b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/AI/Enums/Definitions/AI_Procedure.cs new file mode 100644 index 00000000..60c2759e --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/AI/Enums/Definitions/AI_Procedure.cs @@ -0,0 +1,1715 @@ +namespace BinarySerializer.Ubisoft.CPA { + // Regex for NP++: + // Find: (NU_)?M_DEFINE_[^ \t\(]*[ \t]*\([ \t]*e[^_]*_([^ \t,]*)[ \t]*,[ \t]*([^ \t,]*)[ \t]*,([ \t]*([^ \t,]*)[ \t]*,)?[ \t]*([^ \t,]*)[ \t]*,[ \t]*fn_.* + // eCond , FR , EN , SCR + // Replace: \[AI_Definition\(SCR: \6, EN: \5, FR: \3\)] \2, + // Then replace " EN: ," with "" + public enum AI_Procedure { + #region DefProc + //******************************************************************************************************************************************************************************************************************************************************** + // HitPoints procedures + [AI_Definition(SCR: "Proc_SetHitPoints", EN: "ACT_SetHitPoints", FR: "ACT_FixePointsDeVie")] SetHitPoints, + [AI_Definition(SCR: "Proc_SetHitPointsInit", EN: "ACT_SetHitPointsInit", FR: "ACT_FixePointsDeVieInit")] SetHitPointsInit, + [AI_Definition(SCR: "Proc_SetHitPointsToInit", EN: "ACT_SetHitPointsToInit", FR: "ACT_ReinitPointsDeVie")] SetHitPointsToInitValue, + [AI_Definition(SCR: "Proc_SetHitPointsToMax", EN: "ACT_SetHitPointsToMax", FR: "ACT_ReinitPointsDeVieAMax")] SetHitPointsToMaxValue, + [AI_Definition(SCR: "Proc_AddHitPoints", EN: "ACT_AddHitPoints", FR: "ACT_AjoutePointsDeVie")] AddHitPoints, + [AI_Definition(SCR: "Proc_SubHitPoints", EN: "ACT_SubHitPoints", FR: "ACT_EnlevePointsDeVie")] SubHitPoints, + // HitPointsMax procedures + [AI_Definition(SCR: "Proc_SetHitPointsMax", EN: "ACT_SetHitPointsMax", FR: "ACT_FixePointsDeVieMax")] SetHitPointsMax, + [AI_Definition(SCR: "Proc_SetHitPointsMaxToInit", EN: "ACT_SetHitPointsMaxToInit", FR: "ACT_ReinitPointsDeVieMax")] SetHitPointsMaxToInitValue, + [AI_Definition(SCR: "Proc_SetHitPointsMaxToMax", EN: "ACT_SetHitPointsMaxToMax", FR: "ACT_ReinitPointsDeVieMaxAMax")] SetHitPointsMaxToMaxValue, + [AI_Definition(SCR: "Proc_AddHitPointsMax", EN: "ACT_AddHitPointsMax", FR: "ACT_AjoutePointsDeVieMax")] AddHitPointsMax, + [AI_Definition(SCR: "Proc_SubHitPointsMax", EN: "ACT_SubHitPointsMax", FR: "ACT_EnlevePointsDeVieMax")] SubHitPointsMax, + // Transparence + [AI_Definition(SCR: "Proc_TransparentDisplay", EN: "ACT_TransparentDisplay", FR: "ACT_ActivationTransparence")] TransparentDisplay, + [AI_Definition(SCR: "Proc_SetTransparency", EN: "ACT_SetTransparency", FR: "ACT_NiveauTransparence")] SetTransparency, + // draw mask + [AI_Definition(SCR: "Proc_ACT_SetDrawFlag", EN: "ACT_SetDrawFlag", FR: "ACT_SetDrawFlag")] ACT_SetDrawFlag, + //********************************************************************************************************************************************************************************************************************************************************* + // Transparence + [AI_Definition(SCR: "Proc_ModuleTransparentDisplay", EN: "MOD_ModuleTransparentDisplay", FR: "MOD_ActivationTransparence")] ModuleTransparentDisplay, + [AI_Definition(SCR: "Proc_ModuleTransparentDisplay2", EN: "MOD_ModuleTransparentDisplay2", FR: "MOD_ActivationTransparence2")] ModuleTransparentDisplay2, + [AI_Definition(SCR: "Proc_SetModuleTransparency", EN: "MOD_SetModuleTransparency", FR: "MOD_NiveauTransparence")] SetModuleTransparency, + [AI_Definition(SCR: "Proc_SetModuleTransparency2", EN: "MOD_SetModuleTransparency2", FR: "MOD_NiveauTransparence2")] SetModuleTransparency2, + //********************************************************************************************************************************************************************************************************************************************************* + // List ZDD ZDE procedures + [AI_Definition(SCR: "Proc_ListAffectWithPersoZDD", EN: "LST_ListAffectWithPersoZDD", FR: "LST_AffecteListeAvecZDDPerso")] ListAffectPersoZDD, + [AI_Definition(SCR: "Proc_ListAffectWithModuleZDD", EN: "LST_ListAffectWithModuleZDD", FR: "LST_AffecteListeAvecZDDModule")] ListAffectModuleZDD, + [AI_Definition(SCR: "Proc_ListAffectWithPersoZDE", EN: "LST_ListAffectWithPersoZDE", FR: "LST_AffecteListeAvecZDEPerso")] ListAffectPersoZDE, + [AI_Definition(SCR: "Proc_ListAffectWithModuleZDE", EN: "LST_ListAffectWithModuleZDE", FR: "LST_AffecteListeAvecZDEModule")] ListAffectModuleZDE, + [AI_Definition(SCR: "Proc_ListAffectWithPersoTypeZDE", EN: "LST_ListAffectWithPersoTypeZDE", FR: "LST_AffecteListeAvecTypeZDEPerso")] ListAffectPersoTypeZDE, + [AI_Definition(SCR: "Proc_ListAffectWithModuleTypeZDE", EN: "LST_ListAffectWithModuleTypeZDE", FR: "LST_AffecteListeAvecTypeZDEModule")] ListAffectModuleTypeZDE, + [AI_Definition(SCR: "Proc_ListAffectTypeZDEWithTypeZDE", EN: "LST_ListAffectTypeZDEWithTypeZDE", FR: "LST_AffecteListeTypeZDEAvecTypeZDE")] ListAffectTypeZDEWithTypeZDE, + // List Misc procedures + [AI_Definition(SCR: "Proc_AddPersoInList", EN: "LST_AddPersoInList", FR: "LST_AjoutePersoDansListe")] AddPersoInList, + [AI_Definition(SCR: "Proc_AddPersoInListAt", EN: "LST_AddPersoInListAt", FR: "LST_AjoutePersoDansListeA")] AddPersoInListAt, + [AI_Definition(SCR: "Proc_DeletePersoAtInList", EN: "LST_DeletePersoAtInList", FR: "LST_DetruitPersoDansListe")] DeletePersoAtInList, + [AI_Definition(SCR: "Proc_FindPersoAndDeleteInList", EN: "LST_FindPersoAndDeleteInList", FR: "LST_TrouveEtDetruitPersoDansListe")] FindPersoAndDeleteInList, + [AI_Definition(SCR: "Proc_Select", EN: "LST_Select", FR: "LST_SelectDansListe")] ListSelect, + [AI_Definition(SCR: "Proc_UnSelect", EN: "LST_UnSelect", FR: "LST_UnSelectDansListe")] ListUnSelect, + [AI_Definition(SCR: "Proc_ListSort", EN: "LST_ListSort", FR: "LST_TrieListe")] ListSort, + [AI_Definition(SCR: "Proc_ListSortByFamily", EN: "LST_ListSortByFamily", FR: "LST_TrieListeParFamille")] ListSortByFamily, + [AI_Definition(SCR: "Proc_ListSortByModele", EN: "LST_ListSortByModele", FR: "LST_TrieListeParModele")] ListSortByModel, + [AI_Definition(SCR: "Proc_FillListWithAllPersoOfAFamily", EN: "LST_ListSortByModele", FR: "LST_RemplirListeAvecTouteUneFamille")] FillListWithAllPersoOfAFamily, + [AI_Definition(SCR: "Proc_FillListWithAllPersoOfAModel", EN: "LST_FillListWithAllPersoOfAModel", FR: "LST_RemplirListeAvecToutUnModele")] FillListWithAllPersoOfAModel, + [AI_Definition(SCR: "Proc_DeleteFamilyInList", EN: "LST_DeleteFamilyInList", FR: "LST_DetruitFamilleDansListe")] DeleteFamilyInList, + [AI_Definition(SCR: "Proc_DeleteModelInList", EN: "LST_DeleteModelInList", FR: "LST_DetruitModeleDansListe")] DeleteModelInList, + // List Ensemble procedures + [AI_Definition(SCR: "Proc_ListUnion", EN: "LST_DeleteModelInList", FR: "LST_ListeUnion")] ListUnion, + [AI_Definition(SCR: "Proc_ListInter", EN: "LST_ListInter", FR: "LST_ListeInter")] ListInter, + [AI_Definition(SCR: "Proc_ListDiff", EN: "LST_ListDiff", FR: "LST_ListeDiff")] ListDiff, + [AI_Definition(SCR: "Proc_ListAdd", EN: "LST_ListAdd", FR: "LST_ListeAjoute")] ListAdd, + //******************************************************************************************************************************************************************************************************************************************************** + // Brouillards + [AI_Definition(SCR: "FOG_Proc_Activate", EN: "FOG_Activate", FR: "LUM_BrouillardActive")] FogActivate, + [AI_Definition(SCR: "FOG_Proc_SetColor", EN: "FOG_SetColor", FR: "LUM_BrouillardFixeCouleur")] SetFogColor, + [AI_Definition(SCR: "FOG_Proc_SetNearFarInf", EN: "FOG_SetNearFarInf", FR: "LUM_BrouillardFixeDistances")] SetFogNearFarInf, + [AI_Definition(SCR: "FOG_Proc_SetBlend", EN: "FOG_SetBlend", FR: "LUM_BrouillardFixeBlend")] SetFogBlend, + [AI_Definition(SCR: "FOG_Proc_RestoreFog", EN: "FOG_RestoreFog", FR: "LUM_RestaurerBrouillard")] RestoreFog, + [AI_Definition(SCR: "FOG_Proc_SaveFog", EN: "FOG_SaveFog", FR: "LUM_SauverBrouillard")] SaveFog, + //*********************************************************************************************************************************** + // Magnet MGT procedure + [AI_Definition(SCR: "Procedure_Magnet_ActiveMagnet", EN: "MAGNET_ON", FR: "Magnet_ON")] Magnet_ActiveMagnet, + [AI_Definition(SCR: "Procedure_Magnet_DeactiveMagnet", EN: "MAGNET_OFF", FR: "Magnet_OFF")] Magnet_DeactiveMagnet, + [AI_Definition(SCR: "Procedure_Magnet_SetStrength", EN: "MAGNET_SetStrength", FR: "Magnet_SetStrength")] Magnet_SetStrength, + [AI_Definition(SCR: "Procedure_Magnet_SetFar", EN: "MAGNET_SetFar", FR: "Magnet_SetFar")] Magnet_SetFar, + [AI_Definition(SCR: "Procedure_Magnet_SetNear", EN: "MAGNET_SetNear", FR: "Magnet_SetNear")] Magnet_SetNear, + [AI_Definition(SCR: "Procedure_Magnet_SetDuration", EN: "MAGNET_SetDuration", FR: "Magnet_SetDuration")] Magnet_SetDuration, + //******************************************************************************************************************************************************************************************************************************************************** + // FootPath + [AI_Definition(SCR: "Proc_FootPath_AddFootPrint", EN: "FootPath_AddFootPrint", FR: "FootPath_AddFootPrint")] FootPath_AddFootPrint, + [AI_Definition(SCR: "Proc_FootPath_Clear", EN: "FootPath_Clear", FR: "FootPath_Clear")] FootPath_Clear, + //******************************************************************************************************************************************************************************************************************************************************** + // Effect + [AI_Definition(SCR: "Proc_SinusEffect_SetFreq", EN: "EFFECT_SetSinusFreq", FR: "Effect_SetSinusFreq")] SinEffect_SetFreq, + [AI_Definition(SCR: "Proc_SinusEffect_SetAmplitude", EN: "EFFECT_SetSinusAmplitude", FR: "Effect_SetSinusAmplitude")] SinEffect_SetAmplitude, + [AI_Definition(SCR: "Proc_SinusEffect_SetState", EN: "EFFECT_SetSinusState", FR: "Effect_SetSinusState")] SinEffect_SetState, + [AI_Definition(SCR: "Proc_SinusEffect_SetFreq3D", EN: "EFFECT_SetSinusFreq3D", FR: "Effect_SetSinusFreq3D")] SinEffect_SetFreq3D, + [AI_Definition(SCR: "Proc_SinusEffect_SetRLIAmplitude", EN: "EFFECT_SetRLISinusAmplitude", FR: "Effect_SetRLISinusAmplitude")] SinEffect_SetRLIAmplitude, + [AI_Definition(SCR: "Proc_SinusEffect_SetRLIBase", EN: "EFFECT_SetRLISinusBase", FR: "Effect_SetRLISinusBase")] SinEffect_SetRLIBase, + + //******************************************************************************************************************************************************************************************************************************************************** + // SuperObject Draw mask + [AI_Definition(SCR: "Proc_SPO_SetDrawFlag", EN: "SPO_SetDrawFlag", FR: "SPO_SetDrawFlag")] SPO_SetDrawFlag, + [AI_Definition(SCR: "Proc_SPO_SetEngineDisplayModeFlag", EN: "SPO_SetEngineDisplayModeFlag", FR: "SPO_SetEngineDisplayModeFlag")] SPO_SetEngineDisplayModeFlag, + //******************************************************************************************************************************************************************************************************************************************************** + // NO FAMILY + [AI_Definition(SCR: "Proc_DeactivateBut", EN: "DeactivateBut", FR: "BoutonDesactive")] DeactivateBut, + [AI_Definition(SCR: "Proc_ActivateBut", EN: "ActivateBut", FR: "BoutonActive")] ActivateBut, + //******************************************************************************************************************************************************************************************************************************************************** + [AI_Definition(SCR: "Proc_None", EN: "None", FR: "NeRienFaire")] None, + [AI_Definition(SCR: "Proc_ChangeComport", EN: "ChangeComport", FR: "ChangeComportement")] ChangeComport, + [AI_Definition(SCR: "Proc_ChangeComportReflex", EN: "ChangeComportReflex", FR: "ChangeComportementReflexe")] ChangeComportReflex, + [AI_Definition(SCR: "Proc_ChangeMyComport", EN: "ChangeMyComport", FR: "ChangeMonComportement")] ChangeMyComport, + [AI_Definition(SCR: "Proc_ChangeMyComportReflex", EN: "ChangeMyComportReflex", FR: "ChangeMonComportementReflexe")] ChangeMyComportReflex, + [AI_Definition(SCR: "Proc_ChangeMyComportAndMyReflex", EN: "ChangeMyComportAndMyReflex", FR: "ChangeMonComportementEtMonReflexe")] ChangeMyComportAndMyReflex, + [AI_Definition(SCR: "Proc_ChangeAction", EN: "ChangeAction", FR: "ChangeAction")] ChangeAction, + [AI_Definition(SCR: "Proc_ChangeActionForce", EN: "ChangeActionForce", FR: "ChangeActionForce")] ChangeActionForce, + [AI_Definition(SCR: "Proc_ChangeActionRandom", EN: "ChangeActionRandom", FR: "ChangeActionAleatoire")] ChangeActionRandom, + [AI_Definition(SCR: "Proc_ChangeActionWithEvents", EN: "ChangeActionWithEvents", FR: "ChangeActionAvecEvenements")] ChangeActionWithEvents, + //******************************************************************************************************************************************************************************************************************************************************** + [AI_Definition(SCR: "Proc_Loop", EN: "Loop", FR: "Boucle")] Boucle, + [AI_Definition(SCR: "Proc_EndLoop", EN: "EndLoop", FR: "FinBoucle")] FinBoucle, + [AI_Definition(SCR: "Proc_Break", EN: "Break", FR: "Break")] Break, + + //******************************************************************************************************************************************************************************************************************************************************** + // Misc procedures with no parameter + [AI_Definition(SCR: "Proc_PlayerIsDead", EN: "ACT_PlayerIsDead", FR: "MortDuJoueur")] PlayerIsDead, + [AI_Definition(SCR: "Proc_RestoreCardParameters", EN: "MEC_RestoreCardParameters", FR: "MEC_RestaureParametresCarte")] ResetDynamicsWithCard, + [AI_Definition(SCR: "Proc_BreakAI", EN: "BreakAI", FR: "BreakAI")] BreakAI, + [AI_Definition(SCR: "Proc_IgnoreTraceFlagForNextPicking", EN: "Proc_IgnoreTraceFlagForNextPicking", FR: "COL_IgnoreFlagRayTraceAuProchainPicking")] IgnoreTraceFlagForNextPicking, + + //******************************************************************************************************************************************************************************************************************************************************** + // Misc procedures with one parameter + [AI_Definition(SCR: "Proc_SetMainActor", EN: "ACT_SetMainActor", FR: "FixeActeurPrincipal")] SetMainActor, + [AI_Definition(SCR: "Proc_ActivateObject", EN: "SPO_ActivateObject", FR: "ActiveObjet")] ActivateObject, + [AI_Definition(SCR: "Proc_DesactivateObject", EN: "SPO_DesactivateObject", FR: "DesactiveObjet")] DesactivateObject, + [AI_Definition(SCR: "Proc_ChangeMap", EN: "MAP_ChangeMap", FR: "ChangeMap")] ChangeMap, + [AI_Definition(SCR: "Proc_ChangeMapNoAutosave", EN: "MAP_ChangeMapNoAutosave", FR: "ChangeMapSansSauver")] ChangeMapNoAutosave, + [AI_Definition(SCR: "Proc_SetActionReturn", EN: "SetActionReturn", FR: "ForceValeurDeRetourMetaAction")] SetActionReturn, + [AI_Definition(SCR: "Proc_FactorAnimationFrameRate", EN: "FactorAnimationFrameRate", FR: "FixeFacteurVitesseAnimation")] FactorAnimationFrameRate, + [AI_Definition(SCR: "Proc_SetCharacterPriority", EN: "ACT_SetCharacterPriority", FR: "ACT_FixePriorite")] SetCharacterPriority, + [AI_Definition(SCR: "Proc_ForcePersoHandling", EN: "ACT_ForcePersoHandling", FR: "ACT_ForceTraitementPerso")] ForcePersoHandling, + [AI_Definition(SCR: "Proc_PlayerIsDeadWithOption", FR: "MortDuJoueurAvecOption")] PlayerIsDeadWithOption, + //******************************************************************************************************************************************************************************************************************************************************** + // Misc procedures with two or more parameters + [AI_Definition(SCR: "Proc_ChangeMapAtPosition", FR: "ChangeMapALaPosition")] ChangeMapAtPosition, + [AI_Definition(SCR: "Proc_PlayerIsDeadWithPlacement", EN: "ACT_PlayerIsDeadWithPlacement", FR: "MortDuJoueurAvecRepositionnement")] PlayerIsDeadWithPlacement, + //******************************************************************************************************************************************************************************************************************************************************** + + //******************************************************************************************************************************************************************************************************************************************************** + // Table procedures + [AI_Definition(SCR: "Proc_SwapLinkTableObjects", EN: "SwapLinkTableObjects", FR: "EchangeObjetsDansTable")] SwapLinkTableObjects, + [AI_Definition(SCR: "Proc_ChangeCurrentObjectTable", EN: "ChangeCurrentObjectTable", FR: "ChangeTableObjetCourante")] ChangeCurrentObjectTable, + [AI_Definition(SCR: "Proc_BuildObjectTableFromTableAndString", EN: "BuildObjectTableFromTableAndString", FR: "ModifieTableCouranteAvecTableEtTexte")] BuildObjectTableFromTableAndString, + [AI_Definition(SCR: "Proc_BuildObjectTableFromFormattedString", EN: "BuildObjectTableFromFormattedString", FR: "ModifieTableCouranteAvecTexteFormate")] BuildObjectTableFromFormattedString, + //******************************************************************************************************************************************************************************************************************************************************** + // LipsSynchro + [AI_Definition(SCR: "Proc_StartSpeech", EN: "StartSpeech", FR: "Parle")] StartSpeech, + [AI_Definition(SCR: "Proc_StopSpeech", EN: "StopSpeech", FR: "ArreteDeParler")] StopSpeech, + //******************************************************************************************************************************************************************************************************************************************************** + // Module Control + [AI_Definition(SCR: "Proc_TakeModuleControl", EN: "MOD_TakeModuleControl", FR: "ControlerModule")] TakeModuleControl, + [AI_Definition(SCR: "Proc_TakeManyModulesControl", EN: "MOD_TakeManyModulesControl", FR: "ControlerPlusieursModules")] TakeManyModulesControl, + [AI_Definition(SCR: "Proc_ReleaseModuleControl", EN: "MOD_ReleaseModuleControl", FR: "LibererModule")] ReleaseModuleControl, + + //******************************************************************************************************************************************************************************************************************************************************** + // Saved game + [AI_Definition(SCR: "Proc_SaveGame", EN: "GAME_SaveGame", FR: "SauvePartie")] SaveGame, + [AI_Definition(SCR: "Proc_LoadGame", EN: "GAME_LoadGame", FR: "ChargePartie")] LoadGame, + [AI_Definition(SCR: "Proc_EraseGame", EN: "GAME_EraseGame", FR: "EffacePartie")] EraseGame, + [AI_Definition(SCR: "Proc_CopyGame", EN: "GAME_CopyGame", FR: "CopiePartie")] CopyGame, + [AI_Definition(SCR: "Proc_QuitGame", EN: "GAME_QuitGame", FR: "TerminePartie")] QuitGame, + //******************************************************************************************************************************************************************************************************************************************************** + // Channel activation : ULTRA + [AI_Definition(SCR: "Proc_ActivateChannel", EN: "ActivateChannel", FR: "ActiveCanal")] ActivateChannel, + [AI_Definition(SCR: "Proc_DeactivateChannel", EN: "DeactivateChannel", FR: "DesactiveCanal")] DeactivateChannel, + //******************************************************************************************************************************************************************************************************************************************************** + // Light + [AI_Definition(SCR: "Proc_PersoLightOn", EN: "ACT_PersoLightOn", FR: "AllumeLumierePerso")] PersoLightOn, + [AI_Definition(SCR: "Proc_PersoLightOff", EN: "ACT_PersoLightOff", FR: "EteintLumierePerso")] PersoLightOff, + [AI_Definition(SCR: "Proc_SetPersoLightColor", EN: "ACT_SetPersoLightColor", FR: "FixeCouleurLumierePerso")] SetPersoLightColor, + [AI_Definition(SCR: "Proc_SetPersoLightNearFar", EN: "ACT_SetPersoLightNearFar", FR: "FixeDistancesLumierePerso")] SetPersoLightNearFar, + [AI_Definition(SCR: "Proc_SetPersoLightLittleBigAlpha", EN: "ACT_SetPersoLightLittleBigAlpha", FR: "FixeAlphasLumierePerso")] SetPersoLightLittleBigAlpha, + [AI_Definition(SCR: "Proc_SetPersoLightGyrophare", EN: "ACT_SetPersoLightGyrophare", FR: "FixeGyrophareLumierePerso")] SetPersoLightGyrophare, + [AI_Definition(SCR: "Proc_SetPersoLightPulse", EN: "ACT_SetPersoLightPulse", FR: "FixePulseLumierePerso")] SetPersoLightPulse, + [AI_Definition(SCR: "Proc_SetPersoLightParalleleType", EN: "ACT_SetPersoLightParalleleType", FR: "FixeTypeParalleleLumierePerso")] SetPersoLightParalleleType, + [AI_Definition(SCR: "Proc_SetPersoLightSphericalType", EN: "ACT_SetPersoLightSphericalType", FR: "FixeTypeSpheriqueLumierePerso")] SetPersoLightSphericalType, + [AI_Definition(SCR: "Proc_SetPersoLightHotSpotType", EN: "ACT_SetPersoLightHotSpotType", FR: "FixeTypeHotSpotLumierePerso")] SetPersoLightHotSpotType, + [AI_Definition(SCR: "Proc_SetPersoLightAmbientType", EN: "ACT_SetPersoLightAmbientType", FR: "FixeTypeAmbientLumierePerso")] SetPersoLightAmbientType, + //******************************************************************************************************************************************************************************************************************************************************** + // Sound + [AI_Definition(SCR: "Proc_SendSoundRequest", EN: "SOUND_SendSoundRequest", FR: "EnvoieRequeteSon")] SendSoundRequest, + [AI_Definition(SCR: "Proc_SendVoiceRequest", EN: "SOUND_SendVoiceRequest", FR: "EnvoieRequeteVoix")] SendVoiceRequest, + [AI_Definition(SCR: "Proc_SendMusicRequest", EN: "SOUND_SendMusicRequest", FR: "EnvoieRequeteMusique")] SendMusicRequest, + [AI_Definition(SCR: "Proc_SendAmbianceRequest", EN: "SOUND_SendAmbianceRequest", FR: "EnvoieRequeteAmbiance")] SendAmbianceRequest, + [AI_Definition(SCR: "Proc_SendMenuSndRequest", EN: "SOUND_SendMenuSndRequest", FR: "EnvoieRequeteMenuSon")] SendMenuSndRequest, + //******************************************************************************************************************************************************************************************************************************************************** + // display + [AI_Definition(SCR: "Proc_DefautDisplay", EN: "DefautDisplay", FR: "AfficheDefaut")] DefaultDisplay, + //******************************************************************************************************************************************************************************************************************************************************** + [AI_Definition(SCR: "Proc_DisplayVignette", EN: "VIG_DisplayVignette", FR: "VIG_AfficheVignette")] DisplayVignette, + [AI_Definition(SCR: "Proc_DeleteVignette", EN: "VIG_DeleteVignette", FR: "VIG_SupprimeVignette")] DeleteVignette, + //******************************************************************************************************************************************************************************************************************************************************** + // ParticleGenerator + // diverse + [AI_Definition(SCR: "Proc_SetParticleGeneratorOn", EN: "PRT_SetParticleGeneratorOn", FR: "PRT_DeclencheGenerateur")] PRT_SetGeneratorOn, + [AI_Definition(SCR: "Proc_SetParticleGeneratorOff", EN: "PRT_SetParticleGeneratorOff", FR: "PRT_ArreteGenerateur")] PRT_SetGeneratorOff, + [AI_Definition(SCR: "Proc_SetParticleGenerator", EN: "PRT_SetParticleGenerator", FR: "PRT_InstalleGenerateur")] PRT_SetGenerator, + // Generation mode + [AI_Definition(SCR: "Proc_SetGenerationModeNone", EN: "PRT_SetGenerationModeNone", FR: "PRT_PasDeGeneration")] PRT_SetModeNone, + [AI_Definition(SCR: "Proc_SetGenerationModeContinuous", EN: "PRT_SetGenerationModeContinuous", FR: "PRT_GenerationContinue")] PRT_SetModeContinuous, + [AI_Definition(SCR: "Proc_SetGenerationModeCrenel", EN: "PRT_SetGenerationModeCrenel", FR: "PRT_GenerationEnCreneau")] PRT_SetModeCrenel, + [AI_Definition(SCR: "Proc_SetGenerationModeProbability", EN: "PRT_SetGenerationModeProbability", FR: "PRT_GenerationProbabiliste")] PRT_SetModeProbability, + // Generation number + [AI_Definition(SCR: "Proc_SetGenerationNbConstant", EN: "PRT_SetGenerationNbConstant", FR: "PRT_GenereNombreConstant")] PRT_SetNumberConstant, + [AI_Definition(SCR: "Proc_SetGenerationNbProbabilist", EN: "PRT_SetGenerationNbProbabilist", FR: "PRT_GenereNombreProbabiliste")] PRT_SetNumberProbabilist, + // Particles LifeTime + [AI_Definition(SCR: "Proc_SetInfiniteLifeTime", EN: "PRT_SetInfiniteLifeTime", FR: "PRT_TempsDeVieInfini")] PRT_SetInfiniteLifeTime, + [AI_Definition(SCR: "Proc_SetConstantLifeTime", EN: "PRT_SetConstantLifeTime", FR: "PRT_TempsDeVieConstant")] PRT_SetConstantLifeTime, + [AI_Definition(SCR: "Proc_SetProbabilistLifeTime", EN: "PRT_SetProbabilistLifeTime", FR: "PRT_TempsDeVieProbabiliste")] PRT_SetPobabilistLifeTime, + + //******************************************************************************************************************************************************************************************************************************************************** + + //******************************************************************************************************************************************************************************************************************************************************** + // Old metactions + [AI_Definition(SCR: "Proc_TurnAbsoluteDirection", FR: "TourneDirectionAbsolue")] TurnAbsoluteDirection, + [AI_Definition(SCR: "Proc_GoAbsoluteDirection", FR: "VaToutDroitDirectionAbsolue")] GoAbsoluteDirection, + [AI_Definition(SCR: "Proc_Turn", EN: "ACT_Turn", FR: "ACT_TourneVitesse")] Turn, + [AI_Definition(SCR: "Proc_Turn2", EN: "ACT_Turn2", FR: "ACT_TourneAngle")] Turn2, + [AI_Definition(SCR: "Proc_DeltaTurnPerso", EN: "ACT_DeltaTurnPerso", FR: "OrienteVersPersoAvecDelta")] DeltaTurnPerso, + [AI_Definition(SCR: "Proc_TurnPerso", EN: "ACT_TurnPerso", FR: "OrienteVersPerso")] TurnPerso, + [AI_Definition(SCR: "Proc_KillPerso", EN: "ACT_KillPerso", FR: "DetruitPerso")] KillPerso, + [AI_Definition(SCR: "Proc_KillPersoAndClearVariable", EN: "ACT_KillPersoAndClearVariable", FR: "DetruitPersoEtEffaceVariable")] KillPersoAndClearVariable, + + + //*********************************************************************************************************************************** + // Visual GMT procedure + [AI_Definition(SCR: "Proc_SetVisualGMTColor", EN: "GMT_SetVisualGMTColor", FR: "FixeVisuelGMTCouleur")] SetVisualGMTColor, + [AI_Definition(SCR: "Proc_SetVisualGMTSpecularExponant", EN: "GMT_SetVisualGMTSpecularExponant", FR: "FixeVisuelGMTSpeculaireExposant")] SetVisualGMTSpecularExponent, + [AI_Definition(SCR: "Proc_SetVisualGMTSpecularCoef", EN: "GMT_SetVisualGMTSpecularCoef", FR: "FixeVisuelGMTSpeculaireCoef")] SetVisualGMTSpecularCoef, + [AI_Definition(SCR: "Proc_SetVisualGMTDiffuseCoef", EN: "GMT_SetVisualGMTDiffuseCoef", FR: "FixeVisuelGMTDiffusionCoef")] SetVisualGMTDiffuseCoef, + [AI_Definition(SCR: "Proc_SetVisualGMTAmbientCoef", EN: "GMT_SetVisualGMTAmbientCoef", FR: "FixeVisuelGMTAmbientCoef")] SetVisualGMTAmbientCoef, + [AI_Definition(SCR: "Proc_SetVisualGMTAsChromed", EN: "GMT_SetVisualGMTAsChromed", FR: "FixeVisuelGMTChrome")] SetVisualGMTAsChromed, + [AI_Definition(SCR: "Proc_SetVisualGMTTextureScrollingCoef", EN: "GMT_SetVisualGMTTextureScrollingCoef", FR: "FixeVisuelGMTTextureScrollingCoef")] SetVisualGMTTextureScrollingCoef, + [AI_Definition(SCR: "Proc_LockVisualGMT", EN: "GMT_LockVisualGMT", FR: "BloqueVisuelGMT")] LockVisualGMT, + [AI_Definition(SCR: "Proc_UnlockVisualGMT", EN: "GMT_UnlockVisualGMT", FR: "DebloqueVisuelGMT")] UnlockVisualGMT, + [AI_Definition(SCR: "Proc_SetVisualGMTFrame", EN: "GMT_SetVisualGMTFrame", FR: "FixeNoImageVisuelGMT")] SetVisualGMTFrame, + + //*********************************************************************************************************************************** + //KWN's New AI Function + [AI_Definition(SCR: "Func_SetScreenDSActif", EN: "ACT_SetScreenDSActif", FR: "ACT_SetScreenDSActif")] SetScreenDSActif, + //*********************************************************************************************************************************** + + //MICRO + [AI_Definition(SCR: "Func_MICRO_Enable", EN: "MICRO_Enable", FR: "MICRO_Enable")] MICRO_Enable, + + #endregion + + #region DefProc1 + //******************************************************************************************************************************************************************************************************************************************************** + // Option procedures + [AI_Definition(SCR: "Proc_OptionChangeDetailsValue", EN: "OPTION_ChangeDetailsValue", FR: "Option_ChangeNiveauDeDetails")] OptionChangeDetailsValue, + [AI_Definition(SCR: "Proc_OptionChangeMusicVolume", EN: "OPTION_ChangeMusicVolume", FR: "Option_ChangeVolumeMusical")] OptionChangeMusicVolume, + [AI_Definition(SCR: "Proc_OptionChangeSfxVolume", EN: "OPTION_ChangeSfxVolume", FR: "Option_ChangeVolumeEffets")] OptionChangeSfxVolume, + [AI_Definition(SCR: "Proc_OptionChangeVoiceVolume", EN: "OPTION_ChangeVoiceVolume", FR: "Option_ChangeVolumeVoix")] OptionChangeVoiceVolume, + [AI_Definition(SCR: "Proc_OptionChangeActionKey", EN: "OPTION_ChangeActionKey", FR: "Option_ChangeConfigDeTouche")] OptionChangeActionKey, + [AI_Definition(SCR: "Proc_ConfigureKey", EN: "OPTION_ConfigureKey", FR: "Option_ConfigureTouche")] OptionConfigureKey, + //******************************************************************************************************************************************************************************************************************************************************** + // 3D procedures + [AI_Definition(SCR: "Proc_SetPersoAbsolutePosition", EN: "ACT_SetPersoAbsolutePosition", FR: "ACT_ChangePositionAbsoluePerso")] SetPersoAbsolutePosition, + [AI_Definition(SCR: "Proc_SetPersoAtModulePosition", EN: "ACT_SetPersoAtModulePosition", FR: "ACT_PlaceSurModuleDePerso")] SetPersoAtModulePosition, + [AI_Definition(SCR: "Proc_ForcePersoAveragePosition", EN: "ACT_ForcePersoAveragePosition", FR: "ACT_ForcePositionMoyennePerso")] ForcePersoAveragePosition, + [AI_Definition(SCR: "Proc_RelativeMovePerso", EN: "ACT_RelativeMovePerso", FR: "ACT_DeplacePerso")] RelativeMovePerso, + [AI_Definition(SCR: "Proc_ChangePersoAnySighting", EN: "ACT_SetPersoAnySighting", FR: "ACT_ChangeViseeQuelconquePerso")] ChangePersoAnySighting, + [AI_Definition(SCR: "Proc_ChangePersoSightingWithOffset", EN: "ACT_SetPersoSightingWithOffset", FR: "ACT_ChangeViseePersoAvecOffset")] ChangePersoSightingWithOffset, + [AI_Definition(SCR: "Proc_RotatePersoAroundX", EN: "ACT_RotatePersoAroundX", FR: "ACT_TournePersoAutourDeX")] RotatePersoAroundX, + [AI_Definition(SCR: "Proc_RotatePersoAroundY", EN: "ACT_RotatePersoAroundY", FR: "ACT_TournePersoAutourDeY")] RotatePersoAroundY, + [AI_Definition(SCR: "Proc_RotatePersoAroundZ", EN: "ACT_RotatePersoAroundZ", FR: "ACT_TournePersoAutourDeZ")] RotatePersoAroundZ, + [AI_Definition(SCR: "Proc_RotatePersoAroundVector", EN: "ACT_RotatePersoAroundVector", FR: "ACT_TournePersoAutourDeVecteur")] RotatePersoAroundVector, + [AI_Definition(SCR: "Proc_RotatePersoAroundVectorWithOffset", EN: "ACT_RotatePersoAroundVectorOffset", FR: "ACT_TournePersoAutourDeVecteurAvecOffset")] RotatePersoAroundVectorWithOffset, + [AI_Definition(SCR: "Proc_RotatePersoAroundXwithOffset", EN: "ACT_RotatePersoAroundXwithOffset", FR: "ACT_TournePersoAutourDeXavecOffset")] RotatePersoAroundXwithOffset, + [AI_Definition(SCR: "Proc_RotatePersoAroundYwithOffset", EN: "ACT_RotatePersoAroundYwithOffset", FR: "ACT_TournePersoAutourDeYavecOffset")] RotatePersoAroundYwithOffset, + [AI_Definition(SCR: "Proc_RotatePersoAroundZwithOffset", EN: "ACT_RotatePersoAroundZwithOffset", FR: "ACT_TournePersoAutourDeZavecOffset")] RotatePersoAroundZwithOffset, + [AI_Definition(SCR: "Proc_SetFullPersoOrientation", EN: "ACT_SetFullPersoOrientation", FR: "ACT_ReorientePerso")] SetFullPersoOrientation, + [AI_Definition(SCR: "Proc_SetFullPersoOrientationWithOffset", EN: "ACT_SetFullPersoOrientWithOffset", FR: "ACT_ReorientePersoAvecOffset")] SetFullPersoOrientationWithOffset, + + [AI_Definition(SCR: "Proc_ZoomPerso", EN: "ACT_ZoomPerso", FR: "ACT_DeformePerso")] ZoomPerso, + [AI_Definition(SCR: "Proc_ChangeOneCustomBit", EN: "ACT_ChangeOneCustomBit", FR: "ACT_ChangeCustomBit")] ChangeOneCustomBit, + [AI_Definition(SCR: "Proc_ChangeManyCustomBits", EN: "ACT_ChangeManyCustomBits", FR: "ACT_ChangeCustomBits")] ChangeManyCustomBits, + // impose relative + [AI_Definition(SCR: "Proc_ImposeSpeed", EN: "ACT_ImposeSpeed", FR: "ACT_ImposeVecteurVitesse")] ImposeSpeed, + [AI_Definition(SCR: "Proc_ImposeSpeedX", EN: "ACT_ImposeSpeedX", FR: "ACT_ImposeVitesseX")] ImposeSpeedX, + [AI_Definition(SCR: "Proc_ImposeSpeedY", EN: "ACT_ImposeSpeedY", FR: "ACT_ImposeVitesseY")] ImposeSpeedY, + [AI_Definition(SCR: "Proc_ImposeSpeedZ", EN: "ACT_ImposeSpeedZ", FR: "ACT_ImposeVitesseZ")] ImposeSpeedZ, + [AI_Definition(SCR: "Proc_ImposeSpeedXY", EN: "ACT_ImposeSpeedXY", FR: "ACT_ImposeVitesseXY")] ImposeSpeedXY, + [AI_Definition(SCR: "Proc_ImposeSpeedXYZ", EN: "ACT_ImposeSpeedXYZ", FR: "ACT_ImposeVitesseXYZ")] ImposeSpeedXYZ, + // impose absolute + [AI_Definition(SCR: "Proc_ImposeAbsoluteSpeed", EN: "ACT_ImposeAbsoluteSpeed", FR: "ACT_ImposeVecteurVitesseAbsolu")] ImposeAbsoluteSpeed, + [AI_Definition(SCR: "Proc_ImposeAbsoluteSpeedX", EN: "ACT_ImposeAbsoluteSpeedX", FR: "ACT_ImposeVitesseAbsoluX")] ImposeAbsoluteSpeedX, + [AI_Definition(SCR: "Proc_ImposeAbsoluteSpeedY", EN: "ACT_ImposeAbsoluteSpeedY", FR: "ACT_ImposeVitesseAbsoluY")] ImposeAbsoluteSpeedY, + [AI_Definition(SCR: "Proc_ImposeAbsoluteSpeedZ", EN: "ACT_ImposeAbsoluteSpeedZ", FR: "ACT_ImposeVitesseAbsoluZ")] ImposeAbsoluteSpeedZ, + [AI_Definition(SCR: "Proc_ImposeAbsoluteSpeedXY", EN: "ACT_ImposeAbsoluteSpeedXY", FR: "ACT_ImposeVitesseAbsoluXY")] ImposeAbsoluteSpeedXY, + [AI_Definition(SCR: "Proc_ImposeAbsoluteSpeedXYZ", EN: "ACT_ImposeAbsoluteSpeedXYZ", FR: "ACT_ImposeVitesseAbsoluXYZ")] ImposeAbsoluteSpeedXYZ, + // propose relative + [AI_Definition(SCR: "Proc_ProposeSpeed", EN: "ACT_ProposeSpeed", FR: "ACT_ProposeVecteurVitesse")] ProposeSpeed, + [AI_Definition(SCR: "Proc_ProposeSpeedX", EN: "ACT_ProposeSpeedX", FR: "ACT_ProposeVitesseX")] ProposeSpeedX, + [AI_Definition(SCR: "Proc_ProposeSpeedY", EN: "ACT_ProposeSpeedY", FR: "ACT_ProposeVitesseY")] ProposeSpeedY, + [AI_Definition(SCR: "Proc_ProposeSpeedZ", EN: "ACT_ProposeSpeedZ", FR: "ACT_ProposeVitesseZ")] ProposeSpeedZ, + [AI_Definition(SCR: "Proc_ProposeSpeedXY", EN: "ACT_ProposeSpeedXY", FR: "ACT_ProposeVitesseXY")] ProposeSpeedXY, + [AI_Definition(SCR: "Proc_ProposeSpeedXYZ", EN: "ACT_ProposeSpeedXYZ", FR: "ACT_ProposeVitesseXYZ")] ProposeSpeedXYZ, + // propose absolute + [AI_Definition(SCR: "Proc_ProposeAbsoluteSpeed", EN: "ACT_ProposeAbsoluteSpeed", FR: "ACT_ProposeVecteurVitesseAbsolu")] ProposeAbsoluteSpeed, + [AI_Definition(SCR: "Proc_ProposeAbsoluteSpeedX", EN: "ACT_ProposeAbsoluteSpeedX", FR: "ACT_ProposeVitesseAbsoluX")] ProposeAbsoluteSpeedX, + [AI_Definition(SCR: "Proc_ProposeAbsoluteSpeedY", EN: "ACT_ProposeAbsoluteSpeedY", FR: "ACT_ProposeVitesseAbsoluY")] ProposeAbsoluteSpeedY, + [AI_Definition(SCR: "Proc_ProposeAbsoluteSpeedZ", EN: "ACT_ProposeAbsoluteSpeedZ", FR: "ACT_ProposeVitesseAbsoluZ")] ProposeAbsoluteSpeedZ, + [AI_Definition(SCR: "Proc_ProposeAbsoluteSpeedXY", EN: "ACT_ProposeAbsoluteSpeedXY", FR: "ACT_ProposeVitesseAbsoluXY")] ProposeAbsoluteSpeedXY, + [AI_Definition(SCR: "Proc_ProposeAbsoluteSpeedXYZ", EN: "ACT_ProposeAbsoluteSpeedXYZ", FR: "ACT_ProposeVitesseAbsoluXYZ")] ProposeAbsoluteSpeedXYZ, + [AI_Definition(SCR: "Proc_FixePositionPerso", EN: "ACT_FixePositionPerso", FR: "ACT_FixePositionPerso")] FixePositionPerso, + // add speed relative + [AI_Definition(SCR: "Proc_AddSpeed", EN: "ACT_AddSpeed", FR: "ACT_AddVecteurVitesse")] AddSpeed, + [AI_Definition(SCR: "Proc_AddSpeedX", EN: "ACT_AddSpeedX", FR: "ACT_AddVitesseX")] AddSpeedX, + [AI_Definition(SCR: "Proc_AddSpeedY", EN: "ACT_AddSpeedY", FR: "ACT_AddVitesseY")] AddSpeedY, + [AI_Definition(SCR: "Proc_AddSpeedZ", EN: "ACT_AddSpeedZ", FR: "ACT_AddVitesseZ")] AddSpeedZ, + [AI_Definition(SCR: "Proc_AddSpeedXY", EN: "ACT_AddSpeedXY", FR: "ACT_AddVitesseXY")] AddSpeedXY, + [AI_Definition(SCR: "Proc_AddSpeedXYZ", EN: "ACT_AddSpeedXYZ", FR: "ACT_AddVitesseXYZ")] AddSpeedXYZ, + // propose absolute + [AI_Definition(SCR: "Proc_AddAbsoluteSpeed", EN: "ACT_AddAbsoluteSpeed", FR: "ACT_AddVecteurVitesseAbsolu")] AddAbsoluteSpeed, + [AI_Definition(SCR: "Proc_AddAbsoluteSpeedX", EN: "ACT_AddAbsoluteSpeedX", FR: "ACT_AddVitesseAbsoluX")] AddAbsoluteSpeedX, + [AI_Definition(SCR: "Proc_AddAbsoluteSpeedY", EN: "ACT_AddAbsoluteSpeedY", FR: "ACT_AddVitesseAbsoluY")] AddAbsoluteSpeedY, + [AI_Definition(SCR: "Proc_AddAbsoluteSpeedZ", EN: "ACT_AddAbsoluteSpeedZ", FR: "ACT_AddVitesseAbsoluZ")] AddAbsoluteSpeedZ, + [AI_Definition(SCR: "Proc_AddAbsoluteSpeedXY", EN: "ACT_AddAbsoluteSpeedXY", FR: "ACT_AddVitesseAbsoluXY")] AddAbsoluteSpeedXY, + [AI_Definition(SCR: "Proc_AddAbsoluteSpeedXYZ", EN: "ACT_AddAbsoluteSpeedXYZ", FR: "ACT_AddVitesseAbsoluXYZ")] AddAbsoluteSpeedXYZ, + //******************************************************************************************************************************************************************************************************************************************************** + // Morphing management procedures + [AI_Definition(SCR: "Proc_PrepareMorph", EN: "MOD_PrepareMorph", FR: "MOD_PrepareMorph")] PrepareMorph, + [AI_Definition(SCR: "Proc_StopMorph", EN: "MOD_StopMorph", FR: "MOD_StopMorph")] StopMorph, + [AI_Definition(SCR: "Proc_Morphing", EN: "MOD_Morphing", FR: "MOD_Morphing")] Morphing, + [AI_Definition(SCR: "Proc_ReleaseAllModulesControl", EN: "MOD_ReleaseAllModulesControl", FR: "MOD_LibererTousLesModules")] ReleaseAllModulesControl, + [AI_Definition(SCR: "Proc_ChangeModuleSighting", EN: "MOD_ChangeModuleSighting", FR: "MOD_ChangeViseeModule")] ChangeModuleSighting, + [AI_Definition(SCR: "Proc_SetModuleAbsolutePosition", EN: "MOD_SetModuleAbsolutePosition", FR: "MOD_ChangePositionModule")] SetModuleAbsolutePosition, + [AI_Definition(SCR: "Proc_RelativeMoveModule", EN: "MOD_RelativeMoveModule", FR: "MOD_DeplaceModule")] RelativeMoveModule, + [AI_Definition(SCR: "Proc_ChangeModuleSightingWithOffset", EN: "MOD_ChangeModuleSightingWithOffset", FR: "MOD_ChangeViseeModuleAvecOffset")] ChangeModuleSightingWithOffset, + [AI_Definition(SCR: "Proc_RotateModuleAroundX", EN: "MOD_RotateModuleAroundX", FR: "MOD_TourneModuleAutourDeX")] RotateModuleAroundX, + [AI_Definition(SCR: "Proc_RotateModuleAroundY", EN: "MOD_RotateModuleAroundY", FR: "MOD_TourneModuleAutourDeY")] RotateModuleAroundY, + [AI_Definition(SCR: "Proc_RotateModuleAroundZ", EN: "MOD_RotateModuleAroundZ", FR: "MOD_TourneModuleAutourDeZ")] RotateModuleAroundZ, + [AI_Definition(SCR: "Proc_RotateModuleAroundVector", EN: "MOD_RotateModuleAroundVector", FR: "MOD_TourneModuleAutourDeVecteur")] RotateModuleAroundVector, + [AI_Definition(SCR: "Proc_RotateModuleAroundVectorOffset", EN: "MOD_RotateModuleAroundVectorOffset", FR: "MOD_TourneModuleAutourDeVecteurAvecOffset")] RotateModuleAroundVectorWithOffset, + [AI_Definition(SCR: "Proc_RotateModuleAroundXwithOffset", EN: "MOD_RotateModuleAroundXwithOffset", FR: "MOD_TourneModuleAutourDeXavecOffset")] RotateModuleAroundXwithOffset, + [AI_Definition(SCR: "Proc_RotateModuleAroundYwithOffset", EN: "MOD_RotateModuleAroundYwithOffset", FR: "MOD_TourneModuleAutourDeYavecOffset")] RotateModuleAroundYwithOffset, + [AI_Definition(SCR: "Proc_RotateModuleAroundZwithOffset", EN: "MOD_RotateModuleAroundZwithOffset", FR: "MOD_TourneModuleAutourDeZavecOffset")] RotateModuleAroundZwithOffset, + [AI_Definition(SCR: "Proc_SetFullModuleOrientation", EN: "MOD_SetFullModuleOrientation", FR: "MOD_ReorienteModule")] SetFullModuleOrientation, + [AI_Definition(SCR: "Proc_SetFullModuleOrientationOffset", EN: "MOD_SetFullModuleOrientationOffset", FR: "MOD_ReorienteModuleAvecOffset")] SetFullModuleOrientationWithOffset, + [AI_Definition(SCR: "Proc_ZoomModule", EN: "MOD_ZoomModule", FR: "MOD_DeformeModule")] ZoomModule, + //******************************************************************************************************************************************************************************************************************************************************** + // collision communication management : ULTRA + [AI_Definition(SCR: "Proc_SetColliderType", EN: "COL_SetColliderType", FR: "COL_ChangeTypeDeCollisionneur")] SetColliderType, + [AI_Definition(SCR: "Proc_SetColliderVector", EN: "COL_SetColliderVector", FR: "COL_ChangeVecteurDeCollisionneur")] SetColliderVector, + [AI_Definition(SCR: "Proc_SetColliderReal", EN: "COL_SetColliderReal", FR: "COL_ChangeReelDeCollisionneur")] SetColliderReal, + [AI_Definition(SCR: "Proc_ResetLastCollisionActor", EN: "COL_ResetLastCollisionActor", FR: "COL_AnnuleDernierPersoCollisionne")] ResetLastCollisionActor, + [AI_Definition(SCR: "Proc_ClearCollisionReport", EN: "COL_ClearCollisionReport", FR: "COL_VideRapportDeCollision")] ClearCollisionReport, + [AI_Definition(SCR: "Proc_SetGoThroughMechanicsHandling", EN: "COL_SetGoThroughMechanicsHandling", FR: "COL_TraiteCollisionTraversee")] SetGoThroughMechanicsHandling, + [AI_Definition(SCR: "Proc_EraseLastGoThroughMaterial", EN: "COL_EraseLastGoThroughMaterial", FR: "COL_EffaceDernierMateriauTraverse")] EraseLastGoThroughMaterial, + //******************************************************************************************************************************************************************************************************************************************************** + // String procedures + [AI_Definition(SCR: "Proc_StringAddChar", EN: "TEXT_AddChar", FR: "TEXT_AjouteCaractere")] StringAddChar, + [AI_Definition(SCR: "Proc_StringReplaceChar", EN: "TEXT_ReplaceChar", FR: "TEXT_RemplaceCaractere")] StringReplaceChar, + [AI_Definition(SCR: "Proc_StringRemoveChar", EN: "TEXT_RemoveChar", FR: "TEXT_RetireCaractere")] StringRemoveChar, + [AI_Definition(SCR: "Proc_ChangeLanguage", EN: "TEXT_ChangeLanguage", FR: "TEXT_ChangeLangueCourante")] ChangeLanguage, + [AI_Definition(SCR: "Proc_IntToText", EN: "TEXT_IntToText", FR: "TEXT_EntierEnTexte")] IntToText, + + + //******************************************************************************************************************************************************************************************************************************************************** + // Meca + [AI_Definition(SCR: "Proc_SetMechanicAnimation", EN: "MEC_SetMechanicAnimation", FR: "MEC_ActiveAnimation")] SetMechanicAnimation, + [AI_Definition(SCR: "Proc_SetMechanicCollide", EN: "MEC_SetMechanicCollide", FR: "MEC_ActiveCollision")] SetMechanicCollide, + [AI_Definition(SCR: "Proc_SetMechanicGravity", EN: "MEC_SetMechanicGravity", FR: "MEC_ActiveGravite")] SetMechanicGravity, + [AI_Definition(SCR: "Proc_SetMechanicTilt", EN: "MEC_SetMechanicTilt", FR: "MEC_ActiveTilt")] SetMechanicTilt, + [AI_Definition(SCR: "Proc_SetMechanicGI", EN: "MEC_SetMechanicGI", FR: "MEC_ActiveGi")] SetMechanicGi, + [AI_Definition(SCR: "Proc_SetMechanicClimb", EN: "MEC_SetMechanicClimb", FR: "MEC_ActiveVarappe")] SetMechanicClimb, + [AI_Definition(SCR: "Proc_SetMechanicOnGround", EN: "MEC_SetMechanicOnGround", FR: "MEC_ActivePlaqueAuSol")] SetMechanicOnGround, + [AI_Definition(SCR: "Proc_SetMechanicSpider", EN: "MEC_SetMechanicSpider", FR: "MEC_ActiveAraignee")] SetMechanicSpider, + [AI_Definition(SCR: "Proc_SetMechanicShoot", EN: "MEC_SetMechanicShoot", FR: "MEC_ActiveShoot")] SetMechanicShoot, + [AI_Definition(SCR: "Proc_SetMechanicSwim", EN: "MEC_SetMechanicSwim", FR: "MEC_ActiveNage")] SetMechanicSwim, + [AI_Definition(SCR: "Proc_SetMechanicNeverFall", EN: "MEC_SetMechanicNeverFall", FR: "MEC_ActiveNeTombePas")] SetMechanicNeverFall, + [AI_Definition(SCR: "Proc_ResetMechanicNewMechanic", EN: "MEC_ResetMechanicNewMechanic", FR: "MEC_DesactiveNouvelleMecanique")] SetMechanicNewMechanic, + [AI_Definition(SCR: "Proc_SetMechanicCollisionControl", EN: "MEC_SetMechanicCollisionControl", FR: "MEC_ControleCollision")] SetMechanicCollisionControl, + [AI_Definition(SCR: "Proc_SetMechanicKeepSpeedZ", EN: "MEC_SetMechanicKeepSpeedZ", FR: "MEC_ConserveVitesseZ")] SetMechanicKeepSpeedZ, + [AI_Definition(SCR: "Proc_SetMechanicSpeedLimit", EN: "MEC_SetMechanicSpeedLimit", FR: "MEC_ActiveLimiteVitesse")] SetMechanicSpeedLimit, + [AI_Definition(SCR: "Proc_SetMechanicInertia", EN: "MEC_SetMechanicInertia", FR: "MEC_ActiveInertie")] SetMechanicInertia, + [AI_Definition(SCR: "Proc_SetMechanicStream", EN: "MEC_SetMechanicStream", FR: "MEC_ActiveFlux")] SetMechanicStream, + [AI_Definition(SCR: "Proc_SetMechanicStickOnPlatform", EN: "MEC_SetMechanicStickOnPlatform", FR: "MEC_ActiveCollerAuxPlateformes")] SetMechanicStickOnPlatform, + [AI_Definition(SCR: "Proc_SetMechanicScale", EN: "MEC_SetMechanicScale", FR: "MEC_ActiveScale")] SetMechanicScale, + [AI_Definition(SCR: "Proc_SetMechanicGravityFactor", EN: "MEC_SetMechanicGravityFactor", FR: "MEC_FixeGravite")] SetMechanicGravityFactor, + [AI_Definition(SCR: "Proc_SetMechanicSlide", EN: "MEC_SetMechanicSlide", FR: "MEC_FixeGlissement")] SetMechanicSlide, + [AI_Definition(SCR: "Proc_SetMechanicMaxRebound", EN: "MEC_SetMechanicMaxRebound", FR: "MEC_FixeRebond")] SetMechanicRebound, + [AI_Definition(SCR: "Proc_SetMechanicSlopeLimit", EN: "MEC_SetMechanicSlopeLimit", FR: "MEC_FixeLimitePente")] SetMechanicSlopeLimit, + [AI_Definition(SCR: "Proc_SetMechanicInertiaX", EN: "MEC_SetMechanicInertiaX", FR: "MEC_FixeInertieX")] SetMechanicInertiaX, + [AI_Definition(SCR: "Proc_SetMechanicInertiaY", EN: "MEC_SetMechanicInertiaY", FR: "MEC_FixeInertieY")] SetMechanicInertiaY, + [AI_Definition(SCR: "Proc_SetMechanicInertiaZ", EN: "MEC_SetMechanicInertiaZ", FR: "MEC_FixeInertieZ")] SetMechanicInertiaZ, + [AI_Definition(SCR: "Proc_SetMechanicInertiaXYZ", EN: "MEC_SetMechanicInertiaXYZ", FR: "MEC_FixeInertie")] SetMechanicInertiaXYZ, + [AI_Definition(SCR: "Proc_SetMechanicTiltIntensity", EN: "MEC_SetMechanicTiltIntensity", FR: "MEC_FixeIntensiteTilt")] SetMechanicTiltIntensity, + [AI_Definition(SCR: "Proc_SetMechanicTiltInertia", EN: "MEC_SetMechanicTiltInertia", FR: "MEC_FixeInertieTilt")] SetMechanicTiltInertia, + [AI_Definition(SCR: "Proc_SetMechanicTiltOrigin", EN: "MEC_SetMechanicTiltOrigin", FR: "MEC_FixeOrigineTilt")] SetMechanicTiltOrigin, + [AI_Definition(SCR: "Proc_SetMechanicSpeedMax", EN: "MEC_SetMechanicSpeedMax", FR: "MEC_FixeVitesseMax")] SetMechanicSpeedMax, + [AI_Definition(SCR: "Proc_SetMechanicStreamPriority", EN: "MEC_SetMechanicStreamPriority", FR: "MEC_FixePrioriteFlux")] SetMechanicStreamPriority, + [AI_Definition(SCR: "Proc_SetMechanicStreamSpeed", EN: "MEC_SetMechanicStreamSpeed", FR: "MEC_FixeVitesseFlux")] SetMechanicStreamSpeed, + [AI_Definition(SCR: "Proc_SetMechanicStreamFactor", EN: "MEC_SetMechanicStreamFactor", FR: "MEC_FixeFacteurDeFlux")] SetMechanicStreamFactor, + [AI_Definition(SCR: "Proc_AddMechanicStreamSpeed", EN: "MEC_AddMechanicStreamSpeed", FR: "MEC_AjouteVitesseFlux")] AddMechanicStreamSpeed, + [AI_Definition(SCR: "Proc_AddMechanicStreamSpeedList", EN: "MEC_AddMechanicStreamSpeedList", FR: "MEC_AjouteVitesseFluxListe")] AddMechanicStreamSpeedList, + // limit + [AI_Definition(SCR: "Proc_MoveLimit", EN: "MEC_MoveLimit", FR: "MEC_LimiteDeplacement")] MoveLimit, + [AI_Definition(SCR: "Proc_MoveLimitX", EN: "MEC_MoveLimitX", FR: "MEC_LimiteDeplacementX")] MoveLimitX, + [AI_Definition(SCR: "Proc_MoveLimitY", EN: "MEC_MoveLimitY", FR: "MEC_LimiteDeplacementY")] MoveLimitY, + [AI_Definition(SCR: "Proc_MoveLimitZ", EN: "MEC_MoveLimitZ", FR: "MEC_LimiteDeplacementZ")] MoveLimitZ, + [AI_Definition(SCR: "Proc_MoveLimitXYZ", EN: "MEC_MoveLimitXYZ", FR: "MEC_LimiteDeplacementXYZ")] MoveLimitXYZ, + // stop limit + [AI_Definition(SCR: "Proc_StopMoveLimitX", EN: "MEC_StopMoveLimitX", FR: "MEC_StopLimiteDeplacementX")] StopMoveLimitX, + [AI_Definition(SCR: "Proc_StopMoveLimitY", EN: "MEC_StopMoveLimitY", FR: "MEC_StopLimiteDeplacementY")] StopMoveLimitY, + [AI_Definition(SCR: "Proc_StopMoveLimitZ", EN: "MEC_StopMoveLimitZ", FR: "MEC_StopLimiteDeplacementZ")] StopMoveLimitZ, + [AI_Definition(SCR: "Proc_StopMoveLimitXYZ", EN: "MEC_StopMoveLimitXYZ", FR: "MEC_StopLimiteDeplacementXYZ")] StopMoveLimitXYZ, + // platform + [AI_Definition(SCR: "Proc_SetPlatformLink", EN: "MEC_SetPlatformLink", FR: "MEC_ForceLienPlateforme")] SetPlatformLink, + [AI_Definition(SCR: "Proc_FreePlatformLink", EN: "MEC_FreePlatformLink", FR: "MEC_LibereLienPlateforme")] FreePlatformLink, + // Scale + [AI_Definition(SCR: "Proc_SetScale", EN: "MEC_SetScale", FR: "MEC_FixeScale")] MecSetScale, + // Slide coeff + [AI_Definition(SCR: "Proc_SetSlideFactorXYZ", EN: "MEC_SetSlideFactorXYZ", FR: "MEC_FixeCoefDeGlisseXYZ")] MecSetSlideFactorXYZ, + [AI_Definition(SCR: "Proc_SetSlideFactorX", EN: "MEC_SetSlideFactorX", FR: "MEC_FixeCoefDeGlisseX")] MecSetSlideFactorX, + [AI_Definition(SCR: "Proc_SetSlideFactorY", EN: "MEC_SetSlideFactorY", FR: "MEC_FixeCoefDeGlisseY")] MecSetSlideFactorY, + [AI_Definition(SCR: "Proc_SetSlideFactorZ", EN: "MEC_SetSlideFactorZ", FR: "MEC_FixeCoefDeGlisseZ")] MecSetSlideFactorZ, + [AI_Definition(SCR: "Proc_SetClimbSpeedLimit", EN: "MEC_SetClimbSpeedLimit", FR: "MEC_FixeLimiteVitesseVarappe")] MecSetClimbSpeedLimit, + + [AI_Definition(SCR: "Proc_SetHangingLimit", EN: "MEC_SetHangingLimit", FR: "MEC_ActiveMecaAccrochage")] MecSetHangingLimit, + [AI_Definition(SCR: "Proc_SetHangingOff", EN: "MEC_SetHangingOff", FR: "MEC_DesactiveMecaAccrochage")] MecSetHangingOff, + + // These two are not in Rayman_Z U64 + [AI_Definition(SCR: "Proc_SetBaseCoeff", EN: "MEC_SetBaseCoef", FR: "MEC_FixeCoeffSaut")] MecSetBaseCoeff, + [AI_Definition(SCR: "Proc_SetWalkCoeff", EN: "MEC_SetWalkCoeff", FR: "MEC_FixeCoeffMarche")] MecSetWalkCoeff, + + //******************************************************************************************************************************************************************************************************************************************************** + // Hierarchy - Platform + [AI_Definition(SCR: "Proc_HierSetFather", EN: "HIER_SetFather", FR: "HIER_ForcePere")] HierSetFather, + [AI_Definition(SCR: "Proc_HierFreeFather", EN: "HIER_FreeFather", FR: "HIER_LiberePere")] HierFreeFather, + [AI_Definition(SCR: "Proc_HierListOfSon", EN: "HIER_ListOfSon", FR: "HIER_MesFils")] HierListOfSon, + [AI_Definition(SCR: "Proc_HierSetPlatformType", EN: "HIER_SetPlatformType", FR: "HIER_ForceTypePlateforme")] HierSetPlatformType, + [AI_Definition(SCR: "Proc_HierLinkControl", EN: "HIER_LinkControl", FR: "HIER_ControlePlatforme")] HierControlLink, + [AI_Definition(SCR: "Proc_HierFreezeEngine", EN: "HIER_FreezeEngine", FR: "HIER_GeleMoteur")] HierFreezeEngine, + //******************************************************************************************************************************************************************************************************************************************************** + [AI_Definition(SCR: "Proc_FixePositionZDM", EN: "ZON_SetPositionZDM", FR: "ZON_FixePositionZDM")] FixePositionZDM, + [AI_Definition(SCR: "Proc_FixePositionZDD", EN: "ZON_SetPositionZDD", FR: "ZON_FixePositionZDD")] FixePositionZDD, + [AI_Definition(SCR: "Proc_FixePositionZDE", EN: "ZON_SetPositionZDE", FR: "ZON_FixePositionZDE")] FixePositionZDE, + //******************************************************************************************************************************************************************************************************************************************************** + [AI_Definition(SCR: "Proc_ChangeLightIntensity", EN: "LIGHT_ChangeLightIntensity", FR: "LUM_ChangerIntensiteLumineuse")] ChangeLightIntensity, + //******************************************************************************************************************************************************************************************************************************************************** + [AI_Definition(SCR: "Proc_SPO_ChangeFlag", EN: "SPO_ChangeFlag", FR: "SPO_ChangeFlag")] SPO_ChangeFlag, + [AI_Definition(SCR: "ACT_ChangeSpoFlag", EN: "ACT_ChangeSpoFlag", FR: "ACT_ChangeSpoFlag")] ActChangeSpoFlag, + //******************************************************************************************************************************************************************************************************************************************************** + [AI_Definition(SCR: "Proc_EcranChangeTaille", EN: "SCREEN_ChangeSize", FR: "Ecran_ChangeTaille")] ChangeScreenSize, + [AI_Definition(SCR: "Proc_EcranChangeClip", EN: "SCREEN_ChangeClip", FR: "Ecran_ChangeClip")] ChangeScreenClip, + [AI_Definition(SCR: "Proc_EcranChangePos", EN: "SCREEN_ChangePos", FR: "Ecran_ChangePos")] ChangeScreenPos, + [AI_Definition(SCR: "Proc_EcranChangePosPercent", EN: "SCREEN_ChangePosPercent", FR: "Ecran_ChangePosPercent")] ChangeScreenPosPercent, + [AI_Definition(SCR: "Proc_EcranChangeRatio", EN: "SCREEN_ChangeProportion", FR: "Ecran_ChangeRatio")] ChangeScreenRatio, + //******************************************************************************************************************************************************************************************************************************************************** + [AI_Definition(SCR: "Proc_OMBREAffichage", EN: "SHADOW_Display", FR: "OMBRE_Affichage")] DisplayShadow, + [AI_Definition(SCR: "Proc_OMBREChangeHauteur", EN: "SHADOW_ChangeHeight", FR: "OMBRE_ChangeHauteur")] ChangeShadowHeight, + [AI_Definition(SCR: "Proc_OMBREChangeVecteurProjection", EN: "SHADOW_ChangeVectorProjection", FR: "OMBRE_ChangeVecteurProjection")] ChangeShadowVector, + //******************************************************************************************************************************************************************************************************************************************************** + [AI_Definition(SCR: "Proc_ForceActivationZDD", EN: "ZON_ForceActivationZDD", FR: "ZON_ForceActivationZDD")] ForceActivationZDD, + [AI_Definition(SCR: "Proc_ForceActivationZDM", EN: "ZON_ForceActivationZDM", FR: "ZON_ForceActivationZDM")] ForceActivationZDM, + [AI_Definition(SCR: "Proc_ForceActivationZDE", EN: "ZON_ForceActivationZDE", FR: "ZON_ForceActivationZDE")] ForceActivationZDE, + [AI_Definition(SCR: "Proc_ForceActivationZDR", EN: "ZON_ForceActivationZDR", FR: "ZON_ForceActivationZDR")] ForceActivationZDR, + [AI_Definition(SCR: "Proc_ForceDesactivationZDD", EN: "ZON_ForceDesactivationZDD", FR: "ZON_ForceDesactivationZDD")] ForceDesactivationZDD, + [AI_Definition(SCR: "Proc_ForceDesactivationZDM", EN: "ZON_ForceDesactivationZDM", FR: "ZON_ForceDesactivationZDM")] ForceDesactivationZDM, + [AI_Definition(SCR: "Proc_ForceDesactivationZDE", EN: "ZON_ForceDesactivationZDE", FR: "ZON_ForceDesactivationZDE")] ForceDesactivationZDE, + [AI_Definition(SCR: "Proc_ForceDesactivationZDR", EN: "ZON_ForceDesactivationZDR", FR: "ZON_ForceDesactivationZDR")] ForceDesactivationZDR, + [AI_Definition(SCR: "Proc_LibereActivationZDD", EN: "ZON_ReleaseActivationZDD", FR: "ZON_LibereActivationZDD")] LibereActivationZDD, + [AI_Definition(SCR: "Proc_LibereActivationZDM", EN: "ZON_ReleaseActivationZDM", FR: "ZON_LibereActivationZDM")] LibereActivationZDM, + [AI_Definition(SCR: "Proc_LibereActivationZDE", EN: "ZON_ReleaseActivationZDE", FR: "ZON_LibereActivationZDE")] LibereActivationZDE, + [AI_Definition(SCR: "Proc_LibereActivationZDR", EN: "ZON_ReleaseActivationZDR", FR: "ZON_LibereActivationZDR")] LibereActivationZDR, + [AI_Definition(SCR: "Proc_ActiveZDR", EN: "ZON_ActiveZDR", FR: "ZON_ActiveZDR")] ActiveZDR, + //******************************************************************************************************************************************************************************************************************************************************** + // Collision Flags and Computing collisions frequency + [AI_Definition(SCR: "Proc_SetNoColWithMap", EN: "ACT_SetNoColWithMap", FR: "ACT_FixePasDeCollisionAvecMap")] SetNoCollisionWithMap, + [AI_Definition(SCR: "Proc_SetNoColWithProjectile", EN: "ACT_SetNoColWithProjectile", FR: "ACT_FixePasDeCollisionAvecProjectiles")] SetNoCollisionWithProjectile, + [AI_Definition(SCR: "Proc_SetNoColWithSeconfCharact", EN: "ACT_SetNoColWithSeconfCharact", FR: "ACT_FixePasDeCollisionAvecActeursSecondaires")] SetNoCollisionWithSecondCharact, + [AI_Definition(SCR: "Proc_SetNoColWithMainCharact", EN: "ACT_SetNoColWithMainCharact", FR: "ACT_FixePasDeCollisionAvecActeurPrincipal")] SetNoCollisionWithMainCharact, + [AI_Definition(SCR: "Proc_SetNoColWithOtherSectors", EN: "ACT_SetNoColWithOtherSectors", FR: "ACT_FixePasDeCollisionAvecAutresSecteurs")] SetNoCollisionWithOtherSectors, + [AI_Definition(SCR: "Proc_SetNoColZdeWithProjectile", EN: "ACT_SetNoColZdeWithProjectile", FR: "ACT_FixePasDeCollisionZdeAvecProjectiles")] SetNoCollisionZdeWithProjectile, + [AI_Definition(SCR: "Proc_SetCollComputeFreq", EN: "ACT_SetCollComputeFreq", FR: "ACT_FixeFrequenceCalculCollisions")] SetCollComputeFrequency, + [AI_Definition(SCR: "Proc_SetBrainComputeFreq", EN: "ACT_SetBrainComputeFreq", FR: "ACT_FixeFrequenceCalculIA")] SetBrainComputeFrequency, + [AI_Definition(SCR: "Proc_SetLightComputeFreq", EN: "ACT_SetLightComputeFreq", FR: "ACT_FixeFrequenceCalculLumieres")] SetLightComputeFrequency, + //******************************************************************************************************************************************************************************************************************************************************** + // map exits management for world map update + [AI_Definition(SCR: "Proc_SetUsedExitIdentifier", EN: "MAP_SetUsedExitIdentifier", FR: "MAP_IndiqueLaSortieUtilisee")] SetUsedExitIdentifier, + [AI_Definition(SCR: "Proc_GetUsedExitIdentifier", EN: "MAP_GetUsedExitIdentifier", FR: "MAP_LitLaSortieUtilisee")] GetUsedExitIdentifier, + [AI_Definition(SCR: "eProc_SetGlobalCounter", EN: "MAP_SetGlobalCounter", FR: "MAP_ChangeCompteurGlobal")] SetGlobalCounter, + //******************************************************************************************************************************************************************************************************************************************************** + [AI_Definition(SCR: "PAD_ReadAnalogJoystickMarioMode", EN: "PAD_ReadAnalogJoystickMarioMode", FR: "PAD_LitJoyAnalogiqueModeMario")] ReadAnalogJoystick, + [AI_Definition(SCR: "PAD_InitAnalogJoystickAxes", EN: "PAD_InitAnalogJoystickAxes", FR: "PAD_JoyAnalogiqueFixeAxes")] SetAnalogJoystickAxes, + [AI_Definition(SCR: "Proc_SetPadReadingDsgvars", EN: "PAD_SetPadReadingDsgvars", FR: "PAD_FixeVariablesDeLecture")] SetPadReadingDsgvars, + [AI_Definition(SCR: "Proc_CancelKeyboardInertia", EN: "PAD_CancelKeyboardInertia", FR: "PAD_AnnuleInertieClavier")] CancelKeyboardInertia, + [AI_Definition(SCR: "Proc_GetPadCalibration", EN: "PAD_GetPadCalibration", FR: "PAD_LitCalibration")] GetPadCalibration, + [AI_Definition(SCR: "Proc_SetPadCalibration", EN: "PAD_SetPadCalibration", FR: "PAD_ChangeCalibration")] SetPadCalibration, + //******************************************************************************************************************************************************************************************************************************************************** + [AI_Definition(SCR: "ACT_SetBooleanInArray", EN: "ACT_SetBooleanInArray", FR: "ACT_FixeBooleenDansTableau")] SetBooleanInArray, + //******************************************************************************************************************************************************************************************************************************************************** + [AI_Definition(SCR: "TEXT_SetDefaultFormatCharacter", EN: "TEXT_SetDefaultFormatCharacter", FR: "TEXT_SetDefaultFormatCharacter")] SetDefaultFormatCharacter, + //******************************************************************************************************************************************************************************************************************************************************** + [AI_Definition(SCR: "VID_SelectDriver", EN: "VID_SelectDriver", FR: "VID_SelectDriver")] SelectDriver, + + [AI_Definition(SCR: "Proc_SelectShapnessMax", EN: "VID_SelectShapnessMax", FR: "VID_SelectShapnessMax")] SelectShapnessMax, + [AI_Definition(SCR: "Proc_CenterScreen", EN: "VID_CenterScreen", FR: "VID_CenterScreen")] CenterScreen, + + + //******************************************************************************************************************************************************************************************************************************************************** + [AI_Definition(SCR: "VID_SelectResolution", EN: "VID_SelectResolution", FR: "VID_SelectResolution")] SelectResolution, + //******************************************************************************************************************************************************************************************************************************************************** + [AI_Definition(SCR: "VID_ChangeBrightness", EN: "VID_ChangeBrightness", FR: "VID_ChangeBrightness")] ChangeBrightness, + //******************************************************************************************************************************************************************************************************************************************************** + [AI_Definition(SCR: "TEXT_IntegerParameter", EN: "TEXT_IntegerParameter", FR: "TEXT_ParametreEntier")] TexteEntier, + [AI_Definition(SCR: "TEXT_RealParameter", EN: "TEXT_RealParameter", FR: "TEXT_ParametreReel")] TexteReel, + //******************************************************************************************************************************************************************************************************************************************************** + [AI_Definition(SCR: "VID_SetTextureFiltering", EN: "VID_SetTextureFiltering", FR: "VID_SetTextureFiltering")] SetTextureFiltering, + [AI_Definition(SCR: "VID_SetAntiAliasing", EN: "VID_SetAntiAliasing", FR: "VID_SetAntiAliasing")] SetAntiAliasing, + //******************************************************************************************************************************************************************************************************************************************************** + [AI_Definition(SCR: "SOUND_SetInStereoMode", EN: "SOUND_SetInStereoMode", FR: "SOUND_SetInStereoMode")] SetInStereoMode, + [AI_Definition(SCR: "Proc_SetSaturationBackGroundDistance", EN: "ACT_SetSaturationBackGroundDistance", FR: "ACT_FixeDistanceSaturationBackGround")] SetSaturationBackGroundDistance, + [AI_Definition(SCR: "Proc_SaveCurrentRequest", EN: "SOUND_SaveCurrentRequest", FR: "SOUND_SauveRequeteCourante")] SaveSoundEventInSlotMemory, + [AI_Definition(SCR: "Proc_RestoreRequest", EN: "SOUND_RestoreRequest", FR: "SOUND_RestaureRequete")] RestoreSoundEventInSlotMemory, + + [AI_Definition(SCR: "Proc_DrawSegment", EN: "DEBUG_DrawSegment", FR: "DEBUG_DessineSegment")] DrawSegment, + [AI_Definition(SCR: "Proc_UpdateChecksum", EN: "ACT_UpdateChecksum", FR: "ACT_MetAJourChecksum")] UpdateChecksum, + [AI_Definition(SCR: "Proc_ShellExecute", EN: "ShellExecute", FR: "ShellExecute")] ShellExecute, + + [AI_Definition(SCR: "Proc_ForceVerticalUsingX", EN: "ACT_ForceVerticalUsingX", FR: "ACT_ForceVerticalUsingX")] ForceVerticalUsingX, + [AI_Definition(SCR: "Proc_ForceVerticalUsingY", EN: "ACT_ForceVerticalUsingY", FR: "ACT_ForceVerticalUsingY")] ForceVerticalUsingY, + #endregion + + #region DefProCa + [AI_Definition(SCR: "Proc_Cam_UpdatePosition", EN: "Cam_UpdatePosition", FR: "Cam_UpdatePosition")] Cam_UpdatePosition, + [AI_Definition(SCR: "Proc_Cam_ChangeShiftTarget", EN: "Cam_ChangeShiftTarget", FR: "Cam_ChangeShiftTarget")] Cam_ChangeShiftTarget, + [AI_Definition(SCR: "Proc_Cam_ChangeShiftPos", EN: "Cam_ChangeShiftPos", FR: "Cam_ChangeShiftPos")] Cam_ChangeShiftPos, + [AI_Definition(SCR: "Proc_Cam_ChangeDistMin", EN: "Cam_ChangeDistMin", FR: "Cam_ChangeDistMin")] Cam_ChangeDistMin, + [AI_Definition(SCR: "Proc_Cam_ChangeDistMax", EN: "Cam_ChangeDistMax", FR: "Cam_ChangeDistMax")] Cam_ChangeDistMax, + [AI_Definition(SCR: "Proc_Cam_ChangeBoundDistMin", EN: "Cam_ChangeBoundDistMin", FR: "Cam_ChangeBoundDistMin")] Cam_ChangeBoundDistMin, + [AI_Definition(SCR: "Proc_Cam_ChangeBoundDistMax", EN: "Cam_ChangeBoundDistMax", FR: "Cam_ChangeBoundDistMax")] Cam_ChangeBoundDistMax, + [AI_Definition(SCR: "Proc_Cam_ChangeAngleAlpha", EN: "Cam_ChangeAngleAlpha", FR: "Cam_ChangeAngleAlpha")] Cam_ChangeAngleAlpha, + [AI_Definition(SCR: "Proc_Cam_ChangeAngleShiftAlpha", EN: "Cam_ChangeAngleShiftAlpha", FR: "Cam_ChangeAngleShiftAlpha")] Cam_ChangeAngleShiftAlpha, + [AI_Definition(SCR: "Proc_Cam_ChangeAngleTheta", EN: "Cam_ChangeAngleTheta", FR: "Cam_ChangeAngleTheta")] Cam_ChangeAngleTheta, + [AI_Definition(SCR: "Proc_Cam_ChangeAngleShiftTheta", EN: "Cam_ChangeAngleShiftTheta", FR: "Cam_ChangeAngleShiftTheta")] Cam_ChangeAngleShiftTheta, + [AI_Definition(SCR: "Proc_Cam_ChangeLinearSpeed", EN: "Cam_ChangeLinearSpeed", FR: "Cam_ChangeLinearSpeed")] Cam_ChangeLinearSpeed, + [AI_Definition(SCR: "Proc_Cam_ChangeLinearIncreaseSpeed", EN: "Cam_ChangeLinearIncreaseSpeed", FR: "Cam_ChangeLinearIncreaseSpeed")] Cam_ChangeLinearIncreaseSpeed, + [AI_Definition(SCR: "Proc_Cam_ChangeLinearDecreaseSpeed", EN: "Cam_ChangeLinearDecreaseSpeed", FR: "Cam_ChangeLinearDecreaseSpeed")] Cam_ChangeLinearDecreaseSpeed, + [AI_Definition(SCR: "Proc_Cam_ChangeAngularSpeed", EN: "Cam_ChangeAngularSpeed", FR: "Cam_ChangeAngularSpeed")] Cam_ChangeAngularSpeed, + [AI_Definition(SCR: "Proc_Cam_ChangeAngularIncreaseSpeed", EN: "Cam_ChangeAngularIncreaseSpeed", FR: "Cam_ChangeAngularIncreaseSpeed")] Cam_ChangeAngularIncreaseSpeed, + [AI_Definition(SCR: "Proc_Cam_ChangeAngularDecreaseSpeed", EN: "Cam_ChangeAngularDecreaseSpeed", FR: "Cam_ChangeAngularDecreaseSpeed")] Cam_ChangeAngularDecreaseSpeed, + [AI_Definition(SCR: "Proc_Cam_ChangeTargetSpeed", EN: "Cam_ChangeTargetSpeed", FR: "Cam_ChangeTargetSpeed")] Cam_ChangeTargetSpeed, + [AI_Definition(SCR: "Proc_Cam_ChangeTargetIncreaseSpeed", EN: "Cam_ChangeTargetIncreaseSpeed", FR: "Cam_ChangeTargetIncreaseSpeed")] Cam_ChangeTargetIncreaseSpeed, + [AI_Definition(SCR: "Proc_Cam_ChangeTargetDecreaseSpeed", EN: "Cam_ChangeTargetDecreaseSpeed", FR: "Cam_ChangeTargetDecreaseSpeed")] Cam_ChangeTargetDecreaseSpeed, + [AI_Definition(SCR: "Proc_Cam_ChangeFocal", EN: "Cam_ChangeFocal", FR: "Cam_ChangeFocal")] Cam_ChangeFocal, + [AI_Definition(SCR: "Proc_Cam_ChangeZMin", EN: "Cam_ChangeZMin", FR: "Cam_ChangeZMin")] Cam_ChangeZMin, + [AI_Definition(SCR: "Proc_Cam_ChangeZMax", EN: "Cam_ChangeZMax", FR: "Cam_ChangeZMax")] Cam_ChangeZMax, + + [AI_Definition(SCR: "Proc_Cam_ChangeTgtPerso", EN: "Cam_ChangeTgtPerso", FR: "Cam_ChangeTgtPerso")] Cam_ChangeTgtPerso, + [AI_Definition(SCR: "Proc_Cam_ChangeSecondTgtPerso", EN: "Cam_ChangeSecondTgtPerso", FR: "Cam_ChangeSecondTgtPerso")] Cam_ChangeSecondTgtPerso, + [AI_Definition(SCR: "Proc_Cam_ChangeChannel", EN: "Cam_ChangeChannel", FR: "Cam_ChangeChannel")] Cam_ChangeChannel, + + [AI_Definition(SCR: "Proc_Cam_Activate", EN: "Cam_Activate", FR: "Cam_Activate")] Cam_Activate, + [AI_Definition(SCR: "Proc_Cam_AssociateViewport", EN: "Cam_AssociateViewport", FR: "Cam_AssociateViewport")] Cam_AssociateViewport, + + [AI_Definition(SCR: "Proc_Cam_ResetIAFlags", EN: "Cam_ResetIAFlags", FR: "Cam_ResetIAFlags")] Cam_ResetIAFlags, + [AI_Definition(SCR: "Proc_Cam_SetFlagNoDynamicTarget", EN: "Cam_SetFlagNoDynamicTarget", FR: "Cam_SetFlagNoDynamicTarget")] Cam_SetFlagNoDynamicTarget, + [AI_Definition(SCR: "Proc_Cam_SetFlagNoAverageMoveTgtPerso", EN: "Cam_SetFlagNoAverageMoveTgtPerso", FR: "Cam_SetFlagNoAverageMoveTgtPerso")] Cam_SetFlagNoAverageMoveTgtPerso, + [AI_Definition(SCR: "Proc_Cam_SetFlagNoParseCutAngle", EN: "Cam_SetFlagNoParseCutAngle", FR: "Cam_SetFlagNoParseCutAngle")] Cam_SetFlagNoParseCutAngle, + [AI_Definition(SCR: "Proc_Cam_SetFlagNoVisibility", EN: "Cam_SetFlagNoVisibility", FR: "Cam_SetFlagNoVisibility")] Cam_SetFlagNoVisibility, + [AI_Definition(SCR: "Proc_Cam_SetFlagNoVisibilityWithDynHie", EN: "Cam_SetFlagNoVisibilityWithDynHie", FR: "Cam_SetFlagNoVisibilityWithDynHie")] Cam_SetFlagNoVisibilityWithDynHie, + [AI_Definition(SCR: "Proc_Cam_SetFlagNoDynChangeTheta", EN: "Cam_SetFlagNoDynChangeTheta", FR: "Cam_SetFlagNoDynChangeTheta")] Cam_SetFlagNoDynChangeTheta, + [AI_Definition(SCR: "Proc_Cam_SetFlagNoShiftUntilPosReached", EN: "Cam_SetFlagNoShiftUntilPosReached", FR: "Cam_SetFlagNoShiftUntilPosReached")] Cam_SetFlagNoShiftUntilPosReached, + [AI_Definition(SCR: "Proc_Cam_SetFlagNoDynSpeed", EN: "Cam_SetFlagNoDynSpeed", FR: "Cam_SetFlagNoDynSpeed")] Cam_SetFlagNoDynSpeed, + + [AI_Definition(SCR: "Proc_Cam_ResetDNMFlags", EN: "Cam_ResetDNMFlags", FR: "Cam_ResetDNMFlags")] Cam_ResetDNMFlags, + [AI_Definition(SCR: "Proc_Cam_SetFlagNoLinearParsing", EN: "Cam_SetFlagNoLinearParsing", FR: "Cam_SetFlagNoLinearParsing")] Cam_SetFlagNoLinearParsing, + [AI_Definition(SCR: "Proc_Cam_SetFlagNoLinearInertia", EN: "Cam_SetFlagNoLinearInertia", FR: "Cam_SetFlagNoLinearInertia")] Cam_SetFlagNoLinearInertia, + [AI_Definition(SCR: "Proc_Cam_SetFlagNoAngularParsing", EN: "Cam_SetFlagNoAngularParsing", FR: "Cam_SetFlagNoAngularParsing")] Cam_SetFlagNoAngularParsing, + [AI_Definition(SCR: "Proc_Cam_SetFlagNoAngularInertia", EN: "Cam_SetFlagNoAngularInertia", FR: "Cam_SetFlagNoAngularInertia")] Cam_SetFlagNoAngularInertia, + [AI_Definition(SCR: "Proc_Cam_SetFlagNoTargetParsing", EN: "Cam_SetFlagNoTargetParsing", FR: "Cam_SetFlagNoTargetParsing")] Cam_SetFlagNoTargetParsing, + [AI_Definition(SCR: "Proc_Cam_SetFlagNoTargetInertia", EN: "Cam_SetFlagNoTargetInertia", FR: "Cam_SetFlagNoTargetInertia")] Cam_SetFlagNoTargetInertia, + [AI_Definition(SCR: "Proc_Cam_SetFlagFixedOrientation", EN: "Cam_SetFlagFixedOrientation", FR: "Cam_SetFlagFixedOrientation")] Cam_SetFlagFixedOrientation, + [AI_Definition(SCR: "Proc_Cam_SetFlagNoObstacle", EN: "Cam_SetFlagNoObstacle", FR: "Cam_SetFlagNoObstacle")] Cam_SetFlagNoObstacle, + [AI_Definition(SCR: "Proc_Cam_SetFlagNoCollisionWhenNotMoving", EN: "Cam_SetFlagNoCollisionWhenNotMoving", FR: "Cam_SetFlagNoCollisionWhenNotMoving")] Cam_SetFlagNoCollisionWhenNotMoving, + + [AI_Definition(SCR: "Proc_Cam_ChangeConstants", EN: "Cam_ChangeConstants", FR: "Cam_ChangeConstants")] Cam_ChangeConstants, + [AI_Definition(SCR: "Proc_Cam_SaveConstants", EN: "Cam_SaveConstants", FR: "Cam_SaveConstants")] Cam_SaveConstants, + [AI_Definition(SCR: "Proc_Cam_RestoreConstants", EN: "Cam_RestoreConstants", FR: "Cam_RestoreConstants")] Cam_RestoreConstants, + + [AI_Definition(SCR: "Proc_Cam_ShowInfo", EN: "Cam_ShowInfo", FR: "Cam_ShowInfo")] Cam_ShowInfo, + + [AI_Definition(SCR: "Proc_Cam_ForceTarget", EN: "Cam_ForceTarget", FR: "Cam_ForceTarget")] Cam_ForceTarget, + [AI_Definition(SCR: "Proc_Cam_ForcePosition", EN: "Cam_ForcePosition", FR: "Cam_ForcePosition")] Cam_ForcePosition, + [AI_Definition(SCR: "Proc_Cam_ForceRefAxis", EN: "Cam_ForceRefAxis", FR: "Cam_ForceRefAxis")] Cam_ForceRefAxis, + + [AI_Definition(SCR: "Proc_Cam_Reset", EN: "Cam_Reset", FR: "Cam_Reset")] Cam_Reset, + [AI_Definition(SCR: "Proc_Cam_ForceBestPos", EN: "Cam_ForceBestPos", FR: "Cam_ForceBestPos")] Cam_ForceBestPos, + [AI_Definition(SCR: "Proc_Cam_ForceNormalState", EN: "Cam_ForceNormalState", FR: "Cam_ForceNormalState")] Cam_ForceNormalState, + + + [AI_Definition(SCR: "Proc_Cam_ForceMovingOnRail", EN: "Cam_ForceMovingOnRail", FR: "Cam_ForceMovingOnRail")] Cam_ForceMovingOnRail, + + [AI_Definition(SCR: "Proc_Cam_SetCameraModeForEngine", EN: "Cam_SetCameraModeForEngine", FR: "Cam_ChangeModePourMoteur")] Cam_SetCameraModeForEngine, + #endregion + + #region DefProc part 2 + ///////////////////////////////////////////////////////////////////////////////////////// + // Animations Graphiques Optimisées + ///////////////////////////////////////////////////////////////////////////////////////// + // Generates a simple particle + // Arg 1 = Particle type (int) + // Arg 2 = Position + // Arg 3 = Initial Direction + // Arg 4 = Game Material + // Arg 5 = Optional Real Parameter + [AI_Definition(SCR: "Proc_SetAGO", EN: "SetAGO", FR: "LanceAGO")] LaunchAGO, + // + /////////////////////////////////////////////////////////////////////////////////////////// + + [AI_Definition(SCR: "Proc_ActivateMenuMap", EN: "ActivateMenuMap", FR: "ActiveMenuMap")] SetInGameMenu, + + /////////////////////////////////////////////////////////////////////////////////////////// + // Texts without always + /////////////////////////////////////////////////////////////////////////////////////////// + + [AI_Definition(SCR: "Proc_JffTxt_Affiche", EN: "JFFTXT_Affiche", FR: "JFFTXT_Affiche")] JffTxt_Affiche, + [AI_Definition(SCR: "Proc_JffTxt_Extend", EN: "JFFTXT_Extend", FR: "JFFTXT_Extend")] JffTxt_Extend, + [AI_Definition(SCR: "Proc_JffTxt_Modify", EN: "JFFTXT_Modify", FR: "JFFTXT_Modify")] JffTxt_Modify, + + [AI_Definition(SCR: "Proc_FadeIn", EN: "FADE_FadeIn", FR: "FadeIn")] FadeIn, + [AI_Definition(SCR: "Proc_FadeOut", EN: "FADE_FadeOut", FR: "FadeOut")] FadeOut, + + [AI_Definition(SCR: "Proc_HUD_SetLumsCount", EN: "HUD_SetLumsCount", FR: "HUD_SetLumsCount")] HUD_SetLumsCount, + [AI_Definition(SCR: "Proc_HUD_SetCagesCount", EN: "HUD_SetCagesCount", FR: "HUD_SetCagesCount")] HUD_SetCagesCount, + [AI_Definition(SCR: "Proc_HUD_SetSwimGauge", EN: "HUD_SetSwimGauge", FR: "HUD_SetSwimGauge")] HUD_SetSwimGauge, + [AI_Definition(SCR: "Proc_HUD_SetHealthGauge", EN: "HUD_SetHealthGauge", FR: "HUD_SetHealthGauge")] HUD_SetHealthGauge, + [AI_Definition(SCR: "Proc_HUD_SetEnemyHealthGauge", EN: "HUD_SetEnemyHealthGauge", FR: "HUD_SetEnemyHealthGauge")] HUD_SetEnemyHealthGauge, + + [AI_Definition(SCR: "Proc_DoCheatMenu", EN: "PROC_DoCheatMenu", FR: "PROC_DoCheatMenu")] DoCheatMenu, + [AI_Definition(SCR: "Proc_SetBacklight", EN: "PROC_SetBacklight", FR: "PROC_SetBacklight")] SetBacklight, + + [AI_Definition(SCR: "Proc_BeginAnalogCalibration", EN: "PROC_BeginAnalogCalibration", FR: "PROC_BeginAnalogCalibration")] BeginAnalogCalibration, + [AI_Definition(SCR: "Proc_EndAnalogCalibration", EN: "PROC_EndAnalogCalibration", FR: "PROC_EndAnalogCalibration")] EndAnalogCalibration, + #endregion + + #region ProcRay2 + //******************************************************************************************************************************************************************************************************************************************************** + // Magic points management + [AI_Definition(SCR: "Proc_FixePointsDeMagie", EN: "RAY_SetMagicPoints", FR: "RAY_FixePointsDeMagie")] FixePointsDeMagie, + [AI_Definition(SCR: "Proc_FixePointsDeMagieMax", EN: "RAY_SetMagicPointsMax", FR: "RAY_FixePointsDeMagieMax")] FixePointsDeMagieMax, + [AI_Definition(SCR: "Proc_InitPointsDeMagie", EN: "RAY_InitMagicPoints", FR: "RAY_InitPointsDeMagie")] InitPointsDeMagie, + [AI_Definition(SCR: "Proc_InitPointsDeMagieMax", EN: "RAY_InitMagicPointsMax", FR: "RAY_InitPointsDeMagieMax")] InitPointsDeMagieMax, + [AI_Definition(SCR: "Proc_AddMagicPoints", EN: "RAY_AddMagicPoints", FR: "RAY_AjoutePointsDeMagie")] AjoutePointsDeMagie, + [AI_Definition(SCR: "Proc_AddMagicPointsMax", EN: "RAY_AddMagicPointsMax", FR: "RAY_AjoutePointsDeMagieMax")] AjoutePointsDeMagieMax, + [AI_Definition(SCR: "Proc_SubMagicPoints", EN: "RAY_SubMagicPoints", FR: "RAY_EnlevePointsDeMagie")] EnlevePointsDeMagie, + [AI_Definition(SCR: "Proc_SubMagicPointsMax", EN: "RAY_SubMagicPointsMax", FR: "RAY_EnlevePointsDeMagieMax")] EnlevePointsDeMagieMax, + // Air points management + [AI_Definition(SCR: "Proc_FixePointsDair", EN: "RAY_SetAirPoints", FR: "RAY_FixePointsDair")] FixePointsDair, + [AI_Definition(SCR: "Proc_FixePointsDairMax", EN: "RAY_SetAirPointsMax", FR: "RAY_FixePointsDairMax")] FixePointsDairMax, + [AI_Definition(SCR: "Proc_InitPointsDair", EN: "RAY_InitAirPoints", FR: "RAY_InitPointsDair")] InitPointsDair, + [AI_Definition(SCR: "Proc_InitPointsDairMax", EN: "RAY_InitAirPointsMax", FR: "RAY_InitPointsDairMax")] InitPointsDairMax, + [AI_Definition(SCR: "Proc_AddAirPoints", EN: "RAY_AddAirPoints", FR: "RAY_AjoutePointsDair")] AjoutePointsDair, + [AI_Definition(SCR: "Proc_AddAirPointsMax", EN: "RAY_AddAirPointsMax", FR: "RAY_AjoutePointsDairMax")] AjoutePointsDairMax, + [AI_Definition(SCR: "Proc_SubAirPoints", EN: "RAY_SubAirPoints", FR: "RAY_EnlevePointsDair")] EnlevePointsDair, + [AI_Definition(SCR: "Proc_SubAirPointsMax", EN: "RAY_SubAirPointsMax", FR: "RAY_EnlevePointsDairMax")] EnlevePointsDairMax, + //******************************************************************************************************************************************************************************************************************************************************** + [AI_Definition(SCR: "Proc_FixePositionFade", EN: "FAD_FixePositionFade", FR: "FAD_FixePositionFade")] FixePositionFade, + //******************************************************************************************************************************************************************************************************************************************************** + [AI_Definition(SCR: "Proc_SetLocalPersoLight", EN: "LIGHT_SetLocalPersoLight", FR: "LUM_FixeLumierePersoLocal")] FixeLumierePersoLocal, + [AI_Definition(SCR: "Proc_SetStaticLightOnOff", EN: "LIGHT_SetStaticLightOnOff", FR: "LUM_FixeLumiereStaticOnOff")] FixeLumiereStaticOnOff, + [AI_Definition(SCR: "Proc_SetStaticLightNearFar", EN: "LIGHT_SetStaticLightNearFar", FR: "LUM_FixeLumiereStaticNearFar")] FixeLumiereStaticNearFar, + [AI_Definition(SCR: "Proc_SetStaticLightColor", EN: "LIGHT_SetStaticLightColor", FR: "LUM_FixeLumiereStaticCouleur")] FixeLumiereStaticColor, + [AI_Definition(SCR: "Proc_ComputeLightEffect", EN: "LIGHT_ComputeLightEffect", FR: "LUM_CalculeLumiereEffet")] CalculeLumiereEffet, + // Blend RLI + [AI_Definition(SCR: "Proc_RLIPasDeRLI", EN: "LIGHT_RLIPasDeRLI", FR: "LUM_RLIDesactive")] NoRLI, + [AI_Definition(SCR: "Proc_RLIFixe", EN: "LIGHT_RLIFixe", FR: "LUM_RLIFixe")] FixeRLI, + [AI_Definition(SCR: "Proc_RLIBlend", EN: "LIGHT_RLIBlend", FR: "LUM_RLIBlend")] BlendRLI, + //******************************************************************************************************************************************************************************************************************************************************** + // Type Of WP + [AI_Definition(SCR: "Proc_ChangeTypeOfWP", EN: "NETWORK_ChangeWPType", FR: "Reseau_ChangeTypeDuWP")] ChangeTypeOfWP, + // Capability procedures + [AI_Definition(SCR: "Proc_CAPSSetCapabilities", EN: "CAPS_SetCapabilities", FR: "Caps_FixeCapacites")] SetCapabilities, + [AI_Definition(SCR: "Proc_CAPSAddCapabilities", EN: "CAPS_AddCapabilities", FR: "Caps_AjouteCapacites")] AddCapabilities, + [AI_Definition(SCR: "Proc_CAPSSubCapabilities", EN: "CAPS_SubCapabilities", FR: "Caps_EnleveCapacites")] SubCapabilities, + [AI_Definition(SCR: "Proc_CAPSChangeCapabilities", EN: "CAPS_ChangeCapabilities", FR: "Caps_ChangeCapacites")] ChangeCapabilities, + // Reinit Graph + [AI_Definition(SCR: "Proc_ReinitGraph", EN: "NETWORK_ReinitGraph", FR: "Reseau_ReinitGraph")] ReinitGraph, + + //******************************************************************************************************************************************************************************************************************************************************** + [AI_Definition(SCR: "Proc_SetScrollSpeed", EN: "MAT_SetScrollSpeed", FR: "MAT_FixeVitesseTexture")] FixeVitesseTexture, + [AI_Definition(SCR: "Proc_SetScrollOnOff", EN: "MAT_SetScrollOnOff", FR: "MAT_ScrollingOnOff")] ScrollingOnOff, + [AI_Definition(SCR: "Proc_SetTextureOffset", EN: "MAT_SetTextureOffset", FR: "MAT_FixeDecalageTexture")] FixeDecalageTexture, + [AI_Definition(SCR: "Proc_SetScrollPause", EN: "MAT_SetScrollPause", FR: "MAT_ScrollingPause")] ScrollingPause, + //******************************************************************************************************************************************************************************************************************************************************** + [AI_Definition(SCR: "Proc_ChangeCurrFrame", EN: "ANI_ChangeCurrFrame", FR: "ANI_ChangeFrameCourante")] ChangeCurrFrame, + [AI_Definition(SCR: "Proc_ChangeRandomFrame", EN: "ANI_ChangeRandomFrame", FR: "ANI_ChangeFrameAleatoire")] ChangeRandomFrame, + [AI_Definition(SCR: "Proc_FreezeAnim", EN: "ANI_FreezeAnim", FR: "ANI_GelerPerso")] FreezeAnim, + [AI_Definition(SCR: "Proc_UnFreezeAnim", EN: "ANI_UnFreezeAnim", FR: "ANI_DegelerPerso")] UnFreezeAnim, + //******************************************************************************************************************************************************************************************************************************************************** + [AI_Definition(SCR: "Proc_SetSuperimposed", EN: "SPO_SetSuperimposed", FR: "SPO_SetSuperimposed")] SetSuperimposed, + [AI_Definition(SCR: "Proc_SetSuperimposed2", EN: "SPO_SetSuperimposed2", FR: "SPO_SetSuperimposed2")] SetSuperimposed2, + [AI_Definition(SCR: "Proc_ReleaseSuperimposed", EN: "SPO_ReleaseSuperimposed", FR: "SPO_ReleaseSuperimposed")] ReleaseSuperimposed, + [AI_Definition(SCR: "Proc_SetCoordinates", EN: "SPO_SetCoordinates", FR: "SPO_FixeCoordonnees")] SetSPOCoordinates, + [AI_Definition(SCR: "Proc_SwitchSuperimposedTab", EN: "SPO_SwitchSuperimposedTab", FR: "SPO_SwitchSuperimposedTab")] SwitchSuperimposedTab, + //******************************************************************************************************************************************************************************************************************************************************** + [AI_Definition(SCR: "Proc_ACTsetTractionFactor", EN: "ACT_SetTractionFactor", FR: "ACT_FixeFacteurDeTraction")] SetTractionFactor, + [AI_Definition(SCR: "Proc_TurnToPositionAngle", EN: "ACT_TurnToPositionAngle", FR: "ACT_OrienteVersPositionAngle")] TurnToPositionAngle, + [AI_Definition(SCR: "Proc_TurnToPositionSpeed", EN: "ACT_TurnToPositionSpeed", FR: "ACT_OrienteVersPositionVitesse")] TurnToPositionSpeed, + //******************************************************************************************************************************************************************************************************************************************************** + [AI_Definition(SCR: "Proc_TABSortArray", EN: "ARRAY_Sort", FR: "TAB_Trie")] SortArray, + //******************************************************************************************************************************************************************************************************************************************************** + [AI_Definition(SCR: "Proc_ActiveJoystickAnal", EN: "OPTION_ActiveJoystickAnal", FR: "Option_ActiveJoystickAnalogique")] ActiveJoystickAnal, + [AI_Definition(SCR: "Proc_UnActiveJoystickAnal", EN: "OPTION_UnActiveJoystickAnal", FR: "Option_DesactiveJoystickAnalogique")] UnActiveJoystickAnal, + //******************************************************************************************************************************************************************************************************************************************************** + [AI_Definition(SCR: "Proc_SetZDMSizeSphere", EN: "ZON_SetZDMSizeSphere", FR: "ZON_FixeTailleZDMSphere")] SetZDMSizeSphere, + [AI_Definition(SCR: "Proc_SetZDDSizeCone", EN: "ZON_SetZDDSizeCone", FR: "ZON_FixeTailleZDDCone")] SetZDDSizeCone, + //******************************************************************************************************************************************************************************************************************************************************** + [AI_Definition(SCR: "Proc_SetVolumeAnim", EN: "SOUND_SetVolumeAnim", FR: "SON_FixeAnimVolume")] SetSoundVolumeAnim, + [AI_Definition(SCR: "Proc_SetVolumeMusic", EN: "SOUND_SetVolumeMusic", FR: "SON_FixeMusicVolume")] SetSoundVolumeMusic, + [AI_Definition(SCR: "Proc_SetVolumeAmbiance", EN: "SOUND_SetVolumeAmbiance", FR: "SON_FixeAmbianceVolume")] SetSoundVolumeAmbiance, + [AI_Definition(SCR: "Proc_SetDopplerEffect", EN: "SOUND_SetDopplerEffect", FR: "SON_ChangeEffetDoppler")] SetDopplerEffect, + [AI_Definition(SCR: "Proc_PauseSound", EN: "SOUND_PauseSound", FR: "SON_Pause")] PauseSound, + [AI_Definition(SCR: "Proc_ResumeSound", EN: "SOUND_ResumeSound", FR: "SON_Reprendre")] ResumeSound, + [AI_Definition(SCR: "Proc_StopMenuSound", EN: "SOUND_StopMenuSound", FR: "SON_ArretSonMenu")] StopMenuSound, + //******************************************************************************************************************************************************************************************************************************************************** + [AI_Definition(SCR: "Proc_ChangeCaractere", EN: "TEXT_ChangeCharactere", FR: "TEXT_ChangeCaractere")] ChangeCaractere, + [AI_Definition(SCR: "Proc_FormateTexte", EN: "TEXT_FormatText", FR: "TEXT_FormateTexte")] FormateTexte, + [AI_Definition(SCR: "Proc_ValideNomDuSlot", EN: "MNU_ValidateSlotName", FR: "MNU_ValideNomDuSlot")] ValideNomDuSlot, + [AI_Definition(SCR: "Proc_RestoreNomDuSlot", EN: "MNU_RestoreSlotName", FR: "MNU_RestoreNomDuSlot")] RestoreNomDuSlot, + [AI_Definition(SCR: "Proc_ChangePersoSighting", EN: "ACT_ChangeActorSighting", FR: "ACT_ChangeViseePerso")] ChangePersoSighting, + [AI_Definition(SCR: "Proc_PlayDemo", EN: "DEM_PlayDemo", FR: "DEM_JoueDemo")] PlayDemo, + + // Specific PC IA procs + [AI_Definition(SCR: "PAD_InitKeyBoardDirections", EN: "PAD_InitKeyBoardDirections", FR: "PAD_InitKeyBoardDirections")] InitKeyBoardDirections, + [AI_Definition(SCR: "PAD_SetCenterPosition", EN: "PAD_SetCenterPosition", FR: "PAD_SetCenterPosition")] PadSetCenterposition, + [AI_Definition(SCR: "PAD_SetMaximalValues", EN: "PAD_SetMaximalValues", FR: "PAD_SetMaximalValues")] PadSetMaximalValues, + // End Specific PC IA procs + + // ANNECY MT - 22/10/98 { + //******************************************************************************************************************************************************************************************************************************************************** + [AI_Definition(SCR: "Proc_ChangeTooFarLimit", EN: "ACT_ChangeTooFarLimit", FR: "ACT_FixeLimiteEloignement")] ChangeTooFarLimit, + [AI_Definition(SCR: "Proc_ChangeTransparencyZone", EN: "ACT_ChangeTransparencyZone", FR: "ACT_FixeZoneTransparence")] ChangeTransparencyZone, + // END ANNECY MT } + + [AI_Definition(SCR: "Proc_SetBaseFrequenceForMenu", EN: "Effect_SetBaseFrequenceForMenu", FR: "Effect_SetBaseFrequenceForMenu")] SetBaseFrequenceForMenu, + [AI_Definition(SCR: "Proc_SaveSinusContext", EN: "Effect_SaveSinusContext", FR: "Effect_SaveSinusContext")] SaveSinusContext, + [AI_Definition(SCR: "Proc_RestoreSinusContext", EN: "Effect_RestoreSinusContext", FR: "Effect_RestoreSinusContext")] RestoreSinusContext, + //******************************************************************************************************************************************************************************************************************************************************** + [AI_Definition(SCR: "Func_TextSuperImposed", EN: "TEXT_SuperImposed", FR: "TEXT_SuperImposed")] TextSuperImposed, + #endregion + + #region R3 PS2 (SCR from RA PS2) + [AI_Definition(SCR: "Proc_SkinMaterial")] SkinMaterial, + [AI_Definition(SCR: "Proc_SkinIndex")] SkinIndex, + [AI_Definition(SCR: "Proc_SinusEffect_SetFreq3DMesh")] SinEffect_SetFreq3DMesh, + [AI_Definition(SCR: "Proc_SinusEffect_SetFreq3DRLI")] SinEffect_SetFreq3DRLI, + [AI_Definition(SCR: "Proc_Trace")] Trace, + [AI_Definition(SCR: "Proc_ChangeActionSmooth")] ChangeActionSmooth, + [AI_Definition(SCR: "Proc_ChangeActionForceSmooth")] ChangeActionForceSmooth, + [AI_Definition(SCR: "Proc_ChangeActionRandomSmooth")] ChangeActionRandomSmooth, + [AI_Definition(SCR: "Proc_ChangeActionWithEventsSmooth")] ChangeActionWithEventsSmooth, + [AI_Definition(SCR: "Proc_ChangeActionSmoothNL")] ChangeActionSmoothNL, + [AI_Definition(SCR: "Proc_ChangeActionForceSmoothNL")] ChangeActionForceSmoothNL, + [AI_Definition(SCR: "Proc_ChangeActionRandomSmoothNL")] ChangeActionRandomSmoothNL, + [AI_Definition(SCR: "Proc_ChangeActionWithEventsSmoothNL")] ChangeActionWithEventsSmoothNL, + [AI_Definition(SCR: "Proc_ChangeMapWithTransition")] ChangeMapWithTransition, + [AI_Definition(SCR: "Proc_SetAlwaysActive")] SetDynamicAlwaysActive, + ReinitTableObjects, + DeletePersoFromGame, + [AI_Definition(SCR: "Proc_SetVMTColor")] SetVMTColor, + [AI_Definition(SCR: "Proc_SetVMTSpecularExponant")] SetVMTSpecularExponent, + [AI_Definition(SCR: "Proc_SetVMTSpecularCoef")] SetVMTSpecularCoef, + [AI_Definition(SCR: "Proc_SetVMTDiffuseCoef")] SetVMTDiffuseCoef, + [AI_Definition(SCR: "Proc_SetVMTAmbientCoef")] SetVMTAmbientCoef, + [AI_Definition(SCR: "Proc_SetVMTAsChromed")] SetVMTAsChromed, + [AI_Definition(SCR: "Proc_SetVMTTextureScrollingCoef")] SetVMTTextureScrollingCoef, + [AI_Definition(SCR: "Proc_LockVMT")] LockVMT, + [AI_Definition(SCR: "Proc_UnlockVMT")] UnlockVMT, + [AI_Definition(SCR: "Proc_SetVMTFrame")] SetVMTFrame, + [AI_Definition(SCR: "Proc_CurrentKeyValue")] OptionGetCurrentKeyValue, + [AI_Definition(SCR: "Proc_ChangeKeyValue")] OptionChangeKeyValue, + [AI_Definition(SCR: "Proc_ResetKeyValueToDefault")] OptionResetKeyValueToDefault, + [AI_Definition(SCR: "Proc_BatchSetPersoAtModulePosition")] BatchSetPersoAtModulePosition, + [AI_Definition(SCR: "Proc_BatchSetPersoOrientation")] BatchSetPersoOrientation, + [AI_Definition(SCR: "Proc_BatchSynchroPersoWithPerso")] BatchSetPersoAtPerso, + [AI_Definition(SCR: "Proc_ChangeManyCustomBits2")] ChangeManyCustomBitsExtended, + [AI_Definition(SCR: "Proc_ChangeOneCustomFloat")] ChangeOneCustomFloat, + [AI_Definition(SCR: "Proc_ChangeOneCustomLong")] ChangeOneCustomLong, + [AI_Definition(SCR: "Proc_ChangeOneCustomVector")] ChangeOneCustomVector, + FixePositionPersoWithInterpol, + [AI_Definition(SCR: "Proc_PrepareMorphMT")] PrepareMorphMT, + StopAllMorph, + [AI_Definition(SCR: "Proc_MorphingMT")] MorphingMT, + [AI_Definition(SCR: "Proc_SetColliderActor")] SetColliderActor, + [AI_Definition(SCR: "Proc_ReinitCollider")] ReinitCollider, + [AI_Definition(SCR: "Proc_ChangeTextDefaultColor")] ChangeTextDefaultColor, + [AI_Definition(SCR: "Proc_CreateTextWithParamFormat")] CreateTextWithParamFormat, + [AI_Definition(SCR: "Proc_CreateTextWith2ParamsFormat")] CreateTextWith2ParamsFormat, + [AI_Definition(SCR: "Proc_RealToText")] FloatToText, + [AI_Definition(SCR: "Proc_ChangeGameMaterialZDE")] ChangeGameMaterialZDE, + [AI_Definition(SCR: "Proc_SPO_ChangeFlagRecursively")] SPO_ChangeFlagRecursively, + ChangeScreenPosPerThousand, + [AI_Definition(SCR: "PAD2_InitAnalogJoystickAxes2")] SetAnalogJoystickAxes2, + [AI_Definition(SCR: "PAD2_ReleaseAnalogJoystick")] ReleaseAnalogJoystick, + [AI_Definition(SCR: "Proc_TemporalChangeSighting")] ChangeSightingAccordingTime, + [AI_Definition(SCR: "Proc_PAD2_ChangePadGlobalVector")] PAD2_SetGlobalVector, + [AI_Definition(SCR: "Proc_PAD2_ChangePadHorizontalAxis")] PAD2_SetHorizontalAxis, + [AI_Definition(SCR: "Proc_PAD2_ChangePadVerticalAxis")] PAD2_SetVerticalAxis, + [AI_Definition(SCR: "Proc_PAD2_ChangePadAnalogForce")] PAD2_SetAnalogForce, + [AI_Definition(SCR: "Proc_PAD2_ChangePadTrueAnalogForce")] PAD2_SetTrueAnalogForce, + [AI_Definition(SCR: "Proc_PAD2_ChangePadRotationAngle")] PAD2_SetRotationAngle, + [AI_Definition(SCR: "Proc_PAD2_ChangePadSector")] PAD2_SetPadSector, + PAD2_SetLongDescValue, + [AI_Definition(SCR: "SHW_SetShadowModeNormal")] SetModifierModeNormal, + [AI_Definition(SCR: "SHW_SetShadowModeLight")] SetModifierModeLight, + [AI_Definition(SCR: "SHW_SetShadowModeRGB")] SetModifierModeRGB, + [AI_Definition(SCR: "ValidateMemoryCard")] ValidateMemoryCard, + [AI_Definition(SCR: "AddMemoryCardString")] AddMemoryCardString, + SetGlobalAccelerationFactorForAnims, + [AI_Definition(SCR: "Proc_SetLocalPersoOnOff")] FixeLumierePersoOnOff, + [AI_Definition(SCR: "Proc_ComputeLight")] CalculeLumiere, + [AI_Definition(SCR: "Proc_ComputeLightWithShadows")] CalculeLumiereAvecOmbres, + [AI_Definition(SCR: "Proc_SetRadiusWP")] SetRadiusWP, + [AI_Definition(SCR: "Proc_SetPositionAbsWP")] SetPositionAbsWP, + [AI_Definition(SCR: "Proc_SetPositionRelWP")] SetPositionRelWP, + [AI_Definition(SCR: "Proc_WPSetRangeValue")] WPIndiquePlageValeur, + [AI_Definition(SCR: "Proc_DiscreetSpeed")] SetDiscreetSpeed, + [AI_Definition(SCR: "Proc_MJ_SetSuperimposed")] MJ_SetSuperimposed, + [AI_Definition(SCR: "Proc_SuperimposedClipping")] SetSuperimposedClipping, + [AI_Definition(SCR: "Proc_ResetSuperimposedClipping")] ResetSuperimposedClipping, + [AI_Definition(SCR: "Proc_SetOutlineMode")] SetOutlineMode, + [AI_Definition(SCR: "Proc_SetOutlineModeSPO")] SetOutlineModeSPO, + [AI_Definition(SCR: "Proc_SetCoordinatesAndMoveType1")] SetSPOCoordinatesAndMoveType1, + [AI_Definition(SCR: "Proc_SetCoordinatesAndMoveType2")] SetSPOCoordinatesAndMoveType2, + [AI_Definition(SCR: "Proc_SetCoordinatesAndMoveType3")] SetSPOCoordinatesAndMoveType3, + [AI_Definition(SCR: "Proc_SetCoordinatesAndMoveType4")] SetSPOCoordinatesAndMoveType4, + SetSPOCoordsNoInt, + SetSPOCoordsAndMoveType1NoInt, + SetSPOCoordsAndMoveType2NoInt, + SetSPOCoordsAndMoveType3NoInt, + SetSPOCoordsAndMoveType4NoInt, + [AI_Definition(SCR: "Proc_SetSOLFromWorldOrigin_SPOParam")] SetSOLFromWorldOrigin_SPOParam, + [AI_Definition(SCR: "Proc_SetSOLFromInit_SPOParam")] SetSOLFromInit_SPOParam, + [AI_Definition(SCR: "Proc_SetSOLFromHere_SPOParam")] SetSOLFromHere_SPOParam, + [AI_Definition(SCR: "Proc_SetSOLToInit_SPOParam")] SetSOLToInit_SPOParam, + [AI_Definition(SCR: "Proc_ReinitSOL_SPOParam")] ReinitSOL_SPOParam, + [AI_Definition(SCR: "Proc_SetSOLFromWorldOrigin_SOLParam")] SetSOLFromWorldOrigin_SOLParam, + [AI_Definition(SCR: "Proc_SetSOLFromInit_SOLParam")] SetSOLFromInit_SOLParam, + [AI_Definition(SCR: "Proc_SetSOLFromHere_SOLParam")] SetSOLFromHere_SOLParam, + [AI_Definition(SCR: "Proc_SetSOLToInit_SOLParam")] SetSOLToInit_SOLParam, + [AI_Definition(SCR: "Proc_ReinitSOL_SOLParam")] ReinitSOL_SOLParam, + [AI_Definition(SCR: "Proc_SOL_AddCharacter")] SOLAddCharacter, + [AI_Definition(SCR: "Proc_SOL_AddWaypoint")] SOLAddWaypoint, + [AI_Definition(SCR: "Proc_SOL_AddObject")] SOLAddObject, + [AI_Definition(SCR: "Proc_SOL_DeleteCharacter")] SOLDeleteCharacter, + [AI_Definition(SCR: "Proc_SOL_DeleteWaypoint")] SOLDeleteWaypoint, + [AI_Definition(SCR: "Proc_SOL_DeleteObject")] SOLDeleteObject, + [AI_Definition(SCR: "Proc_RotateSPOAroundX")] RotateSPOAroundX, + [AI_Definition(SCR: "Proc_RotateSPOAroundXType1")] RotateSPOAroundXType1, + [AI_Definition(SCR: "Proc_RotateSPOAroundXType2")] RotateSPOAroundXType2, + [AI_Definition(SCR: "Proc_RotateSPOAroundXType3")] RotateSPOAroundXType3, + [AI_Definition(SCR: "Proc_RotateSPOAroundXType4")] RotateSPOAroundXType4, + [AI_Definition(SCR: "Proc_RotateSPOAroundY")] RotateSPOAroundY, + [AI_Definition(SCR: "Proc_RotateSPOAroundYType1")] RotateSPOAroundYType1, + [AI_Definition(SCR: "Proc_RotateSPOAroundYType2")] RotateSPOAroundYType2, + [AI_Definition(SCR: "Proc_RotateSPOAroundYType3")] RotateSPOAroundYType3, + [AI_Definition(SCR: "Proc_RotateSPOAroundYType4")] RotateSPOAroundYType4, + [AI_Definition(SCR: "Proc_RotateSPOAroundZ")] RotateSPOAroundZ, + [AI_Definition(SCR: "Proc_RotateSPOAroundZType1")] RotateSPOAroundZType1, + [AI_Definition(SCR: "Proc_RotateSPOAroundZType2")] RotateSPOAroundZType2, + [AI_Definition(SCR: "Proc_RotateSPOAroundZType3")] RotateSPOAroundZType3, + [AI_Definition(SCR: "Proc_RotateSPOAroundZType4")] RotateSPOAroundZType4, + [AI_Definition(SCR: "Proc_RotateSPOAroundAxis")] RotateSPOAroundAxis, + [AI_Definition(SCR: "Proc_RotateSPOAroundAxisType1")] RotateSPOAroundAxisType1, + [AI_Definition(SCR: "Proc_RotateSPOAroundAxisType2")] RotateSPOAroundAxisType2, + [AI_Definition(SCR: "Proc_RotateSPOAroundAxisType3")] RotateSPOAroundAxisType3, + [AI_Definition(SCR: "Proc_RotateSPOAroundAxisType4")] RotateSPOAroundAxisType4, + [AI_Definition(SCR: "Proc_RotateSPOToIdentity")] RotateSPOToIdentity, + [AI_Definition(SCR: "Proc_ChangeSPOSighting")] ChangeSPOSighting, + [AI_Definition(SCR: "Proc_ChangeSPOSightingType1")] ChangeSPOSightingType1, + [AI_Definition(SCR: "Proc_ChangeSPOSightingType2")] ChangeSPOSightingType2, + [AI_Definition(SCR: "Proc_ChangeSPOSightingType3")] ChangeSPOSightingType3, + [AI_Definition(SCR: "Proc_ChangeSPOSightingType4")] ChangeSPOSightingType4, + [AI_Definition(SCR: "Proc_ChangeSPOAnySighting")] ChangeSPOAnySighting, + [AI_Definition(SCR: "Proc_ChangeSPOAnySightingType1")] ChangeSPOAnySightingType1, + [AI_Definition(SCR: "Proc_ChangeSPOAnySightingType2")] ChangeSPOAnySightingType2, + [AI_Definition(SCR: "Proc_ChangeSPOAnySightingType3")] ChangeSPOAnySightingType3, + [AI_Definition(SCR: "Proc_ChangeSPOAnySightingType4")] ChangeSPOAnySightingType4, + [AI_Definition(SCR: "Proc_FormateTexteTime")] FormateTexteTime, + [AI_Definition(SCR: "Proc_PlayAutoDemo")] PlayAutoDemo, + [AI_Definition(SCR: "Proc_MaskCharacterForResearch")] SetCharacterNotResearched, + [AI_Definition(SCR: "PAD2_InitKeyBoardBouton")] InitKeyBoardBouton, + [AI_Definition(SCR: "Proc_StartSubAnim")] StartSubAnim, + StartSubAnimWithFrame, + StartSubAnimSmooth, + StartSubAnimSmoothWithFrame, + [AI_Definition(SCR: "Proc_StopSubAnim")] StopSubAnim, + [AI_Definition(SCR: "Proc_WriteCustomBitSubAnim")] WriteCBSubAnim, + [AI_Definition(SCR: "Proc_EndSubAnim")] EndSubAnim, + [AI_Definition(SCR: "SHW_SetDynShadowLevel")] SetDynShadowLevel, + [AI_Definition(SCR: "SHW_SetDynShadowClosed")] SetDynShadowClosed, + [AI_Definition(SCR: "SHW_SetDynShadowSensitive")] SetDynShadowSensitive, + [AI_Definition(SCR: "PS2_SetCurrentLanguage")] SetCurrentLanguage, + [AI_Definition(SCR: "CallSubRoutine")] CallSubRoutine, + [AI_Definition(SCR: "Proc_ACTSetRangeValue")] ACTIndiquePlageValeur, + [AI_Definition(SCR: "Proc_ActivateInternalLight")] ActivateInternalLight, + [AI_Definition(SCR: "Proc_SetInternalLightParams")] SetInternalLightParams, + ToggleCinemascopeOn, + ToggleCinemascopeOff, + SetCinemascopeRatio, + [AI_Definition(SCR: "Proc_Cam_UpdatePositionLight")] Cam_UpdatePositionLight, + [AI_Definition(SCR: "Proc_Cam_SetCameraTransparencyFlag")] Cam_SetCameraTransparencyFlag, + [AI_Definition(SCR: "Proc_InitCamShooter")] InitCamShooter, + [AI_Definition(SCR: "Proc_RegisterIntegerVar")] CSHRegisterIntegerVar, + [AI_Definition(SCR: "Proc_RegisterFloatVar")] CSHRegisterFloatVar, + [AI_Definition(SCR: "Proc_RegisterVectorVar")] CSHRegisterVectorVar, + [AI_Definition(SCR: "Proc_RegisterPersoVar")] CSHRegisterPersoVar, + [AI_Definition(SCR: "Proc_RegisterBooleanVar")] CSHRegisterBooleanVar, + [AI_Definition(SCR: "Proc_GetViewfinderGMT")] CSHGetViewFinderVMT, + [AI_Definition(SCR: "Proc_GetMAComports")] CSHGetMAComports, + [AI_Definition(SCR: "Proc_InitBackMode")] CSHInitBackMode, + [AI_Definition(SCR: "Proc_InitMarioMode")] CSHInitMarioMode, + [AI_Definition(SCR: "Proc_InitStrafeLockMode")] CSHInitStrafeLockMode, + AddMainActor, + RemoveMainActor, + SetSkin, + SetGCubeVersion, + [AI_Definition(SCR: "Proc_LinkInitAll")] LinkInitAll, + [AI_Definition(SCR: "Proc_IncAgo")] SetAgoLink, + [AI_Definition(SCR: "Proc_SetLag")] SetLag, + [AI_Definition(SCR: "Proc_SetGaugeSpeed")] SetGaugeSpeed, + [AI_Definition(SCR: "Proc_SetSendDataRate")] SetSendDataRate, + [AI_Definition(SCR: "Proc_SetSendStatusRate")] SetSendStatusPeriod, + [AI_Definition(SCR: "Proc_SetLaunchSpeed")] SetLaunchSpeed, + [AI_Definition(SCR: "Proc_SetFlagStraight")] SetFlagStraight, + [AI_Definition(SCR: "Proc_SetUnlaunch")] SetUnlaunch, + [AI_Definition(SCR: "Proc_SetAGOClipping")] SetAGOClipping, + [AI_Definition(SCR: "Proc_JffTxt_AfficheInitPause")] JffTxt_AfficheVmsInitPause, + [AI_Definition(SCR: "Proc_JffTxt_AffichePadInitPause")] JffTxt_AffichePadInitPause, + [AI_Definition(SCR: "Proc_JffTxt_AfficheMultitapInitPause")] JffTxt_AfficheMultitapInitPause, + [AI_Definition(SCR: "Proc_JffTxt_DemoPressStat")] JffTxt_DemoPressStart, + [AI_Definition(SCR: "Proc_JffTxt_PauseDrawStringGame")] JffTxt_PauseDrawStringGame, + [AI_Definition(SCR: "Proc_JffTxt_PauseDrawStringInv")] JffTxt_PauseDrawStringInv, + [AI_Definition(SCR: "Proc_JffTxt_PauseEnable")] JffTxt_PauseEnable, + [AI_Definition(SCR: "Proc_JffTxt_IAmInTheInventory")] JffTxt_IAmInTheInventory, + [AI_Definition(SCR: "roc_JffTxt_PauseInitVars")] JffTxt_PauseInitVars, + [AI_Definition(SCR: "Proc_JffTxt_SetColor")] JffTxt_SetColor, + [AI_Definition(SCR: "Proc_JffTxt_SetTransp")] JffTxt_SetTransp, + [AI_Definition(SCR: "Proc_JffTxt_DoFadeIn")] JffTxt_DoFadeIn, + [AI_Definition(SCR: "Proc_JffTxt_DoFadeOut")] JffTxt_DoFadeOut, + [AI_Definition(SCR: "Proc_JffTxt_SetFrameMode")] JffTxt_SetFrameMode, + JffTxt_GetBdBox, + [AI_Definition(SCR: "Proc_CheatCodeDoubleSpeed")] CheatDoubleSpeed, + [AI_Definition(SCR: "Proc_CheatCodeInvertPad")] CheatInvertPad, + [AI_Definition(SCR: "Proc_CheatCodeRandomPad")] CheatRandomPad, + [AI_Definition(SCR: "Proc_CheatCodeRandomVignette")] CheatRandomVignette, + [AI_Definition(SCR: "Proc_MP_SetAspectRatio")] MultiPlayer_SetAspectRatio, + [AI_Definition(SCR: "Proc_MP_SetNumberOfPlayers")] MultiPlayer_SetNumberOfPlayers, + [AI_Definition(SCR: "Proc_MP_SetPlayerForViewport")] MultiPlayer_SetPlayerForViewport, + [AI_Definition(SCR: "Proc_MP_InvertViewports")] MultiPlayer_InvertViewports, + [AI_Definition(SCR: "Proc_MP_SetIcon")] MultiPlayer_LanceIcone, + [AI_Definition(SCR: "Proc_MP_SetGauge")] MultiPlayer_LanceGauge, + [AI_Definition(SCR: "Proc_MP_SetBitmapFile")] MultiPlayer_LanceBitmapFile, + [AI_Definition(SCR: "Proc_MP_SetBitmapMemory")] MultiPlayer_LanceBitmapMemory, + [AI_Definition(SCR: "Proc_MP_JFFTXT_Display")] MultiPlayer_JFFTXT_Affiche, + [AI_Definition(SCR: "Proc_MP_JFFTXT_DisplayOver3dPoint")] MultiPlayer_JFFTXT_AfficheOver3D, + [AI_Definition(SCR: "Proc_MP_JFFTXT_DisplayOver3dPointAtt")] MultiPlayer_JFFTXT_AfficheOver3DAttenuated, + [AI_Definition(SCR: "Proc_MP_SetViewportSizeAndPos")] MultiPlayer_SetViewportSizeAndPos, + [AI_Definition(SCR: "Proc_MP_SetViewportDisplayOrder")] MultiPlayer_SetViewportDisplayOrder, + [AI_Definition(SCR: "Proc_SinusEffect_SetSinusPreMultiplier")] SinEffect_SetSinusPreMultiplier, + MultiPlayer_LanceMask, + MultiPlayer_LanceBlur, + MultiPlayer_Prepare2DSprite, + [AI_Definition(SCR: "Proc_PrintInLogWindow")] PrintInLogWindow, + [AI_Definition(SCR: "Proc_TransitionRLI")] TransitionDeRLI, + [AI_Definition(SCR: "Proc_AddRLI")] AjoutDeRLI, + [AI_Definition(SCR: "Proc_BlockingRLITransitions")] BlockingRLITransitions, + [AI_Definition(SCR: "Proc_DeclareVideo")] EnqueueVideo, + [AI_Definition(SCR: "Proc_PlayVideo")] PlayVideo, + [AI_Definition(SCR: "Proc_PlayVideoAfterLevel")] PlayVideoAfterLevel, + [AI_Definition(SCR: "Proc_VideoQuality")] VideoQuality, + [AI_Definition(SCR: "Proc_SetVSyncWait")] SetVsyncWait, + [AI_Definition(SCR: "Proc_ActiveBrainDuringTransitions")] ActiveBrainDuringTransitions, + [AI_Definition(SCR: "Proc_DeactiveBrainDuringTransitions")] DeactiveBrainDuringTransitions, + [AI_Definition(SCR: "Proc_DisplaySegment")] DisplaySegment, + [AI_Definition(SCR: "Proc_EndTransition")] EndTransition, + [AI_Definition(SCR: "Proc_StartCine")] StartCine, + [AI_Definition(SCR: "Proc_StopCine")] EndCine, + [AI_Definition(SCR: "Proc_SetLoadingLevel")] SkipLoading_SetLoadingLevel, + [AI_Definition(SCR: "Proc_SetDataPath")] SetDataPath, + [AI_Definition(SCR: "Proc_SAV2_DeclareField")] SAV2_DeclareField, + [AI_Definition(SCR: "Proc_SAV2_DeleteField")] SAV2_DeleteField, + [AI_Definition(SCR: "Proc_SAV2_DeleteAllPipeline")] SAV2_DeleteAllPipeline, + [AI_Definition(SCR: "Proc_SAV2_DeleteAll")] SAV2_DeleteAll, + [AI_Definition(SCR: "Proc_SAV2_SetValue")] SAV2_SetValue, + [AI_Definition(SCR: "Proc_SAV2_SetValueIndex")] SAV2_SetValueIndex, + [AI_Definition(SCR: "Proc_SAV2_AddSingleValueInPipeline")] SAV2_AddSingleValueInPipeline, + [AI_Definition(SCR: "Proc_SAV2_AddSingleValueForSave")] SAV2_AddSingleValueForSave, + [AI_Definition(SCR: "Proc_SAV2_GetValueString")] SAV2_GetValueString, + [AI_Definition(SCR: "Proc_SAV2_GetValueStringIndex")] SAV2_GetValueStringIndex, + [AI_Definition(SCR: "Proc_SAV2_AddArrayInPipeline")] SAV2_AddArrayInPipeline, + [AI_Definition(SCR: "Proc_SAV2_AddArrayForSave")] SAV2_AddArrayForSave, + [AI_Definition(SCR: "Proc_SAV2_GetArray")] SAV2_GetArray, + SAV2_AutoSaveOnDisk, + [AI_Definition(SCR: "Proc_SAV2_Save")] SAV2_SaveOnDisk, + [AI_Definition(SCR: "Proc_SAV2_Load")] SAV2_LoadOnDisk, + [AI_Definition(SCR: "Proc_SAV2_RemoveSaveOnDisk")] SAV2_RemoveSaveOnDisk, + [AI_Definition(SCR: "Proc_SAV2_ActualizeExistingSave")] SAV2_ActualizeExistingSave, + [AI_Definition(SCR: "Proc_SAV2_GetSaveNameFromSaveNumber")] SAV2_GetSaveNameFromSaveNumber, + [AI_Definition(SCR: "Proc_SCT_EnableSectorSynchro")] SCT_EnableSectorSynchro, + [AI_Definition(SCR: "Proc_SCT_DisableSectorSynchro")] SCT_DisableSectorSynchro, + [AI_Definition(SCR: "Proc_ActivePortal")] ActivePortal, + [AI_Definition(SCR: "Proc_DeactivePortal")] DeactivePortal, + LogFileCreate, + LogFileAdd, + LogFileSeparator, + [AI_Definition(SCR: "Proc_FFB_LaunchPreCreateEffect")] FFBStartPreCreatedEffect, + [AI_Definition(SCR: "Proc_FFB_StopPreCreateEffect")] FFBStopPreCreatedEffect, + [AI_Definition(SCR: "Proc_FFB_StopAllEffectForPad")] FFBStopAllEffectForAPad, + [AI_Definition(SCR: "Proc_FFB_StopAllEffect")] FFBStopAllEffectForAllPad, + [AI_Definition(SCR: "Proc_FFB_PauseAllEffect")] FFBPauseAllEffectForAllPad, + [AI_Definition(SCR: "Proc_FFB_ResumeAllEffect")] FFBResumeAllEffectForAllPad, + [AI_Definition(SCR: "Proc_FFB_DeletePreCreateEffect")] FFBDeletePreCreatedEffect, + [AI_Definition(SCR: "Proc_FFB_DeleteAllPreCreateEffectsForPad")] FFBDeleteAllPreCreatedEffectForAPad, + [AI_Definition(SCR: "Proc_FFB_DeleteAllPreCreateEffects")] FFBDeleteAllPreCreatedEffectForAllPad, + [AI_Definition(SCR: "Proc_FFB_StopEffect")] FFBStopEffect, + [AI_Definition(SCR: "Proc_SetMechaSoundCharacter")] SND_SetMechaSoundCharacter, + [AI_Definition(SCR: "Proc_SetMicroActivation")] SND_SetMicroActivation, + [AI_Definition(SCR: "Proc_SaveCurrentTheme")] SND_SaveCurrentTheme, + [AI_Definition(SCR: "Proc_RestoreLastTheme")] SND_RestoreLastTheme, + SND_SendSoundRequest, + SND_SendVoiceRequest, + SND_SendVoiceRequestWithLipsChannel, + SND_SendVoiceRequestWithLipsAuto, + SND_SendMusicRequest, + SND_SendMusicRequestWithMarkers, + SND_SendAmbianceRequest, + SND_SendMenuSndRequest, + [AI_Definition(SCR: "Proc_SendSoundRequestSemaphore")] SND_SendSoundRequestSemaphore, + [AI_Definition(SCR: "Proc_SendVoiceRequestSemaphore")] SND_SendVoiceRequestSemaphore, + SND_SendVoiceRequestWithLipsChannelSemaphore, + [AI_Definition(SCR: "Proc_SendMusicRequestSemaphore")] SND_SendMusicRequestSemaphore, + [AI_Definition(SCR: "Proc_SendAmbianceRequestSemaphore")] SND_SendAmbianceRequestSemaphore, + [AI_Definition(SCR: "Proc_SendMenuSndRequestSemaphore")] SND_SendMenuSndRequestSemaphore, + SND_ChangeVolumeIdAmbiance, + SND_ChangeVolumeIdVoice, + SND_ChangeVolumeIdMusic, + [AI_Definition(SCR: "Proc_StopRequestSound")] SND_StopSound, + [AI_Definition(SCR: "Proc_StopRequestVoice")] SND_StopVoice, + [AI_Definition(SCR: "Proc_StopRequestMusic")] SND_StopMusic, + [AI_Definition(SCR: "Proc_StopRequestAmbiance")] SND_StopAmbiance, + [AI_Definition(SCR: "Proc_StopRequestMenuSon")] SND_StopMenuSnd, + [AI_Definition(SCR: "Proc_StopRequestAllRequests")] SND_StopAllRequests, + SND_StopLipsChannel, + SND_StopLipsChannelAuto, + [AI_Definition(SCR: "Proc_SetSemaphoreCapacity")] SND_SetSemaphoreCapacity, + [AI_Definition(SCR: "Proc_KillSemaphore")] SND_KillSemaphore, + [AI_Definition(SCR: "Proc_SND_LoadBank")] SND_LoadBank, + [AI_Definition(SCR: "Proc_SND_UnloadBank")] SND_UnloadBank, + [AI_Definition(SCR: "Proc_SetVolumeSound")] SND_SetVolumeSound, + [AI_Definition(SCR: "Proc_SetVolumeVoice")] SND_SetVolumeVoice, + [AI_Definition(SCR: "Proc_SetVolumeMusic")] SND_SetVolumeMusic, + [AI_Definition(SCR: "Proc_SetVolumeAmbiance")] SND_SetVolumeAmbiance, + [AI_Definition(SCR: "Proc_SetVolumeMenuSnd")] SND_SetVolumeMenuSnd, + [AI_Definition(SCR: "Proc_ChangeVolumeSound")] SND_ChangeVolumeSound, + [AI_Definition(SCR: "Proc_ChangeVolumeVoice")] SND_ChangeVolumeVoice, + [AI_Definition(SCR: "Proc_ChangeVolumeMusic")] SND_ChangeVolumeMusic, + [AI_Definition(SCR: "Proc_ChangeVolumeAmbiance")] SND_ChangeVolumeAmbiance, + [AI_Definition(SCR: "Proc_ChangeVolumeMenuSnd")] SND_ChangeVolumeMenuSnd, + SND_PauseSound, + [AI_Definition(SCR: "Proc_PauseVoice")] SND_PauseVoice, + [AI_Definition(SCR: "Proc_PauseMusic")] SND_PauseMusic, + [AI_Definition(SCR: "Proc_PauseAmbiance")] SND_PauseAmbiance, + [AI_Definition(SCR: "Proc_PauseMenuSound")] SND_PauseMenuSound, + [AI_Definition(SCR: "Proc_PauseAllRequests")] SND_PauseAllRequests, + SND_ResumeSound, + [AI_Definition(SCR: "Proc_ResumeVoice")] SND_ResumeVoice, + [AI_Definition(SCR: "Proc_ResumeMusic")] SND_ResumeMusic, + [AI_Definition(SCR: "Proc_ResumeAmbiance")] SND_ResumeAmbiance, + [AI_Definition(SCR: "Proc_ResumeMenuSound")] SND_ResumeMenuSound, + [AI_Definition(SCR: "Proc_ResumeAllRequests")] SND_ResumeAllRequests, + SND_SetDopplerEffect, + SND_SetInStereoMode, + [AI_Definition(SCR: "Proc_SetPrevMusicFadeOut")] SND_SetPrevMusicFadeOut, + [AI_Definition(SCR: "Proc_SetRollOffDistances")] SND_SetRollOffDistances, + [AI_Definition(SCR: "Proc_SetDefaultRollOffDistances")] SND_SetDefaultRollOffDistances, + [AI_Definition(SCR: "Proc_SaveCurrentRequest", EN: "SOUND_SaveCurrentRequest", FR: "SOUND_SauveRequeteCourante")] SND_SaveSoundEventInSlotMemory, // Same as R2 version prefixed with SND_ + [AI_Definition(SCR: "Proc_RestoreRequest", EN: "SOUND_RestoreRequest", FR: "SOUND_RestaureRequete")] SND_RestoreSoundEventInSlotMemory, // Same as R2 version prefixed with SND_ + SND_ResetMusicMarkerSlot, + SND_PS2ChangeReverb, + SND_PS2SetReverbOn, + SND_SendJingleRequest, + [AI_Definition(SCR: "Procedure_SetSingleplayerMode")] SetSingleplayerMode, + [AI_Definition(SCR: "Procedure_SetMultiplayerMode")] SetMultiplayerMode, + [AI_Definition(SCR: "Procedure_DoNotLoadTextures")] DoNotLoadTextures, + [AI_Definition(SCR: "Proc_DoNotLoadMaterialTextures")] DoNotLoadMaterialTextures, + [AI_Definition(SCR: "Proc_SetFamilyToLoad")] SetFamilyToLoad, + [AI_Definition(SCR: "Proc_SetActorToLoad")] SetActorToLoad, + [AI_Definition(SCR: "Proc_MonitoringStart")] MonitoringStart, + [AI_Definition(SCR: "Proc_MonitoringStop")] MonitoringStop, + TobyCreate, + TobyAddSegment, + TobySetTransparency, + TobyDestroy, + TobySetMaterial, + [AI_Definition(SCR: "EnableWidescreen")] EnableWidescreen, + [AI_Definition(SCR: "DisableWidescreen")] DisableWidescreen, + SetDisplayFrequency, + SetSaveGameAccessType, + SetFakeSpeedPercentage, + ExitFromDemo, + SetCurrentValueAsInit, + SetCheapCharacterListMinDistance, + SetCheapCharacterListMaxDistance, + SetCheapCharacterListTimer, + SetCheapCharacterListRefObj, + SetCheapCharacterListMode, + SetCheapCharacterListAura, + SetCheapCharacterNewPos, + SetCheapCharacterNewDir, + AddCheapCharacter, + ResetCheapCharacterList, + ActivateCheapCharacter, + DesactivateCheapCharacter, + SetCheapCharacterOptions, + R3SetScore, + R3SetNbCage, + R3SetCurrentEnvNumber, + R3SetNbCineOpen, + R3SetNbBonusOpen, + R3SetAutoSave, + R3SetEndOfGame, + WaterEffect_SetRandomPerturbationGeneration, + WaterEffect_GenerateImpulse, + WaterEffect_GenerateSplash, + AGO_Kill, + AGO_ReInit, + TakePicture, + ReleasePicture, + SFX_ActivateLightReflection, + SFX_ActivateWaterCircles, + SetActiveMcSlot, + GcResetToIpl, + ChangeActionSmoothProportional, + ChangeActionSmoothSymetric, + ChangeActionSmoothNoSpeed, + Begin2DMenu, + Begin2DMenuStart, + Begin2DMenuPhoto, + Begin2DMenuBonus, + Begin2DMenuBonusExit, + AllowNormalsRecomputing, + #endregion + + #region RA PS2 (custom enum names, SCR from ELF) + [AI_Definition(SCR: "Proc_NetDescribeVarVector")] NetDescribeVarVector, + [AI_Definition(SCR: "Proc_NetDescribeVarReal")] NetDescribeVarReal, + [AI_Definition(SCR: "Proc_NetDescribeVarInteger")] NetDescribeVarInteger, + [AI_Definition(SCR: "Proc_NetDescribeVarReal2")] NetDescribeVarReal2, + [AI_Definition(SCR: "Proc_NetDescribeVarInteger2")] NetDescribeVarInteger2, + [AI_Definition(SCR: "Proc_NetDescribeVarVector2")] NetDescribeVarVector2, + [AI_Definition(SCR: "Proc_NetDescribeVarPerso")] NetDescribeVarPerso, + [AI_Definition(SCR: "Proc_NetDescribeVarBoolean")] NetDescribeVarBoolean, + [AI_Definition(SCR: "Proc_NetEndDataDescription")] NetEndDataDescription, + [AI_Definition(SCR: "Proc_NetRequestAuthority")] NetRequestAuthority, + [AI_Definition(SCR: "Proc_NetRelinquishAuthority")] NetRelinquishAuthority, + [AI_Definition(SCR: "Proc_NetChangeActionByIndex")] NetChangeActionByIndex, + [AI_Definition(SCR: "Proc_NetConnectAndLogin")] NetConnectAndLogin, + [AI_Definition(SCR: "Proc_NetDisconnect")] NetDisconnect, + [AI_Definition(SCR: "Proc_NetGetGroupInfo")] NetGetGroupInfo, + [AI_Definition(SCR: "Proc_NetEnterGroup")] NetEnterGroup, + [AI_Definition(SCR: "Proc_NetLeaveGroup")] NetLeaveGroup, + [AI_Definition(SCR: "Proc_NetResetString")] NetResetString, + [AI_Definition(SCR: "Proc_NetDescribeVarInterpolator")] NetDescribeVarInterpolator, + [AI_Definition(SCR: "Proc_Net_Inter_SetActorToMonitor")] Net_Inter_SetActorToMonitor, + [AI_Definition(SCR: "Proc_Net_Inter_SetInterpolationType")] Net_Inter_SetInterpolationType, + [AI_Definition(SCR: "Proc_Net_Inter_SetInterpolationType2")] Net_Inter_SetInterpolationType2, + [AI_Definition(SCR: "Proc_NetSetNetworkMode")] NetSetNetworkMode, + [AI_Definition(SCR: "Proc_NetUpdateLANServerList")] NetUpdateLANServerList, + [AI_Definition(SCR: "Proc_NetSetPlayerName")] NetSetPlayerName, + [AI_Definition(SCR: "Proc_SetServerGameParam")] SetServerGameParam, + [AI_Definition(SCR: "Proc_DisconnectFromServer")] DisconnectFromServer, + + [AI_Definition(SCR: "Proc_ORB_Menu_Init")] ORB_Menu_Init, + [AI_Definition(SCR: "Proc_ORB_Menu_Destroy")] ORB_Menu_Destroy, + [AI_Definition(SCR: "Proc_ORB_Menu_SetButtonModifiers")] ORB_Menu_SetButtonModifiers, + [AI_Definition(SCR: "Proc_ORB_Menu_SetMPButtonModifiers")] ORB_Menu_SetMPButtonModifiers, + [AI_Definition(SCR: "Proc_ORB_Menu_AddPage")] ORB_Menu_AddPage, + [AI_Definition(SCR: "Proc_ORB_Menu_RemovePage")] ORB_Menu_RemovePage, + [AI_Definition(SCR: "Proc_ORB_Menu_AddWindow")] ORB_Menu_AddWindow, + [AI_Definition(SCR: "Proc_ORB_Menu_RemoveWindow")] ORB_Menu_RemoveWindow, + [AI_Definition(SCR: "Proc_ORB_Page_AddOrbit")] ORB_Page_AddOrbit, + [AI_Definition(SCR: "Proc_ORB_Menu_RemoveOrbit")] ORB_Menu_RemoveOrbit, + [AI_Definition(SCR: "Proc_ORB_Orbit_AddDisc")] ORB_Orbit_AddDisc, + [AI_Definition(SCR: "Proc_ORB_Menu_RemoveDisc")] ORB_Menu_RemoveDisc, + [AI_Definition(SCR: "Proc_ORB_Disc_AddButtonSet")] ORB_Disc_AddButtonSet, + [AI_Definition(SCR: "Proc_ORB_Menu_RemoveButtonSet")] ORB_Menu_RemoveButtonSet, + [AI_Definition(SCR: "Proc_ORB_ButtonSet_AddButton")] ORB_ButtonSet_AddButton, + [AI_Definition(SCR: "Proc_ORB_Menu_RemoveButton")] ORB_Menu_RemoveButton, + [AI_Definition(SCR: "Proc_ORB_Menu_SetCurrentPage")] ORB_Menu_SetCurrentPage, + [AI_Definition(SCR: "Proc_ORB_Menu_SetCurrentWindow")] ORB_Menu_SetCurrentWindow, + [AI_Definition(SCR: "Proc_ORB_Menu_SetCurrentOrbit")] ORB_Menu_SetCurrentOrbit, + [AI_Definition(SCR: "Proc_ORB_Menu_SetCurrentDisc")] ORB_Menu_SetCurrentDisc, + [AI_Definition(SCR: "Proc_ORB_Menu_SetCurrentButtonSet")] ORB_Menu_SetCurrentButtonSet, + [AI_Definition(SCR: "Proc_ORB_Menu_SetCurrentButton")] ORB_Menu_SetCurrentButton, + [AI_Definition(SCR: "Proc_ORB_Page_SetData")] ORB_Page_SetData, + [AI_Definition(SCR: "Proc_ORB_Window_SetData")] ORB_Window_SetData, + [AI_Definition(SCR: "Proc_ORB_Orbit_SetData")] ORB_Orbit_SetData, + [AI_Definition(SCR: "Proc_ORB_Disc_SetData")] ORB_Disc_SetData, + [AI_Definition(SCR: "Proc_ORB_Disc_SetCenterButtonData")] ORB_Disc_SetCenterButtonData, + [AI_Definition(SCR: "Proc_ORB_Button_SetData")] ORB_Button_SetData, + [AI_Definition(SCR: "Proc_ORB_ButtonSet_AddButton_SetData")] ORB_ButtonSet_AddButton_SetData, + [AI_Definition(SCR: "Proc_ORB_Button_SetIconData")] ORB_Button_SetIconData, + [AI_Definition(SCR: "Proc_ORB_Window_SetStatusFlag")] ORB_Window_SetStatusFlag, + [AI_Definition(SCR: "Proc_ORB_Window_ResetStatusFlag")] ORB_Window_ResetStatusFlag, + [AI_Definition(SCR: "Proc_ORB_Button_SetStatusFlag")] ORB_Button_SetStatusFlag, + [AI_Definition(SCR: "Proc_ORB_Button_ResetStatusFlag")] ORB_Button_ResetStatusFlag, + [AI_Definition(SCR: "Proc_ORB_Page_Update")] ORB_Page_Update, + [AI_Definition(SCR: "Proc_ORB_Disc_Display")] ORB_Disc_Display, + [AI_Definition(SCR: "Proc_ORB_Disc_ChangePointedButtonStatus")] ORB_Disc_ChangePointedButtonStatus, + [AI_Definition(SCR: "Proc_ORB_Disc_GenerateSeparators")] ORB_Disc_GenerateSeparators, + #endregion + + #region Hype PS2 (SCR from Hype PC) + [AI_Definition(SCR: "Proc_ChangeInitPosition")] ChangeInitPosition, + [AI_Definition(SCR: "Proc_BecomesSonOfPerso")] BecomesSonOfPerso, + [AI_Definition(SCR: "Proc_BecomesFatherOfPerso")] BecomesFatherOfPerso, + [AI_Definition(SCR: "Proc_FillListWithSons")] FillListWithSons, + [AI_Definition(SCR: "Proc_ActivateObjectOnPosition")] ActivateObjectOnPosition, + [AI_Definition(SCR: "Proc_AllowDynamLOD")] AllowDynamLOD, + [AI_Definition(SCR: "Proc_ForbidDynamLOD")] ForbidDynamLOD, + [AI_Definition(SCR: "Proc_ResetSpeed")] ResetSpeed, + [AI_Definition(SCR: "Proc_ResetOrientation")] ResetOrientation, + [AI_Definition(SCR: "Proc_SetRotationAxe")] SetRotationAxe, + [AI_Definition(SCR: "Proc_SetAlphaAngle")] SetAlphaAngle, + [AI_Definition(SCR: "Proc_SetRotationAngleStep")] SetRotationAngleStep, + [AI_Definition(SCR: "Proc_SetThetaAngle")] SetThetaAngle, + [AI_Definition(SCR: "Proc_SetImpulse")] SetImpulse, + [AI_Definition(SCR: "Proc_SetNormSpeed")] SetNormSpeed, + [AI_Definition(SCR: "Proc_AddNormSpeed")] AddNormSpeed, + [AI_Definition(SCR: "Proc_MulNormSpeed")] MulNormSpeed, + [AI_Definition(SCR: "Proc_SetDirectionSpeed")] SetDirectionSpeed, + [AI_Definition(SCR: "Proc_AddDirectionSpeed")] AddDirectionSpeed, + [AI_Definition(SCR: "Proc_SetVectorSpeed")] SetVectorSpeed, + [AI_Definition(SCR: "Proc_AddWind")] AddWind, + [AI_Definition(SCR: "Proc_SetDynamScalar")] SetDynamScalar, + [AI_Definition(SCR: "Proc_SetTarget")] SetTarget, + [AI_Definition(SCR: "Proc_TurnAround")] TurnAround, + [AI_Definition(SCR: "Proc_GoRelative")] GoRelative, + [AI_Definition(SCR: "Proc_GoInDirection")] GoInDirection, + [AI_Definition(SCR: "Proc_TurnLeft")] TurnLeft, + [AI_Definition(SCR: "Proc_TurnRight")] TurnRight, + [AI_Definition(SCR: "Proc_TurnUp")] TurnUp, + [AI_Definition(SCR: "Proc_LateralLeft")] TurnLateralLeft, + [AI_Definition(SCR: "Proc_TurnLateralright")] TurnLateralright, + [AI_Definition(SCR: "Proc_Brake")] Brake, + [AI_Definition(SCR: "Proc_AccelTurbo")] AccelTurbo, + [AI_Definition(SCR: "Proc_TurnDown")] TurnDown, + [AI_Definition(SCR: "Proc_Pulse")] Pulse, + [AI_Definition(SCR: "Proc_StonePulse")] StonePulse, + [AI_Definition(SCR: "Proc_Jump")] Jump, + [AI_Definition(SCR: "Proc_JumpAbsolute")] JumpAbsolute, + [AI_Definition(SCR: "Proc_JumpWithoutAddingSpeed")] JumpWithoutAddingSpeed, + [AI_Definition(SCR: "Proc_Fire")] Fire, + [AI_Definition(SCR: "Proc_GoTarget")] GoTarget, + [AI_Definition(SCR: "Proc_ReachTarget")] ReachTarget, + [AI_Definition(SCR: "Proc_LSY_StartSpeech")] LSY_StartSpeech, + [AI_Definition(SCR: "Proc_LSY_StopSpeech")] LSY_StopSpeech, + [AI_Definition(SCR: "Proc_InitModuleCtrlWithAnimTranslation")] InitModuleControlWithAnimTranslation, + [AI_Definition(SCR: "Proc_InitModuleCtrlWithAnimRotation")] InitModuleControlWithAnimRotation, + [AI_Definition(SCR: "Proc_RotateSector")] RotateSector, + [AI_Definition(SCR: "Proc_RotateSectorLocalX")] RotateSectorLocalX, + [AI_Definition(SCR: "Proc_RotateSectorLocalY")] RotateSectorLocalY, + [AI_Definition(SCR: "Proc_RotateSectorLocalZ")] RotateSectorLocalZ, + [AI_Definition(SCR: "Proc_LevelSaveRotationSector")] LevelSaveRotationSector, + [AI_Definition(SCR: "Proc_PlayerSaveRotationSector")] PlayerSaveRotationSector, + [AI_Definition(SCR: "Proc_TranslateSector")] TranslateSector, + [AI_Definition(SCR: "Proc_TranslateLocalSector")] TranslateLocalSector, + [AI_Definition(SCR: "Proc_IncHistoricAndSaveGame")] IncHistoryAndSaveGame, + [AI_Definition(SCR: "Proc_SaveAllGameValues")] SaveAllGameValues, + [AI_Definition(SCR: "Proc_EnableEscape")] EnableEscape, + [AI_Definition(SCR: "Proc_ResetButtonState")] ResetButtonState, + [AI_Definition(SCR: "Proc_FogOn")] FogOn, + [AI_Definition(SCR: "Proc_FogOff")] FogOff, + [AI_Definition(SCR: "Proc_DYL_ChangeGraduallyIntensity")] DYL_ChangeGraduallyIntensity, + [AI_Definition(SCR: "Proc_DYL_CopyStaticToDynamic")] DYL_CopyStaticToDynamic, + [AI_Definition(SCR: "Proc_AddSurfaceHeight")] AddSurfaceHeight, + [AI_Definition(SCR: "Proc_MoveSurfaceHeight")] MoveSurfaceHeight, + [AI_Definition(SCR: "Proc_LevelSaveMovingSurface")] LevelSaveMovingSurface, + [AI_Definition(SCR: "Proc_PlayerSaveMovingSurface")] PlayerSaveMovingSurface, + [AI_Definition(SCR: "Proc_DisplaylValue")] DisplaylValue, + [AI_Definition(SCR: "Proc_DisplayChrono")] DisplaylChrono, + [AI_Definition(SCR: "Proc_DisplayString")] DisplayString, + [AI_Definition(SCR: "Proc_ActivateString")] ActivateString, + [AI_Definition(SCR: "Proc_EraseString")] EraseString, + [AI_Definition(SCR: "Proc_Camera_UpdatePosition")] Camera_UpdatePosition, + [AI_Definition(SCR: "Procedure_Camera_Reset")] Camera_Reset, + [AI_Definition(SCR: "Procedure_Camera_ActivateSctUpdPatch")] Camera_ActSctUpdPatch, + [AI_Definition(SCR: "Procedure_Camera_RestoreAfterTrame")] Camera_RestoreAfterTrame, + [AI_Definition(SCR: "Procedure_Camera_CancelRestoreTrame")] Camera_CancelRestoreTrame, + [AI_Definition(SCR: "Procedure_Camera_ShowInfo")] Camera_ShowInfo, + [AI_Definition(SCR: "Procedure_Camera_ChangeCamera")] Camera_ChangeCamera, + [AI_Definition(SCR: "Procedure_Camera_ActiveCamera")] Camera_ActiveCamera, + [AI_Definition(SCR: "Procedure_Camera_ChangeDistance")] Camera_ChangeDistance, + [AI_Definition(SCR: "Procedure_Camera_BoundChangeDist")] Camera_ChangeBoundDist, + [AI_Definition(SCR: "Procedure_Camera_ChangeCamLinearSpeed")] Camera_ChangeCamLinearSpeed, + [AI_Definition(SCR: "Procedure_Camera_ChangeCamLinearInertia")] Camera_ChangeCamLinearInertia, + [AI_Definition(SCR: "Procedure_Camera_ChangeCamAngularSpeed")] Camera_ChangeCamAngularSpeed, + [AI_Definition(SCR: "Procedure_Camera_ChangeCamAngularInertia")] Camera_ChangeCamAngularInertia, + [AI_Definition(SCR: "Procedure_Camera_ChangeTgtLinearSpeed")] Camera_ChangeTgtLinearSpeed, + [AI_Definition(SCR: "Procedure_Camera_MoveTarget")] Camera_MoveTarget, + [AI_Definition(SCR: "Procedure_Camera_MoveLookTarget")] Camera_MoveLookTarget, + [AI_Definition(SCR: "Procedure_Camera_MoveShift")] Camera_MoveShift, + [AI_Definition(SCR: "Procedure_Camera_ChangeAngle")] Camera_ChangeAngle, + [AI_Definition(SCR: "Procedure_Camera_Move")] Camera_Move, + [AI_Definition(SCR: "Procedure_Camera_Turn")] Camera_Turn, + [AI_Definition(SCR: "Procedure_Camera_ManageSavedPos")] Camera_ManageSavePos, + [AI_Definition(SCR: "Procedure_Camera_ChangeState")] Camera_ChangeState, + [AI_Definition(SCR: "Procedure_Camera_ChangeFocal")] Camera_ChangeFocal, + [AI_Definition(SCR: "Procedure_Camera_ActivateFocalParsing")] Camera_ActivateFocalParsing, + [AI_Definition(SCR: "Procedure_Camera_ChangeTargetedPerso")] Camera_ChangeTargetedPerso, + [AI_Definition(SCR: "Proc_Cam_ChangeTgtChannel")] Camera_ChangeTargetedChannel, + [AI_Definition(SCR: "Proc_Cam_StopTargettingChannel")] Camera_StopTargettingChannel, + [AI_Definition(SCR: "Procedure_Camera_ResetTargetedPerso")] Camera_RestoreInitialTargetedPerso, + [AI_Definition(SCR: "Procedure_Camera_Shake")] Camera_Shake, + [AI_Definition(SCR: "Procedure_Camera_SetPosition")] Camera_SetPosition, + [AI_Definition(SCR: "Procedure_Camera_ChangeFlag")] Camera_ChangeFlag, + [AI_Definition(SCR: "Procedure_Camera_SavePositionAsOptimal")] Camera_SavePositionAsOptimal, + [AI_Definition(SCR: "Procedure_Camera_SetAdditionnalTarget")] Camera_SetAdditionnalTarget, + [AI_Definition(SCR: "Procedure_Camera_SetApexParameters")] Camera_SetApexParameters, + [AI_Definition(SCR: "Procedure_Camera_SetCameraZMax")] Camera_SetCameraZMax, + [AI_Definition(SCR: "Procedure_Camera_ResetCameraZMax")] Camera_ResetCameraZMax, + [AI_Definition(SCR: "Procedure_Camera_SetCameraZMin")] Camera_SetCameraZMin, + [AI_Definition(SCR: "Procedure_Camera_ResetCameraZMin")] Camera_ResetCameraZMin, + [AI_Definition(SCR: "Procedure_Camera_SetCameraOrientation")] Camera_SetCameraOrientation, + [AI_Definition(SCR: "Procedure_Camera_SetCameraPosition")] Camera_SetCameraPosition, + [AI_Definition(SCR: "Procedure_Camera_SetTargetPosition")] Camera_SetTargetPosition, + [AI_Definition(SCR: "Procedure_Cam_ChangeOrientAngleMax")] Camera_ChangeOrientationAngleMax, + [AI_Definition(SCR: "Procedure_Cam_ChangeOrientAngularSpeed")] Camera_ChangeOrientationAngularSpeed, + [AI_Definition(SCR: "Procedure_Cam_ChangeChannel")] Camera_ChangeChannel, + [AI_Definition(SCR: "Procedure_Camera_ChangeHard")] Camera_ChangeHard, + [AI_Definition(SCR: "Procedure_Camera_RepositionHard")] Camera_RepositionHard, + [AI_Definition(SCR: "Proc_SetPower")] SetPower, + [AI_Definition(SCR: "Proc_SubPower")] SubPower, + [AI_Definition(SCR: "Proc_AddPower")] AddPower, + [AI_Definition(SCR: "Proc_SetDisplayFixFlag")] DisplayFixFlag, + [AI_Definition(SCR: "Proc_StartMenuWithPauseGame")] StartMenuWithPauseGame, + [AI_Definition(SCR: "Proc_StartMenuWithoutPauseGame")] StartMenuWithoutPauseGame, + [AI_Definition(SCR: "Proc_DisplayVignetteDuring")] DisplayVignetteDuringTime, + [AI_Definition(SCR: "Proc_SetParticleGeneratorOn")] SetParticleGeneratorOn, + [AI_Definition(SCR: "Proc_SetParticleGeneratorOff")] SetParticleGeneratorOff, + [AI_Definition(SCR: "Proc_SetParticleGenerator")] SetParticleGenerator, + [AI_Definition(SCR: "Proc_SetGenerationModeNone")] SetGenerationModeNone, + [AI_Definition(SCR: "Proc_SetGenerationModeContinuous")] SetGenerationModeContinuous, + [AI_Definition(SCR: "Proc_SetGenerationModeCrenel")] SetGenerationModeCrenel, + [AI_Definition(SCR: "Proc_SetGenerationModeProbability")] SetGenerationModeProbability, + [AI_Definition(SCR: "Proc_SetGenerationNumberConstant")] SetGenerationNumberConstant, + [AI_Definition(SCR: "Proc_SetGenerationNumberProbabilist")] SetGenerationNumberProbabilist, + [AI_Definition(SCR: "Proc_SetGenerationInfiniteLifeTime")] SetGenerationInfiniteLifeTime, + [AI_Definition(SCR: "Proc_SetGenerationConstantLifeTime")] SetGenerationConstantLifeTime, + [AI_Definition(SCR: "Proc_SetGenerationProbabilistLifeTime")] SetGenerationProbabilistLifeTime, + [AI_Definition(SCR: "Proc_Accelerate")] Accelerate, + [AI_Definition(SCR: "Proc_ReInitWay")] ReInitWay, + [AI_Definition(SCR: "Proc_ReInitWayBack")] ReInitWayBack, + [AI_Definition(SCR: "Proc_InitWayWithWp")] InitWayWithWp, + [AI_Definition(SCR: "Proc_SwimPulse")] SwimPulse, + [AI_Definition(SCR: "Proc_SkiTurnLeft")] Ski_TurnLeft, + [AI_Definition(SCR: "Proc_SkiTurnRight")] Ski_TurnRight, + [AI_Definition(SCR: "Proc_SetMechanicalGMTAdhesionCoef")] SetMechanicalGMTAdhesionCoef, + [AI_Definition(SCR: "Proc_SetMechanicalGMTAbsorptionCoef")] SetMechanicalGMTAbsorptionCoef, + [AI_Definition(SCR: "Proc_SetMechanicalGMTFrictionCoef")] SetMechanicalGMTFrictionCoef, + [AI_Definition(SCR: "Proc_SetMechanicalGMTSlideCoef")] SetMechanicalGMTSlideCoef, + [AI_Definition(SCR: "Proc_SetMechanicalGMTProgressionCoef")] SetMechanicalGMTProgressionCoef, + [AI_Definition(SCR: "Proc_SetMechanicalGMTPenetrationCoef")] SetMechanicalGMTPenetrationCoef, + [AI_Definition(SCR: "Proc_SetMechanicalGMTPenetrationMaxCoef")] SetMechanicalGMTPenetrationMaxCoef, + [AI_Definition(SCR: "Proc_ConfirmModuleControl")] ConfirmModuleControl, + [AI_Definition(SCR: "Proc_OptionChangeScreenSize")] OptionChangeScreenSize, + [AI_Definition(SCR: "Proc_InvisibleDisplay")] Invisible, + [AI_Definition(SCR: "Proc_VisibleDisplay")] Visible, + [AI_Definition(SCR: "Proc_AddChildToChannel")] AddChildToChannelOfActor, + [AI_Definition(SCR: "Proc_RemoveChildFromChannel")] RemoveChildFromChannelOfActor, + [AI_Definition(SCR: "Map_vEnableObject")] vEnableMapObject, + [AI_Definition(SCR: "Map_vSetDestination")] vSetDestination, + [AI_Definition(SCR: "Map_vResetDestination")] vResetDestination, + [AI_Definition(SCR: "Proc_SetWeightlessness")] Weightlessness, + [AI_Definition(SCR: "Proc_OrientWallNormal")] OrientWallNormal, + [AI_Definition(SCR: "Proc_SetAnimationGravity")] SetAnimationGravity, + [AI_Definition(SCR: "Proc_GiveImpulsionRope")] GiveImpulsionRope, + [AI_Definition(SCR: "Proc_ChangeSpringConstantForChannel")] ChangeSpringConstantForChannel, + [AI_Definition(SCR: "Proc_RopeHitAWall")] RopeHitAWall, + [AI_Definition(SCR: "SCT_ActivateSector")] ActiveSector, + [AI_Definition(SCR: "SCT_DesactivateSector")] DesactiveSector, + [AI_Definition(SCR: "SCT_ActivateSectorVisibility")] ActiveSectorVisibility, + [AI_Definition(SCR: "SCT_DesactivateSectorVisibility")] DesactiveSectorVisibility, + [AI_Definition(SCR: "SCT_ActivateSectorCollisions")] ActiveSectorCollisions, + [AI_Definition(SCR: "SCT_DesactivateSectorCollisions")] DesactiveSectorCollisions, + [AI_Definition(SCR: "ReturnToMainMenu")] ReturnToMainMenu, + [AI_Definition(SCR: "DisplayVignetteAndReturnToMainMenu")] DisplayVignetteAndReturnToMainMenu, + [AI_Definition(SCR: "DisplayVignetteAndQuitGame")] DisplayVignetteAndQuitGame, + PlayAvi, + [AI_Definition(SCR: "Proc_ActivateOptionnalSectors")] ActivateOptSectors, + [AI_Definition(SCR: "Proc_DeactivateOptionnalSectors")] DeactivateOptSectors, + [AI_Definition(SCR: "Proc_SetGameState")] SetGameState, + [AI_Definition(SCR: "Proc_SetMouseCursorTexture")] SetMouseCursorTexture, + [AI_Definition(SCR: "Proc_RestoreComport")] RestoreComport, + [AI_Definition(SCR: "Proc_RestoreMyComport")] RestoreMyComport, + [AI_Definition(SCR: "Proc_SCT_SetTransparence")] SCT_SetTransparence, + [AI_Definition(SCR: "Proc_setFadeValue")] setFadeValue, + [AI_Definition(SCR: "Proc_setFadeTexture")] setFadeTexture, + [AI_Definition(SCR: "Proc_ActivateFade")] setFadeOn, + [AI_Definition(SCR: "Proc_DeactivateFade")] setFadeOff, + [AI_Definition(SCR: "Proc_ExecuteFade")] StartFade, + [AI_Definition(SCR: "Proc_ExecuteFadeMS")] StartFadeMS, + [AI_Definition(SCR: "Proc_ToggleWideScreen")] ToggleWideScreen, + [AI_Definition(SCR: "Proc_EndDialog")] EndDialog, + [AI_Definition(SCR: "Proc_RunDialog")] RunDialog, + [AI_Definition(SCR: "Proc_ScrollDialog")] ScrollDialog, + [AI_Definition(SCR: "Proc_SelectDialog")] SelectDialog, + [AI_Definition(SCR: "Proc_PositionDialog")] PositionDialog, + [AI_Definition(SCR: "Proc_DLG_ChangeAction")] DLG_ChangeAction, + [AI_Definition(SCR: "Proc_DLG_ChangeComport")] DLG_ChangeComport, + [AI_Definition(SCR: "Proc_DLG_ActivateChannel")] DLG_ActivateChannel, + [AI_Definition(SCR: "Proc_SND_SetSoundEventActivation")] SND_SetSoundEventActivation, + [AI_Definition(SCR: "Proc_ActivateCreditsMotorMode")] ActivateCreditsMotorMode, + [AI_Definition(SCR: "Proc_ActivateInventoryMotorMode")] ActivateInventoryMotorMode, + [AI_Definition(SCR: "Proc_ActivateBinocularMotorMode")] ActivateBinocularMotorMode, + [AI_Definition(SCR: "Proc_ActivateSaveGameMotorMode")] ActivateSaveGameMotorMode, + [AI_Definition(SCR: "Proc_ActivateLaserPointer")] ActivateLaserPointer, + [AI_Definition(SCR: "Proc_HideLaserPointer")] HideLaserPointer, + [AI_Definition(SCR: "Proc_SetLaserPointerDistance")] SetLaserPointerDistance, + [AI_Definition(SCR: "Proc_SetLaserPointerTexture")] SetLaserPointerTexture, + [AI_Definition(SCR: "Proc_SetLaserPointerDetailLevel")] SetLaserPointerDetails, + [AI_Definition(SCR: "Proc_SetLaserPointerSniperMode")] LaserPointerSniper, + [AI_Definition(SCR: "Proc_SetLaserPointerFlyMode")] LaserPointerFly, + [AI_Definition(SCR: "Proc_FadeRandom")] FadeRandom, + [AI_Definition(SCR: "Proc_RopeInitialisation")] RopeInitialisation, + [AI_Definition(SCR: "InterpolationReset")] TurnInterpolationReset, + [AI_Definition(SCR: "InterpolationOff")] TurnInterpolationOff, + [AI_Definition(SCR: "InterpolationOn")] TurnInterpolationOn, + [AI_Definition(SCR: "Proc_GPI_SetDraw")] SetDraw, + [AI_Definition(SCR: "Proc_GPI_SetImage")] SetImage, + [AI_Definition(SCR: "Proc_GPI_SetToNextImage")] SetToNextImage, + [AI_Definition(SCR: "Proc_GPI_FadeImage")] FadeImage, + [AI_Definition(SCR: "Proc_GPI_MovingUV")] MovingUV, + [AI_Definition(SCR: "Proc_GPI_Rotation")] Rotation, + [AI_Definition(SCR: "Proc_GPI_SetText")] SetTextString, + [AI_Definition(SCR: "Proc_GPI_SetTextNumber")] SetTextNumber, + [AI_Definition(SCR: "Proc_GPI_SlideGamePlayInterface")] SlideGamePlayInterface, + [AI_Definition(SCR: "Proc_HilitePerso")] HilitePerso, + [AI_Definition(SCR: "Proc_ResetPersoToInitialState")] ResetPersoToInitialState, + [AI_Definition(SCR: "Proc_SetFlashingSpeed")] SetFlashingSpeed, + [AI_Definition(SCR: "Proc_SetFlashingTransparent")] SetFlashingTransparent, + [AI_Definition(SCR: "Proc_SetFlashingNotTransparent")] SetFlashingNotTransparent, + [AI_Definition(SCR: "Proc_SetFlashingWithDefaultGMT")] SetFlashingWithDefaultGMT, + [AI_Definition(SCR: "Proc_SetFlashingNotWithDefaultGMT")] SetFlashingNotWithDefaultGMT, + [AI_Definition(SCR: "Proc_SetInitialGameFloors")] SetInitialGameFloors, + [AI_Definition(SCR: "Proc_SetStandardFloor")] SetStandardFloor, + [AI_Definition(SCR: "Proc_ActivateFloorGame")] ActivateFloorGame, + [AI_Definition(SCR: "Proc_SetColorPathGoal")] SetColorPathGoal, + [AI_Definition(SCR: "Proc_LGT_ChangeColor")] ChangeColor, + [AI_Definition(SCR: "Proc_LGT_ChangeIntensity")] LGT_ChangeIntensity, + [AI_Definition(SCR: "Proc_LGT_Switch")] LGT_Switch, + [AI_Definition(SCR: "Proc_LGT_SwitchAll")] LGT_SwitchAll, + [AI_Definition(SCR: "SetStableEnvironnement")] SetStableEnvironnement, + [AI_Definition(SCR: "Proc_ActivateMapMotorMode")] ActivateMapMotorMode, + [AI_Definition(SCR: "Proc_ActivateEpoque")] SetEpoque, + [AI_Definition(SCR: "Proc_ActivateName")] SetName, + [AI_Definition(SCR: "Proc_RopeCareTaker")] RopeCareTaker, + [AI_Definition(SCR: "Proc_ChangeChannelMassForPolySys")] ChangeChannelMassForPolySys, + [AI_Definition(SCR: "Proc_FixNormReelSpeed")] FixNormReelSpeed, + [AI_Definition(SCR: "Proc_SND_LoadSoundBank")] LoadSoundBank, + [AI_Definition(SCR: "Proc_SND_UnLoadSoundBank")] UnLoadSoundBank, + [AI_Definition(SCR: "Proc_SND_KillMusic")] KillMusic, + [AI_Definition(SCR: "Proc_SND_KillSoundEffect")] KillSoundEffect, + [AI_Definition(SCR: "Proc_SND_KillVoice")] KillVoice, + [AI_Definition(SCR: "Proc_SND_KillAllSounds")] KillAllSounds, + [AI_Definition(SCR: "Proc_SND_ChangeMyVolumeEffects")] SND_ChangeMyVolumeEffects, + SND_ChangeVolEffects, + [AI_Definition(SCR: "Proc_SND_ChangeVolumeEffects")] SND_ChangeVolumeEffects, + [AI_Definition(SCR: "Proc_SND_ChangeMyVolumeVoice")] SND_ChangeMyVolumeVoice, + [AI_Definition(SCR: "Proc_SND_ChangeMyVolumeMusic")] SND_ChangeMyVolumeMusic, + [AI_Definition(SCR: "Proc_SND_ChangeAllVolume")] SND_ChangeAllVolume, + [AI_Definition(SCR: "Proc_SND_ResetMyVolumeEffects")] SND_ResetMyVolumeEffects, + [AI_Definition(SCR: "Proc_SND_ResetMyVolumeVoice")] SND_ResetMyVolumeVoice, + [AI_Definition(SCR: "Proc_SND_ResetMyVolumeMusique")] SND_ResetMyVolumeMusic, + [AI_Definition(SCR: "Proc_SND_ResetVolumeEffects")] SND_ResetVolumeEffects, + [AI_Definition(SCR: "Proc_SND_ResetVolumeVoice")] SND_ResetVolumeVoice, + [AI_Definition(SCR: "Proc_SND_ResetVolumeMusic")] SND_ResetVolumeMusic, + [AI_Definition(SCR: "Proc_SND_ResetAllVolume")] SND_ResetAllVolume, + [AI_Definition(SCR: "Proc_SND_SetEffectSound")] SND_SetEffectSound, + [AI_Definition(SCR: "Proc_SND_SwitchMicroPerso")] SND_SwitchMicroPerso, + [AI_Definition(SCR: "Proc_SND_SwitchOldMicroPerso")] SND_SwitchOldMicroPerso, + SND_SetMicroOrientationPerso, + [AI_Definition(SCR: "SetVignetteIndex")] SetVignetteIndex, + [AI_Definition(SCR: "Proc_SND_SaveMusic")] SND_SaveMusic, + [AI_Definition(SCR: "Proc_SND_LoadMusic")] SND_LoadMusic, + [AI_Definition(SCR: "Proc_SND_FadeMusic")] SND_FadeMusic, + [AI_Definition(SCR: "Proc_SND_FadeVoice")] SND_FadeVoice, + [AI_Definition(SCR: "Proc_SND_FadeSound")] SND_FadeSound, + [AI_Definition(SCR: "Proc_SND_FadeAll")] SND_FadeAll, + [AI_Definition(SCR: "Proc_SND_FadeObjectAndStop")] SND_FadeObjectAndStop, + [AI_Definition(SCR: "Proc_SND_FadeInObject")] SND_FadeInObject, + [AI_Definition(SCR: "Proc_SND_KillObject")] SND_KillSoundObject, + [AI_Definition(SCR: "Proc_SetEconomicPersoAbsolutePosition")] SetEconomicPersoAbsolutePosition, + [AI_Definition(SCR: "ScaleReallyModule")] ScaleModule, + [AI_Definition(SCR: "Inv_UnselectSelectedObject")] Inv_DeselectionnerObjetSelectionne, + [AI_Definition(SCR: "Inv_ChangeObjectMaxCapacity")] Inv_ChangerCapaciteMaximumObjet, + [AI_Definition(SCR: "Inv_ChangeJewelState")] Inv_ChangerEtatJoyau, + [AI_Definition(SCR: "Inv_ChangeStockLstNumber")] Inv_ChangerLeNombreDuStockLst, + [AI_Definition(SCR: "Inv_DisplayAnObject")] Inv_AfficherUnObjet, + [AI_Definition(SCR: "Stats_DisplayMainActorLife")] Stats_DisplayMainActorLife, + [AI_Definition(SCR: "Stats_DisplayMainActorArmor")] Stats_DisplayMainActorArmor, + [AI_Definition(SCR: "Stats_DisplayMainActorMagic")] Stats_DisplayMainActorMagic, + [AI_Definition(SCR: "Stats_DisplayMainActorSelectedObject")] Stats_DisplayMainActorSelectedObject, + [AI_Definition(SCR: "Stats_DisplayMainActorWeapon")] Stats_DisplayMainActorWeapon, + [AI_Definition(SCR: "Stats_DisplayDragon")] Stats_DisplayDragon, + [AI_Definition(SCR: "Stats_DisplayCash")] Stats_DisplayCash, + [AI_Definition(SCR: "Fight_ChangeArmor")] Fight_ChangeArmor, + [AI_Definition(SCR: "Fight_ChangeArmorResistance")] Fight_ChangeArmorResistance, + [AI_Definition(SCR: "Fight_RepairArmor")] Fight_RepairArmor, + [AI_Definition(SCR: "Fight_SubHitPointsEnemy")] Fight_SubHitPointsEnemy, + [AI_Definition(SCR: "Magic_ChangeInitialMagicPoints")] Magic_ChangeInitialMagicPoints, + [AI_Definition(SCR: "Magic_ChangeMaxMagicPoints")] Magic_ChangeMaxMagicPoints, + [AI_Definition(SCR: "Magic_InitMagicPointsToInit")] Magic_InitMagicPointsToInit, + [AI_Definition(SCR: "Magic_InitMagicPointsToMax")] Magic_InitMagicPointsToMax, + [AI_Definition(SCR: "Magic_SelectPrevSpellType")] Magic_SelectPrevSpellType, + [AI_Definition(SCR: "Magic_SelectNextSpellType")] Magic_SelectNextSpellType, + [AI_Definition(SCR: "Dragon_ChangeInitialNbrDiamonds")] Dragon_ChangeInitialNbrDiamonds, + [AI_Definition(SCR: "Dragon_ChangeMaxNbrDiamonds")] Dragon_ChangeMaxNbrDiamonds, + [AI_Definition(SCR: "Dragon_InitDiamondsToInit")] Dragon_InitDiamondsToInit, + [AI_Definition(SCR: "Dragon_InitDiamondsToMax")] Dragon_InitDiamondsToMax, + [AI_Definition(SCR: "Dragon_ChangeDragonActor")] Dragon_SetDragonActor, + [AI_Definition(SCR: "Demo_ValidateMap")] Demo_ValidateMap, + [AI_Definition(SCR: "Proc_ChangePersoSighting")] ChangeViseePerso, + ChangementCustomBits, + ActiveArbalete, + DesactiveArbalete, + LancerVibrationGrave, + LancerVibrationAigu, + PS2ResetLevelOfMipmap, + PS2UpdateLevelOfMipmap, + #endregion + + #region Tonic Trouble SE + [AI_Definition(SCR: "Proc_CopyObjectFromTableToTable")] CopyObjectFromTableToTable, + [AI_Definition(SCR: "Proc_AddObjectInInventory")] AddObjectInInventory, + + #endregion + + #region R2 iOS & DC + iOS__Placeholder__StringProc_SaveOptions, + iOS__Placeholder__StringProc_LinkTwitter, + iOS__Placeholder__StringProc_StatusBarOrientation, + iOS__Placeholder__StringProc_SoundRelated, + + ChangeStateForSoftReset, // DC + SetAllPadsActive, + + RunDemo, + + LaunchInternetBrowser, + LaunchIGP, + ActivateRumblePakInPort1, + ActivateRumblePakInPort2, + DeactivateRumblePak, + ShiftScreenToTheLeft, + ShiftScreenToTheRight, + ShiftScreenToTheTop, + ShiftScreenToTheBottom, + + MultiInput, + SetHighScoreDisc, + + MenuInit, + MenuUpdate, + IngameMenuInit, + StatusBar, + StopBackgroundMusic, + GameButtonEnable, + + RumblePak, // params: (Freq, Force, On/Off. 0 = On) + ChangeVideoMode__Placeholder, + ChangeScreenSizeValue, + + #endregion + + #region R2 PS2 & Largo + Placeholder__SetRevolutionStdGamePlusC, // Sets ((byte)(StdGame + 0xC) & 0x7F + Placeholder__Revolution__SaveGame_1, + Placeholder__Revolution__SaveGame_2, + Placeholder__Revolution__SaveGame_3, + Placeholder__Revolution__SaveGame_3b__LargoOnly, + Placeholder__Revolution__SaveGame_4, + Placeholder__Revolution__SaveGame_5a, + Placeholder__Revolution__SaveGame_5b, + + SendSoundRequestWithChannelId, + SendVoiceRequestWithoutSpeaker, + SendVoiceRequestWithChannelId, + + SND_StopSoundWithChannelId, + SND_StopVoiceWithoutSpeaker, + SND_StopVoiceWithChannelId, + ChangeVoiceLanguage, + + Placeholder__Revolution__Shadow_1, + Placeholder__Revolution__Shadow_2_Does3And4, + Placeholder__Revolution__Shadow_3, + Placeholder__Revolution__Shadow_4, + Placeholder__Revolution__Shadow_5, + ReadAnalogJoystick2, + GetPadCalibration2, + SetPadCalibration2, + Placeholder__Revolution__Pad_1, + Placeholder__Revolution__PadRelated, + Placeholder__Revolution__SetAnalogJoystickAxes_1, + Placeholder__Revolution__SetAnalogJoystickAxes_2, + Placeholder__Revolution__AfterPad, + Placeholder__Revolution__DummyAfterKeyboardDirections_1, + Placeholder__Revolution__DummyAfterKeyboardDirections_2, + Placeholder__Revolution__DummyAfterKeyboardDirections_3, + Placeholder__Revolution__DummyAfterKeyboardDirections_4, + Placeholder__Revolution__DummyAfterKeyboardDirections_5, + Placeholder__Revolution__DummyAfterKeyboardDirections_6, + Placeholder__Revolution__AfterTextSuperimposed, + Placeholder__Revolution__DummyAfterTextSuperimposed_1, + Placeholder__Revolution__DummyAfterTextSuperimposed_2, + Placeholder__Revolution__DummyAfterTextSuperimposed_3, + Placeholder__Revolution__DummyAfterTextSuperimposed_4, + Placeholder__Revolution__DummyAfterTextSuperimposed_5, + Placeholder__Revolution__DummyAfterTextSuperimposed_6, + Placeholder__Revolution__DummyAfterTextSuperimposed_7, + Placeholder__Revolution__DummyAfterTextSuperimposed_8, + Placeholder__Revolution__FinalAfterTextSuperimposed, + Placeholder__Revolution__LargoAfterTextSuperimposed_1, + Placeholder__Revolution__LargoAfterTextSuperimposed_2, + Placeholder__Revolution__LargoAfterTextSuperimposed_3, + Placeholder__Revolution__AfterLaunchAGO_1, + Placeholder__Revolution__AfterLaunchAGO_2, + Placeholder__Revolution__AfterLaunchAGO_3, + Placeholder__Revolution__AfterLaunchAGO_4, + Placeholder__Largo__AfterLaunchAGO_5, + Placeholder__Largo__AfterLaunchAGO_6, + Placeholder__Largo__AfterLaunchAGO_7, + Placeholder__Largo__AfterLaunchAGO_8, + ListAffectPersoZDD_LargoExtended, + SinEffect_SetRLILargo, // RLI seems to work a little differently in Largo + ChangeActionWithEvents_LargoNoParam, + ChangeActionWithEvents_Largo2Params, + PlayerIsDeadLargo, + ChangeMapByIndex, + Largo_UnknownChangeMap_1, + Largo_UnknownChangeMap_2, + Largo_UnknownChangeMap_3, + Largo_UnknownChangeMap_4, + Largo_UnknownChangeMap_5, + Largo_UnknownChangeMap_6, + Placeholder__Revolution__AfterChangeSightingAccordingTime, + Placeholder__Largo_Game_1, + Placeholder__Largo_Game_2, + Placeholder__Largo_Game_3, + Placeholder__Largo_Game_4, + Placeholder__Largo_Game_5, + Placeholder__Largo_Game_6, + Placeholder__Largo_Game_7, + Placeholder__Largo_Game_8, + Placeholder__Largo_Game_9, + Placeholder__Largo_Game_10, + Placeholder__Largo_Game_11, + Placeholder__Largo_Game_12, + ChangeTypeOfWPCurrentNetwork, // Largo only: uses network in current perso's MSWay to replace first argument of regular proc + Placeholder__Largo__AfterReinitGraph_1, + Placeholder__Largo__AfterReinitGraph_2, + SetSuperImposedLargoSpecial, + Placeholder__Largo__AfterSuperimposed_1, + Placeholder__Largo__AfterSuperimposed_2, + Placeholder__Largo__AfterSuperimposed_3, + Placeholder__Largo_LastProcedures_1, + Placeholder__Largo_LastProcedures_2, + Placeholder__Largo_LastProcedures_3, + Placeholder__Largo_LastProcedures_4, + Placeholder__Largo_LastProcedures_5, + Placeholder__Largo_LastProcedures_6, + Placeholder__Largo_LastProcedures_7, + Placeholder__Largo_LastProcedures_8, + Placeholder__Largo_LastProcedures_9, + Placeholder__Largo_LastProcedures_10, + Placeholder__Largo_LastProcedures_11, + Placeholder__Largo_LastProcedures_12, + Placeholder__Largo_LastProcedures_13, + Placeholder__Largo_LastProcedures_14, + Placeholder__Largo_LastProcedures_15, + Placeholder__Largo_LastProcedures_16, + Placeholder__Largo_LastProcedures_17, + Placeholder__Largo_LastProcedures_18, + Placeholder__Largo_LastProcedures_19, + Placeholder__Largo_LastProcedures_20, + Placeholder__Largo_LastProcedures_21, + Placeholder__Largo_LastProcedures_22, + Placeholder__Largo_LastProcedures_23, + Placeholder__Largo_LastProcedures_24, + Placeholder__Largo_LastProcedures_25, + #endregion + + #region R3 GC + FixePositionPerso_R3GCOnlyVariant, + Placeholder__R3SetGCOnly_1, + Placeholder__R3SetGCOnly_2, + Placeholder__R3GCOnly__LastProcs_1, + Placeholder__R3GCOnly__LastProcs_2, + Placeholder__R3GCOnly__LastProcs_3, + Placeholder__R3GCOnly__LastProcs_4, + Placeholder__R3GCOnly__LastProcs_5, + Placeholder__R3GCOnly__LastProcs_6, + Placeholder__R3GCOnly__LastProcs_7, + Placeholder__R3GCOnly__LastProcs_8, + #endregion + } +} \ No newline at end of file diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/AI/Enums/Definitions/AI_Procedure.cs.meta b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/AI/Enums/Definitions/AI_Procedure.cs.meta new file mode 100644 index 00000000..34a9c902 --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/AI/Enums/Definitions/AI_Procedure.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 82c4c4067d8b93b499d9097aa23f7f3f +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/AI/Types.meta b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/AI/Types.meta new file mode 100644 index 00000000..01f34d08 --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/AI/Types.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 8961f4eb7e0ab194bb45227f86f1b819 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/AI/Types/AI_Types.cs b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/AI/Types/AI_Types.cs new file mode 100644 index 00000000..64230733 --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/AI/Types/AI_Types.cs @@ -0,0 +1,105 @@ +namespace BinarySerializer.Ubisoft.CPA { + // TODO: Add Save & Init Types + /* TODO: Add the following + * - TT PC final + * - R2 3DS + * - R2 N64: there are some DS exclusive functions, conditions etc. + * - R2 DC: there are some iOS exclusive functions, conditions etc. + * - R3 PC & PC demo (probably the same as PS2. Procedures, function and condition lists match between demo and PS2. Procedures also match between final and PS2.) + * - R3 HD (definitely has new functions/procedures for the new menu pages mainly) + * - R3 PS2 proto(s) & PC early demos? + * - RRR DS proto + * - RRR DS final + * - Red Planet + * - Donald PC + * - Donald N64 + * - Laura & Alex (like hype, SCR names are in the exe) + * - Rayman M PS2 demo + * - Rayman Arena GC/Xb + * - Dinosaur PS2 + * - PK PS2 + */ + + public abstract class AI_Types { + //public string[] functionTypes; + public AI_Keyword[] Keywords { get; set; } + public AI_Operator[] Operators { get; set; } + public AI_Function[] Functions { get; set; } + public AI_Procedure[] Procedures { get; set; } + public AI_Condition[] Conditions { get; set; } + public AI_DsgVarType[] VariableTypes { get; set; } + public AI_Field[] Fields { get; set; } + public AI_MetaAction[] MetaActions { get; set; } + public AI_InterpretType[] InterpretTypes { get; set; } + + public void Init() { + InitArrays(); + CreateDictionaries(); + } + + protected abstract void InitInterpretTypes(); + protected abstract void InitVariableTypes(); + protected abstract void InitKeywords(); + protected abstract void InitOperators(); + protected abstract void InitConditions(); + protected abstract void InitFields(); + protected abstract void InitMetaActions(); + protected abstract void InitFunctions(); + protected abstract void InitProcedures(); + + protected void InitArrays() { + InitInterpretTypes(); + InitVariableTypes(); + InitKeywords(); + InitOperators(); + InitConditions(); + InitFields(); + InitMetaActions(); + InitFunctions(); + InitProcedures(); + } + + private void CreateDictionaries() { + // TODO + } + + public AI_Keyword? GetKeyword(uint index) { + if(index < Keywords.Length) return Keywords[index]; + return null; + } + public AI_Operator? GetOperator(uint index) { + if (index < Operators.Length) return Operators[index]; + return null; + } + public AI_Function? GetFunction(uint index) { + if (index < Functions.Length) return Functions[index]; + return null; + } + public AI_Procedure? GetProcedure(uint index) { + if (index < Procedures.Length) return Procedures[index]; + return null; + } + public AI_Condition? GetCondition(uint index) { + if (index < Conditions.Length) return Conditions[index]; + return null; + } + public AI_Field? GetField(uint index) { + if (index < Fields.Length) return Fields[index]; + return null; + } + public AI_MetaAction? GetMetaAction(uint index) { + if (index < MetaActions.Length) return MetaActions[index]; + return null; + } + + public AI_InterpretType GetNodeType(byte functionType) { + if (functionType < InterpretTypes.Length) return InterpretTypes[functionType]; + return AI_InterpretType.Unknown; + } + + public AI_DsgVarType GetDsgVarType(uint type) { + if (type < VariableTypes.Length) return VariableTypes[type]; + return AI_DsgVarType.None; + } + } +} diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/AI/Types/AI_Types.cs.meta b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/AI/Types/AI_Types.cs.meta new file mode 100644 index 00000000..e8b46110 --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/AI/Types/AI_Types.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 191255bcd6d05f140a2bcd4bef7c5aa6 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/AI/Types/LargoWinch.meta b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/AI/Types/LargoWinch.meta new file mode 100644 index 00000000..a3dbd3bd --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/AI/Types/LargoWinch.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 1f797d51f25a3aa468b8b0725aaf0fe9 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/AI/Types/LargoWinch/AI_Types_LargoWinch_PC.cs b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/AI/Types/LargoWinch/AI_Types_LargoWinch_PC.cs new file mode 100644 index 00000000..62b1c2cf --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/AI/Types/LargoWinch/AI_Types_LargoWinch_PC.cs @@ -0,0 +1,1239 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace BinarySerializer.Ubisoft.CPA { + public class AI_Types_LargoWinch_PC : AI_Types_R2_PS2 { + // Re-checked + + // Fields: same as R2 PS2 + + #region DsgVar Types + protected override void InitVariableTypes() { + // Same list as Revolution, with 1 extra array, 2 extra types at the end as well as ObjectTable + VariableTypes = new AI_DsgVarType[] { + AI_DsgVarType.Boolean, + AI_DsgVarType.SByte, + AI_DsgVarType.UByte, + AI_DsgVarType.Short, + AI_DsgVarType.UShort, + AI_DsgVarType.Int, + AI_DsgVarType.UInt, + AI_DsgVarType.Float, + AI_DsgVarType.WayPoint, + AI_DsgVarType.Perso, + AI_DsgVarType.List, + AI_DsgVarType.Vector, + AI_DsgVarType.Comport, + AI_DsgVarType.Action, + AI_DsgVarType.Text, + AI_DsgVarType.GameMaterial, + AI_DsgVarType.VisualMaterial, + AI_DsgVarType.SoundEvent, + AI_DsgVarType.Caps, + AI_DsgVarType.Graph, + + AI_DsgVarType.Placeholder__UnknownArray, + AI_DsgVarType.Placeholder__UnknownArray, + AI_DsgVarType.Placeholder__UnknownArray, + AI_DsgVarType.Placeholder__UnknownArray, + AI_DsgVarType.Placeholder__UnknownArray, + AI_DsgVarType.Placeholder__UnknownArray, + AI_DsgVarType.Placeholder__UnknownArray, + AI_DsgVarType.Placeholder__UnknownArray, + AI_DsgVarType.Placeholder__R2PS2__Type2E, + AI_DsgVarType.Module, + AI_DsgVarType.Placeholder__UnknownArray, + AI_DsgVarType.SuperObject, + AI_DsgVarType.Input, + + AI_DsgVarType.Placeholder__Largo__Type2F, + AI_DsgVarType.Placeholder__Largo__Type30, + AI_DsgVarType.ObjectTable, + + }; + } + #endregion + + #region Node types + protected override void InitInterpretTypes() { + base.InitInterpretTypes(); + // Exact same list as Revo, but 2 extra + InterpretTypes = InterpretTypes + .Append(AI_InterpretType.Placeholder__Largo__Type2F) + .Append(AI_InterpretType.Placeholder__Largo__Type30) + .ToArray(); + } + #endregion + + #region Keywords + protected override void InitKeywords() { + Keywords = new AI_Keyword[] { + AI_Keyword.If, + AI_Keyword.IfNot, + AI_Keyword.If2, + AI_Keyword.If4, + AI_Keyword.If8, + AI_Keyword.If16, + AI_Keyword.IfNot2, + AI_Keyword.IfNot4, + AI_Keyword.IfNot8, + AI_Keyword.IfNot16, + AI_Keyword.IfDebug, + AI_Keyword.IfNotU64, + AI_Keyword.Then, + AI_Keyword.Else, + AI_Keyword.EngineGoto, + AI_Keyword.Me, + AI_Keyword.MainActor, + AI_Keyword.Nobody, + AI_Keyword.NoInput, + AI_Keyword.Nowhere, + AI_Keyword.EmptyText, + AI_Keyword.CapsNull, + AI_Keyword.NoGraph, + AI_Keyword.NoAction, + }; + } + #endregion + + #region Conditions + protected override void InitConditions() { + Conditions = new AI_Condition[] { + AI_Condition.Et, + AI_Condition.Ou, + AI_Condition.Not, + AI_Condition.XOr, + AI_Condition.Equal, + AI_Condition.Different, + AI_Condition.Lesser, + AI_Condition.Greater, + AI_Condition.LesserOrEqual, + AI_Condition.GreaterOrEqual, + AI_Condition.CollidePersoZDDNoWithPerso, + AI_Condition.CollideModuleZDDNoWithPerso, + AI_Condition.CollidePersoAllZDDWithPerso, + AI_Condition.CollidePersoZDDWithAnyPerso, + AI_Condition.CollideModuleZDDWithAnyPerso, + AI_Condition.CollidePersoZDENoWithPersoZDENo, + AI_Condition.CollideModuleZDENoWithPersoZDENo, + AI_Condition.CollidePersoZDENoWithModuleZDENo, + AI_Condition.CollideModuleZDENoWithModuleZDENo, + AI_Condition.CollidePersoZDENoWithPersoTypeZDE, + AI_Condition.CollideModuleZDENoWithPersoTypeZDE, + AI_Condition.CollidePersoTypeZDEWithPersoTypeZDE, + AI_Condition.CollidePersoAllZDEWithPersoAllZDE, + AI_Condition.CollidePersoTypeZDEWithPersoAllZDE, + AI_Condition.CollidePersoAllZDEWithPersoTypeZDE, + AI_Condition.CollidePersoZDENoWithTypeZDE, + AI_Condition.CollideModuleZDENoWithTypeZDE, + AI_Condition.CollideWithGround, + AI_Condition.CollideWithWall, + AI_Condition.CollideWithNothing, + AI_Condition.CollideWithCeiling, + AI_Condition.CollideWithPerso, + AI_Condition.CollideWithWater, + AI_Condition.CollideWithThisPerso, + AI_Condition.ZDMCollideWithGround, + AI_Condition.ZDMCollideWithWall, + AI_Condition.ZDMCollideWithNothing, + AI_Condition.ZDMCollideWithCeiling, + AI_Condition.IsPersoInList, + AI_Condition.IsModelInList, + AI_Condition.IsFamilyInList, + AI_Condition.ListEmptyTest, + AI_Condition.UserEvent_IsSet, + AI_Condition.UserEvent_IsSet2, + AI_Condition.PressedBut, + AI_Condition.JustPressedBut, + AI_Condition.ReleasedBut, + AI_Condition.JustReleasedBut, + AI_Condition.IsTimeElapsed, + AI_Condition.IsValidObject, // First validity condition. Don't know the rest + AI_Condition.Placeholder, + AI_Condition.Placeholder, + AI_Condition.Placeholder, + AI_Condition.Placeholder, + AI_Condition.Placeholder, + AI_Condition.Placeholder, + AI_Condition.Placeholder, + AI_Condition.Placeholder, + AI_Condition.Placeholder, + AI_Condition.SeePerso, + AI_Condition.IsActivable, + AI_Condition.IsAlreadyHandled, + AI_Condition.Alw_IsMine, + AI_Condition.IsPersoLightOn, + AI_Condition.IsPersoLightPulseOn, + AI_Condition.IsPersoLightGyroPhareOn, + AI_Condition.Placeholder, + AI_Condition.Placeholder, + AI_Condition.IsZDMCollideWithObstacle, + AI_Condition.IsZDMCollideWithWall, + AI_Condition.IsZDMCollideWithGround, + AI_Condition.IsZDMCollideWithCeiling, + AI_Condition.CmtIdentifierContainsMask, + AI_Condition.HitByCollider, + AI_Condition.IsTypeOfGMTCollide, + AI_Condition.IsInComport, + AI_Condition.IsInReflexComport, + AI_Condition.IsInAction, + AI_Condition.ChangeActionEnable, + AI_Condition.EngineReinitRequested, + AI_Condition.IsThereMechEvent, + AI_Condition.CollisionWP, + AI_Condition.IsCustomBitSet, + AI_Condition.IsPersoActive, + AI_Condition.CheckActionEnd, + AI_Condition.IsCurrentStateCustomBitSet, + AI_Condition.IsMechanicAnimation, + AI_Condition.IsMechanicCollide, + AI_Condition.IsMechanicOnGround, + AI_Condition.IsNullVector, + AI_Condition.IsMorphing, + AI_Condition.CheckAnimEnd, + AI_Condition.CheckAnimSmooth, + AI_Condition.HasTheCapability, + AI_Condition.HasOneOfTheCapabilities, + AI_Condition.HasTheCapabilityNumber, + AI_Condition.PersoHasTheCapability, + AI_Condition.PersoHasOneOfTheCapabilities, + AI_Condition.PersoHasTheCapabilityNumber, + AI_Condition.MagnetIsActivated, + AI_Condition.NEstPasEnCollisionAvecMap, + AI_Condition.NEstPasEnCollisionAvecProjectile, + AI_Condition.NEstPasEnCollisionAvecSecondCharact, + AI_Condition.NEstPasEnCollisionAvecMainCharact, + AI_Condition.NEstPasEnCollisionAvecAutresSecteurs, + AI_Condition.IsInFamily, + AI_Condition.IsInModel, + AI_Condition.AJoypadIsConnected, + AI_Condition.AKeyJustPressed, + AI_Condition.AButtonPadJustPressed, + AI_Condition.AKeyJustPressedAlphanumeric, // With an extra argument + AI_Condition.IsInDemoMode, + AI_Condition.IsInStereoMode, + AI_Condition.IsMusicPlaying, + AI_Condition.Placeholder, + AI_Condition.IsShapnessMax, + AI_Condition.IsTooFar, + AI_Condition.Placeholder, + AI_Condition.Placeholder, + AI_Condition.Placeholder, + AI_Condition.Placeholder, + AI_Condition.Placeholder, + AI_Condition.Placeholder, + AI_Condition.Cam_IsActive, + AI_Condition.Cam_IsViewportOwner, + AI_Condition.Cam_IsFlagNoDynamicTarget, + AI_Condition.Cam_IsFlagNoAverageMoveTgtPerso, + AI_Condition.Cam_IsFlagNoParseCutAngle, + AI_Condition.Cam_IsFlagNoVisibility, + AI_Condition.Cam_IsFlagNoVisibilityWithDynHie, + AI_Condition.Cam_IsFlagNoDynChangeTheta, + AI_Condition.Cam_IsFlagNoShiftUntilPosReached, + AI_Condition.Cam_IsFlagNoDynSpeed, + AI_Condition.Cam_IsFlagNoLinearParsing, + AI_Condition.Cam_IsFlagNoLinearInertia, + AI_Condition.Cam_IsFlagNoAngularParsing, + AI_Condition.Cam_IsFlagNoAngularInertia, + AI_Condition.Cam_IsFlagNoTargetParsing, + AI_Condition.Cam_IsFlagNoTargetInertia, + AI_Condition.Cam_IsFlagNoObstacle, + AI_Condition.Cam_IsFlagFixedOrientation, + AI_Condition.Cam_IsFlagForcedPosition, + AI_Condition.Cam_IsFlagForcedTarget, + AI_Condition.Cam_IsFlagForcedAxis, + }; + } + #endregion + + #region Meta Actions + protected override void InitMetaActions() { + MetaActions = new AI_MetaAction[] { + AI_MetaAction.FrozenWait, + AI_MetaAction.ExecuteAction, + AI_MetaAction.ExecuteActionSmooth, + AI_MetaAction.WaitEndOfAction, + AI_MetaAction.WaitEndOfAnim, + AI_MetaAction.Placeholder, // Unknown type "g" too. Something new for Largo Winch + AI_MetaAction.CamCineMoveAToBTgtC, + AI_MetaAction.CamCineMoveAToBTgtAC, + AI_MetaAction.CamCinePosATgtB, + AI_MetaAction.CamCinePosAMoveTgtBToC, + AI_MetaAction.CamCinePosATgtBTurnPosH, + AI_MetaAction.CamCinePosATgtBTurnTgtH, + AI_MetaAction.CamCinePosATgtBTurnPosV, + AI_MetaAction.CamCinePosATgtBTurnTgtV + }; + } + #endregion + + #region Operators + protected override void InitOperators() { + Operators = new AI_Operator[] { + AI_Operator.ScalarPlusScalar, + AI_Operator.ScalarMinusScalar, + AI_Operator.ScalarMulScalar, + AI_Operator.ScalarDivScalar, + AI_Operator.ScalarUnaryMinus, + AI_Operator.PlusAffect, + AI_Operator.MinusAffect, + AI_Operator.MulAffect, + AI_Operator.DivAffect, + AI_Operator.PlusPlusAffect, + AI_Operator.MinusMinusAffect, + AI_Operator.Affect, + AI_Operator.Dot, + AI_Operator.GetVectorX, + AI_Operator.GetVectorY, + AI_Operator.GetVectorZ, + AI_Operator.VectorPlusVector, + AI_Operator.VectorMinusVector, + AI_Operator.VectorMulScalar, + AI_Operator.VectorDivScalar, + AI_Operator.VectorUnaryMinus, + AI_Operator.SetVectorX, + AI_Operator.SetVectorY, + AI_Operator.SetVectorZ, + AI_Operator.Ultra, + AI_Operator.ModelCast, + AI_Operator.Array, + AI_Operator.AffectArray, + }; + } + #endregion + + #region Functions + protected override void InitFunctions() { + Functions = new AI_Function[] { + AI_Function.GetPersoAbsolutePosition, + AI_Function.GetMyAbsolutePosition, + AI_Function.GetAngleAroundZToPerso, + AI_Function.DistanceToPerso, + AI_Function.DistanceXToPerso, + AI_Function.DistanceYToPerso, + AI_Function.DistanceZToPerso, + AI_Function.DistanceXYToPerso, + AI_Function.DistanceXZToPerso, + AI_Function.DistanceYZToPerso, + AI_Function.DistanceToPersoCenter, + AI_Function.DistanceXToPersoCenter, + AI_Function.DistanceYToPersoCenter, + AI_Function.DistanceZToPersoCenter, + AI_Function.DistanceXYToPersoCenter, + AI_Function.DistanceXZToPersoCenter, + AI_Function.DistanceYZToPersoCenter, + AI_Function.DistanceToWP, + AI_Function.GetWPAbsolutePosition, + AI_Function.Int, + AI_Function.RandomInt, + AI_Function.Real, + AI_Function.Sinus, + AI_Function.Cosinus, + AI_Function.Square, + AI_Function.SquareRoot, + AI_Function.RandomReal, + AI_Function.MinimumReal, + AI_Function.MaximumReal, + AI_Function.DegreeToRadian, + AI_Function.RadianToDegree, + AI_Function.AbsoluteValue, + AI_Function.LimitRealInRange, + AI_Function.Sign, + AI_Function.Cube, + AI_Function.Modulo, + AI_Function.ModuloInt, + AI_Function.TernInf, + AI_Function.TernSup, + AI_Function.TernEq, + AI_Function.TernInfEq, + AI_Function.TernSupEq, + AI_Function.TernOp, + AI_Function.TemporalRealCombination, + AI_Function.Power, + AI_Function.Factorial, + AI_Function.Placeholder__GetRevolutionStdGamePlusC, + AI_Function.GetHitPoints, + AI_Function.AddAndGetHitPoints, + AI_Function.SubAndGetHitPoints, + AI_Function.GetHitPointsMax, + AI_Function.AddAndGetHitPointsMax, + AI_Function.SubAndGetHitPointsMax, + AI_Function.ListSize, + AI_Function.GivePersoInList, + AI_Function.AbsoluteVector, + AI_Function.RelativeVector, + AI_Function.VecteurLocalToGlobal, + AI_Function.VecteurGlobalToLocal, + AI_Function.GetMagnetStrength, + AI_Function.GetMagnetFar, + AI_Function.GetMagnetNear, + AI_Function.GetMagnetDuration, + AI_Function.SPO_GetDrawFlag, + AI_Function.GetTime, + AI_Function.GetElapsedTime, + AI_Function.GetDeltaT, + AI_Function.GetFrameLength, + AI_Function.InputAnalogicValue, + AI_Function.VitessePadAnalogique, + AI_Function.GenerateObject, + AI_Function.CountGeneratedObjects, + AI_Function.GetGlobalCounter, + AI_Function.GetSubMapId, + AI_Function.AddColor, + AI_Function.AddRed, + AI_Function.AddGreen, + AI_Function.AddBlue, + AI_Function.AddAlpha, + AI_Function.ColorRedGreenBlueAlpha, + AI_Function.ColorRedGreenBlue, + AI_Function.ColorRed, + AI_Function.ColorGreen, + AI_Function.ColorBlue, + AI_Function.ColorAlpha, + AI_Function.GetVisualGMTColor, + AI_Function.GetVisualGMTSpecularCoef, + AI_Function.GetVisualGMTSpecularExponent, + AI_Function.GetVisualGMTDiffuseCoef, + AI_Function.GetVisualGMTAmbientCoef, + AI_Function.GetVisualGMTTextureScrollingCoefU, + AI_Function.GetVisualGMTTextureScrollingCoefV, + AI_Function.GetVisualGMTFrame, + AI_Function.GetVisualGMTNumberOfFrames, + + // TODO: 16 save functions, 21 in Largo... + AI_Function.Placeholder__R2PS2__SaveGame_0__UInt, + AI_Function.Placeholder__R2PS2__SaveGame_0b__UInt__LargoOnly, + AI_Function.Placeholder__R2PS2__SaveGame_1__UInt, + AI_Function.Placeholder__R2PS2__SaveGame_2__1P__String, + AI_Function.Placeholder__R2PS2__SaveGame_4__1P__String, + AI_Function.Placeholder__R2PS2__SaveGame_5__UInt, + AI_Function.Placeholder__R2PS2__SaveGame_6__String, + AI_Function.Placeholder__R2PS2__SaveGame_8__String, + AI_Function.Placeholder__R2PS2__SaveGame_9__UInt, + AI_Function.Placeholder__R2PS2__SaveGame_9b__LargoOnly__Dummy, + AI_Function.Placeholder__R2PS2__SaveGame_9c__LargoOnly__Dummy, + AI_Function.Placeholder__R2PS2__SaveGame_9d__LargoOnly__Dummy, + AI_Function.Placeholder__R2PS2__SaveGame_10__UInt, + AI_Function.Placeholder__R2PS2__SaveGame_11__1P__UInt, + AI_Function.Placeholder__R2PS2__SaveGame_12__UInt, + AI_Function.Placeholder__R2PS2__SaveGame_13__UInt, + AI_Function.Placeholder__R2PS2__SaveGame_14__1P__UInt, + AI_Function.Placeholder__R2PS2__SaveGame_15__1P__UInt, + AI_Function.Placeholder__R2PS2__SaveGame_16__1P__UInt__LargoOnly, + AI_Function.Largo__GetFreeSpaceInKB, + AI_Function.Placeholder__R2PS2__SaveGame_18__1P__UInt__LargoOnly, + AI_Function.IsAValidSlotName, + + // FuncRay2 + AI_Function.Placeholder__Largo__GameFunction__1, + AI_Function.Placeholder__Largo__GameFunction__2, + AI_Function.Placeholder__Largo__GameFunction__3, + AI_Function.Placeholder__Largo__GameFunction__4, + AI_Function.Placeholder__Largo__GameFunction__5, + AI_Function.Placeholder__Largo__GameFunction__6, + AI_Function.Placeholder__Largo__GameFunction__7, + AI_Function.Placeholder__Largo__GameFunction__8, + AI_Function.Placeholder__Largo__GameFunction__9, + AI_Function.Placeholder__Largo__GameFunction__10, + AI_Function.Placeholder__Largo__GameFunction__11, + AI_Function.Placeholder__Largo__GameFunction__12, + AI_Function.Placeholder__Largo__GameFunction__13, + AI_Function.Placeholder__Largo__GameFunction__14, + AI_Function.Placeholder__Largo__GameFunction__15, + AI_Function.Placeholder__Largo__GameFunction__16, + AI_Function.Placeholder__Largo__GameFunction__17, + AI_Function.Placeholder__Largo__GameFunction__18, + AI_Function.Placeholder__Largo__GameFunction__19, + AI_Function.Placeholder__Largo__GameFunction__20, + AI_Function.Placeholder__Largo__GameFunction__21, + AI_Function.Placeholder__Largo__GameFunction__22, + AI_Function.Placeholder__Largo__GameFunction__23, + AI_Function.Placeholder__Largo__GameFunction__24, + AI_Function.Placeholder__Largo__GameFunction__25, + AI_Function.Placeholder__Largo__GameFunction__26, + AI_Function.PersoLePlusProche, + AI_Function.PersoLePlusProcheDansSecteurCourant, + + AI_Function.NearerActorInFieldOfVision, + AI_Function.NearerActorOfFamilyInFieldOfVision, + AI_Function.NearerActorInFieldOfVisionWithOffset, + AI_Function.NearerActorOfFamilyInFOVWithOffset, + + AI_Function.GetNbActivePerso, + AI_Function.CibleLaPlusProche, + AI_Function.CibleLaPlusProcheAvecAngles, + + AI_Function.ReseauWPLePlusProche, + AI_Function.NetworkCloserWPOfType, + AI_Function.ReseauWPLePlusDansLAxe, + AI_Function.ReseauWPLePlusDansLAxe2, + AI_Function.NetworkNextWPWithCapa, + AI_Function.NetworkAffectTypeOfConnectedWP, + AI_Function.NetworkAffectTypeOfConnectedWPWithCapa, + + AI_Function.ReseauCheminLePlusCourt, + AI_Function.NetworkBuildOrderedPath, + AI_Function.NetworkBuildOrderedPathCircular, + AI_Function.NetworkAllocateGraphToMSWay, + AI_Function.NetworkAllocateGraphToMSWayCircular, + AI_Function.NetworkBuildComplexPath, + AI_Function.NetworkShortestPathRadius1, + AI_Function.NetworkShortestPathRadius2, + AI_Function.CurrentNetworkGetTypeOfWP, + AI_Function.GetCurrentNetwork, + + AI_Function.ReseauLitIndexCourant, + AI_Function.ReseauForceIndexCourant, + AI_Function.ReseauLitPremierIndex, + AI_Function.ReseauLitDernierIndex, + AI_Function.ReseauIncrementIndex, + AI_Function.ReseauDecrementIndex, + AI_Function.ReseauLitWPAIndex, + AI_Function.ReseauLitCapaciteLiaisonAIndex, + AI_Function.ReseauChangeCapaciteLiaisonAIndex, + AI_Function.ReseauLitPoidsLiaisonAIndex, + AI_Function.ReseauChangePoidsLiaisonAIndex, + AI_Function.NetworkGetIndexOfWPInMSWay, + AI_Function.NetworkForceWPToCurrent, + AI_Function.NetworkTestTheEnds, + AI_Function.ReseauLitCapaciteLiaisonDansGraph, + AI_Function.ReseauChangeCapaciteLiaisonDansGraph, + AI_Function.ReseauLitPoidsLiaisonDansGraph, + AI_Function.ReseauChangePoidsLiaisonDansGraph, + AI_Function.ReseauLitCapaciteLiaisonDansGraphCourant, + AI_Function.ReseauChangeCapaciteLiaisonDansGraphCourant, + AI_Function.ReseauLitPoidsLiaisonDansGraphCourant, + AI_Function.ReseauChangePoidsLiaisonDansGraphCourant, + AI_Function.CurrentNetworkGetTypeOfWP, + AI_Function.NetworkGetTypeOfWP, + AI_Function.GetRadiusWP, + AI_Function.CurrentNetworkGetRadiusWP, + AI_Function.CurrentNetworkGetNbOfArcsForWP, + AI_Function.CurrentNetworkGetWPAtArcIndexForWP, + AI_Function.GetCapabilities, + AI_Function.CapabilityAtBitNumber, + AI_Function.GetScrollSpeed, + AI_Function.GetNbFrame, + AI_Function.DotProduct, + AI_Function.CrossProduct, + AI_Function.Normalize, + AI_Function.GetSPOCoordinates, + AI_Function.GetTractionFactor, + AI_Function.GetCenterZDEType, + AI_Function.GetCenterZDMType, + AI_Function.GetCenterZDRType, + AI_Function.GetCenterZDDType, + + AI_Function.GetCPUCounter, + AI_Function.TurnToPosition, + AI_Function.ActGetAlwaysGenerator, + + AI_Function.PAD2_GetGlobalVector, + AI_Function.PAD2_GetHorizontalAxis, + AI_Function.PAD2_GetVerticalAxis, + AI_Function.PAD2_GetAnalogForce, + AI_Function.PAD2_GetTrueAnalogForce, + AI_Function.PAD2_GetRotationAngle, + AI_Function.PAD2_GetPadSector, + AI_Function.PAD2_GetGlobalVector_2, // TODO: What are these? Previous? + AI_Function.PAD2_GetHorizontalAxis_2, + AI_Function.PAD2_GetVerticalAxis_2, + AI_Function.PAD2_GetAnalogForce_2, + AI_Function.PAD2_GetTrueAnalogForce_2, + AI_Function.PAD2_GetRotationAngle_2, + AI_Function.PAD2_GetPadSector_2, + + // DefFunc1 + AI_Function.VitesseHorizontaleDuPerso, + AI_Function.VitesseVerticaleDuPerso, + AI_Function.GetPersoZoomFactor, + AI_Function.GetPersoSighting, + AI_Function.GetPersoHorizon, + AI_Function.GetPersoBanking, + AI_Function.LitPositionZDM, + AI_Function.LitPositionZDE, + AI_Function.LitPositionZDD, + AI_Function.LitCentreZDM, + AI_Function.LitCentreZDE, + AI_Function.LitCentreZDD, + AI_Function.LitAxeZDM, + AI_Function.LitAxeZDE, + AI_Function.LitAxeZDD, + AI_Function.LitDimensionZDM, + AI_Function.LitDimensionZDE, + AI_Function.LitDimensionZDD, + AI_Function.VecteurPointAxe, + AI_Function.VecteurPointSegment, + AI_Function.VectorContribution, + AI_Function.VectorCombination, + AI_Function.TemporalVectorCombination, + AI_Function.ScaledVector, + AI_Function.GetVectorNorm, + AI_Function.RotateVector, + AI_Function.VectorAngle, + AI_Function.VectorCos, + AI_Function.VectorSin, + AI_Function.GetNormalCollideVector, + AI_Function.GetNormalCollideVector2, + AI_Function.GetCollidePoint, + AI_Function.GetCollidePoint2, + AI_Function.GetHandsCollidePoint, + AI_Function.GetCollideRate, + AI_Function.GetCollideRate2, + AI_Function.GetCollideMaterialType, + AI_Function.GetCollideMaterialType2, + AI_Function.GetCollisionPoint, + AI_Function.GetCollisionVector, + AI_Function.GetCollisionPerso, + AI_Function.GetCollisionPointMaterial, + AI_Function.GetLastTraversedMaterialType, + AI_Function.GetLastTraversedMaterial, + AI_Function.GetCurrentCollidedGMT, + + AI_Function.GetColliderType, + AI_Function.GetColliderActor, // Added + AI_Function.GetColliderVector, + AI_Function.GetColliderReal, + AI_Function.GetLastCollisionActor, + AI_Function.ComputeRebondVector, + AI_Function.GetModuleAbsolutePosition, + AI_Function.GetModuleRelativePosition, + AI_Function.GetModuleZoomFactor, + AI_Function.GetModuleSighting, + AI_Function.CastIntegerToChannel, + AI_Function.GetStringCharAt, + + AI_Function.GetActivationZDD, + AI_Function.GetActivationZDM, + AI_Function.GetActivationZDE, + AI_Function.GetActivationZDR, + AI_Function.GetCollisionFrequency, + AI_Function.GetBrainFrequency, + AI_Function.GetLightFrequency, + AI_Function.GetBooleanInArray, + AI_Function.GetNumberOfBooleanInArray, + AI_Function.GetButtonName, + + AI_Function.GetDriversAvailable, + AI_Function.GetCurrentLanguageId, + AI_Function.GetNbLanguages, + AI_Function.GetLanguageText, + AI_Function.TextToInt, + AI_Function.GetMusicVolume, + AI_Function.GetSfxVolume, + AI_Function.GetVoicesVolume, + AI_Function.NbAvailableResolution, + AI_Function.CurrentResolution, + AI_Function.SaveResolution, + + AI_Function.GetBrightness, + + AI_Function.GetSaturationDistance, + AI_Function.GetBackgroundDistance, + AI_Function.GetTooFarLimit, + AI_Function.GetTransparencyZoneMin, + AI_Function.GetTransparencyZoneMax, + AI_Function.GetCurrentFrame, // Or ComputeProtectKey but dummied + AI_Function.Xor, + AI_Function.And, + AI_Function.Or, + AI_Function.Not, + AI_Function.DivUnsigned, + AI_Function.MulUnsigned, + AI_Function.AddUnsigned, + AI_Function.SubUnsigned, + AI_Function.Placeholder__R2PS2__CheckPersoStdGamePlusC4_1__Float, + AI_Function.Placeholder__R2PS2__CheckPersoStdGamePlusC4_2__Float, + AI_Function.Placeholder__R2PS2__LargoOnly__AfterR2Placeholders_1__Vector, + AI_Function.Placeholder__R2PS2__LargoOnly__AfterR2Placeholders_2__UInt, + + // DefFunCa + AI_Function.Cam_GetShiftTarget, + AI_Function.Cam_GetShiftPos, + AI_Function.Cam_GetDistMin, + AI_Function.Cam_GetDistMax, + AI_Function.Cam_GetBoundDistMin, + AI_Function.Cam_GetBoundDistMax, + AI_Function.Cam_GetAngleAlpha, + AI_Function.Cam_GetAngleShiftAlpha, + AI_Function.Cam_GetAngleTheta, + AI_Function.Cam_GetAngleShiftTheta, + AI_Function.Cam_GetLinearSpeed, + AI_Function.Cam_GetLinearIncreaseSpeed, + AI_Function.Cam_GetLinearDecreaseSpeed, + AI_Function.Cam_GetAngularSpeed, + AI_Function.Cam_GetAngularIncreaseSpeed, + AI_Function.Cam_GetAngularDecreaseSpeed, + AI_Function.Cam_GetTargetSpeed, + AI_Function.Cam_GetTargetIncreaseSpeed, + AI_Function.Cam_GetTargetDecreaseSpeed, + AI_Function.Cam_GetFocal, + AI_Function.Cam_GetZMin, + AI_Function.Cam_GetZMax, + AI_Function.Cam_GetTargetedSuperObject, + AI_Function.Cam_GetTypeOfViewport, + AI_Function.Cam_GetCameraOfViewport, + AI_Function.Cam_GetMainCamera, + AI_Function.Cam_ComputeTargetWithTgtPerso, + AI_Function.Cam_GetCurrentTargetPosition, + AI_Function.Cam_GetBestPos, + }; + } + #endregion + + #region Procedures + protected override void InitProcedures() { + Procedures = new AI_Procedure[] { + AI_Procedure.Placeholder__SetRevolutionStdGamePlusC, + AI_Procedure.SetHitPoints, + AI_Procedure.SetHitPointsInit, + AI_Procedure.SetHitPointsToInitValue, + AI_Procedure.SetHitPointsToMaxValue, + AI_Procedure.AddHitPoints, + AI_Procedure.SubHitPoints, + AI_Procedure.SetHitPointsMax, + AI_Procedure.SetHitPointsMaxToInitValue, + AI_Procedure.SetHitPointsMaxToMaxValue, + AI_Procedure.AddHitPointsMax, + AI_Procedure.SubHitPointsMax, + AI_Procedure.TransparentDisplay, + AI_Procedure.SetTransparency, + AI_Procedure.ACT_SetDrawFlag, + AI_Procedure.ModuleTransparentDisplay, + AI_Procedure.ModuleTransparentDisplay2, + AI_Procedure.SetModuleTransparency, + AI_Procedure.SetModuleTransparency2, + AI_Procedure.ListAffectPersoZDD, + AI_Procedure.ListAffectPersoZDD_LargoExtended, + AI_Procedure.ListAffectModuleZDD, + AI_Procedure.ListAffectPersoZDE, + AI_Procedure.ListAffectModuleZDE, + AI_Procedure.ListAffectPersoTypeZDE, + AI_Procedure.ListAffectModuleTypeZDE, + AI_Procedure.ListAffectTypeZDEWithTypeZDE, + AI_Procedure.AddPersoInList, + AI_Procedure.AddPersoInListAt, + AI_Procedure.DeletePersoAtInList, + AI_Procedure.FindPersoAndDeleteInList, + AI_Procedure.ListSelect, + AI_Procedure.ListUnSelect, + AI_Procedure.ListSort, + AI_Procedure.ListSortByFamily, + AI_Procedure.ListSortByModel, + AI_Procedure.FillListWithAllPersoOfAFamily, + AI_Procedure.FillListWithAllPersoOfAModel, + AI_Procedure.DeleteFamilyInList, + AI_Procedure.DeleteModelInList, + AI_Procedure.ListUnion, + AI_Procedure.ListInter, + AI_Procedure.ListDiff, + AI_Procedure.ListAdd, + AI_Procedure.FogActivate, + AI_Procedure.SetFogColor, + AI_Procedure.SetFogNearFarInf, + AI_Procedure.SetFogBlend, + AI_Procedure.RestoreFog, + AI_Procedure.SaveFog, + AI_Procedure.Magnet_ActiveMagnet, + AI_Procedure.Magnet_DeactiveMagnet, + AI_Procedure.Magnet_SetStrength, + AI_Procedure.Magnet_SetFar, + AI_Procedure.Magnet_SetNear, + AI_Procedure.Magnet_SetDuration, + // No footpath procs + AI_Procedure.SinEffect_SetFreq, + AI_Procedure.SinEffect_SetAmplitude, + AI_Procedure.SinEffect_SetState, + AI_Procedure.SinEffect_SetFreq3D, + AI_Procedure.SinEffect_SetRLILargo, + AI_Procedure.SPO_SetDrawFlag, + AI_Procedure.SPO_SetEngineDisplayModeFlag, + AI_Procedure.DeactivateBut, + AI_Procedure.ActivateBut, + AI_Procedure.None, + AI_Procedure.ChangeComport, + AI_Procedure.ChangeComportReflex, + AI_Procedure.ChangeMyComport, + AI_Procedure.ChangeMyComportReflex, + AI_Procedure.ChangeMyComportAndMyReflex, + AI_Procedure.ChangeAction, + AI_Procedure.ChangeActionForce, + AI_Procedure.ChangeActionRandom, + AI_Procedure.ChangeActionWithEvents_LargoNoParam, + AI_Procedure.ChangeActionWithEvents, + AI_Procedure.ChangeActionWithEvents_Largo2Params, + AI_Procedure.Boucle, + AI_Procedure.FinBoucle, + AI_Procedure.Break, + AI_Procedure.PlayerIsDead, + AI_Procedure.ResetDynamicsWithCard, + AI_Procedure.BreakAI, + AI_Procedure.IgnoreTraceFlagForNextPicking, + AI_Procedure.PlayerIsDeadLargo, + AI_Procedure.SetMainActor, + AI_Procedure.ActivateObject, + AI_Procedure.DesactivateObject, + AI_Procedure.ChangeMap, + AI_Procedure.ChangeMapByIndex, + AI_Procedure.ChangeMapNoAutosave, + AI_Procedure.Largo_UnknownChangeMap_1, + AI_Procedure.Largo_UnknownChangeMap_2, + AI_Procedure.Largo_UnknownChangeMap_3, + AI_Procedure.Largo_UnknownChangeMap_4, + AI_Procedure.Largo_UnknownChangeMap_5, + AI_Procedure.Largo_UnknownChangeMap_6, + AI_Procedure.SetActionReturn, + AI_Procedure.FactorAnimationFrameRate, + AI_Procedure.SetCharacterPriority, + AI_Procedure.ForcePersoHandling, + AI_Procedure.PlayerIsDeadWithPlacement, + AI_Procedure.SwapLinkTableObjects, + AI_Procedure.ChangeCurrentObjectTable, + AI_Procedure.BuildObjectTableFromTableAndString, + + AI_Procedure.TakeModuleControl, + AI_Procedure.TakeManyModulesControl, + AI_Procedure.ReleaseModuleControl, + AI_Procedure.Placeholder__Revolution__SaveGame_1, + AI_Procedure.Placeholder__Revolution__SaveGame_2, + AI_Procedure.Placeholder__Revolution__SaveGame_3, + AI_Procedure.Placeholder__Revolution__SaveGame_3b__LargoOnly, + AI_Procedure.Placeholder__Revolution__SaveGame_4, + AI_Procedure.Placeholder__Revolution__SaveGame_5a, + AI_Procedure.Placeholder__Revolution__SaveGame_5b, + AI_Procedure.QuitGame, + AI_Procedure.ActivateChannel, + AI_Procedure.DeactivateChannel, + AI_Procedure.PersoLightOn, + AI_Procedure.PersoLightOff, + AI_Procedure.SetPersoLightColor, + AI_Procedure.SetPersoLightNearFar, + AI_Procedure.SetPersoLightLittleBigAlpha, + AI_Procedure.SetPersoLightGyrophare, + AI_Procedure.SetPersoLightPulse, + AI_Procedure.SetPersoLightParalleleType, + AI_Procedure.SetPersoLightSphericalType, + AI_Procedure.SetPersoLightHotSpotType, + AI_Procedure.SetPersoLightAmbientType, + + AI_Procedure.SendSoundRequest, + AI_Procedure.SendMusicRequest, + AI_Procedure.SendAmbianceRequest, + AI_Procedure.SendMenuSndRequest, + AI_Procedure.SendSoundRequestWithChannelId, + AI_Procedure.SendVoiceRequest, + AI_Procedure.SendVoiceRequestWithoutSpeaker, + AI_Procedure.SendVoiceRequestWithChannelId, + AI_Procedure.SND_StopSound, + AI_Procedure.SND_StopMusic, + AI_Procedure.SND_StopAmbiance, + AI_Procedure.SND_StopMenuSnd, + AI_Procedure.SND_StopSoundWithChannelId, + AI_Procedure.SND_StopVoice, + AI_Procedure.SND_StopVoiceWithoutSpeaker, + AI_Procedure.SND_StopVoiceWithChannelId, + AI_Procedure.DefaultDisplay, + AI_Procedure.DisplayVignette, + AI_Procedure.DeleteVignette, + + AI_Procedure.Turn, + AI_Procedure.Turn2, + AI_Procedure.DeltaTurnPerso, + AI_Procedure.TurnPerso, + AI_Procedure.KillPerso, + AI_Procedure.KillPersoAndClearVariable, + AI_Procedure.SetVisualGMTColor, + AI_Procedure.SetVisualGMTSpecularExponent, + AI_Procedure.SetVisualGMTSpecularCoef, + AI_Procedure.SetVisualGMTDiffuseCoef, + AI_Procedure.SetVisualGMTAmbientCoef, + AI_Procedure.SetVisualGMTAsChromed, + AI_Procedure.SetVisualGMTTextureScrollingCoef, + AI_Procedure.LockVisualGMT, + AI_Procedure.UnlockVisualGMT, + AI_Procedure.SetVisualGMTFrame, + AI_Procedure.OptionChangeDetailsValue, + AI_Procedure.OptionChangeMusicVolume, + AI_Procedure.OptionChangeSfxVolume, + AI_Procedure.OptionChangeVoiceVolume, + AI_Procedure.OptionChangeActionKey, + AI_Procedure.OptionConfigureKey, + + AI_Procedure.BatchSetPersoAtModulePosition, + AI_Procedure.BatchSetPersoOrientation, + AI_Procedure.BatchSetPersoAtPerso, + AI_Procedure.SetPersoAbsolutePosition, + AI_Procedure.SetPersoAtModulePosition, + AI_Procedure.ForcePersoAveragePosition, + AI_Procedure.RelativeMovePerso, + AI_Procedure.ChangePersoAnySighting, + AI_Procedure.ChangePersoSightingWithOffset, + AI_Procedure.RotatePersoAroundX, + AI_Procedure.RotatePersoAroundY, + AI_Procedure.RotatePersoAroundZ, + AI_Procedure.RotatePersoAroundVector, + AI_Procedure.RotatePersoAroundVectorWithOffset, + AI_Procedure.RotatePersoAroundXwithOffset, + AI_Procedure.RotatePersoAroundYwithOffset, + AI_Procedure.RotatePersoAroundZwithOffset, + AI_Procedure.SetFullPersoOrientation, + AI_Procedure.SetFullPersoOrientationWithOffset, + AI_Procedure.ZoomPerso, + AI_Procedure.ChangeOneCustomBit, + AI_Procedure.ChangeManyCustomBits, + AI_Procedure.ChangeManyCustomBitsExtended, + AI_Procedure.ImposeSpeed, + AI_Procedure.ImposeSpeedX, + AI_Procedure.ImposeSpeedY, + AI_Procedure.ImposeSpeedZ, + AI_Procedure.ImposeSpeedXY, + AI_Procedure.ImposeSpeedXYZ, + AI_Procedure.ImposeAbsoluteSpeed, + AI_Procedure.ImposeAbsoluteSpeedX, + AI_Procedure.ImposeAbsoluteSpeedY, + AI_Procedure.ImposeAbsoluteSpeedZ, + AI_Procedure.ImposeAbsoluteSpeedXY, + AI_Procedure.ImposeAbsoluteSpeedXYZ, + AI_Procedure.ProposeSpeed, + AI_Procedure.ProposeSpeedX, + AI_Procedure.ProposeSpeedY, + AI_Procedure.ProposeSpeedZ, + AI_Procedure.ProposeSpeedXY, + AI_Procedure.ProposeSpeedXYZ, + AI_Procedure.ProposeAbsoluteSpeed, + AI_Procedure.ProposeAbsoluteSpeedX, + AI_Procedure.ProposeAbsoluteSpeedY, + AI_Procedure.ProposeAbsoluteSpeedZ, + AI_Procedure.ProposeAbsoluteSpeedXY, + AI_Procedure.ProposeAbsoluteSpeedXYZ, + AI_Procedure.FixePositionPerso, + // No AddSpeed/AddAbsoluteSpeed + // Morph procedures, contrary to R2 PS2 + AI_Procedure.PrepareMorph, + AI_Procedure.StopMorph, + AI_Procedure.Morphing, + AI_Procedure.ReleaseAllModulesControl, + AI_Procedure.ChangeModuleSighting, + AI_Procedure.SetModuleAbsolutePosition, + AI_Procedure.RelativeMoveModule, + AI_Procedure.ChangeModuleSightingWithOffset, + AI_Procedure.RotateModuleAroundX, + AI_Procedure.RotateModuleAroundY, + AI_Procedure.RotateModuleAroundZ, + AI_Procedure.RotateModuleAroundVector, + AI_Procedure.RotateModuleAroundVectorWithOffset, + AI_Procedure.RotateModuleAroundXwithOffset, + AI_Procedure.RotateModuleAroundYwithOffset, + AI_Procedure.RotateModuleAroundZwithOffset, + AI_Procedure.SetFullModuleOrientation, + AI_Procedure.SetFullModuleOrientationWithOffset, + AI_Procedure.ZoomModule, + AI_Procedure.SetColliderType, + AI_Procedure.SetColliderActor, + AI_Procedure.SetColliderVector, + AI_Procedure.SetColliderReal, + AI_Procedure.ResetLastCollisionActor, + AI_Procedure.ClearCollisionReport, + AI_Procedure.SetGoThroughMechanicsHandling, + AI_Procedure.EraseLastGoThroughMaterial, + AI_Procedure.StringAddChar, + AI_Procedure.StringReplaceChar, + AI_Procedure.StringRemoveChar, + AI_Procedure.ChangeLanguage, + AI_Procedure.ChangeVoiceLanguage, + AI_Procedure.IntToText, + + AI_Procedure.SetMechanicAnimation, + AI_Procedure.SetMechanicCollide, + AI_Procedure.SetMechanicOnGround, + AI_Procedure.SetMechanicCollisionControl, + AI_Procedure.MecSetScale, + AI_Procedure.HierFreezeEngine, + AI_Procedure.FixePositionZDM, + AI_Procedure.FixePositionZDD, + AI_Procedure.FixePositionZDE, + AI_Procedure.ChangeLightIntensity, + AI_Procedure.SPO_ChangeFlag, + AI_Procedure.ActChangeSpoFlag, + AI_Procedure.ChangeScreenSize, + AI_Procedure.ChangeScreenClip, + AI_Procedure.ChangeScreenPos, + AI_Procedure.ChangeScreenPosPercent, + AI_Procedure.ChangeScreenRatio, + AI_Procedure.Placeholder__Revolution__Shadow_1, + AI_Procedure.Placeholder__Revolution__Shadow_2_Does3And4, + AI_Procedure.Placeholder__Revolution__Shadow_3, + AI_Procedure.Placeholder__Revolution__Shadow_4, + AI_Procedure.Placeholder__Revolution__Shadow_5, + AI_Procedure.ForceActivationZDD, + AI_Procedure.ForceActivationZDM, + AI_Procedure.ForceActivationZDE, + AI_Procedure.ForceActivationZDR, + AI_Procedure.ForceDesactivationZDD, + AI_Procedure.ForceDesactivationZDM, + AI_Procedure.ForceDesactivationZDE, + AI_Procedure.ForceDesactivationZDR, + AI_Procedure.LibereActivationZDD, + AI_Procedure.LibereActivationZDM, + AI_Procedure.LibereActivationZDE, + AI_Procedure.LibereActivationZDR, + AI_Procedure.ActiveZDR, + AI_Procedure.SetNoCollisionWithMap, + AI_Procedure.SetNoCollisionWithProjectile, + AI_Procedure.SetNoCollisionWithSecondCharact, + AI_Procedure.SetNoCollisionWithMainCharact, + AI_Procedure.SetNoCollisionWithOtherSectors, + AI_Procedure.SetNoCollisionZdeWithProjectile, + AI_Procedure.SetCollComputeFrequency, + AI_Procedure.SetBrainComputeFrequency, + AI_Procedure.SetLightComputeFrequency, + AI_Procedure.SetUsedExitIdentifier, + AI_Procedure.GetUsedExitIdentifier, + AI_Procedure.SetGlobalCounter, + + AI_Procedure.ReadAnalogJoystick, + AI_Procedure.SetAnalogJoystickAxes, + AI_Procedure.CancelKeyboardInertia, + AI_Procedure.GetPadCalibration, + AI_Procedure.SetPadCalibration, + AI_Procedure.ReadAnalogJoystick2, + AI_Procedure.SetAnalogJoystickAxes2, + AI_Procedure.GetPadCalibration2, + AI_Procedure.SetPadCalibration2, + AI_Procedure.Placeholder__Revolution__PadRelated, + AI_Procedure.Placeholder__Revolution__SetAnalogJoystickAxes_1, + AI_Procedure.Placeholder__Revolution__SetAnalogJoystickAxes_2, + AI_Procedure.Placeholder__Revolution__AfterPad, + + AI_Procedure.SetBooleanInArray, + AI_Procedure.SetDefaultFormatCharacter, + AI_Procedure.SelectResolution, + AI_Procedure.ChangeBrightness, + + AI_Procedure.SetInStereoMode, + AI_Procedure.SND_SetPrevMusicFadeOut, + AI_Procedure.SetSaturationBackGroundDistance, + AI_Procedure.SaveSoundEventInSlotMemory, + AI_Procedure.RestoreSoundEventInSlotMemory, + AI_Procedure.DrawSegment, + AI_Procedure.ShellExecute, + AI_Procedure.ChangeSightingAccordingTime, + AI_Procedure.Placeholder__Revolution__AfterChangeSightingAccordingTime, + + AI_Procedure.Placeholder__Largo_Game_1, + AI_Procedure.Placeholder__Largo_Game_2, + AI_Procedure.Placeholder__Largo_Game_3, + AI_Procedure.Placeholder__Largo_Game_4, + AI_Procedure.Placeholder__Largo_Game_5, + AI_Procedure.Placeholder__Largo_Game_6, + AI_Procedure.Placeholder__Largo_Game_7, + AI_Procedure.Placeholder__Largo_Game_8, + AI_Procedure.Placeholder__Largo_Game_9, + AI_Procedure.Placeholder__Largo_Game_10, + AI_Procedure.Placeholder__Largo_Game_11, + AI_Procedure.Placeholder__Largo_Game_12, + + AI_Procedure.FixePositionFade, + AI_Procedure.FixeLumierePersoLocal, + AI_Procedure.FixeLumiereStaticOnOff, + AI_Procedure.FixeLumiereStaticNearFar, + AI_Procedure.FixeLumiereStaticColor, + AI_Procedure.CalculeLumiereEffet, + + AI_Procedure.ChangeTypeOfWP, + AI_Procedure.ChangeTypeOfWPCurrentNetwork, + AI_Procedure.SetCapabilities, + AI_Procedure.AddCapabilities, + AI_Procedure.SubCapabilities, + AI_Procedure.ChangeCapabilities, + AI_Procedure.ReinitGraph, + AI_Procedure.Placeholder__Largo__AfterReinitGraph_1, + AI_Procedure.Placeholder__Largo__AfterReinitGraph_2, + + AI_Procedure.FixeVitesseTexture, + AI_Procedure.ScrollingOnOff, + AI_Procedure.FixeDecalageTexture, + AI_Procedure.ScrollingPause, + AI_Procedure.ChangeCurrFrame, + AI_Procedure.ChangeRandomFrame, + AI_Procedure.FreezeAnim, + AI_Procedure.UnFreezeAnim, + AI_Procedure.SetSuperimposed, + AI_Procedure.SetSuperimposed2, + AI_Procedure.SetSuperImposedLargoSpecial, + AI_Procedure.ReleaseSuperimposed, + AI_Procedure.SetSPOCoordinates, + AI_Procedure.SwitchSuperimposedTab, + AI_Procedure.Placeholder__Largo__AfterSuperimposed_1, + AI_Procedure.Placeholder__Largo__AfterSuperimposed_2, + AI_Procedure.Placeholder__Largo__AfterSuperimposed_3, + AI_Procedure.SetTractionFactor, + AI_Procedure.TurnToPositionAngle, + AI_Procedure.TurnToPositionSpeed, + AI_Procedure.SortArray, + AI_Procedure.ActiveJoystickAnal, + AI_Procedure.UnActiveJoystickAnal, + AI_Procedure.SetZDMSizeSphere, + AI_Procedure.SetZDDSizeCone, + AI_Procedure.SetSoundVolumeAnim, + AI_Procedure.SetSoundVolumeMusic, + AI_Procedure.SetSoundVolumeAmbiance, + AI_Procedure.SetDopplerEffect, + AI_Procedure.PauseSound, + AI_Procedure.ResumeSound, + AI_Procedure.StopMenuSound, + + AI_Procedure.FormateTexte, + AI_Procedure.ValideNomDuSlot, + + AI_Procedure.ChangePersoSighting, + AI_Procedure.PlayDemo, + AI_Procedure.InitKeyBoardDirections, + AI_Procedure.Placeholder__Revolution__DummyAfterKeyboardDirections_1, + AI_Procedure.Placeholder__Revolution__DummyAfterKeyboardDirections_2, + AI_Procedure.Placeholder__Revolution__DummyAfterKeyboardDirections_3, + AI_Procedure.Placeholder__Revolution__DummyAfterKeyboardDirections_4, + AI_Procedure.Placeholder__Revolution__DummyAfterKeyboardDirections_5, + AI_Procedure.Placeholder__Revolution__DummyAfterKeyboardDirections_6, + + AI_Procedure.ChangeTooFarLimit, + AI_Procedure.ChangeTransparencyZone, + AI_Procedure.SetBaseFrequenceForMenu, + AI_Procedure.SaveSinusContext, + AI_Procedure.RestoreSinusContext, + AI_Procedure.TextSuperImposed, + AI_Procedure.Placeholder__Revolution__AfterTextSuperimposed, + AI_Procedure.Placeholder__Revolution__DummyAfterTextSuperimposed_1, + AI_Procedure.Placeholder__Revolution__DummyAfterTextSuperimposed_2, + AI_Procedure.Placeholder__Revolution__DummyAfterTextSuperimposed_3, + AI_Procedure.Placeholder__Revolution__DummyAfterTextSuperimposed_4, + AI_Procedure.Placeholder__Revolution__DummyAfterTextSuperimposed_5, + AI_Procedure.Placeholder__Revolution__DummyAfterTextSuperimposed_6, + AI_Procedure.Placeholder__Revolution__DummyAfterTextSuperimposed_7, + AI_Procedure.Placeholder__Revolution__DummyAfterTextSuperimposed_8, + AI_Procedure.Placeholder__Revolution__FinalAfterTextSuperimposed, + AI_Procedure.Placeholder__Revolution__LargoAfterTextSuperimposed_1, + AI_Procedure.Placeholder__Revolution__LargoAfterTextSuperimposed_2, + AI_Procedure.Placeholder__Revolution__LargoAfterTextSuperimposed_3, + + + AI_Procedure.Cam_UpdatePosition, + AI_Procedure.Cam_ChangeShiftTarget, + AI_Procedure.Cam_ChangeShiftPos, + AI_Procedure.Cam_ChangeDistMin, + AI_Procedure.Cam_ChangeDistMax, + AI_Procedure.Cam_ChangeBoundDistMin, + AI_Procedure.Cam_ChangeBoundDistMax, + AI_Procedure.Cam_ChangeAngleAlpha, + AI_Procedure.Cam_ChangeAngleShiftAlpha, + AI_Procedure.Cam_ChangeAngleTheta, + AI_Procedure.Cam_ChangeAngleShiftTheta, + AI_Procedure.Cam_ChangeLinearSpeed, + AI_Procedure.Cam_ChangeLinearIncreaseSpeed, + AI_Procedure.Cam_ChangeLinearDecreaseSpeed, + AI_Procedure.Cam_ChangeAngularSpeed, + AI_Procedure.Cam_ChangeAngularIncreaseSpeed, + AI_Procedure.Cam_ChangeAngularDecreaseSpeed, + AI_Procedure.Cam_ChangeTargetSpeed, + AI_Procedure.Cam_ChangeTargetIncreaseSpeed, + AI_Procedure.Cam_ChangeTargetDecreaseSpeed, + AI_Procedure.Cam_ChangeFocal, + AI_Procedure.Cam_ChangeZMin, + AI_Procedure.Cam_ChangeZMax, + AI_Procedure.Cam_ChangeTgtPerso, + AI_Procedure.Cam_ChangeSecondTgtPerso, + AI_Procedure.Cam_ChangeChannel, + AI_Procedure.Cam_Activate, + AI_Procedure.Cam_AssociateViewport, + AI_Procedure.Cam_ResetIAFlags, + AI_Procedure.Cam_SetFlagNoDynamicTarget, + AI_Procedure.Cam_SetFlagNoAverageMoveTgtPerso, + AI_Procedure.Cam_SetFlagNoParseCutAngle, + AI_Procedure.Cam_SetFlagNoVisibility, + AI_Procedure.Cam_SetFlagNoVisibilityWithDynHie, + AI_Procedure.Cam_SetFlagNoDynChangeTheta, + AI_Procedure.Cam_SetFlagNoShiftUntilPosReached, + AI_Procedure.Cam_SetFlagNoDynSpeed, + AI_Procedure.Cam_ResetDNMFlags, + AI_Procedure.Cam_SetFlagNoLinearParsing, + AI_Procedure.Cam_SetFlagNoLinearInertia, + AI_Procedure.Cam_SetFlagNoAngularParsing, + AI_Procedure.Cam_SetFlagNoAngularInertia, + AI_Procedure.Cam_SetFlagNoTargetParsing, + AI_Procedure.Cam_SetFlagNoTargetInertia, + AI_Procedure.Cam_SetFlagFixedOrientation, + AI_Procedure.Cam_SetFlagNoObstacle, + AI_Procedure.Cam_SetFlagNoCollisionWhenNotMoving, + AI_Procedure.Cam_ChangeConstants, + AI_Procedure.Cam_SaveConstants, + AI_Procedure.Cam_RestoreConstants, + AI_Procedure.Cam_ShowInfo, + AI_Procedure.Cam_ForceTarget, + AI_Procedure.Cam_ForcePosition, + AI_Procedure.Cam_ForceRefAxis, + AI_Procedure.Cam_Reset, + AI_Procedure.Cam_ForceBestPos, + AI_Procedure.Cam_ForceNormalState, + AI_Procedure.Cam_ForceMovingOnRail, + + AI_Procedure.LaunchAGO, + AI_Procedure.Placeholder__Revolution__AfterLaunchAGO_1, // These next 4 are ABOUT the same in Largo. Probably were unfinished in Revo? + AI_Procedure.Placeholder__Revolution__AfterLaunchAGO_2, + AI_Procedure.Placeholder__Revolution__AfterLaunchAGO_3, + AI_Procedure.Placeholder__Revolution__AfterLaunchAGO_4, + AI_Procedure.Placeholder__Largo__AfterLaunchAGO_5, + AI_Procedure.Placeholder__Largo__AfterLaunchAGO_6, + AI_Procedure.Placeholder__Largo__AfterLaunchAGO_7, + AI_Procedure.Placeholder__Largo__AfterLaunchAGO_8, + AI_Procedure.SetInGameMenu, + AI_Procedure.JffTxt_Affiche, + AI_Procedure.JffTxt_AfficheVmsInitPause, + AI_Procedure.JffTxt_Extend, + AI_Procedure.JffTxt_Modify, + AI_Procedure.JffTxt_SetColor, // JFFTxtSettings + AI_Procedure.JffTxt_SetTransp, + AI_Procedure.JffTxt_DoFadeIn, + AI_Procedure.JffTxt_DoFadeOut, + AI_Procedure.JffTxt_SetFrameMode, + AI_Procedure.FadeIn, // Dummy + AI_Procedure.FadeOut, + AI_Procedure.CheatDoubleSpeed, + AI_Procedure.CheatInvertPad, + AI_Procedure.CheatRandomPad, + AI_Procedure.CheatRandomVignette, + AI_Procedure.Placeholder__Largo_LastProcedures_1, + AI_Procedure.Placeholder__Largo_LastProcedures_2, + AI_Procedure.Placeholder__Largo_LastProcedures_3, + AI_Procedure.Placeholder__Largo_LastProcedures_4, + AI_Procedure.Placeholder__Largo_LastProcedures_5, + AI_Procedure.Placeholder__Largo_LastProcedures_6, + AI_Procedure.Placeholder__Largo_LastProcedures_7, + AI_Procedure.Placeholder__Largo_LastProcedures_8, + AI_Procedure.Placeholder__Largo_LastProcedures_9, + AI_Procedure.Placeholder__Largo_LastProcedures_10, + AI_Procedure.Placeholder__Largo_LastProcedures_11, + AI_Procedure.Placeholder__Largo_LastProcedures_12, + AI_Procedure.Placeholder__Largo_LastProcedures_13, + AI_Procedure.Placeholder__Largo_LastProcedures_14, + AI_Procedure.Placeholder__Largo_LastProcedures_15, + AI_Procedure.Placeholder__Largo_LastProcedures_16, + AI_Procedure.Placeholder__Largo_LastProcedures_17, + AI_Procedure.Placeholder__Largo_LastProcedures_18, + AI_Procedure.Placeholder__Largo_LastProcedures_19, + AI_Procedure.Placeholder__Largo_LastProcedures_20, + AI_Procedure.Placeholder__Largo_LastProcedures_21, + AI_Procedure.Placeholder__Largo_LastProcedures_22, + AI_Procedure.Placeholder__Largo_LastProcedures_23, + AI_Procedure.Placeholder__Largo_LastProcedures_24, + AI_Procedure.Placeholder__Largo_LastProcedures_25, + }; + } + #endregion + + } + +} \ No newline at end of file diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/AI/Types/LargoWinch/AI_Types_LargoWinch_PC.cs.meta b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/AI/Types/LargoWinch/AI_Types_LargoWinch_PC.cs.meta new file mode 100644 index 00000000..faaea8bf --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/AI/Types/LargoWinch/AI_Types_LargoWinch_PC.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 352b76a8ba5ac3b47bfa0dc288ddbacb +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/AI/Types/Playmobil.meta b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/AI/Types/Playmobil.meta new file mode 100644 index 00000000..f364e005 --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/AI/Types/Playmobil.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: b70bb0cf077fcd843b5f3fe6e38dcf5e +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/AI/Types/Playmobil/AI_Types_Hype_PC.cs b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/AI/Types/Playmobil/AI_Types_Hype_PC.cs new file mode 100644 index 00000000..d2dda405 --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/AI/Types/Playmobil/AI_Types_Hype_PC.cs @@ -0,0 +1,613 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace BinarySerializer.Ubisoft.CPA { + public class AI_Types_Hype_PC : AI_Types_Hype_PS2 { + // Re-checked + + // Fields list: same as PS2 + + #region Conditions + // Slightly less than PS2 + protected override void InitConditions() { + Conditions = new AI_Condition[] { + AI_Condition.Et, + AI_Condition.Ou, + AI_Condition.Not, + AI_Condition.Equal, + AI_Condition.Different, + AI_Condition.Lesser, + AI_Condition.Greater, + AI_Condition.LesserOrEqual, + AI_Condition.GreaterOrEqual, + AI_Condition.PressedBut, + AI_Condition.JustPressedBut, + AI_Condition.ReleasedBut, + AI_Condition.JustReleasedBut, + AI_Condition.CollidePersoZDDNoWithPerso, + AI_Condition.CollideModuleZDDNoWithPerso, + AI_Condition.CollidePersoAllZDDWithPerso, + AI_Condition.CollidePersoZDDWithAnyPerso, + AI_Condition.CollideModuleZDDWithAnyPerso, + AI_Condition.CollidePersoZDENoWithPersoZDENo, + AI_Condition.CollideModuleZDENoWithPersoZDENo, + AI_Condition.CollidePersoZDENoWithModuleZDENo, + AI_Condition.CollideModuleZDENoWithModuleZDENo, + AI_Condition.CollidePersoZDENoWithPersoTypeZDE, + AI_Condition.CollideModuleZDENoWithPersoTypeZDE, + AI_Condition.CollidePersoTypeZDEWithPersoTypeZDE, + AI_Condition.CollidePersoAllZDEWithPersoAllZDE, + AI_Condition.CollidePersoTypeZDEWithPersoAllZDE, + AI_Condition.CollidePersoAllZDEWithPersoTypeZDE, + AI_Condition.CollidePersoZDENoWithTypeZDE, + AI_Condition.CollideModuleZDENoWithTypeZDE, + AI_Condition.CollideMovingZDM, + AI_Condition.CollideWithGround, + AI_Condition.CollideWithWall, + AI_Condition.CollideWithNothing, + AI_Condition.CollideWithSlope, + AI_Condition.CollideWithAttic, + AI_Condition.CollideWithCeiling, + AI_Condition.CollideWithPerso, + AI_Condition.CollideWithTrap, + AI_Condition.CollideWithPoint, + AI_Condition.CollideWithTriangle, + AI_Condition.CollideWithEdge, + AI_Condition.CollideWithSphere, + AI_Condition.CollideWithAlignedBox, + AI_Condition.ZDMCollideWithGround, + AI_Condition.ZDMCollideWithWall, + AI_Condition.ZDMCollideWithNothing, + AI_Condition.ZDMCollideWithSlope, + AI_Condition.ZDMCollideWithAttic, + AI_Condition.ZDMCollideWithCeiling, + AI_Condition.InEnvironmentAir, + AI_Condition.InEnvironmentWater, + AI_Condition.InEnvironmentFire, + AI_Condition.IsPersoInList, + AI_Condition.ListEmptyTest, + AI_Condition.IsTimeElapsed, + AI_Condition.IsInComport, + AI_Condition.IsInReflex, + AI_Condition.ChangeActionEnable, + AI_Condition.IsInAction, + AI_Condition.IsTypeOfGMTCollide, + // AI_Condition.WallIsTypeOfGMTCollide, // Not on PC + // AI_Condition.ObstacleIsTypeOfGMTCollide, // Not on PC + AI_Condition.IsThereMechEvent, + AI_Condition.IsValidObject, + AI_Condition.IsValidWayPoint, + AI_Condition.IsValidGMT, + AI_Condition.IsValidAction, + AI_Condition.IsValidWay, + AI_Condition.InTopOfJump, + AI_Condition.CanSwim, + AI_Condition.CanSwimOnSurface, + AI_Condition.CanSwimUnderWater, + AI_Condition.IsNotOutOfDepth, + AI_Condition.IsCompletelyOutOfWater, + AI_Condition.LSY_IsSpeechOver, + AI_Condition.SeePerso, + AI_Condition.SeePosition, + AI_Condition.SeePositionWithOffset, + AI_Condition.SeePersoWithOffset, + AI_Condition.IsSectorInTranslation, + AI_Condition.IsSectorInRotation, + AI_Condition.IsCameraInState, + AI_Condition.IsCameraInInitialState, + AI_Condition.IsCameraActive, + AI_Condition.IsCameraViewportOwner, + AI_Condition.IsCameraTargetVisible, + AI_Condition.IsCameraTargetMoving, + AI_Condition.IsCameraReachedItsOptPos, + AI_Condition.IsCameraInAlphaOrientation, + AI_Condition.IsCameraInTetaOrientation, + AI_Condition.IsSurfaceHeightMoving, + AI_Condition.TestPower, + AI_Condition.IsActivable, + AI_Condition.HasAtLeft, + AI_Condition.HasAtRight, + AI_Condition.HasBehind, + AI_Condition.HasInFront, + AI_Condition.HasAbove, + AI_Condition.HasBelow, + AI_Condition.UserEvent_IsSet, + AI_Condition.IsPersoLightOn, + AI_Condition.IsPersoLightPulseOn, + AI_Condition.IsPersoLightGyroPhareOn, + AI_Condition.IsZDMCollideWithObstacle, + AI_Condition.IsZDMCollideWithWall, + AI_Condition.IsZDMCollideWithGround, + AI_Condition.IsCustomBitSet, + AI_Condition.CollisionWP, + AI_Condition.IsGiBlock, + AI_Condition.IsNullVector, + AI_Condition.HasTheCapability, + AI_Condition.HasTheCapabilityNumber, + AI_Condition.PersoHasTheCapability, + AI_Condition.PersoHasTheCapabilityNumber, + AI_Condition.HasOneOfTheCapabilities, + AI_Condition.PersoHasOneOfTheCapabilities, + AI_Condition.GetAction, + AI_Condition.Inv_InventairePlein, + AI_Condition.Inv_TrouverObjet, + AI_Condition.GetDialogStatus, + AI_Condition.DLG_IsDialogOver, + AI_Condition.DLG_IsScrollingOver, + AI_Condition.ActionFinished, + AI_Condition.SCT_ActorInSector, + AI_Condition.CollisionSphereSphere, + AI_Condition.SectorActive, + AI_Condition.IsSoundFinished, + }; + } + #endregion + + #region Functions + protected override void InitFunctions() { + base.InitFunctions(); + var funcList = Functions.ToList(); + // These two functions were added on PS2 + funcList.Remove(AI_Function.GetLaserPointerDistaneToStaticMap); + funcList.Remove(AI_Function.SND_GetMicroOrientationPerso); + Functions = funcList.ToArray(); + } + #endregion + + #region Procedures + protected override void InitProcedures() { + Procedures = new AI_Procedure[] { + AI_Procedure.PlayerIsDead, + AI_Procedure.ChangeInitPosition, + AI_Procedure.SetMainActor, + AI_Procedure.ActivateObject, + AI_Procedure.DesactivateObject, + AI_Procedure.ChangeMap, + AI_Procedure.SetActionReturn, + AI_Procedure.FactorAnimationFrameRate, + AI_Procedure.PlayerIsDeadWithOption, + AI_Procedure.BecomesSonOfPerso, + AI_Procedure.BecomesFatherOfPerso, + AI_Procedure.FillListWithSons, + AI_Procedure.ActivateObjectOnPosition, + AI_Procedure.ChangeMapAtPosition, + AI_Procedure.PlayerIsDeadWithPlacement, + AI_Procedure.AllowDynamLOD, + AI_Procedure.ForbidDynamLOD, + AI_Procedure.ResetSpeed, + AI_Procedure.ResetOrientation, + AI_Procedure.SetRotationAxe, + AI_Procedure.SetAlphaAngle, + AI_Procedure.SetRotationAngleStep, + AI_Procedure.SetThetaAngle, + AI_Procedure.SetImpulse, + AI_Procedure.SetNormSpeed, + AI_Procedure.AddNormSpeed, + AI_Procedure.MulNormSpeed, + AI_Procedure.SetDirectionSpeed, + AI_Procedure.AddDirectionSpeed, + AI_Procedure.SetVectorSpeed, + AI_Procedure.AddWind, + AI_Procedure.SetDynamScalar, + AI_Procedure.SetTarget, + AI_Procedure.TurnAround, + AI_Procedure.GoRelative, + AI_Procedure.GoInDirection, + AI_Procedure.TurnLeft, + AI_Procedure.TurnRight, + AI_Procedure.TurnUp, + AI_Procedure.TurnLateralLeft, + AI_Procedure.TurnLateralright, + AI_Procedure.Brake, + AI_Procedure.AccelTurbo, + AI_Procedure.TurnDown, + AI_Procedure.Pulse, + AI_Procedure.StonePulse, + AI_Procedure.Jump, + AI_Procedure.JumpAbsolute, + AI_Procedure.JumpWithoutAddingSpeed, + AI_Procedure.Fire, + AI_Procedure.GoTarget, + AI_Procedure.ReachTarget, + AI_Procedure.SetHitPoints, + AI_Procedure.SetHitPointsToInitValue, + AI_Procedure.SetHitPointsToMaxValue, + AI_Procedure.AddHitPoints, + AI_Procedure.SubHitPoints, + AI_Procedure.SetHitPointsMax, + AI_Procedure.SetHitPointsMaxToInitValue, + AI_Procedure.SetHitPointsMaxToMaxValue, + AI_Procedure.AddHitPointsMax, + AI_Procedure.SubHitPointsMax, + AI_Procedure.ListAffectPersoZDD, + AI_Procedure.ListAffectModuleZDD, + AI_Procedure.ListAffectPersoZDE, + AI_Procedure.ListAffectModuleZDE, + AI_Procedure.ListAffectPersoTypeZDE, + AI_Procedure.ListAffectModuleTypeZDE, + AI_Procedure.ListAffectTypeZDEWithTypeZDE, + AI_Procedure.AddPersoInList, + AI_Procedure.AddPersoInListAt, + AI_Procedure.DeletePersoAtInList, + AI_Procedure.FindPersoAndDeleteInList, + AI_Procedure.ListSelect, + AI_Procedure.ListUnSelect, + AI_Procedure.ListSort, + AI_Procedure.ListSortByFamily, + AI_Procedure.FillListWithAllPersoOfAFamily, + AI_Procedure.ListUnion, + AI_Procedure.ListInter, + AI_Procedure.ListDiff, + AI_Procedure.ListAdd, + AI_Procedure.SwapLinkTableObjects, + AI_Procedure.ChangeCurrentObjectTable, + AI_Procedure.BuildObjectTableFromTableAndString, + AI_Procedure.LSY_StartSpeech, + AI_Procedure.LSY_StopSpeech, + AI_Procedure.TakeModuleControl, + AI_Procedure.ReleaseModuleControl, + AI_Procedure.InitModuleControlWithAnimTranslation, + AI_Procedure.InitModuleControlWithAnimRotation, + AI_Procedure.RotateSector, + AI_Procedure.RotateSectorLocalX, + AI_Procedure.RotateSectorLocalY, + AI_Procedure.RotateSectorLocalZ, + AI_Procedure.LevelSaveRotationSector, + AI_Procedure.PlayerSaveRotationSector, + AI_Procedure.TranslateSector, + AI_Procedure.TranslateLocalSector, + AI_Procedure.SaveGame, + AI_Procedure.IncHistoryAndSaveGame, + AI_Procedure.SaveAllGameValues, + AI_Procedure.EnableEscape, + AI_Procedure.ResetButtonState, + AI_Procedure.ActivateChannel, + AI_Procedure.DeactivateChannel, + AI_Procedure.FogOn, + AI_Procedure.FogOff, + AI_Procedure.SetFogColor, + AI_Procedure.SetFogNearFarInf, + AI_Procedure.PersoLightOn, + AI_Procedure.PersoLightOff, + AI_Procedure.SetPersoLightColor, + AI_Procedure.SetPersoLightNearFar, + AI_Procedure.SetPersoLightLittleBigAlpha, + AI_Procedure.SetPersoLightGyrophare, + AI_Procedure.SetPersoLightPulse, + AI_Procedure.SetPersoLightParalleleType, + AI_Procedure.SetPersoLightSphericalType, + AI_Procedure.SetPersoLightHotSpotType, + AI_Procedure.SetPersoLightAmbientType, + AI_Procedure.DYL_ChangeGraduallyIntensity, + AI_Procedure.DYL_CopyStaticToDynamic, + AI_Procedure.AddSurfaceHeight, + AI_Procedure.MoveSurfaceHeight, + AI_Procedure.LevelSaveMovingSurface, + AI_Procedure.PlayerSaveMovingSurface, + AI_Procedure.SendSoundRequest, + AI_Procedure.SendVoiceRequest, + AI_Procedure.SendMusicRequest, + AI_Procedure.DisplaylValue, + AI_Procedure.DisplaylChrono, + AI_Procedure.DisplayString, + AI_Procedure.ActivateString, + AI_Procedure.EraseString, + AI_Procedure.Camera_UpdatePosition, + AI_Procedure.Camera_Reset, + AI_Procedure.Camera_ActSctUpdPatch, + AI_Procedure.Camera_RestoreAfterTrame, + AI_Procedure.Camera_CancelRestoreTrame, + AI_Procedure.Camera_ShowInfo, + AI_Procedure.Camera_ChangeCamera, + AI_Procedure.Camera_ActiveCamera, + AI_Procedure.Camera_ChangeDistance, + AI_Procedure.Camera_ChangeBoundDist, + AI_Procedure.Camera_ChangeCamLinearSpeed, + AI_Procedure.Camera_ChangeCamLinearInertia, + AI_Procedure.Camera_ChangeCamAngularSpeed, + AI_Procedure.Camera_ChangeCamAngularInertia, + AI_Procedure.Camera_ChangeTgtLinearSpeed, + AI_Procedure.Camera_MoveTarget, + AI_Procedure.Camera_MoveLookTarget, + AI_Procedure.Camera_MoveShift, + AI_Procedure.Camera_ChangeAngle, + AI_Procedure.Camera_Move, + AI_Procedure.Camera_Turn, + AI_Procedure.Camera_ManageSavePos, + AI_Procedure.Camera_ChangeState, + AI_Procedure.Camera_ChangeFocal, + AI_Procedure.Camera_ActivateFocalParsing, + AI_Procedure.Camera_ChangeTargetedPerso, + AI_Procedure.Camera_ChangeTargetedChannel, + AI_Procedure.Camera_StopTargettingChannel, + AI_Procedure.Camera_RestoreInitialTargetedPerso, + AI_Procedure.Camera_Shake, + AI_Procedure.Camera_SetPosition, + AI_Procedure.Camera_ChangeFlag, + AI_Procedure.Camera_SavePositionAsOptimal, + AI_Procedure.Camera_SetAdditionnalTarget, + AI_Procedure.Camera_SetApexParameters, + AI_Procedure.Camera_SetCameraZMax, + AI_Procedure.Camera_ResetCameraZMax, + AI_Procedure.Camera_SetCameraZMin, + AI_Procedure.Camera_ResetCameraZMin, + AI_Procedure.Camera_SetCameraOrientation, + AI_Procedure.Camera_SetCameraPosition, + AI_Procedure.Camera_SetTargetPosition, + AI_Procedure.Camera_ChangeOrientationAngleMax, + AI_Procedure.Camera_ChangeOrientationAngularSpeed, + AI_Procedure.Camera_ChangeChannel, + AI_Procedure.Camera_ChangeHard, + AI_Procedure.Camera_RepositionHard, + AI_Procedure.SetPower, + AI_Procedure.SubPower, + AI_Procedure.AddPower, + AI_Procedure.TransparentDisplay, + AI_Procedure.DefaultDisplay, + AI_Procedure.SetTransparency, + AI_Procedure.DisplayFixFlag, + AI_Procedure.StartMenuWithPauseGame, + AI_Procedure.StartMenuWithoutPauseGame, + AI_Procedure.DisplayVignetteDuringTime, + AI_Procedure.SetParticleGeneratorOn, + AI_Procedure.SetParticleGeneratorOff, + AI_Procedure.SetParticleGenerator, + AI_Procedure.SetGenerationModeNone, + AI_Procedure.SetGenerationModeContinuous, + AI_Procedure.SetGenerationModeCrenel, + AI_Procedure.SetGenerationModeProbability, + AI_Procedure.SetGenerationNumberConstant, + AI_Procedure.SetGenerationNumberProbabilist, + AI_Procedure.SetGenerationInfiniteLifeTime, + AI_Procedure.SetGenerationConstantLifeTime, + AI_Procedure.SetGenerationProbabilistLifeTime, + AI_Procedure.DeactivateBut, + AI_Procedure.ActivateBut, + AI_Procedure.None, + AI_Procedure.ChangeComport, + AI_Procedure.ChangeComportReflex, + AI_Procedure.ChangeMyComport, + AI_Procedure.ChangeMyComportReflex, + AI_Procedure.TurnAbsoluteDirection, + AI_Procedure.GoAbsoluteDirection, + AI_Procedure.Accelerate, + AI_Procedure.Turn, + AI_Procedure.Turn2, + AI_Procedure.DeltaTurnPerso, + AI_Procedure.TurnPerso, + AI_Procedure.ChangeAction, + AI_Procedure.ChangeActionRandom, + AI_Procedure.ReInitWay, + AI_Procedure.ReInitWayBack, + AI_Procedure.InitWayWithWp, + AI_Procedure.SwimPulse, + AI_Procedure.Ski_TurnLeft, + AI_Procedure.Ski_TurnRight, + AI_Procedure.KillPerso, + AI_Procedure.SetMechanicalGMTAdhesionCoef, + AI_Procedure.SetMechanicalGMTAbsorptionCoef, + AI_Procedure.SetMechanicalGMTFrictionCoef, + AI_Procedure.SetMechanicalGMTSlideCoef, + AI_Procedure.SetMechanicalGMTProgressionCoef, + AI_Procedure.SetMechanicalGMTPenetrationCoef, + AI_Procedure.SetMechanicalGMTPenetrationMaxCoef, + AI_Procedure.SetVisualGMTColor, + AI_Procedure.SetVisualGMTSpecularExponent, + AI_Procedure.SetVisualGMTSpecularCoef, + AI_Procedure.SetVisualGMTDiffuseCoef, + AI_Procedure.SetVisualGMTAmbientCoef, + AI_Procedure.SetVisualGMTAsChromed, + AI_Procedure.SetVisualGMTTextureScrollingCoef, + AI_Procedure.LockVisualGMT, + AI_Procedure.UnlockVisualGMT, + AI_Procedure.SetVisualGMTFrame, + AI_Procedure.FootPath_AddFootPrint, + AI_Procedure.FootPath_Clear, + AI_Procedure.ReleaseAllModulesControl, + AI_Procedure.ConfirmModuleControl, + AI_Procedure.OptionChangeScreenSize, + AI_Procedure.OptionChangeDetailsValue, + AI_Procedure.OptionChangeMusicVolume, + AI_Procedure.OptionChangeSfxVolume, + AI_Procedure.OptionChangeVoiceVolume, + AI_Procedure.SetPersoAbsolutePosition, + AI_Procedure.RelativeMovePerso, + AI_Procedure.SetModuleAbsolutePosition, + AI_Procedure.RelativeMoveModule, + AI_Procedure.ChangeModuleSighting, + AI_Procedure.RotatePersoAroundX, + AI_Procedure.RotatePersoAroundY, + AI_Procedure.RotatePersoAroundZ, + AI_Procedure.RotateModuleAroundX, + AI_Procedure.RotateModuleAroundY, + AI_Procedure.RotateModuleAroundZ, + AI_Procedure.ZoomPerso, + AI_Procedure.ZoomModule, + AI_Procedure.Invisible, + AI_Procedure.Visible, + AI_Procedure.AddChildToChannelOfActor, + AI_Procedure.RemoveChildFromChannelOfActor, + AI_Procedure.vEnableMapObject, + AI_Procedure.vSetDestination, + AI_Procedure.vResetDestination, + AI_Procedure.ChangeOneCustomBit, + AI_Procedure.ChangeManyCustomBits, + AI_Procedure.StringAddChar, + AI_Procedure.StringReplaceChar, + AI_Procedure.StringRemoveChar, + AI_Procedure.Weightlessness, + AI_Procedure.OrientWallNormal, + AI_Procedure.SetAnimationGravity, + AI_Procedure.FixePositionZDM, + AI_Procedure.FixePositionZDD, + AI_Procedure.FixePositionZDE, + AI_Procedure.ChangeLightIntensity, + AI_Procedure.GiveImpulsionRope, + AI_Procedure.ChangeSpringConstantForChannel, + AI_Procedure.RopeHitAWall, + AI_Procedure.FixePointsDeMagie, + AI_Procedure.FixePointsDeMagieMax, + AI_Procedure.InitPointsDeMagie, + AI_Procedure.InitPointsDeMagieMax, + AI_Procedure.AjoutePointsDeMagie, + AI_Procedure.AjoutePointsDeMagieMax, + AI_Procedure.EnlevePointsDeMagie, + AI_Procedure.EnlevePointsDeMagieMax, + AI_Procedure.SetCapabilities, + AI_Procedure.AddCapabilities, + AI_Procedure.SubCapabilities, + AI_Procedure.ActiveSector, + AI_Procedure.DesactiveSector, + AI_Procedure.ActiveSectorVisibility, + AI_Procedure.DesactiveSectorVisibility, + AI_Procedure.ActiveSectorCollisions, + AI_Procedure.DesactiveSectorCollisions, + AI_Procedure.QuitGame, + AI_Procedure.ReturnToMainMenu, + AI_Procedure.DisplayVignetteAndReturnToMainMenu, + AI_Procedure.DisplayVignetteAndQuitGame, + + AI_Procedure.ActivateOptSectors, + AI_Procedure.DeactivateOptSectors, + AI_Procedure.SetGameState, + AI_Procedure.SetMouseCursorTexture, + AI_Procedure.RestoreComport, + AI_Procedure.RestoreMyComport, + AI_Procedure.SCT_SetTransparence, + AI_Procedure.setFadeValue, + AI_Procedure.setFadeTexture, + AI_Procedure.setFadeOn, + AI_Procedure.setFadeOff, + AI_Procedure.StartFade, + AI_Procedure.StartFadeMS, + AI_Procedure.ToggleWideScreen, + AI_Procedure.EndDialog, + AI_Procedure.RunDialog, + AI_Procedure.ScrollDialog, + AI_Procedure.SelectDialog, + AI_Procedure.PositionDialog, + AI_Procedure.DLG_ChangeAction, + AI_Procedure.DLG_ChangeComport, + AI_Procedure.DLG_ActivateChannel, + AI_Procedure.SND_SetSoundEventActivation, + AI_Procedure.ActivateCreditsMotorMode, + AI_Procedure.ActivateInventoryMotorMode, + AI_Procedure.ActivateBinocularMotorMode, + AI_Procedure.ActivateSaveGameMotorMode, + AI_Procedure.ActivateLaserPointer, + AI_Procedure.HideLaserPointer, + AI_Procedure.SetLaserPointerDistance, + AI_Procedure.SetLaserPointerTexture, + AI_Procedure.SetLaserPointerDetails, + AI_Procedure.LaserPointerSniper, + AI_Procedure.LaserPointerFly, + AI_Procedure.FadeRandom, + AI_Procedure.RopeInitialisation, + AI_Procedure.TurnInterpolationReset, + AI_Procedure.TurnInterpolationOff, + AI_Procedure.TurnInterpolationOn, + AI_Procedure.SetDraw, + AI_Procedure.SetImage, + AI_Procedure.SetToNextImage, + AI_Procedure.FadeImage, + AI_Procedure.MovingUV, + AI_Procedure.Rotation, + AI_Procedure.SetTextString, + AI_Procedure.SetTextNumber, + AI_Procedure.SlideGamePlayInterface, + AI_Procedure.HilitePerso, + AI_Procedure.ResetPersoToInitialState, + AI_Procedure.SetFlashingSpeed, + AI_Procedure.SetFlashingTransparent, + AI_Procedure.SetFlashingNotTransparent, + AI_Procedure.SetFlashingWithDefaultGMT, + AI_Procedure.SetFlashingNotWithDefaultGMT, + AI_Procedure.SetInitialGameFloors, + AI_Procedure.SetStandardFloor, + AI_Procedure.ActivateFloorGame, + AI_Procedure.SetColorPathGoal, + AI_Procedure.ChangeColor, + AI_Procedure.LGT_ChangeIntensity, + AI_Procedure.LGT_Switch, + AI_Procedure.LGT_SwitchAll, + AI_Procedure.SetStableEnvironnement, + AI_Procedure.ActivateMapMotorMode, + AI_Procedure.SetEpoque, + AI_Procedure.SetName, + AI_Procedure.RopeCareTaker, + AI_Procedure.ChangeChannelMassForPolySys, + AI_Procedure.FixNormReelSpeed, + AI_Procedure.LoadSoundBank, + AI_Procedure.UnLoadSoundBank, + AI_Procedure.KillMusic, + AI_Procedure.KillSoundEffect, + AI_Procedure.KillVoice, + AI_Procedure.KillAllSounds, + AI_Procedure.SND_ChangeMyVolumeEffects, + + AI_Procedure.SND_ChangeVolumeEffects, + AI_Procedure.SND_ChangeMyVolumeVoice, + AI_Procedure.SND_ChangeVolumeVoice, + AI_Procedure.SND_ChangeMyVolumeMusic, + AI_Procedure.SND_ChangeVolumeMusic, + AI_Procedure.SND_ChangeAllVolume, + AI_Procedure.SND_ResetMyVolumeEffects, + AI_Procedure.SND_ResetMyVolumeVoice, + AI_Procedure.SND_ResetMyVolumeMusic, + AI_Procedure.SND_ResetVolumeEffects, + AI_Procedure.SND_ResetVolumeVoice, + AI_Procedure.SND_ResetVolumeMusic, + AI_Procedure.SND_ResetAllVolume, + AI_Procedure.SND_SetEffectSound, + AI_Procedure.SND_SwitchMicroPerso, + AI_Procedure.SND_SwitchOldMicroPerso, + + AI_Procedure.SetVignetteIndex, + AI_Procedure.SND_SaveMusic, + AI_Procedure.SND_LoadMusic, + AI_Procedure.SND_FadeMusic, + AI_Procedure.SND_FadeVoice, + AI_Procedure.SND_FadeSound, + AI_Procedure.SND_FadeAll, + AI_Procedure.SND_FadeObjectAndStop, + AI_Procedure.SND_FadeInObject, + AI_Procedure.SND_KillSoundObject, + AI_Procedure.SetEconomicPersoAbsolutePosition, + AI_Procedure.ScaleModule, + AI_Procedure.Inv_DeselectionnerObjetSelectionne, + AI_Procedure.Inv_ChangerCapaciteMaximumObjet, + AI_Procedure.Inv_ChangerEtatJoyau, + AI_Procedure.Inv_ChangerLeNombreDuStockLst, + AI_Procedure.Inv_AfficherUnObjet, + AI_Procedure.Stats_DisplayMainActorLife, + AI_Procedure.Stats_DisplayMainActorArmor, + AI_Procedure.Stats_DisplayMainActorMagic, + AI_Procedure.Stats_DisplayMainActorSelectedObject, + AI_Procedure.Stats_DisplayMainActorWeapon, + AI_Procedure.Stats_DisplayDragon, + AI_Procedure.Stats_DisplayCash, + AI_Procedure.Fight_ChangeArmor, + AI_Procedure.Fight_ChangeArmorResistance, + AI_Procedure.Fight_RepairArmor, + AI_Procedure.Fight_SubHitPointsEnemy, + AI_Procedure.Magic_ChangeInitialMagicPoints, + AI_Procedure.Magic_ChangeMaxMagicPoints, + AI_Procedure.Magic_InitMagicPointsToInit, + AI_Procedure.Magic_InitMagicPointsToMax, + AI_Procedure.Magic_SelectPrevSpellType, + AI_Procedure.Magic_SelectNextSpellType, + AI_Procedure.Dragon_ChangeInitialNbrDiamonds, + AI_Procedure.Dragon_ChangeMaxNbrDiamonds, + AI_Procedure.Dragon_InitDiamondsToInit, + AI_Procedure.Dragon_InitDiamondsToMax, + AI_Procedure.Dragon_SetDragonActor, + AI_Procedure.Demo_ValidateMap, + AI_Procedure.ChangeViseePerso, + }; + } + #endregion + } +} diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/AI/Types/Playmobil/AI_Types_Hype_PC.cs.meta b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/AI/Types/Playmobil/AI_Types_Hype_PC.cs.meta new file mode 100644 index 00000000..21d7f871 --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/AI/Types/Playmobil/AI_Types_Hype_PC.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: d5ad2f54d303a914680675da05047c38 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/AI/Types/Playmobil/AI_Types_Hype_PS2.cs b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/AI/Types/Playmobil/AI_Types_Hype_PS2.cs new file mode 100644 index 00000000..31ff07da --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/AI/Types/Playmobil/AI_Types_Hype_PS2.cs @@ -0,0 +1,1088 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace BinarySerializer.Ubisoft.CPA { + public class AI_Types_Hype_PS2 : AI_Types { + // Re-checked + + #region DsgVar Types + protected override void InitVariableTypes() { + VariableTypes = new AI_DsgVarType[] { + AI_DsgVarType.Boolean, + AI_DsgVarType.SByte, + AI_DsgVarType.UByte, + AI_DsgVarType.Short, + AI_DsgVarType.UShort, + AI_DsgVarType.Int, + AI_DsgVarType.UInt, + AI_DsgVarType.Float, + AI_DsgVarType.WayPoint, + AI_DsgVarType.Way, + AI_DsgVarType.Perso, + AI_DsgVarType.List, + AI_DsgVarType.Vector, + AI_DsgVarType.Comport, + AI_DsgVarType.Action, + AI_DsgVarType.Text, + AI_DsgVarType.GameMaterial, + AI_DsgVarType.Caps, + AI_DsgVarType.Graph, + AI_DsgVarType.PersoArray, + AI_DsgVarType.VectorArray, + AI_DsgVarType.FloatArray, + AI_DsgVarType.IntegerArray, + AI_DsgVarType.WayPointArray, + AI_DsgVarType.TextArray, + AI_DsgVarType.ActionArray, + AI_DsgVarType.None + }; + } + #endregion + + #region Node types + protected override void InitInterpretTypes() { + InterpretTypes = new AI_InterpretType[] { + AI_InterpretType.KeyWord, // 0 + AI_InterpretType.Condition, + AI_InterpretType.Operator, + AI_InterpretType.Function, + AI_InterpretType.Procedure, + AI_InterpretType.MetaAction, // 5 + AI_InterpretType.BeginMacro, + AI_InterpretType.EndMacro, + AI_InterpretType.EndTree, + AI_InterpretType.Field, + AI_InterpretType.DsgVar, // 10 + AI_InterpretType.DsgVarRef, + AI_InterpretType.Constant, + AI_InterpretType.Real, + AI_InterpretType.Button, + AI_InterpretType.ConstantVector, // 15 + AI_InterpretType.Vector, + AI_InterpretType.Mask, + AI_InterpretType.Module, + AI_InterpretType.DsgVarId, + AI_InterpretType.String, // 20 + AI_InterpretType.LipsSynchroRef, + AI_InterpretType.FamilyRef, + AI_InterpretType.Way, + AI_InterpretType.PersoRef, + AI_InterpretType.ActionRef, // 25 + AI_InterpretType.EnvironmentRef, + AI_InterpretType.SuperObjectRef, + AI_InterpretType.SurfaceRef, + AI_InterpretType.WayPointRef, + AI_InterpretType.TextRef, // 30 + AI_InterpretType.FontRef, + AI_InterpretType.ComportRef, + AI_InterpretType.ModuleRef, + AI_InterpretType.SoundEventRef, + AI_InterpretType.ObjectTableRef, // 35 + AI_InterpretType.GameMaterialRef, + AI_InterpretType.ParticleGenerator, + AI_InterpretType.Color, + AI_InterpretType.ModelRef, + AI_InterpretType.Caps, + AI_InterpretType.GraphRef + }; + } + #endregion + + #region Conditions + protected override void InitConditions() { + Conditions = new AI_Condition[] { + AI_Condition.Et, + AI_Condition.Ou, + AI_Condition.Not, + AI_Condition.Equal, + AI_Condition.Different, + AI_Condition.Lesser, + AI_Condition.Greater, + AI_Condition.LesserOrEqual, + AI_Condition.GreaterOrEqual, + AI_Condition.PressedBut, + AI_Condition.JustPressedBut, + AI_Condition.ReleasedBut, + AI_Condition.JustReleasedBut, + AI_Condition.CollidePersoZDDNoWithPerso, + AI_Condition.CollideModuleZDDNoWithPerso, + AI_Condition.CollidePersoAllZDDWithPerso, + AI_Condition.CollidePersoZDDWithAnyPerso, + AI_Condition.CollideModuleZDDWithAnyPerso, + AI_Condition.CollidePersoZDENoWithPersoZDENo, + AI_Condition.CollideModuleZDENoWithPersoZDENo, + AI_Condition.CollidePersoZDENoWithModuleZDENo, + AI_Condition.CollideModuleZDENoWithModuleZDENo, + AI_Condition.CollidePersoZDENoWithPersoTypeZDE, + AI_Condition.CollideModuleZDENoWithPersoTypeZDE, + AI_Condition.CollidePersoTypeZDEWithPersoTypeZDE, + AI_Condition.CollidePersoAllZDEWithPersoAllZDE, + AI_Condition.CollidePersoTypeZDEWithPersoAllZDE, + AI_Condition.CollidePersoAllZDEWithPersoTypeZDE, + AI_Condition.CollidePersoZDENoWithTypeZDE, + AI_Condition.CollideModuleZDENoWithTypeZDE, + AI_Condition.CollideMovingZDM, + AI_Condition.CollideWithGround, + AI_Condition.CollideWithWall, + AI_Condition.CollideWithNothing, + AI_Condition.CollideWithSlope, + AI_Condition.CollideWithAttic, + AI_Condition.CollideWithCeiling, + AI_Condition.CollideWithPerso, + AI_Condition.CollideWithTrap, + AI_Condition.CollideWithPoint, + AI_Condition.CollideWithTriangle, + AI_Condition.CollideWithEdge, + AI_Condition.CollideWithSphere, + AI_Condition.CollideWithAlignedBox, + AI_Condition.ZDMCollideWithGround, + AI_Condition.ZDMCollideWithWall, + AI_Condition.ZDMCollideWithNothing, + AI_Condition.ZDMCollideWithSlope, + AI_Condition.ZDMCollideWithAttic, + AI_Condition.ZDMCollideWithCeiling, + AI_Condition.InEnvironmentAir, + AI_Condition.InEnvironmentWater, + AI_Condition.InEnvironmentFire, + AI_Condition.IsPersoInList, + AI_Condition.ListEmptyTest, + AI_Condition.IsTimeElapsed, + AI_Condition.IsInComport, + AI_Condition.IsInReflex, + AI_Condition.ChangeActionEnable, + AI_Condition.IsInAction, + AI_Condition.IsTypeOfGMTCollide, + AI_Condition.WallIsTypeOfGMTCollide, // New on PS2 + AI_Condition.ObstacleIsTypeOfGMTCollide, // New on PS2 + AI_Condition.IsThereMechEvent, + AI_Condition.IsValidObject, + AI_Condition.IsValidWayPoint, + AI_Condition.IsValidGMT, + AI_Condition.IsValidAction, + AI_Condition.IsValidWay, + AI_Condition.InTopOfJump, + AI_Condition.CanSwim, + AI_Condition.CanSwimOnSurface, + AI_Condition.CanSwimUnderWater, + AI_Condition.IsNotOutOfDepth, + AI_Condition.IsCompletelyOutOfWater, + AI_Condition.LSY_IsSpeechOver, + AI_Condition.SeePerso, + AI_Condition.SeePosition, + AI_Condition.SeePositionWithOffset, + AI_Condition.SeePersoWithOffset, + AI_Condition.IsSectorInTranslation, + AI_Condition.IsSectorInRotation, + AI_Condition.IsCameraInState, + AI_Condition.IsCameraInInitialState, + AI_Condition.IsCameraActive, + AI_Condition.IsCameraViewportOwner, + AI_Condition.IsCameraTargetVisible, + AI_Condition.IsCameraTargetMoving, + AI_Condition.IsCameraReachedItsOptPos, + AI_Condition.IsCameraInAlphaOrientation, + AI_Condition.IsCameraInTetaOrientation, + AI_Condition.IsSurfaceHeightMoving, + AI_Condition.TestPower, + AI_Condition.IsActivable, + AI_Condition.HasAtLeft, + AI_Condition.HasAtRight, + AI_Condition.HasBehind, + AI_Condition.HasInFront, + AI_Condition.HasAbove, + AI_Condition.HasBelow, + AI_Condition.UserEvent_IsSet, + AI_Condition.IsPersoLightOn, + AI_Condition.IsPersoLightPulseOn, + AI_Condition.IsPersoLightGyroPhareOn, + AI_Condition.IsZDMCollideWithObstacle, + AI_Condition.IsZDMCollideWithWall, + AI_Condition.IsZDMCollideWithGround, + AI_Condition.IsCustomBitSet, + AI_Condition.CollisionWP, + AI_Condition.IsGiBlock, + AI_Condition.IsNullVector, + AI_Condition.HasTheCapability, + AI_Condition.HasTheCapabilityNumber, + AI_Condition.PersoHasTheCapability, + AI_Condition.PersoHasTheCapabilityNumber, + AI_Condition.HasOneOfTheCapabilities, + AI_Condition.PersoHasOneOfTheCapabilities, + AI_Condition.GetAction, + AI_Condition.Inv_InventairePlein, + AI_Condition.Inv_TrouverObjet, + AI_Condition.GetDialogStatus, + AI_Condition.DLG_IsDialogOver, + AI_Condition.DLG_IsScrollingOver, + AI_Condition.ActionFinished, + AI_Condition.SCT_ActorInSector, + AI_Condition.CollisionSphereSphere, + AI_Condition.SectorActive, + AI_Condition.IsSoundFinished, + }; + } + #endregion + + #region Operators + protected override void InitOperators() { + Operators = new AI_Operator[] { + AI_Operator.ScalarPlusScalar, + AI_Operator.ScalarMinusScalar, + AI_Operator.ScalarMulScalar, + AI_Operator.ScalarDivScalar, + AI_Operator.ScalarUnaryMinus, + AI_Operator.PlusAffect, + AI_Operator.MinusAffect, + AI_Operator.MulAffect, + AI_Operator.DivAffect, + AI_Operator.PlusPlusAffect, + AI_Operator.MinusMinusAffect, + AI_Operator.Affect, + AI_Operator.Dot, + AI_Operator.GetVectorX, + AI_Operator.GetVectorY, + AI_Operator.GetVectorZ, + AI_Operator.VectorPlusVector, + AI_Operator.VectorMinusVector, + AI_Operator.VectorMulScalar, + AI_Operator.VectorDivScalar, + AI_Operator.VectorUnaryMinus, + AI_Operator.SetVectorX, + AI_Operator.SetVectorY, + AI_Operator.SetVectorZ, + AI_Operator.Ultra, + AI_Operator.ModelCast, + AI_Operator.Array, + AI_Operator.AffectArray, + }; + } + #endregion + + #region Keywords + protected override void InitKeywords() { + Keywords = new AI_Keyword[] { + AI_Keyword.If, + AI_Keyword.Then, + AI_Keyword.Else, + AI_Keyword.EngineGoto, + AI_Keyword.Me, + AI_Keyword.MainActor, + AI_Keyword.World, + AI_Keyword.Nobody, + AI_Keyword.Nowhere, + AI_Keyword.Noway, + AI_Keyword.CapsNull, + AI_Keyword.NoGraph, + }; + } + #endregion + + #region Meta Actions + protected override void InitMetaActions() { + MetaActions = new AI_MetaAction[] { + AI_MetaAction.IncrementalTurn2, + AI_MetaAction.IncrementalTurn, + AI_MetaAction.Pursuit, + AI_MetaAction.DeltaPursuit, + AI_MetaAction.ExecuteAction, + AI_MetaAction.ExecuteActionPerso, + AI_MetaAction.WaitEndOfAction, + AI_MetaAction.WaitEndOfActionPerso, + AI_MetaAction.WaitEndOfAnim, + AI_MetaAction.WaitEndOfAnimPerso, + AI_MetaAction.SpeakAndWaitEnd, + AI_MetaAction.LSY_SpeakPersoAndWaitEnd, + AI_MetaAction.ExecuteActionAndTakeObject, + AI_MetaAction.ExecuteActionAndPutObject, + AI_MetaAction.ExecuteActionAndLaunchObject, + AI_MetaAction.ExecuteActionAndGenerateObject, + AI_MetaAction.AdjustPersoOnObjectAxes, + AI_MetaAction.AdjustPersoOnObject, + AI_MetaAction.RunAway, + AI_MetaAction.IncrementalTurnPosition, + AI_MetaAction.IncrementalDeltaTurnPerso2, + AI_MetaAction.IncrementalTurnPerso2, + AI_MetaAction.IncrementalDeltaTurnPerso, + AI_MetaAction.IncrementalTurnPerso, + AI_MetaAction.RunAwayWP, + AI_MetaAction.GoToWP, + AI_MetaAction.GoToWPXY, + AI_MetaAction.GoOverWay, + AI_MetaAction.GoOverWay3D, + AI_MetaAction.GoOverWayBack, + AI_MetaAction.GoToNextWPOfWay, + AI_MetaAction.GoToNextWPOfWayBack, + AI_MetaAction.GoToPosition, + AI_MetaAction.GoToPositionXY, + AI_MetaAction.GoOverShortestPath, + AI_MetaAction.GoOverShortestPathBezier, + AI_MetaAction.MoveLift, + AI_MetaAction.Wait, + AI_MetaAction.WaitBoolean, + AI_MetaAction.WaitNextTime, + AI_MetaAction.WaitInteger, + AI_MetaAction.WaitReal, + AI_MetaAction.IncrementalTurnPositionW, + AI_MetaAction.IncrementalTurnPositionWPerso, + AI_MetaAction.IncrementalTurnPersoW, + AI_MetaAction.IncrementalTurnPersoWPerso, + AI_MetaAction.IncrementalTurnPersoWPersoW, + AI_MetaAction.IncrementalTurnPersoWPersoWPerso, + AI_MetaAction.Camera_GoToPosition, + AI_MetaAction.Camera_GoToWP, + AI_MetaAction.Camera_GoOverWay, + AI_MetaAction.Camera_GoOverWayBack, + AI_MetaAction.Camera_GoToNextWPOfWay, + AI_MetaAction.Camera_GoToNextWPOfWayBack, + AI_MetaAction.Camera_StayInWay, + AI_MetaAction.Camera_GoToFromTarget, + AI_MetaAction.Camera_Shake, + AI_MetaAction.Camera_WaitUntil, + AI_MetaAction.RotateModule, + AI_MetaAction.RotateModuleToPerso, + AI_MetaAction.SwimToSurface, + AI_MetaAction.WaitEndOfFade, + AI_MetaAction.SendSoundRequestAndWait, + AI_MetaAction.SendVoiceRequestAndWait, + AI_MetaAction.SendVoiceRequestPersoAndWait, + AI_MetaAction.GoToPosition2, + AI_MetaAction.IncrementalTurnAbsDirection, + AI_MetaAction.IncTurnPersoAbsDirection, + AI_MetaAction.WaitNbFrames, + }; + } + #endregion + + #region Fields + protected override void InitFields() { + Fields = new AI_Field[] { + AI_Field.Position, + AI_Field.Orientation, + AI_Field.Speed, + AI_Field.NormSpeed, + AI_Field.AbsoluteAxisX, + AI_Field.AbsoluteAxisY, + AI_Field.AbsoluteAxisZ, + AI_Field.PrevComportIntell, + AI_Field.PrevComportReflex, + AI_Field.CollisionFlag, + AI_Field.ShadowScaleX, + AI_Field.ShadowScaleY, + }; + } + #endregion + + #region Functions + protected override void InitFunctions() { + Functions = new AI_Function[] { + AI_Function.GetPersoAbsolutePosition, + AI_Function.GetAngleAroundZToPerso, + AI_Function.GetAngleAroundZToPosition, + AI_Function.GetWPAbsolutePosition, + AI_Function.DistanceToPerso, + AI_Function.DistanceXToPerso, + AI_Function.DistanceYToPerso, + AI_Function.DistanceZToPerso, + AI_Function.DistanceXYToPerso, + AI_Function.DistanceXZToPerso, + AI_Function.DistanceYZToPerso, + AI_Function.DistanceToWP, + AI_Function.CloserWP, + AI_Function.DistanceToPosition, + AI_Function.DistanceToPersoCenter, + AI_Function.DistanceXToPersoCenter, + AI_Function.DistanceYToPersoCenter, + AI_Function.DistanceZToPersoCenter, + AI_Function.DistanceXYToPersoCenter, + AI_Function.DistanceXZToPersoCenter, + AI_Function.DistanceYZToPersoCenter, + AI_Function.Real, + AI_Function.Int, + AI_Function.Sinus, + AI_Function.Cosinus, + AI_Function.Square, + AI_Function.SquareRoot, + AI_Function.RandomInt, + AI_Function.RandomReal, + AI_Function.MinimumReal, + AI_Function.MaximumReal, + AI_Function.DegreeToRadian, + AI_Function.RadianToDegree, + AI_Function.AbsoluteValue, + AI_Function.AbsoluteInteger, + AI_Function.GetHitPoints, + AI_Function.AddAndGetHitPoints, + AI_Function.SubAndGetHitPoints, + AI_Function.GetHitPointsMax, + AI_Function.AddAndGetHitPointsMax, + AI_Function.SubAndGetHitPointsMax, + AI_Function.GetTime, + AI_Function.GetElapsedTime, + AI_Function.ListSize, + AI_Function.GivePersoInList, + AI_Function.InputAnalogicValue, + AI_Function.GenerateObject, + AI_Function.DepthEnv, + AI_Function.AltitudeEnv, + AI_Function.GetFather, + AI_Function.GetCamera, + AI_Function.GetMainCamera, + AI_Function.GetDistanceCameraTarget, + AI_Function.GetTargetCamera, + AI_Function.GetDistMinCamera, + AI_Function.GetDistMaxCamera, + AI_Function.GetBoundDistMin, + AI_Function.GetBoundDistMax, + AI_Function.GetAlphaCamera, + AI_Function.GetShiftAlphaCamera, + AI_Function.GetTetaCamera, + AI_Function.GetShiftTetaCamera, + AI_Function.GetOrientationXCamera, + AI_Function.GetOrientationYCamera, + AI_Function.GetOrientationZCamera, + AI_Function.GetCamLinearSpeedMin, + AI_Function.GetCamLinearSpeedMax, + AI_Function.GetCamAngularSpeed, + AI_Function.GetTgtLinearSpeed, + AI_Function.GetFocalCamera, + AI_Function.GetStateCamera, + AI_Function.GetFlagCamera, + AI_Function.GetActivationCamera, + AI_Function.GetShiftPersoCamera, + AI_Function.GetShiftVertexCamera, + AI_Function.GetLookVertexCamera, + AI_Function.ComputeAlphaAngleCameraTarget, + AI_Function.ComputeTetaAngleCameraTarget, + AI_Function.GetOrientationSpeed, + AI_Function.GetOrientationLimitX, + AI_Function.GetOrientationLimitY, + AI_Function.GetOrientationLimitZ, + AI_Function.ComputeTargetPosition, + AI_Function.GetNormSpeed, + AI_Function.GetAlphaPas, + AI_Function.GetThetaPas, + AI_Function.GetAlpha, + AI_Function.GetTheta, + AI_Function.GetVectorNorm, + AI_Function.AbsoluteVector, + AI_Function.RelativeVector, + AI_Function.GetEnvironmentToxicity, + AI_Function.AddColor, + AI_Function.AddRed, + AI_Function.AddGreen, + AI_Function.AddBlue, + AI_Function.AddAlpha, + AI_Function.ColorRedGreenBlueAlpha, + AI_Function.ColorRedGreenBlue, + AI_Function.ColorRed, + AI_Function.ColorGreen, + AI_Function.ColorBlue, + AI_Function.ColorAlpha, + AI_Function.GetCurrentCollidedGMT, + AI_Function.GetMechanicalGMTAdhesionCoef, + AI_Function.GetMechanicalGMTAbsorptionCoef, + AI_Function.GetMechanicalGMTFrictionCoef, + AI_Function.GetMechanicalGMTSlideCoef, + AI_Function.GetMechanicalGMTProgressionCoef, + AI_Function.GetMechanicalGMTPenetrationCoef, + AI_Function.GetMechanicalGMTPenetrationMaxCoef, + AI_Function.GetVisualGMTColor, + AI_Function.GetVisualGMTSpecularCoef, + AI_Function.GetVisualGMTSpecularExponent, + AI_Function.GetVisualGMTDiffuseCoef, + AI_Function.GetVisualGMTAmbientCoef, + AI_Function.GetVisualGMTTextureScrollingCoefU, + AI_Function.GetVisualGMTTextureScrollingCoefV, + AI_Function.GetVisualGMTFrame, + AI_Function.GetVisualGMTNumberOfFrames, + AI_Function.LitPointsDeMagie, + AI_Function.LitPointsDeMagieMax, + AI_Function.AjouteEtLitPointsDeMagie, + AI_Function.AjouteEtLitPointsDeMagieMax, + AI_Function.EnleveEtLitPointsDeMagie, + AI_Function.EnleveEtLitPointsDeMagieMax, + AI_Function.PersoLePlusProche, + AI_Function.PersoLePlusProcheAvecAngle, + AI_Function.ReseauLitIndexCourant, + AI_Function.ReseauForceIndexCourant, + AI_Function.ReseauLitPremierIndex, + AI_Function.ReseauLitDernierIndex, + AI_Function.ReseauIncrementIndex, + AI_Function.ReseauDecrementIndex, + AI_Function.ReseauLitWPAIndex, + AI_Function.ReseauLitCapaciteLiaison, + AI_Function.ReseauChangeCapaciteLiaison, + AI_Function.ReseauCheminLePlusCourt, + AI_Function.NetworkAllocateGraphToMSWay, + AI_Function.NetworkGetIndexOfWPInMSWay, + AI_Function.NetworkForceWPToCurrent, + AI_Function.ReseauWPLePlusProche, + AI_Function.NetworkWPCloserOrientation, + AI_Function.GetCapabilities, + AI_Function.CapabilityAtBitNumber, + AI_Function.VitesseHorizontaleDuPerso, + AI_Function.VitesseVerticaleDuPerso, + AI_Function.LitPositionZDM, + AI_Function.LitPositionZDE, + AI_Function.LitPositionZDD, + AI_Function.GetDeltaT, + AI_Function.VecteurLocalToGlobal, + AI_Function.VecteurGlobalToLocal, + AI_Function.GetNormalCollideVector, + AI_Function.GetCollidePoint, + AI_Function.GetCollisionPoint, + AI_Function.GetCollisionVector, + AI_Function.CrossProduct, + AI_Function.NormalizeVector, + AI_Function.GetLastTraversedMaterial, + AI_Function.GetModuleAbsolutePosition, + AI_Function.GetModuleRelativePosition, + AI_Function.GetModuleZoomFactor, + AI_Function.GetPersoZoomFactor, + AI_Function.GetPersoSighting, + AI_Function.GetModuleSighting, + AI_Function.GetPlayerName, + AI_Function.GetStringCharAt, + AI_Function.GetLastCollisionActor, + AI_Function.ComputeRebondVector, + AI_Function.ComputeRebondVector2, + AI_Function.VectorAngle, + AI_Function.VectorCos, + AI_Function.VectorSin, + AI_Function.GetNormalGroundVector, + AI_Function.PositionAbsolueCanal, + AI_Function.DistancePersoToCanal, + AI_Function.CollisionRopeSphere, + AI_Function.TBL_WayPointResearchInTable, + AI_Function.TBL_PersoResearchInTable, + AI_Function.MTH_DotProduct, + AI_Function.GetRopeSpeedVector, + AI_Function.GetRopeChannelPosition, + AI_Function.MTH_RoundRealToInteger, + AI_Function.GetCurrectAnimFrame, + AI_Function.PersoUnderCursor, + AI_Function.XCoordOfCursor, + AI_Function.YCoordOfCursor, + AI_Function.MTH_Puissance, + AI_Function.MTH_Modulo, + AI_Function.RelativeXPositionOfPerso, + AI_Function.RelativeYPositionOfPerso, + AI_Function.RelativeZPositionOfPerso, + AI_Function.RelativePositionOfPerso, + AI_Function.DistanceCaracToWP, + AI_Function.GetGameState, + AI_Function.Inv_AjouterObjet, + AI_Function.Inv_EnleverObjet, + AI_Function.Inv_LireOr, + AI_Function.Inv_AjouterOr, + AI_Function.Inv_EnleverOr, + AI_Function.Inv_LireArme, + AI_Function.Inv_ChangerArme, + AI_Function.Inv_LireMagie, + AI_Function.Inv_ChangerMagie, + AI_Function.Inv_LireObjet, + AI_Function.Inv_SelectionnerObjet, + AI_Function.Inv_UtiliserItem, + AI_Function.Inv_LireQuantiteObjet, + AI_Function.Inv_EnleverQuantiteObjet, + AI_Function.Inv_LireCapaciteMaximumObjet, + AI_Function.GetLaserPointerDirection, + AI_Function.GetLaserPointerDistance, + AI_Function.GetLaserPointerDistaneToStaticMap, + AI_Function.SpeedChannel, + AI_Function.ExecuteFloorGame, + AI_Function.DifferentFromCurrentImage, + AI_Function.IsDrawn, + AI_Function.DLG_PersoParle, + AI_Function.WP_IndexOfClosestWPinArray, + AI_Function.eReduceIndexOfVectorArray, + AI_Function.TBL_InitArray, + AI_Function.SND_GetMicroPerso, + AI_Function.SND_GetMicroOrientationPerso, + AI_Function.FightRemoveHitPointsMainActorWithArmor, + AI_Function.FightRemoveAndReadHitPointsEnemy, + AI_Function.FightReadArmorResistance, + AI_Function.FightGetNumberOfArmors, + AI_Function.Magic_ReadMagicPoints, + AI_Function.Magic_AddMagicPoints, + AI_Function.Magic_RemoveMagicPoints, + AI_Function.Magic_ReadMagicPointsMax, + AI_Function.Magic_ReadCurrentSpell, + AI_Function.Dragon_ReadNbrDiamonds, + AI_Function.Dragon_AddDiamonds, + AI_Function.Dragon_RemoveDiamonds, + AI_Function.Dragon_ReadNbrDiamondsMax, + AI_Function.POS_GetChannelPosition, + AI_Function.SendSoundRequest, + AI_Function.SendVoiceRequest, + AI_Function.SendMusicRequest, + AI_Function.GiveMeTheGround, + }; + } + #endregion + + #region Procedures + protected override void InitProcedures() { + Procedures = new AI_Procedure[] { + AI_Procedure.PlayerIsDead, + AI_Procedure.ChangeInitPosition, + AI_Procedure.SetMainActor, + AI_Procedure.ActivateObject, + AI_Procedure.DesactivateObject, + AI_Procedure.ChangeMap, + AI_Procedure.SetActionReturn, + AI_Procedure.FactorAnimationFrameRate, + AI_Procedure.PlayerIsDeadWithOption, + AI_Procedure.BecomesSonOfPerso, + AI_Procedure.BecomesFatherOfPerso, + AI_Procedure.FillListWithSons, + AI_Procedure.ActivateObjectOnPosition, + AI_Procedure.ChangeMapAtPosition, + AI_Procedure.PlayerIsDeadWithPlacement, + AI_Procedure.AllowDynamLOD, + AI_Procedure.ForbidDynamLOD, + AI_Procedure.ResetSpeed, + AI_Procedure.ResetOrientation, + AI_Procedure.SetRotationAxe, + AI_Procedure.SetAlphaAngle, + AI_Procedure.SetRotationAngleStep, + AI_Procedure.SetThetaAngle, + AI_Procedure.SetImpulse, + AI_Procedure.SetNormSpeed, + AI_Procedure.AddNormSpeed, + AI_Procedure.MulNormSpeed, + AI_Procedure.SetDirectionSpeed, + AI_Procedure.AddDirectionSpeed, + AI_Procedure.SetVectorSpeed, + AI_Procedure.AddWind, + AI_Procedure.SetDynamScalar, + AI_Procedure.SetTarget, + AI_Procedure.TurnAround, + AI_Procedure.GoRelative, + AI_Procedure.GoInDirection, + AI_Procedure.TurnLeft, + AI_Procedure.TurnRight, + AI_Procedure.TurnUp, + AI_Procedure.TurnLateralLeft, + AI_Procedure.TurnLateralright, + AI_Procedure.Brake, + AI_Procedure.AccelTurbo, + AI_Procedure.TurnDown, + AI_Procedure.Pulse, + AI_Procedure.StonePulse, + AI_Procedure.Jump, + AI_Procedure.JumpAbsolute, + AI_Procedure.JumpWithoutAddingSpeed, + AI_Procedure.Fire, + AI_Procedure.GoTarget, + AI_Procedure.ReachTarget, + AI_Procedure.SetHitPoints, + AI_Procedure.SetHitPointsToInitValue, + AI_Procedure.SetHitPointsToMaxValue, + AI_Procedure.AddHitPoints, + AI_Procedure.SubHitPoints, + AI_Procedure.SetHitPointsMax, + AI_Procedure.SetHitPointsMaxToInitValue, + AI_Procedure.SetHitPointsMaxToMaxValue, + AI_Procedure.AddHitPointsMax, + AI_Procedure.SubHitPointsMax, + AI_Procedure.ListAffectPersoZDD, + AI_Procedure.ListAffectModuleZDD, + AI_Procedure.ListAffectPersoZDE, + AI_Procedure.ListAffectModuleZDE, + AI_Procedure.ListAffectPersoTypeZDE, + AI_Procedure.ListAffectModuleTypeZDE, + AI_Procedure.ListAffectTypeZDEWithTypeZDE, + AI_Procedure.AddPersoInList, + AI_Procedure.AddPersoInListAt, + AI_Procedure.DeletePersoAtInList, + AI_Procedure.FindPersoAndDeleteInList, + AI_Procedure.ListSelect, + AI_Procedure.ListUnSelect, + AI_Procedure.ListSort, + AI_Procedure.ListSortByFamily, + AI_Procedure.FillListWithAllPersoOfAFamily, + AI_Procedure.ListUnion, + AI_Procedure.ListInter, + AI_Procedure.ListDiff, + AI_Procedure.ListAdd, + AI_Procedure.SwapLinkTableObjects, + AI_Procedure.ChangeCurrentObjectTable, + AI_Procedure.BuildObjectTableFromTableAndString, + AI_Procedure.LSY_StartSpeech, + AI_Procedure.LSY_StopSpeech, + AI_Procedure.TakeModuleControl, + AI_Procedure.ReleaseModuleControl, + AI_Procedure.InitModuleControlWithAnimTranslation, + AI_Procedure.InitModuleControlWithAnimRotation, + AI_Procedure.RotateSector, + AI_Procedure.RotateSectorLocalX, + AI_Procedure.RotateSectorLocalY, + AI_Procedure.RotateSectorLocalZ, + AI_Procedure.LevelSaveRotationSector, + AI_Procedure.PlayerSaveRotationSector, + AI_Procedure.TranslateSector, + AI_Procedure.TranslateLocalSector, + AI_Procedure.SaveGame, + AI_Procedure.IncHistoryAndSaveGame, + AI_Procedure.SaveAllGameValues, + AI_Procedure.EnableEscape, + AI_Procedure.ResetButtonState, + AI_Procedure.ActivateChannel, + AI_Procedure.DeactivateChannel, + AI_Procedure.FogOn, + AI_Procedure.FogOff, + AI_Procedure.SetFogColor, + AI_Procedure.SetFogNearFarInf, + AI_Procedure.PersoLightOn, + AI_Procedure.PersoLightOff, + AI_Procedure.SetPersoLightColor, + AI_Procedure.SetPersoLightNearFar, + AI_Procedure.SetPersoLightLittleBigAlpha, + AI_Procedure.SetPersoLightGyrophare, + AI_Procedure.SetPersoLightPulse, + AI_Procedure.SetPersoLightParalleleType, + AI_Procedure.SetPersoLightSphericalType, + AI_Procedure.SetPersoLightHotSpotType, + AI_Procedure.SetPersoLightAmbientType, + AI_Procedure.DYL_ChangeGraduallyIntensity, + AI_Procedure.DYL_CopyStaticToDynamic, + AI_Procedure.AddSurfaceHeight, + AI_Procedure.MoveSurfaceHeight, + AI_Procedure.LevelSaveMovingSurface, + AI_Procedure.PlayerSaveMovingSurface, + AI_Procedure.SendSoundRequest, + AI_Procedure.SendVoiceRequest, + AI_Procedure.SendMusicRequest, + AI_Procedure.DisplaylValue, + AI_Procedure.DisplaylChrono, + AI_Procedure.DisplayString, + AI_Procedure.ActivateString, + AI_Procedure.EraseString, + AI_Procedure.Camera_UpdatePosition, + AI_Procedure.Camera_Reset, + AI_Procedure.Camera_ActSctUpdPatch, + AI_Procedure.Camera_RestoreAfterTrame, + AI_Procedure.Camera_CancelRestoreTrame, + AI_Procedure.Camera_ShowInfo, + AI_Procedure.Camera_ChangeCamera, + AI_Procedure.Camera_ActiveCamera, + AI_Procedure.Camera_ChangeDistance, + AI_Procedure.Camera_ChangeBoundDist, + AI_Procedure.Camera_ChangeCamLinearSpeed, + AI_Procedure.Camera_ChangeCamLinearInertia, + AI_Procedure.Camera_ChangeCamAngularSpeed, + AI_Procedure.Camera_ChangeCamAngularInertia, + AI_Procedure.Camera_ChangeTgtLinearSpeed, + AI_Procedure.Camera_MoveTarget, + AI_Procedure.Camera_MoveLookTarget, + AI_Procedure.Camera_MoveShift, + AI_Procedure.Camera_ChangeAngle, + AI_Procedure.Camera_Move, + AI_Procedure.Camera_Turn, + AI_Procedure.Camera_ManageSavePos, + AI_Procedure.Camera_ChangeState, + AI_Procedure.Camera_ChangeFocal, + AI_Procedure.Camera_ActivateFocalParsing, + AI_Procedure.Camera_ChangeTargetedPerso, + AI_Procedure.Camera_ChangeTargetedChannel, + AI_Procedure.Camera_StopTargettingChannel, + AI_Procedure.Camera_RestoreInitialTargetedPerso, + AI_Procedure.Camera_Shake, + AI_Procedure.Camera_SetPosition, + AI_Procedure.Camera_ChangeFlag, + AI_Procedure.Camera_SavePositionAsOptimal, + AI_Procedure.Camera_SetAdditionnalTarget, + AI_Procedure.Camera_SetApexParameters, + AI_Procedure.Camera_SetCameraZMax, + AI_Procedure.Camera_ResetCameraZMax, + AI_Procedure.Camera_SetCameraZMin, + AI_Procedure.Camera_ResetCameraZMin, + AI_Procedure.Camera_SetCameraOrientation, + AI_Procedure.Camera_SetCameraPosition, + AI_Procedure.Camera_SetTargetPosition, + AI_Procedure.Camera_ChangeOrientationAngleMax, + AI_Procedure.Camera_ChangeOrientationAngularSpeed, + AI_Procedure.Camera_ChangeChannel, + AI_Procedure.Camera_ChangeHard, + AI_Procedure.Camera_RepositionHard, + AI_Procedure.SetPower, + AI_Procedure.SubPower, + AI_Procedure.AddPower, + AI_Procedure.TransparentDisplay, + AI_Procedure.DefaultDisplay, + AI_Procedure.SetTransparency, + AI_Procedure.DisplayFixFlag, + AI_Procedure.StartMenuWithPauseGame, + AI_Procedure.StartMenuWithoutPauseGame, + AI_Procedure.DisplayVignetteDuringTime, + AI_Procedure.SetParticleGeneratorOn, + AI_Procedure.SetParticleGeneratorOff, + AI_Procedure.SetParticleGenerator, + AI_Procedure.SetGenerationModeNone, + AI_Procedure.SetGenerationModeContinuous, + AI_Procedure.SetGenerationModeCrenel, + AI_Procedure.SetGenerationModeProbability, + AI_Procedure.SetGenerationNumberConstant, + AI_Procedure.SetGenerationNumberProbabilist, + AI_Procedure.SetGenerationInfiniteLifeTime, + AI_Procedure.SetGenerationConstantLifeTime, + AI_Procedure.SetGenerationProbabilistLifeTime, + AI_Procedure.DeactivateBut, + AI_Procedure.ActivateBut, + AI_Procedure.None, + AI_Procedure.ChangeComport, + AI_Procedure.ChangeComportReflex, + AI_Procedure.ChangeMyComport, + AI_Procedure.ChangeMyComportReflex, + AI_Procedure.TurnAbsoluteDirection, + AI_Procedure.GoAbsoluteDirection, + AI_Procedure.Accelerate, + AI_Procedure.Turn, + AI_Procedure.Turn2, + AI_Procedure.DeltaTurnPerso, + AI_Procedure.TurnPerso, + AI_Procedure.ChangeAction, + AI_Procedure.ChangeActionRandom, + AI_Procedure.ReInitWay, + AI_Procedure.ReInitWayBack, + AI_Procedure.InitWayWithWp, + AI_Procedure.SwimPulse, + AI_Procedure.Ski_TurnLeft, + AI_Procedure.Ski_TurnRight, + AI_Procedure.KillPerso, + AI_Procedure.SetMechanicalGMTAdhesionCoef, + AI_Procedure.SetMechanicalGMTAbsorptionCoef, + AI_Procedure.SetMechanicalGMTFrictionCoef, + AI_Procedure.SetMechanicalGMTSlideCoef, + AI_Procedure.SetMechanicalGMTProgressionCoef, + AI_Procedure.SetMechanicalGMTPenetrationCoef, + AI_Procedure.SetMechanicalGMTPenetrationMaxCoef, + AI_Procedure.SetVisualGMTColor, + AI_Procedure.SetVisualGMTSpecularExponent, + AI_Procedure.SetVisualGMTSpecularCoef, + AI_Procedure.SetVisualGMTDiffuseCoef, + AI_Procedure.SetVisualGMTAmbientCoef, + AI_Procedure.SetVisualGMTAsChromed, + AI_Procedure.SetVisualGMTTextureScrollingCoef, + AI_Procedure.LockVisualGMT, + AI_Procedure.UnlockVisualGMT, + AI_Procedure.SetVisualGMTFrame, + AI_Procedure.FootPath_AddFootPrint, + AI_Procedure.FootPath_Clear, + AI_Procedure.ReleaseAllModulesControl, + AI_Procedure.ConfirmModuleControl, + AI_Procedure.OptionChangeScreenSize, + AI_Procedure.OptionChangeDetailsValue, + AI_Procedure.OptionChangeMusicVolume, + AI_Procedure.OptionChangeSfxVolume, + AI_Procedure.OptionChangeVoiceVolume, + AI_Procedure.SetPersoAbsolutePosition, + AI_Procedure.RelativeMovePerso, + AI_Procedure.SetModuleAbsolutePosition, + AI_Procedure.RelativeMoveModule, + AI_Procedure.ChangeModuleSighting, + AI_Procedure.RotatePersoAroundX, + AI_Procedure.RotatePersoAroundY, + AI_Procedure.RotatePersoAroundZ, + AI_Procedure.RotateModuleAroundX, + AI_Procedure.RotateModuleAroundY, + AI_Procedure.RotateModuleAroundZ, + AI_Procedure.ZoomPerso, + AI_Procedure.ZoomModule, + AI_Procedure.Invisible, + AI_Procedure.Visible, + AI_Procedure.AddChildToChannelOfActor, + AI_Procedure.RemoveChildFromChannelOfActor, + AI_Procedure.vEnableMapObject, + AI_Procedure.vSetDestination, + AI_Procedure.vResetDestination, + AI_Procedure.ChangeOneCustomBit, + AI_Procedure.ChangeManyCustomBits, + AI_Procedure.StringAddChar, + AI_Procedure.StringReplaceChar, + AI_Procedure.StringRemoveChar, + AI_Procedure.Weightlessness, + AI_Procedure.OrientWallNormal, + AI_Procedure.SetAnimationGravity, + AI_Procedure.FixePositionZDM, + AI_Procedure.FixePositionZDD, + AI_Procedure.FixePositionZDE, + AI_Procedure.ChangeLightIntensity, + AI_Procedure.GiveImpulsionRope, + AI_Procedure.ChangeSpringConstantForChannel, + AI_Procedure.RopeHitAWall, + AI_Procedure.FixePointsDeMagie, + AI_Procedure.FixePointsDeMagieMax, + AI_Procedure.InitPointsDeMagie, + AI_Procedure.InitPointsDeMagieMax, + AI_Procedure.AjoutePointsDeMagie, + AI_Procedure.AjoutePointsDeMagieMax, + AI_Procedure.EnlevePointsDeMagie, + AI_Procedure.EnlevePointsDeMagieMax, + AI_Procedure.SetCapabilities, + AI_Procedure.AddCapabilities, + AI_Procedure.SubCapabilities, + AI_Procedure.ActiveSector, + AI_Procedure.DesactiveSector, + AI_Procedure.ActiveSectorVisibility, + AI_Procedure.DesactiveSectorVisibility, + AI_Procedure.ActiveSectorCollisions, + AI_Procedure.DesactiveSectorCollisions, + AI_Procedure.QuitGame, + AI_Procedure.ReturnToMainMenu, + AI_Procedure.DisplayVignetteAndReturnToMainMenu, + AI_Procedure.DisplayVignetteAndQuitGame, + AI_Procedure.PlayAvi, + AI_Procedure.ActivateOptSectors, + AI_Procedure.DeactivateOptSectors, + AI_Procedure.SetGameState, + AI_Procedure.SetMouseCursorTexture, + AI_Procedure.RestoreComport, + AI_Procedure.RestoreMyComport, + AI_Procedure.SCT_SetTransparence, + AI_Procedure.setFadeValue, + AI_Procedure.setFadeTexture, + AI_Procedure.setFadeOn, + AI_Procedure.setFadeOff, + AI_Procedure.StartFade, + AI_Procedure.StartFadeMS, + AI_Procedure.ToggleWideScreen, + AI_Procedure.EndDialog, + AI_Procedure.RunDialog, + AI_Procedure.ScrollDialog, + AI_Procedure.SelectDialog, + AI_Procedure.PositionDialog, + AI_Procedure.DLG_ChangeAction, + AI_Procedure.DLG_ChangeComport, + AI_Procedure.DLG_ActivateChannel, + AI_Procedure.SND_SetSoundEventActivation, + AI_Procedure.ActivateCreditsMotorMode, + AI_Procedure.ActivateInventoryMotorMode, + AI_Procedure.ActivateBinocularMotorMode, + AI_Procedure.ActivateSaveGameMotorMode, + AI_Procedure.ActivateLaserPointer, + AI_Procedure.HideLaserPointer, + AI_Procedure.SetLaserPointerDistance, + AI_Procedure.SetLaserPointerTexture, + AI_Procedure.SetLaserPointerDetails, + AI_Procedure.LaserPointerSniper, + AI_Procedure.LaserPointerFly, + AI_Procedure.FadeRandom, + AI_Procedure.RopeInitialisation, + AI_Procedure.TurnInterpolationReset, + AI_Procedure.TurnInterpolationOff, + AI_Procedure.TurnInterpolationOn, + AI_Procedure.SetDraw, + AI_Procedure.SetImage, + AI_Procedure.SetToNextImage, + AI_Procedure.FadeImage, + AI_Procedure.MovingUV, + AI_Procedure.Rotation, + AI_Procedure.SetTextString, + AI_Procedure.SetTextNumber, + AI_Procedure.SlideGamePlayInterface, + AI_Procedure.HilitePerso, + AI_Procedure.ResetPersoToInitialState, + AI_Procedure.SetFlashingSpeed, + AI_Procedure.SetFlashingTransparent, + AI_Procedure.SetFlashingNotTransparent, + AI_Procedure.SetFlashingWithDefaultGMT, + AI_Procedure.SetFlashingNotWithDefaultGMT, + AI_Procedure.SetInitialGameFloors, + AI_Procedure.SetStandardFloor, + AI_Procedure.ActivateFloorGame, + AI_Procedure.SetColorPathGoal, + AI_Procedure.ChangeColor, + AI_Procedure.LGT_ChangeIntensity, + AI_Procedure.LGT_Switch, + AI_Procedure.LGT_SwitchAll, + AI_Procedure.SetStableEnvironnement, + AI_Procedure.ActivateMapMotorMode, + AI_Procedure.SetEpoque, + AI_Procedure.SetName, + AI_Procedure.RopeCareTaker, + AI_Procedure.ChangeChannelMassForPolySys, + AI_Procedure.FixNormReelSpeed, + AI_Procedure.LoadSoundBank, + AI_Procedure.UnLoadSoundBank, + AI_Procedure.KillMusic, + AI_Procedure.KillSoundEffect, + AI_Procedure.KillVoice, + AI_Procedure.KillAllSounds, + AI_Procedure.SND_ChangeMyVolumeEffects, + AI_Procedure.SND_ChangeVolEffects, + AI_Procedure.SND_ChangeVolumeEffects, + AI_Procedure.SND_ChangeMyVolumeVoice, + AI_Procedure.SND_ChangeVolumeVoice, + AI_Procedure.SND_ChangeMyVolumeMusic, + AI_Procedure.SND_ChangeVolumeMusic, + AI_Procedure.SND_ChangeAllVolume, + AI_Procedure.SND_ResetMyVolumeEffects, + AI_Procedure.SND_ResetMyVolumeVoice, + AI_Procedure.SND_ResetMyVolumeMusic, + AI_Procedure.SND_ResetVolumeEffects, + AI_Procedure.SND_ResetVolumeVoice, + AI_Procedure.SND_ResetVolumeMusic, + AI_Procedure.SND_ResetAllVolume, + AI_Procedure.SND_SetEffectSound, + AI_Procedure.SND_SwitchMicroPerso, + AI_Procedure.SND_SwitchOldMicroPerso, + AI_Procedure.SND_SetMicroOrientationPerso, + AI_Procedure.SetVignetteIndex, + AI_Procedure.SND_SaveMusic, + AI_Procedure.SND_LoadMusic, + AI_Procedure.SND_FadeMusic, + AI_Procedure.SND_FadeVoice, + AI_Procedure.SND_FadeSound, + AI_Procedure.SND_FadeAll, + AI_Procedure.SND_FadeObjectAndStop, + AI_Procedure.SND_FadeInObject, + AI_Procedure.SND_KillSoundObject, + AI_Procedure.SetEconomicPersoAbsolutePosition, + AI_Procedure.ScaleModule, + AI_Procedure.Inv_DeselectionnerObjetSelectionne, + AI_Procedure.Inv_ChangerCapaciteMaximumObjet, + AI_Procedure.Inv_ChangerEtatJoyau, + AI_Procedure.Inv_ChangerLeNombreDuStockLst, + AI_Procedure.Inv_AfficherUnObjet, + AI_Procedure.Stats_DisplayMainActorLife, + AI_Procedure.Stats_DisplayMainActorArmor, + AI_Procedure.Stats_DisplayMainActorMagic, + AI_Procedure.Stats_DisplayMainActorSelectedObject, + AI_Procedure.Stats_DisplayMainActorWeapon, + AI_Procedure.Stats_DisplayDragon, + AI_Procedure.Stats_DisplayCash, + AI_Procedure.Fight_ChangeArmor, + AI_Procedure.Fight_ChangeArmorResistance, + AI_Procedure.Fight_RepairArmor, + AI_Procedure.Fight_SubHitPointsEnemy, + AI_Procedure.Magic_ChangeInitialMagicPoints, + AI_Procedure.Magic_ChangeMaxMagicPoints, + AI_Procedure.Magic_InitMagicPointsToInit, + AI_Procedure.Magic_InitMagicPointsToMax, + AI_Procedure.Magic_SelectPrevSpellType, + AI_Procedure.Magic_SelectNextSpellType, + AI_Procedure.Dragon_ChangeInitialNbrDiamonds, + AI_Procedure.Dragon_ChangeMaxNbrDiamonds, + AI_Procedure.Dragon_InitDiamondsToInit, + AI_Procedure.Dragon_InitDiamondsToMax, + AI_Procedure.Dragon_SetDragonActor, + AI_Procedure.Demo_ValidateMap, + AI_Procedure.ChangeViseePerso, + AI_Procedure.LaunchAGO, + AI_Procedure.ChangementCustomBits, + AI_Procedure.ActiveArbalete, + AI_Procedure.DesactiveArbalete, + AI_Procedure.LancerVibrationGrave, + AI_Procedure.LancerVibrationAigu, + AI_Procedure.PS2ResetLevelOfMipmap, + AI_Procedure.PS2UpdateLevelOfMipmap, + }; + } + #endregion + } +} diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/AI/Types/Playmobil/AI_Types_Hype_PS2.cs.meta b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/AI/Types/Playmobil/AI_Types_Hype_PS2.cs.meta new file mode 100644 index 00000000..bdff75e4 --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/AI/Types/Playmobil/AI_Types_Hype_PS2.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 82c4d0e2cc047a945b01ba6c391bd65c +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/AI/Types/Rayman2.meta b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/AI/Types/Rayman2.meta new file mode 100644 index 00000000..e6252cbc --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/AI/Types/Rayman2.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: cbb02dedc7ac22748999afd257e13d07 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/AI/Types/Rayman2/AI_Types_R2_DS_EU.cs b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/AI/Types/Rayman2/AI_Types_R2_DS_EU.cs new file mode 100644 index 00000000..61a38a14 --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/AI/Types/Rayman2/AI_Types_R2_DS_EU.cs @@ -0,0 +1,1125 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace BinarySerializer.Ubisoft.CPA { + public class AI_Types_R2_DS_EU : AI_Types_R2_PC { + // Re-checked + // Commented with //NU//: never used + + // InterpretTypes list: same as PC + // MetaActions list: same as PC + + #region DsgVar Types + protected override void InitVariableTypes() { + VariableTypes = new AI_DsgVarType[] { + AI_DsgVarType.Boolean, + AI_DsgVarType.SByte, + AI_DsgVarType.UByte, + AI_DsgVarType.Short, + AI_DsgVarType.UShort, + AI_DsgVarType.Int, + AI_DsgVarType.UInt, + AI_DsgVarType.Float, + AI_DsgVarType.WayPoint, + AI_DsgVarType.Perso, + AI_DsgVarType.List, + AI_DsgVarType.Vector, + AI_DsgVarType.Comport, + AI_DsgVarType.Action, + AI_DsgVarType.Text, + AI_DsgVarType.GameMaterial, + AI_DsgVarType.Caps, + AI_DsgVarType.Graph, + AI_DsgVarType.PersoArray, + AI_DsgVarType.VectorArray, + AI_DsgVarType.FloatArray, + AI_DsgVarType.IntegerArray, + AI_DsgVarType.WayPointArray, + AI_DsgVarType.TextArray, + AI_DsgVarType.None + // 24, the above, seems to be an array on 3DS. Doesn't seem to be treated at all on DS + //24 on PC is DsgVarInfoEntry.DsgVarType.SuperObject and input on iOS. + }; + } + #endregion + + #region Keywords + protected override void InitKeywords() { + Keywords = new AI_Keyword[] { + AI_Keyword.If, + AI_Keyword.IfNot, + AI_Keyword.If2, + AI_Keyword.If4, + AI_Keyword.If8, + AI_Keyword.If16, + AI_Keyword.IfDebug, + AI_Keyword.IfNotU64, + AI_Keyword.Then, + AI_Keyword.Else, + AI_Keyword.EngineGoto, + AI_Keyword.Me, + AI_Keyword.MainActor, + AI_Keyword.Nobody, + AI_Keyword.Nowhere, + AI_Keyword.EmptyText, + AI_Keyword.CapsNull, + AI_Keyword.NoGraph, + AI_Keyword.NoAction, + }; + } + #endregion + + #region Conditions + protected override void InitConditions() { + Conditions = new AI_Condition[] { + AI_Condition.Et, + AI_Condition.Ou, + AI_Condition.Not, + //NU//AI_Condition.XOr, + AI_Condition.Equal, + AI_Condition.Different, + AI_Condition.Lesser, + AI_Condition.Greater, + AI_Condition.LesserOrEqual, + AI_Condition.GreaterOrEqual, + + AI_Condition.CollidePersoZDDNoWithPerso, + //NU//AI_Condition.CollideModuleZDDNoWithPerso, + AI_Condition.CollidePersoAllZDDWithPerso, + //NU//AI_Condition.CollidePersoZDDWithAnyPerso, + //NU//AI_Condition.CollideModuleZDDWithAnyPerso, + + AI_Condition.CollidePersoZDENoWithPersoZDENo, + //NU//AI_Condition.CollideModuleZDENoWithPersoZDENo, + //NU//AI_Condition.CollidePersoZDENoWithModuleZDENo, + //NU//AI_Condition.CollideModuleZDENoWithModuleZDENo, + AI_Condition.CollidePersoZDENoWithPersoTypeZDE, + //NU//AI_Condition.CollideModuleZDENoWithPersoTypeZDE, + //NU//AI_Condition.CollidePersoTypeZDEWithPersoTypeZDE, + AI_Condition.CollidePersoAllZDEWithPersoAllZDE, + //NU//AI_Condition.CollidePersoTypeZDEWithPersoAllZDE, + AI_Condition.CollidePersoAllZDEWithPersoTypeZDE, + //NU//AI_Condition.CollidePersoZDENoWithTypeZDE, + //NU//AI_Condition.CollideModuleZDENoWithTypeZDE, + + AI_Condition.CollideWithGround, + AI_Condition.CollideWithWall, + AI_Condition.CollideWithNothing, + AI_Condition.CollideWithCeiling, + AI_Condition.CollideWithPerso, + AI_Condition.CollideWithWater, + AI_Condition.CollideWithThisPerso, + AI_Condition.ZDMCollideWithGround, + //NU//AI_Condition.ZDMCollideWithWall, + //NU//AI_Condition.ZDMCollideWithNothing, + //NU//AI_Condition.ZDMCollideWithCeiling, + AI_Condition.IsPersoInList, + //NU//AI_Condition.IsModelInList, + //NU//AI_Condition.IsFamilyInList, + AI_Condition.ListEmptyTest, + AI_Condition.UserEvent_IsSet, + AI_Condition.UserEvent_IsSet2, + AI_Condition.PressedBut, + AI_Condition.JustPressedBut, + AI_Condition.ReleasedBut, + AI_Condition.JustReleasedBut, + AI_Condition.IsTimeElapsed, + AI_Condition.IsValidObject, + AI_Condition.IsValidWayPoint, + //NU//AI_Condition.IsValidGMT, + //NU//AI_Condition.IsValidAction, + AI_Condition.IsValidText, + AI_Condition.SeePerso, + AI_Condition.IsActivable, + AI_Condition.IsAlreadyHandled, + AI_Condition.Alw_IsMine, + //NU//AI_Condition.IsPersoLightOn, + //NU//AI_Condition.IsPersoLightPulseOn, + //NU//AI_Condition.IsPersoLightGyroPhareOn, + AI_Condition.IsZDMCollideWithObstacle, + AI_Condition.IsZDMCollideWithWall, + AI_Condition.IsZDMCollideWithGround, + AI_Condition.IsZDMCollideWithCeiling, + AI_Condition.CmtIdentifierContainsMask, + AI_Condition.HitByCollider, + //NU//AI_Condition.IsTypeOfGMTCollide, + AI_Condition.IsInComport, + AI_Condition.IsInReflexComport, + AI_Condition.IsInAction, + AI_Condition.ChangeActionEnable, + AI_Condition.EngineReinitRequested, + //NU//AI_Condition.IsThereMechEvent, + AI_Condition.CollisionWP, + AI_Condition.IsCustomBitSet, + AI_Condition.IsPersoActive, + AI_Condition.CheckActionEnd, + AI_Condition.IsCurrentStateCustomBitSet, + + AI_Condition.IsGiBlock, + AI_Condition.IsMechanicBlock, + //NU//AI_Condition.IsMechanicAnimation, + //NU//AI_Condition.IsMechanicCollide, + //NU//AI_Condition.IsMechanicGravity, + //NU//AI_Condition.IsMechanicTilt, + //NU//AI_Condition.IsMechanicGi, + //NU//AI_Condition.IsMechanicClimb, + //NU//AI_Condition.IsMechanicOnGround, + //NU//AI_Condition.IsMechanicSpider, + //NU//AI_Condition.IsMechanicShoot, + //NU//AI_Condition.IsMechanicSwim, + //NU//AI_Condition.IsMechanicNeverFall, + //NU//AI_Condition.IsMechanicCollisionControl, + //NU//AI_Condition.IsMechanicKeepSpeedZ, + //NU//AI_Condition.IsMechanicSpeedLimit, + //NU//AI_Condition.IsMechanicInertia, + AI_Condition.IsMechanicStream, + //NU//AI_Condition.IsMechanicStickOnPlatform, + //NU//AI_Condition.IsMechanicPatformCrash, + //NU//AI_Condition.IsMechanicScale, + //NU//AI_Condition.IsMechanicExec, + AI_Condition.CanFall, + AI_Condition.IsMechanicCrash, + + AI_Condition.IsNullVector, + AI_Condition.HierIsSonOfActor, + //NU//AI_Condition.IsMorphing, + AI_Condition.CheckAnimEnd, + AI_Condition.HasTheCapability, + //NU//AI_Condition.HasOneOfTheCapabilities, + AI_Condition.HasTheCapabilityNumber, + //NU//AI_Condition.PersoHasTheCapability, + //NU//AI_Condition.PersoHasOneOfTheCapabilities, + //NU//AI_Condition.PersoHasTheCapabilityNumber, + //NU//AI_Condition.MagnetIsActivated, + //NU//AI_Condition.NEstPasEnCollisionAvecMap, + //NU//AI_Condition.NEstPasEnCollisionAvecProjectile, + //NU//AI_Condition.NEstPasEnCollisionAvecSecondCharact, + //NU//AI_Condition.NEstPasEnCollisionAvecMainCharact, + //NU//AI_Condition.NEstPasEnCollisionAvecAutresSecteurs, + AI_Condition.IsInFamily, + AI_Condition.IsInModel, + + //NU//AI_Condition.AJoypadIsConnected, + AI_Condition.AKeyJustPressed, + AI_Condition.AButtonPadJustPressed, + AI_Condition.IsInDemoMode, + AI_Condition.IsInStereoMode, + AI_Condition.IsMusicPlaying, + AI_Condition.IsShapnessMax, + + AI_Condition.IsSlotDataCorrupt, + AI_Condition.IsCheatMenu, + //AI_Condition.IsUSBuild, // only in R2 DS US + + //NU//AI_Condition.Cam_IsActive, + //NU//AI_Condition.Cam_IsViewportOwner, + //NU//AI_Condition.Cam_IsFlagNoDynamicTarget, + //NU//AI_Condition.Cam_IsFlagNoAverageMoveTgtPerso, + //NU//AI_Condition.Cam_IsFlagNoParseCutAngle, + //NU//AI_Condition.Cam_IsFlagNoVisibility, + //NU//AI_Condition.Cam_IsFlagNoVisibilityWithDynHie, + //NU//AI_Condition.Cam_IsFlagNoDynChangeTheta, + //NU//AI_Condition.Cam_IsFlagNoShiftUntilPosReached, + //NU//AI_Condition.Cam_IsFlagNoDynSpeed, + //NU//AI_Condition.Cam_IsFlagNoLinearParsing, + //NU//AI_Condition.Cam_IsFlagNoLinearInertia, + //NU//AI_Condition.Cam_IsFlagNoAngularParsing, + //NU//AI_Condition.Cam_IsFlagNoAngularInertia, + //NU//AI_Condition.Cam_IsFlagNoTargetParsing, + //NU//AI_Condition.Cam_IsFlagNoTargetInertia, + //NU//AI_Condition.Cam_IsFlagNoObstacle, + //NU//AI_Condition.Cam_IsFlagFixedOrientation, + AI_Condition.Cam_IsFlagForcedPosition, + //NU//AI_Condition.Cam_IsFlagForcedTarget, + //NU//AI_Condition.Cam_IsFlagForcedAxis, + }; + } + #endregion + + #region Fields + protected override void InitFields() { + Fields = new AI_Field[] { + AI_Field.Position, + AI_Field.Orientation, + AI_Field.Speed, + AI_Field.NormSpeed, + AI_Field.AbsoluteAxisX, + AI_Field.AbsoluteAxisY, + AI_Field.AbsoluteAxisZ, + AI_Field.PrevComportIntell, + AI_Field.PrevComportReflex, + AI_Field.ShadowScaleX, + AI_Field.ShadowScaleY, + }; + } + #endregion + + #region Functions + protected override void InitFunctions() { + Functions = new AI_Function[] { + AI_Function.GetPersoAbsolutePosition, + AI_Function.GetMyAbsolutePosition, + AI_Function.GetAngleAroundZToPerso, + AI_Function.DistanceToPerso, + AI_Function.DistanceXToPerso, + AI_Function.DistanceYToPerso, + AI_Function.DistanceZToPerso, + AI_Function.DistanceXYToPerso, + AI_Function.DistanceXZToPerso, + //NU//AI_Function.DistanceYZToPerso, + AI_Function.DistanceToPersoCenter, + //NU//AI_Function.DistanceXToPersoCenter, + AI_Function.DistanceYToPersoCenter, + AI_Function.DistanceZToPersoCenter, + AI_Function.DistanceXYToPersoCenter, + //NU//AI_Function.DistanceXZToPersoCenter, + //NU//AI_Function.DistanceYZToPersoCenter, + AI_Function.DistanceToWP, + AI_Function.GetWPAbsolutePosition, + AI_Function.Int, + AI_Function.RandomInt, + AI_Function.Real, + AI_Function.Sinus, + AI_Function.Cosinus, + AI_Function.Square, + AI_Function.SquareRoot, + AI_Function.RandomReal, + AI_Function.MinimumReal, + AI_Function.MaximumReal, + AI_Function.DegreeToRadian, + AI_Function.RadianToDegree, + AI_Function.AbsoluteValue, + AI_Function.LimitRealInRange, + AI_Function.Sign, + //NU//AI_Function.Cube, + AI_Function.Modulo, + AI_Function.TernInf, + AI_Function.TernSup, + AI_Function.TernEq, + AI_Function.TernInfEq, + AI_Function.TernSupEq, + AI_Function.TernOp, + AI_Function.TemporalRealCombination, + AI_Function.GetHitPoints, + //NU//AI_Function.AddAndGetHitPoints, + AI_Function.SubAndGetHitPoints, + AI_Function.GetHitPointsMax, + AI_Function.AddAndGetHitPointsMax, + //NU//AI_Function.SubAndGetHitPointsMax, + AI_Function.ListSize, + AI_Function.GivePersoInList, + AI_Function.AbsoluteVector, + AI_Function.RelativeVector, + AI_Function.VecteurLocalToGlobal, + AI_Function.VecteurGlobalToLocal, + //NU//AI_Function.GetMagnetStrength, + //NU//AI_Function.GetMagnetFar, + //NU//AI_Function.GetMagnetNear, + //NU//AI_Function.GetMagnetDuration, + //NU//AI_Function.SPO_GetDrawFlag, + AI_Function.GetTime, + AI_Function.GetElapsedTime, + AI_Function.GetDeltaT, + AI_Function.GetFrameLength, + AI_Function.InputAnalogicValue, + //NU//AI_Function.VitessePadAnalogique, + AI_Function.GenerateObject, + AI_Function.CountGeneratedObjects, + AI_Function.GetGlobalCounter, + //NU//AI_Function.GetSubMapId, + //NU//AI_Function.AddColor, + //NU//AI_Function.AddRed, + //NU//AI_Function.AddGreen, + //NU//AI_Function.AddBlue, + //NU//AI_Function.AddAlpha, + AI_Function.ColorRedGreenBlueAlpha, + AI_Function.ColorRedGreenBlue, + //NU//AI_Function.ColorRed, + //NU//AI_Function.ColorGreen, + //NU//AI_Function.ColorBlue, + //NU//AI_Function.ColorAlpha, + //NU//AI_Function.GetVisualGMTColor, + //NU//AI_Function.GetVisualGMTSpecularCoef, + //NU//AI_Function.GetVisualGMTSpecularExponent, + //NU//AI_Function.GetVisualGMTDiffuseCoef, + //NU//AI_Function.GetVisualGMTAmbientCoef, + //NU//AI_Function.GetVisualGMTTextureScrollingCoefU, + //NU//AI_Function.GetVisualGMTTextureScrollingCoefV, + //NU//AI_Function.GetVisualGMTFrame, + //NU//AI_Function.GetVisualGMTNumberOfFrames, + AI_Function.SaveGame, + AI_Function.LoadGame, + AI_Function.EraseGame, + AI_Function.GetCurrentSlot, + AI_Function.IsAValidSlotName, + AI_Function.RepairCorruptSlot, + + // FuncRay2 + //NU//AI_Function.LitPointsDeMagie, + //NU//AI_Function.LitPointsDeMagieMax, + //NU//AI_Function.AjouteEtLitPointsDeMagie, + //NU//AI_Function.AjouteEtLitPointsDeMagieMax, + //NU//AI_Function.EnleveEtLitPointsDeMagie, + //NU//AI_Function.EnleveEtLitPointsDeMagieMax, + AI_Function.LitPointsDair, + AI_Function.LitPointsDairMax, + //NU//AI_Function.AjouteEtLitPointsDair, + //NU//AI_Function.AjouteEtLitPointsDairMax, + AI_Function.EnleveEtLitPointsDair, + //NU//AI_Function.EnleveEtLitPointsDairMax, + //NU//AI_Function.PersoLePlusProche, + //NU//AI_Function.PersoLePlusProcheDansSecteurCourant, + //NU//AI_Function.NearerActorInFieldOfVision, + //NU//AI_Function.GetNbActivePerso, + AI_Function.CibleLaPlusProche, + AI_Function.CibleLaPlusProcheAvecAngles, + AI_Function.ReseauWPLePlusProche, + AI_Function.NetworkCloserWPOfType, + AI_Function.ReseauWPLePlusDansLAxe, + //NU//AI_Function.ReseauWPLePlusDansLAxe2, + AI_Function.NetworkNextWPWithCapa, + //NU//AI_Function.NetworkAffectTypeOfConnectedWP, + //NU//AI_Function.NetworkAffectTypeOfConnectedWPWithCapa, + AI_Function.ReseauCheminLePlusCourt, + AI_Function.NetworkBuildOrderedPath, + AI_Function.NetworkBuildOrderedPathCircular, + AI_Function.NetworkAllocateGraphToMSWay, + //NU//AI_Function.NetworkAllocateGraphToMSWayCircular, + AI_Function.ReseauLitIndexCourant, + AI_Function.ReseauForceIndexCourant, + AI_Function.ReseauLitPremierIndex, + AI_Function.ReseauLitDernierIndex, + AI_Function.ReseauIncrementIndex, + AI_Function.ReseauDecrementIndex, + AI_Function.ReseauLitWPAIndex, + AI_Function.ReseauLitCapaciteLiaisonAIndex, + //NU//AI_Function.ReseauChangeCapaciteLiaisonAIndex, + //NU//AI_Function.ReseauLitPoidsLiaisonAIndex, + //NU//AI_Function.ReseauChangePoidsLiaisonAIndex, + AI_Function.NetworkGetIndexOfWPInMSWay, + AI_Function.NetworkForceWPToCurrent, + //NU//AI_Function.NetworkTestTheEnds, + AI_Function.ReseauLitCapaciteLiaisonDansGraph, + AI_Function.ReseauChangeCapaciteLiaisonDansGraph, + //NU//AI_Function.ReseauLitPoidsLiaisonDansGraph, + //NU//AI_Function.ReseauChangePoidsLiaisonDansGraph, + AI_Function.NetworkGetTypeOfWP, + //NU//AI_Function.GetCapabilities, + //NU//AI_Function.CapabilityAtBitNumber, + AI_Function.GetScrollSpeed, + AI_Function.GetNbFrame, + AI_Function.DotProduct, + AI_Function.CrossProduct, + AI_Function.Normalize, + //NU//AI_Function.GetSPOCoordinates, + AI_Function.GetTractionFactor, + AI_Function.GetCenterZDEType, + //NU//AI_Function.GetCenterZDMType, + //NU//AI_Function.GetCenterZDRType, + //NU//AI_Function.GetCenterZDDType, + AI_Function.TextAffiche, + //NU//AI_Function.GetCPUCounter, + + // DefFunc1 + //NU//AI_Function.VitesseHorizontaleDuPerso, + //NU//AI_Function.VitesseVerticaleDuPerso, + AI_Function.GetPersoZoomFactor, + AI_Function.GetPersoSighting, + AI_Function.GetPersoHorizon, + AI_Function.GetPersoBanking, + AI_Function.LitPositionZDM, + AI_Function.LitPositionZDE, + //NU//AI_Function.LitPositionZDD, + //NU//AI_Function.LitCentreZDM, + //NU//AI_Function.LitCentreZDE, + AI_Function.LitCentreZDD, + //NU//AI_Function.LitAxeZDM, + //NU//AI_Function.LitAxeZDE, + //NU//AI_Function.LitAxeZDD, + AI_Function.LitDimensionZDM, + //NU//AI_Function.LitDimensionZDE, + AI_Function.LitDimensionZDD, + //NU//AI_Function.VecteurPointAxe, // Was not NeverUsed in Rayman_Z! + AI_Function.VecteurPointSegment, + AI_Function.VectorContribution, + AI_Function.VectorCombination, + AI_Function.TemporalVectorCombination, + AI_Function.ScaledVector, + AI_Function.GetVectorNorm, + AI_Function.RotateVector, + AI_Function.VectorAngle, + AI_Function.VectorCos, + //NU//AI_Function.VectorSin, + AI_Function.GetNormalCollideVector, + AI_Function.GetNormalCollideVector2, + AI_Function.GetCollidePoint, + AI_Function.GetCollidePoint2, + AI_Function.GetHandsCollidePoint, + //NU//AI_Function.GetCollideRate, + AI_Function.GetCollideRate2, + AI_Function.GetCollideMaterialType, + AI_Function.GetCollideMaterialType2, + AI_Function.GetCollisionPoint, + AI_Function.GetCollisionVector, + //NU//AI_Function.GetCollisionPerso, // Was not NeverUsed in Rayman_Z! + AI_Function.GetCollisionPointMaterial, + //NU//AI_Function.GetLastTraversedMaterialType, + //NU//AI_Function.GetLastTraversedMaterial, + //NU//AI_Function.GetCurrentCollidedGMT, + AI_Function.GetColliderType, + AI_Function.GetColliderVector, + AI_Function.GetColliderReal, + AI_Function.GetLastCollisionActor, + AI_Function.ComputeRebondVector, + AI_Function.GetModuleAbsolutePosition, + AI_Function.GetModuleRelativePosition, + //NU//AI_Function.GetModuleZoomFactor, + AI_Function.GetModuleSighting, + AI_Function.CastIntegerToChannel, + AI_Function.GetSlotDate, + AI_Function.GetSlotName, + AI_Function.GetSlotScore, + AI_Function.GetStringCharAt, + //NU//AI_Function.GetFormattedTextInfo, + //NU//AI_Function.GetInputEntryName, + AI_Function.GetMechanicGravityFactor, + //NU//AI_Function.GetMechanicSlide, + //NU//AI_Function.GetMechanicRebound, + //NU//AI_Function.GetMechanicSlopeLimit, + //NU//AI_Function.GetMechanicInertiaX, + //NU//AI_Function.GetMechanicInertiaY, + //NU//AI_Function.GetMechanicInertiaZ, + //NU//AI_Function.GetMechanicTiltIntensity, + //NU//AI_Function.GetMechanicTiltInertia, + //NU//AI_Function.GetMechanicTiltOrigin, + //NU//AI_Function.GetMechanicMaxSpeed, + //NU//AI_Function.GetMechanicStreamPriority, + //NU//AI_Function.GetMechanicStreamSpeed, + //NU//AI_Function.GetMechanicStreamFactor, + //NU//AI_Function.GetSlideFactorX, + //NU//AI_Function.GetSlideFactorY, + //NU//AI_Function.GetSlideFactorZ, + AI_Function.JumpImpulsion, + AI_Function.GetSpeedAnim, + AI_Function.HierGetFather, + //NU//AI_Function.GetActivationZDD, + //NU//AI_Function.GetActivationZDM, + //NU//AI_Function.GetActivationZDE, + //NU//AI_Function.GetActivationZDR, + //NU//AI_Function.GetCollisionFrequency, + AI_Function.GetBrainFrequency, + //NU//AI_Function.GetLightFrequency, + AI_Function.GetBooleanInArray, + AI_Function.GetNumberOfBooleanInArray, + //NU//AI_Function.GetButtonName, + //NU//AI_Function.GetDriversAvailable, + AI_Function.GetCurrentLanguageId, + //NU//AI_Function.GetNbLanguages, + //NU//AI_Function.GetLanguageText, + //NU//AI_Function.TextToInt, + AI_Function.GetMusicVolume, + AI_Function.GetSfxVolume, + AI_Function.SlotIsValid, + AI_Function.NbAvailableResolution, + AI_Function.CurrentResolution, + AI_Function.GetBrightness, + //NU//AI_Function.NameResolution, + AI_Function.GetNbSlotsAvailable, + //NU//AI_Function.GetTextureFiltering, + //NU//AI_Function.GetAntiAliasing, + //NU//AI_Function.GetSaturationDistance, + //NU//AI_Function.GetBackgroundDistance, + AI_Function.GetTooFarLimit, + AI_Function.GetTransparencyZoneMin, + AI_Function.GetTransparencyZoneMax, + AI_Function.ExecuteVariable, + AI_Function.ComputeProtectKey, + AI_Function.Xor, + AI_Function.DivUnsigned, + AI_Function.MulUnsigned, + AI_Function.AddUnsigned, + AI_Function.SubUnsigned, + AI_Function.GetMemoryValue, + + // DS exclusive + AI_Function.GetCheats, + AI_Function.GetBacklight, + AI_Function.DoneAnalogCalibration, + + // DefFunCa + AI_Function.Cam_GetShiftTarget, + AI_Function.Cam_GetShiftPos, + AI_Function.Cam_GetDistMin, + AI_Function.Cam_GetDistMax, + //NU//AI_Function.Cam_GetBoundDistMin, + //NU//AI_Function.Cam_GetBoundDistMax, + //NU//AI_Function.Cam_GetAngleAlpha, + //NU//AI_Function.Cam_GetAngleShiftAlpha, + AI_Function.Cam_GetAngleTheta, + //NU//AI_Function.Cam_GetAngleShiftTheta, + //NU//AI_Function.Cam_GetLinearSpeed, + //NU//AI_Function.Cam_GetLinearIncreaseSpeed, + //NU//AI_Function.Cam_GetLinearDecreaseSpeed, + //NU//AI_Function.Cam_GetAngularSpeed, + //NU//AI_Function.Cam_GetAngularIncreaseSpeed, + //NU//AI_Function.Cam_GetAngularDecreaseSpeed, + //NU//AI_Function.Cam_GetTargetSpeed, + //NU//AI_Function.Cam_GetTargetIncreaseSpeed, + //NU//AI_Function.Cam_GetTargetDecreaseSpeed, + AI_Function.Cam_GetFocal, + //NU//AI_Function.Cam_GetZMin, + //NU//AI_Function.Cam_GetZMax, + //NU//AI_Function.Cam_GetTargetedSuperObject, + //NU//AI_Function.Cam_GetTypeOfViewport, + //NU//AI_Function.Cam_GetCameraOfViewport, + //NU//AI_Function.Cam_GetMainCamera, + AI_Function.Cam_ComputeTargetWithTgtPerso, + AI_Function.Cam_GetCurrentTargetPosition, + //NU//AI_Function.Cam_GetSectorCameraType, + AI_Function.Cam_GetBestPos, + }; + } + #endregion + + #region Procedures + protected override void InitProcedures() { + Procedures = new AI_Procedure[] { + AI_Procedure.SetHitPoints, + AI_Procedure.SetHitPointsInit, + AI_Procedure.SetHitPointsToInitValue, + //NU//AI_Procedure.SetHitPointsToMaxValue, + AI_Procedure.AddHitPoints, + AI_Procedure.SubHitPoints, + AI_Procedure.SetHitPointsMax, + //NU//AI_Procedure.SetHitPointsMaxToInitValue, + //NU//AI_Procedure.SetHitPointsMaxToMaxValue, + AI_Procedure.AddHitPointsMax, + //NU//AI_Procedure.SubHitPointsMax, + AI_Procedure.TransparentDisplay, + AI_Procedure.SetTransparency, + AI_Procedure.ACT_SetDrawFlag, + AI_Procedure.ModuleTransparentDisplay, + AI_Procedure.ModuleTransparentDisplay2, + AI_Procedure.SetModuleTransparency, + AI_Procedure.SetModuleTransparency2, + AI_Procedure.ListAffectPersoZDD, + AI_Procedure.ListAffectModuleZDD, + //NU//AI_Procedure.ListAffectPersoZDE, + //NU//AI_Procedure.ListAffectModuleZDE, + AI_Procedure.ListAffectPersoTypeZDE, + //NU//AI_Procedure.ListAffectModuleTypeZDE, + //NU//AI_Procedure.ListAffectTypeZDEWithTypeZDE, + //NU//AI_Procedure.AddPersoInList, + //NU//AI_Procedure.AddPersoInListAt, + AI_Procedure.DeletePersoAtInList, + //NU//AI_Procedure.FindPersoAndDeleteInList, + //NU//AI_Procedure.ListSelect, + //NU//AI_Procedure.ListUnSelect, + AI_Procedure.ListSort, + AI_Procedure.ListSortByFamily, + AI_Procedure.ListSortByModel, + //NU//AI_Procedure.FillListWithAllPersoOfAFamily, + //NU//AI_Procedure.FillListWithAllPersoOfAModel, + AI_Procedure.DeleteFamilyInList, + AI_Procedure.DeleteModelInList, + //NU//AI_Procedure.ListUnion, + //NU//AI_Procedure.ListInter, + //NU//AI_Procedure.ListDiff, + //NU//AI_Procedure.ListAdd, + AI_Procedure.FogActivate, + AI_Procedure.SetFogColor, + AI_Procedure.SetFogNearFarInf, + AI_Procedure.SetFogBlend, + //NU//AI_Procedure.RestoreFog, + //NU//AI_Procedure.SaveFog, + //NU//AI_Procedure.Magnet_ActiveMagnet, + //NU//AI_Procedure.Magnet_DeactiveMagnet, + //NU//AI_Procedure.Magnet_SetStrength, + //NU//AI_Procedure.Magnet_SetFar, + //NU//AI_Procedure.Magnet_SetNear, + //NU//AI_Procedure.Magnet_SetDuration, + //NU//AI_Procedure.FootPath_AddFootPrint, + //NU//AI_Procedure.FootPath_Clear, + AI_Procedure.SinEffect_SetFreq, + AI_Procedure.SinEffect_SetAmplitude, + AI_Procedure.SinEffect_SetState, + AI_Procedure.SinEffect_SetFreq3D, + AI_Procedure.SinEffect_SetRLIAmplitude, + AI_Procedure.SinEffect_SetRLIBase, + AI_Procedure.SPO_SetDrawFlag, + //NU//AI_Procedure.SPO_SetEngineDisplayModeFlag, + AI_Procedure.DeactivateBut, + AI_Procedure.ActivateBut, + AI_Procedure.None, + AI_Procedure.ChangeComport, + AI_Procedure.ChangeComportReflex, + AI_Procedure.ChangeMyComport, + AI_Procedure.ChangeMyComportReflex, + AI_Procedure.ChangeMyComportAndMyReflex, + AI_Procedure.ChangeAction, + AI_Procedure.ChangeActionForce, + AI_Procedure.ChangeActionRandom, + AI_Procedure.ChangeActionWithEvents, + AI_Procedure.Boucle, + AI_Procedure.FinBoucle, + AI_Procedure.Break, + AI_Procedure.PlayerIsDead, + AI_Procedure.ResetDynamicsWithCard, + AI_Procedure.BreakAI, + AI_Procedure.IgnoreTraceFlagForNextPicking, + AI_Procedure.SetMainActor, + AI_Procedure.ActivateObject, + AI_Procedure.DesactivateObject, + AI_Procedure.ChangeMap, + AI_Procedure.ChangeMapNoAutosave, + AI_Procedure.SetActionReturn, + AI_Procedure.FactorAnimationFrameRate, + AI_Procedure.SetCharacterPriority, + AI_Procedure.ForcePersoHandling, + AI_Procedure.PlayerIsDeadWithPlacement, + //NU//AI_Procedure.SwapLinkTableObjects, + AI_Procedure.ChangeCurrentObjectTable, + //NU//AI_Procedure.BuildObjectTableFromTableAndString, + //NU//AI_Procedure.BuildObjectTableFromFormattedString, + AI_Procedure.TakeModuleControl, + //NU//AI_Procedure.TakeManyModulesControl, + AI_Procedure.ReleaseModuleControl, + //NU//AI_Procedure.CopyGame, + AI_Procedure.QuitGame, + AI_Procedure.ActivateChannel, + AI_Procedure.DeactivateChannel, + AI_Procedure.PersoLightOn, + AI_Procedure.PersoLightOff, + AI_Procedure.SetPersoLightColor, + AI_Procedure.SetPersoLightNearFar, + //NU//AI_Procedure.SetPersoLightLittleBigAlpha, + //NU//AI_Procedure.SetPersoLightGyrophare, + //NU//AI_Procedure.SetPersoLightPulse, + //NU//AI_Procedure.SetPersoLightParalleleType, + AI_Procedure.SetPersoLightSphericalType, + //NU//AI_Procedure.SetPersoLightHotSpotType, + //NU//AI_Procedure.SetPersoLightAmbientType, + AI_Procedure.SendSoundRequest, + //NU//AI_Procedure.SendVoiceRequest, + AI_Procedure.SendMusicRequest, + AI_Procedure.SendAmbianceRequest, + AI_Procedure.SendMenuSndRequest, + //NU//AI_Procedure.DefaultDisplay, + AI_Procedure.DisplayVignette, + AI_Procedure.DeleteVignette, + //NU//AI_Procedure.PRT_SetGeneratorOn, + //NU//AI_Procedure.PRT_SetGeneratorOff, + //NU//AI_Procedure.PRT_SetGenerator, + //NU//AI_Procedure.PRT_SetModeNone, + //NU//AI_Procedure.PRT_SetModeContinuous, + //NU//AI_Procedure.PRT_SetModeCrenel, + //NU//AI_Procedure.PRT_SetModeProbability, + //NU//AI_Procedure.PRT_SetNumberConstant, + //NU//AI_Procedure.PRT_SetNumberProbabilist, + //NU//AI_Procedure.PRT_SetInfiniteLifeTime, + //NU//AI_Procedure.PRT_SetConstantLifeTime, + //NU//AI_Procedure.PRT_SetPobabilistLifeTime, + AI_Procedure.Turn, + AI_Procedure.Turn2, + //NU//AI_Procedure.DeltaTurnPerso, + AI_Procedure.TurnPerso, + AI_Procedure.KillPerso, + AI_Procedure.KillPersoAndClearVariable, + //NU//AI_Procedure.SetVisualGMTColor, + //NU//AI_Procedure.SetVisualGMTSpecularExponent, + AI_Procedure.SetVisualGMTSpecularCoef, + AI_Procedure.SetVisualGMTDiffuseCoef, + AI_Procedure.SetVisualGMTAmbientCoef, + AI_Procedure.SetVisualGMTAsChromed, + //NU//AI_Procedure.SetVisualGMTTextureScrollingCoef, + //NU//AI_Procedure.LockVisualGMT, + //NU//AI_Procedure.UnlockVisualGMT, + AI_Procedure.SetVisualGMTFrame, + + // DefProc1 + //NU//AI_Procedure.OptionChangeDetailsValue, + AI_Procedure.OptionChangeMusicVolume, + AI_Procedure.OptionChangeSfxVolume, + //NU//AI_Procedure.OptionChangeVoiceVolume, + //NU//AI_Procedure.OptionChangeActionKey, + AI_Procedure.OptionConfigureKey, + AI_Procedure.SetPersoAbsolutePosition, + AI_Procedure.SetPersoAtModulePosition, + AI_Procedure.ForcePersoAveragePosition, + AI_Procedure.RelativeMovePerso, + AI_Procedure.ChangePersoAnySighting, + AI_Procedure.ChangePersoSightingWithOffset, + AI_Procedure.RotatePersoAroundX, + AI_Procedure.RotatePersoAroundY, + AI_Procedure.RotatePersoAroundZ, + AI_Procedure.RotatePersoAroundVector, + AI_Procedure.RotatePersoAroundVectorWithOffset, + AI_Procedure.RotatePersoAroundXwithOffset, + AI_Procedure.RotatePersoAroundYwithOffset, + AI_Procedure.RotatePersoAroundZwithOffset, + AI_Procedure.SetFullPersoOrientation, + AI_Procedure.SetFullPersoOrientationWithOffset, + AI_Procedure.ZoomPerso, + AI_Procedure.ChangeOneCustomBit, + AI_Procedure.ChangeManyCustomBits, + AI_Procedure.ImposeSpeed, + AI_Procedure.ImposeSpeedX, + AI_Procedure.ImposeSpeedY, + AI_Procedure.ImposeSpeedZ, + AI_Procedure.ImposeSpeedXY, + AI_Procedure.ImposeSpeedXYZ, + AI_Procedure.ImposeAbsoluteSpeed, + //NU//AI_Procedure.ImposeAbsoluteSpeedX, + //NU//AI_Procedure.ImposeAbsoluteSpeedY, + AI_Procedure.ImposeAbsoluteSpeedZ, + AI_Procedure.ImposeAbsoluteSpeedXY, + AI_Procedure.ImposeAbsoluteSpeedXYZ, + AI_Procedure.ProposeSpeed, + AI_Procedure.ProposeSpeedX, + AI_Procedure.ProposeSpeedY, + AI_Procedure.ProposeSpeedZ, + //NU//AI_Procedure.ProposeSpeedXY, + //NU//AI_Procedure.ProposeSpeedXYZ, + AI_Procedure.ProposeAbsoluteSpeed, + //NU//AI_Procedure.ProposeAbsoluteSpeedX, + //NU//AI_Procedure.ProposeAbsoluteSpeedY, + AI_Procedure.ProposeAbsoluteSpeedZ, + AI_Procedure.ProposeAbsoluteSpeedXY, + //NU//AI_Procedure.ProposeAbsoluteSpeedXYZ, + AI_Procedure.FixePositionPerso, + //NU//AI_Procedure.AddSpeed, + //NU//AI_Procedure.AddSpeedX, + //NU//AI_Procedure.AddSpeedY, + //NU//AI_Procedure.AddSpeedZ, + //NU//AI_Procedure.AddSpeedXY, + //NU//AI_Procedure.AddSpeedXYZ, + AI_Procedure.AddAbsoluteSpeed, + //NU//AI_Procedure.AddAbsoluteSpeedX, + //NU//AI_Procedure.AddAbsoluteSpeedY, + //NU//AI_Procedure.AddAbsoluteSpeedZ, + //NU//AI_Procedure.AddAbsoluteSpeedXY, + //NU//AI_Procedure.AddAbsoluteSpeedXYZ, + //NU//AI_Procedure.PrepareMorph, + //NU//AI_Procedure.StopMorph, + //NU//AI_Procedure.Morphing, + AI_Procedure.ReleaseAllModulesControl, + AI_Procedure.ChangeModuleSighting, + AI_Procedure.SetModuleAbsolutePosition, + AI_Procedure.RelativeMoveModule, + //NU//AI_Procedure.ChangeModuleSightingWithOffset, + AI_Procedure.RotateModuleAroundX, + AI_Procedure.RotateModuleAroundY, + AI_Procedure.RotateModuleAroundZ, + //NU//AI_Procedure.RotateModuleAroundVector, + //NU//AI_Procedure.RotateModuleAroundVectorWithOffset, + //NU//AI_Procedure.RotateModuleAroundXwithOffset, + //NU//AI_Procedure.RotateModuleAroundYwithOffset, + //NU//AI_Procedure.RotateModuleAroundZwithOffset, + AI_Procedure.SetFullModuleOrientation, + //NU//AI_Procedure.SetFullModuleOrientationWithOffset, + AI_Procedure.ZoomModule, + AI_Procedure.SetColliderType, + AI_Procedure.SetColliderVector, + AI_Procedure.SetColliderReal, + AI_Procedure.ResetLastCollisionActor, + AI_Procedure.ClearCollisionReport, + AI_Procedure.SetGoThroughMechanicsHandling, + //NU//AI_Procedure.EraseLastGoThroughMaterial, + AI_Procedure.StringAddChar, + //NU//AI_Procedure.StringReplaceChar, + //NU//AI_Procedure.StringRemoveChar, + AI_Procedure.ChangeLanguage, + AI_Procedure.IntToText, + //NU//AI_Procedure.SetMechanicAnimation, + AI_Procedure.SetMechanicCollide, + AI_Procedure.SetMechanicGravity, + //NU//AI_Procedure.SetMechanicTilt, + //NU//AI_Procedure.SetMechanicGi, + //NU//AI_Procedure.SetMechanicClimb, + AI_Procedure.SetMechanicOnGround, + //NU//AI_Procedure.SetMechanicSpider, + AI_Procedure.SetMechanicShoot, + AI_Procedure.SetMechanicSwim, + AI_Procedure.SetMechanicNeverFall, + AI_Procedure.SetMechanicNewMechanic, + AI_Procedure.SetMechanicCollisionControl, + //NU//AI_Procedure.SetMechanicKeepSpeedZ, + AI_Procedure.SetMechanicSpeedLimit, + AI_Procedure.SetMechanicInertia, + AI_Procedure.SetMechanicStream, + AI_Procedure.SetMechanicStickOnPlatform, + AI_Procedure.SetMechanicScale, + AI_Procedure.SetMechanicGravityFactor, + AI_Procedure.SetMechanicSlide, + AI_Procedure.SetMechanicRebound, + AI_Procedure.SetMechanicSlopeLimit, + AI_Procedure.SetMechanicInertiaX, + AI_Procedure.SetMechanicInertiaY, + AI_Procedure.SetMechanicInertiaZ, + AI_Procedure.SetMechanicInertiaXYZ, + //NU//AI_Procedure.SetMechanicTiltIntensity, + //NU//AI_Procedure.SetMechanicTiltInertia, + //NU//AI_Procedure.SetMechanicTiltOrigin, + AI_Procedure.SetMechanicSpeedMax, + AI_Procedure.SetMechanicStreamPriority, + AI_Procedure.SetMechanicStreamSpeed, + AI_Procedure.SetMechanicStreamFactor, + //NU//AI_Procedure.AddMechanicStreamSpeed, + //NU//AI_Procedure.AddMechanicStreamSpeedList, + //NU//AI_Procedure.MoveLimit, + //NU//AI_Procedure.MoveLimitX, + //NU//AI_Procedure.MoveLimitY, + //NU//AI_Procedure.MoveLimitZ, + //NU//AI_Procedure.MoveLimitXYZ, + //NU//AI_Procedure.StopMoveLimitX, + //NU//AI_Procedure.StopMoveLimitY, + //NU//AI_Procedure.StopMoveLimitZ, + AI_Procedure.StopMoveLimitXYZ, + //NU//AI_Procedure.SetPlatformLink, + //NU//AI_Procedure.FreePlatformLink, + AI_Procedure.MecSetScale, + AI_Procedure.MecSetSlideFactorXYZ, + //NU//AI_Procedure.MecSetSlideFactorX, + //NU//AI_Procedure.MecSetSlideFactorY, + //NU//AI_Procedure.MecSetSlideFactorZ, + AI_Procedure.MecSetClimbSpeedLimit, + AI_Procedure.MecSetHangingLimit, + AI_Procedure.MecSetHangingOff, + AI_Procedure.HierSetFather, + AI_Procedure.HierFreeFather, + AI_Procedure.HierListOfSon, + AI_Procedure.HierSetPlatformType, + AI_Procedure.HierControlLink, + AI_Procedure.HierFreezeEngine, + AI_Procedure.FixePositionZDM, + //NU//AI_Procedure.FixePositionZDD, + //NU//AI_Procedure.FixePositionZDE, + //NU//AI_Procedure.ChangeLightIntensity, + AI_Procedure.SPO_ChangeFlag, + AI_Procedure.ActChangeSpoFlag, + AI_Procedure.ChangeScreenSize, + AI_Procedure.ChangeScreenClip, + AI_Procedure.ChangeScreenPos, + //NU//AI_Procedure.ChangeScreenPosPercent, + //NU//AI_Procedure.ChangeScreenRatio, + AI_Procedure.DisplayShadow, + //NU//AI_Procedure.ChangeShadowHeight, + //NU//AI_Procedure.ChangeShadowVector, + AI_Procedure.ForceActivationZDD, + AI_Procedure.ForceActivationZDM, + AI_Procedure.ForceActivationZDE, + //NU//AI_Procedure.ForceActivationZDR, + AI_Procedure.ForceDesactivationZDD, + AI_Procedure.ForceDesactivationZDM, + AI_Procedure.ForceDesactivationZDE, + //NU//AI_Procedure.ForceDesactivationZDR, + //NU//AI_Procedure.LibereActivationZDD, + AI_Procedure.LibereActivationZDM, + AI_Procedure.LibereActivationZDE, + //NU//AI_Procedure.LibereActivationZDR, + AI_Procedure.ActiveZDR, + AI_Procedure.SetNoCollisionWithMap, + //NU//AI_Procedure.SetNoCollisionWithProjectile, + AI_Procedure.SetNoCollisionWithSecondCharact, + AI_Procedure.SetNoCollisionWithMainCharact, + AI_Procedure.SetNoCollisionWithOtherSectors, + AI_Procedure.SetNoCollisionZdeWithProjectile, + AI_Procedure.SetCollComputeFrequency, + AI_Procedure.SetBrainComputeFrequency, + AI_Procedure.SetLightComputeFrequency, + AI_Procedure.SetUsedExitIdentifier, + AI_Procedure.GetUsedExitIdentifier, + AI_Procedure.SetGlobalCounter, + AI_Procedure.ReadAnalogJoystick, + AI_Procedure.SetAnalogJoystickAxes, + AI_Procedure.SetPadReadingDsgvars, + //NU//AI_Procedure.CancelKeyboardInertia, + //NU//AI_Procedure.GetPadCalibration, + AI_Procedure.SetPadCalibration, + AI_Procedure.SetBooleanInArray, + AI_Procedure.SetDefaultFormatCharacter, + //NU//AI_Procedure.SelectDriver, + AI_Procedure.SelectShapnessMax, + AI_Procedure.CenterScreen, + AI_Procedure.SelectResolution, + AI_Procedure.ChangeBrightness, + AI_Procedure.TexteEntier, + AI_Procedure.TexteReel, + AI_Procedure.SetTextureFiltering, + AI_Procedure.SetAntiAliasing, + AI_Procedure.SetInStereoMode, + AI_Procedure.SetSaturationBackGroundDistance, + AI_Procedure.SaveSoundEventInSlotMemory, + AI_Procedure.RestoreSoundEventInSlotMemory, + AI_Procedure.DrawSegment, + AI_Procedure.UpdateChecksum, + AI_Procedure.ShellExecute, + AI_Procedure.ForceVerticalUsingX, + AI_Procedure.ForceVerticalUsingY, + + // ProcRay2 + //NU//AI_Procedure.FixePointsDeMagie, + //NU//AI_Procedure.FixePointsDeMagieMax, + //NU//AI_Procedure.InitPointsDeMagie, + //NU//AI_Procedure.InitPointsDeMagieMax, + //NU//AI_Procedure.AjoutePointsDeMagie, + //NU//AI_Procedure.AjoutePointsDeMagieMax, + //NU//AI_Procedure.EnlevePointsDeMagie, + //NU//AI_Procedure.EnlevePointsDeMagieMax, + AI_Procedure.FixePointsDair, + AI_Procedure.FixePointsDairMax, + AI_Procedure.InitPointsDair, + //NU//AI_Procedure.InitPointsDairMax, + AI_Procedure.AjoutePointsDair, + //NU//AI_Procedure.AjoutePointsDairMax, + //NU//AI_Procedure.EnlevePointsDair, + //NU//AI_Procedure.EnlevePointsDairMax, + //NU//AI_Procedure.FixePositionFade, + AI_Procedure.FixeLumierePersoLocal, + AI_Procedure.FixeLumiereStaticOnOff, + //NU//AI_Procedure.FixeLumiereStaticNearFar, + //NU//AI_Procedure.FixeLumiereStaticColor, + //NU//AI_Procedure.CalculeLumiereEffet, + AI_Procedure.NoRLI, + AI_Procedure.FixeRLI, + AI_Procedure.BlendRLI, + AI_Procedure.ChangeTypeOfWP, + AI_Procedure.SetCapabilities, + //NU//AI_Procedure.AddCapabilities, + //NU//AI_Procedure.SubCapabilities, + //NU//AI_Procedure.ChangeCapabilities, + AI_Procedure.ReinitGraph, + //NU//AI_Procedure.FixeVitesseTexture, + //NU//AI_Procedure.ScrollingOnOff, + //NU//AI_Procedure.FixeDecalageTexture, + //NU//AI_Procedure.ScrollingPause, + AI_Procedure.ChangeCurrFrame, + AI_Procedure.ChangeRandomFrame, + AI_Procedure.FreezeAnim, + //NU//AI_Procedure.UnFreezeAnim, + AI_Procedure.SetSuperimposed, + AI_Procedure.SetSuperimposed2, + AI_Procedure.ReleaseSuperimposed, + //NU//AI_Procedure.SetSPOCoordinates, + AI_Procedure.SwitchSuperimposedTab, + AI_Procedure.SetTractionFactor, + AI_Procedure.TurnToPositionAngle, + AI_Procedure.TurnToPositionSpeed, + //NU//AI_Procedure.SortArray, + AI_Procedure.ActiveJoystickAnal, + //NU//AI_Procedure.UnActiveJoystickAnal, + AI_Procedure.SetZDMSizeSphere, + //NU//AI_Procedure.SetZDDSizeCone, + AI_Procedure.SetSoundVolumeAnim, + AI_Procedure.SetSoundVolumeMusic, + AI_Procedure.SetSoundVolumeAmbiance, + //NU//AI_Procedure.SetDopplerEffect, + AI_Procedure.PauseSound, + AI_Procedure.ResumeSound, + AI_Procedure.StopMenuSound, + AI_Procedure.ChangeCaractere, + AI_Procedure.FormateTexte, + AI_Procedure.ValideNomDuSlot, + AI_Procedure.RestoreNomDuSlot, + AI_Procedure.ChangePersoSighting, + AI_Procedure.PlayDemo, + AI_Procedure.InitKeyBoardDirections, + AI_Procedure.PadSetCenterposition, + //NU//AI_Procedure.PadSetMaximalValues, + AI_Procedure.ChangeTooFarLimit, + AI_Procedure.ChangeTransparencyZone, + //NU//AI_Procedure.SetBaseFrequenceForMenu, + AI_Procedure.SaveSinusContext, + AI_Procedure.RestoreSinusContext, + AI_Procedure.TextSuperImposed, + + // DefProCa + AI_Procedure.Cam_UpdatePosition, + AI_Procedure.Cam_ChangeShiftTarget, + AI_Procedure.Cam_ChangeShiftPos, + AI_Procedure.Cam_ChangeDistMin, + AI_Procedure.Cam_ChangeDistMax, + AI_Procedure.Cam_ChangeBoundDistMin, + //NU//AI_Procedure.Cam_ChangeBoundDistMax, + AI_Procedure.Cam_ChangeAngleAlpha, + AI_Procedure.Cam_ChangeAngleShiftAlpha, + AI_Procedure.Cam_ChangeAngleTheta, + AI_Procedure.Cam_ChangeAngleShiftTheta, + AI_Procedure.Cam_ChangeLinearSpeed, + AI_Procedure.Cam_ChangeLinearIncreaseSpeed, + AI_Procedure.Cam_ChangeLinearDecreaseSpeed, + AI_Procedure.Cam_ChangeAngularSpeed, + AI_Procedure.Cam_ChangeAngularIncreaseSpeed, + AI_Procedure.Cam_ChangeAngularDecreaseSpeed, + AI_Procedure.Cam_ChangeTargetSpeed, + AI_Procedure.Cam_ChangeTargetIncreaseSpeed, + AI_Procedure.Cam_ChangeTargetDecreaseSpeed, + AI_Procedure.Cam_ChangeFocal, + AI_Procedure.Cam_ChangeZMin, + AI_Procedure.Cam_ChangeZMax, + AI_Procedure.Cam_ChangeTgtPerso, + AI_Procedure.Cam_ChangeSecondTgtPerso, + //NU//AI_Procedure.Cam_ChangeChannel, + //NU//AI_Procedure.Cam_Activate, + //NU//AI_Procedure.Cam_AssociateViewport, + //NU//AI_Procedure.Cam_ResetIAFlags, + AI_Procedure.Cam_SetFlagNoDynamicTarget, + AI_Procedure.Cam_SetFlagNoAverageMoveTgtPerso, + AI_Procedure.Cam_SetFlagNoParseCutAngle, + AI_Procedure.Cam_SetFlagNoVisibility, + //NU//AI_Procedure.Cam_SetFlagNoVisibilityWithDynHie, + AI_Procedure.Cam_SetFlagNoDynChangeTheta, + //NU//AI_Procedure.Cam_SetFlagNoShiftUntilPosReached, + AI_Procedure.Cam_SetFlagNoDynSpeed, + //NU//AI_Procedure.Cam_ResetDNMFlags, + AI_Procedure.Cam_SetFlagNoLinearParsing, + AI_Procedure.Cam_SetFlagNoLinearInertia, + AI_Procedure.Cam_SetFlagNoAngularParsing, + AI_Procedure.Cam_SetFlagNoAngularInertia, + AI_Procedure.Cam_SetFlagNoTargetParsing, + AI_Procedure.Cam_SetFlagNoTargetInertia, + AI_Procedure.Cam_SetFlagFixedOrientation, + AI_Procedure.Cam_SetFlagNoObstacle, + AI_Procedure.Cam_SetFlagNoCollisionWhenNotMoving, + AI_Procedure.Cam_ChangeConstants, + AI_Procedure.Cam_SaveConstants, + AI_Procedure.Cam_RestoreConstants, + //NU//AI_Procedure.Cam_ShowInfo, + AI_Procedure.Cam_ForceTarget, + AI_Procedure.Cam_ForcePosition, + AI_Procedure.Cam_ForceRefAxis, + //NU//AI_Procedure.Cam_Reset, + AI_Procedure.Cam_ForceBestPos, + AI_Procedure.Cam_ForceNormalState, + //NU//AI_Procedure.Cam_ForceMovingOnRail, + AI_Procedure.Cam_SetCameraModeForEngine, + + // DefProc 2 + AI_Procedure.LaunchAGO, + AI_Procedure.SetInGameMenu, + AI_Procedure.JffTxt_Affiche, + AI_Procedure.JffTxt_Extend, + AI_Procedure.JffTxt_Modify, + //NU//AI_Procedure.FadeIn, + //NU//AI_Procedure.FadeOut, + + // DS Exclusive + AI_Procedure.HUD_SetLumsCount, + AI_Procedure.HUD_SetCagesCount, + AI_Procedure.HUD_SetSwimGauge, + AI_Procedure.HUD_SetHealthGauge, + AI_Procedure.HUD_SetEnemyHealthGauge, + AI_Procedure.DoCheatMenu, + AI_Procedure.SetBacklight, + AI_Procedure.BeginAnalogCalibration, + AI_Procedure.EndAnalogCalibration, + }; + } + #endregion + + } + +} diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/AI/Types/Rayman2/AI_Types_R2_DS_EU.cs.meta b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/AI/Types/Rayman2/AI_Types_R2_DS_EU.cs.meta new file mode 100644 index 00000000..cba6bdef --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/AI/Types/Rayman2/AI_Types_R2_DS_EU.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 77169680d1f78c842b6eea50237e9bc3 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/AI/Types/Rayman2/AI_Types_R2_DS_US.cs b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/AI/Types/Rayman2/AI_Types_R2_DS_US.cs new file mode 100644 index 00000000..1254960a --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/AI/Types/Rayman2/AI_Types_R2_DS_US.cs @@ -0,0 +1,23 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace BinarySerializer.Ubisoft.CPA { + public class AI_Types_R2_DS_US : AI_Types_R2_DS_EU { + + #region Conditions + protected override void InitConditions() { + // Same list but with IsUSBuild added + base.InitConditions(); + var ind = Array.IndexOf(Conditions, AI_Condition.IsCheatMenu); + var condList = Conditions.ToList(); + condList.Insert(ind+1, AI_Condition.IsUSBuild); + Conditions = condList.ToArray(); + } + #endregion + + } + +} diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/AI/Types/Rayman2/AI_Types_R2_DS_US.cs.meta b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/AI/Types/Rayman2/AI_Types_R2_DS_US.cs.meta new file mode 100644 index 00000000..b003b0be --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/AI/Types/Rayman2/AI_Types_R2_DS_US.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: d4c27df617d021c4d9d9c585e6b5c949 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/AI/Types/Rayman2/AI_Types_R2_PC.cs b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/AI/Types/Rayman2/AI_Types_R2_PC.cs new file mode 100644 index 00000000..346e053d --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/AI/Types/Rayman2/AI_Types_R2_PC.cs @@ -0,0 +1,1207 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace BinarySerializer.Ubisoft.CPA { + public class AI_Types_R2_PC : AI_Types { + // Re-checked + + #region DsgVar Types + protected override void InitVariableTypes() { + VariableTypes = new AI_DsgVarType[] { + AI_DsgVarType.Boolean, + AI_DsgVarType.SByte, + AI_DsgVarType.UByte, + AI_DsgVarType.Short, + AI_DsgVarType.UShort, + AI_DsgVarType.Int, + AI_DsgVarType.UInt, + AI_DsgVarType.Float, + AI_DsgVarType.WayPoint, + AI_DsgVarType.Perso, + AI_DsgVarType.List, + AI_DsgVarType.Vector, + AI_DsgVarType.Comport, + AI_DsgVarType.Action, + AI_DsgVarType.Text, + AI_DsgVarType.GameMaterial, + AI_DsgVarType.Caps, + AI_DsgVarType.Graph, + AI_DsgVarType.PersoArray, + AI_DsgVarType.VectorArray, + AI_DsgVarType.FloatArray, + AI_DsgVarType.IntegerArray, + AI_DsgVarType.WayPointArray, + AI_DsgVarType.TextArray, + AI_DsgVarType.SuperObject + }; + } + #endregion + + #region Node types + protected override void InitInterpretTypes() { + InterpretTypes = new AI_InterpretType[] { + AI_InterpretType.KeyWord, // 0 + AI_InterpretType.Condition, + AI_InterpretType.Operator, + AI_InterpretType.Function, + AI_InterpretType.Procedure, + AI_InterpretType.MetaAction, // 5 + AI_InterpretType.BeginMacro, + AI_InterpretType.EndMacro, + AI_InterpretType.EndTree, + AI_InterpretType.Field, + AI_InterpretType.DsgVar, // 10 + AI_InterpretType.DsgVarRef, + AI_InterpretType.Constant, + AI_InterpretType.Real, + AI_InterpretType.Button, + AI_InterpretType.ConstantVector, // 15 + AI_InterpretType.Vector, + AI_InterpretType.Mask, + AI_InterpretType.Module, + AI_InterpretType.DsgVarId, + AI_InterpretType.String, // 20 + AI_InterpretType.LipsSynchroRef, + AI_InterpretType.FamilyRef, + AI_InterpretType.PersoRef, + AI_InterpretType.ActionRef, + AI_InterpretType.SuperObjectRef, // 25 + AI_InterpretType.WayPointRef, + AI_InterpretType.TextRef, + AI_InterpretType.ComportRef, + AI_InterpretType.ModuleRef, + AI_InterpretType.SoundEventRef, // 30 + AI_InterpretType.ObjectTableRef, + AI_InterpretType.GameMaterialRef, + AI_InterpretType.ParticleGenerator, + AI_InterpretType.Color, + AI_InterpretType.ModelRef, // 35 + AI_InterpretType.Light, + AI_InterpretType.Caps, + AI_InterpretType.Graph, + AI_InterpretType.MacroRef__Subroutine, + AI_InterpretType.Null, // 40 + }; + } + #endregion + + #region Keywords + protected override void InitKeywords() { + Keywords = new AI_Keyword[] { + AI_Keyword.If, + AI_Keyword.IfNot, + AI_Keyword.If2, + AI_Keyword.If4, + AI_Keyword.If8, + AI_Keyword.If16, + AI_Keyword.IfDebug, + AI_Keyword.IfNotU64, + AI_Keyword.Then, + AI_Keyword.Else, + AI_Keyword.EngineGoto, + AI_Keyword.Me, + AI_Keyword.MainActor, + AI_Keyword.Nobody, + AI_Keyword.NoSuperObject, + AI_Keyword.Nowhere, + AI_Keyword.EmptyText, + AI_Keyword.CapsNull, + AI_Keyword.NoGraph, + AI_Keyword.NoAction, + }; + } + #endregion + + #region Conditions + protected override void InitConditions() { + Conditions = new AI_Condition[] { + AI_Condition.Et, + AI_Condition.Ou, + AI_Condition.Not, + AI_Condition.XOr, + AI_Condition.Equal, + AI_Condition.Different, + AI_Condition.Lesser, + AI_Condition.Greater, + AI_Condition.LesserOrEqual, + AI_Condition.GreaterOrEqual, + AI_Condition.CollidePersoZDDNoWithPerso, + AI_Condition.CollideModuleZDDNoWithPerso, + AI_Condition.CollidePersoAllZDDWithPerso, + AI_Condition.CollidePersoZDDWithAnyPerso, + AI_Condition.CollideModuleZDDWithAnyPerso, + AI_Condition.CollidePersoZDENoWithPersoZDENo, + AI_Condition.CollideModuleZDENoWithPersoZDENo, + AI_Condition.CollidePersoZDENoWithModuleZDENo, + AI_Condition.CollideModuleZDENoWithModuleZDENo, + AI_Condition.CollidePersoZDENoWithPersoTypeZDE, + AI_Condition.CollideModuleZDENoWithPersoTypeZDE, + AI_Condition.CollidePersoTypeZDEWithPersoTypeZDE, + AI_Condition.CollidePersoAllZDEWithPersoAllZDE, + AI_Condition.CollidePersoTypeZDEWithPersoAllZDE, + AI_Condition.CollidePersoAllZDEWithPersoTypeZDE, + AI_Condition.CollidePersoZDENoWithTypeZDE, + AI_Condition.CollideModuleZDENoWithTypeZDE, + AI_Condition.CollideWithGround, + AI_Condition.CollideWithWall, + AI_Condition.CollideWithNothing, + AI_Condition.CollideWithCeiling, + AI_Condition.CollideWithPerso, + AI_Condition.CollideWithWater, + AI_Condition.CollideWithThisPerso, + AI_Condition.ZDMCollideWithGround, + AI_Condition.ZDMCollideWithWall, + AI_Condition.ZDMCollideWithNothing, + AI_Condition.ZDMCollideWithCeiling, + AI_Condition.IsPersoInList, + AI_Condition.IsModelInList, + AI_Condition.IsFamilyInList, + AI_Condition.ListEmptyTest, + AI_Condition.UserEvent_IsSet, + AI_Condition.UserEvent_IsSet2, + AI_Condition.PressedBut, + AI_Condition.JustPressedBut, + AI_Condition.ReleasedBut, + AI_Condition.JustReleasedBut, + AI_Condition.IsTimeElapsed, + AI_Condition.IsValidObject, + AI_Condition.IsValidWayPoint, + AI_Condition.IsValidGMT, + AI_Condition.IsValidAction, + AI_Condition.IsValidText, + AI_Condition.SeePerso, + AI_Condition.IsActivable, + AI_Condition.IsAlreadyHandled, + AI_Condition.Alw_IsMine, + AI_Condition.IsPersoLightOn, + AI_Condition.IsPersoLightPulseOn, + AI_Condition.IsPersoLightGyroPhareOn, + AI_Condition.IsZDMCollideWithObstacle, + AI_Condition.IsZDMCollideWithWall, + AI_Condition.IsZDMCollideWithGround, + AI_Condition.IsZDMCollideWithCeiling, + AI_Condition.CmtIdentifierContainsMask, + AI_Condition.HitByCollider, + AI_Condition.IsTypeOfGMTCollide, + AI_Condition.IsInComport, + AI_Condition.IsInReflexComport, + AI_Condition.IsInAction, + AI_Condition.ChangeActionEnable, + AI_Condition.EngineReinitRequested, + AI_Condition.IsThereMechEvent, + AI_Condition.CollisionWP, + AI_Condition.IsCustomBitSet, + AI_Condition.IsPersoActive, + AI_Condition.CheckActionEnd, + AI_Condition.IsCurrentStateCustomBitSet, + + AI_Condition.IsGiBlock, + AI_Condition.IsMechanicBlock, + AI_Condition.IsMechanicAnimation, + AI_Condition.IsMechanicCollide, + AI_Condition.IsMechanicGravity, + AI_Condition.IsMechanicTilt, + AI_Condition.IsMechanicGi, + AI_Condition.IsMechanicClimb, + AI_Condition.IsMechanicOnGround, + AI_Condition.IsMechanicSpider, + AI_Condition.IsMechanicShoot, + AI_Condition.IsMechanicSwim, + AI_Condition.IsMechanicNeverFall, + AI_Condition.IsMechanicCollisionControl, + AI_Condition.IsMechanicKeepSpeedZ, + AI_Condition.IsMechanicSpeedLimit, + AI_Condition.IsMechanicInertia, + AI_Condition.IsMechanicStream, + AI_Condition.IsMechanicStickOnPlatform, + AI_Condition.IsMechanicPatformCrash, + AI_Condition.IsMechanicScale, + AI_Condition.IsMechanicExec, + AI_Condition.CanFall, + AI_Condition.IsMechanicCrash, + + AI_Condition.IsNullVector, + AI_Condition.HierIsSonOfActor, + AI_Condition.IsMorphing, + AI_Condition.CheckAnimEnd, + AI_Condition.HasTheCapability, + AI_Condition.HasOneOfTheCapabilities, + AI_Condition.HasTheCapabilityNumber, + AI_Condition.PersoHasTheCapability, + AI_Condition.PersoHasOneOfTheCapabilities, + AI_Condition.PersoHasTheCapabilityNumber, + AI_Condition.MagnetIsActivated, + AI_Condition.NEstPasEnCollisionAvecMap, + AI_Condition.NEstPasEnCollisionAvecProjectile, + AI_Condition.NEstPasEnCollisionAvecSecondCharact, + AI_Condition.NEstPasEnCollisionAvecMainCharact, + AI_Condition.NEstPasEnCollisionAvecAutresSecteurs, + AI_Condition.IsInFamily, + AI_Condition.IsInModel, + + AI_Condition.AJoypadIsConnected, + AI_Condition.AKeyJustPressed, + AI_Condition.AButtonPadJustPressed, + AI_Condition.IsInDemoMode, + AI_Condition.IsInStereoMode, + AI_Condition.IsMusicPlaying, + AI_Condition.IsShapnessMax, + + AI_Condition.Cam_IsActive, + AI_Condition.Cam_IsViewportOwner, + AI_Condition.Cam_IsFlagNoDynamicTarget, + AI_Condition.Cam_IsFlagNoAverageMoveTgtPerso, + AI_Condition.Cam_IsFlagNoParseCutAngle, + AI_Condition.Cam_IsFlagNoVisibility, + AI_Condition.Cam_IsFlagNoVisibilityWithDynHie, + AI_Condition.Cam_IsFlagNoDynChangeTheta, + AI_Condition.Cam_IsFlagNoShiftUntilPosReached, + AI_Condition.Cam_IsFlagNoDynSpeed, + AI_Condition.Cam_IsFlagNoLinearParsing, + AI_Condition.Cam_IsFlagNoLinearInertia, + AI_Condition.Cam_IsFlagNoAngularParsing, + AI_Condition.Cam_IsFlagNoAngularInertia, + AI_Condition.Cam_IsFlagNoTargetParsing, + AI_Condition.Cam_IsFlagNoTargetInertia, + AI_Condition.Cam_IsFlagNoObstacle, + AI_Condition.Cam_IsFlagFixedOrientation, + AI_Condition.Cam_IsFlagForcedPosition, + AI_Condition.Cam_IsFlagForcedTarget, + AI_Condition.Cam_IsFlagForcedAxis, + }; + } + #endregion + + #region Operators + protected override void InitOperators() { + Operators = new AI_Operator[] { + AI_Operator.ScalarPlusScalar, + AI_Operator.ScalarMinusScalar, + AI_Operator.ScalarMulScalar, + AI_Operator.ScalarDivScalar, + AI_Operator.ScalarUnaryMinus, + AI_Operator.PlusAffect, + AI_Operator.MinusAffect, + AI_Operator.MulAffect, + AI_Operator.DivAffect, + AI_Operator.PlusPlusAffect, + AI_Operator.MinusMinusAffect, + AI_Operator.Affect, + AI_Operator.Dot, + AI_Operator.GetVectorX, + AI_Operator.GetVectorY, + AI_Operator.GetVectorZ, + AI_Operator.VectorPlusVector, + AI_Operator.VectorMinusVector, + AI_Operator.VectorMulScalar, + AI_Operator.VectorDivScalar, + AI_Operator.VectorUnaryMinus, + AI_Operator.SetVectorX, + AI_Operator.SetVectorY, + AI_Operator.SetVectorZ, + AI_Operator.Ultra, + AI_Operator.ModelCast, + AI_Operator.Array, + AI_Operator.AffectArray, + }; + } + #endregion + + #region Meta Actions + protected override void InitMetaActions() { + MetaActions = new AI_MetaAction[] { + AI_MetaAction.FrozenWait, + AI_MetaAction.ExecuteAction, + AI_MetaAction.WaitEndOfAction, + AI_MetaAction.WaitEndOfAnim, + AI_MetaAction.CamCineMoveAToBTgtC, + AI_MetaAction.CamCineMoveAToBTgtAC, + AI_MetaAction.CamCinePosATgtB, + AI_MetaAction.CamCinePosAMoveTgtBToC, + AI_MetaAction.CamCinePosATgtBTurnPosH, + AI_MetaAction.CamCinePosATgtBTurnTgtH, + AI_MetaAction.CamCinePosATgtBTurnPosV, + AI_MetaAction.CamCinePosATgtBTurnTgtV + }; + } + #endregion + + #region Fields + protected override void InitFields() { + Fields = new AI_Field[] { + AI_Field.Position, + AI_Field.Orientation, + AI_Field.Speed, + AI_Field.NormSpeed, + AI_Field.AbsoluteAxisX, + AI_Field.AbsoluteAxisY, + AI_Field.AbsoluteAxisZ, + AI_Field.PrevComportIntell, + AI_Field.PrevComportReflex, + AI_Field.ShadowScaleX, + AI_Field.ShadowScaleY, + AI_Field.PadGlobalVector, + AI_Field.PadHorizontalAxis, + AI_Field.PadVerticalAxis, + AI_Field.PadAnalogForce, + AI_Field.PadTrueAnalogForce, + AI_Field.PadRotationAngle, + AI_Field.PadSector, + }; + } + #endregion + + #region Functions + protected override void InitFunctions() { + Functions = new AI_Function[] { + AI_Function.GetPersoAbsolutePosition, + AI_Function.GetMyAbsolutePosition, + AI_Function.GetAngleAroundZToPerso, + AI_Function.DistanceToPerso, + AI_Function.DistanceXToPerso, + AI_Function.DistanceYToPerso, + AI_Function.DistanceZToPerso, + AI_Function.DistanceXYToPerso, + AI_Function.DistanceXZToPerso, + AI_Function.DistanceYZToPerso, + AI_Function.DistanceToPersoCenter, + AI_Function.DistanceXToPersoCenter, + AI_Function.DistanceYToPersoCenter, + AI_Function.DistanceZToPersoCenter, + AI_Function.DistanceXYToPersoCenter, + AI_Function.DistanceXZToPersoCenter, + AI_Function.DistanceYZToPersoCenter, + AI_Function.DistanceToWP, + AI_Function.GetWPAbsolutePosition, + AI_Function.Int, + AI_Function.RandomInt, + AI_Function.Real, + AI_Function.Sinus, + AI_Function.Cosinus, + AI_Function.Square, + AI_Function.SquareRoot, + AI_Function.RandomReal, + AI_Function.MinimumReal, + AI_Function.MaximumReal, + AI_Function.DegreeToRadian, + AI_Function.RadianToDegree, + AI_Function.AbsoluteValue, + AI_Function.LimitRealInRange, + AI_Function.Sign, + AI_Function.Cube, + AI_Function.Modulo, + AI_Function.TernInf, + AI_Function.TernSup, + AI_Function.TernEq, + AI_Function.TernInfEq, + AI_Function.TernSupEq, + AI_Function.TernOp, + AI_Function.TemporalRealCombination, + AI_Function.GetHitPoints, + AI_Function.AddAndGetHitPoints, + AI_Function.SubAndGetHitPoints, + AI_Function.GetHitPointsMax, + AI_Function.AddAndGetHitPointsMax, + AI_Function.SubAndGetHitPointsMax, + AI_Function.ListSize, + AI_Function.GivePersoInList, + AI_Function.AbsoluteVector, + AI_Function.RelativeVector, + AI_Function.VecteurLocalToGlobal, + AI_Function.VecteurGlobalToLocal, + AI_Function.GetMagnetStrength, + AI_Function.GetMagnetFar, + AI_Function.GetMagnetNear, + AI_Function.GetMagnetDuration, + AI_Function.SPO_GetDrawFlag, + AI_Function.GetTime, + AI_Function.GetElapsedTime, + AI_Function.GetDeltaT, + AI_Function.GetFrameLength, + AI_Function.InputAnalogicValue, + AI_Function.VitessePadAnalogique, + AI_Function.GenerateObject, + AI_Function.CountGeneratedObjects, + AI_Function.GetGlobalCounter, + AI_Function.GetSubMapId, + AI_Function.AddColor, + AI_Function.AddRed, + AI_Function.AddGreen, + AI_Function.AddBlue, + AI_Function.AddAlpha, + AI_Function.ColorRedGreenBlueAlpha, + AI_Function.ColorRedGreenBlue, + AI_Function.ColorRed, + AI_Function.ColorGreen, + AI_Function.ColorBlue, + AI_Function.ColorAlpha, + AI_Function.GetVisualGMTColor, + AI_Function.GetVisualGMTSpecularCoef, + AI_Function.GetVisualGMTSpecularExponent, + AI_Function.GetVisualGMTDiffuseCoef, + AI_Function.GetVisualGMTAmbientCoef, + AI_Function.GetVisualGMTTextureScrollingCoefU, + AI_Function.GetVisualGMTTextureScrollingCoefV, + AI_Function.GetVisualGMTFrame, + AI_Function.GetVisualGMTNumberOfFrames, + AI_Function.SaveGame, + AI_Function.LoadGame, + AI_Function.EraseGame, + AI_Function.NewGame, + AI_Function.GetCurrentSlot, + AI_Function.IsAValidSlotName, + + // FuncRay2 + AI_Function.LitPointsDeMagie, + AI_Function.LitPointsDeMagieMax, + AI_Function.AjouteEtLitPointsDeMagie, + AI_Function.AjouteEtLitPointsDeMagieMax, + AI_Function.EnleveEtLitPointsDeMagie, + AI_Function.EnleveEtLitPointsDeMagieMax, + AI_Function.LitPointsDair, + AI_Function.LitPointsDairMax, + AI_Function.AjouteEtLitPointsDair, + AI_Function.AjouteEtLitPointsDairMax, + AI_Function.EnleveEtLitPointsDair, + AI_Function.EnleveEtLitPointsDairMax, + AI_Function.PersoLePlusProche, + AI_Function.PersoLePlusProcheDansSecteurCourant, + AI_Function.NearerActorInFieldOfVision, + AI_Function.GetNbActivePerso, + AI_Function.CibleLaPlusProche, + AI_Function.CibleLaPlusProcheAvecAngles, + AI_Function.ReseauWPLePlusProche, + AI_Function.NetworkCloserWPOfType, + AI_Function.ReseauWPLePlusDansLAxe, + AI_Function.ReseauWPLePlusDansLAxe2, + AI_Function.NetworkNextWPWithCapa, + AI_Function.NetworkAffectTypeOfConnectedWP, + AI_Function.NetworkAffectTypeOfConnectedWPWithCapa, + AI_Function.ReseauCheminLePlusCourt, + AI_Function.NetworkBuildOrderedPath, + AI_Function.NetworkBuildOrderedPathCircular, + AI_Function.NetworkAllocateGraphToMSWay, + AI_Function.NetworkAllocateGraphToMSWayCircular, + AI_Function.ReseauLitIndexCourant, + AI_Function.ReseauForceIndexCourant, + AI_Function.ReseauLitPremierIndex, + AI_Function.ReseauLitDernierIndex, + AI_Function.ReseauIncrementIndex, + AI_Function.ReseauDecrementIndex, + AI_Function.ReseauLitWPAIndex, + AI_Function.ReseauLitCapaciteLiaisonAIndex, + AI_Function.ReseauChangeCapaciteLiaisonAIndex, + AI_Function.ReseauLitPoidsLiaisonAIndex, + AI_Function.ReseauChangePoidsLiaisonAIndex, + AI_Function.NetworkGetIndexOfWPInMSWay, + AI_Function.NetworkForceWPToCurrent, + AI_Function.NetworkTestTheEnds, + AI_Function.ReseauLitCapaciteLiaisonDansGraph, + AI_Function.ReseauChangeCapaciteLiaisonDansGraph, + AI_Function.ReseauLitPoidsLiaisonDansGraph, + AI_Function.ReseauChangePoidsLiaisonDansGraph, + AI_Function.NetworkGetTypeOfWP, + AI_Function.GetCapabilities, + AI_Function.CapabilityAtBitNumber, + AI_Function.GetScrollSpeed, + AI_Function.GetNbFrame, + AI_Function.DotProduct, + AI_Function.CrossProduct, + AI_Function.Normalize, + AI_Function.GetSPOCoordinates, + AI_Function.GetTractionFactor, + AI_Function.GetCenterZDEType, + AI_Function.GetCenterZDMType, + AI_Function.GetCenterZDRType, + AI_Function.GetCenterZDDType, + AI_Function.TextAffiche, + AI_Function.GetCPUCounter, + + // DefFunc1 + AI_Function.VitesseHorizontaleDuPerso, + AI_Function.VitesseVerticaleDuPerso, + AI_Function.GetPersoZoomFactor, + AI_Function.GetPersoSighting, + AI_Function.GetPersoHorizon, + AI_Function.GetPersoBanking, + AI_Function.LitPositionZDM, + AI_Function.LitPositionZDE, + AI_Function.LitPositionZDD, + AI_Function.LitCentreZDM, + AI_Function.LitCentreZDE, + AI_Function.LitCentreZDD, + AI_Function.LitAxeZDM, + AI_Function.LitAxeZDE, + AI_Function.LitAxeZDD, + AI_Function.LitDimensionZDM, + AI_Function.LitDimensionZDE, + AI_Function.LitDimensionZDD, + AI_Function.VecteurPointAxe, + AI_Function.VecteurPointSegment, + AI_Function.VectorContribution, + AI_Function.VectorCombination, + AI_Function.TemporalVectorCombination, + AI_Function.ScaledVector, + AI_Function.GetVectorNorm, + AI_Function.RotateVector, + AI_Function.VectorAngle, + AI_Function.VectorCos, + AI_Function.VectorSin, + AI_Function.GetNormalCollideVector, + AI_Function.GetNormalCollideVector2, + AI_Function.GetCollidePoint, + AI_Function.GetCollidePoint2, + AI_Function.GetHandsCollidePoint, + AI_Function.GetCollideRate, + AI_Function.GetCollideRate2, + AI_Function.GetCollideMaterialType, + AI_Function.GetCollideMaterialType2, + AI_Function.GetCollisionPoint, + AI_Function.GetCollisionVector, + AI_Function.GetCollisionPerso, + AI_Function.GetCollisionPointMaterial, + AI_Function.GetLastTraversedMaterialType, + AI_Function.GetLastTraversedMaterial, + AI_Function.GetCurrentCollidedGMT, + AI_Function.GetColliderType, + AI_Function.GetColliderVector, + AI_Function.GetColliderReal, + AI_Function.GetLastCollisionActor, + AI_Function.ComputeRebondVector, + AI_Function.GetModuleAbsolutePosition, + AI_Function.GetModuleRelativePosition, + AI_Function.GetModuleZoomFactor, + AI_Function.GetModuleSighting, + AI_Function.CastIntegerToChannel, + AI_Function.GetSlotDate, + AI_Function.GetSlotName, + AI_Function.GetSlotScore, + AI_Function.GetStringCharAt, + AI_Function.GetFormattedTextInfo, + AI_Function.GetInputEntryName, + AI_Function.GetMechanicGravityFactor, + AI_Function.GetMechanicSlide, + AI_Function.GetMechanicRebound, + AI_Function.GetMechanicSlopeLimit, + AI_Function.GetMechanicInertiaX, + AI_Function.GetMechanicInertiaY, + AI_Function.GetMechanicInertiaZ, + AI_Function.GetMechanicTiltIntensity, + AI_Function.GetMechanicTiltInertia, + AI_Function.GetMechanicTiltOrigin, + AI_Function.GetMechanicMaxSpeed, + AI_Function.GetMechanicStreamPriority, + AI_Function.GetMechanicStreamSpeed, + AI_Function.GetMechanicStreamFactor, + AI_Function.GetSlideFactorX, + AI_Function.GetSlideFactorY, + AI_Function.GetSlideFactorZ, + AI_Function.JumpImpulsion, + AI_Function.GetSpeedAnim, + AI_Function.HierGetFather, + AI_Function.GetActivationZDD, + AI_Function.GetActivationZDM, + AI_Function.GetActivationZDE, + AI_Function.GetActivationZDR, + AI_Function.GetCollisionFrequency, + AI_Function.GetBrainFrequency, + AI_Function.GetLightFrequency, + AI_Function.GetBooleanInArray, + AI_Function.GetNumberOfBooleanInArray, + AI_Function.GetButtonName, + AI_Function.GetDriversAvailable, + AI_Function.GetCurrentLanguageId, + AI_Function.GetNbLanguages, + AI_Function.GetLanguageText, + AI_Function.TextToInt, + AI_Function.GetMusicVolume, + AI_Function.GetSfxVolume, + AI_Function.SlotIsValid, + AI_Function.NbAvailableResolution, + AI_Function.CurrentResolution, + AI_Function.SaveResolution, + AI_Function.IsResolutionAvailable, + AI_Function.GetBrightness, + AI_Function.NameResolution, + AI_Function.GetNbSlotsAvailable, + AI_Function.GetTextureFiltering, + AI_Function.GetAntiAliasing, + AI_Function.GetSaturationDistance, + AI_Function.GetBackgroundDistance, + AI_Function.GetTooFarLimit, + AI_Function.GetTransparencyZoneMin, + AI_Function.GetTransparencyZoneMax, + AI_Function.ExecuteVariable, + AI_Function.ComputeProtectKey, + AI_Function.Xor, + AI_Function.And, + AI_Function.Or, + AI_Function.Not, + AI_Function.DivUnsigned, + AI_Function.MulUnsigned, + AI_Function.AddUnsigned, + AI_Function.SubUnsigned, + AI_Function.GetMemoryValue, + + // DefFunCa + AI_Function.Cam_GetShiftTarget, + AI_Function.Cam_GetShiftPos, + AI_Function.Cam_GetDistMin, + AI_Function.Cam_GetDistMax, + AI_Function.Cam_GetBoundDistMin, + AI_Function.Cam_GetBoundDistMax, + AI_Function.Cam_GetAngleAlpha, + AI_Function.Cam_GetAngleShiftAlpha, + AI_Function.Cam_GetAngleTheta, + AI_Function.Cam_GetAngleShiftTheta, + AI_Function.Cam_GetLinearSpeed, + AI_Function.Cam_GetLinearIncreaseSpeed, + AI_Function.Cam_GetLinearDecreaseSpeed, + AI_Function.Cam_GetAngularSpeed, + AI_Function.Cam_GetAngularIncreaseSpeed, + AI_Function.Cam_GetAngularDecreaseSpeed, + AI_Function.Cam_GetTargetSpeed, + AI_Function.Cam_GetTargetIncreaseSpeed, + AI_Function.Cam_GetTargetDecreaseSpeed, + AI_Function.Cam_GetFocal, + AI_Function.Cam_GetZMin, + AI_Function.Cam_GetZMax, + AI_Function.Cam_GetTargetedSuperObject, + AI_Function.Cam_GetTypeOfViewport, + AI_Function.Cam_GetCameraOfViewport, + AI_Function.Cam_GetMainCamera, + AI_Function.Cam_ComputeTargetWithTgtPerso, + AI_Function.Cam_GetCurrentTargetPosition, + AI_Function.Cam_GetSectorCameraType, + AI_Function.Cam_GetBestPos, + }; + } + #endregion + + #region Procedures + protected override void InitProcedures() { + Procedures = new AI_Procedure[] { + AI_Procedure.SetHitPoints, + AI_Procedure.SetHitPointsInit, + AI_Procedure.SetHitPointsToInitValue, + AI_Procedure.SetHitPointsToMaxValue, + AI_Procedure.AddHitPoints, + AI_Procedure.SubHitPoints, + AI_Procedure.SetHitPointsMax, + AI_Procedure.SetHitPointsMaxToInitValue, + AI_Procedure.SetHitPointsMaxToMaxValue, + AI_Procedure.AddHitPointsMax, + AI_Procedure.SubHitPointsMax, + AI_Procedure.TransparentDisplay, + AI_Procedure.SetTransparency, + AI_Procedure.ACT_SetDrawFlag, + AI_Procedure.ModuleTransparentDisplay, + AI_Procedure.ModuleTransparentDisplay2, + AI_Procedure.SetModuleTransparency, + AI_Procedure.SetModuleTransparency2, + AI_Procedure.ListAffectPersoZDD, + AI_Procedure.ListAffectModuleZDD, + AI_Procedure.ListAffectPersoZDE, + AI_Procedure.ListAffectModuleZDE, + AI_Procedure.ListAffectPersoTypeZDE, + AI_Procedure.ListAffectModuleTypeZDE, + AI_Procedure.ListAffectTypeZDEWithTypeZDE, + AI_Procedure.AddPersoInList, + AI_Procedure.AddPersoInListAt, + AI_Procedure.DeletePersoAtInList, + AI_Procedure.FindPersoAndDeleteInList, + AI_Procedure.ListSelect, + AI_Procedure.ListUnSelect, + AI_Procedure.ListSort, + AI_Procedure.ListSortByFamily, + AI_Procedure.ListSortByModel, + AI_Procedure.FillListWithAllPersoOfAFamily, + AI_Procedure.FillListWithAllPersoOfAModel, + AI_Procedure.DeleteFamilyInList, + AI_Procedure.DeleteModelInList, + AI_Procedure.ListUnion, + AI_Procedure.ListInter, + AI_Procedure.ListDiff, + AI_Procedure.ListAdd, + AI_Procedure.FogActivate, + AI_Procedure.SetFogColor, + AI_Procedure.SetFogNearFarInf, + AI_Procedure.SetFogBlend, + AI_Procedure.RestoreFog, + AI_Procedure.SaveFog, + AI_Procedure.Magnet_ActiveMagnet, + AI_Procedure.Magnet_DeactiveMagnet, + AI_Procedure.Magnet_SetStrength, + AI_Procedure.Magnet_SetFar, + AI_Procedure.Magnet_SetNear, + AI_Procedure.Magnet_SetDuration, + AI_Procedure.FootPath_AddFootPrint, + AI_Procedure.FootPath_Clear, + AI_Procedure.SinEffect_SetFreq, + AI_Procedure.SinEffect_SetAmplitude, + AI_Procedure.SinEffect_SetState, + AI_Procedure.SinEffect_SetFreq3D, + AI_Procedure.SinEffect_SetRLIAmplitude, + AI_Procedure.SinEffect_SetRLIBase, + AI_Procedure.SPO_SetDrawFlag, + AI_Procedure.SPO_SetEngineDisplayModeFlag, + AI_Procedure.DeactivateBut, + AI_Procedure.ActivateBut, + AI_Procedure.None, + AI_Procedure.ChangeComport, + AI_Procedure.ChangeComportReflex, + AI_Procedure.ChangeMyComport, + AI_Procedure.ChangeMyComportReflex, + AI_Procedure.ChangeMyComportAndMyReflex, + AI_Procedure.ChangeAction, + AI_Procedure.ChangeActionForce, + AI_Procedure.ChangeActionRandom, + AI_Procedure.ChangeActionWithEvents, + AI_Procedure.Boucle, + AI_Procedure.FinBoucle, + AI_Procedure.Break, + AI_Procedure.PlayerIsDead, + AI_Procedure.ResetDynamicsWithCard, + AI_Procedure.BreakAI, + AI_Procedure.IgnoreTraceFlagForNextPicking, + AI_Procedure.SetMainActor, + AI_Procedure.ActivateObject, + AI_Procedure.DesactivateObject, + AI_Procedure.ChangeMap, + AI_Procedure.ChangeMapNoAutosave, + AI_Procedure.SetActionReturn, + AI_Procedure.FactorAnimationFrameRate, + AI_Procedure.SetCharacterPriority, + AI_Procedure.ForcePersoHandling, + AI_Procedure.PlayerIsDeadWithPlacement, + AI_Procedure.SwapLinkTableObjects, + AI_Procedure.ChangeCurrentObjectTable, + AI_Procedure.BuildObjectTableFromTableAndString, + AI_Procedure.BuildObjectTableFromFormattedString, + AI_Procedure.TakeModuleControl, + AI_Procedure.TakeManyModulesControl, + AI_Procedure.ReleaseModuleControl, + AI_Procedure.CopyGame, + AI_Procedure.QuitGame, + AI_Procedure.ActivateChannel, + AI_Procedure.DeactivateChannel, + AI_Procedure.PersoLightOn, + AI_Procedure.PersoLightOff, + AI_Procedure.SetPersoLightColor, + AI_Procedure.SetPersoLightNearFar, + AI_Procedure.SetPersoLightLittleBigAlpha, + AI_Procedure.SetPersoLightGyrophare, + AI_Procedure.SetPersoLightPulse, + AI_Procedure.SetPersoLightParalleleType, + AI_Procedure.SetPersoLightSphericalType, + AI_Procedure.SetPersoLightHotSpotType, + AI_Procedure.SetPersoLightAmbientType, + AI_Procedure.SendSoundRequest, + AI_Procedure.SendVoiceRequest, + AI_Procedure.SendMusicRequest, + AI_Procedure.SendAmbianceRequest, + AI_Procedure.SendMenuSndRequest, + AI_Procedure.DefaultDisplay, + AI_Procedure.DisplayVignette, + AI_Procedure.DeleteVignette, + AI_Procedure.PRT_SetGeneratorOn, + AI_Procedure.PRT_SetGeneratorOff, + AI_Procedure.PRT_SetGenerator, + AI_Procedure.PRT_SetModeNone, + AI_Procedure.PRT_SetModeContinuous, + AI_Procedure.PRT_SetModeCrenel, + AI_Procedure.PRT_SetModeProbability, + AI_Procedure.PRT_SetNumberConstant, + AI_Procedure.PRT_SetNumberProbabilist, + AI_Procedure.PRT_SetInfiniteLifeTime, + AI_Procedure.PRT_SetConstantLifeTime, + AI_Procedure.PRT_SetPobabilistLifeTime, + AI_Procedure.Turn, + AI_Procedure.Turn2, + AI_Procedure.DeltaTurnPerso, + AI_Procedure.TurnPerso, + AI_Procedure.KillPerso, + AI_Procedure.KillPersoAndClearVariable, + AI_Procedure.SetVisualGMTColor, + AI_Procedure.SetVisualGMTSpecularExponent, + AI_Procedure.SetVisualGMTSpecularCoef, + AI_Procedure.SetVisualGMTDiffuseCoef, + AI_Procedure.SetVisualGMTAmbientCoef, + AI_Procedure.SetVisualGMTAsChromed, + AI_Procedure.SetVisualGMTTextureScrollingCoef, + AI_Procedure.LockVisualGMT, + AI_Procedure.UnlockVisualGMT, + AI_Procedure.SetVisualGMTFrame, + AI_Procedure.OptionChangeDetailsValue, + AI_Procedure.OptionChangeMusicVolume, + AI_Procedure.OptionChangeSfxVolume, + AI_Procedure.OptionChangeVoiceVolume, + AI_Procedure.OptionChangeActionKey, + AI_Procedure.OptionConfigureKey, + AI_Procedure.SetPersoAbsolutePosition, + AI_Procedure.SetPersoAtModulePosition, + AI_Procedure.ForcePersoAveragePosition, + AI_Procedure.RelativeMovePerso, + AI_Procedure.ChangePersoAnySighting, + AI_Procedure.ChangePersoSightingWithOffset, + AI_Procedure.RotatePersoAroundX, + AI_Procedure.RotatePersoAroundY, + AI_Procedure.RotatePersoAroundZ, + AI_Procedure.RotatePersoAroundVector, + AI_Procedure.RotatePersoAroundVectorWithOffset, + AI_Procedure.RotatePersoAroundXwithOffset, + AI_Procedure.RotatePersoAroundYwithOffset, + AI_Procedure.RotatePersoAroundZwithOffset, + AI_Procedure.SetFullPersoOrientation, + AI_Procedure.SetFullPersoOrientationWithOffset, + AI_Procedure.ZoomPerso, + AI_Procedure.ChangeOneCustomBit, + AI_Procedure.ChangeManyCustomBits, + AI_Procedure.ImposeSpeed, + AI_Procedure.ImposeSpeedX, + AI_Procedure.ImposeSpeedY, + AI_Procedure.ImposeSpeedZ, + AI_Procedure.ImposeSpeedXY, + AI_Procedure.ImposeSpeedXYZ, + AI_Procedure.ImposeAbsoluteSpeed, + AI_Procedure.ImposeAbsoluteSpeedX, + AI_Procedure.ImposeAbsoluteSpeedY, + AI_Procedure.ImposeAbsoluteSpeedZ, + AI_Procedure.ImposeAbsoluteSpeedXY, + AI_Procedure.ImposeAbsoluteSpeedXYZ, + AI_Procedure.ProposeSpeed, + AI_Procedure.ProposeSpeedX, + AI_Procedure.ProposeSpeedY, + AI_Procedure.ProposeSpeedZ, + AI_Procedure.ProposeSpeedXY, + AI_Procedure.ProposeSpeedXYZ, + AI_Procedure.ProposeAbsoluteSpeed, + AI_Procedure.ProposeAbsoluteSpeedX, + AI_Procedure.ProposeAbsoluteSpeedY, + AI_Procedure.ProposeAbsoluteSpeedZ, + AI_Procedure.ProposeAbsoluteSpeedXY, + AI_Procedure.ProposeAbsoluteSpeedXYZ, + AI_Procedure.FixePositionPerso, + AI_Procedure.AddSpeed, + AI_Procedure.AddSpeedX, + AI_Procedure.AddSpeedY, + AI_Procedure.AddSpeedZ, + AI_Procedure.AddSpeedXY, + AI_Procedure.AddSpeedXYZ, + AI_Procedure.AddAbsoluteSpeed, + AI_Procedure.AddAbsoluteSpeedX, + AI_Procedure.AddAbsoluteSpeedY, + AI_Procedure.AddAbsoluteSpeedZ, + AI_Procedure.AddAbsoluteSpeedXY, + AI_Procedure.AddAbsoluteSpeedXYZ, + AI_Procedure.PrepareMorph, + AI_Procedure.StopMorph, + AI_Procedure.Morphing, + AI_Procedure.ReleaseAllModulesControl, + AI_Procedure.ChangeModuleSighting, + AI_Procedure.SetModuleAbsolutePosition, + AI_Procedure.RelativeMoveModule, + AI_Procedure.ChangeModuleSightingWithOffset, + AI_Procedure.RotateModuleAroundX, + AI_Procedure.RotateModuleAroundY, + AI_Procedure.RotateModuleAroundZ, + AI_Procedure.RotateModuleAroundVector, + AI_Procedure.RotateModuleAroundVectorWithOffset, + AI_Procedure.RotateModuleAroundXwithOffset, + AI_Procedure.RotateModuleAroundYwithOffset, + AI_Procedure.RotateModuleAroundZwithOffset, + AI_Procedure.SetFullModuleOrientation, + AI_Procedure.SetFullModuleOrientationWithOffset, + AI_Procedure.ZoomModule, + AI_Procedure.SetColliderType, + AI_Procedure.SetColliderVector, + AI_Procedure.SetColliderReal, + AI_Procedure.ResetLastCollisionActor, + AI_Procedure.ClearCollisionReport, + AI_Procedure.SetGoThroughMechanicsHandling, + AI_Procedure.EraseLastGoThroughMaterial, + AI_Procedure.StringAddChar, + AI_Procedure.StringReplaceChar, + AI_Procedure.StringRemoveChar, + AI_Procedure.ChangeLanguage, + AI_Procedure.IntToText, + AI_Procedure.SetMechanicAnimation, + AI_Procedure.SetMechanicCollide, + AI_Procedure.SetMechanicGravity, + AI_Procedure.SetMechanicTilt, + AI_Procedure.SetMechanicGi, + AI_Procedure.SetMechanicClimb, + AI_Procedure.SetMechanicOnGround, + AI_Procedure.SetMechanicSpider, + AI_Procedure.SetMechanicShoot, + AI_Procedure.SetMechanicSwim, + AI_Procedure.SetMechanicNeverFall, + AI_Procedure.SetMechanicNewMechanic, + AI_Procedure.SetMechanicCollisionControl, + AI_Procedure.SetMechanicKeepSpeedZ, + AI_Procedure.SetMechanicSpeedLimit, + AI_Procedure.SetMechanicInertia, + AI_Procedure.SetMechanicStream, + AI_Procedure.SetMechanicStickOnPlatform, + AI_Procedure.SetMechanicScale, + AI_Procedure.SetMechanicGravityFactor, + AI_Procedure.SetMechanicSlide, + AI_Procedure.SetMechanicRebound, + AI_Procedure.SetMechanicSlopeLimit, + AI_Procedure.SetMechanicInertiaX, + AI_Procedure.SetMechanicInertiaY, + AI_Procedure.SetMechanicInertiaZ, + AI_Procedure.SetMechanicInertiaXYZ, + AI_Procedure.SetMechanicTiltIntensity, + AI_Procedure.SetMechanicTiltInertia, + AI_Procedure.SetMechanicTiltOrigin, + AI_Procedure.SetMechanicSpeedMax, + AI_Procedure.SetMechanicStreamPriority, + AI_Procedure.SetMechanicStreamSpeed, + AI_Procedure.SetMechanicStreamFactor, + AI_Procedure.AddMechanicStreamSpeed, + AI_Procedure.AddMechanicStreamSpeedList, + AI_Procedure.MoveLimit, + AI_Procedure.MoveLimitX, + AI_Procedure.MoveLimitY, + AI_Procedure.MoveLimitZ, + AI_Procedure.MoveLimitXYZ, + AI_Procedure.StopMoveLimitX, + AI_Procedure.StopMoveLimitY, + AI_Procedure.StopMoveLimitZ, + AI_Procedure.StopMoveLimitXYZ, + AI_Procedure.SetPlatformLink, + AI_Procedure.FreePlatformLink, + AI_Procedure.MecSetScale, + AI_Procedure.MecSetSlideFactorXYZ, + AI_Procedure.MecSetSlideFactorX, + AI_Procedure.MecSetSlideFactorY, + AI_Procedure.MecSetSlideFactorZ, + AI_Procedure.MecSetClimbSpeedLimit, + AI_Procedure.MecSetHangingLimit, + AI_Procedure.MecSetHangingOff, + AI_Procedure.MecSetBaseCoeff, + AI_Procedure.MecSetWalkCoeff, + AI_Procedure.HierSetFather, + AI_Procedure.HierFreeFather, + AI_Procedure.HierListOfSon, + AI_Procedure.HierSetPlatformType, + AI_Procedure.HierControlLink, + AI_Procedure.HierFreezeEngine, + AI_Procedure.FixePositionZDM, + AI_Procedure.FixePositionZDD, + AI_Procedure.FixePositionZDE, + AI_Procedure.ChangeLightIntensity, + AI_Procedure.SPO_ChangeFlag, + AI_Procedure.ActChangeSpoFlag, + AI_Procedure.ChangeScreenSize, + AI_Procedure.ChangeScreenClip, + AI_Procedure.ChangeScreenPos, + AI_Procedure.ChangeScreenPosPercent, + AI_Procedure.ChangeScreenRatio, + AI_Procedure.DisplayShadow, + AI_Procedure.ChangeShadowHeight, + AI_Procedure.ChangeShadowVector, + AI_Procedure.ForceActivationZDD, + AI_Procedure.ForceActivationZDM, + AI_Procedure.ForceActivationZDE, + AI_Procedure.ForceActivationZDR, + AI_Procedure.ForceDesactivationZDD, + AI_Procedure.ForceDesactivationZDM, + AI_Procedure.ForceDesactivationZDE, + AI_Procedure.ForceDesactivationZDR, + AI_Procedure.LibereActivationZDD, + AI_Procedure.LibereActivationZDM, + AI_Procedure.LibereActivationZDE, + AI_Procedure.LibereActivationZDR, + AI_Procedure.ActiveZDR, + AI_Procedure.SetNoCollisionWithMap, + AI_Procedure.SetNoCollisionWithProjectile, + AI_Procedure.SetNoCollisionWithSecondCharact, + AI_Procedure.SetNoCollisionWithMainCharact, + AI_Procedure.SetNoCollisionWithOtherSectors, + AI_Procedure.SetNoCollisionZdeWithProjectile, + AI_Procedure.SetCollComputeFrequency, + AI_Procedure.SetBrainComputeFrequency, + AI_Procedure.SetLightComputeFrequency, + AI_Procedure.SetUsedExitIdentifier, + AI_Procedure.GetUsedExitIdentifier, + AI_Procedure.SetGlobalCounter, + AI_Procedure.ReadAnalogJoystick, + AI_Procedure.SetAnalogJoystickAxes, + AI_Procedure.CancelKeyboardInertia, + AI_Procedure.GetPadCalibration, + AI_Procedure.SetPadCalibration, + AI_Procedure.SetBooleanInArray, + AI_Procedure.SetDefaultFormatCharacter, + AI_Procedure.SelectDriver, + AI_Procedure.SelectShapnessMax, + AI_Procedure.CenterScreen, + AI_Procedure.SelectResolution, + AI_Procedure.ChangeBrightness, + AI_Procedure.TexteEntier, + AI_Procedure.TexteReel, + AI_Procedure.SetTextureFiltering, + AI_Procedure.SetAntiAliasing, + AI_Procedure.SetInStereoMode, + AI_Procedure.SND_SetPrevMusicFadeOut, + AI_Procedure.SetSaturationBackGroundDistance, + AI_Procedure.SaveSoundEventInSlotMemory, + AI_Procedure.RestoreSoundEventInSlotMemory, + AI_Procedure.DrawSegment, + AI_Procedure.UpdateChecksum, + AI_Procedure.ShellExecute, + AI_Procedure.FixePointsDeMagie, + AI_Procedure.FixePointsDeMagieMax, + AI_Procedure.InitPointsDeMagie, + AI_Procedure.InitPointsDeMagieMax, + AI_Procedure.AjoutePointsDeMagie, + AI_Procedure.AjoutePointsDeMagieMax, + AI_Procedure.EnlevePointsDeMagie, + AI_Procedure.EnlevePointsDeMagieMax, + AI_Procedure.FixePointsDair, + AI_Procedure.FixePointsDairMax, + AI_Procedure.InitPointsDair, + AI_Procedure.InitPointsDairMax, + AI_Procedure.AjoutePointsDair, + AI_Procedure.AjoutePointsDairMax, + AI_Procedure.EnlevePointsDair, + AI_Procedure.EnlevePointsDairMax, + AI_Procedure.FixePositionFade, + AI_Procedure.FixeLumierePersoLocal, + AI_Procedure.FixeLumiereStaticOnOff, + AI_Procedure.FixeLumiereStaticNearFar, + AI_Procedure.FixeLumiereStaticColor, + AI_Procedure.CalculeLumiereEffet, + AI_Procedure.NoRLI, + AI_Procedure.FixeRLI, + AI_Procedure.BlendRLI, + AI_Procedure.ChangeTypeOfWP, + AI_Procedure.SetCapabilities, + AI_Procedure.AddCapabilities, + AI_Procedure.SubCapabilities, + AI_Procedure.ChangeCapabilities, + AI_Procedure.ReinitGraph, + AI_Procedure.FixeVitesseTexture, + AI_Procedure.ScrollingOnOff, + AI_Procedure.FixeDecalageTexture, + AI_Procedure.ScrollingPause, + AI_Procedure.ChangeCurrFrame, + AI_Procedure.ChangeRandomFrame, + AI_Procedure.FreezeAnim, + AI_Procedure.UnFreezeAnim, + AI_Procedure.SetSuperimposed, + AI_Procedure.SetSuperimposed2, + AI_Procedure.ReleaseSuperimposed, + AI_Procedure.SetSPOCoordinates, + AI_Procedure.SwitchSuperimposedTab, + AI_Procedure.SetTractionFactor, + AI_Procedure.TurnToPositionAngle, + AI_Procedure.TurnToPositionSpeed, + AI_Procedure.SortArray, + AI_Procedure.ActiveJoystickAnal, + AI_Procedure.UnActiveJoystickAnal, + AI_Procedure.SetZDMSizeSphere, + AI_Procedure.SetZDDSizeCone, + AI_Procedure.SetSoundVolumeAnim, + AI_Procedure.SetSoundVolumeMusic, + AI_Procedure.SetSoundVolumeAmbiance, + AI_Procedure.SetDopplerEffect, + AI_Procedure.PauseSound, + AI_Procedure.ResumeSound, + AI_Procedure.StopMenuSound, + AI_Procedure.ChangeCaractere, + AI_Procedure.FormateTexte, + AI_Procedure.ValideNomDuSlot, + AI_Procedure.RestoreNomDuSlot, + AI_Procedure.ChangePersoSighting, + AI_Procedure.PlayDemo, + AI_Procedure.InitKeyBoardDirections, + AI_Procedure.PadSetCenterposition, + AI_Procedure.PadSetMaximalValues, + AI_Procedure.ChangeTooFarLimit, + AI_Procedure.ChangeTransparencyZone, + AI_Procedure.SetBaseFrequenceForMenu, + AI_Procedure.SaveSinusContext, + AI_Procedure.RestoreSinusContext, + AI_Procedure.TextSuperImposed, + AI_Procedure.Cam_UpdatePosition, + AI_Procedure.Cam_ChangeShiftTarget, + AI_Procedure.Cam_ChangeShiftPos, + AI_Procedure.Cam_ChangeDistMin, + AI_Procedure.Cam_ChangeDistMax, + AI_Procedure.Cam_ChangeBoundDistMin, + AI_Procedure.Cam_ChangeBoundDistMax, + AI_Procedure.Cam_ChangeAngleAlpha, + AI_Procedure.Cam_ChangeAngleShiftAlpha, + AI_Procedure.Cam_ChangeAngleTheta, + AI_Procedure.Cam_ChangeAngleShiftTheta, + AI_Procedure.Cam_ChangeLinearSpeed, + AI_Procedure.Cam_ChangeLinearIncreaseSpeed, + AI_Procedure.Cam_ChangeLinearDecreaseSpeed, + AI_Procedure.Cam_ChangeAngularSpeed, + AI_Procedure.Cam_ChangeAngularIncreaseSpeed, + AI_Procedure.Cam_ChangeAngularDecreaseSpeed, + AI_Procedure.Cam_ChangeTargetSpeed, + AI_Procedure.Cam_ChangeTargetIncreaseSpeed, + AI_Procedure.Cam_ChangeTargetDecreaseSpeed, + AI_Procedure.Cam_ChangeFocal, + AI_Procedure.Cam_ChangeZMin, + AI_Procedure.Cam_ChangeZMax, + AI_Procedure.Cam_ChangeTgtPerso, + AI_Procedure.Cam_ChangeSecondTgtPerso, + AI_Procedure.Cam_ChangeChannel, + AI_Procedure.Cam_Activate, + AI_Procedure.Cam_AssociateViewport, + AI_Procedure.Cam_ResetIAFlags, + AI_Procedure.Cam_SetFlagNoDynamicTarget, + AI_Procedure.Cam_SetFlagNoAverageMoveTgtPerso, + AI_Procedure.Cam_SetFlagNoParseCutAngle, + AI_Procedure.Cam_SetFlagNoVisibility, + AI_Procedure.Cam_SetFlagNoVisibilityWithDynHie, + AI_Procedure.Cam_SetFlagNoDynChangeTheta, + AI_Procedure.Cam_SetFlagNoShiftUntilPosReached, + AI_Procedure.Cam_SetFlagNoDynSpeed, + AI_Procedure.Cam_ResetDNMFlags, + AI_Procedure.Cam_SetFlagNoLinearParsing, + AI_Procedure.Cam_SetFlagNoLinearInertia, + AI_Procedure.Cam_SetFlagNoAngularParsing, + AI_Procedure.Cam_SetFlagNoAngularInertia, + AI_Procedure.Cam_SetFlagNoTargetParsing, + AI_Procedure.Cam_SetFlagNoTargetInertia, + AI_Procedure.Cam_SetFlagFixedOrientation, + AI_Procedure.Cam_SetFlagNoObstacle, + AI_Procedure.Cam_SetFlagNoCollisionWhenNotMoving, + AI_Procedure.Cam_ChangeConstants, + AI_Procedure.Cam_SaveConstants, + AI_Procedure.Cam_RestoreConstants, + AI_Procedure.Cam_ShowInfo, + AI_Procedure.Cam_ForceTarget, + AI_Procedure.Cam_ForcePosition, + AI_Procedure.Cam_ForceRefAxis, + AI_Procedure.Cam_Reset, + AI_Procedure.Cam_ForceBestPos, + AI_Procedure.Cam_ForceNormalState, + AI_Procedure.Cam_ForceMovingOnRail, + AI_Procedure.Cam_SetCameraModeForEngine, + AI_Procedure.LaunchAGO, + AI_Procedure.SetInGameMenu, + AI_Procedure.JffTxt_Affiche, + AI_Procedure.JffTxt_Extend, + AI_Procedure.JffTxt_Modify, + AI_Procedure.FadeIn, + AI_Procedure.FadeOut, + AI_Procedure.CheatDoubleSpeed, + AI_Procedure.CheatInvertPad, + AI_Procedure.CheatRandomPad, + AI_Procedure.CheatRandomVignette, + }; + } + #endregion + + } + +} diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/AI/Types/Rayman2/AI_Types_R2_PC.cs.meta b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/AI/Types/Rayman2/AI_Types_R2_PC.cs.meta new file mode 100644 index 00000000..22fc568e --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/AI/Types/Rayman2/AI_Types_R2_PC.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 42af200eda3079c41a90d6fcf034f5b7 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/AI/Types/Rayman2/AI_Types_R2_PC_Demo1.cs b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/AI/Types/Rayman2/AI_Types_R2_PC_Demo1.cs new file mode 100644 index 00000000..cdba8c61 --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/AI/Types/Rayman2/AI_Types_R2_PC_Demo1.cs @@ -0,0 +1,866 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace BinarySerializer.Ubisoft.CPA { + public class AI_Types_R2_PC_Demo1 : AI_Types_R2_PC { + // Re-checked + + // DsgVarTypes list: same as PC + // InterpretTypes list: same as PC + // Keywords list: same as PC + // Conditions list: same as PC + // Operators list: same as PC + // MetaActions list: same as PC + + #region Fields + protected override void InitFields() { // Matches DS/N64 version + Fields = new AI_Field[] { + AI_Field.Position, + AI_Field.Orientation, + AI_Field.Speed, + AI_Field.NormSpeed, + AI_Field.AbsoluteAxisX, + AI_Field.AbsoluteAxisY, + AI_Field.AbsoluteAxisZ, + AI_Field.PrevComportIntell, + AI_Field.PrevComportReflex, + AI_Field.ShadowScaleX, + AI_Field.ShadowScaleY, + }; + } + #endregion + + #region Functions + protected override void InitFunctions() { + Functions = new AI_Function[] { + AI_Function.GetPersoAbsolutePosition, + AI_Function.GetMyAbsolutePosition, + AI_Function.GetAngleAroundZToPerso, + AI_Function.DistanceToPerso, + AI_Function.DistanceXToPerso, + AI_Function.DistanceYToPerso, + AI_Function.DistanceZToPerso, + AI_Function.DistanceXYToPerso, + AI_Function.DistanceXZToPerso, + AI_Function.DistanceYZToPerso, + AI_Function.DistanceToPersoCenter, + AI_Function.DistanceXToPersoCenter, + AI_Function.DistanceYToPersoCenter, + AI_Function.DistanceZToPersoCenter, + AI_Function.DistanceXYToPersoCenter, + AI_Function.DistanceXZToPersoCenter, + AI_Function.DistanceYZToPersoCenter, + AI_Function.DistanceToWP, + AI_Function.GetWPAbsolutePosition, + AI_Function.Int, + AI_Function.RandomInt, + AI_Function.Real, + AI_Function.Sinus, + AI_Function.Cosinus, + AI_Function.Square, + AI_Function.SquareRoot, + AI_Function.RandomReal, + AI_Function.MinimumReal, + AI_Function.MaximumReal, + AI_Function.DegreeToRadian, + AI_Function.RadianToDegree, + AI_Function.AbsoluteValue, + AI_Function.LimitRealInRange, + AI_Function.Sign, + AI_Function.Cube, + AI_Function.Modulo, + AI_Function.TernInf, + AI_Function.TernSup, + AI_Function.TernEq, + AI_Function.TernInfEq, + AI_Function.TernSupEq, + AI_Function.TernOp, + AI_Function.TemporalRealCombination, + AI_Function.GetHitPoints, + AI_Function.AddAndGetHitPoints, + AI_Function.SubAndGetHitPoints, + AI_Function.GetHitPointsMax, + AI_Function.AddAndGetHitPointsMax, + AI_Function.SubAndGetHitPointsMax, + AI_Function.ListSize, + AI_Function.GivePersoInList, + AI_Function.AbsoluteVector, + AI_Function.RelativeVector, + AI_Function.VecteurLocalToGlobal, + AI_Function.VecteurGlobalToLocal, + AI_Function.GetMagnetStrength, + AI_Function.GetMagnetFar, + AI_Function.GetMagnetNear, + AI_Function.GetMagnetDuration, + AI_Function.SPO_GetDrawFlag, + AI_Function.GetTime, + AI_Function.GetElapsedTime, + AI_Function.GetDeltaT, + AI_Function.GetFrameLength, + AI_Function.InputAnalogicValue, + AI_Function.VitessePadAnalogique, + AI_Function.GenerateObject, + AI_Function.CountGeneratedObjects, + AI_Function.GetGlobalCounter, + AI_Function.GetSubMapId, + AI_Function.AddColor, + AI_Function.AddRed, + AI_Function.AddGreen, + AI_Function.AddBlue, + AI_Function.AddAlpha, + AI_Function.ColorRedGreenBlueAlpha, + AI_Function.ColorRedGreenBlue, + AI_Function.ColorRed, + AI_Function.ColorGreen, + AI_Function.ColorBlue, + AI_Function.ColorAlpha, + AI_Function.GetVisualGMTColor, + AI_Function.GetVisualGMTSpecularCoef, + AI_Function.GetVisualGMTSpecularExponent, + AI_Function.GetVisualGMTDiffuseCoef, + AI_Function.GetVisualGMTAmbientCoef, + AI_Function.GetVisualGMTTextureScrollingCoefU, + AI_Function.GetVisualGMTTextureScrollingCoefV, + AI_Function.GetVisualGMTFrame, + AI_Function.GetVisualGMTNumberOfFrames, + AI_Function.SaveGame, + AI_Function.LoadGame, + AI_Function.EraseGame, + AI_Function.GetCurrentSlot, + AI_Function.IsAValidSlotName, + AI_Function.LitPointsDeMagie, + AI_Function.LitPointsDeMagieMax, + AI_Function.AjouteEtLitPointsDeMagie, + AI_Function.AjouteEtLitPointsDeMagieMax, + AI_Function.EnleveEtLitPointsDeMagie, + AI_Function.EnleveEtLitPointsDeMagieMax, + AI_Function.LitPointsDair, + AI_Function.LitPointsDairMax, + AI_Function.AjouteEtLitPointsDair, + AI_Function.AjouteEtLitPointsDairMax, + AI_Function.EnleveEtLitPointsDair, + AI_Function.EnleveEtLitPointsDairMax, + AI_Function.PersoLePlusProche, + AI_Function.PersoLePlusProcheDansSecteurCourant, + AI_Function.NearerActorInFieldOfVision, + AI_Function.GetNbActivePerso, + AI_Function.CibleLaPlusProche, + AI_Function.CibleLaPlusProcheAvecAngles, + AI_Function.ReseauWPLePlusProche, + AI_Function.NetworkCloserWPOfType, + AI_Function.ReseauWPLePlusDansLAxe, + AI_Function.ReseauWPLePlusDansLAxe2, + AI_Function.NetworkNextWPWithCapa, + AI_Function.NetworkAffectTypeOfConnectedWP, + AI_Function.NetworkAffectTypeOfConnectedWPWithCapa, + AI_Function.ReseauCheminLePlusCourt, + AI_Function.NetworkBuildOrderedPath, + AI_Function.NetworkBuildOrderedPathCircular, + AI_Function.NetworkAllocateGraphToMSWay, + AI_Function.NetworkAllocateGraphToMSWayCircular, + AI_Function.ReseauLitIndexCourant, + AI_Function.ReseauForceIndexCourant, + AI_Function.ReseauLitPremierIndex, + AI_Function.ReseauLitDernierIndex, + AI_Function.ReseauIncrementIndex, + AI_Function.ReseauDecrementIndex, + AI_Function.ReseauLitWPAIndex, + AI_Function.ReseauLitCapaciteLiaisonAIndex, + AI_Function.ReseauChangeCapaciteLiaisonAIndex, + AI_Function.ReseauLitPoidsLiaisonAIndex, + AI_Function.ReseauChangePoidsLiaisonAIndex, + AI_Function.NetworkGetIndexOfWPInMSWay, + AI_Function.NetworkForceWPToCurrent, + AI_Function.NetworkTestTheEnds, + AI_Function.ReseauLitCapaciteLiaisonDansGraph, + AI_Function.ReseauChangeCapaciteLiaisonDansGraph, + AI_Function.ReseauLitPoidsLiaisonDansGraph, + AI_Function.ReseauChangePoidsLiaisonDansGraph, + AI_Function.NetworkGetTypeOfWP, + AI_Function.GetCapabilities, + AI_Function.CapabilityAtBitNumber, + AI_Function.GetScrollSpeed, + AI_Function.GetNbFrame, + AI_Function.DotProduct, + AI_Function.CrossProduct, + AI_Function.Normalize, + AI_Function.GetSPOCoordinates, + AI_Function.GetTractionFactor, + AI_Function.GetCenterZDEType, + AI_Function.GetCenterZDMType, + AI_Function.GetCenterZDRType, + AI_Function.GetCenterZDDType, + AI_Function.TextAffiche, + AI_Function.GetCPUCounter, + AI_Function.VitesseHorizontaleDuPerso, + AI_Function.VitesseVerticaleDuPerso, + AI_Function.GetPersoZoomFactor, + AI_Function.GetPersoSighting, + AI_Function.GetPersoHorizon, + AI_Function.GetPersoBanking, + AI_Function.LitPositionZDM, + AI_Function.LitPositionZDE, + AI_Function.LitPositionZDD, + AI_Function.LitCentreZDM, + AI_Function.LitCentreZDE, + AI_Function.LitCentreZDD, + AI_Function.LitAxeZDM, + AI_Function.LitAxeZDE, + AI_Function.LitAxeZDD, + AI_Function.LitDimensionZDM, + AI_Function.LitDimensionZDE, + AI_Function.LitDimensionZDD, + AI_Function.VecteurPointAxe, + AI_Function.VecteurPointSegment, + AI_Function.VectorContribution, + AI_Function.VectorCombination, + AI_Function.TemporalVectorCombination, + AI_Function.ScaledVector, + AI_Function.GetVectorNorm, + AI_Function.RotateVector, + AI_Function.VectorAngle, + AI_Function.VectorCos, + AI_Function.VectorSin, + AI_Function.GetNormalCollideVector, + AI_Function.GetNormalCollideVector2, + AI_Function.GetCollidePoint, + AI_Function.GetCollidePoint2, + AI_Function.GetHandsCollidePoint, + AI_Function.GetCollideRate, + AI_Function.GetCollideRate2, + AI_Function.GetCollideMaterialType, + AI_Function.GetCollideMaterialType2, + AI_Function.GetCollisionPoint, + AI_Function.GetCollisionVector, + AI_Function.GetCollisionPerso, + AI_Function.GetCollisionPointMaterial, + AI_Function.GetLastTraversedMaterialType, + AI_Function.GetLastTraversedMaterial, + AI_Function.GetCurrentCollidedGMT, + AI_Function.GetColliderType, + AI_Function.GetColliderVector, + AI_Function.GetColliderReal, + AI_Function.GetLastCollisionActor, + AI_Function.ComputeRebondVector, + AI_Function.GetModuleAbsolutePosition, + AI_Function.GetModuleRelativePosition, + AI_Function.GetModuleZoomFactor, + AI_Function.GetModuleSighting, + AI_Function.CastIntegerToChannel, + AI_Function.GetSlotName, + AI_Function.GetSlotScore, + AI_Function.GetStringCharAt, + AI_Function.GetFormattedTextInfo, + AI_Function.GetInputEntryName, + AI_Function.GetMechanicGravityFactor, + AI_Function.GetMechanicSlide, + AI_Function.GetMechanicRebound, + AI_Function.GetMechanicSlopeLimit, + AI_Function.GetMechanicInertiaX, + AI_Function.GetMechanicInertiaY, + AI_Function.GetMechanicInertiaZ, + AI_Function.GetMechanicTiltIntensity, + AI_Function.GetMechanicTiltInertia, + AI_Function.GetMechanicTiltOrigin, + AI_Function.GetMechanicMaxSpeed, + AI_Function.GetMechanicStreamPriority, + AI_Function.GetMechanicStreamSpeed, + AI_Function.GetMechanicStreamFactor, + AI_Function.GetSlideFactorX, + AI_Function.GetSlideFactorY, + AI_Function.GetSlideFactorZ, + AI_Function.JumpImpulsion, + AI_Function.GetSpeedAnim, + AI_Function.HierGetFather, + AI_Function.GetActivationZDD, + AI_Function.GetActivationZDM, + AI_Function.GetActivationZDE, + AI_Function.GetActivationZDR, + AI_Function.GetCollisionFrequency, + AI_Function.GetBrainFrequency, + AI_Function.GetLightFrequency, + AI_Function.ReadCharAtKeyPosition, + AI_Function.ExecuteVariable, + AI_Function.GetBooleanInArray, + AI_Function.GetNumberOfBooleanInArray, + AI_Function.GetButtonName, + AI_Function.GetDriversAvailable, + AI_Function.GetCurrentLanguageId, + AI_Function.GetNbLanguages, + AI_Function.GetLanguageText, + AI_Function.TextToInt, + AI_Function.GetMusicVolume, + AI_Function.GetSfxVolume, + AI_Function.SlotIsValid, + AI_Function.NbAvailableResolution, + AI_Function.CurrentResolution, + AI_Function.GetBrightness, + AI_Function.NameResolution, + AI_Function.GetNbSlotsAvailable, + AI_Function.GetTextureFiltering, + AI_Function.GetAntiAliasing, + AI_Function.GetSaturationDistance, + AI_Function.GetBackgroundDistance, + AI_Function.GetTooFarLimit, + AI_Function.GetTransparencyZoneMin, + AI_Function.GetTransparencyZoneMax, + AI_Function.ComputeProtectKey, + AI_Function.Xor, + AI_Function.DivUnsigned, + AI_Function.MulUnsigned, + AI_Function.AddUnsigned, + AI_Function.SubUnsigned, + AI_Function.GetMemoryValue, + AI_Function.Cam_GetShiftTarget, + AI_Function.Cam_GetShiftPos, + AI_Function.Cam_GetDistMin, + AI_Function.Cam_GetDistMax, + AI_Function.Cam_GetBoundDistMin, + AI_Function.Cam_GetBoundDistMax, + AI_Function.Cam_GetAngleAlpha, + AI_Function.Cam_GetAngleShiftAlpha, + AI_Function.Cam_GetAngleTheta, + AI_Function.Cam_GetAngleShiftTheta, + AI_Function.Cam_GetLinearSpeed, + AI_Function.Cam_GetLinearIncreaseSpeed, + AI_Function.Cam_GetLinearDecreaseSpeed, + AI_Function.Cam_GetAngularSpeed, + AI_Function.Cam_GetAngularIncreaseSpeed, + AI_Function.Cam_GetAngularDecreaseSpeed, + AI_Function.Cam_GetTargetSpeed, + AI_Function.Cam_GetTargetIncreaseSpeed, + AI_Function.Cam_GetTargetDecreaseSpeed, + AI_Function.Cam_GetFocal, + AI_Function.Cam_GetZMin, + AI_Function.Cam_GetZMax, + AI_Function.Cam_GetTargetedSuperObject, + AI_Function.Cam_GetTypeOfViewport, + AI_Function.Cam_GetCameraOfViewport, + AI_Function.Cam_GetMainCamera, + AI_Function.Cam_ComputeTargetWithTgtPerso, + AI_Function.Cam_GetCurrentTargetPosition, + AI_Function.Cam_GetSectorCameraType, + AI_Function.Cam_GetBestPos, + }; + } + #endregion + + #region Procedures + protected override void InitProcedures() { + Procedures = new AI_Procedure[] { + AI_Procedure.SetHitPoints, + AI_Procedure.SetHitPointsInit, + AI_Procedure.SetHitPointsToInitValue, + AI_Procedure.SetHitPointsToMaxValue, + AI_Procedure.AddHitPoints, + AI_Procedure.SubHitPoints, + AI_Procedure.SetHitPointsMax, + AI_Procedure.SetHitPointsMaxToInitValue, + AI_Procedure.SetHitPointsMaxToMaxValue, + AI_Procedure.AddHitPointsMax, + AI_Procedure.SubHitPointsMax, + AI_Procedure.TransparentDisplay, + AI_Procedure.SetTransparency, + AI_Procedure.ACT_SetDrawFlag, + AI_Procedure.ModuleTransparentDisplay, + AI_Procedure.ModuleTransparentDisplay2, + AI_Procedure.SetModuleTransparency, + AI_Procedure.SetModuleTransparency2, + AI_Procedure.ListAffectPersoZDD, + AI_Procedure.ListAffectModuleZDD, + AI_Procedure.ListAffectPersoZDE, + AI_Procedure.ListAffectModuleZDE, + AI_Procedure.ListAffectPersoTypeZDE, + AI_Procedure.ListAffectModuleTypeZDE, + AI_Procedure.ListAffectTypeZDEWithTypeZDE, + AI_Procedure.AddPersoInList, + AI_Procedure.AddPersoInListAt, + AI_Procedure.DeletePersoAtInList, + AI_Procedure.FindPersoAndDeleteInList, + AI_Procedure.ListSelect, + AI_Procedure.ListUnSelect, + AI_Procedure.ListSort, + AI_Procedure.ListSortByFamily, + AI_Procedure.ListSortByModel, + AI_Procedure.FillListWithAllPersoOfAFamily, + AI_Procedure.FillListWithAllPersoOfAModel, + AI_Procedure.DeleteFamilyInList, + AI_Procedure.DeleteModelInList, + AI_Procedure.ListUnion, + AI_Procedure.ListInter, + AI_Procedure.ListDiff, + AI_Procedure.ListAdd, + AI_Procedure.FogActivate, + AI_Procedure.SetFogColor, + AI_Procedure.SetFogNearFarInf, + AI_Procedure.SetFogBlend, + AI_Procedure.RestoreFog, + AI_Procedure.SaveFog, + AI_Procedure.Magnet_ActiveMagnet, + AI_Procedure.Magnet_DeactiveMagnet, + AI_Procedure.Magnet_SetStrength, + AI_Procedure.Magnet_SetFar, + AI_Procedure.Magnet_SetNear, + AI_Procedure.Magnet_SetDuration, + AI_Procedure.FootPath_AddFootPrint, + AI_Procedure.FootPath_Clear, + AI_Procedure.SinEffect_SetFreq, + AI_Procedure.SinEffect_SetAmplitude, + AI_Procedure.SinEffect_SetState, + AI_Procedure.SinEffect_SetFreq3D, + AI_Procedure.SinEffect_SetRLIAmplitude, + AI_Procedure.SinEffect_SetRLIBase, + AI_Procedure.SPO_SetDrawFlag, + AI_Procedure.SPO_SetEngineDisplayModeFlag, + AI_Procedure.DeactivateBut, + AI_Procedure.ActivateBut, + AI_Procedure.None, + AI_Procedure.ChangeComport, + AI_Procedure.ChangeComportReflex, + AI_Procedure.ChangeMyComport, + AI_Procedure.ChangeMyComportReflex, + AI_Procedure.ChangeMyComportAndMyReflex, + AI_Procedure.ChangeAction, + AI_Procedure.ChangeActionForce, + AI_Procedure.ChangeActionRandom, + AI_Procedure.ChangeActionWithEvents, + AI_Procedure.Boucle, + AI_Procedure.FinBoucle, + AI_Procedure.Break, + AI_Procedure.PlayerIsDead, + AI_Procedure.ResetDynamicsWithCard, + AI_Procedure.BreakAI, + AI_Procedure.IgnoreTraceFlagForNextPicking, + AI_Procedure.SetMainActor, + AI_Procedure.ActivateObject, + AI_Procedure.DesactivateObject, + AI_Procedure.ChangeMap, + AI_Procedure.ChangeMapNoAutosave, + AI_Procedure.SetActionReturn, + AI_Procedure.FactorAnimationFrameRate, + AI_Procedure.SetCharacterPriority, + AI_Procedure.ForcePersoHandling, + AI_Procedure.PlayerIsDeadWithPlacement, + AI_Procedure.SwapLinkTableObjects, + AI_Procedure.ChangeCurrentObjectTable, + AI_Procedure.BuildObjectTableFromTableAndString, + AI_Procedure.BuildObjectTableFromFormattedString, + AI_Procedure.TakeModuleControl, + AI_Procedure.TakeManyModulesControl, + AI_Procedure.ReleaseModuleControl, + AI_Procedure.CopyGame, + AI_Procedure.QuitGame, + AI_Procedure.ActivateChannel, + AI_Procedure.DeactivateChannel, + AI_Procedure.PersoLightOn, + AI_Procedure.PersoLightOff, + AI_Procedure.SetPersoLightColor, + AI_Procedure.SetPersoLightNearFar, + AI_Procedure.SetPersoLightLittleBigAlpha, + AI_Procedure.SetPersoLightGyrophare, + AI_Procedure.SetPersoLightPulse, + AI_Procedure.SetPersoLightParalleleType, + AI_Procedure.SetPersoLightSphericalType, + AI_Procedure.SetPersoLightHotSpotType, + AI_Procedure.SetPersoLightAmbientType, + AI_Procedure.SendSoundRequest, + AI_Procedure.SendVoiceRequest, + AI_Procedure.SendMusicRequest, + AI_Procedure.SendAmbianceRequest, + AI_Procedure.SendMenuSndRequest, + AI_Procedure.DefaultDisplay, + AI_Procedure.DisplayVignette, + AI_Procedure.DeleteVignette, + AI_Procedure.PRT_SetGeneratorOn, + AI_Procedure.PRT_SetGeneratorOff, + AI_Procedure.PRT_SetGenerator, + AI_Procedure.PRT_SetModeNone, + AI_Procedure.PRT_SetModeContinuous, + AI_Procedure.PRT_SetModeCrenel, + AI_Procedure.PRT_SetModeProbability, + AI_Procedure.PRT_SetNumberConstant, + AI_Procedure.PRT_SetNumberProbabilist, + AI_Procedure.PRT_SetInfiniteLifeTime, + AI_Procedure.PRT_SetConstantLifeTime, + AI_Procedure.PRT_SetPobabilistLifeTime, + AI_Procedure.Turn, + AI_Procedure.Turn2, + AI_Procedure.DeltaTurnPerso, + AI_Procedure.TurnPerso, + AI_Procedure.KillPerso, + AI_Procedure.KillPersoAndClearVariable, + AI_Procedure.SetVisualGMTColor, + AI_Procedure.SetVisualGMTSpecularExponent, + AI_Procedure.SetVisualGMTSpecularCoef, + AI_Procedure.SetVisualGMTDiffuseCoef, + AI_Procedure.SetVisualGMTAmbientCoef, + AI_Procedure.SetVisualGMTAsChromed, + AI_Procedure.SetVisualGMTTextureScrollingCoef, + AI_Procedure.LockVisualGMT, + AI_Procedure.UnlockVisualGMT, + AI_Procedure.SetVisualGMTFrame, + AI_Procedure.OptionChangeDetailsValue, + AI_Procedure.OptionChangeMusicVolume, + AI_Procedure.OptionChangeSfxVolume, + AI_Procedure.OptionChangeVoiceVolume, + AI_Procedure.OptionChangeActionKey, + AI_Procedure.OptionConfigureKey, + AI_Procedure.SetPersoAbsolutePosition, + AI_Procedure.SetPersoAtModulePosition, + AI_Procedure.ForcePersoAveragePosition, + AI_Procedure.RelativeMovePerso, + AI_Procedure.ChangePersoAnySighting, + AI_Procedure.ChangePersoSightingWithOffset, + AI_Procedure.RotatePersoAroundX, + AI_Procedure.RotatePersoAroundY, + AI_Procedure.RotatePersoAroundZ, + AI_Procedure.RotatePersoAroundVector, + AI_Procedure.RotatePersoAroundVectorWithOffset, + AI_Procedure.RotatePersoAroundXwithOffset, + AI_Procedure.RotatePersoAroundYwithOffset, + AI_Procedure.RotatePersoAroundZwithOffset, + AI_Procedure.SetFullPersoOrientation, + AI_Procedure.SetFullPersoOrientationWithOffset, + AI_Procedure.ZoomPerso, + AI_Procedure.ChangeOneCustomBit, + AI_Procedure.ChangeManyCustomBits, + AI_Procedure.ImposeSpeed, + AI_Procedure.ImposeSpeedX, + AI_Procedure.ImposeSpeedY, + AI_Procedure.ImposeSpeedZ, + AI_Procedure.ImposeSpeedXY, + AI_Procedure.ImposeSpeedXYZ, + AI_Procedure.ImposeAbsoluteSpeed, + AI_Procedure.ImposeAbsoluteSpeedX, + AI_Procedure.ImposeAbsoluteSpeedY, + AI_Procedure.ImposeAbsoluteSpeedZ, + AI_Procedure.ImposeAbsoluteSpeedXY, + AI_Procedure.ImposeAbsoluteSpeedXYZ, + AI_Procedure.ProposeSpeed, + AI_Procedure.ProposeSpeedX, + AI_Procedure.ProposeSpeedY, + AI_Procedure.ProposeSpeedZ, + AI_Procedure.ProposeSpeedXY, + AI_Procedure.ProposeSpeedXYZ, + AI_Procedure.ProposeAbsoluteSpeed, + AI_Procedure.ProposeAbsoluteSpeedX, + AI_Procedure.ProposeAbsoluteSpeedY, + AI_Procedure.ProposeAbsoluteSpeedZ, + AI_Procedure.ProposeAbsoluteSpeedXY, + AI_Procedure.ProposeAbsoluteSpeedXYZ, + AI_Procedure.FixePositionPerso, + AI_Procedure.AddSpeed, + AI_Procedure.AddSpeedX, + AI_Procedure.AddSpeedY, + AI_Procedure.AddSpeedZ, + AI_Procedure.AddSpeedXY, + AI_Procedure.AddSpeedXYZ, + AI_Procedure.AddAbsoluteSpeed, + AI_Procedure.AddAbsoluteSpeedX, + AI_Procedure.AddAbsoluteSpeedY, + AI_Procedure.AddAbsoluteSpeedZ, + AI_Procedure.AddAbsoluteSpeedXY, + AI_Procedure.AddAbsoluteSpeedXYZ, + AI_Procedure.PrepareMorph, + AI_Procedure.StopMorph, + AI_Procedure.Morphing, + AI_Procedure.ReleaseAllModulesControl, + AI_Procedure.ChangeModuleSighting, + AI_Procedure.SetModuleAbsolutePosition, + AI_Procedure.RelativeMoveModule, + AI_Procedure.ChangeModuleSightingWithOffset, + AI_Procedure.RotateModuleAroundX, + AI_Procedure.RotateModuleAroundY, + AI_Procedure.RotateModuleAroundZ, + AI_Procedure.RotateModuleAroundVector, + AI_Procedure.RotateModuleAroundVectorWithOffset, + AI_Procedure.RotateModuleAroundXwithOffset, + AI_Procedure.RotateModuleAroundYwithOffset, + AI_Procedure.RotateModuleAroundZwithOffset, + AI_Procedure.SetFullModuleOrientation, + AI_Procedure.SetFullModuleOrientationWithOffset, + AI_Procedure.ZoomModule, + AI_Procedure.SetColliderType, + AI_Procedure.SetColliderVector, + AI_Procedure.SetColliderReal, + AI_Procedure.ResetLastCollisionActor, + AI_Procedure.ClearCollisionReport, + AI_Procedure.SetGoThroughMechanicsHandling, + AI_Procedure.EraseLastGoThroughMaterial, + AI_Procedure.StringAddChar, + AI_Procedure.StringReplaceChar, + AI_Procedure.StringRemoveChar, + AI_Procedure.ChangeLanguage, + AI_Procedure.IntToText, + AI_Procedure.SetMechanicAnimation, + AI_Procedure.SetMechanicCollide, + AI_Procedure.SetMechanicGravity, + AI_Procedure.SetMechanicTilt, + AI_Procedure.SetMechanicGi, + AI_Procedure.SetMechanicClimb, + AI_Procedure.SetMechanicOnGround, + AI_Procedure.SetMechanicSpider, + AI_Procedure.SetMechanicShoot, + AI_Procedure.SetMechanicSwim, + AI_Procedure.SetMechanicNeverFall, + AI_Procedure.SetMechanicCollisionControl, + AI_Procedure.SetMechanicKeepSpeedZ, + AI_Procedure.SetMechanicSpeedLimit, + AI_Procedure.SetMechanicInertia, + AI_Procedure.SetMechanicStream, + AI_Procedure.SetMechanicStickOnPlatform, + AI_Procedure.SetMechanicScale, + AI_Procedure.SetMechanicGravityFactor, + AI_Procedure.SetMechanicSlide, + AI_Procedure.SetMechanicRebound, + AI_Procedure.SetMechanicSlopeLimit, + AI_Procedure.SetMechanicInertiaX, + AI_Procedure.SetMechanicInertiaY, + AI_Procedure.SetMechanicInertiaZ, + AI_Procedure.SetMechanicInertiaXYZ, + AI_Procedure.SetMechanicTiltIntensity, + AI_Procedure.SetMechanicTiltInertia, + AI_Procedure.SetMechanicTiltOrigin, + AI_Procedure.SetMechanicSpeedMax, + AI_Procedure.SetMechanicStreamPriority, + AI_Procedure.SetMechanicStreamSpeed, + AI_Procedure.SetMechanicStreamFactor, + AI_Procedure.AddMechanicStreamSpeed, + AI_Procedure.AddMechanicStreamSpeedList, + AI_Procedure.MoveLimit, + AI_Procedure.MoveLimitX, + AI_Procedure.MoveLimitY, + AI_Procedure.MoveLimitZ, + AI_Procedure.MoveLimitXYZ, + AI_Procedure.StopMoveLimitX, + AI_Procedure.StopMoveLimitY, + AI_Procedure.StopMoveLimitZ, + AI_Procedure.StopMoveLimitXYZ, + AI_Procedure.SetPlatformLink, + AI_Procedure.FreePlatformLink, + AI_Procedure.MecSetScale, + AI_Procedure.MecSetSlideFactorXYZ, + AI_Procedure.MecSetSlideFactorX, + AI_Procedure.MecSetSlideFactorY, + AI_Procedure.MecSetSlideFactorZ, + AI_Procedure.MecSetClimbSpeedLimit, + AI_Procedure.MecSetHangingLimit, + AI_Procedure.MecSetHangingOff, + AI_Procedure.HierSetFather, + AI_Procedure.HierFreeFather, + AI_Procedure.HierListOfSon, + AI_Procedure.HierSetPlatformType, + AI_Procedure.HierControlLink, + AI_Procedure.HierFreezeEngine, + AI_Procedure.FixePositionZDM, + AI_Procedure.FixePositionZDD, + AI_Procedure.FixePositionZDE, + AI_Procedure.ChangeLightIntensity, + AI_Procedure.SPO_ChangeFlag, + AI_Procedure.ActChangeSpoFlag, + AI_Procedure.ChangeScreenSize, + AI_Procedure.ChangeScreenClip, + AI_Procedure.ChangeScreenPos, + AI_Procedure.ChangeScreenPosPercent, + AI_Procedure.ChangeScreenRatio, + AI_Procedure.DisplayShadow, + AI_Procedure.ChangeShadowHeight, + AI_Procedure.ChangeShadowVector, + AI_Procedure.ForceActivationZDD, + AI_Procedure.ForceActivationZDM, + AI_Procedure.ForceActivationZDE, + AI_Procedure.ForceActivationZDR, + AI_Procedure.ForceDesactivationZDD, + AI_Procedure.ForceDesactivationZDM, + AI_Procedure.ForceDesactivationZDE, + AI_Procedure.ForceDesactivationZDR, + AI_Procedure.LibereActivationZDD, + AI_Procedure.LibereActivationZDM, + AI_Procedure.LibereActivationZDE, + AI_Procedure.LibereActivationZDR, + AI_Procedure.ActiveZDR, + AI_Procedure.SetNoCollisionWithMap, + AI_Procedure.SetNoCollisionWithProjectile, + AI_Procedure.SetNoCollisionWithSecondCharact, + AI_Procedure.SetNoCollisionWithMainCharact, + AI_Procedure.SetNoCollisionWithOtherSectors, + AI_Procedure.SetNoCollisionZdeWithProjectile, + AI_Procedure.SetCollComputeFrequency, + AI_Procedure.SetBrainComputeFrequency, + AI_Procedure.SetLightComputeFrequency, + AI_Procedure.SetUsedExitIdentifier, + AI_Procedure.GetUsedExitIdentifier, + AI_Procedure.SetGlobalCounter, + AI_Procedure.ReadAnalogJoystick, + AI_Procedure.SetAnalogJoystickAxes, + AI_Procedure.SetPadReadingDsgvars, + AI_Procedure.CancelKeyboardInertia, + AI_Procedure.GetPadCalibration, + AI_Procedure.SetPadCalibration, + AI_Procedure.SetBooleanInArray, + AI_Procedure.SetDefaultFormatCharacter, + AI_Procedure.SelectDriver, + AI_Procedure.SelectShapnessMax, + AI_Procedure.CenterScreen, + AI_Procedure.SelectResolution, + AI_Procedure.ChangeBrightness, + AI_Procedure.TexteEntier, + AI_Procedure.TexteReel, + AI_Procedure.SetTextureFiltering, + AI_Procedure.SetAntiAliasing, + AI_Procedure.SetInStereoMode, + AI_Procedure.SetSaturationBackGroundDistance, + AI_Procedure.SaveSoundEventInSlotMemory, + AI_Procedure.RestoreSoundEventInSlotMemory, + AI_Procedure.DrawSegment, + AI_Procedure.UpdateChecksum, + AI_Procedure.ShellExecute, + AI_Procedure.FixePointsDeMagie, + AI_Procedure.FixePointsDeMagieMax, + AI_Procedure.InitPointsDeMagie, + AI_Procedure.InitPointsDeMagieMax, + AI_Procedure.AjoutePointsDeMagie, + AI_Procedure.AjoutePointsDeMagieMax, + AI_Procedure.EnlevePointsDeMagie, + AI_Procedure.EnlevePointsDeMagieMax, + AI_Procedure.FixePointsDair, + AI_Procedure.FixePointsDairMax, + AI_Procedure.InitPointsDair, + AI_Procedure.InitPointsDairMax, + AI_Procedure.AjoutePointsDair, + AI_Procedure.AjoutePointsDairMax, + AI_Procedure.EnlevePointsDair, + AI_Procedure.EnlevePointsDairMax, + AI_Procedure.FixePositionFade, + AI_Procedure.FixeLumierePersoLocal, + AI_Procedure.FixeLumiereStaticOnOff, + AI_Procedure.FixeLumiereStaticNearFar, + AI_Procedure.FixeLumiereStaticColor, + AI_Procedure.CalculeLumiereEffet, + AI_Procedure.NoRLI, + AI_Procedure.FixeRLI, + AI_Procedure.BlendRLI, + AI_Procedure.ChangeTypeOfWP, + AI_Procedure.SetCapabilities, + AI_Procedure.AddCapabilities, + AI_Procedure.SubCapabilities, + AI_Procedure.ChangeCapabilities, + AI_Procedure.ReinitGraph, + AI_Procedure.FixeVitesseTexture, + AI_Procedure.ScrollingOnOff, + AI_Procedure.FixeDecalageTexture, + AI_Procedure.ScrollingPause, + AI_Procedure.ChangeCurrFrame, + AI_Procedure.ChangeRandomFrame, + AI_Procedure.FreezeAnim, + AI_Procedure.UnFreezeAnim, + AI_Procedure.SetSuperimposed, + AI_Procedure.SetSuperimposed2, + AI_Procedure.ReleaseSuperimposed, + AI_Procedure.SetSPOCoordinates, + AI_Procedure.SwitchSuperimposedTab, + AI_Procedure.SetTractionFactor, + AI_Procedure.TurnToPositionAngle, + AI_Procedure.TurnToPositionSpeed, + AI_Procedure.SortArray, + AI_Procedure.ActiveJoystickAnal, + AI_Procedure.UnActiveJoystickAnal, + AI_Procedure.SetZDMSizeSphere, + AI_Procedure.SetZDDSizeCone, + AI_Procedure.SetSoundVolumeAnim, + AI_Procedure.SetSoundVolumeMusic, + AI_Procedure.SetSoundVolumeAmbiance, + AI_Procedure.SetDopplerEffect, + AI_Procedure.PauseSound, + AI_Procedure.ResumeSound, + AI_Procedure.StopMenuSound, + AI_Procedure.ChangeCaractere, + AI_Procedure.FormateTexte, + AI_Procedure.ValideNomDuSlot, + AI_Procedure.ChangePersoSighting, + AI_Procedure.PlayDemo, + AI_Procedure.InitKeyBoardDirections, + AI_Procedure.PadSetCenterposition, + AI_Procedure.PadSetMaximalValues, + AI_Procedure.ChangeTooFarLimit, + AI_Procedure.ChangeTransparencyZone, + AI_Procedure.SetBaseFrequenceForMenu, + AI_Procedure.SaveSinusContext, + AI_Procedure.RestoreSinusContext, + AI_Procedure.TextSuperImposed, + AI_Procedure.Cam_UpdatePosition, + AI_Procedure.Cam_ChangeShiftTarget, + AI_Procedure.Cam_ChangeShiftPos, + AI_Procedure.Cam_ChangeDistMin, + AI_Procedure.Cam_ChangeDistMax, + AI_Procedure.Cam_ChangeBoundDistMin, + AI_Procedure.Cam_ChangeBoundDistMax, + AI_Procedure.Cam_ChangeAngleAlpha, + AI_Procedure.Cam_ChangeAngleShiftAlpha, + AI_Procedure.Cam_ChangeAngleTheta, + AI_Procedure.Cam_ChangeAngleShiftTheta, + AI_Procedure.Cam_ChangeLinearSpeed, + AI_Procedure.Cam_ChangeLinearIncreaseSpeed, + AI_Procedure.Cam_ChangeLinearDecreaseSpeed, + AI_Procedure.Cam_ChangeAngularSpeed, + AI_Procedure.Cam_ChangeAngularIncreaseSpeed, + AI_Procedure.Cam_ChangeAngularDecreaseSpeed, + AI_Procedure.Cam_ChangeTargetSpeed, + AI_Procedure.Cam_ChangeTargetIncreaseSpeed, + AI_Procedure.Cam_ChangeTargetDecreaseSpeed, + AI_Procedure.Cam_ChangeFocal, + AI_Procedure.Cam_ChangeZMin, + AI_Procedure.Cam_ChangeZMax, + AI_Procedure.Cam_ChangeTgtPerso, + AI_Procedure.Cam_ChangeSecondTgtPerso, + AI_Procedure.Cam_ChangeChannel, + AI_Procedure.Cam_Activate, + AI_Procedure.Cam_AssociateViewport, + AI_Procedure.Cam_ResetIAFlags, + AI_Procedure.Cam_SetFlagNoDynamicTarget, + AI_Procedure.Cam_SetFlagNoAverageMoveTgtPerso, + AI_Procedure.Cam_SetFlagNoParseCutAngle, + AI_Procedure.Cam_SetFlagNoVisibility, + AI_Procedure.Cam_SetFlagNoVisibilityWithDynHie, + AI_Procedure.Cam_SetFlagNoDynChangeTheta, + AI_Procedure.Cam_SetFlagNoShiftUntilPosReached, + AI_Procedure.Cam_SetFlagNoDynSpeed, + AI_Procedure.Cam_ResetDNMFlags, + AI_Procedure.Cam_SetFlagNoLinearParsing, + AI_Procedure.Cam_SetFlagNoLinearInertia, + AI_Procedure.Cam_SetFlagNoAngularParsing, + AI_Procedure.Cam_SetFlagNoAngularInertia, + AI_Procedure.Cam_SetFlagNoTargetParsing, + AI_Procedure.Cam_SetFlagNoTargetInertia, + AI_Procedure.Cam_SetFlagFixedOrientation, + AI_Procedure.Cam_SetFlagNoObstacle, + AI_Procedure.Cam_SetFlagNoCollisionWhenNotMoving, + AI_Procedure.Cam_ChangeConstants, + AI_Procedure.Cam_SaveConstants, + AI_Procedure.Cam_RestoreConstants, + AI_Procedure.Cam_ShowInfo, + AI_Procedure.Cam_ForceTarget, + AI_Procedure.Cam_ForcePosition, + AI_Procedure.Cam_ForceRefAxis, + AI_Procedure.Cam_Reset, + AI_Procedure.Cam_ForceBestPos, + AI_Procedure.Cam_ForceNormalState, + AI_Procedure.Cam_ForceMovingOnRail, + AI_Procedure.Cam_SetCameraModeForEngine, + AI_Procedure.LaunchAGO, + AI_Procedure.SetInGameMenu, + AI_Procedure.JffTxt_Affiche, + AI_Procedure.JffTxt_Extend, + AI_Procedure.JffTxt_Modify, + AI_Procedure.FadeIn, + AI_Procedure.FadeOut, + }; + } + #endregion + + } + +} diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/AI/Types/Rayman2/AI_Types_R2_PC_Demo1.cs.meta b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/AI/Types/Rayman2/AI_Types_R2_PC_Demo1.cs.meta new file mode 100644 index 00000000..0c8ad964 --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/AI/Types/Rayman2/AI_Types_R2_PC_Demo1.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: c150f1f04f6c0c343b8111dea35d57cc +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/AI/Types/Rayman2/AI_Types_R2_PS2.cs b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/AI/Types/Rayman2/AI_Types_R2_PS2.cs new file mode 100644 index 00000000..3cc2c73e --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/AI/Types/Rayman2/AI_Types_R2_PS2.cs @@ -0,0 +1,1239 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace BinarySerializer.Ubisoft.CPA { + public class AI_Types_R2_PS2 : AI_Types_R2_PC { + // Re-checked + + #region DsgVar Types + protected override void InitVariableTypes() { + VariableTypes = new AI_DsgVarType[] { + AI_DsgVarType.Boolean, + AI_DsgVarType.SByte, + AI_DsgVarType.UByte, + AI_DsgVarType.Short, + AI_DsgVarType.UShort, + AI_DsgVarType.Int, + AI_DsgVarType.UInt, + AI_DsgVarType.Float, + AI_DsgVarType.WayPoint, + AI_DsgVarType.Perso, + AI_DsgVarType.List, + AI_DsgVarType.Vector, + AI_DsgVarType.Comport, + AI_DsgVarType.Action, + AI_DsgVarType.Text, + AI_DsgVarType.GameMaterial, + AI_DsgVarType.VisualMaterial, + AI_DsgVarType.SoundEvent, + AI_DsgVarType.Caps, + AI_DsgVarType.Graph, + + AI_DsgVarType.Placeholder__UnknownArray, + AI_DsgVarType.Placeholder__UnknownArray, + AI_DsgVarType.Placeholder__UnknownArray, + AI_DsgVarType.Placeholder__UnknownArray, + AI_DsgVarType.Placeholder__UnknownArray, + AI_DsgVarType.Placeholder__UnknownArray, + AI_DsgVarType.Placeholder__UnknownArray, + AI_DsgVarType.Placeholder__R2PS2__Type2E, + AI_DsgVarType.Module, + AI_DsgVarType.Placeholder__UnknownArray, + AI_DsgVarType.SuperObject, + AI_DsgVarType.Input, + + }; + } + #endregion + + #region Node types + protected override void InitInterpretTypes() { + InterpretTypes = new AI_InterpretType[] { + AI_InterpretType.KeyWord, // 0 + AI_InterpretType.Condition, + AI_InterpretType.Operator, + AI_InterpretType.Function, + AI_InterpretType.Procedure, + AI_InterpretType.MetaAction, // 5 + AI_InterpretType.BeginMacro, + AI_InterpretType.EndMacro, + AI_InterpretType.EndTree, + AI_InterpretType.Field, + AI_InterpretType.DsgVar, // 10 + AI_InterpretType.DsgVarRef, + AI_InterpretType.Constant, + AI_InterpretType.Real, + AI_InterpretType.Button, + AI_InterpretType.ConstantVector, // 15 + AI_InterpretType.Vector, + AI_InterpretType.Mask, + AI_InterpretType.ModuleRef, + AI_InterpretType.DsgVarId, + AI_InterpretType.String, // 20 + AI_InterpretType.LipsSynchroRef, + AI_InterpretType.FamilyRef, + AI_InterpretType.PersoRef, + AI_InterpretType.ActionRef, + AI_InterpretType.SuperObjectRef, // 25 + AI_InterpretType.WayPointRef, + AI_InterpretType.TextRef, + AI_InterpretType.ComportRef, + AI_InterpretType.ModuleRef, + AI_InterpretType.SoundEventRef, // 30 + AI_InterpretType.ObjectTableRef, + AI_InterpretType.GameMaterialRef, + AI_InterpretType.VisualMaterialRef, // Not 100% sure + AI_InterpretType.Placeholder__R2PS2__Type2E, // Not 100% sure + AI_InterpretType.Color, + AI_InterpretType.ModelRef, // 35 + AI_InterpretType.Light, + AI_InterpretType.Caps, + AI_InterpretType.Graph, + AI_InterpretType.MacroRef__Subroutine, // 40 + AI_InterpretType.Null, + }; + } + #endregion + + #region Keywords + protected override void InitKeywords() { + Keywords = new AI_Keyword[] { + AI_Keyword.If, + AI_Keyword.IfNot, + AI_Keyword.If2, + AI_Keyword.IfNot2, + AI_Keyword.If4, + AI_Keyword.IfNot4, + AI_Keyword.If8, + AI_Keyword.IfNot8, + AI_Keyword.If16, + AI_Keyword.IfNot16, + AI_Keyword.Then, + AI_Keyword.Else, + AI_Keyword.EngineGoto, + AI_Keyword.Me, + AI_Keyword.MainActor, + AI_Keyword.Nobody, + AI_Keyword.NoSuperObject, + AI_Keyword.Nowhere, + AI_Keyword.EmptyText, + AI_Keyword.CapsNull, + AI_Keyword.NoGraph, + AI_Keyword.NoAction, + AI_Keyword.NoGameMaterial, + AI_Keyword.NoVisualMaterial, + AI_Keyword.NoSoundEvent, + AI_Keyword.NoModule, + AI_Keyword.While, + AI_Keyword.BeginWhile, + AI_Keyword.EndWhile, + AI_Keyword.NoInput, + }; + } + #endregion + + #region Conditions + protected override void InitConditions() { + Conditions = new AI_Condition[] { + AI_Condition.Et, + AI_Condition.Ou, + AI_Condition.Not, + AI_Condition.XOr, + AI_Condition.Equal, + AI_Condition.Different, + AI_Condition.Lesser, + AI_Condition.Greater, + AI_Condition.LesserOrEqual, + AI_Condition.GreaterOrEqual, + + AI_Condition.CollidePersoZDDNoWithPerso, // merged with AI_Condition.CollideModuleZDDNoWithPerso, + AI_Condition.CollidePersoAllZDDWithPerso, + AI_Condition.CollidePersoZDDWithAnyPerso, // merged with AI_Condition.CollideModuleZDDWithAnyPerso, + AI_Condition.CollidePersoZDENoWithPersoZDENo, // merged with AI_Condition.CollideModuleZDENoWithPersoZDENo, + //AI_Condition.CollidePersoZDENoWithModuleZDENo, + //AI_Condition.CollideModuleZDENoWithModuleZDENo, + AI_Condition.CollidePersoZDENoWithPersoTypeZDE, // merged with AI_Condition.CollideModuleZDENoWithPersoTypeZDE, + AI_Condition.CollidePersoTypeZDEWithPersoTypeZDE, + AI_Condition.CollidePersoAllZDEWithPersoAllZDE, + AI_Condition.CollidePersoTypeZDEWithPersoAllZDE, + AI_Condition.CollidePersoAllZDEWithPersoTypeZDE, + AI_Condition.CollidePersoZDENoWithTypeZDE, // merged with AI_Condition.CollideModuleZDENoWithTypeZDE, + + AI_Condition.CollideWithGround, + AI_Condition.CollideWithWall, + AI_Condition.CollideWithNothing, + AI_Condition.CollideWithCeiling, + AI_Condition.CollideWithPerso, + AI_Condition.CollideWithWater, + AI_Condition.CollideWithThisPerso, + AI_Condition.ZDMCollideWithGround, + AI_Condition.ZDMCollideWithWall, + AI_Condition.ZDMCollideWithNothing, + AI_Condition.ZDMCollideWithCeiling, + + AI_Condition.IsPersoInList, + AI_Condition.IsModelInList, + AI_Condition.IsFamilyInList, + AI_Condition.ListEmptyTest, + AI_Condition.UserEvent_IsSet, + AI_Condition.UserEvent_IsSet2, + AI_Condition.PressedBut, + AI_Condition.JustPressedBut, + AI_Condition.ReleasedBut, + AI_Condition.JustReleasedBut, + AI_Condition.IsTimeElapsed, + AI_Condition.IsValidObject, + AI_Condition.IsValidWayPoint, + AI_Condition.IsValidGMT, + AI_Condition.IsValidVMT, + AI_Condition.IsValidAction, + AI_Condition.IsValidText, + AI_Condition.Placeholder, + AI_Condition.SeePerso, + AI_Condition.IsActivable, + AI_Condition.IsAlreadyHandled, + AI_Condition.Alw_IsMine, + AI_Condition.IsPersoLightOn, + AI_Condition.IsPersoLightPulseOn, + AI_Condition.IsPersoLightGyroPhareOn, + + AI_Condition.IsZDMCollideWithObstacle, + AI_Condition.IsZDMCollideWithWall, + AI_Condition.IsZDMCollideWithGround, + AI_Condition.IsZDMCollideWithCeiling, + + AI_Condition.CmtIdentifierContainsMask, + AI_Condition.HitByCollider, + AI_Condition.IsTypeOfGMTCollide, + AI_Condition.IsInComport, + AI_Condition.IsInReflexComport, + AI_Condition.IsInAction, + AI_Condition.ChangeActionEnable, + AI_Condition.EngineReinitRequested, + AI_Condition.IsThereMechEvent, + AI_Condition.CollisionWP, + AI_Condition.IsCustomBitSet, + AI_Condition.IsPersoActive, + AI_Condition.CheckActionEnd, + AI_Condition.IsCurrentStateCustomBitSet, + + AI_Condition.IsGiBlock, + AI_Condition.IsMechanicBlock, + AI_Condition.IsMechanicAnimation, + AI_Condition.IsMechanicCollide, + AI_Condition.IsMechanicGravity, + AI_Condition.IsMechanicTilt, + AI_Condition.IsMechanicGi, + AI_Condition.IsMechanicClimb, + AI_Condition.IsMechanicOnGround, + AI_Condition.IsMechanicSpider, + AI_Condition.IsMechanicShoot, + AI_Condition.IsMechanicSwim, + AI_Condition.IsMechanicNeverFall, + AI_Condition.IsMechanicCollisionControl, + AI_Condition.IsMechanicKeepSpeedZ, + AI_Condition.IsMechanicSpeedLimit, + AI_Condition.IsMechanicInertia, + AI_Condition.IsMechanicStream, + AI_Condition.IsMechanicStickOnPlatform, + AI_Condition.IsMechanicPatformCrash, + AI_Condition.IsMechanicScale, + AI_Condition.IsMechanicExec, + AI_Condition.CanFall, + AI_Condition.IsMechanicCrash, + + AI_Condition.IsNullVector, + AI_Condition.HierIsSonOfActor, + AI_Condition.CheckAnimEnd, + AI_Condition.HasTheCapability, + AI_Condition.HasOneOfTheCapabilities, + AI_Condition.HasTheCapabilityNumber, + AI_Condition.PersoHasTheCapability, + AI_Condition.PersoHasOneOfTheCapabilities, + AI_Condition.PersoHasTheCapabilityNumber, + AI_Condition.NEstPasEnCollisionAvecMap, + AI_Condition.NEstPasEnCollisionAvecProjectile, + AI_Condition.NEstPasEnCollisionAvecSecondCharact, + AI_Condition.NEstPasEnCollisionAvecMainCharact, + AI_Condition.NEstPasEnCollisionAvecAutresSecteurs, + AI_Condition.IsInFamily, + AI_Condition.IsInModel, + + AI_Condition.AJoypadIsConnected, + AI_Condition.AKeyJustPressed, + AI_Condition.AButtonPadJustPressed, + AI_Condition.IsInDemoMode, + AI_Condition.IsInStereoMode, + AI_Condition.IsMusicPlaying, + AI_Condition.Placeholder, + AI_Condition.IsShapnessMax, + AI_Condition.IsTooFar, + AI_Condition.Placeholder, + AI_Condition.Placeholder, + AI_Condition.Placeholder, + AI_Condition.Placeholder, + + AI_Condition.Cam_IsActive, + AI_Condition.Cam_IsViewportOwner, + AI_Condition.Cam_IsFlagNoDynamicTarget, + AI_Condition.Cam_IsFlagNoAverageMoveTgtPerso, + AI_Condition.Cam_IsFlagNoParseCutAngle, + AI_Condition.Cam_IsFlagNoVisibility, + AI_Condition.Cam_IsFlagNoVisibilityWithDynHie, + AI_Condition.Cam_IsFlagNoDynChangeTheta, + AI_Condition.Cam_IsFlagNoShiftUntilPosReached, + AI_Condition.Cam_IsFlagNoDynSpeed, + AI_Condition.Cam_IsFlagNoLinearParsing, + AI_Condition.Cam_IsFlagNoLinearInertia, + AI_Condition.Cam_IsFlagNoAngularParsing, + AI_Condition.Cam_IsFlagNoAngularInertia, + AI_Condition.Cam_IsFlagNoTargetParsing, + AI_Condition.Cam_IsFlagNoTargetInertia, + AI_Condition.Cam_IsFlagNoObstacle, + AI_Condition.Cam_IsFlagFixedOrientation, + AI_Condition.Cam_IsFlagForcedPosition, + AI_Condition.Cam_IsFlagForcedTarget, + AI_Condition.Cam_IsFlagForcedAxis, + }; + } + #endregion + + #region Fields + protected override void InitFields() { + Fields = new AI_Field[] { // Type + AI_Field.Position, // 2 + AI_Field.Orientation, // 2 + AI_Field.Speed, // 2 + AI_Field.NormSpeed, // 1 + AI_Field.PrevComportIntell, // 3 + AI_Field.PrevComportReflex, // 3 + AI_Field.PadGlobalVector, // 2 + AI_Field.PadHorizontalAxis, // 0 + AI_Field.PadVerticalAxis, // 0 + AI_Field.PadAnalogForce, // 1 + AI_Field.PadTrueAnalogForce, // 1 + AI_Field.PadRotationAngle, // 1 + AI_Field.PadSector, // 0 + }; + } + #endregion + + #region Functions + protected override void InitFunctions() { + Functions = new AI_Function[] { + AI_Function.GetPersoAbsolutePosition, + AI_Function.GetMyAbsolutePosition, + AI_Function.GetAngleAroundZToPerso, + AI_Function.DistanceToPerso, + AI_Function.DistanceXToPerso, + AI_Function.DistanceYToPerso, + AI_Function.DistanceZToPerso, + AI_Function.DistanceXYToPerso, + AI_Function.DistanceXZToPerso, + AI_Function.DistanceYZToPerso, + AI_Function.DistanceToPersoCenter, + AI_Function.DistanceXToPersoCenter, + AI_Function.DistanceYToPersoCenter, + AI_Function.DistanceZToPersoCenter, + AI_Function.DistanceXYToPersoCenter, + AI_Function.DistanceXZToPersoCenter, + AI_Function.DistanceYZToPersoCenter, + AI_Function.DistanceToWP, + AI_Function.GetWPAbsolutePosition, + AI_Function.Int, + AI_Function.RandomInt, + AI_Function.Real, + AI_Function.Sinus, + AI_Function.Cosinus, + AI_Function.Square, + AI_Function.SquareRoot, + AI_Function.RandomReal, + AI_Function.MinimumReal, + AI_Function.MaximumReal, + AI_Function.DegreeToRadian, + AI_Function.RadianToDegree, + AI_Function.AbsoluteValue, + AI_Function.LimitRealInRange, + AI_Function.Sign, + AI_Function.Cube, + AI_Function.Modulo, + AI_Function.TernInf, + AI_Function.TernSup, + AI_Function.TernEq, + AI_Function.TernInfEq, + AI_Function.TernSupEq, + AI_Function.TernOp, + AI_Function.TemporalRealCombination, + AI_Function.Placeholder__GetRevolutionStdGamePlusC, + AI_Function.GetHitPoints, + AI_Function.AddAndGetHitPoints, + AI_Function.SubAndGetHitPoints, + AI_Function.GetHitPointsMax, + AI_Function.AddAndGetHitPointsMax, + AI_Function.SubAndGetHitPointsMax, + AI_Function.ListSize, + AI_Function.GivePersoInList, + AI_Function.AbsoluteVector, + AI_Function.RelativeVector, + AI_Function.VecteurLocalToGlobal, + AI_Function.VecteurGlobalToLocal, + AI_Function.SPO_GetDrawFlag, + AI_Function.GetTime, + AI_Function.GetElapsedTime, + AI_Function.GetDeltaT, + AI_Function.GetFrameLength, + AI_Function.InputAnalogicValue, + AI_Function.VitessePadAnalogique, + AI_Function.GenerateObject, + AI_Function.CountGeneratedObjects, + AI_Function.GetGlobalCounter, + AI_Function.GetSubMapId, + AI_Function.AddColor, + AI_Function.AddRed, + AI_Function.AddGreen, + AI_Function.AddBlue, + AI_Function.AddAlpha, + AI_Function.ColorRedGreenBlueAlpha, + AI_Function.ColorRedGreenBlue, + AI_Function.ColorRed, + AI_Function.ColorGreen, + AI_Function.ColorBlue, + AI_Function.ColorAlpha, + AI_Function.GetVisualGMTColor, + AI_Function.GetVisualGMTSpecularCoef, + AI_Function.GetVisualGMTSpecularExponent, + AI_Function.GetVisualGMTDiffuseCoef, + AI_Function.GetVisualGMTAmbientCoef, + AI_Function.GetVisualGMTTextureScrollingCoefU, + AI_Function.GetVisualGMTTextureScrollingCoefV, + AI_Function.GetVisualGMTFrame, + AI_Function.GetVisualGMTNumberOfFrames, + + // TODO: 16 save functions, 21 in Largo... + AI_Function.Placeholder__R2PS2__SaveGame_0__UInt, + AI_Function.Placeholder__R2PS2__SaveGame_1__UInt, + AI_Function.Placeholder__R2PS2__SaveGame_2__1P__String, + AI_Function.Placeholder__R2PS2__SaveGame_3__1P__UInt__NotInLargo, + AI_Function.Placeholder__R2PS2__SaveGame_4__1P__String, + AI_Function.Placeholder__R2PS2__SaveGame_5__UInt, + AI_Function.Placeholder__R2PS2__SaveGame_6__String, + AI_Function.Placeholder__R2PS2__SaveGame_7__UInt__NotInLargo, + AI_Function.Placeholder__R2PS2__SaveGame_8__String, + AI_Function.Placeholder__R2PS2__SaveGame_9__UInt, + AI_Function.Placeholder__R2PS2__SaveGame_10__UInt, + AI_Function.Placeholder__R2PS2__SaveGame_11__1P__UInt, + AI_Function.Placeholder__R2PS2__SaveGame_12__UInt, + AI_Function.Placeholder__R2PS2__SaveGame_13__UInt, + AI_Function.Placeholder__R2PS2__SaveGame_14__1P__UInt, + AI_Function.Placeholder__R2PS2__SaveGame_15__1P__UInt, + AI_Function.IsAValidSlotName, + + // FuncRay2 + AI_Function.LitPointsDeMagie, + AI_Function.LitPointsDeMagieMax, + AI_Function.AjouteEtLitPointsDeMagie, + AI_Function.AjouteEtLitPointsDeMagieMax, + AI_Function.EnleveEtLitPointsDeMagie, + AI_Function.EnleveEtLitPointsDeMagieMax, + AI_Function.LitPointsDair, + AI_Function.LitPointsDairMax, + AI_Function.AjouteEtLitPointsDair, + AI_Function.AjouteEtLitPointsDairMax, + AI_Function.EnleveEtLitPointsDair, + AI_Function.EnleveEtLitPointsDairMax, + AI_Function.PersoLePlusProche, + AI_Function.PersoLePlusProcheDansSecteurCourant, + + AI_Function.NearerActorInFieldOfVision, + AI_Function.NearerActorOfFamilyInFieldOfVision, + AI_Function.NearerActorInFieldOfVisionWithOffset, + AI_Function.NearerActorOfFamilyInFOVWithOffset, + + AI_Function.GetNbActivePerso, + AI_Function.CibleLaPlusProche, + AI_Function.CibleLaPlusProcheAvecAngles, + + AI_Function.ReseauWPLePlusProche, + AI_Function.NetworkCloserWPOfType, + AI_Function.ReseauWPLePlusDansLAxe, + AI_Function.ReseauWPLePlusDansLAxe2, + AI_Function.NetworkNextWPWithCapa, + AI_Function.NetworkAffectTypeOfConnectedWP, + AI_Function.NetworkAffectTypeOfConnectedWPWithCapa, + AI_Function.ReseauCheminLePlusCourt, + AI_Function.NetworkBuildOrderedPath, + AI_Function.NetworkBuildOrderedPathCircular, + AI_Function.NetworkAllocateGraphToMSWay, + AI_Function.NetworkAllocateGraphToMSWayCircular, + AI_Function.ReseauLitIndexCourant, + AI_Function.ReseauForceIndexCourant, + AI_Function.ReseauLitPremierIndex, + AI_Function.ReseauLitDernierIndex, + AI_Function.ReseauIncrementIndex, + AI_Function.ReseauDecrementIndex, + AI_Function.ReseauLitWPAIndex, + AI_Function.ReseauLitCapaciteLiaisonAIndex, + AI_Function.ReseauChangeCapaciteLiaisonAIndex, + AI_Function.ReseauLitPoidsLiaisonAIndex, + AI_Function.ReseauChangePoidsLiaisonAIndex, + AI_Function.NetworkGetIndexOfWPInMSWay, + AI_Function.NetworkForceWPToCurrent, + AI_Function.NetworkTestTheEnds, + AI_Function.ReseauLitCapaciteLiaisonDansGraph, + AI_Function.ReseauChangeCapaciteLiaisonDansGraph, + AI_Function.ReseauLitPoidsLiaisonDansGraph, + AI_Function.ReseauChangePoidsLiaisonDansGraph, + AI_Function.NetworkGetTypeOfWP, + AI_Function.GetRadiusWP, + AI_Function.GetCapabilities, + AI_Function.CapabilityAtBitNumber, + AI_Function.GetScrollSpeed, + AI_Function.GetNbFrame, + AI_Function.DotProduct, + AI_Function.CrossProduct, + AI_Function.Normalize, + AI_Function.GetSPOCoordinates, + AI_Function.GetTractionFactor, + AI_Function.GetCenterZDEType, + AI_Function.GetCenterZDMType, + AI_Function.GetCenterZDRType, + AI_Function.GetCenterZDDType, + AI_Function.TextAffiche, + AI_Function.MJTextAffiche, + AI_Function.GetCPUCounter, + AI_Function.TurnToPosition, + AI_Function.ActGetAlwaysGenerator, + + AI_Function.PAD2_GetGlobalVector, + AI_Function.PAD2_GetHorizontalAxis, + AI_Function.PAD2_GetVerticalAxis, + AI_Function.PAD2_GetAnalogForce, + AI_Function.PAD2_GetTrueAnalogForce, + AI_Function.PAD2_GetRotationAngle, + AI_Function.PAD2_GetPadSector, + AI_Function.PAD2_GetGlobalVector_2, // TODO: What are these? Previous? + AI_Function.PAD2_GetHorizontalAxis_2, + AI_Function.PAD2_GetVerticalAxis_2, + AI_Function.PAD2_GetAnalogForce_2, + AI_Function.PAD2_GetTrueAnalogForce_2, + AI_Function.PAD2_GetRotationAngle_2, + AI_Function.PAD2_GetPadSector_2, + + // DefFunc1 + AI_Function.VitesseHorizontaleDuPerso, + AI_Function.VitesseVerticaleDuPerso, + AI_Function.GetPersoZoomFactor, + AI_Function.GetPersoSighting, + AI_Function.GetPersoHorizon, + AI_Function.GetPersoBanking, + AI_Function.LitPositionZDM, + AI_Function.LitPositionZDE, + AI_Function.LitPositionZDD, + AI_Function.LitCentreZDM, + AI_Function.LitCentreZDE, + AI_Function.LitCentreZDD, + AI_Function.LitAxeZDM, + AI_Function.LitAxeZDE, + AI_Function.LitAxeZDD, + AI_Function.LitDimensionZDM, + AI_Function.LitDimensionZDE, + AI_Function.LitDimensionZDD, + AI_Function.VecteurPointAxe, + AI_Function.VecteurPointSegment, + AI_Function.VectorContribution, + AI_Function.VectorCombination, + AI_Function.TemporalVectorCombination, + AI_Function.ScaledVector, + AI_Function.GetVectorNorm, + AI_Function.RotateVector, + AI_Function.VectorAngle, + AI_Function.VectorCos, + AI_Function.VectorSin, + AI_Function.GetNormalCollideVector, + AI_Function.GetNormalCollideVector2, + AI_Function.GetCollidePoint, + AI_Function.GetCollidePoint2, + AI_Function.GetHandsCollidePoint, + AI_Function.GetCollideRate, + AI_Function.GetCollideRate2, + AI_Function.GetCollideMaterialType, + AI_Function.GetCollideMaterialType2, + AI_Function.GetCollisionPoint, + AI_Function.GetCollisionVector, + AI_Function.GetCollisionPerso, + AI_Function.GetCollisionPointMaterial, + AI_Function.GetLastTraversedMaterialType, + AI_Function.GetLastTraversedMaterial, + AI_Function.GetCurrentCollidedGMT, + + AI_Function.GetColliderType, + AI_Function.GetColliderActor, // Added + AI_Function.GetColliderVector, + AI_Function.GetColliderReal, + AI_Function.GetLastCollisionActor, + AI_Function.ComputeRebondVector, + AI_Function.GetModuleAbsolutePosition, + AI_Function.GetModuleRelativePosition, + AI_Function.GetModuleZoomFactor, + AI_Function.GetModuleSighting, + AI_Function.CastIntegerToChannel, + AI_Function.GetStringCharAt, + + AI_Function.GetMechanicGravityFactor, + AI_Function.GetMechanicSlide, + AI_Function.GetMechanicRebound, + AI_Function.GetMechanicSlopeLimit, + AI_Function.GetMechanicInertiaX, + AI_Function.GetMechanicInertiaY, + AI_Function.GetMechanicInertiaZ, + AI_Function.GetMechanicTiltIntensity, + AI_Function.GetMechanicTiltInertia, + AI_Function.GetMechanicTiltOrigin, + AI_Function.GetMechanicMaxSpeed, + AI_Function.GetMechanicStreamPriority, + AI_Function.GetMechanicStreamSpeed, + AI_Function.GetMechanicStreamFactor, + AI_Function.GetSlideFactorX, + AI_Function.GetSlideFactorY, + AI_Function.GetSlideFactorZ, + AI_Function.JumpImpulsion, + AI_Function.GetSpeedAnim, + AI_Function.HierGetFather, + AI_Function.GetActivationZDD, + AI_Function.GetActivationZDM, + AI_Function.GetActivationZDE, + AI_Function.GetActivationZDR, + AI_Function.GetCollisionFrequency, + AI_Function.GetBrainFrequency, + AI_Function.GetLightFrequency, + AI_Function.GetBooleanInArray, + AI_Function.GetNumberOfBooleanInArray, + AI_Function.GetButtonName, + AI_Function.Placeholder__R2PS2__AfterGetButtonName_DummyFunction, + AI_Function.GetDriversAvailable, + AI_Function.GetCurrentLanguageId, + AI_Function.GetNbLanguages, + AI_Function.GetLanguageText, + AI_Function.TextToInt, + AI_Function.GetMusicVolume, + AI_Function.GetSfxVolume, + AI_Function.GetVoicesVolume, + AI_Function.NbAvailableResolution, + AI_Function.CurrentResolution, + AI_Function.SaveResolution, + AI_Function.IsResolutionAvailable, + AI_Function.GetBrightness, + AI_Function.NameResolution, + AI_Function.GetTextureFiltering, + AI_Function.GetAntiAliasing, + AI_Function.GetSaturationDistance, + AI_Function.GetBackgroundDistance, + AI_Function.GetTooFarLimit, + AI_Function.GetTransparencyZoneMin, + AI_Function.GetTransparencyZoneMax, + AI_Function.GetCurrentFrame, // Or ComputeProtectKey but dummied + AI_Function.Xor, + AI_Function.And, + AI_Function.Or, + AI_Function.Not, + AI_Function.DivUnsigned, + AI_Function.MulUnsigned, + AI_Function.AddUnsigned, + AI_Function.SubUnsigned, + AI_Function.Placeholder__R2PS2__CheckPersoStdGamePlusC4_1__Float, + AI_Function.Placeholder__R2PS2__CheckPersoStdGamePlusC4_2__Float, + + // DefFunCa + AI_Function.Cam_GetShiftTarget, + AI_Function.Cam_GetShiftPos, + AI_Function.Cam_GetDistMin, + AI_Function.Cam_GetDistMax, + AI_Function.Cam_GetBoundDistMin, + AI_Function.Cam_GetBoundDistMax, + AI_Function.Cam_GetAngleAlpha, + AI_Function.Cam_GetAngleShiftAlpha, + AI_Function.Cam_GetAngleTheta, + AI_Function.Cam_GetAngleShiftTheta, + AI_Function.Cam_GetLinearSpeed, + AI_Function.Cam_GetLinearIncreaseSpeed, + AI_Function.Cam_GetLinearDecreaseSpeed, + AI_Function.Cam_GetAngularSpeed, + AI_Function.Cam_GetAngularIncreaseSpeed, + AI_Function.Cam_GetAngularDecreaseSpeed, + AI_Function.Cam_GetTargetSpeed, + AI_Function.Cam_GetTargetIncreaseSpeed, + AI_Function.Cam_GetTargetDecreaseSpeed, + AI_Function.Cam_GetFocal, + AI_Function.Cam_GetZMin, + AI_Function.Cam_GetZMax, + AI_Function.Cam_GetTargetedSuperObject, + AI_Function.Cam_GetTypeOfViewport, + AI_Function.Cam_GetCameraOfViewport, + AI_Function.Cam_GetMainCamera, + AI_Function.Cam_ComputeTargetWithTgtPerso, + AI_Function.Cam_GetCurrentTargetPosition, + AI_Function.Cam_GetSectorCameraType, + AI_Function.Cam_GetBestPos, + }; + } + #endregion + + #region Procedures + protected override void InitProcedures() { + Procedures = new AI_Procedure[] { + AI_Procedure.Placeholder__SetRevolutionStdGamePlusC, + AI_Procedure.SetHitPoints, + AI_Procedure.SetHitPointsInit, + AI_Procedure.SetHitPointsToInitValue, + AI_Procedure.SetHitPointsToMaxValue, + AI_Procedure.AddHitPoints, + AI_Procedure.SubHitPoints, + AI_Procedure.SetHitPointsMax, + AI_Procedure.SetHitPointsMaxToInitValue, + AI_Procedure.SetHitPointsMaxToMaxValue, + AI_Procedure.AddHitPointsMax, + AI_Procedure.SubHitPointsMax, + AI_Procedure.TransparentDisplay, + AI_Procedure.SetTransparency, + AI_Procedure.ACT_SetDrawFlag, + AI_Procedure.ModuleTransparentDisplay, + AI_Procedure.ModuleTransparentDisplay2, + AI_Procedure.SetModuleTransparency, + AI_Procedure.SetModuleTransparency2, + AI_Procedure.ListAffectPersoZDD, // merged with AI_Procedure.ListAffectModuleZDD, + AI_Procedure.ListAffectPersoZDE, // merged with AI_Procedure.ListAffectModuleZDE, + AI_Procedure.ListAffectPersoTypeZDE, // merged with AI_Procedure.ListAffectModuleTypeZDE, + AI_Procedure.ListAffectTypeZDEWithTypeZDE, + AI_Procedure.AddPersoInList, + AI_Procedure.AddPersoInListAt, + AI_Procedure.DeletePersoAtInList, + AI_Procedure.FindPersoAndDeleteInList, + AI_Procedure.ListSelect, + AI_Procedure.ListUnSelect, + AI_Procedure.ListSort, + AI_Procedure.ListSortByFamily, + AI_Procedure.ListSortByModel, + AI_Procedure.FillListWithAllPersoOfAFamily, + AI_Procedure.FillListWithAllPersoOfAModel, + AI_Procedure.DeleteFamilyInList, + AI_Procedure.DeleteModelInList, + AI_Procedure.ListUnion, + AI_Procedure.ListInter, + AI_Procedure.ListDiff, + AI_Procedure.ListAdd, + AI_Procedure.FogActivate, + AI_Procedure.SetFogColor, + AI_Procedure.SetFogNearFarInf, + AI_Procedure.SetFogBlend, + AI_Procedure.RestoreFog, + AI_Procedure.SaveFog, + // No magnet or footpath procs + AI_Procedure.SinEffect_SetFreq, + AI_Procedure.SinEffect_SetAmplitude, + AI_Procedure.SinEffect_SetState, + AI_Procedure.SinEffect_SetFreq3D, + AI_Procedure.SinEffect_SetRLIAmplitude, + AI_Procedure.SinEffect_SetRLIBase, + AI_Procedure.SPO_SetDrawFlag, + AI_Procedure.SPO_SetEngineDisplayModeFlag, + AI_Procedure.DeactivateBut, + AI_Procedure.ActivateBut, + AI_Procedure.None, + AI_Procedure.ChangeComport, + AI_Procedure.ChangeComportReflex, + AI_Procedure.ChangeMyComport, + AI_Procedure.ChangeMyComportReflex, + AI_Procedure.ChangeMyComportAndMyReflex, + AI_Procedure.ChangeAction, + AI_Procedure.ChangeActionForce, + AI_Procedure.ChangeActionRandom, + AI_Procedure.ChangeActionWithEvents, + AI_Procedure.Boucle, + AI_Procedure.FinBoucle, + AI_Procedure.Break, + AI_Procedure.PlayerIsDead, + AI_Procedure.ResetDynamicsWithCard, + AI_Procedure.BreakAI, + AI_Procedure.IgnoreTraceFlagForNextPicking, + AI_Procedure.SetMainActor, + AI_Procedure.ActivateObject, + AI_Procedure.DesactivateObject, + AI_Procedure.ChangeMap, + AI_Procedure.ChangeMapByIndex, + AI_Procedure.ChangeMapNoAutosave, + AI_Procedure.SetActionReturn, + AI_Procedure.FactorAnimationFrameRate, + AI_Procedure.SetCharacterPriority, + AI_Procedure.ForcePersoHandling, + AI_Procedure.PlayerIsDeadWithPlacement, + AI_Procedure.SwapLinkTableObjects, + AI_Procedure.ChangeCurrentObjectTable, + AI_Procedure.BuildObjectTableFromTableAndString, + + AI_Procedure.TakeModuleControl, + AI_Procedure.TakeManyModulesControl, + AI_Procedure.ReleaseModuleControl, + AI_Procedure.Placeholder__Revolution__SaveGame_1, + AI_Procedure.Placeholder__Revolution__SaveGame_2, + AI_Procedure.Placeholder__Revolution__SaveGame_3, + AI_Procedure.Placeholder__Revolution__SaveGame_4, + AI_Procedure.Placeholder__Revolution__SaveGame_5a, + AI_Procedure.Placeholder__Revolution__SaveGame_5b, + AI_Procedure.QuitGame, + AI_Procedure.ActivateChannel, + AI_Procedure.DeactivateChannel, + AI_Procedure.PersoLightOn, + AI_Procedure.PersoLightOff, + AI_Procedure.SetPersoLightColor, + AI_Procedure.SetPersoLightNearFar, + AI_Procedure.SetPersoLightLittleBigAlpha, + AI_Procedure.SetPersoLightGyrophare, + AI_Procedure.SetPersoLightPulse, + AI_Procedure.SetPersoLightParalleleType, + AI_Procedure.SetPersoLightSphericalType, + AI_Procedure.SetPersoLightHotSpotType, + AI_Procedure.SetPersoLightAmbientType, + + AI_Procedure.SendSoundRequest, + AI_Procedure.SendMusicRequest, + AI_Procedure.SendAmbianceRequest, + AI_Procedure.SendMenuSndRequest, + AI_Procedure.SendSoundRequestWithChannelId, + AI_Procedure.SendVoiceRequest, + AI_Procedure.SendVoiceRequestWithoutSpeaker, + AI_Procedure.SendVoiceRequestWithChannelId, + AI_Procedure.SND_StopSound, + AI_Procedure.SND_StopMusic, + AI_Procedure.SND_StopAmbiance, + AI_Procedure.SND_StopMenuSnd, + AI_Procedure.SND_StopSoundWithChannelId, + AI_Procedure.SND_StopVoice, + AI_Procedure.SND_StopVoiceWithoutSpeaker, + AI_Procedure.SND_StopVoiceWithChannelId, + AI_Procedure.DefaultDisplay, + + AI_Procedure.Turn, + AI_Procedure.Turn2, + AI_Procedure.DeltaTurnPerso, + AI_Procedure.TurnPerso, + AI_Procedure.KillPerso, + AI_Procedure.KillPersoAndClearVariable, + AI_Procedure.SetVisualGMTColor, + AI_Procedure.SetVisualGMTSpecularExponent, + AI_Procedure.SetVisualGMTSpecularCoef, + AI_Procedure.SetVisualGMTDiffuseCoef, + AI_Procedure.SetVisualGMTAmbientCoef, + AI_Procedure.SetVisualGMTAsChromed, + AI_Procedure.SetVisualGMTTextureScrollingCoef, + AI_Procedure.LockVisualGMT, + AI_Procedure.UnlockVisualGMT, + AI_Procedure.SetVisualGMTFrame, + AI_Procedure.OptionChangeDetailsValue, + AI_Procedure.OptionChangeMusicVolume, + AI_Procedure.OptionChangeSfxVolume, + AI_Procedure.OptionChangeVoiceVolume, + AI_Procedure.OptionChangeActionKey, + AI_Procedure.OptionConfigureKey, + AI_Procedure.SetPersoAbsolutePosition, + AI_Procedure.SetPersoAtModulePosition, + AI_Procedure.ForcePersoAveragePosition, + AI_Procedure.RelativeMovePerso, + AI_Procedure.ChangePersoAnySighting, + AI_Procedure.ChangePersoSightingWithOffset, + AI_Procedure.RotatePersoAroundX, + AI_Procedure.RotatePersoAroundY, + AI_Procedure.RotatePersoAroundZ, + AI_Procedure.RotatePersoAroundVector, + AI_Procedure.RotatePersoAroundVectorWithOffset, + AI_Procedure.RotatePersoAroundXwithOffset, + AI_Procedure.RotatePersoAroundYwithOffset, + AI_Procedure.RotatePersoAroundZwithOffset, + AI_Procedure.SetFullPersoOrientation, + AI_Procedure.SetFullPersoOrientationWithOffset, + AI_Procedure.ZoomPerso, + AI_Procedure.ChangeOneCustomBit, + AI_Procedure.ChangeManyCustomBits, + AI_Procedure.ChangeManyCustomBitsExtended, + AI_Procedure.ImposeSpeed, + AI_Procedure.ImposeSpeedX, + AI_Procedure.ImposeSpeedY, + AI_Procedure.ImposeSpeedZ, + AI_Procedure.ImposeSpeedXY, + AI_Procedure.ImposeSpeedXYZ, + AI_Procedure.ImposeAbsoluteSpeed, + AI_Procedure.ImposeAbsoluteSpeedX, + AI_Procedure.ImposeAbsoluteSpeedY, + AI_Procedure.ImposeAbsoluteSpeedZ, + AI_Procedure.ImposeAbsoluteSpeedXY, + AI_Procedure.ImposeAbsoluteSpeedXYZ, + AI_Procedure.ProposeSpeed, + AI_Procedure.ProposeSpeedX, + AI_Procedure.ProposeSpeedY, + AI_Procedure.ProposeSpeedZ, + AI_Procedure.ProposeSpeedXY, + AI_Procedure.ProposeSpeedXYZ, + AI_Procedure.ProposeAbsoluteSpeed, + AI_Procedure.ProposeAbsoluteSpeedX, + AI_Procedure.ProposeAbsoluteSpeedY, + AI_Procedure.ProposeAbsoluteSpeedZ, + AI_Procedure.ProposeAbsoluteSpeedXY, + AI_Procedure.ProposeAbsoluteSpeedXYZ, + AI_Procedure.FixePositionPerso, + AI_Procedure.AddSpeed, + AI_Procedure.AddSpeedX, + AI_Procedure.AddSpeedY, + AI_Procedure.AddSpeedZ, + AI_Procedure.AddSpeedXY, + AI_Procedure.AddSpeedXYZ, + AI_Procedure.AddAbsoluteSpeed, + AI_Procedure.AddAbsoluteSpeedX, + AI_Procedure.AddAbsoluteSpeedY, + AI_Procedure.AddAbsoluteSpeedZ, + AI_Procedure.AddAbsoluteSpeedXY, + AI_Procedure.AddAbsoluteSpeedXYZ, + // No morph procedures + AI_Procedure.ReleaseAllModulesControl, + AI_Procedure.ChangeModuleSighting, + AI_Procedure.SetModuleAbsolutePosition, + AI_Procedure.RelativeMoveModule, + AI_Procedure.ChangeModuleSightingWithOffset, + AI_Procedure.RotateModuleAroundX, + AI_Procedure.RotateModuleAroundY, + AI_Procedure.RotateModuleAroundZ, + AI_Procedure.RotateModuleAroundVector, + AI_Procedure.RotateModuleAroundVectorWithOffset, + AI_Procedure.RotateModuleAroundXwithOffset, + AI_Procedure.RotateModuleAroundYwithOffset, + AI_Procedure.RotateModuleAroundZwithOffset, + AI_Procedure.SetFullModuleOrientation, + AI_Procedure.SetFullModuleOrientationWithOffset, + AI_Procedure.ZoomModule, + AI_Procedure.SetColliderType, + AI_Procedure.SetColliderActor, + AI_Procedure.SetColliderVector, + AI_Procedure.SetColliderReal, + AI_Procedure.ResetLastCollisionActor, + AI_Procedure.ClearCollisionReport, + AI_Procedure.SetGoThroughMechanicsHandling, + AI_Procedure.EraseLastGoThroughMaterial, + AI_Procedure.StringAddChar, + AI_Procedure.StringReplaceChar, + AI_Procedure.StringRemoveChar, + AI_Procedure.ChangeLanguage, + AI_Procedure.ChangeVoiceLanguage, + AI_Procedure.IntToText, + AI_Procedure.SetMechanicAnimation, + AI_Procedure.SetMechanicCollide, + AI_Procedure.SetMechanicGravity, + AI_Procedure.SetMechanicTilt, + AI_Procedure.SetMechanicGi, + AI_Procedure.SetMechanicClimb, + AI_Procedure.SetMechanicOnGround, + AI_Procedure.SetMechanicSpider, + AI_Procedure.SetMechanicShoot, + AI_Procedure.SetMechanicSwim, + AI_Procedure.SetMechanicNeverFall, + AI_Procedure.SetMechanicNewMechanic, + AI_Procedure.SetMechanicCollisionControl, + AI_Procedure.SetMechanicKeepSpeedZ, + AI_Procedure.SetMechanicSpeedLimit, + AI_Procedure.SetMechanicInertia, + AI_Procedure.SetMechanicStream, + AI_Procedure.SetMechanicStickOnPlatform, + AI_Procedure.SetMechanicScale, + AI_Procedure.SetMechanicGravityFactor, + AI_Procedure.SetMechanicSlide, + AI_Procedure.SetMechanicRebound, + AI_Procedure.SetMechanicSlopeLimit, + AI_Procedure.SetMechanicInertiaX, + AI_Procedure.SetMechanicInertiaY, + AI_Procedure.SetMechanicInertiaZ, + AI_Procedure.SetMechanicInertiaXYZ, + AI_Procedure.SetMechanicTiltIntensity, + AI_Procedure.SetMechanicTiltInertia, + AI_Procedure.SetMechanicTiltOrigin, + AI_Procedure.SetMechanicSpeedMax, + AI_Procedure.SetMechanicStreamPriority, + AI_Procedure.SetMechanicStreamSpeed, + AI_Procedure.SetMechanicStreamFactor, + AI_Procedure.AddMechanicStreamSpeed, + AI_Procedure.AddMechanicStreamSpeedList, + AI_Procedure.MoveLimit, + AI_Procedure.MoveLimitX, + AI_Procedure.MoveLimitY, + AI_Procedure.MoveLimitZ, + AI_Procedure.MoveLimitXYZ, + AI_Procedure.StopMoveLimitX, + AI_Procedure.StopMoveLimitY, + AI_Procedure.StopMoveLimitZ, + AI_Procedure.StopMoveLimitXYZ, + AI_Procedure.SetPlatformLink, + AI_Procedure.FreePlatformLink, + AI_Procedure.MecSetScale, + AI_Procedure.MecSetSlideFactorXYZ, + AI_Procedure.MecSetSlideFactorX, + AI_Procedure.MecSetSlideFactorY, + AI_Procedure.MecSetSlideFactorZ, + AI_Procedure.MecSetClimbSpeedLimit, + AI_Procedure.MecSetHangingLimit, + AI_Procedure.MecSetHangingOff, + AI_Procedure.MecSetBaseCoeff, + AI_Procedure.MecSetWalkCoeff, + AI_Procedure.HierSetFather, + AI_Procedure.HierFreeFather, + AI_Procedure.HierListOfSon, + AI_Procedure.HierSetPlatformType, + AI_Procedure.HierControlLink, + AI_Procedure.HierFreezeEngine, + AI_Procedure.FixePositionZDM, + AI_Procedure.FixePositionZDD, + AI_Procedure.FixePositionZDE, + AI_Procedure.ChangeLightIntensity, + AI_Procedure.SPO_ChangeFlag, + AI_Procedure.ActChangeSpoFlag, + AI_Procedure.ChangeScreenSize, + AI_Procedure.ChangeScreenClip, + AI_Procedure.ChangeScreenPos, + AI_Procedure.ChangeScreenPosPercent, + AI_Procedure.ChangeScreenRatio, + AI_Procedure.Placeholder__Revolution__Shadow_1, + AI_Procedure.Placeholder__Revolution__Shadow_2_Does3And4, + AI_Procedure.Placeholder__Revolution__Shadow_3, + AI_Procedure.Placeholder__Revolution__Shadow_4, + AI_Procedure.Placeholder__Revolution__Shadow_5, + AI_Procedure.ForceActivationZDD, + AI_Procedure.ForceActivationZDM, + AI_Procedure.ForceActivationZDE, + AI_Procedure.ForceActivationZDR, + AI_Procedure.ForceDesactivationZDD, + AI_Procedure.ForceDesactivationZDM, + AI_Procedure.ForceDesactivationZDE, + AI_Procedure.ForceDesactivationZDR, + AI_Procedure.LibereActivationZDD, + AI_Procedure.LibereActivationZDM, + AI_Procedure.LibereActivationZDE, + AI_Procedure.LibereActivationZDR, + AI_Procedure.ActiveZDR, + AI_Procedure.SetNoCollisionWithMap, + AI_Procedure.SetNoCollisionWithProjectile, + AI_Procedure.SetNoCollisionWithSecondCharact, + AI_Procedure.SetNoCollisionWithMainCharact, + AI_Procedure.SetNoCollisionWithOtherSectors, + AI_Procedure.SetNoCollisionZdeWithProjectile, + AI_Procedure.SetCollComputeFrequency, + AI_Procedure.SetBrainComputeFrequency, + AI_Procedure.SetLightComputeFrequency, + AI_Procedure.SetUsedExitIdentifier, + AI_Procedure.GetUsedExitIdentifier, + AI_Procedure.SetGlobalCounter, + + AI_Procedure.ReadAnalogJoystick, + AI_Procedure.SetAnalogJoystickAxes, + AI_Procedure.CancelKeyboardInertia, + AI_Procedure.GetPadCalibration, + AI_Procedure.SetPadCalibration, + AI_Procedure.ReadAnalogJoystick2, + AI_Procedure.SetAnalogJoystickAxes2, + AI_Procedure.GetPadCalibration2, + AI_Procedure.SetPadCalibration2, + AI_Procedure.Placeholder__Revolution__PadRelated, + AI_Procedure.Placeholder__Revolution__SetAnalogJoystickAxes_1, + AI_Procedure.Placeholder__Revolution__SetAnalogJoystickAxes_2, + AI_Procedure.Placeholder__Revolution__AfterPad, + + AI_Procedure.SetBooleanInArray, + AI_Procedure.SetDefaultFormatCharacter, + AI_Procedure.SelectDriver, + AI_Procedure.SelectShapnessMax, + AI_Procedure.CenterScreen, + AI_Procedure.SelectResolution, + AI_Procedure.ChangeBrightness, + AI_Procedure.TexteEntier, + AI_Procedure.TexteReel, + AI_Procedure.SetTextureFiltering, + AI_Procedure.SetAntiAliasing, + AI_Procedure.SetInStereoMode, + AI_Procedure.SND_SetPrevMusicFadeOut, + AI_Procedure.SetSaturationBackGroundDistance, + AI_Procedure.SaveSoundEventInSlotMemory, + AI_Procedure.RestoreSoundEventInSlotMemory, + AI_Procedure.DrawSegment, + AI_Procedure.ShellExecute, + AI_Procedure.ChangeSightingAccordingTime, + AI_Procedure.Placeholder__Revolution__AfterChangeSightingAccordingTime, + + AI_Procedure.FixePointsDeMagie, + AI_Procedure.FixePointsDeMagieMax, + AI_Procedure.InitPointsDeMagie, + AI_Procedure.InitPointsDeMagieMax, + AI_Procedure.AjoutePointsDeMagie, + AI_Procedure.AjoutePointsDeMagieMax, + AI_Procedure.EnlevePointsDeMagie, + AI_Procedure.EnlevePointsDeMagieMax, + AI_Procedure.FixePointsDair, + AI_Procedure.FixePointsDairMax, + AI_Procedure.InitPointsDair, + AI_Procedure.InitPointsDairMax, + AI_Procedure.AjoutePointsDair, + AI_Procedure.AjoutePointsDairMax, + AI_Procedure.EnlevePointsDair, + AI_Procedure.EnlevePointsDairMax, + AI_Procedure.FixePositionFade, + AI_Procedure.FixeLumierePersoLocal, + AI_Procedure.FixeLumiereStaticOnOff, + AI_Procedure.FixeLumiereStaticNearFar, + AI_Procedure.FixeLumiereStaticColor, + AI_Procedure.CalculeLumiereEffet, + AI_Procedure.NoRLI, + AI_Procedure.FixeRLI, + AI_Procedure.BlendRLI, + AI_Procedure.ChangeTypeOfWP, + AI_Procedure.SetCapabilities, + AI_Procedure.AddCapabilities, + AI_Procedure.SubCapabilities, + AI_Procedure.ChangeCapabilities, + AI_Procedure.ReinitGraph, + AI_Procedure.FixeVitesseTexture, + AI_Procedure.ScrollingOnOff, + AI_Procedure.FixeDecalageTexture, + AI_Procedure.ScrollingPause, + AI_Procedure.ChangeCurrFrame, + AI_Procedure.ChangeRandomFrame, + AI_Procedure.FreezeAnim, + AI_Procedure.UnFreezeAnim, + AI_Procedure.SetSuperimposed, + AI_Procedure.SetSuperimposed2, + AI_Procedure.ReleaseSuperimposed, + AI_Procedure.SetSPOCoordinates, + AI_Procedure.SwitchSuperimposedTab, + AI_Procedure.SetTractionFactor, + AI_Procedure.TurnToPositionAngle, + AI_Procedure.TurnToPositionSpeed, + AI_Procedure.SortArray, + AI_Procedure.ActiveJoystickAnal, + AI_Procedure.UnActiveJoystickAnal, + AI_Procedure.SetZDMSizeSphere, + AI_Procedure.SetZDDSizeCone, + AI_Procedure.SetSoundVolumeAnim, + AI_Procedure.SetSoundVolumeMusic, + AI_Procedure.SetSoundVolumeAmbiance, + AI_Procedure.SetDopplerEffect, + AI_Procedure.PauseSound, + AI_Procedure.ResumeSound, + AI_Procedure.StopMenuSound, + + AI_Procedure.FormateTexte, + + + AI_Procedure.ChangePersoSighting, + AI_Procedure.PlayDemo, + AI_Procedure.InitKeyBoardDirections, + AI_Procedure.Placeholder__Revolution__DummyAfterKeyboardDirections_1, + AI_Procedure.Placeholder__Revolution__DummyAfterKeyboardDirections_2, + AI_Procedure.Placeholder__Revolution__DummyAfterKeyboardDirections_3, + AI_Procedure.Placeholder__Revolution__DummyAfterKeyboardDirections_4, + AI_Procedure.Placeholder__Revolution__DummyAfterKeyboardDirections_5, + AI_Procedure.Placeholder__Revolution__DummyAfterKeyboardDirections_6, + + AI_Procedure.ChangeTooFarLimit, + AI_Procedure.ChangeTransparencyZone, + AI_Procedure.SetBaseFrequenceForMenu, + AI_Procedure.SaveSinusContext, + AI_Procedure.RestoreSinusContext, + AI_Procedure.TextSuperImposed, + AI_Procedure.Placeholder__Revolution__AfterTextSuperimposed, + AI_Procedure.Placeholder__Revolution__DummyAfterTextSuperimposed_1, + AI_Procedure.Placeholder__Revolution__DummyAfterTextSuperimposed_2, + AI_Procedure.Placeholder__Revolution__DummyAfterTextSuperimposed_3, + AI_Procedure.Placeholder__Revolution__DummyAfterTextSuperimposed_4, + AI_Procedure.Placeholder__Revolution__DummyAfterTextSuperimposed_5, + AI_Procedure.Placeholder__Revolution__DummyAfterTextSuperimposed_6, + AI_Procedure.Placeholder__Revolution__DummyAfterTextSuperimposed_7, + AI_Procedure.Placeholder__Revolution__DummyAfterTextSuperimposed_8, + AI_Procedure.Placeholder__Revolution__FinalAfterTextSuperimposed, + + + AI_Procedure.Cam_UpdatePosition, + AI_Procedure.Cam_ChangeShiftTarget, + AI_Procedure.Cam_ChangeShiftPos, + AI_Procedure.Cam_ChangeDistMin, + AI_Procedure.Cam_ChangeDistMax, + AI_Procedure.Cam_ChangeBoundDistMin, + AI_Procedure.Cam_ChangeBoundDistMax, + AI_Procedure.Cam_ChangeAngleAlpha, + AI_Procedure.Cam_ChangeAngleShiftAlpha, + AI_Procedure.Cam_ChangeAngleTheta, + AI_Procedure.Cam_ChangeAngleShiftTheta, + AI_Procedure.Cam_ChangeLinearSpeed, + AI_Procedure.Cam_ChangeLinearIncreaseSpeed, + AI_Procedure.Cam_ChangeLinearDecreaseSpeed, + AI_Procedure.Cam_ChangeAngularSpeed, + AI_Procedure.Cam_ChangeAngularIncreaseSpeed, + AI_Procedure.Cam_ChangeAngularDecreaseSpeed, + AI_Procedure.Cam_ChangeTargetSpeed, + AI_Procedure.Cam_ChangeTargetIncreaseSpeed, + AI_Procedure.Cam_ChangeTargetDecreaseSpeed, + AI_Procedure.Cam_ChangeFocal, + AI_Procedure.Cam_ChangeZMin, + AI_Procedure.Cam_ChangeZMax, + AI_Procedure.Cam_ChangeTgtPerso, + AI_Procedure.Cam_ChangeSecondTgtPerso, + AI_Procedure.Cam_ChangeChannel, + AI_Procedure.Cam_Activate, + AI_Procedure.Cam_AssociateViewport, + AI_Procedure.Cam_ResetIAFlags, + AI_Procedure.Cam_SetFlagNoDynamicTarget, + AI_Procedure.Cam_SetFlagNoAverageMoveTgtPerso, + AI_Procedure.Cam_SetFlagNoParseCutAngle, + AI_Procedure.Cam_SetFlagNoVisibility, + AI_Procedure.Cam_SetFlagNoVisibilityWithDynHie, + AI_Procedure.Cam_SetFlagNoDynChangeTheta, + AI_Procedure.Cam_SetFlagNoShiftUntilPosReached, + AI_Procedure.Cam_SetFlagNoDynSpeed, + AI_Procedure.Cam_ResetDNMFlags, + AI_Procedure.Cam_SetFlagNoLinearParsing, + AI_Procedure.Cam_SetFlagNoLinearInertia, + AI_Procedure.Cam_SetFlagNoAngularParsing, + AI_Procedure.Cam_SetFlagNoAngularInertia, + AI_Procedure.Cam_SetFlagNoTargetParsing, + AI_Procedure.Cam_SetFlagNoTargetInertia, + AI_Procedure.Cam_SetFlagFixedOrientation, + AI_Procedure.Cam_SetFlagNoObstacle, + AI_Procedure.Cam_SetFlagNoCollisionWhenNotMoving, + AI_Procedure.Cam_ChangeConstants, + AI_Procedure.Cam_SaveConstants, + AI_Procedure.Cam_RestoreConstants, + AI_Procedure.Cam_ShowInfo, + AI_Procedure.Cam_ForceTarget, + AI_Procedure.Cam_ForcePosition, + AI_Procedure.Cam_ForceRefAxis, + AI_Procedure.Cam_Reset, + AI_Procedure.Cam_ForceBestPos, + AI_Procedure.Cam_ForceNormalState, + AI_Procedure.Cam_ForceMovingOnRail, + AI_Procedure.Cam_SetCameraModeForEngine, + AI_Procedure.LaunchAGO, + AI_Procedure.Placeholder__Revolution__AfterLaunchAGO_1, + AI_Procedure.Placeholder__Revolution__AfterLaunchAGO_2, + AI_Procedure.Placeholder__Revolution__AfterLaunchAGO_3, + AI_Procedure.Placeholder__Revolution__AfterLaunchAGO_4, + AI_Procedure.SetInGameMenu, + AI_Procedure.JffTxt_Affiche, + AI_Procedure.JffTxt_Extend, + AI_Procedure.JffTxt_Modify, + AI_Procedure.FadeIn, + AI_Procedure.FadeOut, + AI_Procedure.CheatDoubleSpeed, + AI_Procedure.CheatInvertPad, + AI_Procedure.CheatRandomPad, + AI_Procedure.CheatRandomVignette, + }; + } + #endregion + + } + +} diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/AI/Types/Rayman2/AI_Types_R2_PS2.cs.meta b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/AI/Types/Rayman2/AI_Types_R2_PS2.cs.meta new file mode 100644 index 00000000..23d31b2f --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/AI/Types/Rayman2/AI_Types_R2_PS2.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: dc31da8857d59a14298265fff08c5e43 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/AI/Types/Rayman2/AI_Types_R2_iOS.cs b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/AI/Types/Rayman2/AI_Types_R2_iOS.cs new file mode 100644 index 00000000..67cd6a9a --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/AI/Types/Rayman2/AI_Types_R2_iOS.cs @@ -0,0 +1,1237 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace BinarySerializer.Ubisoft.CPA { + public class AI_Types_R2_iOS : AI_Types_R2_PC { + // Re-checked + // InterpretTypes: same as PC + // MetaActions: same as PC + + #region DsgVar Types + protected override void InitVariableTypes() { + VariableTypes = new AI_DsgVarType[] { + AI_DsgVarType.Boolean, + AI_DsgVarType.SByte, + AI_DsgVarType.UByte, + AI_DsgVarType.Short, + AI_DsgVarType.UShort, + AI_DsgVarType.Int, + AI_DsgVarType.UInt, + AI_DsgVarType.Float, + AI_DsgVarType.WayPoint, + AI_DsgVarType.Perso, + AI_DsgVarType.List, + AI_DsgVarType.Vector, + AI_DsgVarType.Comport, + AI_DsgVarType.Action, + AI_DsgVarType.Text, + AI_DsgVarType.GameMaterial, + AI_DsgVarType.Caps, + AI_DsgVarType.Graph, + AI_DsgVarType.PersoArray, + AI_DsgVarType.VectorArray, + AI_DsgVarType.FloatArray, + AI_DsgVarType.IntegerArray, + AI_DsgVarType.WayPointArray, + AI_DsgVarType.TextArray, + AI_DsgVarType.Input + }; + } + #endregion + + #region Keywords + protected override void InitKeywords() { + Keywords = new AI_Keyword[] { + AI_Keyword.If, + AI_Keyword.IfNot, + AI_Keyword.If2, + AI_Keyword.If4, + AI_Keyword.If8, + AI_Keyword.If16, + AI_Keyword.IfDebug, + AI_Keyword.IfNotU64, + AI_Keyword.Then, + AI_Keyword.Else, + AI_Keyword.EngineGoto, + AI_Keyword.Me, + AI_Keyword.MainActor, + AI_Keyword.Nobody, + AI_Keyword.NoInput, + AI_Keyword.Nowhere, + AI_Keyword.EmptyText, + AI_Keyword.CapsNull, + AI_Keyword.NoGraph, + AI_Keyword.NoAction, + }; + } + #endregion + + #region Conditions + protected override void InitConditions() { + Conditions = new AI_Condition[] { + AI_Condition.Et, + AI_Condition.Ou, + AI_Condition.Not, + AI_Condition.XOr, + AI_Condition.Equal, + AI_Condition.Different, + AI_Condition.Lesser, + AI_Condition.Greater, + AI_Condition.LesserOrEqual, + AI_Condition.GreaterOrEqual, + AI_Condition.CollidePersoZDDNoWithPerso, + AI_Condition.CollideModuleZDDNoWithPerso, + AI_Condition.CollidePersoAllZDDWithPerso, + AI_Condition.CollidePersoZDDWithAnyPerso, + AI_Condition.CollideModuleZDDWithAnyPerso, + AI_Condition.CollidePersoZDENoWithPersoZDENo, + AI_Condition.CollideModuleZDENoWithPersoZDENo, + AI_Condition.CollidePersoZDENoWithModuleZDENo, + AI_Condition.CollideModuleZDENoWithModuleZDENo, + AI_Condition.CollidePersoZDENoWithPersoTypeZDE, + AI_Condition.CollideModuleZDENoWithPersoTypeZDE, + AI_Condition.CollidePersoTypeZDEWithPersoTypeZDE, + AI_Condition.CollidePersoAllZDEWithPersoAllZDE, + AI_Condition.CollidePersoTypeZDEWithPersoAllZDE, + AI_Condition.CollidePersoAllZDEWithPersoTypeZDE, + AI_Condition.CollidePersoZDENoWithTypeZDE, + AI_Condition.CollideModuleZDENoWithTypeZDE, + AI_Condition.CollideWithGround, + AI_Condition.CollideWithWall, + AI_Condition.CollideWithNothing, + AI_Condition.CollideWithCeiling, + AI_Condition.CollideWithPerso, + AI_Condition.CollideWithWater, + AI_Condition.CollideWithThisPerso, + AI_Condition.ZDMCollideWithGround, + AI_Condition.ZDMCollideWithWall, + AI_Condition.ZDMCollideWithNothing, + AI_Condition.ZDMCollideWithCeiling, + AI_Condition.IsPersoInList, + AI_Condition.IsModelInList, + AI_Condition.IsFamilyInList, + AI_Condition.ListEmptyTest, + AI_Condition.UserEvent_IsSet, + AI_Condition.UserEvent_IsSet2, + AI_Condition.PressedBut, + AI_Condition.JustPressedBut, + AI_Condition.ReleasedBut, + AI_Condition.JustReleasedBut, + AI_Condition.IsTimeElapsed, + AI_Condition.IsValidObject, + AI_Condition.IsValidWayPoint, + AI_Condition.IsValidGMT, + AI_Condition.IsValidAction, + AI_Condition.IsValidText, + AI_Condition.SeePerso, + AI_Condition.IsActivable, + AI_Condition.IsAlreadyHandled, + AI_Condition.Alw_IsMine, + AI_Condition.IsPersoLightOn, + AI_Condition.IsPersoLightPulseOn, + AI_Condition.IsPersoLightGyroPhareOn, + AI_Condition.IsZDMCollideWithObstacle, + AI_Condition.IsZDMCollideWithWall, + AI_Condition.IsZDMCollideWithGround, + AI_Condition.IsZDMCollideWithCeiling, + AI_Condition.CmtIdentifierContainsMask, + AI_Condition.HitByCollider, + AI_Condition.IsTypeOfGMTCollide, + AI_Condition.IsInComport, + AI_Condition.IsInReflexComport, + AI_Condition.IsInAction, + AI_Condition.ChangeActionEnable, + AI_Condition.EngineReinitRequested, + AI_Condition.IsThereMechEvent, + AI_Condition.CollisionWP, + AI_Condition.IsCustomBitSet, + AI_Condition.IsPersoActive, + AI_Condition.CheckActionEnd, + AI_Condition.IsCurrentStateCustomBitSet, + + AI_Condition.IsGiBlock, + AI_Condition.IsMechanicBlock, + AI_Condition.IsMechanicAnimation, + AI_Condition.IsMechanicCollide, + AI_Condition.IsMechanicGravity, + AI_Condition.IsMechanicTilt, + AI_Condition.IsMechanicGi, + AI_Condition.IsMechanicClimb, + AI_Condition.IsMechanicOnGround, + AI_Condition.IsMechanicSpider, + AI_Condition.IsMechanicShoot, + AI_Condition.IsMechanicSwim, + AI_Condition.IsMechanicNeverFall, + AI_Condition.IsMechanicCollisionControl, + AI_Condition.IsMechanicKeepSpeedZ, + AI_Condition.IsMechanicSpeedLimit, + AI_Condition.IsMechanicInertia, + AI_Condition.IsMechanicStream, + AI_Condition.IsMechanicStickOnPlatform, + AI_Condition.IsMechanicPatformCrash, + AI_Condition.IsMechanicScale, + AI_Condition.IsMechanicExec, + AI_Condition.CanFall, + AI_Condition.IsMechanicCrash, + + AI_Condition.IsNullVector, + AI_Condition.HierIsSonOfActor, + AI_Condition.IsMorphing, + AI_Condition.CheckAnimEnd, + AI_Condition.HasTheCapability, + AI_Condition.HasOneOfTheCapabilities, + AI_Condition.HasTheCapabilityNumber, + AI_Condition.PersoHasTheCapability, + AI_Condition.PersoHasOneOfTheCapabilities, + AI_Condition.PersoHasTheCapabilityNumber, + AI_Condition.MagnetIsActivated, + AI_Condition.NEstPasEnCollisionAvecMap, + AI_Condition.NEstPasEnCollisionAvecProjectile, + AI_Condition.NEstPasEnCollisionAvecSecondCharact, + AI_Condition.NEstPasEnCollisionAvecMainCharact, + AI_Condition.NEstPasEnCollisionAvecAutresSecteurs, + AI_Condition.IsInFamily, + AI_Condition.IsInModel, + + AI_Condition.AJoypadIsConnected, + AI_Condition.AKeyJustPressed, + AI_Condition.AButtonPadJustPressed, + AI_Condition.IsInDemoMode, + AI_Condition.IsInStereoMode, + AI_Condition.IsMusicPlaying, + AI_Condition.IsShapnessMax, + + // v Added for iOS + AI_Condition.IsInternetAvailable, + AI_Condition.IsRumblePakInPort1, + AI_Condition.IsRumblePakInPort2, + AI_Condition.IsRumblePakInPort1_Active, + AI_Condition.IsRumblePakInPort2_Active, + AI_Condition.IsStartButtonPressed, + AI_Condition.DC_IsNTSC, + AI_Condition.DC_OptionLoaded1, + AI_Condition.DC_OptionLoaded2, + AI_Condition.DC_Video1, + AI_Condition.DC_Video2, + // ^ Added for iOS + + AI_Condition.Cam_IsActive, + AI_Condition.Cam_IsViewportOwner, + AI_Condition.Cam_IsFlagNoDynamicTarget, + AI_Condition.Cam_IsFlagNoAverageMoveTgtPerso, + AI_Condition.Cam_IsFlagNoParseCutAngle, + AI_Condition.Cam_IsFlagNoVisibility, + AI_Condition.Cam_IsFlagNoVisibilityWithDynHie, + AI_Condition.Cam_IsFlagNoDynChangeTheta, + AI_Condition.Cam_IsFlagNoShiftUntilPosReached, + AI_Condition.Cam_IsFlagNoDynSpeed, + AI_Condition.Cam_IsFlagNoLinearParsing, + AI_Condition.Cam_IsFlagNoLinearInertia, + AI_Condition.Cam_IsFlagNoAngularParsing, + AI_Condition.Cam_IsFlagNoAngularInertia, + AI_Condition.Cam_IsFlagNoTargetParsing, + AI_Condition.Cam_IsFlagNoTargetInertia, + AI_Condition.Cam_IsFlagNoObstacle, + AI_Condition.Cam_IsFlagFixedOrientation, + AI_Condition.Cam_IsFlagForcedPosition, + AI_Condition.Cam_IsFlagForcedTarget, + AI_Condition.Cam_IsFlagForcedAxis, + }; + } + #endregion + + #region Operators + protected override void InitOperators() { + Operators = new AI_Operator[] { + AI_Operator.ScalarPlusScalar, + AI_Operator.ScalarMinusScalar, + AI_Operator.ScalarMulScalar, + AI_Operator.ScalarDivScalar, + AI_Operator.ScalarDivScalarAllowZero, // Added for iOS + AI_Operator.ScalarUnaryMinus, + AI_Operator.PlusAffect, + AI_Operator.MinusAffect, + AI_Operator.MulAffect, + AI_Operator.DivAffect, + AI_Operator.PlusPlusAffect, + AI_Operator.MinusMinusAffect, + AI_Operator.Affect, + AI_Operator.Dot, + AI_Operator.GetVectorX, + AI_Operator.GetVectorY, + AI_Operator.GetVectorZ, + AI_Operator.VectorPlusVector, + AI_Operator.VectorMinusVector, + AI_Operator.VectorMulScalar, + AI_Operator.VectorDivScalar, + AI_Operator.VectorUnaryMinus, + AI_Operator.SetVectorX, + AI_Operator.SetVectorY, + AI_Operator.SetVectorZ, + AI_Operator.Ultra, + AI_Operator.ModelCast, + AI_Operator.Array, + AI_Operator.AffectArray, + }; + } + #endregion + + #region Fields + protected override void InitFields() { + Fields = new AI_Field[] { + AI_Field.Position, + AI_Field.Orientation, + AI_Field.Speed, + AI_Field.NormSpeed, + AI_Field.AbsoluteAxisX, + AI_Field.AbsoluteAxisY, + AI_Field.AbsoluteAxisZ, + AI_Field.PrevComportIntell, + AI_Field.PrevComportReflex, + AI_Field.ShadowScaleX, + AI_Field.ShadowScaleY, + AI_Field.PadGlobalVector, + AI_Field.PadHorizontalAxis, + AI_Field.PadVerticalAxis, + AI_Field.PadAnalogForce, + AI_Field.PadTrueAnalogForce, + AI_Field.PadRotationAngle, + AI_Field.PadSector, + + // All fields under this are iOS exclusive + AI_Field.CameraOffsetX, + AI_Field.MenuIndex, + AI_Field.MenuItem_Index, + AI_Field.HoldItem_Index, + AI_Field.SoundEffectVolume, + AI_Field.MusicVolume, + AI_Field.bGotoIGM, + AI_Field.TempFunction, + AI_Field.bMotionSensor, + AI_Field.bCameraLook, + AI_Field.bHoldCamera, + AI_Field.CheatEnable + }; + } + #endregion + + #region Functions + protected override void InitFunctions() { + Functions = new AI_Function[] { + AI_Function.GetPersoAbsolutePosition, + AI_Function.GetMyAbsolutePosition, + AI_Function.GetAngleAroundZToPerso, + AI_Function.DistanceToPerso, + AI_Function.DistanceXToPerso, + AI_Function.DistanceYToPerso, + AI_Function.DistanceZToPerso, + AI_Function.DistanceXYToPerso, + AI_Function.DistanceXZToPerso, + AI_Function.DistanceYZToPerso, + AI_Function.DistanceToPersoCenter, + AI_Function.DistanceXToPersoCenter, + AI_Function.DistanceYToPersoCenter, + AI_Function.DistanceZToPersoCenter, + AI_Function.DistanceXYToPersoCenter, + AI_Function.DistanceXZToPersoCenter, + AI_Function.DistanceYZToPersoCenter, + AI_Function.DistanceToWP, + AI_Function.GetWPAbsolutePosition, + AI_Function.GetRadiusWP, // New for DC/iOS + AI_Function.Int, + AI_Function.RandomInt, + AI_Function.Real, + AI_Function.Sinus, + AI_Function.Cosinus, + AI_Function.Square, + AI_Function.SquareRoot, + AI_Function.RandomReal, + AI_Function.MinimumReal, + AI_Function.MaximumReal, + AI_Function.DegreeToRadian, + AI_Function.RadianToDegree, + AI_Function.AbsoluteValue, + AI_Function.LimitRealInRange, + AI_Function.Sign, + AI_Function.Cube, + AI_Function.Modulo, + AI_Function.TernInf, + AI_Function.TernSup, + AI_Function.TernEq, + AI_Function.TernInfEq, + AI_Function.TernSupEq, + AI_Function.TernOp, + AI_Function.TemporalRealCombination, + AI_Function.GetHitPoints, + AI_Function.AddAndGetHitPoints, + AI_Function.SubAndGetHitPoints, + AI_Function.GetHitPointsMax, + AI_Function.AddAndGetHitPointsMax, + AI_Function.SubAndGetHitPointsMax, + AI_Function.ListSize, + AI_Function.GivePersoInList, + AI_Function.AbsoluteVector, + AI_Function.RelativeVector, + AI_Function.VecteurLocalToGlobal, + AI_Function.VecteurGlobalToLocal, + AI_Function.GetMagnetStrength, + AI_Function.GetMagnetFar, + AI_Function.GetMagnetNear, + AI_Function.GetMagnetDuration, + AI_Function.SPO_GetDrawFlag, + AI_Function.GetTime, + AI_Function.GetElapsedTime, + AI_Function.GetDeltaT, + AI_Function.GetFrameLength, + AI_Function.InputAnalogicValue, + AI_Function.VitessePadAnalogique, + AI_Function.GenerateObject, + AI_Function.CountGeneratedObjects, + AI_Function.GetGlobalCounter, + AI_Function.GetSubMapId, + AI_Function.AddColor, + AI_Function.AddRed, + AI_Function.AddGreen, + AI_Function.AddBlue, + AI_Function.AddAlpha, + AI_Function.ColorRedGreenBlueAlpha, + AI_Function.ColorRedGreenBlue, + AI_Function.ColorRed, + AI_Function.ColorGreen, + AI_Function.ColorBlue, + AI_Function.ColorAlpha, + AI_Function.GetVisualGMTColor, + AI_Function.GetVisualGMTSpecularCoef, + AI_Function.GetVisualGMTSpecularExponent, + AI_Function.GetVisualGMTDiffuseCoef, + AI_Function.GetVisualGMTAmbientCoef, + AI_Function.GetVisualGMTTextureScrollingCoefU, + AI_Function.GetVisualGMTTextureScrollingCoefV, + AI_Function.GetVisualGMTFrame, + AI_Function.GetVisualGMTNumberOfFrames, + AI_Function.SaveGame, + AI_Function.LoadGame, + AI_Function.EraseGame, + AI_Function.NewGame, + AI_Function.GetCurrentSlot, + AI_Function.IsAValidSlotName, + // v New for DC/iOS + AI_Function.CheckVmsStatus, + AI_Function.SetActiveVms, + AI_Function.GetActiveVms, + AI_Function.SaveOptions, + AI_Function.LoadOptions, + // ^ New for DC/iOS + + // FuncRay2 + AI_Function.LitPointsDeMagie, + AI_Function.LitPointsDeMagieMax, + AI_Function.AjouteEtLitPointsDeMagie, + AI_Function.AjouteEtLitPointsDeMagieMax, + AI_Function.EnleveEtLitPointsDeMagie, + AI_Function.EnleveEtLitPointsDeMagieMax, + AI_Function.LitPointsDair, + AI_Function.LitPointsDairMax, + AI_Function.AjouteEtLitPointsDair, + AI_Function.AjouteEtLitPointsDairMax, + AI_Function.EnleveEtLitPointsDair, + AI_Function.EnleveEtLitPointsDairMax, + AI_Function.PersoLePlusProche, + AI_Function.PersoLePlusProcheDansSecteurCourant, + AI_Function.NearerActorInFieldOfVision, + AI_Function.GetNbActivePerso, + AI_Function.CibleLaPlusProche, + AI_Function.CibleLaPlusProcheAvecAngles, + AI_Function.ReseauWPLePlusProche, + AI_Function.NetworkCloserWPOfType, + AI_Function.ReseauWPLePlusDansLAxe, + AI_Function.ReseauWPLePlusDansLAxe2, + AI_Function.NetworkNextWPWithCapa, + AI_Function.NetworkAffectTypeOfConnectedWP, + AI_Function.NetworkAffectTypeOfConnectedWPWithCapa, + AI_Function.ReseauCheminLePlusCourt, + AI_Function.NetworkBuildOrderedPath, + AI_Function.NetworkBuildOrderedPathCircular, + AI_Function.NetworkAllocateGraphToMSWay, + AI_Function.NetworkAllocateGraphToMSWayCircular, + AI_Function.ReseauLitIndexCourant, + AI_Function.ReseauForceIndexCourant, + AI_Function.ReseauLitPremierIndex, + AI_Function.ReseauLitDernierIndex, + AI_Function.ReseauIncrementIndex, + AI_Function.ReseauDecrementIndex, + AI_Function.ReseauLitWPAIndex, + AI_Function.ReseauLitCapaciteLiaisonAIndex, + AI_Function.ReseauChangeCapaciteLiaisonAIndex, + AI_Function.ReseauLitPoidsLiaisonAIndex, + AI_Function.ReseauChangePoidsLiaisonAIndex, + AI_Function.NetworkGetIndexOfWPInMSWay, + AI_Function.NetworkForceWPToCurrent, + AI_Function.NetworkTestTheEnds, + AI_Function.ReseauLitCapaciteLiaisonDansGraph, + AI_Function.ReseauChangeCapaciteLiaisonDansGraph, + AI_Function.ReseauLitPoidsLiaisonDansGraph, + AI_Function.ReseauChangePoidsLiaisonDansGraph, + AI_Function.NetworkGetTypeOfWP, + AI_Function.GetCapabilities, + AI_Function.CapabilityAtBitNumber, + AI_Function.GetScrollSpeed, + AI_Function.GetNbFrame, + AI_Function.DotProduct, + AI_Function.CrossProduct, + AI_Function.Normalize, + AI_Function.GetSPOCoordinates, + AI_Function.GetTractionFactor, + AI_Function.GetCenterZDEType, + AI_Function.GetCenterZDMType, + AI_Function.GetCenterZDRType, + AI_Function.GetCenterZDDType, + AI_Function.TextAffiche, + AI_Function.GetCPUCounter, + + // DefFunc1 + AI_Function.VitesseHorizontaleDuPerso, + AI_Function.VitesseVerticaleDuPerso, + AI_Function.GetPersoZoomFactor, + AI_Function.GetPersoSighting, + AI_Function.GetPersoHorizon, + AI_Function.GetPersoBanking, + AI_Function.LitPositionZDM, + AI_Function.LitPositionZDE, + AI_Function.LitPositionZDD, + AI_Function.LitCentreZDM, + AI_Function.LitCentreZDE, + AI_Function.LitCentreZDD, + AI_Function.LitAxeZDM, + AI_Function.LitAxeZDE, + AI_Function.LitAxeZDD, + AI_Function.LitDimensionZDM, + AI_Function.LitDimensionZDE, + AI_Function.LitDimensionZDD, + AI_Function.VecteurPointAxe, + AI_Function.VecteurPointSegment, + AI_Function.VectorContribution, + AI_Function.VectorCombination, + AI_Function.TemporalVectorCombination, + AI_Function.ScaledVector, + AI_Function.GetVectorNorm, + AI_Function.RotateVector, + AI_Function.VectorAngle, + AI_Function.VectorCos, + AI_Function.VectorSin, + AI_Function.GetNormalCollideVector, + AI_Function.GetNormalCollideVector2, + AI_Function.GetCollidePoint, + AI_Function.GetCollidePoint2, + AI_Function.GetHandsCollidePoint, + AI_Function.GetCollideRate, + AI_Function.GetCollideRate2, + AI_Function.GetCollideMaterialType, + AI_Function.GetCollideMaterialType2, + AI_Function.GetCollisionPoint, + AI_Function.GetCollisionVector, + AI_Function.GetCollisionPerso, + AI_Function.GetCollisionPointMaterial, + AI_Function.GetLastTraversedMaterialType, + AI_Function.GetLastTraversedMaterial, + AI_Function.GetCurrentCollidedGMT, + AI_Function.GetColliderType, + AI_Function.GetColliderVector, + AI_Function.GetColliderReal, + AI_Function.GetLastCollisionActor, + AI_Function.ComputeRebondVector, + AI_Function.GetModuleAbsolutePosition, + AI_Function.GetModuleRelativePosition, + AI_Function.GetModuleZoomFactor, + AI_Function.GetModuleSighting, + AI_Function.CastIntegerToChannel, + AI_Function.GetSlotDate, + AI_Function.GetSlotName, + AI_Function.GetSlotScore, + AI_Function.GetStringCharAt, + AI_Function.GetFormattedTextInfo, + AI_Function.GetInputEntryName, + AI_Function.GetMechanicGravityFactor, + AI_Function.GetMechanicSlide, + AI_Function.GetMechanicRebound, + AI_Function.GetMechanicSlopeLimit, + AI_Function.GetMechanicInertiaX, + AI_Function.GetMechanicInertiaY, + AI_Function.GetMechanicInertiaZ, + AI_Function.GetMechanicTiltIntensity, + AI_Function.GetMechanicTiltInertia, + AI_Function.GetMechanicTiltOrigin, + AI_Function.GetMechanicMaxSpeed, + AI_Function.GetMechanicStreamPriority, + AI_Function.GetMechanicStreamSpeed, + AI_Function.GetMechanicStreamFactor, + AI_Function.GetSlideFactorX, + AI_Function.GetSlideFactorY, + AI_Function.GetSlideFactorZ, + AI_Function.JumpImpulsion, + AI_Function.GetSpeedAnim, + AI_Function.HierGetFather, + AI_Function.GetActivationZDD, + AI_Function.GetActivationZDM, + AI_Function.GetActivationZDE, + AI_Function.GetActivationZDR, + AI_Function.GetCollisionFrequency, + AI_Function.GetBrainFrequency, + AI_Function.GetLightFrequency, + AI_Function.GetBooleanInArray, + AI_Function.GetNumberOfBooleanInArray, + AI_Function.GetButtonName, + AI_Function.GetDriversAvailable, + AI_Function.GetCurrentLanguageId, + AI_Function.GetNbLanguages, + AI_Function.GetLanguageText, + AI_Function.TextToInt, + AI_Function.GetMusicVolume, + AI_Function.GetSfxVolume, + AI_Function.SlotIsValid, + AI_Function.NbAvailableResolution, + AI_Function.CurrentResolution, + AI_Function.SaveResolution, + AI_Function.IsResolutionAvailable, + AI_Function.GetBrightness, + AI_Function.NameResolution, + AI_Function.GetNbSlotsAvailable, + AI_Function.GetTextureFiltering, + AI_Function.GetAntiAliasing, + AI_Function.GetSaturationDistance, + AI_Function.GetBackgroundDistance, + AI_Function.GetTooFarLimit, + AI_Function.GetTransparencyZoneMin, + AI_Function.GetTransparencyZoneMax, + AI_Function.ExecuteVariable, + AI_Function.ComputeProtectKey, + AI_Function.Xor, + AI_Function.And, + AI_Function.Or, + AI_Function.Not, + AI_Function.DivUnsigned, + AI_Function.MulUnsigned, + AI_Function.AddUnsigned, + AI_Function.SubUnsigned, + AI_Function.GetMemoryValue, + // v New for DC/iOS + AI_Function.GetHighScoreDisc, + AI_Function.DC_MagicBox, + // ^ New for DC/iOS + + // DefFunCa + AI_Function.Cam_GetShiftTarget, + AI_Function.Cam_GetShiftPos, + AI_Function.Cam_GetDistMin, + AI_Function.Cam_GetDistMax, + AI_Function.Cam_GetBoundDistMin, + AI_Function.Cam_GetBoundDistMax, + AI_Function.Cam_GetAngleAlpha, + AI_Function.Cam_GetAngleShiftAlpha, + AI_Function.Cam_GetAngleTheta, + AI_Function.Cam_GetAngleShiftTheta, + AI_Function.Cam_GetLinearSpeed, + AI_Function.Cam_GetLinearIncreaseSpeed, + AI_Function.Cam_GetLinearDecreaseSpeed, + AI_Function.Cam_GetAngularSpeed, + AI_Function.Cam_GetAngularIncreaseSpeed, + AI_Function.Cam_GetAngularDecreaseSpeed, + AI_Function.Cam_GetTargetSpeed, + AI_Function.Cam_GetTargetIncreaseSpeed, + AI_Function.Cam_GetTargetDecreaseSpeed, + AI_Function.Cam_GetFocal, + AI_Function.Cam_GetZMin, + AI_Function.Cam_GetZMax, + AI_Function.Cam_GetTargetedSuperObject, + AI_Function.Cam_GetTypeOfViewport, + AI_Function.Cam_GetCameraOfViewport, + AI_Function.Cam_GetMainCamera, + AI_Function.Cam_ComputeTargetWithTgtPerso, + AI_Function.Cam_GetCurrentTargetPosition, + AI_Function.Cam_GetSectorCameraType, + AI_Function.Cam_GetBestPos, + }; + } + #endregion + + #region Procedures + protected override void InitProcedures() { + Procedures = new AI_Procedure[] { + AI_Procedure.SetHitPoints, + AI_Procedure.SetHitPointsInit, + AI_Procedure.SetHitPointsToInitValue, + AI_Procedure.SetHitPointsToMaxValue, + AI_Procedure.AddHitPoints, + AI_Procedure.SubHitPoints, + AI_Procedure.SetHitPointsMax, + AI_Procedure.SetHitPointsMaxToInitValue, + AI_Procedure.SetHitPointsMaxToMaxValue, + AI_Procedure.AddHitPointsMax, + AI_Procedure.SubHitPointsMax, + AI_Procedure.TransparentDisplay, + AI_Procedure.SetTransparency, + AI_Procedure.ACT_SetDrawFlag, + AI_Procedure.ModuleTransparentDisplay, + AI_Procedure.ModuleTransparentDisplay2, + AI_Procedure.SetModuleTransparency, + AI_Procedure.SetModuleTransparency2, + AI_Procedure.ListAffectPersoZDD, + AI_Procedure.ListAffectModuleZDD, + AI_Procedure.ListAffectPersoZDE, + AI_Procedure.ListAffectModuleZDE, + AI_Procedure.ListAffectPersoTypeZDE, + AI_Procedure.ListAffectModuleTypeZDE, + AI_Procedure.ListAffectTypeZDEWithTypeZDE, + AI_Procedure.AddPersoInList, + AI_Procedure.AddPersoInListAt, + AI_Procedure.DeletePersoAtInList, + AI_Procedure.FindPersoAndDeleteInList, + AI_Procedure.ListSelect, + AI_Procedure.ListUnSelect, + AI_Procedure.ListSort, + AI_Procedure.ListSortByFamily, + AI_Procedure.ListSortByModel, + AI_Procedure.FillListWithAllPersoOfAFamily, + AI_Procedure.FillListWithAllPersoOfAModel, + AI_Procedure.DeleteFamilyInList, + AI_Procedure.DeleteModelInList, + AI_Procedure.ListUnion, + AI_Procedure.ListInter, + AI_Procedure.ListDiff, + AI_Procedure.ListAdd, + AI_Procedure.FogActivate, + AI_Procedure.SetFogColor, + AI_Procedure.SetFogNearFarInf, + AI_Procedure.SetFogBlend, + AI_Procedure.RestoreFog, + AI_Procedure.SaveFog, + AI_Procedure.Magnet_ActiveMagnet, + AI_Procedure.Magnet_DeactiveMagnet, + AI_Procedure.Magnet_SetStrength, + AI_Procedure.Magnet_SetFar, + AI_Procedure.Magnet_SetNear, + AI_Procedure.Magnet_SetDuration, + AI_Procedure.FootPath_AddFootPrint, + AI_Procedure.FootPath_Clear, + AI_Procedure.SinEffect_SetFreq, + AI_Procedure.SinEffect_SetAmplitude, + AI_Procedure.SinEffect_SetState, + AI_Procedure.SinEffect_SetFreq3D, + AI_Procedure.SinEffect_SetRLIAmplitude, + AI_Procedure.SinEffect_SetRLIBase, + AI_Procedure.SPO_SetDrawFlag, + AI_Procedure.SPO_SetEngineDisplayModeFlag, + AI_Procedure.DeactivateBut, + AI_Procedure.ActivateBut, + AI_Procedure.None, + AI_Procedure.ChangeComport, + AI_Procedure.ChangeComportReflex, + AI_Procedure.ChangeMyComport, + AI_Procedure.ChangeMyComportReflex, + AI_Procedure.ChangeMyComportAndMyReflex, + AI_Procedure.ChangeAction, + AI_Procedure.ChangeActionForce, + AI_Procedure.ChangeActionRandom, + AI_Procedure.ChangeActionWithEvents, + AI_Procedure.Boucle, + AI_Procedure.FinBoucle, + AI_Procedure.Break, + AI_Procedure.PlayerIsDead, + AI_Procedure.ResetDynamicsWithCard, + AI_Procedure.BreakAI, + AI_Procedure.IgnoreTraceFlagForNextPicking, + AI_Procedure.SetMainActor, + AI_Procedure.ActivateObject, + AI_Procedure.DesactivateObject, + AI_Procedure.ChangeMap, + AI_Procedure.ChangeMapNoAutosave, + AI_Procedure.SetActionReturn, + AI_Procedure.FactorAnimationFrameRate, + AI_Procedure.SetCharacterPriority, + AI_Procedure.ForcePersoHandling, + AI_Procedure.PlayerIsDeadWithPlacement, + AI_Procedure.SwapLinkTableObjects, + AI_Procedure.ChangeCurrentObjectTable, + AI_Procedure.BuildObjectTableFromTableAndString, + AI_Procedure.BuildObjectTableFromFormattedString, + AI_Procedure.TakeModuleControl, + AI_Procedure.TakeManyModulesControl, + AI_Procedure.ReleaseModuleControl, + AI_Procedure.CopyGame, + AI_Procedure.QuitGame, + AI_Procedure.ActivateChannel, + AI_Procedure.DeactivateChannel, + AI_Procedure.PersoLightOn, + AI_Procedure.PersoLightOff, + AI_Procedure.SetPersoLightColor, + AI_Procedure.SetPersoLightNearFar, + AI_Procedure.SetPersoLightLittleBigAlpha, + AI_Procedure.SetPersoLightGyrophare, + AI_Procedure.SetPersoLightPulse, + AI_Procedure.SetPersoLightParalleleType, + AI_Procedure.SetPersoLightSphericalType, + AI_Procedure.SetPersoLightHotSpotType, + AI_Procedure.SetPersoLightAmbientType, + AI_Procedure.SendSoundRequest, + AI_Procedure.SendVoiceRequest, + AI_Procedure.SendMusicRequest, + AI_Procedure.SendAmbianceRequest, + AI_Procedure.SendMenuSndRequest, + AI_Procedure.DefaultDisplay, + AI_Procedure.DisplayVignette, + AI_Procedure.DeleteVignette, + AI_Procedure.PRT_SetGeneratorOn, + AI_Procedure.PRT_SetGeneratorOff, + AI_Procedure.PRT_SetGenerator, + AI_Procedure.PRT_SetModeNone, + AI_Procedure.PRT_SetModeContinuous, + AI_Procedure.PRT_SetModeCrenel, + AI_Procedure.PRT_SetModeProbability, + AI_Procedure.PRT_SetNumberConstant, + AI_Procedure.PRT_SetNumberProbabilist, + AI_Procedure.PRT_SetInfiniteLifeTime, + AI_Procedure.PRT_SetConstantLifeTime, + AI_Procedure.PRT_SetPobabilistLifeTime, + AI_Procedure.Turn, + AI_Procedure.Turn2, + AI_Procedure.DeltaTurnPerso, + AI_Procedure.TurnPerso, + AI_Procedure.KillPerso, + AI_Procedure.KillPersoAndClearVariable, + AI_Procedure.SetVisualGMTColor, + AI_Procedure.SetVisualGMTSpecularExponent, + AI_Procedure.SetVisualGMTSpecularCoef, + AI_Procedure.SetVisualGMTDiffuseCoef, + AI_Procedure.SetVisualGMTAmbientCoef, + AI_Procedure.SetVisualGMTAsChromed, + AI_Procedure.SetVisualGMTTextureScrollingCoef, + AI_Procedure.LockVisualGMT, + AI_Procedure.UnlockVisualGMT, + AI_Procedure.SetVisualGMTFrame, + AI_Procedure.OptionChangeDetailsValue, + AI_Procedure.OptionChangeMusicVolume, + AI_Procedure.OptionChangeSfxVolume, + AI_Procedure.OptionChangeVoiceVolume, + AI_Procedure.OptionChangeActionKey, + AI_Procedure.OptionConfigureKey, + AI_Procedure.SetPersoAbsolutePosition, + AI_Procedure.SetPersoAtModulePosition, + AI_Procedure.ForcePersoAveragePosition, + AI_Procedure.RelativeMovePerso, + AI_Procedure.ChangePersoAnySighting, + AI_Procedure.ChangePersoSightingWithOffset, + AI_Procedure.RotatePersoAroundX, + AI_Procedure.RotatePersoAroundY, + AI_Procedure.RotatePersoAroundZ, + AI_Procedure.RotatePersoAroundVector, + AI_Procedure.RotatePersoAroundVectorWithOffset, + AI_Procedure.RotatePersoAroundXwithOffset, + AI_Procedure.RotatePersoAroundYwithOffset, + AI_Procedure.RotatePersoAroundZwithOffset, + AI_Procedure.SetFullPersoOrientation, + AI_Procedure.SetFullPersoOrientationWithOffset, + AI_Procedure.ZoomPerso, + AI_Procedure.ChangeOneCustomBit, + AI_Procedure.ChangeManyCustomBits, + AI_Procedure.ImposeSpeed, + AI_Procedure.ImposeSpeedX, + AI_Procedure.ImposeSpeedY, + AI_Procedure.ImposeSpeedZ, + AI_Procedure.ImposeSpeedXY, + AI_Procedure.ImposeSpeedXYZ, + AI_Procedure.ImposeAbsoluteSpeed, + AI_Procedure.ImposeAbsoluteSpeedX, + AI_Procedure.ImposeAbsoluteSpeedY, + AI_Procedure.ImposeAbsoluteSpeedZ, + AI_Procedure.ImposeAbsoluteSpeedXY, + AI_Procedure.ImposeAbsoluteSpeedXYZ, + AI_Procedure.ProposeSpeed, + AI_Procedure.ProposeSpeedX, + AI_Procedure.ProposeSpeedY, + AI_Procedure.ProposeSpeedZ, + AI_Procedure.ProposeSpeedXY, + AI_Procedure.ProposeSpeedXYZ, + AI_Procedure.ProposeAbsoluteSpeed, + AI_Procedure.ProposeAbsoluteSpeedX, + AI_Procedure.ProposeAbsoluteSpeedY, + AI_Procedure.ProposeAbsoluteSpeedZ, + AI_Procedure.ProposeAbsoluteSpeedXY, + AI_Procedure.ProposeAbsoluteSpeedXYZ, + AI_Procedure.FixePositionPerso, + AI_Procedure.AddSpeed, + AI_Procedure.AddSpeedX, + AI_Procedure.AddSpeedY, + AI_Procedure.AddSpeedZ, + AI_Procedure.AddSpeedXY, + AI_Procedure.AddSpeedXYZ, + AI_Procedure.AddAbsoluteSpeed, + AI_Procedure.AddAbsoluteSpeedX, + AI_Procedure.AddAbsoluteSpeedY, + AI_Procedure.AddAbsoluteSpeedZ, + AI_Procedure.AddAbsoluteSpeedXY, + AI_Procedure.AddAbsoluteSpeedXYZ, + AI_Procedure.PrepareMorph, + AI_Procedure.StopMorph, + AI_Procedure.Morphing, + AI_Procedure.ReleaseAllModulesControl, + AI_Procedure.ChangeModuleSighting, + AI_Procedure.SetModuleAbsolutePosition, + AI_Procedure.RelativeMoveModule, + AI_Procedure.ChangeModuleSightingWithOffset, + AI_Procedure.RotateModuleAroundX, + AI_Procedure.RotateModuleAroundY, + AI_Procedure.RotateModuleAroundZ, + AI_Procedure.RotateModuleAroundVector, + AI_Procedure.RotateModuleAroundVectorWithOffset, + AI_Procedure.RotateModuleAroundXwithOffset, + AI_Procedure.RotateModuleAroundYwithOffset, + AI_Procedure.RotateModuleAroundZwithOffset, + AI_Procedure.SetFullModuleOrientation, + AI_Procedure.SetFullModuleOrientationWithOffset, + AI_Procedure.ZoomModule, + AI_Procedure.SetColliderType, + AI_Procedure.SetColliderVector, + AI_Procedure.SetColliderReal, + AI_Procedure.ResetLastCollisionActor, + AI_Procedure.ClearCollisionReport, + AI_Procedure.SetGoThroughMechanicsHandling, + AI_Procedure.EraseLastGoThroughMaterial, + AI_Procedure.StringAddChar, + AI_Procedure.StringReplaceChar, + AI_Procedure.StringRemoveChar, + AI_Procedure.ChangeLanguage, + + // v iOS only + AI_Procedure.iOS__Placeholder__StringProc_SaveOptions, + AI_Procedure.iOS__Placeholder__StringProc_LinkTwitter, + AI_Procedure.iOS__Placeholder__StringProc_StatusBarOrientation, + AI_Procedure.iOS__Placeholder__StringProc_SoundRelated, + // ^ iOS only + + AI_Procedure.IntToText, + AI_Procedure.SetMechanicAnimation, + AI_Procedure.SetMechanicCollide, + AI_Procedure.SetMechanicGravity, + AI_Procedure.SetMechanicTilt, + AI_Procedure.SetMechanicGi, + AI_Procedure.SetMechanicClimb, + AI_Procedure.SetMechanicOnGround, + AI_Procedure.SetMechanicSpider, + AI_Procedure.SetMechanicShoot, + AI_Procedure.SetMechanicSwim, + AI_Procedure.SetMechanicNeverFall, + AI_Procedure.SetMechanicNewMechanic, + AI_Procedure.SetMechanicCollisionControl, + AI_Procedure.SetMechanicKeepSpeedZ, + AI_Procedure.SetMechanicSpeedLimit, + AI_Procedure.SetMechanicInertia, + AI_Procedure.SetMechanicStream, + AI_Procedure.SetMechanicStickOnPlatform, + AI_Procedure.SetMechanicScale, + AI_Procedure.SetMechanicGravityFactor, + AI_Procedure.SetMechanicSlide, + AI_Procedure.SetMechanicRebound, + AI_Procedure.SetMechanicSlopeLimit, + AI_Procedure.SetMechanicInertiaX, + AI_Procedure.SetMechanicInertiaY, + AI_Procedure.SetMechanicInertiaZ, + AI_Procedure.SetMechanicInertiaXYZ, + AI_Procedure.SetMechanicTiltIntensity, + AI_Procedure.SetMechanicTiltInertia, + AI_Procedure.SetMechanicTiltOrigin, + AI_Procedure.SetMechanicSpeedMax, + AI_Procedure.SetMechanicStreamPriority, + AI_Procedure.SetMechanicStreamSpeed, + AI_Procedure.SetMechanicStreamFactor, + AI_Procedure.AddMechanicStreamSpeed, + AI_Procedure.AddMechanicStreamSpeedList, + AI_Procedure.MoveLimit, + AI_Procedure.MoveLimitX, + AI_Procedure.MoveLimitY, + AI_Procedure.MoveLimitZ, + AI_Procedure.MoveLimitXYZ, + AI_Procedure.StopMoveLimitX, + AI_Procedure.StopMoveLimitY, + AI_Procedure.StopMoveLimitZ, + AI_Procedure.StopMoveLimitXYZ, + AI_Procedure.SetPlatformLink, + AI_Procedure.FreePlatformLink, + AI_Procedure.MecSetScale, + AI_Procedure.MecSetSlideFactorXYZ, + AI_Procedure.MecSetSlideFactorX, + AI_Procedure.MecSetSlideFactorY, + AI_Procedure.MecSetSlideFactorZ, + AI_Procedure.MecSetClimbSpeedLimit, + AI_Procedure.MecSetHangingLimit, + AI_Procedure.MecSetHangingOff, + AI_Procedure.MecSetBaseCoeff, + AI_Procedure.MecSetWalkCoeff, + AI_Procedure.HierSetFather, + AI_Procedure.HierFreeFather, + AI_Procedure.HierListOfSon, + AI_Procedure.HierSetPlatformType, + AI_Procedure.HierControlLink, + AI_Procedure.HierFreezeEngine, + AI_Procedure.FixePositionZDM, + AI_Procedure.FixePositionZDD, + AI_Procedure.FixePositionZDE, + AI_Procedure.ChangeLightIntensity, + AI_Procedure.SPO_ChangeFlag, + AI_Procedure.ActChangeSpoFlag, + AI_Procedure.ChangeScreenSize, + AI_Procedure.ChangeScreenClip, + AI_Procedure.ChangeScreenPos, + AI_Procedure.ChangeScreenPosPercent, + AI_Procedure.ChangeScreenRatio, + AI_Procedure.DisplayShadow, + AI_Procedure.ChangeShadowHeight, + AI_Procedure.ChangeShadowVector, + AI_Procedure.ForceActivationZDD, + AI_Procedure.ForceActivationZDM, + AI_Procedure.ForceActivationZDE, + AI_Procedure.ForceActivationZDR, + AI_Procedure.ForceDesactivationZDD, + AI_Procedure.ForceDesactivationZDM, + AI_Procedure.ForceDesactivationZDE, + AI_Procedure.ForceDesactivationZDR, + AI_Procedure.LibereActivationZDD, + AI_Procedure.LibereActivationZDM, + AI_Procedure.LibereActivationZDE, + AI_Procedure.LibereActivationZDR, + AI_Procedure.ActiveZDR, + AI_Procedure.SetNoCollisionWithMap, + AI_Procedure.SetNoCollisionWithProjectile, + AI_Procedure.SetNoCollisionWithSecondCharact, + AI_Procedure.SetNoCollisionWithMainCharact, + AI_Procedure.SetNoCollisionWithOtherSectors, + AI_Procedure.SetNoCollisionZdeWithProjectile, + AI_Procedure.SetCollComputeFrequency, + AI_Procedure.SetBrainComputeFrequency, + AI_Procedure.SetLightComputeFrequency, + AI_Procedure.SetUsedExitIdentifier, + AI_Procedure.GetUsedExitIdentifier, + AI_Procedure.SetGlobalCounter, + AI_Procedure.ReadAnalogJoystick, + AI_Procedure.SetAnalogJoystickAxes, + AI_Procedure.CancelKeyboardInertia, + AI_Procedure.GetPadCalibration, + AI_Procedure.SetPadCalibration, + AI_Procedure.SetBooleanInArray, + AI_Procedure.SetDefaultFormatCharacter, + AI_Procedure.SelectDriver, + AI_Procedure.SelectShapnessMax, + AI_Procedure.CenterScreen, + + // DC & iOS v + AI_Procedure.ChangeStateForSoftReset, + AI_Procedure.SetAllPadsActive, + // DC & iOS ^ + + AI_Procedure.SelectResolution, + AI_Procedure.ChangeBrightness, + AI_Procedure.TexteEntier, + AI_Procedure.TexteReel, + AI_Procedure.SetTextureFiltering, + AI_Procedure.SetAntiAliasing, + AI_Procedure.SetInStereoMode, + AI_Procedure.SND_SetPrevMusicFadeOut, + AI_Procedure.SetSaturationBackGroundDistance, + AI_Procedure.SaveSoundEventInSlotMemory, + AI_Procedure.RestoreSoundEventInSlotMemory, + + // DC & iOS v + AI_Procedure.RunDemo, + // DC & iOS ^ + + AI_Procedure.DrawSegment, + AI_Procedure.UpdateChecksum, + AI_Procedure.ShellExecute, + + // DC & iOS v + AI_Procedure.LaunchInternetBrowser, + AI_Procedure.LaunchIGP, + AI_Procedure.ActivateRumblePakInPort1, + AI_Procedure.ActivateRumblePakInPort2, + AI_Procedure.DeactivateRumblePak, + AI_Procedure.ShiftScreenToTheLeft, + AI_Procedure.ShiftScreenToTheRight, + AI_Procedure.ShiftScreenToTheTop, + AI_Procedure.ShiftScreenToTheBottom, + // DC & iOS ^ + + AI_Procedure.FixePointsDeMagie, + AI_Procedure.FixePointsDeMagieMax, + AI_Procedure.InitPointsDeMagie, + AI_Procedure.InitPointsDeMagieMax, + AI_Procedure.AjoutePointsDeMagie, + AI_Procedure.AjoutePointsDeMagieMax, + AI_Procedure.EnlevePointsDeMagie, + AI_Procedure.EnlevePointsDeMagieMax, + AI_Procedure.FixePointsDair, + AI_Procedure.FixePointsDairMax, + AI_Procedure.InitPointsDair, + AI_Procedure.InitPointsDairMax, + AI_Procedure.AjoutePointsDair, + AI_Procedure.AjoutePointsDairMax, + AI_Procedure.EnlevePointsDair, + AI_Procedure.EnlevePointsDairMax, + AI_Procedure.FixePositionFade, + AI_Procedure.FixeLumierePersoLocal, + AI_Procedure.FixeLumiereStaticOnOff, + AI_Procedure.FixeLumiereStaticNearFar, + AI_Procedure.FixeLumiereStaticColor, + AI_Procedure.CalculeLumiereEffet, + AI_Procedure.NoRLI, + AI_Procedure.FixeRLI, + AI_Procedure.BlendRLI, + AI_Procedure.ChangeTypeOfWP, + AI_Procedure.SetCapabilities, + AI_Procedure.AddCapabilities, + AI_Procedure.SubCapabilities, + AI_Procedure.ChangeCapabilities, + AI_Procedure.ReinitGraph, + AI_Procedure.FixeVitesseTexture, + AI_Procedure.ScrollingOnOff, + AI_Procedure.FixeDecalageTexture, + AI_Procedure.ScrollingPause, + AI_Procedure.ChangeCurrFrame, + AI_Procedure.ChangeRandomFrame, + AI_Procedure.FreezeAnim, + AI_Procedure.UnFreezeAnim, + AI_Procedure.SetSuperimposed, + AI_Procedure.SetSuperimposed2, + AI_Procedure.ReleaseSuperimposed, + AI_Procedure.SetSPOCoordinates, + AI_Procedure.SwitchSuperimposedTab, + AI_Procedure.SetTractionFactor, + AI_Procedure.TurnToPositionAngle, + AI_Procedure.TurnToPositionSpeed, + AI_Procedure.SortArray, + AI_Procedure.ActiveJoystickAnal, + AI_Procedure.UnActiveJoystickAnal, + AI_Procedure.SetZDMSizeSphere, + AI_Procedure.SetZDDSizeCone, + AI_Procedure.SetSoundVolumeAnim, + AI_Procedure.SetSoundVolumeMusic, + AI_Procedure.SetSoundVolumeAmbiance, + AI_Procedure.SetDopplerEffect, + AI_Procedure.PauseSound, + AI_Procedure.ResumeSound, + AI_Procedure.StopMenuSound, + AI_Procedure.ChangeCaractere, + AI_Procedure.FormateTexte, + AI_Procedure.ValideNomDuSlot, + AI_Procedure.RestoreNomDuSlot, + AI_Procedure.ChangePersoSighting, + AI_Procedure.PlayDemo, + AI_Procedure.InitKeyBoardDirections, + AI_Procedure.PadSetCenterposition, + AI_Procedure.PadSetMaximalValues, + AI_Procedure.ChangeTooFarLimit, + AI_Procedure.ChangeTransparencyZone, + AI_Procedure.SetBaseFrequenceForMenu, + AI_Procedure.SaveSinusContext, + AI_Procedure.RestoreSinusContext, + AI_Procedure.TextSuperImposed, + + // DC & iOS v + AI_Procedure.MultiInput, + AI_Procedure.SetHighScoreDisc, + // DC & iOS ^ + + AI_Procedure.Cam_UpdatePosition, + AI_Procedure.Cam_ChangeShiftTarget, + AI_Procedure.Cam_ChangeShiftPos, + AI_Procedure.Cam_ChangeDistMin, + AI_Procedure.Cam_ChangeDistMax, + AI_Procedure.Cam_ChangeBoundDistMin, + AI_Procedure.Cam_ChangeBoundDistMax, + AI_Procedure.Cam_ChangeAngleAlpha, + AI_Procedure.Cam_ChangeAngleShiftAlpha, + AI_Procedure.Cam_ChangeAngleTheta, + AI_Procedure.Cam_ChangeAngleShiftTheta, + AI_Procedure.Cam_ChangeLinearSpeed, + AI_Procedure.Cam_ChangeLinearIncreaseSpeed, + AI_Procedure.Cam_ChangeLinearDecreaseSpeed, + AI_Procedure.Cam_ChangeAngularSpeed, + AI_Procedure.Cam_ChangeAngularIncreaseSpeed, + AI_Procedure.Cam_ChangeAngularDecreaseSpeed, + AI_Procedure.Cam_ChangeTargetSpeed, + AI_Procedure.Cam_ChangeTargetIncreaseSpeed, + AI_Procedure.Cam_ChangeTargetDecreaseSpeed, + AI_Procedure.Cam_ChangeFocal, + AI_Procedure.Cam_ChangeZMin, + AI_Procedure.Cam_ChangeZMax, + AI_Procedure.Cam_ChangeTgtPerso, + AI_Procedure.Cam_ChangeSecondTgtPerso, + AI_Procedure.Cam_ChangeChannel, + AI_Procedure.Cam_Activate, + AI_Procedure.Cam_AssociateViewport, + AI_Procedure.Cam_ResetIAFlags, + AI_Procedure.Cam_SetFlagNoDynamicTarget, + AI_Procedure.Cam_SetFlagNoAverageMoveTgtPerso, + AI_Procedure.Cam_SetFlagNoParseCutAngle, + AI_Procedure.Cam_SetFlagNoVisibility, + AI_Procedure.Cam_SetFlagNoVisibilityWithDynHie, + AI_Procedure.Cam_SetFlagNoDynChangeTheta, + AI_Procedure.Cam_SetFlagNoShiftUntilPosReached, + AI_Procedure.Cam_SetFlagNoDynSpeed, + AI_Procedure.Cam_ResetDNMFlags, + AI_Procedure.Cam_SetFlagNoLinearParsing, + AI_Procedure.Cam_SetFlagNoLinearInertia, + AI_Procedure.Cam_SetFlagNoAngularParsing, + AI_Procedure.Cam_SetFlagNoAngularInertia, + AI_Procedure.Cam_SetFlagNoTargetParsing, + AI_Procedure.Cam_SetFlagNoTargetInertia, + AI_Procedure.Cam_SetFlagFixedOrientation, + AI_Procedure.Cam_SetFlagNoObstacle, + AI_Procedure.Cam_SetFlagNoCollisionWhenNotMoving, + AI_Procedure.Cam_ChangeConstants, + AI_Procedure.Cam_SaveConstants, + AI_Procedure.Cam_RestoreConstants, + AI_Procedure.Cam_ShowInfo, + AI_Procedure.Cam_ForceTarget, + AI_Procedure.Cam_ForcePosition, + AI_Procedure.Cam_ForceRefAxis, + AI_Procedure.Cam_Reset, + AI_Procedure.Cam_ForceBestPos, + AI_Procedure.Cam_ForceNormalState, + AI_Procedure.Cam_ForceMovingOnRail, + AI_Procedure.Cam_SetCameraModeForEngine, + AI_Procedure.LaunchAGO, + AI_Procedure.SetInGameMenu, + AI_Procedure.JffTxt_Affiche, + AI_Procedure.JffTxt_Extend, + AI_Procedure.JffTxt_Modify, + AI_Procedure.FadeIn, + AI_Procedure.FadeOut, + + // DC & iOS v + AI_Procedure.MenuInit, + AI_Procedure.MenuUpdate, + AI_Procedure.IngameMenuInit, + AI_Procedure.StatusBar, + AI_Procedure.StopBackgroundMusic, + AI_Procedure.GameButtonEnable, + // DC & iOS ^ + + AI_Procedure.CheatDoubleSpeed, + AI_Procedure.CheatInvertPad, + AI_Procedure.CheatRandomPad, + AI_Procedure.CheatRandomVignette, + + // DC & iOS v + AI_Procedure.RumblePak, + AI_Procedure.ChangeVideoMode__Placeholder, + AI_Procedure.ChangeScreenSizeValue, + // DC & iOS ^ + }; + } + #endregion + + } + +} diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/AI/Types/Rayman2/AI_Types_R2_iOS.cs.meta b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/AI/Types/Rayman2/AI_Types_R2_iOS.cs.meta new file mode 100644 index 00000000..cfb72bfb --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/AI/Types/Rayman2/AI_Types_R2_iOS.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 3a8fc34196b160a46bf93b518896a298 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/AI/Types/Rayman3.meta b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/AI/Types/Rayman3.meta new file mode 100644 index 00000000..768e0164 --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/AI/Types/Rayman3.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 77a4c9cff2aff2d488dcbdd417f806af +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/AI/Types/Rayman3/AI_Types_R3_GC.cs b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/AI/Types/Rayman3/AI_Types_R3_GC.cs new file mode 100644 index 00000000..1d5959cd --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/AI/Types/Rayman3/AI_Types_R3_GC.cs @@ -0,0 +1,1398 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace BinarySerializer.Ubisoft.CPA { + public class AI_Types_R3_GC : AI_Types_R3_PS2 { + // Re-checked + // Fields: identical + // MetaActions: identical + // Conditions: identical + + #region Functions + protected override void InitFunctions() { + Functions = new AI_Function[] { + AI_Function.GetPersoAbsolutePosition, + AI_Function.GetMyAbsolutePosition, + AI_Function.GetAngleAroundZToPerso, + AI_Function.DistanceToPerso, + AI_Function.DistanceXToPerso, + AI_Function.DistanceYToPerso, + AI_Function.DistanceZToPerso, + AI_Function.DistanceXYToPerso, + AI_Function.DistanceXZToPerso, + AI_Function.DistanceYZToPerso, + AI_Function.DistanceToPersoCenter, + AI_Function.DistanceXToPersoCenter, + AI_Function.DistanceYToPersoCenter, + AI_Function.DistanceZToPersoCenter, + AI_Function.DistanceXYToPersoCenter, + AI_Function.DistanceXZToPersoCenter, + AI_Function.DistanceYZToPersoCenter, + AI_Function.GetRadiusWP, + AI_Function.CircularInterpolationBetween3WP, + AI_Function.BezierBetween3WP, + AI_Function.DistanceToWP, + AI_Function.GetWPAbsolutePosition, + AI_Function.Int, + AI_Function.RandomInt, + AI_Function.Real, + AI_Function.Sinus, + AI_Function.Cosinus, + AI_Function.Square, + AI_Function.SquareRoot, + AI_Function.RandomReal, + AI_Function.MinimumReal, + AI_Function.MaximumReal, + AI_Function.DegreeToRadian, + AI_Function.RadianToDegree, + AI_Function.AbsoluteValue, + AI_Function.LimitRealInRange, + AI_Function.Sign, + AI_Function.Cube, + AI_Function.Modulo, + AI_Function.TernInf, + AI_Function.TernSup, + AI_Function.TernEq, + AI_Function.TernInfEq, + AI_Function.TernSupEq, + AI_Function.TernOp, + AI_Function.TemporalRealCombination, + AI_Function.GetHitPoints, + AI_Function.AddAndGetHitPoints, + AI_Function.SubAndGetHitPoints, + AI_Function.GetHitPointsMax, + AI_Function.AddAndGetHitPointsMax, + AI_Function.SubAndGetHitPointsMax, + AI_Function.ListSize, + AI_Function.GivePersoInList, + AI_Function.AbsoluteVector, + AI_Function.RelativeVector, + AI_Function.VecteurLocalToGlobal, + AI_Function.VecteurGlobalToLocal, + AI_Function.GetMagnetStrength, + AI_Function.GetMagnetFar, + AI_Function.GetMagnetNear, + AI_Function.GetMagnetDuration, + AI_Function.SPO_GetDrawFlag, + AI_Function.GetSPO_GetCollidedSPO, + AI_Function.GetSPO_GetCollidedWallSPO, + AI_Function.GetSPO_GetCollidedCeilingSPO, + AI_Function.GetTime, + AI_Function.GetElapsedTime, + AI_Function.GetDeltaT, + AI_Function.GetFrameLength, + AI_Function.GetFirstActivePad, + AI_Function.InputAnalogicValueX, + AI_Function.InputRealAnalogicValueX, + AI_Function.InputAnalogicValueY, + AI_Function.InputRealAnalogicValueY, + AI_Function.InputAnalogicValue, + AI_Function.InputRealAnalogicValue, + AI_Function.VitessePadAnalogique, + AI_Function.GenerateObject, + AI_Function.CountGeneratedObjects, + AI_Function.GetGlobalCounter, + AI_Function.GetSubMapId, + AI_Function.AddColor, + AI_Function.AddRed, + AI_Function.AddGreen, + AI_Function.AddBlue, + AI_Function.AddAlpha, + AI_Function.ColorRedGreenBlueAlpha, + AI_Function.ColorRedGreenBlue, + AI_Function.ColorRed, + AI_Function.ColorGreen, + AI_Function.ColorBlue, + AI_Function.ColorAlpha, + AI_Function.GetVMTColor, + AI_Function.GetVMTSpecularCoef, + AI_Function.GetVMTSpecularExponent, + AI_Function.GetVMTDiffuseCoef, + AI_Function.GetVMTAmbientCoef, + AI_Function.GetVMTTextureScrollingCoefU, + AI_Function.GetVMTTextureScrollingCoefV, + AI_Function.GetVMTFrame, + AI_Function.GetVMTNumberOfFrames, + AI_Function.MP_GetNumberOfPlayers, + AI_Function.MP_GetMaxNumberOfPlayers, + AI_Function.MP_GetViewPortOfPlayer, + AI_Function.MP_GetActiveMainActors, + AI_Function.PAD_GetHorizontalInvertion, + AI_Function.PAD_GetVerticalInvertion, + AI_Function.GetRLITableIndex, + AI_Function.PAD2_GetGlobalVector, + AI_Function.PAD2_GetHorizontalAxis, + AI_Function.PAD2_GetVerticalAxis, + AI_Function.PAD2_GetAnalogForce, + AI_Function.PAD2_GetTrueAnalogForce, + AI_Function.PAD2_GetRotationAngle, + AI_Function.PAD2_GetPadSector, + AI_Function.PAD2_GetLongDescValue, + AI_Function.TXT_GetNumberOfLines, + AI_Function.InputAnalogicValue2, + AI_Function.InputAnalogicValueV, + AI_Function.InputRealAnalogicValueV, + AI_Function.InputAnalogicValueZ, + AI_Function.InputRealAnalogicValueZ, + AI_Function.SAV2_GetValue, + AI_Function.SAV2_GetValueIndex, + AI_Function.SAV2_GetNumberOfExistingSave, + AI_Function.SAV2_GetTimeSaveGame, + AI_Function.SAV2_GetDateSaveGame, + AI_Function.GetTransitionSectorID, + AI_Function.FFBPreCreateConstantEffect, + AI_Function.FFBCreateAndLaunchConstantEffect, + AI_Function.FFBStopEffectWithFade, + AI_Function.CreateCheapCharacterList, + AI_Function.TestCheapCharacterList, + AI_Function.GetClosestCheapCharacter, + AI_Function.GetFurthestCheapCharacter, + AI_Function.GetReactivateCheapCharacter, + AI_Function.LitPointsDeMagie, + AI_Function.LitPointsDeMagieMax, + AI_Function.AjouteEtLitPointsDeMagie, + AI_Function.AjouteEtLitPointsDeMagieMax, + AI_Function.EnleveEtLitPointsDeMagie, + AI_Function.EnleveEtLitPointsDeMagieMax, + AI_Function.LitPointsDair, + AI_Function.LitPointsDairMax, + AI_Function.AjouteEtLitPointsDair, + AI_Function.AjouteEtLitPointsDairMax, + AI_Function.EnleveEtLitPointsDair, + AI_Function.EnleveEtLitPointsDairMax, + AI_Function.PersoLePlusProche, + AI_Function.PersoLePlusProcheExtended, + AI_Function.PersoLePlusProcheDansSecteurCourant, + AI_Function.PersoLePlusProcheDansSecteurCourantExtended, + AI_Function.NearerActorInFieldOfVision, + AI_Function.NearerActorInFieldOfVisionExtended, + AI_Function.NearerActorOfFamilyInFieldOfVision, + AI_Function.NearerActorOfFamilyInFieldOfVisionExtended, + AI_Function.NearerActorInFieldOfVisionWithOffset, + AI_Function.NearerActorInFieldOfVisionWithOffsetExtended, + AI_Function.NearerActorOfFamilyInFOVWithOffset, + AI_Function.NearerActorOfFamilyInFOVWithOffsetExtended, + AI_Function.GetNbActivePerso, + AI_Function.CibleLaPlusProche, + AI_Function.CibleLaPlusProcheExtended, + AI_Function.CibleLaPlusProcheAvecAngles, + AI_Function.CibleLaPlusProcheAvecAnglesExtended, + AI_Function.GetCloserNetwork, + AI_Function.NetWorkCloserCollisionWP, + AI_Function.ReseauWPLePlusProche, + AI_Function.ReseauWPLePlusProcheZPoids, + AI_Function.NetworkCloserWPOfType, + AI_Function.NetworkCloserCollisionWPOfType, + AI_Function.NetworkCloserWPOfExactType, + AI_Function.ReseauWPLePlusDansLAxe, + AI_Function.ReseauWPLePlusDansLAxe2, + AI_Function.ReseauWPLePlusProcheAvecAngle, + AI_Function.NetworkNextWPWithCapa, + AI_Function.NetworkNextWPWithExactCapa, + AI_Function.NetworkNextWPWithCapaOptimalWeight, + AI_Function.NetworkNextWPOfType, + AI_Function.NetworkNextWPOfExactType, + AI_Function.NetworkAffectTypeOfConnectedWP, + AI_Function.NetworkAffectTypeOfConnectedWPWithCapa, + AI_Function.ReseauCheminLePlusCourt, + AI_Function.NetworkBuildOrderedPath, + AI_Function.NetworkBuildOrderedPathCircular, + AI_Function.NetworkAllocateGraphToMSWay, + AI_Function.NetworkAllocateGraphToMSWayCircular, + AI_Function.NetworkBuildRandomPath, + AI_Function.NetworkBuildRandomCircularPath, + AI_Function.ReseauLitIndexCourant, + AI_Function.ReseauForceIndexCourant, + AI_Function.ReseauLitPremierIndex, + AI_Function.ReseauLitDernierIndex, + AI_Function.ReseauIncrementIndex, + AI_Function.ReseauDecrementIndex, + AI_Function.ReseauLitWPAIndex, + AI_Function.ReseauLitCapaciteLiaisonAIndex, + AI_Function.ReseauChangeCapaciteLiaisonAIndex, + AI_Function.ReseauLitPoidsLiaisonAIndex, + AI_Function.ReseauChangePoidsLiaisonAIndex, + AI_Function.NetworkGetIndexOfWPInMSWay, + AI_Function.NetworkForceWPToCurrent, + AI_Function.NetworkTestTheEnds, + AI_Function.ReseauLitCapaciteLiaisonDansGraph, + AI_Function.ReseauChangeCapaciteLiaisonDansGraph, + AI_Function.ReseauLitPoidsLiaisonDansGraph, + AI_Function.ReseauChangePoidsLiaisonDansGraph, + AI_Function.NetworkGetTypeOfWP, + AI_Function.GetCapabilities, + AI_Function.CapabilityAtBitNumber, + AI_Function.GetScrollSpeed, + AI_Function.MTGetScrollSpeed, + AI_Function.GetNbFrame, + AI_Function.DotProduct, + AI_Function.CrossProduct, + AI_Function.Normalize, + AI_Function.GetSPOCoordinates, + AI_Function.GetSPOSighting, + AI_Function.GetSPOHorizon, + AI_Function.GetSPOBanking, + AI_Function.GetTractionFactor, + AI_Function.GetCenterZDEType, + AI_Function.GetCenterZDMType, + AI_Function.GetCenterZDRType, + AI_Function.GetCenterZDDType, + AI_Function.TextAffiche, + AI_Function.MJTextAffiche, + AI_Function.GetCPUCounter, + AI_Function.TurnToPosition, + AI_Function.FormatMemCard, + AI_Function.GetDefaultLanguage, + AI_Function.PS2_MagicBox, + AI_Function.SAV2_DoVarsNeedToBeSet, + AI_Function.CINEGetGenerateEvent, + AI_Function.StringCompare, + AI_Function.EmptyString, + AI_Function.VitesseHorizontaleDuPerso, + AI_Function.VitesseVerticaleDuPerso, + AI_Function.GetPersoZoomFactor, + AI_Function.GetPersoSighting, + AI_Function.GetPersoHorizon, + AI_Function.GetPersoBanking, + AI_Function.LitPositionZDM, + AI_Function.LitPositionZDE, + AI_Function.LitPositionZDD, + AI_Function.LitCentreZDM, + AI_Function.LitCentreZDE, + AI_Function.LitCentreZDD, + AI_Function.LitAxeZDM, + AI_Function.LitAxeZDE, + AI_Function.LitAxeZDD, + AI_Function.LitDimensionZDM, + AI_Function.LitDimensionZDE, + AI_Function.LitDimensionZDD, + AI_Function.VecteurPointAxe, + AI_Function.VecteurPointSegment, + AI_Function.VectorContribution, + AI_Function.VectorCombination, + AI_Function.TemporalVectorCombination, + AI_Function.ScaledVector, + AI_Function.GetVectorNorm, + AI_Function.RotateVector, + AI_Function.VectorAngle, + AI_Function.VectorCos, + AI_Function.VectorSin, + AI_Function.GetNormalCollideVector, + AI_Function.GetNormalSlopeVector, + AI_Function.GetNormalSlopeVectorAndAngle, + AI_Function.GetNormalCollideVector2, + AI_Function.GetCollidePoint, + AI_Function.GetCollidePoint2, + AI_Function.GetHandsCollidePoint, + AI_Function.GetCollideRate, + AI_Function.GetCollideRate2, + AI_Function.GetCollideMaterialType, + AI_Function.GetCollideMaterialType2, + AI_Function.GetCollideMaterialDirection, + AI_Function.GetCollideMaterialCoeff, + AI_Function.GetCollideMaterialTypeForAi, + AI_Function.GetCollisionPoint, + AI_Function.GetCollisionVector, + AI_Function.GetCollisionPerso, + AI_Function.GetCollisionPointMaterial, + AI_Function.GetFirstCollisionInfo, + AI_Function.GetLastTraversedMaterialType, + AI_Function.GetLastTraversedMaterial, + AI_Function.GetCurrentCollidedGMT, + AI_Function.GetColliderType, + AI_Function.GetColliderActor, + AI_Function.GetColliderVector, + AI_Function.GetColliderReal, + AI_Function.GetLastCollisionActor, + AI_Function.ComputeRebondVector, + AI_Function.GetModuleAbsolutePosition, + AI_Function.GetModuleRelativePosition, + AI_Function.GetModuleZoomFactor, + AI_Function.GetModuleSighting, + AI_Function.GetModuleHorizon, + AI_Function.GetModuleBanking, + AI_Function.CastIntegerToChannel, + AI_Function.GetSlotDate, + AI_Function.GetSlotName, + AI_Function.GetSlotScore, + AI_Function.GetStringCharAt, + AI_Function.ScanAsciiKey, + AI_Function.GetFormattedTextInfo, + AI_Function.GetInputEntryName, + AI_Function.GetMechanicGravityFactor, + AI_Function.GetMechanicSlide, + AI_Function.GetMechanicRebound, + AI_Function.GetMechanicSlopeLimit, + AI_Function.GetMechanicInertiaX, + AI_Function.GetMechanicInertiaY, + AI_Function.GetMechanicInertiaZ, + AI_Function.GetMechanicTiltIntensity, + AI_Function.GetMechanicTiltInertia, + AI_Function.GetMechanicTiltOrigin, + AI_Function.GetMechanicMaxSpeed, + AI_Function.GetMechanicStreamPriority, + AI_Function.GetMechanicStreamSpeed, + AI_Function.GetMechanicStreamFactor, + AI_Function.GetSlideFactorX, + AI_Function.GetSlideFactorY, + AI_Function.GetSlideFactorZ, + AI_Function.JumpImpulsion, + AI_Function.GetSpeedAnim, + AI_Function.HierGetFather, + AI_Function.GetActivationZDD, + AI_Function.GetActivationZDM, + AI_Function.GetActivationZDE, + AI_Function.GetActivationZDR, + AI_Function.GetCollisionFrequency, + AI_Function.GetBrainFrequency, + AI_Function.GetLightFrequency, + AI_Function.GetBooleanInArray, + AI_Function.GetNumberOfBooleanInArray, + AI_Function.GetButtonName, + AI_Function.GetOneCustomFloat, + AI_Function.GetOneCustomLong, + AI_Function.GetOneCustomVector, + AI_Function.GetDriversAvailable, + AI_Function.GetCurrentLanguageId, + AI_Function.GetNbLanguages, + AI_Function.GetLanguageText, + AI_Function.TextToInt, + AI_Function.NbAvailableResolution, + AI_Function.CurrentResolution, + AI_Function.SaveResolution, + AI_Function.IsResolutionAvailable, + AI_Function.GetBrightness, + AI_Function.NameResolution, + AI_Function.GetTextureFiltering, + AI_Function.GetAntiAliasing, + AI_Function.GetSaturationDistance, + AI_Function.GetBackgroundDistance, + AI_Function.GetTooFarLimit, + AI_Function.GetTransparencyZoneMin, + AI_Function.GetTransparencyZoneMax, + AI_Function.GetCurrentFrame, + AI_Function.ExecuteVariable, + AI_Function.ComputeProtectKey, + AI_Function.Xor, + AI_Function.And, + AI_Function.Or, + AI_Function.Not, + AI_Function.DivUnsigned, + AI_Function.MulUnsigned, + AI_Function.AddUnsigned, + AI_Function.SubUnsigned, + AI_Function.GetMemoryValue, + AI_Function.GetXBoxRegion, + AI_Function.CreditsBegin, + AI_Function.CreditsGetChapter, + AI_Function.CreditsGetPageFromCurrentChapter, + AI_Function.Cam_GetShiftTarget, + AI_Function.Cam_GetShiftPos, + AI_Function.Cam_GetDistMin, + AI_Function.Cam_GetDistMax, + AI_Function.Cam_GetBoundDistMin, + AI_Function.Cam_GetBoundDistMax, + AI_Function.Cam_GetAngleAlpha, + AI_Function.Cam_GetAngleShiftAlpha, + AI_Function.Cam_GetAngleTheta, + AI_Function.Cam_GetAngleShiftTheta, + AI_Function.Cam_GetLinearSpeed, + AI_Function.Cam_GetLinearIncreaseSpeed, + AI_Function.Cam_GetLinearDecreaseSpeed, + AI_Function.Cam_GetAngularSpeed, + AI_Function.Cam_GetAngularIncreaseSpeed, + AI_Function.Cam_GetAngularDecreaseSpeed, + AI_Function.Cam_GetTargetSpeed, + AI_Function.Cam_GetTargetIncreaseSpeed, + AI_Function.Cam_GetTargetDecreaseSpeed, + AI_Function.Cam_GetFocal, + AI_Function.Cam_GetZMin, + AI_Function.Cam_GetZMax, + AI_Function.Cam_GetTargetedSuperObject, + AI_Function.Cam_GetTypeOfViewport, + AI_Function.Cam_GetCameraOfViewport, + AI_Function.Cam_GetMainCamera, + AI_Function.Cam_ComputeTargetWithTgtPerso, + AI_Function.Cam_GetCurrentTargetPosition, + AI_Function.Cam_GetSectorCameraType, + AI_Function.Cam_GetBestPos, + AI_Function.Cam_GetTransparencyFlag, + AI_Function.Cam_SetMirrorFlag, + AI_Function.Cam_GetMirrorFlag, + AI_Function.CAM_GetViewportCoordinates, + AI_Function.CSHBackMode, + AI_Function.CSHMarioMode, + AI_Function.CSHStrafeLockMode, + AI_Function.GetViewFinderDistance, + AI_Function.LinkInit, + AI_Function.LinkDoBehaviour, + AI_Function.LinkKill, + AI_Function.LinkGetNoCutpoints, + AI_Function.LinkGetCutPoint, + AI_Function.FollowLinkDirection, + AI_Function.SND_GetSoundHandle, + AI_Function.SND_GetSendSoundRequestHandleState, + AI_Function.SND_GetSendVoiceRequestHandleState, + AI_Function.SND_GetSendMusicRequestHandleState, + AI_Function.SND_GetSendAmbianceRequestHandleState, + AI_Function.SND_GetSendMenuSndRequestHandleState, + AI_Function.SND_GetSoundVolume, + AI_Function.SND_GetVoiceVolume, + AI_Function.SND_GetMusicVolume, + AI_Function.SND_GetAmbianceVolume, + AI_Function.SND_GetMenuSndVolume, + AI_Function.IsSoundPlaying, + AI_Function.SND_GetMusicMarker, + AI_Function.MonitoringSetVariable, + AI_Function.R3GetScore, + AI_Function.R3GetNbCage, + AI_Function.Placeholder__R3GetGCOnly, + AI_Function.PS2DemoGetParameter, + AI_Function.GetScreenDisplayFrequency, + AI_Function.GetLastSaveGameOperationResult, + AI_Function.SinEffect_GetSinusPosition, + AI_Function.SFX_GetLightReflectionStatus, + AI_Function.SFX_GetWaterCirclesStatus, + AI_Function.SFX_IsLightReflectionPossible, + AI_Function.SFX_IsWaterCirclesPossible, + AI_Function.AGO_GetHandle, + AI_Function.IsMcValid, + AI_Function.FormatMc, + AI_Function.Placeholder__R3GCOnly__LastFuncs_1, + AI_Function.Placeholder__R3GCOnly__LastFuncs_2, + AI_Function.Placeholder__R3GCOnly__LastFuncs_3, + AI_Function.Placeholder__R3GCOnly__LastFuncs_4, + AI_Function.Placeholder__R3GCOnly__LastFuncs_5, + AI_Function.Placeholder__R3GCOnly__LastFuncs_6, + AI_Function.Placeholder__R3GCOnly__LastFuncs_7, + AI_Function.Placeholder__R3GCOnly__LastFuncs_8, + AI_Function.Placeholder__R3GCOnly__LastFuncs_9, + AI_Function.Placeholder__R3GCOnly__LastFuncs_10, + AI_Function.Placeholder__R3GCOnly__LastFuncs_11, + AI_Function.Placeholder__R3GCOnly__LastFuncs_12, + AI_Function.Placeholder__R3GCOnly__LastFuncs_13, + AI_Function.Placeholder__R3GCOnly__LastFuncs_14, + AI_Function.Placeholder__R3GCOnly__LastFuncs_15, + AI_Function.Placeholder__R3GCOnly__LastFuncs_16, + AI_Function.Placeholder__R3GCOnly__LastFuncs_17, + AI_Function.Placeholder__R3GCOnly__LastFuncs_18, + AI_Function.Placeholder__R3GCOnly__LastFuncs_19, + AI_Function.Placeholder__R3GCOnly__LastFuncs_20, + AI_Function.Placeholder__R3GCOnly__LastFuncs_21, + AI_Function.Placeholder__R3GCOnly__LastFuncs_22, + AI_Function.Placeholder__R3GCOnly__LastFuncs_23, + AI_Function.Placeholder__R3GCOnly__LastFuncs_24, + AI_Function.Placeholder__R3GCOnly__LastFuncs_25, + AI_Function.Placeholder__R3GCOnly__LastFuncs_26, + AI_Function.Placeholder__R3GCOnly__LastFuncs_27, + AI_Function.Placeholder__R3GCOnly__LastFuncs_28, + AI_Function.Placeholder__R3GCOnly__LastFuncs_29, + AI_Function.Placeholder__R3GCOnly__LastFuncs_30, + AI_Function.Placeholder__R3GCOnly__LastFuncs_31, + AI_Function.Placeholder__R3GCOnly__LastFuncs_32, + AI_Function.Placeholder__R3GCOnly__LastFuncs_33, + AI_Function.Placeholder__R3GCOnly__LastFuncs_34, + AI_Function.Placeholder__R3GCOnly__LastFuncs_35, + AI_Function.Placeholder__R3GCOnly__LastFuncs_36, + }; + } + #endregion + + #region Procedures + protected override void InitProcedures() { + Procedures = new AI_Procedure[] { + AI_Procedure.SetHitPoints, + AI_Procedure.SetHitPointsInit, + AI_Procedure.SetHitPointsToInitValue, + AI_Procedure.SetHitPointsToMaxValue, + AI_Procedure.AddHitPoints, + AI_Procedure.SubHitPoints, + AI_Procedure.SetHitPointsMax, + AI_Procedure.SetHitPointsMaxToInitValue, + AI_Procedure.SetHitPointsMaxToMaxValue, + AI_Procedure.AddHitPointsMax, + AI_Procedure.SubHitPointsMax, + AI_Procedure.TransparentDisplay, + AI_Procedure.SetTransparency, + AI_Procedure.ACT_SetDrawFlag, + AI_Procedure.SkinMaterial, + AI_Procedure.SkinIndex, + AI_Procedure.ModuleTransparentDisplay, + AI_Procedure.ModuleTransparentDisplay2, + AI_Procedure.SetModuleTransparency, + AI_Procedure.SetModuleTransparency2, + AI_Procedure.ListAffectPersoZDD, + AI_Procedure.ListAffectModuleZDD, + AI_Procedure.ListAffectPersoZDE, + AI_Procedure.ListAffectModuleZDE, + AI_Procedure.ListAffectPersoTypeZDE, + AI_Procedure.ListAffectModuleTypeZDE, + AI_Procedure.ListAffectTypeZDEWithTypeZDE, + AI_Procedure.AddPersoInList, + AI_Procedure.AddPersoInListAt, + AI_Procedure.DeletePersoAtInList, + AI_Procedure.FindPersoAndDeleteInList, + AI_Procedure.ListSelect, + AI_Procedure.ListUnSelect, + AI_Procedure.ListSort, + AI_Procedure.ListSortByFamily, + AI_Procedure.ListSortByModel, + AI_Procedure.FillListWithAllPersoOfAFamily, + AI_Procedure.FillListWithAllPersoOfAModel, + AI_Procedure.DeleteFamilyInList, + AI_Procedure.DeleteModelInList, + AI_Procedure.ListUnion, + AI_Procedure.ListInter, + AI_Procedure.ListDiff, + AI_Procedure.ListAdd, + AI_Procedure.FogActivate, + AI_Procedure.SetFogColor, + AI_Procedure.SetFogNearFarInf, + AI_Procedure.SetFogBlend, + AI_Procedure.RestoreFog, + AI_Procedure.SaveFog, + AI_Procedure.Magnet_ActiveMagnet, + AI_Procedure.Magnet_DeactiveMagnet, + AI_Procedure.Magnet_SetStrength, + AI_Procedure.Magnet_SetFar, + AI_Procedure.Magnet_SetNear, + AI_Procedure.Magnet_SetDuration, + AI_Procedure.FootPath_AddFootPrint, + AI_Procedure.FootPath_Clear, + AI_Procedure.SinEffect_SetFreq, + AI_Procedure.SinEffect_SetAmplitude, + AI_Procedure.SinEffect_SetState, + AI_Procedure.SinEffect_SetFreq3D, + AI_Procedure.SinEffect_SetFreq3DMesh, + AI_Procedure.SinEffect_SetFreq3DRLI, + AI_Procedure.SinEffect_SetRLIAmplitude, + AI_Procedure.SinEffect_SetRLIBase, + AI_Procedure.SPO_SetDrawFlag, + AI_Procedure.SPO_SetEngineDisplayModeFlag, + AI_Procedure.DeactivateBut, + AI_Procedure.ActivateBut, + AI_Procedure.None, + AI_Procedure.Trace, + AI_Procedure.ChangeComport, + AI_Procedure.ChangeComportReflex, + AI_Procedure.ChangeMyComport, + AI_Procedure.ChangeMyComportReflex, + AI_Procedure.ChangeMyComportAndMyReflex, + AI_Procedure.ChangeAction, + AI_Procedure.ChangeActionForce, + AI_Procedure.ChangeActionRandom, + AI_Procedure.ChangeActionWithEvents, + AI_Procedure.ChangeActionSmooth, + AI_Procedure.ChangeActionForceSmooth, + AI_Procedure.ChangeActionRandomSmooth, + AI_Procedure.ChangeActionWithEventsSmooth, + AI_Procedure.ChangeActionSmoothNL, + AI_Procedure.ChangeActionForceSmoothNL, + AI_Procedure.ChangeActionRandomSmoothNL, + AI_Procedure.ChangeActionWithEventsSmoothNL, + AI_Procedure.Boucle, + AI_Procedure.FinBoucle, + AI_Procedure.Break, + AI_Procedure.PlayerIsDead, + AI_Procedure.ResetDynamicsWithCard, + AI_Procedure.BreakAI, + AI_Procedure.IgnoreTraceFlagForNextPicking, + AI_Procedure.SetMainActor, + AI_Procedure.ActivateObject, + AI_Procedure.DesactivateObject, + AI_Procedure.ChangeMap, + AI_Procedure.ChangeMapWithTransition, + AI_Procedure.ChangeMapNoAutosave, + AI_Procedure.SetActionReturn, + AI_Procedure.FactorAnimationFrameRate, + AI_Procedure.SetCharacterPriority, + AI_Procedure.ForcePersoHandling, + AI_Procedure.SetDynamicAlwaysActive, + AI_Procedure.PlayerIsDeadWithPlacement, + AI_Procedure.SwapLinkTableObjects, + AI_Procedure.ReinitTableObjects, + AI_Procedure.ChangeCurrentObjectTable, + AI_Procedure.BuildObjectTableFromTableAndString, + AI_Procedure.BuildObjectTableFromFormattedString, + AI_Procedure.TakeModuleControl, + AI_Procedure.TakeManyModulesControl, + AI_Procedure.ReleaseModuleControl, + AI_Procedure.QuitGame, + AI_Procedure.ActivateChannel, + AI_Procedure.DeactivateChannel, + AI_Procedure.PersoLightOn, + AI_Procedure.PersoLightOff, + AI_Procedure.SetPersoLightColor, + AI_Procedure.SetPersoLightNearFar, + AI_Procedure.SetPersoLightLittleBigAlpha, + AI_Procedure.SetPersoLightGyrophare, + AI_Procedure.SetPersoLightPulse, + AI_Procedure.SetPersoLightParalleleType, + AI_Procedure.SetPersoLightSphericalType, + AI_Procedure.SetPersoLightHotSpotType, + AI_Procedure.SetPersoLightAmbientType, + AI_Procedure.DefaultDisplay, + AI_Procedure.DisplayVignette, + AI_Procedure.DeleteVignette, + AI_Procedure.PRT_SetGeneratorOn, + AI_Procedure.PRT_SetGeneratorOff, + AI_Procedure.PRT_SetGenerator, + AI_Procedure.PRT_SetModeNone, + AI_Procedure.PRT_SetModeContinuous, + AI_Procedure.PRT_SetModeCrenel, + AI_Procedure.PRT_SetModeProbability, + AI_Procedure.PRT_SetNumberConstant, + AI_Procedure.PRT_SetNumberProbabilist, + AI_Procedure.PRT_SetInfiniteLifeTime, + AI_Procedure.PRT_SetConstantLifeTime, + AI_Procedure.PRT_SetPobabilistLifeTime, + AI_Procedure.Turn, + AI_Procedure.Turn2, + AI_Procedure.DeltaTurnPerso, + AI_Procedure.TurnPerso, + AI_Procedure.KillPerso, + AI_Procedure.KillPersoAndClearVariable, + AI_Procedure.DeletePersoFromGame, + AI_Procedure.SetVMTColor, + AI_Procedure.SetVMTSpecularExponent, + AI_Procedure.SetVMTSpecularCoef, + AI_Procedure.SetVMTDiffuseCoef, + AI_Procedure.SetVMTAmbientCoef, + AI_Procedure.SetVMTAsChromed, + AI_Procedure.SetVMTTextureScrollingCoef, + AI_Procedure.LockVMT, + AI_Procedure.UnlockVMT, + AI_Procedure.SetVMTFrame, + AI_Procedure.OptionChangeDetailsValue, + AI_Procedure.OptionChangeActionKey, + AI_Procedure.OptionConfigureKey, + AI_Procedure.OptionGetCurrentKeyValue, + AI_Procedure.OptionChangeKeyValue, + AI_Procedure.OptionResetKeyValueToDefault, + AI_Procedure.BatchSetPersoAtModulePosition, + AI_Procedure.BatchSetPersoOrientation, + AI_Procedure.BatchSetPersoAtPerso, + AI_Procedure.SetPersoAbsolutePosition, + AI_Procedure.SetPersoAtModulePosition, + AI_Procedure.ForcePersoAveragePosition, + AI_Procedure.RelativeMovePerso, + AI_Procedure.ChangePersoAnySighting, + AI_Procedure.ChangePersoSightingWithOffset, + AI_Procedure.RotatePersoAroundX, + AI_Procedure.RotatePersoAroundY, + AI_Procedure.RotatePersoAroundZ, + AI_Procedure.RotatePersoAroundVector, + AI_Procedure.RotatePersoAroundVectorWithOffset, + AI_Procedure.RotatePersoAroundXwithOffset, + AI_Procedure.RotatePersoAroundYwithOffset, + AI_Procedure.RotatePersoAroundZwithOffset, + AI_Procedure.SetFullPersoOrientation, + AI_Procedure.SetFullPersoOrientationWithOffset, + AI_Procedure.ZoomPerso, + AI_Procedure.ChangeOneCustomBit, + AI_Procedure.ChangeManyCustomBits, + AI_Procedure.ChangeManyCustomBitsExtended, + AI_Procedure.ChangeOneCustomFloat, + AI_Procedure.ChangeOneCustomLong, + AI_Procedure.ChangeOneCustomVector, + AI_Procedure.ImposeSpeed, + AI_Procedure.ImposeSpeedX, + AI_Procedure.ImposeSpeedY, + AI_Procedure.ImposeSpeedZ, + AI_Procedure.ImposeSpeedXY, + AI_Procedure.ImposeSpeedXYZ, + AI_Procedure.ImposeAbsoluteSpeed, + AI_Procedure.ImposeAbsoluteSpeedX, + AI_Procedure.ImposeAbsoluteSpeedY, + AI_Procedure.ImposeAbsoluteSpeedZ, + AI_Procedure.ImposeAbsoluteSpeedXY, + AI_Procedure.ImposeAbsoluteSpeedXYZ, + AI_Procedure.ProposeSpeed, + AI_Procedure.ProposeSpeedX, + AI_Procedure.ProposeSpeedY, + AI_Procedure.ProposeSpeedZ, + AI_Procedure.ProposeSpeedXY, + AI_Procedure.ProposeSpeedXYZ, + AI_Procedure.ProposeAbsoluteSpeed, + AI_Procedure.ProposeAbsoluteSpeedX, + AI_Procedure.ProposeAbsoluteSpeedY, + AI_Procedure.ProposeAbsoluteSpeedZ, + AI_Procedure.ProposeAbsoluteSpeedXY, + AI_Procedure.ProposeAbsoluteSpeedXYZ, + AI_Procedure.FixePositionPerso, + AI_Procedure.FixePositionPerso_R3GCOnlyVariant, + AI_Procedure.FixePositionPersoWithInterpol, + AI_Procedure.AddSpeed, + AI_Procedure.AddSpeedX, + AI_Procedure.AddSpeedY, + AI_Procedure.AddSpeedZ, + AI_Procedure.AddSpeedXY, + AI_Procedure.AddSpeedXYZ, + AI_Procedure.AddAbsoluteSpeed, + AI_Procedure.AddAbsoluteSpeedX, + AI_Procedure.AddAbsoluteSpeedY, + AI_Procedure.AddAbsoluteSpeedZ, + AI_Procedure.AddAbsoluteSpeedXY, + AI_Procedure.AddAbsoluteSpeedXYZ, + AI_Procedure.PrepareMorph, + AI_Procedure.PrepareMorphMT, + AI_Procedure.StopMorph, + AI_Procedure.StopAllMorph, + AI_Procedure.Morphing, + AI_Procedure.MorphingMT, + AI_Procedure.ReleaseAllModulesControl, + AI_Procedure.ChangeModuleSighting, + AI_Procedure.SetModuleAbsolutePosition, + AI_Procedure.RelativeMoveModule, + AI_Procedure.ChangeModuleSightingWithOffset, + AI_Procedure.RotateModuleAroundX, + AI_Procedure.RotateModuleAroundY, + AI_Procedure.RotateModuleAroundZ, + AI_Procedure.RotateModuleAroundVector, + AI_Procedure.RotateModuleAroundVectorWithOffset, + AI_Procedure.RotateModuleAroundXwithOffset, + AI_Procedure.RotateModuleAroundYwithOffset, + AI_Procedure.RotateModuleAroundZwithOffset, + AI_Procedure.SetFullModuleOrientation, + AI_Procedure.SetFullModuleOrientationWithOffset, + AI_Procedure.ZoomModule, + AI_Procedure.SetColliderType, + AI_Procedure.SetColliderActor, + AI_Procedure.SetColliderVector, + AI_Procedure.SetColliderReal, + AI_Procedure.ReinitCollider, + AI_Procedure.ResetLastCollisionActor, + AI_Procedure.ClearCollisionReport, + AI_Procedure.SetGoThroughMechanicsHandling, + AI_Procedure.EraseLastGoThroughMaterial, + AI_Procedure.ChangeTextDefaultColor, + AI_Procedure.CreateTextWithParamFormat, + AI_Procedure.CreateTextWith2ParamsFormat, + AI_Procedure.StringAddChar, + AI_Procedure.StringReplaceChar, + AI_Procedure.StringRemoveChar, + AI_Procedure.ChangeLanguage, + AI_Procedure.IntToText, + AI_Procedure.FloatToText, + AI_Procedure.SetMechanicAnimation, + AI_Procedure.SetMechanicCollide, + AI_Procedure.SetMechanicGravity, + AI_Procedure.SetMechanicTilt, + AI_Procedure.SetMechanicGi, + AI_Procedure.SetMechanicClimb, + AI_Procedure.SetMechanicOnGround, + AI_Procedure.SetMechanicSpider, + AI_Procedure.SetMechanicShoot, + AI_Procedure.SetMechanicSwim, + AI_Procedure.SetMechanicNeverFall, + AI_Procedure.SetMechanicNewMechanic, + AI_Procedure.SetMechanicCollisionControl, + AI_Procedure.SetMechanicKeepSpeedZ, + AI_Procedure.SetMechanicSpeedLimit, + AI_Procedure.SetMechanicInertia, + AI_Procedure.SetMechanicStream, + AI_Procedure.SetMechanicStickOnPlatform, + AI_Procedure.SetMechanicScale, + AI_Procedure.SetMechanicGravityFactor, + AI_Procedure.SetMechanicSlide, + AI_Procedure.SetMechanicRebound, + AI_Procedure.SetMechanicSlopeLimit, + AI_Procedure.SetMechanicInertiaX, + AI_Procedure.SetMechanicInertiaY, + AI_Procedure.SetMechanicInertiaZ, + AI_Procedure.SetMechanicInertiaXYZ, + AI_Procedure.SetMechanicTiltIntensity, + AI_Procedure.SetMechanicTiltInertia, + AI_Procedure.SetMechanicTiltOrigin, + AI_Procedure.SetMechanicSpeedMax, + AI_Procedure.SetMechanicStreamPriority, + AI_Procedure.SetMechanicStreamSpeed, + AI_Procedure.SetMechanicStreamFactor, + AI_Procedure.AddMechanicStreamSpeed, + AI_Procedure.AddMechanicStreamSpeedList, + AI_Procedure.MoveLimit, + AI_Procedure.MoveLimitX, + AI_Procedure.MoveLimitY, + AI_Procedure.MoveLimitZ, + AI_Procedure.MoveLimitXYZ, + AI_Procedure.StopMoveLimitX, + AI_Procedure.StopMoveLimitY, + AI_Procedure.StopMoveLimitZ, + AI_Procedure.StopMoveLimitXYZ, + AI_Procedure.SetPlatformLink, + AI_Procedure.FreePlatformLink, + AI_Procedure.MecSetScale, + AI_Procedure.MecSetSlideFactorXYZ, + AI_Procedure.MecSetSlideFactorX, + AI_Procedure.MecSetSlideFactorY, + AI_Procedure.MecSetSlideFactorZ, + AI_Procedure.MecSetClimbSpeedLimit, + AI_Procedure.MecSetHangingLimit, + AI_Procedure.MecSetHangingOff, + AI_Procedure.MecSetBaseCoeff, + AI_Procedure.MecSetWalkCoeff, + AI_Procedure.HierSetFather, + AI_Procedure.HierFreeFather, + AI_Procedure.HierListOfSon, + AI_Procedure.HierSetPlatformType, + AI_Procedure.HierControlLink, + AI_Procedure.HierFreezeEngine, + AI_Procedure.FixePositionZDM, + AI_Procedure.FixePositionZDD, + AI_Procedure.FixePositionZDE, + AI_Procedure.ChangeGameMaterialZDE, + AI_Procedure.ChangeLightIntensity, + AI_Procedure.SPO_ChangeFlag, + AI_Procedure.SPO_ChangeFlagRecursively, + AI_Procedure.ActChangeSpoFlag, + AI_Procedure.ChangeScreenSize, + AI_Procedure.ChangeScreenClip, + AI_Procedure.ChangeScreenPos, + AI_Procedure.ChangeScreenPosPercent, + AI_Procedure.ChangeScreenPosPerThousand, + AI_Procedure.ChangeScreenRatio, + AI_Procedure.DisplayShadow, + AI_Procedure.ChangeShadowHeight, + AI_Procedure.ChangeShadowVector, + AI_Procedure.ForceActivationZDD, + AI_Procedure.ForceActivationZDM, + AI_Procedure.ForceActivationZDE, + AI_Procedure.ForceActivationZDR, + AI_Procedure.ForceDesactivationZDD, + AI_Procedure.ForceDesactivationZDM, + AI_Procedure.ForceDesactivationZDE, + AI_Procedure.ForceDesactivationZDR, + AI_Procedure.LibereActivationZDD, + AI_Procedure.LibereActivationZDM, + AI_Procedure.LibereActivationZDE, + AI_Procedure.LibereActivationZDR, + AI_Procedure.ActiveZDR, + AI_Procedure.SetNoCollisionWithMap, + AI_Procedure.SetNoCollisionWithProjectile, + AI_Procedure.SetNoCollisionWithSecondCharact, + AI_Procedure.SetNoCollisionWithMainCharact, + AI_Procedure.SetNoCollisionWithOtherSectors, + AI_Procedure.SetNoCollisionZdeWithProjectile, + AI_Procedure.SetCollComputeFrequency, + AI_Procedure.SetBrainComputeFrequency, + AI_Procedure.SetLightComputeFrequency, + AI_Procedure.SetUsedExitIdentifier, + AI_Procedure.GetUsedExitIdentifier, + AI_Procedure.SetGlobalCounter, + AI_Procedure.ReadAnalogJoystick, + AI_Procedure.SetAnalogJoystickAxes, + AI_Procedure.GetPadCalibration, + AI_Procedure.SetPadCalibration, + AI_Procedure.CancelKeyboardInertia, + AI_Procedure.SetAnalogJoystickAxes2, + AI_Procedure.ReleaseAnalogJoystick, + AI_Procedure.SetBooleanInArray, + AI_Procedure.SetDefaultFormatCharacter, + AI_Procedure.SelectDriver, + AI_Procedure.SelectShapnessMax, + AI_Procedure.CenterScreen, + AI_Procedure.SelectResolution, + AI_Procedure.ChangeBrightness, + AI_Procedure.TexteEntier, + AI_Procedure.TexteReel, + AI_Procedure.SetTextureFiltering, + AI_Procedure.SetAntiAliasing, + AI_Procedure.DrawSegment, + AI_Procedure.UpdateChecksum, + AI_Procedure.ShellExecute, + AI_Procedure.ChangeSightingAccordingTime, + AI_Procedure.PAD2_SetGlobalVector, + AI_Procedure.PAD2_SetHorizontalAxis, + AI_Procedure.PAD2_SetVerticalAxis, + AI_Procedure.PAD2_SetAnalogForce, + AI_Procedure.PAD2_SetTrueAnalogForce, + AI_Procedure.PAD2_SetRotationAngle, + AI_Procedure.PAD2_SetPadSector, + AI_Procedure.PAD2_SetLongDescValue, + AI_Procedure.SetModifierModeNormal, + AI_Procedure.SetModifierModeLight, + AI_Procedure.SetModifierModeRGB, + AI_Procedure.ValidateMemoryCard, + AI_Procedure.AddMemoryCardString, + AI_Procedure.SetGlobalAccelerationFactorForAnims, + AI_Procedure.FixePointsDeMagie, + AI_Procedure.FixePointsDeMagieMax, + AI_Procedure.InitPointsDeMagie, + AI_Procedure.InitPointsDeMagieMax, + AI_Procedure.AjoutePointsDeMagie, + AI_Procedure.AjoutePointsDeMagieMax, + AI_Procedure.EnlevePointsDeMagie, + AI_Procedure.EnlevePointsDeMagieMax, + AI_Procedure.FixePointsDair, + AI_Procedure.FixePointsDairMax, + AI_Procedure.InitPointsDair, + AI_Procedure.InitPointsDairMax, + AI_Procedure.AjoutePointsDair, + AI_Procedure.AjoutePointsDairMax, + AI_Procedure.EnlevePointsDair, + AI_Procedure.EnlevePointsDairMax, + AI_Procedure.FixePositionFade, + AI_Procedure.FixeLumierePersoLocal, + AI_Procedure.FixeLumierePersoOnOff, + AI_Procedure.FixeLumiereStaticOnOff, + AI_Procedure.FixeLumiereStaticNearFar, + AI_Procedure.FixeLumiereStaticColor, + AI_Procedure.CalculeLumiere, + AI_Procedure.CalculeLumiereAvecOmbres, + AI_Procedure.NoRLI, + AI_Procedure.FixeRLI, + AI_Procedure.BlendRLI, + AI_Procedure.SetRadiusWP, + AI_Procedure.SetPositionAbsWP, + AI_Procedure.SetPositionRelWP, + AI_Procedure.ChangeTypeOfWP, + AI_Procedure.SetCapabilities, + AI_Procedure.AddCapabilities, + AI_Procedure.SubCapabilities, + AI_Procedure.ChangeCapabilities, + AI_Procedure.WPIndiquePlageValeur, + AI_Procedure.ReinitGraph, + AI_Procedure.FixeVitesseTexture, + AI_Procedure.ScrollingOnOff, + AI_Procedure.FixeDecalageTexture, + AI_Procedure.ScrollingPause, + AI_Procedure.ChangeCurrFrame, + AI_Procedure.ChangeRandomFrame, + AI_Procedure.FreezeAnim, + AI_Procedure.UnFreezeAnim, + AI_Procedure.SetDiscreetSpeed, + AI_Procedure.SetSuperimposed, + AI_Procedure.MJ_SetSuperimposed, + AI_Procedure.SetSuperimposed2, + AI_Procedure.ReleaseSuperimposed, + AI_Procedure.SetSuperimposedClipping, + AI_Procedure.ResetSuperimposedClipping, + AI_Procedure.SetOutlineMode, + AI_Procedure.SetOutlineModeSPO, + AI_Procedure.SetSPOCoordinates, + AI_Procedure.SetSPOCoordinatesAndMoveType1, + AI_Procedure.SetSPOCoordinatesAndMoveType2, + AI_Procedure.SetSPOCoordinatesAndMoveType3, + AI_Procedure.SetSPOCoordinatesAndMoveType4, + AI_Procedure.SetSPOCoordsNoInt, + AI_Procedure.SetSPOCoordsAndMoveType1NoInt, + AI_Procedure.SetSPOCoordsAndMoveType2NoInt, + AI_Procedure.SetSPOCoordsAndMoveType3NoInt, + AI_Procedure.SetSPOCoordsAndMoveType4NoInt, + AI_Procedure.SetSOLFromWorldOrigin_SPOParam, + AI_Procedure.SetSOLFromInit_SPOParam, + AI_Procedure.SetSOLFromHere_SPOParam, + AI_Procedure.SetSOLToInit_SPOParam, + AI_Procedure.ReinitSOL_SPOParam, + AI_Procedure.SetSOLFromWorldOrigin_SOLParam, + AI_Procedure.SetSOLFromInit_SOLParam, + AI_Procedure.SetSOLFromHere_SOLParam, + AI_Procedure.SetSOLToInit_SOLParam, + AI_Procedure.ReinitSOL_SOLParam, + AI_Procedure.SOLAddCharacter, + AI_Procedure.SOLAddWaypoint, + AI_Procedure.SOLAddObject, + AI_Procedure.SOLDeleteCharacter, + AI_Procedure.SOLDeleteWaypoint, + AI_Procedure.SOLDeleteObject, + AI_Procedure.SwitchSuperimposedTab, + AI_Procedure.RotateSPOAroundX, + AI_Procedure.RotateSPOAroundXType1, + AI_Procedure.RotateSPOAroundXType2, + AI_Procedure.RotateSPOAroundXType3, + AI_Procedure.RotateSPOAroundXType4, + AI_Procedure.RotateSPOAroundY, + AI_Procedure.RotateSPOAroundYType1, + AI_Procedure.RotateSPOAroundYType2, + AI_Procedure.RotateSPOAroundYType3, + AI_Procedure.RotateSPOAroundYType4, + AI_Procedure.RotateSPOAroundZ, + AI_Procedure.RotateSPOAroundZType1, + AI_Procedure.RotateSPOAroundZType2, + AI_Procedure.RotateSPOAroundZType3, + AI_Procedure.RotateSPOAroundZType4, + AI_Procedure.RotateSPOAroundAxis, + AI_Procedure.RotateSPOAroundAxisType1, + AI_Procedure.RotateSPOAroundAxisType2, + AI_Procedure.RotateSPOAroundAxisType3, + AI_Procedure.RotateSPOAroundAxisType4, + AI_Procedure.RotateSPOToIdentity, + AI_Procedure.ChangeSPOSighting, + AI_Procedure.ChangeSPOSightingType1, + AI_Procedure.ChangeSPOSightingType2, + AI_Procedure.ChangeSPOSightingType3, + AI_Procedure.ChangeSPOSightingType4, + AI_Procedure.ChangeSPOAnySighting, + AI_Procedure.ChangeSPOAnySightingType1, + AI_Procedure.ChangeSPOAnySightingType2, + AI_Procedure.ChangeSPOAnySightingType3, + AI_Procedure.ChangeSPOAnySightingType4, + AI_Procedure.SetTractionFactor, + AI_Procedure.TurnToPositionAngle, + AI_Procedure.TurnToPositionSpeed, + AI_Procedure.SortArray, + AI_Procedure.ActiveJoystickAnal, + AI_Procedure.UnActiveJoystickAnal, + AI_Procedure.SetZDMSizeSphere, + AI_Procedure.SetZDDSizeCone, + AI_Procedure.ChangeCaractere, + AI_Procedure.FormateTexte, + AI_Procedure.FormateTexteTime, + AI_Procedure.ChangePersoSighting, + AI_Procedure.PlayDemo, + AI_Procedure.PlayAutoDemo, + AI_Procedure.SetCharacterNotResearched, + AI_Procedure.InitKeyBoardDirections, + AI_Procedure.InitKeyBoardBouton, + AI_Procedure.PadSetCenterposition, + AI_Procedure.PadSetMaximalValues, + AI_Procedure.ChangeTooFarLimit, + AI_Procedure.ChangeTransparencyZone, + AI_Procedure.SetBaseFrequenceForMenu, + AI_Procedure.SaveSinusContext, + AI_Procedure.RestoreSinusContext, + AI_Procedure.TextSuperImposed, + AI_Procedure.StartSubAnim, + AI_Procedure.StartSubAnimWithFrame, + AI_Procedure.StartSubAnimSmooth, + AI_Procedure.StartSubAnimSmoothWithFrame, + AI_Procedure.StopSubAnim, + AI_Procedure.WriteCBSubAnim, + AI_Procedure.EndSubAnim, + AI_Procedure.SetDynShadowLevel, + AI_Procedure.SetDynShadowClosed, + AI_Procedure.SetDynShadowSensitive, + AI_Procedure.SetCurrentLanguage, + AI_Procedure.CallSubRoutine, + AI_Procedure.ACTIndiquePlageValeur, + AI_Procedure.ActivateInternalLight, + AI_Procedure.SetInternalLightParams, + AI_Procedure.ToggleCinemascopeOn, + AI_Procedure.ToggleCinemascopeOff, + AI_Procedure.SetCinemascopeRatio, + AI_Procedure.Cam_UpdatePosition, + AI_Procedure.Cam_UpdatePositionLight, + AI_Procedure.Cam_ChangeShiftTarget, + AI_Procedure.Cam_ChangeShiftPos, + AI_Procedure.Cam_ChangeDistMin, + AI_Procedure.Cam_ChangeDistMax, + AI_Procedure.Cam_ChangeBoundDistMin, + AI_Procedure.Cam_ChangeBoundDistMax, + AI_Procedure.Cam_ChangeAngleAlpha, + AI_Procedure.Cam_ChangeAngleShiftAlpha, + AI_Procedure.Cam_ChangeAngleTheta, + AI_Procedure.Cam_ChangeAngleShiftTheta, + AI_Procedure.Cam_ChangeLinearSpeed, + AI_Procedure.Cam_ChangeLinearIncreaseSpeed, + AI_Procedure.Cam_ChangeLinearDecreaseSpeed, + AI_Procedure.Cam_ChangeAngularSpeed, + AI_Procedure.Cam_ChangeAngularIncreaseSpeed, + AI_Procedure.Cam_ChangeAngularDecreaseSpeed, + AI_Procedure.Cam_ChangeTargetSpeed, + AI_Procedure.Cam_ChangeTargetIncreaseSpeed, + AI_Procedure.Cam_ChangeTargetDecreaseSpeed, + AI_Procedure.Cam_ChangeFocal, + AI_Procedure.Cam_ChangeZMin, + AI_Procedure.Cam_ChangeZMax, + AI_Procedure.Cam_ChangeTgtPerso, + AI_Procedure.Cam_ChangeSecondTgtPerso, + AI_Procedure.Cam_ChangeChannel, + AI_Procedure.Cam_Activate, + AI_Procedure.Cam_AssociateViewport, + AI_Procedure.Cam_ResetIAFlags, + AI_Procedure.Cam_SetFlagNoDynamicTarget, + AI_Procedure.Cam_SetFlagNoAverageMoveTgtPerso, + AI_Procedure.Cam_SetFlagNoParseCutAngle, + AI_Procedure.Cam_SetFlagNoVisibility, + AI_Procedure.Cam_SetFlagNoVisibilityWithDynHie, + AI_Procedure.Cam_SetFlagNoDynChangeTheta, + AI_Procedure.Cam_SetFlagNoShiftUntilPosReached, + AI_Procedure.Cam_SetFlagNoDynSpeed, + AI_Procedure.Cam_ResetDNMFlags, + AI_Procedure.Cam_SetFlagNoLinearParsing, + AI_Procedure.Cam_SetFlagNoLinearInertia, + AI_Procedure.Cam_SetFlagNoAngularParsing, + AI_Procedure.Cam_SetFlagNoAngularInertia, + AI_Procedure.Cam_SetFlagNoTargetParsing, + AI_Procedure.Cam_SetFlagNoTargetInertia, + AI_Procedure.Cam_SetFlagFixedOrientation, + AI_Procedure.Cam_SetFlagNoObstacle, + AI_Procedure.Cam_SetFlagNoCollisionWhenNotMoving, + AI_Procedure.Cam_ChangeConstants, + AI_Procedure.Cam_SaveConstants, + AI_Procedure.Cam_RestoreConstants, + AI_Procedure.Cam_ShowInfo, + AI_Procedure.Cam_ForceTarget, + AI_Procedure.Cam_ForcePosition, + AI_Procedure.Cam_ForceRefAxis, + AI_Procedure.Cam_Reset, + AI_Procedure.Cam_ForceBestPos, + AI_Procedure.Cam_ForceNormalState, + AI_Procedure.Cam_ForceMovingOnRail, + AI_Procedure.Cam_SetCameraModeForEngine, + AI_Procedure.Cam_SetCameraTransparencyFlag, + AI_Procedure.InitCamShooter, + AI_Procedure.CSHRegisterIntegerVar, + AI_Procedure.CSHRegisterFloatVar, + AI_Procedure.CSHRegisterVectorVar, + AI_Procedure.CSHRegisterPersoVar, + AI_Procedure.CSHRegisterBooleanVar, + AI_Procedure.CSHGetViewFinderVMT, + AI_Procedure.CSHGetMAComports, + AI_Procedure.CSHInitBackMode, + AI_Procedure.CSHInitMarioMode, + AI_Procedure.CSHInitStrafeLockMode, + AI_Procedure.AddMainActor, + AI_Procedure.RemoveMainActor, + AI_Procedure.SetSkin, + AI_Procedure.SetGCubeVersion, + AI_Procedure.LinkInitAll, + AI_Procedure.SetAgoLink, + AI_Procedure.SetLag, + AI_Procedure.SetGaugeSpeed, + AI_Procedure.SetSendDataRate, + AI_Procedure.SetSendStatusPeriod, + AI_Procedure.SetLaunchSpeed, + AI_Procedure.SetFlagStraight, + AI_Procedure.SetUnlaunch, + AI_Procedure.LaunchAGO, + AI_Procedure.SetAGOClipping, + AI_Procedure.SetInGameMenu, + AI_Procedure.JffTxt_Affiche, + AI_Procedure.JffTxt_AfficheVmsInitPause, + AI_Procedure.JffTxt_AffichePadInitPause, + AI_Procedure.JffTxt_AfficheMultitapInitPause, + AI_Procedure.JffTxt_DemoPressStart, + AI_Procedure.JffTxt_Extend, + AI_Procedure.JffTxt_Modify, + AI_Procedure.JffTxt_PauseDrawStringGame, + AI_Procedure.JffTxt_PauseDrawStringInv, + AI_Procedure.JffTxt_PauseEnable, + AI_Procedure.JffTxt_IAmInTheInventory, + AI_Procedure.JffTxt_PauseInitVars, + AI_Procedure.JffTxt_SetColor, + AI_Procedure.JffTxt_SetTransp, + AI_Procedure.JffTxt_DoFadeIn, + AI_Procedure.JffTxt_DoFadeOut, + AI_Procedure.JffTxt_SetFrameMode, + AI_Procedure.JffTxt_GetBdBox, + AI_Procedure.FadeIn, + AI_Procedure.FadeOut, + AI_Procedure.CheatDoubleSpeed, + AI_Procedure.CheatInvertPad, + AI_Procedure.CheatRandomPad, + AI_Procedure.CheatRandomVignette, + AI_Procedure.MultiPlayer_SetAspectRatio, + AI_Procedure.MultiPlayer_SetNumberOfPlayers, + AI_Procedure.MultiPlayer_SetPlayerForViewport, + AI_Procedure.MultiPlayer_InvertViewports, + AI_Procedure.MultiPlayer_LanceIcone, + AI_Procedure.MultiPlayer_LanceGauge, + AI_Procedure.MultiPlayer_LanceBitmapFile, + AI_Procedure.MultiPlayer_LanceBitmapMemory, + AI_Procedure.MultiPlayer_JFFTXT_Affiche, + AI_Procedure.MultiPlayer_JFFTXT_AfficheOver3D, + AI_Procedure.MultiPlayer_JFFTXT_AfficheOver3DAttenuated, + AI_Procedure.MultiPlayer_SetViewportSizeAndPos, + AI_Procedure.MultiPlayer_SetViewportDisplayOrder, + AI_Procedure.SinEffect_SetSinusPreMultiplier, + AI_Procedure.MultiPlayer_LanceMask, + AI_Procedure.MultiPlayer_LanceBlur, + AI_Procedure.MultiPlayer_Prepare2DSprite, + AI_Procedure.PrintInLogWindow, + AI_Procedure.TransitionDeRLI, + AI_Procedure.AjoutDeRLI, + AI_Procedure.BlockingRLITransitions, + AI_Procedure.EnqueueVideo, + AI_Procedure.PlayVideo, + AI_Procedure.PlayVideoAfterLevel, + AI_Procedure.VideoQuality, + AI_Procedure.SetVsyncWait, + AI_Procedure.ActiveBrainDuringTransitions, + AI_Procedure.DeactiveBrainDuringTransitions, + AI_Procedure.DisplaySegment, + AI_Procedure.EndTransition, + AI_Procedure.StartCine, + AI_Procedure.EndCine, + AI_Procedure.SkipLoading_SetLoadingLevel, + AI_Procedure.SetDataPath, + AI_Procedure.SAV2_DeclareField, + AI_Procedure.SAV2_DeleteField, + AI_Procedure.SAV2_DeleteAllPipeline, + AI_Procedure.SAV2_DeleteAll, + AI_Procedure.SAV2_SetValue, + AI_Procedure.SAV2_SetValueIndex, + AI_Procedure.SAV2_AddSingleValueInPipeline, + AI_Procedure.SAV2_AddSingleValueForSave, + AI_Procedure.SAV2_GetValueString, + AI_Procedure.SAV2_GetValueStringIndex, + AI_Procedure.SAV2_AddArrayInPipeline, + AI_Procedure.SAV2_AddArrayForSave, + AI_Procedure.SAV2_GetArray, + AI_Procedure.SAV2_AutoSaveOnDisk, + AI_Procedure.SAV2_SaveOnDisk, + AI_Procedure.SAV2_LoadOnDisk, + AI_Procedure.SAV2_RemoveSaveOnDisk, + AI_Procedure.SAV2_ActualizeExistingSave, + AI_Procedure.SAV2_GetSaveNameFromSaveNumber, + AI_Procedure.SCT_EnableSectorSynchro, + AI_Procedure.SCT_DisableSectorSynchro, + AI_Procedure.ActivePortal, + AI_Procedure.DeactivePortal, + AI_Procedure.LogFileCreate, + AI_Procedure.LogFileAdd, + AI_Procedure.LogFileSeparator, + AI_Procedure.FFBStartPreCreatedEffect, + AI_Procedure.FFBStopPreCreatedEffect, + AI_Procedure.FFBStopAllEffectForAPad, + AI_Procedure.FFBStopAllEffectForAllPad, + AI_Procedure.FFBPauseAllEffectForAllPad, + AI_Procedure.FFBResumeAllEffectForAllPad, + AI_Procedure.FFBDeletePreCreatedEffect, + AI_Procedure.FFBDeleteAllPreCreatedEffectForAPad, + AI_Procedure.FFBDeleteAllPreCreatedEffectForAllPad, + AI_Procedure.FFBStopEffect, + AI_Procedure.SND_SetMechaSoundCharacter, + AI_Procedure.SND_SetMicroActivation, + AI_Procedure.SND_SaveCurrentTheme, + AI_Procedure.SND_RestoreLastTheme, + AI_Procedure.SND_SendSoundRequest, + AI_Procedure.SND_SendVoiceRequest, + AI_Procedure.SND_SendVoiceRequestWithLipsChannel, + AI_Procedure.SND_SendVoiceRequestWithLipsAuto, + AI_Procedure.SND_SendMusicRequest, + AI_Procedure.SND_SendMusicRequestWithMarkers, + AI_Procedure.SND_SendAmbianceRequest, + AI_Procedure.SND_SendMenuSndRequest, + AI_Procedure.SND_SendSoundRequestSemaphore, + AI_Procedure.SND_SendVoiceRequestSemaphore, + AI_Procedure.SND_SendVoiceRequestWithLipsChannelSemaphore, + AI_Procedure.SND_SendMusicRequestSemaphore, + AI_Procedure.SND_SendAmbianceRequestSemaphore, + AI_Procedure.SND_SendMenuSndRequestSemaphore, + AI_Procedure.SND_ChangeVolumeIdAmbiance, + AI_Procedure.SND_ChangeVolumeIdVoice, + AI_Procedure.SND_ChangeVolumeIdMusic, + AI_Procedure.SND_StopSound, + AI_Procedure.SND_StopVoice, + AI_Procedure.SND_StopMusic, + AI_Procedure.SND_StopAmbiance, + AI_Procedure.SND_StopMenuSnd, + AI_Procedure.SND_StopAllRequests, + AI_Procedure.SND_StopLipsChannel, + AI_Procedure.SND_StopLipsChannelAuto, + AI_Procedure.SND_SetSemaphoreCapacity, + AI_Procedure.SND_KillSemaphore, + AI_Procedure.SND_LoadBank, + AI_Procedure.SND_UnloadBank, + AI_Procedure.SND_SetVolumeSound, + AI_Procedure.SND_SetVolumeVoice, + AI_Procedure.SND_SetVolumeMusic, + AI_Procedure.SND_SetVolumeAmbiance, + AI_Procedure.SND_SetVolumeMenuSnd, + AI_Procedure.SND_ChangeVolumeSound, + AI_Procedure.SND_ChangeVolumeVoice, + AI_Procedure.SND_ChangeVolumeMusic, + AI_Procedure.SND_ChangeVolumeAmbiance, + AI_Procedure.SND_ChangeVolumeMenuSnd, + AI_Procedure.SND_PauseSound, + AI_Procedure.SND_PauseVoice, + AI_Procedure.SND_PauseMusic, + AI_Procedure.SND_PauseAmbiance, + AI_Procedure.SND_PauseMenuSound, + AI_Procedure.SND_PauseAllRequests, + AI_Procedure.SND_ResumeSound, + AI_Procedure.SND_ResumeVoice, + AI_Procedure.SND_ResumeMusic, + AI_Procedure.SND_ResumeAmbiance, + AI_Procedure.SND_ResumeMenuSound, + AI_Procedure.SND_ResumeAllRequests, + AI_Procedure.SND_SetDopplerEffect, + AI_Procedure.SND_SetInStereoMode, + AI_Procedure.SND_SetPrevMusicFadeOut, + AI_Procedure.SND_SetRollOffDistances, + AI_Procedure.SND_SetDefaultRollOffDistances, + AI_Procedure.SND_SaveSoundEventInSlotMemory, + AI_Procedure.SND_RestoreSoundEventInSlotMemory, + AI_Procedure.SND_ResetMusicMarkerSlot, + AI_Procedure.SND_PS2ChangeReverb, + AI_Procedure.SND_PS2SetReverbOn, + AI_Procedure.SND_SendJingleRequest, + AI_Procedure.SetSingleplayerMode, + AI_Procedure.SetMultiplayerMode, + AI_Procedure.DoNotLoadTextures, + AI_Procedure.DoNotLoadMaterialTextures, + AI_Procedure.SetFamilyToLoad, + AI_Procedure.SetActorToLoad, + AI_Procedure.MonitoringStart, + AI_Procedure.MonitoringStop, + AI_Procedure.TobyCreate, + AI_Procedure.TobyAddSegment, + AI_Procedure.TobySetTransparency, + AI_Procedure.TobyDestroy, + AI_Procedure.TobySetMaterial, + AI_Procedure.EnableWidescreen, + AI_Procedure.DisableWidescreen, + AI_Procedure.SetDisplayFrequency, + AI_Procedure.SetSaveGameAccessType, + AI_Procedure.SetFakeSpeedPercentage, + AI_Procedure.ExitFromDemo, + AI_Procedure.SetCurrentValueAsInit, + AI_Procedure.SetCheapCharacterListMinDistance, + AI_Procedure.SetCheapCharacterListMaxDistance, + AI_Procedure.SetCheapCharacterListTimer, + AI_Procedure.SetCheapCharacterListRefObj, + AI_Procedure.SetCheapCharacterListMode, + AI_Procedure.SetCheapCharacterListAura, + AI_Procedure.SetCheapCharacterNewPos, + AI_Procedure.SetCheapCharacterNewDir, + AI_Procedure.AddCheapCharacter, + AI_Procedure.ResetCheapCharacterList, + AI_Procedure.ActivateCheapCharacter, + AI_Procedure.DesactivateCheapCharacter, + AI_Procedure.SetCheapCharacterOptions, + AI_Procedure.R3SetScore, + AI_Procedure.R3SetNbCage, + AI_Procedure.R3SetCurrentEnvNumber, + AI_Procedure.R3SetNbCineOpen, + AI_Procedure.R3SetNbBonusOpen, + AI_Procedure.R3SetAutoSave, + AI_Procedure.R3SetEndOfGame, + AI_Procedure.Placeholder__R3SetGCOnly_1, + AI_Procedure.Placeholder__R3SetGCOnly_2, + AI_Procedure.WaterEffect_SetRandomPerturbationGeneration, + AI_Procedure.WaterEffect_GenerateImpulse, + AI_Procedure.WaterEffect_GenerateSplash, + AI_Procedure.AGO_Kill, + AI_Procedure.AGO_ReInit, + AI_Procedure.TakePicture, + AI_Procedure.ReleasePicture, + AI_Procedure.SFX_ActivateLightReflection, + AI_Procedure.SFX_ActivateWaterCircles, + AI_Procedure.SetActiveMcSlot, + AI_Procedure.GcResetToIpl, + AI_Procedure.ChangeActionSmoothProportional, + AI_Procedure.ChangeActionSmoothSymetric, + AI_Procedure.ChangeActionSmoothNoSpeed, + AI_Procedure.Begin2DMenu, + AI_Procedure.Begin2DMenuStart, + AI_Procedure.Begin2DMenuPhoto, + AI_Procedure.Begin2DMenuBonus, + AI_Procedure.Begin2DMenuBonusExit, + AI_Procedure.AllowNormalsRecomputing, + AI_Procedure.Placeholder__R3GCOnly__LastProcs_1, + AI_Procedure.Placeholder__R3GCOnly__LastProcs_2, + AI_Procedure.Placeholder__R3GCOnly__LastProcs_3, + AI_Procedure.Placeholder__R3GCOnly__LastProcs_4, + AI_Procedure.Placeholder__R3GCOnly__LastProcs_5, + AI_Procedure.Placeholder__R3GCOnly__LastProcs_6, + AI_Procedure.Placeholder__R3GCOnly__LastProcs_7, + AI_Procedure.Placeholder__R3GCOnly__LastProcs_8, + }; + } + #endregion + } +} \ No newline at end of file diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/AI/Types/Rayman3/AI_Types_R3_GC.cs.meta b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/AI/Types/Rayman3/AI_Types_R3_GC.cs.meta new file mode 100644 index 00000000..520b5619 --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/AI/Types/Rayman3/AI_Types_R3_GC.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: d7c9f60cf53befe4481f8d7d8b61a58b +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/AI/Types/Rayman3/AI_Types_R3_PS2.cs b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/AI/Types/Rayman3/AI_Types_R3_PS2.cs new file mode 100644 index 00000000..b67e51cb --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/AI/Types/Rayman3/AI_Types_R3_PS2.cs @@ -0,0 +1,1754 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace BinarySerializer.Ubisoft.CPA { + public class AI_Types_R3_PS2 : AI_Types { + // Re-checked + + #region DsgVar Types + protected override void InitVariableTypes() { + VariableTypes = new AI_DsgVarType[] { + AI_DsgVarType.Boolean, + AI_DsgVarType.SByte, + AI_DsgVarType.UByte, + AI_DsgVarType.Short, + AI_DsgVarType.UShort, + AI_DsgVarType.Int, + AI_DsgVarType.UInt, + AI_DsgVarType.Float, + AI_DsgVarType.Vector, + AI_DsgVarType.List, + AI_DsgVarType.Comport, + AI_DsgVarType.Action, + AI_DsgVarType.Caps, + AI_DsgVarType.Input, + AI_DsgVarType.SoundEvent, + AI_DsgVarType.Light, + AI_DsgVarType.GameMaterial, + AI_DsgVarType.VisualMaterial, + AI_DsgVarType.Perso, + AI_DsgVarType.WayPoint, + AI_DsgVarType.Graph, + AI_DsgVarType.Text, + AI_DsgVarType.SuperObject, + AI_DsgVarType.SOLinks, + AI_DsgVarType.IntegerArray, + AI_DsgVarType.FloatArray, + AI_DsgVarType.VectorArray, + AI_DsgVarType.PersoArray, + AI_DsgVarType.WayPointArray, + AI_DsgVarType.GraphArray, + AI_DsgVarType.TextArray, + AI_DsgVarType.SuperObjectArray, + AI_DsgVarType.SOLinksArray, + AI_DsgVarType.SoundEventArray, + AI_DsgVarType.VisualMatArray, + }; + } + #endregion + + #region Node types + protected override void InitInterpretTypes() { + InterpretTypes = new AI_InterpretType[] { + AI_InterpretType.KeyWord, // 0 + AI_InterpretType.Condition, + AI_InterpretType.Operator, + AI_InterpretType.Function, + AI_InterpretType.Procedure, + AI_InterpretType.MetaAction, // 5 + AI_InterpretType.BeginMacro, + AI_InterpretType.EndMacro, + AI_InterpretType.EndTree, + AI_InterpretType.Field, + AI_InterpretType.DsgVar, // 10 + AI_InterpretType.DsgVarRef, + AI_InterpretType.Constant, + AI_InterpretType.Real, + AI_InterpretType.Button, + AI_InterpretType.ConstantVector, // 15 + AI_InterpretType.Vector, + AI_InterpretType.Mask, + AI_InterpretType.Module, + AI_InterpretType.DsgVarId, + AI_InterpretType.String, // 20 + AI_InterpretType.LipsSynchroRef, + AI_InterpretType.FamilyRef, + AI_InterpretType.PersoRef, + AI_InterpretType.ActionRef, + AI_InterpretType.SuperObjectRef, // 25 + AI_InterpretType.SOLinksRef, + AI_InterpretType.WayPointRef, + AI_InterpretType.TextRef, + AI_InterpretType.ComportRef, + AI_InterpretType.ModuleRef, // 30 + AI_InterpretType.SoundEventRef, + AI_InterpretType.ObjectTableRef, + AI_InterpretType.GameMaterialRef, + AI_InterpretType.VisualMaterialRef, + AI_InterpretType.ParticleGenerator, // 35 + AI_InterpretType.Color, + AI_InterpretType.ModelRef, + AI_InterpretType.Light, + AI_InterpretType.Caps, + AI_InterpretType.Graph, // 40 + AI_InterpretType.MacroRef__Subroutine, // Officially MacroRef + AI_InterpretType.Unknown, // sic + AI_InterpretType.CineRef, + AI_InterpretType.GraphRef + }; + } + #endregion + + #region Keywords + protected override void InitKeywords() { + Keywords = new AI_Keyword[] { + AI_Keyword.If, + AI_Keyword.IfNot, + AI_Keyword.If2, + AI_Keyword.If4, + AI_Keyword.If8, + AI_Keyword.If16, + AI_Keyword.If32, + AI_Keyword.If64, + AI_Keyword.IfNot2, + AI_Keyword.IfNot4, + AI_Keyword.IfNot8, + AI_Keyword.IfNot16, + AI_Keyword.IfNot32, + AI_Keyword.IfNot64, + AI_Keyword.IfDebug, + AI_Keyword.IfNotU64, + AI_Keyword.Then, + AI_Keyword.Else, + AI_Keyword.EngineGoto, + AI_Keyword.Me, + AI_Keyword.MainActor, + AI_Keyword.Nobody, + AI_Keyword.NoInput, + AI_Keyword.NoSoundEvent, + AI_Keyword.NoLight, + AI_Keyword.NoSuperObject, + AI_Keyword.Nowhere, + AI_Keyword.NoSOL, + AI_Keyword.EmptyText, + AI_Keyword.CapsNull, + AI_Keyword.NoGraph, + AI_Keyword.NoAction, + AI_Keyword.NoGameMaterial, + AI_Keyword.NoVisualMaterial, + AI_Keyword.While, + AI_Keyword.BeginWhile, + AI_Keyword.EndWhile, + }; + } + #endregion + + #region Conditions + protected override void InitConditions() { + Conditions = new AI_Condition[] { + AI_Condition.Et, + AI_Condition.Ou, + AI_Condition.Not, + AI_Condition.XOr, + AI_Condition.Equal, + AI_Condition.Different, + AI_Condition.Lesser, + AI_Condition.Greater, + AI_Condition.LesserOrEqual, + AI_Condition.GreaterOrEqual, + AI_Condition.CollidePersoZDDNoWithPerso, + AI_Condition.CollideModuleZDDNoWithPerso, + AI_Condition.CollidePersoAllZDDWithPerso, + AI_Condition.CollidePersoZDDWithAnyPerso, + AI_Condition.CollideModuleZDDWithAnyPerso, + AI_Condition.CollidePersoZDENoWithPersoZDENo, + AI_Condition.CollideModuleZDENoWithPersoZDENo, + AI_Condition.CollidePersoZDENoWithModuleZDENo, + AI_Condition.CollideModuleZDENoWithModuleZDENo, + AI_Condition.CollidePersoZDENoWithPersoTypeZDE, + AI_Condition.CollideModuleZDENoWithPersoTypeZDE, + AI_Condition.CollidePersoTypeZDEWithPersoTypeZDE, + AI_Condition.CollidePersoAllZDEWithPersoAllZDE, + AI_Condition.CollidePersoTypeZDEWithPersoAllZDE, + AI_Condition.CollidePersoAllZDEWithPersoTypeZDE, + AI_Condition.CollidePersoZDENoWithTypeZDE, + AI_Condition.CollideModuleZDENoWithTypeZDE, + AI_Condition.CollideWithGround, + AI_Condition.CollideWithWall, + AI_Condition.CollideWithNothing, + AI_Condition.CollideWithCeiling, + AI_Condition.CollideWithPerso, + AI_Condition.CollideWithWater, + AI_Condition.CollideWithThisPerso, + AI_Condition.ZDMCollideWithGround, + AI_Condition.ZDMCollideWithWall, + AI_Condition.ZDMCollideWithNothing, + AI_Condition.ZDMCollideWithCeiling, + AI_Condition.IsPersoInList, + AI_Condition.IsModelInList, + AI_Condition.IsFamilyInList, + AI_Condition.ListEmptyTest, + AI_Condition.UserEvent_IsSet, + AI_Condition.UserEvent_IsSet2, + AI_Condition.UserEvent_IsSet3, + AI_Condition.PressedBut, + AI_Condition.JustPressedBut, + AI_Condition.ReleasedBut, + AI_Condition.JustReleasedBut, + AI_Condition.IsTimeElapsed, + AI_Condition.IsValidObject, + AI_Condition.IsValidWayPoint, + AI_Condition.IsValidGMT, + AI_Condition.IsValidVMT, + AI_Condition.IsValidAction, + AI_Condition.IsValidText, + AI_Condition.IsValidSPO, + AI_Condition.IsValidGraph, + AI_Condition.SeePerso, + AI_Condition.IsActivable, + AI_Condition.IsAlreadyHandled, + AI_Condition.Alw_IsMine, + AI_Condition.IsPersoLightOn, + AI_Condition.IsPersoLightPulseOn, + AI_Condition.IsPersoLightGyroPhareOn, + AI_Condition.IsRLITransitionInProgress, + AI_Condition.IsInAlwaysActiveList, + AI_Condition.IsAlwaysActive, + AI_Condition.IsAnActivePad, + AI_Condition.IsMultitap, + AI_Condition.SAV2_IsValid, + AI_Condition.IsWidescreen, + AI_Condition.EngineIsInPAL, + AI_Condition.IsZDMCollideWithObstacle, + AI_Condition.IsZDMCollideWithWall, + AI_Condition.IsZDMCollideWithGround, + AI_Condition.IsZDMCollideWithCeiling, + AI_Condition.CmtIdentifierContainsMask, + AI_Condition.HitByCollider, + AI_Condition.IsTypeOfGMTCollide, + AI_Condition.IsInComport, + AI_Condition.IsInReflexComport, + AI_Condition.IsInAction, + AI_Condition.ChangeActionEnable, + AI_Condition.EngineReinitRequested, + AI_Condition.IsThereMechEvent, + AI_Condition.CollisionWP, + AI_Condition.IsCustomBitSet, + AI_Condition.IsPersoActive, + AI_Condition.CheckActionEnd, + AI_Condition.IsCurrentStateCustomBitSet, + AI_Condition.IsGiBlock, + AI_Condition.IsMechanicBlock, + AI_Condition.IsMechanicAnimation, + AI_Condition.IsMechanicCollide, + AI_Condition.IsMechanicGravity, + AI_Condition.IsMechanicTilt, + AI_Condition.IsMechanicGi, + AI_Condition.IsMechanicClimb, + AI_Condition.IsMechanicOnGround, + AI_Condition.IsMechanicSpider, + AI_Condition.IsMechanicShoot, + AI_Condition.IsMechanicSwim, + AI_Condition.IsMechanicNeverFall, + AI_Condition.IsMechanicCollisionControl, + AI_Condition.IsMechanicKeepSpeedZ, + AI_Condition.IsMechanicSpeedLimit, + AI_Condition.IsMechanicInertia, + AI_Condition.IsMechanicStream, + AI_Condition.IsMechanicStickOnPlatform, + AI_Condition.IsMechanicPatformCrash, + AI_Condition.IsMechanicScale, + AI_Condition.IsMechanicExec, + AI_Condition.CanFall, + AI_Condition.IsMechanicCrash, + AI_Condition.IsNullVector, + AI_Condition.HierIsSonOfActor, + AI_Condition.IsMorphing, + AI_Condition.CheckAnimEnd, + AI_Condition.CheckAnimSmooth, + AI_Condition.HasTheCapability, + AI_Condition.HasOneOfTheCapabilities, + AI_Condition.HasTheCapabilityNumber, + AI_Condition.PersoHasTheCapability, + AI_Condition.PersoHasOneOfTheCapabilities, + AI_Condition.PersoHasTheCapabilityNumber, + AI_Condition.MagnetIsActivated, + AI_Condition.NEstPasEnCollisionAvecMap, + AI_Condition.NEstPasEnCollisionAvecProjectile, + AI_Condition.NEstPasEnCollisionAvecSecondCharact, + AI_Condition.NEstPasEnCollisionAvecMainCharact, + AI_Condition.NEstPasEnCollisionAvecAutresSecteurs, + AI_Condition.IsInFamily, + AI_Condition.IsInModel, + AI_Condition.AJoypadIsConnected, + AI_Condition.AKeyJustPressed, + AI_Condition.AButtonPadJustPressed, + AI_Condition.IsInDemoMode, + AI_Condition.IsShapnessMax, + AI_Condition.IsTooFar, + AI_Condition.IsSubAnimPlaying, + AI_Condition.TestCBSubAnim, + AI_Condition.IsInSubAnim, + AI_Condition.IsSubAnimNearEnd, + AI_Condition.IsSameSPO, + AI_Condition.PressedPadBut, + AI_Condition.JustPressedPadBut, + AI_Condition.ReleasedPadBut, + AI_Condition.JustReleasedPadBut, + AI_Condition.IsCinePlaying, + AI_Condition.LoadInProgress, + AI_Condition.SAV2LastError, + AI_Condition.CheckMCStatus, + AI_Condition.Cam_IsActive, + AI_Condition.Cam_IsViewportOwner, + AI_Condition.Cam_IsFlagNoDynamicTarget, + AI_Condition.Cam_IsFlagNoAverageMoveTgtPerso, + AI_Condition.Cam_IsFlagNoParseCutAngle, + AI_Condition.Cam_IsFlagNoVisibility, + AI_Condition.Cam_IsFlagNoVisibilityWithDynHie, + AI_Condition.Cam_IsFlagNoDynChangeTheta, + AI_Condition.Cam_IsFlagNoShiftUntilPosReached, + AI_Condition.Cam_IsFlagNoDynSpeed, + AI_Condition.Cam_IsFlagNoLinearParsing, + AI_Condition.Cam_IsFlagNoLinearInertia, + AI_Condition.Cam_IsFlagNoAngularParsing, + AI_Condition.Cam_IsFlagNoAngularInertia, + AI_Condition.Cam_IsFlagNoTargetParsing, + AI_Condition.Cam_IsFlagNoTargetInertia, + AI_Condition.Cam_IsFlagNoObstacle, + AI_Condition.Cam_IsFlagFixedOrientation, + AI_Condition.Cam_IsFlagForcedPosition, + AI_Condition.Cam_IsFlagForcedTarget, + AI_Condition.Cam_IsFlagForcedAxis, + AI_Condition.SND_IsInStereoMode, + AI_Condition.SND_IsMusicPlaying, + AI_Condition.SND_IsVoicePlaying, + AI_Condition.SND_IsEventValid, + }; + } + #endregion + + #region Meta Actions + protected override void InitMetaActions() { + MetaActions = new AI_MetaAction[] { + AI_MetaAction.FrozenWait, + AI_MetaAction.ExecuteAction, + AI_MetaAction.ExecuteActionSmooth, + AI_MetaAction.WaitEndOfAction, + AI_MetaAction.WaitEndOfAnim, + AI_MetaAction.CamCineMoveAToBTgtC, + AI_MetaAction.CamCineMoveAToBTgtAC, + AI_MetaAction.CamCinePosATgtB, + AI_MetaAction.CamCinePosAMoveTgtBToC, + AI_MetaAction.CamCinePosATgtBTurnPosH, + AI_MetaAction.CamCinePosATgtBTurnTgtH, + AI_MetaAction.CamCinePosATgtBTurnPosV, + AI_MetaAction.CamCinePosATgtBTurnTgtV + }; + } + #endregion + + #region Operators + protected override void InitOperators() { + Operators = new AI_Operator[] { + AI_Operator.ScalarPlusScalar, + AI_Operator.ScalarMinusScalar, + AI_Operator.ScalarMulScalar, + AI_Operator.ScalarDivScalar, + AI_Operator.ScalarUnaryMinus, + AI_Operator.ScalarModulo, + AI_Operator.PlusAffect, + AI_Operator.MinusAffect, + AI_Operator.MulAffect, + AI_Operator.DivAffect, + AI_Operator.PlusPlusAffect, + AI_Operator.MinusMinusAffect, + AI_Operator.Affect, + AI_Operator.Dot, + AI_Operator.GetVectorX, + AI_Operator.GetVectorY, + AI_Operator.GetVectorZ, + AI_Operator.VectorPlusVector, + AI_Operator.VectorMinusVector, + AI_Operator.VectorUnaryMinus, + AI_Operator.VectorMulScalar, + AI_Operator.VectorDivScalar, + AI_Operator.SetVectorX, + AI_Operator.SetVectorY, + AI_Operator.SetVectorZ, + AI_Operator.Ultra, + AI_Operator.ModelCast, + AI_Operator.Array, + AI_Operator.AffectArray, + }; + } + #endregion + + #region Fields + protected override void InitFields() { + Fields = new AI_Field[] { + AI_Field.Position, + AI_Field.Orientation, + AI_Field.Speed, + AI_Field.NormSpeed, + AI_Field.AbsoluteAxisX, + AI_Field.AbsoluteAxisY, + AI_Field.AbsoluteAxisZ, + AI_Field.PrevComportIntell, + AI_Field.PrevComportReflex, + AI_Field.ShadowScaleX, + AI_Field.ShadowScaleY, + AI_Field.PadGlobalVector, + AI_Field.PadHorizontalAxis, + AI_Field.PadVerticalAxis, + AI_Field.PadAnalogForce, + AI_Field.PadTrueAnalogForce, + AI_Field.PadRotationAngle, + AI_Field.PadSector, + AI_Field.SystemData, + AI_Field.SystemTime, + }; + } + #endregion + + #region Functions + protected override void InitFunctions() { + Functions = new AI_Function[] { + AI_Function.GetPersoAbsolutePosition, + AI_Function.GetMyAbsolutePosition, + AI_Function.GetAngleAroundZToPerso, + AI_Function.DistanceToPerso, + AI_Function.DistanceXToPerso, + AI_Function.DistanceYToPerso, + AI_Function.DistanceZToPerso, + AI_Function.DistanceXYToPerso, + AI_Function.DistanceXZToPerso, + AI_Function.DistanceYZToPerso, + AI_Function.DistanceToPersoCenter, + AI_Function.DistanceXToPersoCenter, + AI_Function.DistanceYToPersoCenter, + AI_Function.DistanceZToPersoCenter, + AI_Function.DistanceXYToPersoCenter, + AI_Function.DistanceXZToPersoCenter, + AI_Function.DistanceYZToPersoCenter, + AI_Function.GetRadiusWP, + AI_Function.CircularInterpolationBetween3WP, + AI_Function.BezierBetween3WP, + AI_Function.DistanceToWP, + AI_Function.GetWPAbsolutePosition, + AI_Function.Int, + AI_Function.RandomInt, + AI_Function.Real, + AI_Function.Sinus, + AI_Function.Cosinus, + AI_Function.Square, + AI_Function.SquareRoot, + AI_Function.RandomReal, + AI_Function.MinimumReal, + AI_Function.MaximumReal, + AI_Function.DegreeToRadian, + AI_Function.RadianToDegree, + AI_Function.AbsoluteValue, + AI_Function.LimitRealInRange, + AI_Function.Sign, + AI_Function.Cube, + AI_Function.Modulo, + AI_Function.TernInf, + AI_Function.TernSup, + AI_Function.TernEq, + AI_Function.TernInfEq, + AI_Function.TernSupEq, + AI_Function.TernOp, + AI_Function.TemporalRealCombination, + AI_Function.GetHitPoints, + AI_Function.AddAndGetHitPoints, + AI_Function.SubAndGetHitPoints, + AI_Function.GetHitPointsMax, + AI_Function.AddAndGetHitPointsMax, + AI_Function.SubAndGetHitPointsMax, + AI_Function.ListSize, + AI_Function.GivePersoInList, + AI_Function.AbsoluteVector, + AI_Function.RelativeVector, + AI_Function.VecteurLocalToGlobal, + AI_Function.VecteurGlobalToLocal, + AI_Function.GetMagnetStrength, + AI_Function.GetMagnetFar, + AI_Function.GetMagnetNear, + AI_Function.GetMagnetDuration, + AI_Function.SPO_GetDrawFlag, + AI_Function.GetSPO_GetCollidedSPO, + AI_Function.GetSPO_GetCollidedWallSPO, + AI_Function.GetSPO_GetCollidedCeilingSPO, + AI_Function.GetTime, + AI_Function.GetElapsedTime, + AI_Function.GetDeltaT, + AI_Function.GetFrameLength, + AI_Function.GetFirstActivePad, + AI_Function.InputAnalogicValueX, + AI_Function.InputRealAnalogicValueX, + AI_Function.InputAnalogicValueY, + AI_Function.InputRealAnalogicValueY, + AI_Function.InputAnalogicValue, + AI_Function.InputRealAnalogicValue, + AI_Function.VitessePadAnalogique, + AI_Function.GenerateObject, + AI_Function.CountGeneratedObjects, + AI_Function.GetGlobalCounter, + AI_Function.GetSubMapId, + AI_Function.AddColor, + AI_Function.AddRed, + AI_Function.AddGreen, + AI_Function.AddBlue, + AI_Function.AddAlpha, + AI_Function.ColorRedGreenBlueAlpha, + AI_Function.ColorRedGreenBlue, + AI_Function.ColorRed, + AI_Function.ColorGreen, + AI_Function.ColorBlue, + AI_Function.ColorAlpha, + AI_Function.GetVMTColor, + AI_Function.GetVMTSpecularCoef, + AI_Function.GetVMTSpecularExponent, + AI_Function.GetVMTDiffuseCoef, + AI_Function.GetVMTAmbientCoef, + AI_Function.GetVMTTextureScrollingCoefU, + AI_Function.GetVMTTextureScrollingCoefV, + AI_Function.GetVMTFrame, + AI_Function.GetVMTNumberOfFrames, + AI_Function.MP_GetNumberOfPlayers, + AI_Function.MP_GetMaxNumberOfPlayers, + AI_Function.MP_GetViewPortOfPlayer, + AI_Function.MP_GetActiveMainActors, + AI_Function.PAD_GetHorizontalInvertion, + AI_Function.PAD_GetVerticalInvertion, + AI_Function.GetRLITableIndex, + AI_Function.PAD2_GetGlobalVector, + AI_Function.PAD2_GetHorizontalAxis, + AI_Function.PAD2_GetVerticalAxis, + AI_Function.PAD2_GetAnalogForce, + AI_Function.PAD2_GetTrueAnalogForce, + AI_Function.PAD2_GetRotationAngle, + AI_Function.PAD2_GetPadSector, + AI_Function.PAD2_GetLongDescValue, + AI_Function.TXT_GetNumberOfLines, + AI_Function.InputAnalogicValue2, + AI_Function.InputAnalogicValueV, + AI_Function.InputRealAnalogicValueV, + AI_Function.InputAnalogicValueZ, + AI_Function.InputRealAnalogicValueZ, + AI_Function.SAV2_GetValue, + AI_Function.SAV2_GetValueIndex, + AI_Function.SAV2_GetNumberOfExistingSave, + AI_Function.SAV2_GetTimeSaveGame, + AI_Function.SAV2_GetDateSaveGame, + AI_Function.GetTransitionSectorID, + AI_Function.FFBPreCreateConstantEffect, + AI_Function.FFBCreateAndLaunchConstantEffect, + AI_Function.FFBStopEffectWithFade, + AI_Function.CreateCheapCharacterList, + AI_Function.TestCheapCharacterList, + AI_Function.GetClosestCheapCharacter, + AI_Function.GetFurthestCheapCharacter, + AI_Function.GetReactivateCheapCharacter, + AI_Function.LitPointsDeMagie, + AI_Function.LitPointsDeMagieMax, + AI_Function.AjouteEtLitPointsDeMagie, + AI_Function.AjouteEtLitPointsDeMagieMax, + AI_Function.EnleveEtLitPointsDeMagie, + AI_Function.EnleveEtLitPointsDeMagieMax, + AI_Function.LitPointsDair, + AI_Function.LitPointsDairMax, + AI_Function.AjouteEtLitPointsDair, + AI_Function.AjouteEtLitPointsDairMax, + AI_Function.EnleveEtLitPointsDair, + AI_Function.EnleveEtLitPointsDairMax, + AI_Function.PersoLePlusProche, + AI_Function.PersoLePlusProcheExtended, + AI_Function.PersoLePlusProcheDansSecteurCourant, + AI_Function.PersoLePlusProcheDansSecteurCourantExtended, + AI_Function.NearerActorInFieldOfVision, + AI_Function.NearerActorInFieldOfVisionExtended, + AI_Function.NearerActorOfFamilyInFieldOfVision, + AI_Function.NearerActorOfFamilyInFieldOfVisionExtended, + AI_Function.NearerActorInFieldOfVisionWithOffset, + AI_Function.NearerActorInFieldOfVisionWithOffsetExtended, + AI_Function.NearerActorOfFamilyInFOVWithOffset, + AI_Function.NearerActorOfFamilyInFOVWithOffsetExtended, + AI_Function.GetNbActivePerso, + AI_Function.CibleLaPlusProche, + AI_Function.CibleLaPlusProcheExtended, + AI_Function.CibleLaPlusProcheAvecAngles, + AI_Function.CibleLaPlusProcheAvecAnglesExtended, + AI_Function.GetCloserNetwork, + AI_Function.NetWorkCloserCollisionWP, + AI_Function.ReseauWPLePlusProche, + AI_Function.ReseauWPLePlusProcheZPoids, + AI_Function.NetworkCloserWPOfType, + AI_Function.NetworkCloserCollisionWPOfType, + AI_Function.NetworkCloserWPOfExactType, + AI_Function.ReseauWPLePlusDansLAxe, + AI_Function.ReseauWPLePlusDansLAxe2, + AI_Function.ReseauWPLePlusProcheAvecAngle, + AI_Function.NetworkNextWPWithCapa, + AI_Function.NetworkNextWPWithExactCapa, + AI_Function.NetworkNextWPWithCapaOptimalWeight, + AI_Function.NetworkNextWPOfType, + AI_Function.NetworkNextWPOfExactType, + AI_Function.NetworkAffectTypeOfConnectedWP, + AI_Function.NetworkAffectTypeOfConnectedWPWithCapa, + AI_Function.ReseauCheminLePlusCourt, + AI_Function.NetworkBuildOrderedPath, + AI_Function.NetworkBuildOrderedPathCircular, + AI_Function.NetworkAllocateGraphToMSWay, + AI_Function.NetworkAllocateGraphToMSWayCircular, + AI_Function.NetworkBuildRandomPath, + AI_Function.NetworkBuildRandomCircularPath, + AI_Function.ReseauLitIndexCourant, + AI_Function.ReseauForceIndexCourant, + AI_Function.ReseauLitPremierIndex, + AI_Function.ReseauLitDernierIndex, + AI_Function.ReseauIncrementIndex, + AI_Function.ReseauDecrementIndex, + AI_Function.ReseauLitWPAIndex, + AI_Function.ReseauLitCapaciteLiaisonAIndex, + AI_Function.ReseauChangeCapaciteLiaisonAIndex, + AI_Function.ReseauLitPoidsLiaisonAIndex, + AI_Function.ReseauChangePoidsLiaisonAIndex, + AI_Function.NetworkGetIndexOfWPInMSWay, + AI_Function.NetworkForceWPToCurrent, + AI_Function.NetworkTestTheEnds, + AI_Function.ReseauLitCapaciteLiaisonDansGraph, + AI_Function.ReseauChangeCapaciteLiaisonDansGraph, + AI_Function.ReseauLitPoidsLiaisonDansGraph, + AI_Function.ReseauChangePoidsLiaisonDansGraph, + AI_Function.NetworkGetTypeOfWP, + AI_Function.GetCapabilities, + AI_Function.CapabilityAtBitNumber, + AI_Function.GetScrollSpeed, + AI_Function.MTGetScrollSpeed, + AI_Function.GetNbFrame, + AI_Function.DotProduct, + AI_Function.CrossProduct, + AI_Function.Normalize, + AI_Function.GetSPOCoordinates, + AI_Function.GetSPOSighting, + AI_Function.GetSPOHorizon, + AI_Function.GetSPOBanking, + AI_Function.GetTractionFactor, + AI_Function.GetCenterZDEType, + AI_Function.GetCenterZDMType, + AI_Function.GetCenterZDRType, + AI_Function.GetCenterZDDType, + AI_Function.TextAffiche, + AI_Function.MJTextAffiche, + AI_Function.GetCPUCounter, + AI_Function.TurnToPosition, + AI_Function.FormatMemCard, + AI_Function.GetDefaultLanguage, + AI_Function.PS2_MagicBox, + AI_Function.SAV2_DoVarsNeedToBeSet, + AI_Function.CINEGetGenerateEvent, + AI_Function.StringCompare, + AI_Function.EmptyString, + AI_Function.VitesseHorizontaleDuPerso, + AI_Function.VitesseVerticaleDuPerso, + AI_Function.GetPersoZoomFactor, + AI_Function.GetPersoSighting, + AI_Function.GetPersoHorizon, + AI_Function.GetPersoBanking, + AI_Function.LitPositionZDM, + AI_Function.LitPositionZDE, + AI_Function.LitPositionZDD, + AI_Function.LitCentreZDM, + AI_Function.LitCentreZDE, + AI_Function.LitCentreZDD, + AI_Function.LitAxeZDM, + AI_Function.LitAxeZDE, + AI_Function.LitAxeZDD, + AI_Function.LitDimensionZDM, + AI_Function.LitDimensionZDE, + AI_Function.LitDimensionZDD, + AI_Function.VecteurPointAxe, + AI_Function.VecteurPointSegment, + AI_Function.VectorContribution, + AI_Function.VectorCombination, + AI_Function.TemporalVectorCombination, + AI_Function.ScaledVector, + AI_Function.GetVectorNorm, + AI_Function.RotateVector, + AI_Function.VectorAngle, + AI_Function.VectorCos, + AI_Function.VectorSin, + AI_Function.GetNormalCollideVector, + AI_Function.GetNormalSlopeVector, + AI_Function.GetNormalSlopeVectorAndAngle, + AI_Function.GetNormalCollideVector2, + AI_Function.GetCollidePoint, + AI_Function.GetCollidePoint2, + AI_Function.GetHandsCollidePoint, + AI_Function.GetCollideRate, + AI_Function.GetCollideRate2, + AI_Function.GetCollideMaterialType, + AI_Function.GetCollideMaterialType2, + AI_Function.GetCollideMaterialDirection, + AI_Function.GetCollideMaterialCoeff, + AI_Function.GetCollideMaterialTypeForAi, + AI_Function.GetCollisionPoint, + AI_Function.GetCollisionVector, + AI_Function.GetCollisionPerso, + AI_Function.GetCollisionPointMaterial, + AI_Function.GetFirstCollisionInfo, + AI_Function.GetLastTraversedMaterialType, + AI_Function.GetLastTraversedMaterial, + AI_Function.GetCurrentCollidedGMT, + AI_Function.GetColliderType, + AI_Function.GetColliderActor, + AI_Function.GetColliderVector, + AI_Function.GetColliderReal, + AI_Function.GetLastCollisionActor, + AI_Function.ComputeRebondVector, + AI_Function.GetModuleAbsolutePosition, + AI_Function.GetModuleRelativePosition, + AI_Function.GetModuleZoomFactor, + AI_Function.GetModuleSighting, + AI_Function.GetModuleHorizon, + AI_Function.GetModuleBanking, + AI_Function.CastIntegerToChannel, + AI_Function.GetSlotDate, + AI_Function.GetSlotName, + AI_Function.GetSlotScore, + AI_Function.GetStringCharAt, + AI_Function.ScanAsciiKey, + AI_Function.GetFormattedTextInfo, + AI_Function.GetInputEntryName, + AI_Function.GetMechanicGravityFactor, + AI_Function.GetMechanicSlide, + AI_Function.GetMechanicRebound, + AI_Function.GetMechanicSlopeLimit, + AI_Function.GetMechanicInertiaX, + AI_Function.GetMechanicInertiaY, + AI_Function.GetMechanicInertiaZ, + AI_Function.GetMechanicTiltIntensity, + AI_Function.GetMechanicTiltInertia, + AI_Function.GetMechanicTiltOrigin, + AI_Function.GetMechanicMaxSpeed, + AI_Function.GetMechanicStreamPriority, + AI_Function.GetMechanicStreamSpeed, + AI_Function.GetMechanicStreamFactor, + AI_Function.GetSlideFactorX, + AI_Function.GetSlideFactorY, + AI_Function.GetSlideFactorZ, + AI_Function.JumpImpulsion, + AI_Function.GetSpeedAnim, + AI_Function.HierGetFather, + AI_Function.GetActivationZDD, + AI_Function.GetActivationZDM, + AI_Function.GetActivationZDE, + AI_Function.GetActivationZDR, + AI_Function.GetCollisionFrequency, + AI_Function.GetBrainFrequency, + AI_Function.GetLightFrequency, + AI_Function.GetBooleanInArray, + AI_Function.GetNumberOfBooleanInArray, + AI_Function.GetButtonName, + AI_Function.GetOneCustomFloat, + AI_Function.GetOneCustomLong, + AI_Function.GetOneCustomVector, + AI_Function.GetDriversAvailable, + AI_Function.GetCurrentLanguageId, + AI_Function.GetNbLanguages, + AI_Function.GetLanguageText, + AI_Function.TextToInt, + AI_Function.NbAvailableResolution, + AI_Function.CurrentResolution, + AI_Function.SaveResolution, + AI_Function.IsResolutionAvailable, + AI_Function.GetBrightness, + AI_Function.NameResolution, + AI_Function.GetTextureFiltering, + AI_Function.GetAntiAliasing, + AI_Function.GetSaturationDistance, + AI_Function.GetBackgroundDistance, + AI_Function.GetTooFarLimit, + AI_Function.GetTransparencyZoneMin, + AI_Function.GetTransparencyZoneMax, + AI_Function.GetCurrentFrame, + AI_Function.ExecuteVariable, + AI_Function.ComputeProtectKey, + AI_Function.Xor, + AI_Function.And, + AI_Function.Or, + AI_Function.Not, + AI_Function.DivUnsigned, + AI_Function.MulUnsigned, + AI_Function.AddUnsigned, + AI_Function.SubUnsigned, + AI_Function.GetMemoryValue, + AI_Function.GetXBoxRegion, + AI_Function.CreditsBegin, + AI_Function.CreditsGetChapter, + AI_Function.CreditsGetPageFromCurrentChapter, + AI_Function.Cam_GetShiftTarget, + AI_Function.Cam_GetShiftPos, + AI_Function.Cam_GetDistMin, + AI_Function.Cam_GetDistMax, + AI_Function.Cam_GetBoundDistMin, + AI_Function.Cam_GetBoundDistMax, + AI_Function.Cam_GetAngleAlpha, + AI_Function.Cam_GetAngleShiftAlpha, + AI_Function.Cam_GetAngleTheta, + AI_Function.Cam_GetAngleShiftTheta, + AI_Function.Cam_GetLinearSpeed, + AI_Function.Cam_GetLinearIncreaseSpeed, + AI_Function.Cam_GetLinearDecreaseSpeed, + AI_Function.Cam_GetAngularSpeed, + AI_Function.Cam_GetAngularIncreaseSpeed, + AI_Function.Cam_GetAngularDecreaseSpeed, + AI_Function.Cam_GetTargetSpeed, + AI_Function.Cam_GetTargetIncreaseSpeed, + AI_Function.Cam_GetTargetDecreaseSpeed, + AI_Function.Cam_GetFocal, + AI_Function.Cam_GetZMin, + AI_Function.Cam_GetZMax, + AI_Function.Cam_GetTargetedSuperObject, + AI_Function.Cam_GetTypeOfViewport, + AI_Function.Cam_GetCameraOfViewport, + AI_Function.Cam_GetMainCamera, + AI_Function.Cam_ComputeTargetWithTgtPerso, + AI_Function.Cam_GetCurrentTargetPosition, + AI_Function.Cam_GetSectorCameraType, + AI_Function.Cam_GetBestPos, + AI_Function.Cam_GetTransparencyFlag, + AI_Function.Cam_SetMirrorFlag, + AI_Function.Cam_GetMirrorFlag, + AI_Function.CAM_GetViewportCoordinates, + AI_Function.CSHBackMode, + AI_Function.CSHMarioMode, + AI_Function.CSHStrafeLockMode, + AI_Function.GetViewFinderDistance, + AI_Function.LinkInit, + AI_Function.LinkDoBehaviour, + AI_Function.LinkKill, + AI_Function.LinkGetNoCutpoints, + AI_Function.LinkGetCutPoint, + AI_Function.FollowLinkDirection, + AI_Function.SND_GetSoundHandle, + AI_Function.SND_GetSendSoundRequestHandleState, + AI_Function.SND_GetSendVoiceRequestHandleState, + AI_Function.SND_GetSendMusicRequestHandleState, + AI_Function.SND_GetSendAmbianceRequestHandleState, + AI_Function.SND_GetSendMenuSndRequestHandleState, + AI_Function.SND_GetSoundVolume, + AI_Function.SND_GetVoiceVolume, + AI_Function.SND_GetMusicVolume, + AI_Function.SND_GetAmbianceVolume, + AI_Function.SND_GetMenuSndVolume, + AI_Function.IsSoundPlaying, + AI_Function.SND_GetMusicMarker, + AI_Function.MonitoringSetVariable, + AI_Function.R3GetScore, + AI_Function.R3GetNbCage, + AI_Function.PS2DemoGetParameter, + AI_Function.GetScreenDisplayFrequency, + AI_Function.GetLastSaveGameOperationResult, + AI_Function.SinEffect_GetSinusPosition, + AI_Function.SFX_GetLightReflectionStatus, + AI_Function.SFX_GetWaterCirclesStatus, + AI_Function.SFX_IsLightReflectionPossible, + AI_Function.SFX_IsWaterCirclesPossible, + AI_Function.AGO_GetHandle, + AI_Function.IsMcValid, + AI_Function.FormatMc, + }; + } + #endregion + + #region Procedures + protected override void InitProcedures() { + Procedures = new AI_Procedure[] { + AI_Procedure.SetHitPoints, + AI_Procedure.SetHitPointsInit, + AI_Procedure.SetHitPointsToInitValue, + AI_Procedure.SetHitPointsToMaxValue, + AI_Procedure.AddHitPoints, + AI_Procedure.SubHitPoints, + AI_Procedure.SetHitPointsMax, + AI_Procedure.SetHitPointsMaxToInitValue, + AI_Procedure.SetHitPointsMaxToMaxValue, + AI_Procedure.AddHitPointsMax, + AI_Procedure.SubHitPointsMax, + AI_Procedure.TransparentDisplay, + AI_Procedure.SetTransparency, + AI_Procedure.ACT_SetDrawFlag, + AI_Procedure.SkinMaterial, + AI_Procedure.SkinIndex, + AI_Procedure.ModuleTransparentDisplay, + AI_Procedure.ModuleTransparentDisplay2, + AI_Procedure.SetModuleTransparency, + AI_Procedure.SetModuleTransparency2, + AI_Procedure.ListAffectPersoZDD, + AI_Procedure.ListAffectModuleZDD, + AI_Procedure.ListAffectPersoZDE, + AI_Procedure.ListAffectModuleZDE, + AI_Procedure.ListAffectPersoTypeZDE, + AI_Procedure.ListAffectModuleTypeZDE, + AI_Procedure.ListAffectTypeZDEWithTypeZDE, + AI_Procedure.AddPersoInList, + AI_Procedure.AddPersoInListAt, + AI_Procedure.DeletePersoAtInList, + AI_Procedure.FindPersoAndDeleteInList, + AI_Procedure.ListSelect, + AI_Procedure.ListUnSelect, + AI_Procedure.ListSort, + AI_Procedure.ListSortByFamily, + AI_Procedure.ListSortByModel, + AI_Procedure.FillListWithAllPersoOfAFamily, + AI_Procedure.FillListWithAllPersoOfAModel, + AI_Procedure.DeleteFamilyInList, + AI_Procedure.DeleteModelInList, + AI_Procedure.ListUnion, + AI_Procedure.ListInter, + AI_Procedure.ListDiff, + AI_Procedure.ListAdd, + AI_Procedure.FogActivate, + AI_Procedure.SetFogColor, + AI_Procedure.SetFogNearFarInf, + AI_Procedure.SetFogBlend, + AI_Procedure.RestoreFog, + AI_Procedure.SaveFog, + AI_Procedure.Magnet_ActiveMagnet, + AI_Procedure.Magnet_DeactiveMagnet, + AI_Procedure.Magnet_SetStrength, + AI_Procedure.Magnet_SetFar, + AI_Procedure.Magnet_SetNear, + AI_Procedure.Magnet_SetDuration, + AI_Procedure.FootPath_AddFootPrint, + AI_Procedure.FootPath_Clear, + AI_Procedure.SinEffect_SetFreq, + AI_Procedure.SinEffect_SetAmplitude, + AI_Procedure.SinEffect_SetState, + AI_Procedure.SinEffect_SetFreq3D, + AI_Procedure.SinEffect_SetFreq3DMesh, + AI_Procedure.SinEffect_SetFreq3DRLI, + AI_Procedure.SinEffect_SetRLIAmplitude, + AI_Procedure.SinEffect_SetRLIBase, + AI_Procedure.SPO_SetDrawFlag, + AI_Procedure.SPO_SetEngineDisplayModeFlag, + AI_Procedure.DeactivateBut, + AI_Procedure.ActivateBut, + AI_Procedure.None, + AI_Procedure.Trace, + AI_Procedure.ChangeComport, + AI_Procedure.ChangeComportReflex, + AI_Procedure.ChangeMyComport, + AI_Procedure.ChangeMyComportReflex, + AI_Procedure.ChangeMyComportAndMyReflex, + AI_Procedure.ChangeAction, + AI_Procedure.ChangeActionForce, + AI_Procedure.ChangeActionRandom, + AI_Procedure.ChangeActionWithEvents, + AI_Procedure.ChangeActionSmooth, + AI_Procedure.ChangeActionForceSmooth, + AI_Procedure.ChangeActionRandomSmooth, + AI_Procedure.ChangeActionWithEventsSmooth, + AI_Procedure.ChangeActionSmoothNL, + AI_Procedure.ChangeActionForceSmoothNL, + AI_Procedure.ChangeActionRandomSmoothNL, + AI_Procedure.ChangeActionWithEventsSmoothNL, + AI_Procedure.Boucle, + AI_Procedure.FinBoucle, + AI_Procedure.Break, + AI_Procedure.PlayerIsDead, + AI_Procedure.ResetDynamicsWithCard, + AI_Procedure.BreakAI, + AI_Procedure.IgnoreTraceFlagForNextPicking, + AI_Procedure.SetMainActor, + AI_Procedure.ActivateObject, + AI_Procedure.DesactivateObject, + AI_Procedure.ChangeMap, + AI_Procedure.ChangeMapWithTransition, + AI_Procedure.ChangeMapNoAutosave, + AI_Procedure.SetActionReturn, + AI_Procedure.FactorAnimationFrameRate, + AI_Procedure.SetCharacterPriority, + AI_Procedure.ForcePersoHandling, + AI_Procedure.SetDynamicAlwaysActive, + AI_Procedure.PlayerIsDeadWithPlacement, + AI_Procedure.SwapLinkTableObjects, + AI_Procedure.ReinitTableObjects, + AI_Procedure.ChangeCurrentObjectTable, + AI_Procedure.BuildObjectTableFromTableAndString, + AI_Procedure.BuildObjectTableFromFormattedString, + AI_Procedure.TakeModuleControl, + AI_Procedure.TakeManyModulesControl, + AI_Procedure.ReleaseModuleControl, + AI_Procedure.QuitGame, + AI_Procedure.ActivateChannel, + AI_Procedure.DeactivateChannel, + AI_Procedure.PersoLightOn, + AI_Procedure.PersoLightOff, + AI_Procedure.SetPersoLightColor, + AI_Procedure.SetPersoLightNearFar, + AI_Procedure.SetPersoLightLittleBigAlpha, + AI_Procedure.SetPersoLightGyrophare, + AI_Procedure.SetPersoLightPulse, + AI_Procedure.SetPersoLightParalleleType, + AI_Procedure.SetPersoLightSphericalType, + AI_Procedure.SetPersoLightHotSpotType, + AI_Procedure.SetPersoLightAmbientType, + AI_Procedure.DefaultDisplay, + AI_Procedure.DisplayVignette, + AI_Procedure.DeleteVignette, + AI_Procedure.PRT_SetGeneratorOn, + AI_Procedure.PRT_SetGeneratorOff, + AI_Procedure.PRT_SetGenerator, + AI_Procedure.PRT_SetModeNone, + AI_Procedure.PRT_SetModeContinuous, + AI_Procedure.PRT_SetModeCrenel, + AI_Procedure.PRT_SetModeProbability, + AI_Procedure.PRT_SetNumberConstant, + AI_Procedure.PRT_SetNumberProbabilist, + AI_Procedure.PRT_SetInfiniteLifeTime, + AI_Procedure.PRT_SetConstantLifeTime, + AI_Procedure.PRT_SetPobabilistLifeTime, + AI_Procedure.Turn, + AI_Procedure.Turn2, + AI_Procedure.DeltaTurnPerso, + AI_Procedure.TurnPerso, + AI_Procedure.KillPerso, + AI_Procedure.KillPersoAndClearVariable, + AI_Procedure.DeletePersoFromGame, + AI_Procedure.SetVMTColor, + AI_Procedure.SetVMTSpecularExponent, + AI_Procedure.SetVMTSpecularCoef, + AI_Procedure.SetVMTDiffuseCoef, + AI_Procedure.SetVMTAmbientCoef, + AI_Procedure.SetVMTAsChromed, + AI_Procedure.SetVMTTextureScrollingCoef, + AI_Procedure.LockVMT, + AI_Procedure.UnlockVMT, + AI_Procedure.SetVMTFrame, + AI_Procedure.OptionChangeDetailsValue, + AI_Procedure.OptionChangeActionKey, + AI_Procedure.OptionConfigureKey, + AI_Procedure.OptionGetCurrentKeyValue, + AI_Procedure.OptionChangeKeyValue, + AI_Procedure.OptionResetKeyValueToDefault, + AI_Procedure.BatchSetPersoAtModulePosition, + AI_Procedure.BatchSetPersoOrientation, + AI_Procedure.BatchSetPersoAtPerso, + AI_Procedure.SetPersoAbsolutePosition, + AI_Procedure.SetPersoAtModulePosition, + AI_Procedure.ForcePersoAveragePosition, + AI_Procedure.RelativeMovePerso, + AI_Procedure.ChangePersoAnySighting, + AI_Procedure.ChangePersoSightingWithOffset, + AI_Procedure.RotatePersoAroundX, + AI_Procedure.RotatePersoAroundY, + AI_Procedure.RotatePersoAroundZ, + AI_Procedure.RotatePersoAroundVector, + AI_Procedure.RotatePersoAroundVectorWithOffset, + AI_Procedure.RotatePersoAroundXwithOffset, + AI_Procedure.RotatePersoAroundYwithOffset, + AI_Procedure.RotatePersoAroundZwithOffset, + AI_Procedure.SetFullPersoOrientation, + AI_Procedure.SetFullPersoOrientationWithOffset, + AI_Procedure.ZoomPerso, + AI_Procedure.ChangeOneCustomBit, + AI_Procedure.ChangeManyCustomBits, + AI_Procedure.ChangeManyCustomBitsExtended, + AI_Procedure.ChangeOneCustomFloat, + AI_Procedure.ChangeOneCustomLong, + AI_Procedure.ChangeOneCustomVector, + AI_Procedure.ImposeSpeed, + AI_Procedure.ImposeSpeedX, + AI_Procedure.ImposeSpeedY, + AI_Procedure.ImposeSpeedZ, + AI_Procedure.ImposeSpeedXY, + AI_Procedure.ImposeSpeedXYZ, + AI_Procedure.ImposeAbsoluteSpeed, + AI_Procedure.ImposeAbsoluteSpeedX, + AI_Procedure.ImposeAbsoluteSpeedY, + AI_Procedure.ImposeAbsoluteSpeedZ, + AI_Procedure.ImposeAbsoluteSpeedXY, + AI_Procedure.ImposeAbsoluteSpeedXYZ, + AI_Procedure.ProposeSpeed, + AI_Procedure.ProposeSpeedX, + AI_Procedure.ProposeSpeedY, + AI_Procedure.ProposeSpeedZ, + AI_Procedure.ProposeSpeedXY, + AI_Procedure.ProposeSpeedXYZ, + AI_Procedure.ProposeAbsoluteSpeed, + AI_Procedure.ProposeAbsoluteSpeedX, + AI_Procedure.ProposeAbsoluteSpeedY, + AI_Procedure.ProposeAbsoluteSpeedZ, + AI_Procedure.ProposeAbsoluteSpeedXY, + AI_Procedure.ProposeAbsoluteSpeedXYZ, + AI_Procedure.FixePositionPerso, + AI_Procedure.FixePositionPersoWithInterpol, + AI_Procedure.AddSpeed, + AI_Procedure.AddSpeedX, + AI_Procedure.AddSpeedY, + AI_Procedure.AddSpeedZ, + AI_Procedure.AddSpeedXY, + AI_Procedure.AddSpeedXYZ, + AI_Procedure.AddAbsoluteSpeed, + AI_Procedure.AddAbsoluteSpeedX, + AI_Procedure.AddAbsoluteSpeedY, + AI_Procedure.AddAbsoluteSpeedZ, + AI_Procedure.AddAbsoluteSpeedXY, + AI_Procedure.AddAbsoluteSpeedXYZ, + AI_Procedure.PrepareMorph, + AI_Procedure.PrepareMorphMT, + AI_Procedure.StopMorph, + AI_Procedure.StopAllMorph, + AI_Procedure.Morphing, + AI_Procedure.MorphingMT, + AI_Procedure.ReleaseAllModulesControl, + AI_Procedure.ChangeModuleSighting, + AI_Procedure.SetModuleAbsolutePosition, + AI_Procedure.RelativeMoveModule, + AI_Procedure.ChangeModuleSightingWithOffset, + AI_Procedure.RotateModuleAroundX, + AI_Procedure.RotateModuleAroundY, + AI_Procedure.RotateModuleAroundZ, + AI_Procedure.RotateModuleAroundVector, + AI_Procedure.RotateModuleAroundVectorWithOffset, + AI_Procedure.RotateModuleAroundXwithOffset, + AI_Procedure.RotateModuleAroundYwithOffset, + AI_Procedure.RotateModuleAroundZwithOffset, + AI_Procedure.SetFullModuleOrientation, + AI_Procedure.SetFullModuleOrientationWithOffset, + AI_Procedure.ZoomModule, + AI_Procedure.SetColliderType, + AI_Procedure.SetColliderActor, + AI_Procedure.SetColliderVector, + AI_Procedure.SetColliderReal, + AI_Procedure.ReinitCollider, + AI_Procedure.ResetLastCollisionActor, + AI_Procedure.ClearCollisionReport, + AI_Procedure.SetGoThroughMechanicsHandling, + AI_Procedure.EraseLastGoThroughMaterial, + AI_Procedure.ChangeTextDefaultColor, + AI_Procedure.CreateTextWithParamFormat, + AI_Procedure.CreateTextWith2ParamsFormat, + AI_Procedure.StringAddChar, + AI_Procedure.StringReplaceChar, + AI_Procedure.StringRemoveChar, + AI_Procedure.ChangeLanguage, + AI_Procedure.IntToText, + AI_Procedure.FloatToText, + AI_Procedure.SetMechanicAnimation, + AI_Procedure.SetMechanicCollide, + AI_Procedure.SetMechanicGravity, + AI_Procedure.SetMechanicTilt, + AI_Procedure.SetMechanicGi, + AI_Procedure.SetMechanicClimb, + AI_Procedure.SetMechanicOnGround, + AI_Procedure.SetMechanicSpider, + AI_Procedure.SetMechanicShoot, + AI_Procedure.SetMechanicSwim, + AI_Procedure.SetMechanicNeverFall, + AI_Procedure.SetMechanicNewMechanic, + AI_Procedure.SetMechanicCollisionControl, + AI_Procedure.SetMechanicKeepSpeedZ, + AI_Procedure.SetMechanicSpeedLimit, + AI_Procedure.SetMechanicInertia, + AI_Procedure.SetMechanicStream, + AI_Procedure.SetMechanicStickOnPlatform, + AI_Procedure.SetMechanicScale, + AI_Procedure.SetMechanicGravityFactor, + AI_Procedure.SetMechanicSlide, + AI_Procedure.SetMechanicRebound, + AI_Procedure.SetMechanicSlopeLimit, + AI_Procedure.SetMechanicInertiaX, + AI_Procedure.SetMechanicInertiaY, + AI_Procedure.SetMechanicInertiaZ, + AI_Procedure.SetMechanicInertiaXYZ, + AI_Procedure.SetMechanicTiltIntensity, + AI_Procedure.SetMechanicTiltInertia, + AI_Procedure.SetMechanicTiltOrigin, + AI_Procedure.SetMechanicSpeedMax, + AI_Procedure.SetMechanicStreamPriority, + AI_Procedure.SetMechanicStreamSpeed, + AI_Procedure.SetMechanicStreamFactor, + AI_Procedure.AddMechanicStreamSpeed, + AI_Procedure.AddMechanicStreamSpeedList, + AI_Procedure.MoveLimit, + AI_Procedure.MoveLimitX, + AI_Procedure.MoveLimitY, + AI_Procedure.MoveLimitZ, + AI_Procedure.MoveLimitXYZ, + AI_Procedure.StopMoveLimitX, + AI_Procedure.StopMoveLimitY, + AI_Procedure.StopMoveLimitZ, + AI_Procedure.StopMoveLimitXYZ, + AI_Procedure.SetPlatformLink, + AI_Procedure.FreePlatformLink, + AI_Procedure.MecSetScale, + AI_Procedure.MecSetSlideFactorXYZ, + AI_Procedure.MecSetSlideFactorX, + AI_Procedure.MecSetSlideFactorY, + AI_Procedure.MecSetSlideFactorZ, + AI_Procedure.MecSetClimbSpeedLimit, + AI_Procedure.MecSetHangingLimit, + AI_Procedure.MecSetHangingOff, + AI_Procedure.MecSetBaseCoeff, + AI_Procedure.MecSetWalkCoeff, + AI_Procedure.HierSetFather, + AI_Procedure.HierFreeFather, + AI_Procedure.HierListOfSon, + AI_Procedure.HierSetPlatformType, + AI_Procedure.HierControlLink, + AI_Procedure.HierFreezeEngine, + AI_Procedure.FixePositionZDM, + AI_Procedure.FixePositionZDD, + AI_Procedure.FixePositionZDE, + AI_Procedure.ChangeGameMaterialZDE, + AI_Procedure.ChangeLightIntensity, + AI_Procedure.SPO_ChangeFlag, + AI_Procedure.SPO_ChangeFlagRecursively, + AI_Procedure.ActChangeSpoFlag, + AI_Procedure.ChangeScreenSize, + AI_Procedure.ChangeScreenClip, + AI_Procedure.ChangeScreenPos, + AI_Procedure.ChangeScreenPosPercent, + AI_Procedure.ChangeScreenPosPerThousand, + AI_Procedure.ChangeScreenRatio, + AI_Procedure.DisplayShadow, + AI_Procedure.ChangeShadowHeight, + AI_Procedure.ChangeShadowVector, + AI_Procedure.ForceActivationZDD, + AI_Procedure.ForceActivationZDM, + AI_Procedure.ForceActivationZDE, + AI_Procedure.ForceActivationZDR, + AI_Procedure.ForceDesactivationZDD, + AI_Procedure.ForceDesactivationZDM, + AI_Procedure.ForceDesactivationZDE, + AI_Procedure.ForceDesactivationZDR, + AI_Procedure.LibereActivationZDD, + AI_Procedure.LibereActivationZDM, + AI_Procedure.LibereActivationZDE, + AI_Procedure.LibereActivationZDR, + AI_Procedure.ActiveZDR, + AI_Procedure.SetNoCollisionWithMap, + AI_Procedure.SetNoCollisionWithProjectile, + AI_Procedure.SetNoCollisionWithSecondCharact, + AI_Procedure.SetNoCollisionWithMainCharact, + AI_Procedure.SetNoCollisionWithOtherSectors, + AI_Procedure.SetNoCollisionZdeWithProjectile, + AI_Procedure.SetCollComputeFrequency, + AI_Procedure.SetBrainComputeFrequency, + AI_Procedure.SetLightComputeFrequency, + AI_Procedure.SetUsedExitIdentifier, + AI_Procedure.GetUsedExitIdentifier, + AI_Procedure.SetGlobalCounter, + AI_Procedure.ReadAnalogJoystick, + AI_Procedure.SetAnalogJoystickAxes, + AI_Procedure.GetPadCalibration, + AI_Procedure.SetPadCalibration, + AI_Procedure.CancelKeyboardInertia, + AI_Procedure.SetAnalogJoystickAxes2, + AI_Procedure.ReleaseAnalogJoystick, + AI_Procedure.SetBooleanInArray, + AI_Procedure.SetDefaultFormatCharacter, + AI_Procedure.SelectDriver, + AI_Procedure.SelectShapnessMax, + AI_Procedure.CenterScreen, + AI_Procedure.SelectResolution, + AI_Procedure.ChangeBrightness, + AI_Procedure.TexteEntier, + AI_Procedure.TexteReel, + AI_Procedure.SetTextureFiltering, + AI_Procedure.SetAntiAliasing, + AI_Procedure.DrawSegment, + AI_Procedure.UpdateChecksum, + AI_Procedure.ShellExecute, + AI_Procedure.ChangeSightingAccordingTime, + AI_Procedure.PAD2_SetGlobalVector, + AI_Procedure.PAD2_SetHorizontalAxis, + AI_Procedure.PAD2_SetVerticalAxis, + AI_Procedure.PAD2_SetAnalogForce, + AI_Procedure.PAD2_SetTrueAnalogForce, + AI_Procedure.PAD2_SetRotationAngle, + AI_Procedure.PAD2_SetPadSector, + AI_Procedure.PAD2_SetLongDescValue, + AI_Procedure.SetModifierModeNormal, + AI_Procedure.SetModifierModeLight, + AI_Procedure.SetModifierModeRGB, + AI_Procedure.ValidateMemoryCard, + AI_Procedure.AddMemoryCardString, + AI_Procedure.SetGlobalAccelerationFactorForAnims, + AI_Procedure.FixePointsDeMagie, + AI_Procedure.FixePointsDeMagieMax, + AI_Procedure.InitPointsDeMagie, + AI_Procedure.InitPointsDeMagieMax, + AI_Procedure.AjoutePointsDeMagie, + AI_Procedure.AjoutePointsDeMagieMax, + AI_Procedure.EnlevePointsDeMagie, + AI_Procedure.EnlevePointsDeMagieMax, + AI_Procedure.FixePointsDair, + AI_Procedure.FixePointsDairMax, + AI_Procedure.InitPointsDair, + AI_Procedure.InitPointsDairMax, + AI_Procedure.AjoutePointsDair, + AI_Procedure.AjoutePointsDairMax, + AI_Procedure.EnlevePointsDair, + AI_Procedure.EnlevePointsDairMax, + AI_Procedure.FixePositionFade, + AI_Procedure.FixeLumierePersoLocal, + AI_Procedure.FixeLumierePersoOnOff, + AI_Procedure.FixeLumiereStaticOnOff, + AI_Procedure.FixeLumiereStaticNearFar, + AI_Procedure.FixeLumiereStaticColor, + AI_Procedure.CalculeLumiere, + AI_Procedure.CalculeLumiereAvecOmbres, + AI_Procedure.NoRLI, + AI_Procedure.FixeRLI, + AI_Procedure.BlendRLI, + AI_Procedure.SetRadiusWP, + AI_Procedure.SetPositionAbsWP, + AI_Procedure.SetPositionRelWP, + AI_Procedure.ChangeTypeOfWP, + AI_Procedure.SetCapabilities, + AI_Procedure.AddCapabilities, + AI_Procedure.SubCapabilities, + AI_Procedure.ChangeCapabilities, + AI_Procedure.WPIndiquePlageValeur, + AI_Procedure.ReinitGraph, + AI_Procedure.FixeVitesseTexture, + AI_Procedure.ScrollingOnOff, + AI_Procedure.FixeDecalageTexture, + AI_Procedure.ScrollingPause, + AI_Procedure.ChangeCurrFrame, + AI_Procedure.ChangeRandomFrame, + AI_Procedure.FreezeAnim, + AI_Procedure.UnFreezeAnim, + AI_Procedure.SetDiscreetSpeed, + AI_Procedure.SetSuperimposed, + AI_Procedure.MJ_SetSuperimposed, + AI_Procedure.SetSuperimposed2, + AI_Procedure.ReleaseSuperimposed, + AI_Procedure.SetSuperimposedClipping, + AI_Procedure.ResetSuperimposedClipping, + AI_Procedure.SetOutlineMode, + AI_Procedure.SetOutlineModeSPO, + AI_Procedure.SetSPOCoordinates, + AI_Procedure.SetSPOCoordinatesAndMoveType1, + AI_Procedure.SetSPOCoordinatesAndMoveType2, + AI_Procedure.SetSPOCoordinatesAndMoveType3, + AI_Procedure.SetSPOCoordinatesAndMoveType4, + AI_Procedure.SetSPOCoordsNoInt, + AI_Procedure.SetSPOCoordsAndMoveType1NoInt, + AI_Procedure.SetSPOCoordsAndMoveType2NoInt, + AI_Procedure.SetSPOCoordsAndMoveType3NoInt, + AI_Procedure.SetSPOCoordsAndMoveType4NoInt, + AI_Procedure.SetSOLFromWorldOrigin_SPOParam, + AI_Procedure.SetSOLFromInit_SPOParam, + AI_Procedure.SetSOLFromHere_SPOParam, + AI_Procedure.SetSOLToInit_SPOParam, + AI_Procedure.ReinitSOL_SPOParam, + AI_Procedure.SetSOLFromWorldOrigin_SOLParam, + AI_Procedure.SetSOLFromInit_SOLParam, + AI_Procedure.SetSOLFromHere_SOLParam, + AI_Procedure.SetSOLToInit_SOLParam, + AI_Procedure.ReinitSOL_SOLParam, + AI_Procedure.SOLAddCharacter, + AI_Procedure.SOLAddWaypoint, + AI_Procedure.SOLAddObject, + AI_Procedure.SOLDeleteCharacter, + AI_Procedure.SOLDeleteWaypoint, + AI_Procedure.SOLDeleteObject, + AI_Procedure.SwitchSuperimposedTab, + AI_Procedure.RotateSPOAroundX, + AI_Procedure.RotateSPOAroundXType1, + AI_Procedure.RotateSPOAroundXType2, + AI_Procedure.RotateSPOAroundXType3, + AI_Procedure.RotateSPOAroundXType4, + AI_Procedure.RotateSPOAroundY, + AI_Procedure.RotateSPOAroundYType1, + AI_Procedure.RotateSPOAroundYType2, + AI_Procedure.RotateSPOAroundYType3, + AI_Procedure.RotateSPOAroundYType4, + AI_Procedure.RotateSPOAroundZ, + AI_Procedure.RotateSPOAroundZType1, + AI_Procedure.RotateSPOAroundZType2, + AI_Procedure.RotateSPOAroundZType3, + AI_Procedure.RotateSPOAroundZType4, + AI_Procedure.RotateSPOAroundAxis, + AI_Procedure.RotateSPOAroundAxisType1, + AI_Procedure.RotateSPOAroundAxisType2, + AI_Procedure.RotateSPOAroundAxisType3, + AI_Procedure.RotateSPOAroundAxisType4, + AI_Procedure.RotateSPOToIdentity, + AI_Procedure.ChangeSPOSighting, + AI_Procedure.ChangeSPOSightingType1, + AI_Procedure.ChangeSPOSightingType2, + AI_Procedure.ChangeSPOSightingType3, + AI_Procedure.ChangeSPOSightingType4, + AI_Procedure.ChangeSPOAnySighting, + AI_Procedure.ChangeSPOAnySightingType1, + AI_Procedure.ChangeSPOAnySightingType2, + AI_Procedure.ChangeSPOAnySightingType3, + AI_Procedure.ChangeSPOAnySightingType4, + AI_Procedure.SetTractionFactor, + AI_Procedure.TurnToPositionAngle, + AI_Procedure.TurnToPositionSpeed, + AI_Procedure.SortArray, + AI_Procedure.ActiveJoystickAnal, + AI_Procedure.UnActiveJoystickAnal, + AI_Procedure.SetZDMSizeSphere, + AI_Procedure.SetZDDSizeCone, + AI_Procedure.ChangeCaractere, + AI_Procedure.FormateTexte, + AI_Procedure.FormateTexteTime, + AI_Procedure.ChangePersoSighting, + AI_Procedure.PlayDemo, + AI_Procedure.PlayAutoDemo, + AI_Procedure.SetCharacterNotResearched, + AI_Procedure.InitKeyBoardDirections, + AI_Procedure.InitKeyBoardBouton, + AI_Procedure.PadSetCenterposition, + AI_Procedure.PadSetMaximalValues, + AI_Procedure.ChangeTooFarLimit, + AI_Procedure.ChangeTransparencyZone, + AI_Procedure.SetBaseFrequenceForMenu, + AI_Procedure.SaveSinusContext, + AI_Procedure.RestoreSinusContext, + AI_Procedure.TextSuperImposed, + AI_Procedure.StartSubAnim, + AI_Procedure.StartSubAnimWithFrame, + AI_Procedure.StartSubAnimSmooth, + AI_Procedure.StartSubAnimSmoothWithFrame, + AI_Procedure.StopSubAnim, + AI_Procedure.WriteCBSubAnim, + AI_Procedure.EndSubAnim, + AI_Procedure.SetDynShadowLevel, + AI_Procedure.SetDynShadowClosed, + AI_Procedure.SetDynShadowSensitive, + AI_Procedure.SetCurrentLanguage, + AI_Procedure.CallSubRoutine, + AI_Procedure.ACTIndiquePlageValeur, + AI_Procedure.ActivateInternalLight, + AI_Procedure.SetInternalLightParams, + AI_Procedure.ToggleCinemascopeOn, + AI_Procedure.ToggleCinemascopeOff, + AI_Procedure.SetCinemascopeRatio, + AI_Procedure.Cam_UpdatePosition, + AI_Procedure.Cam_UpdatePositionLight, + AI_Procedure.Cam_ChangeShiftTarget, + AI_Procedure.Cam_ChangeShiftPos, + AI_Procedure.Cam_ChangeDistMin, + AI_Procedure.Cam_ChangeDistMax, + AI_Procedure.Cam_ChangeBoundDistMin, + AI_Procedure.Cam_ChangeBoundDistMax, + AI_Procedure.Cam_ChangeAngleAlpha, + AI_Procedure.Cam_ChangeAngleShiftAlpha, + AI_Procedure.Cam_ChangeAngleTheta, + AI_Procedure.Cam_ChangeAngleShiftTheta, + AI_Procedure.Cam_ChangeLinearSpeed, + AI_Procedure.Cam_ChangeLinearIncreaseSpeed, + AI_Procedure.Cam_ChangeLinearDecreaseSpeed, + AI_Procedure.Cam_ChangeAngularSpeed, + AI_Procedure.Cam_ChangeAngularIncreaseSpeed, + AI_Procedure.Cam_ChangeAngularDecreaseSpeed, + AI_Procedure.Cam_ChangeTargetSpeed, + AI_Procedure.Cam_ChangeTargetIncreaseSpeed, + AI_Procedure.Cam_ChangeTargetDecreaseSpeed, + AI_Procedure.Cam_ChangeFocal, + AI_Procedure.Cam_ChangeZMin, + AI_Procedure.Cam_ChangeZMax, + AI_Procedure.Cam_ChangeTgtPerso, + AI_Procedure.Cam_ChangeSecondTgtPerso, + AI_Procedure.Cam_ChangeChannel, + AI_Procedure.Cam_Activate, + AI_Procedure.Cam_AssociateViewport, + AI_Procedure.Cam_ResetIAFlags, + AI_Procedure.Cam_SetFlagNoDynamicTarget, + AI_Procedure.Cam_SetFlagNoAverageMoveTgtPerso, + AI_Procedure.Cam_SetFlagNoParseCutAngle, + AI_Procedure.Cam_SetFlagNoVisibility, + AI_Procedure.Cam_SetFlagNoVisibilityWithDynHie, + AI_Procedure.Cam_SetFlagNoDynChangeTheta, + AI_Procedure.Cam_SetFlagNoShiftUntilPosReached, + AI_Procedure.Cam_SetFlagNoDynSpeed, + AI_Procedure.Cam_ResetDNMFlags, + AI_Procedure.Cam_SetFlagNoLinearParsing, + AI_Procedure.Cam_SetFlagNoLinearInertia, + AI_Procedure.Cam_SetFlagNoAngularParsing, + AI_Procedure.Cam_SetFlagNoAngularInertia, + AI_Procedure.Cam_SetFlagNoTargetParsing, + AI_Procedure.Cam_SetFlagNoTargetInertia, + AI_Procedure.Cam_SetFlagFixedOrientation, + AI_Procedure.Cam_SetFlagNoObstacle, + AI_Procedure.Cam_SetFlagNoCollisionWhenNotMoving, + AI_Procedure.Cam_ChangeConstants, + AI_Procedure.Cam_SaveConstants, + AI_Procedure.Cam_RestoreConstants, + AI_Procedure.Cam_ShowInfo, + AI_Procedure.Cam_ForceTarget, + AI_Procedure.Cam_ForcePosition, + AI_Procedure.Cam_ForceRefAxis, + AI_Procedure.Cam_Reset, + AI_Procedure.Cam_ForceBestPos, + AI_Procedure.Cam_ForceNormalState, + AI_Procedure.Cam_ForceMovingOnRail, + AI_Procedure.Cam_SetCameraModeForEngine, + AI_Procedure.Cam_SetCameraTransparencyFlag, + AI_Procedure.InitCamShooter, + AI_Procedure.CSHRegisterIntegerVar, + AI_Procedure.CSHRegisterFloatVar, + AI_Procedure.CSHRegisterVectorVar, + AI_Procedure.CSHRegisterPersoVar, + AI_Procedure.CSHRegisterBooleanVar, + AI_Procedure.CSHGetViewFinderVMT, + AI_Procedure.CSHGetMAComports, + AI_Procedure.CSHInitBackMode, + AI_Procedure.CSHInitMarioMode, + AI_Procedure.CSHInitStrafeLockMode, + AI_Procedure.AddMainActor, + AI_Procedure.RemoveMainActor, + AI_Procedure.SetSkin, + AI_Procedure.SetGCubeVersion, + AI_Procedure.LinkInitAll, + AI_Procedure.SetAgoLink, + AI_Procedure.SetLag, + AI_Procedure.SetGaugeSpeed, + AI_Procedure.SetSendDataRate, + AI_Procedure.SetSendStatusPeriod, + AI_Procedure.SetLaunchSpeed, + AI_Procedure.SetFlagStraight, + AI_Procedure.SetUnlaunch, + AI_Procedure.LaunchAGO, + AI_Procedure.SetAGOClipping, + AI_Procedure.SetInGameMenu, + AI_Procedure.JffTxt_Affiche, + AI_Procedure.JffTxt_AfficheVmsInitPause, + AI_Procedure.JffTxt_AffichePadInitPause, + AI_Procedure.JffTxt_AfficheMultitapInitPause, + AI_Procedure.JffTxt_DemoPressStart, + AI_Procedure.JffTxt_Extend, + AI_Procedure.JffTxt_Modify, + AI_Procedure.JffTxt_PauseDrawStringGame, + AI_Procedure.JffTxt_PauseDrawStringInv, + AI_Procedure.JffTxt_PauseEnable, + AI_Procedure.JffTxt_IAmInTheInventory, + AI_Procedure.JffTxt_PauseInitVars, + AI_Procedure.JffTxt_SetColor, + AI_Procedure.JffTxt_SetTransp, + AI_Procedure.JffTxt_DoFadeIn, + AI_Procedure.JffTxt_DoFadeOut, + AI_Procedure.JffTxt_SetFrameMode, + AI_Procedure.JffTxt_GetBdBox, + AI_Procedure.FadeIn, + AI_Procedure.FadeOut, + AI_Procedure.CheatDoubleSpeed, + AI_Procedure.CheatInvertPad, + AI_Procedure.CheatRandomPad, + AI_Procedure.CheatRandomVignette, + AI_Procedure.MultiPlayer_SetAspectRatio, + AI_Procedure.MultiPlayer_SetNumberOfPlayers, + AI_Procedure.MultiPlayer_SetPlayerForViewport, + AI_Procedure.MultiPlayer_InvertViewports, + AI_Procedure.MultiPlayer_LanceIcone, + AI_Procedure.MultiPlayer_LanceGauge, + AI_Procedure.MultiPlayer_LanceBitmapFile, + AI_Procedure.MultiPlayer_LanceBitmapMemory, + AI_Procedure.MultiPlayer_JFFTXT_Affiche, + AI_Procedure.MultiPlayer_JFFTXT_AfficheOver3D, + AI_Procedure.MultiPlayer_JFFTXT_AfficheOver3DAttenuated, + AI_Procedure.MultiPlayer_SetViewportSizeAndPos, + AI_Procedure.MultiPlayer_SetViewportDisplayOrder, + AI_Procedure.SinEffect_SetSinusPreMultiplier, + AI_Procedure.MultiPlayer_LanceMask, + AI_Procedure.MultiPlayer_LanceBlur, + AI_Procedure.MultiPlayer_Prepare2DSprite, + AI_Procedure.PrintInLogWindow, + AI_Procedure.TransitionDeRLI, + AI_Procedure.AjoutDeRLI, + AI_Procedure.BlockingRLITransitions, + AI_Procedure.EnqueueVideo, + AI_Procedure.PlayVideo, + AI_Procedure.PlayVideoAfterLevel, + AI_Procedure.VideoQuality, + AI_Procedure.SetVsyncWait, + AI_Procedure.ActiveBrainDuringTransitions, + AI_Procedure.DeactiveBrainDuringTransitions, + AI_Procedure.DisplaySegment, + AI_Procedure.EndTransition, + AI_Procedure.StartCine, + AI_Procedure.EndCine, + AI_Procedure.SkipLoading_SetLoadingLevel, + AI_Procedure.SetDataPath, + AI_Procedure.SAV2_DeclareField, + AI_Procedure.SAV2_DeleteField, + AI_Procedure.SAV2_DeleteAllPipeline, + AI_Procedure.SAV2_DeleteAll, + AI_Procedure.SAV2_SetValue, + AI_Procedure.SAV2_SetValueIndex, + AI_Procedure.SAV2_AddSingleValueInPipeline, + AI_Procedure.SAV2_AddSingleValueForSave, + AI_Procedure.SAV2_GetValueString, + AI_Procedure.SAV2_GetValueStringIndex, + AI_Procedure.SAV2_AddArrayInPipeline, + AI_Procedure.SAV2_AddArrayForSave, + AI_Procedure.SAV2_GetArray, + AI_Procedure.SAV2_AutoSaveOnDisk, + AI_Procedure.SAV2_SaveOnDisk, + AI_Procedure.SAV2_LoadOnDisk, + AI_Procedure.SAV2_RemoveSaveOnDisk, + AI_Procedure.SAV2_ActualizeExistingSave, + AI_Procedure.SAV2_GetSaveNameFromSaveNumber, + AI_Procedure.SCT_EnableSectorSynchro, + AI_Procedure.SCT_DisableSectorSynchro, + AI_Procedure.ActivePortal, + AI_Procedure.DeactivePortal, + AI_Procedure.LogFileCreate, + AI_Procedure.LogFileAdd, + AI_Procedure.LogFileSeparator, + AI_Procedure.FFBStartPreCreatedEffect, + AI_Procedure.FFBStopPreCreatedEffect, + AI_Procedure.FFBStopAllEffectForAPad, + AI_Procedure.FFBStopAllEffectForAllPad, + AI_Procedure.FFBPauseAllEffectForAllPad, + AI_Procedure.FFBResumeAllEffectForAllPad, + AI_Procedure.FFBDeletePreCreatedEffect, + AI_Procedure.FFBDeleteAllPreCreatedEffectForAPad, + AI_Procedure.FFBDeleteAllPreCreatedEffectForAllPad, + AI_Procedure.FFBStopEffect, + AI_Procedure.SND_SetMechaSoundCharacter, + AI_Procedure.SND_SetMicroActivation, + AI_Procedure.SND_SaveCurrentTheme, + AI_Procedure.SND_RestoreLastTheme, + AI_Procedure.SND_SendSoundRequest, + AI_Procedure.SND_SendVoiceRequest, + AI_Procedure.SND_SendVoiceRequestWithLipsChannel, + AI_Procedure.SND_SendVoiceRequestWithLipsAuto, + AI_Procedure.SND_SendMusicRequest, + AI_Procedure.SND_SendMusicRequestWithMarkers, + AI_Procedure.SND_SendAmbianceRequest, + AI_Procedure.SND_SendMenuSndRequest, + AI_Procedure.SND_SendSoundRequestSemaphore, + AI_Procedure.SND_SendVoiceRequestSemaphore, + AI_Procedure.SND_SendVoiceRequestWithLipsChannelSemaphore, + AI_Procedure.SND_SendMusicRequestSemaphore, + AI_Procedure.SND_SendAmbianceRequestSemaphore, + AI_Procedure.SND_SendMenuSndRequestSemaphore, + AI_Procedure.SND_ChangeVolumeIdAmbiance, + AI_Procedure.SND_ChangeVolumeIdVoice, + AI_Procedure.SND_ChangeVolumeIdMusic, + AI_Procedure.SND_StopSound, + AI_Procedure.SND_StopVoice, + AI_Procedure.SND_StopMusic, + AI_Procedure.SND_StopAmbiance, + AI_Procedure.SND_StopMenuSnd, + AI_Procedure.SND_StopAllRequests, + AI_Procedure.SND_StopLipsChannel, + AI_Procedure.SND_StopLipsChannelAuto, + AI_Procedure.SND_SetSemaphoreCapacity, + AI_Procedure.SND_KillSemaphore, + AI_Procedure.SND_LoadBank, + AI_Procedure.SND_UnloadBank, + AI_Procedure.SND_SetVolumeSound, + AI_Procedure.SND_SetVolumeVoice, + AI_Procedure.SND_SetVolumeMusic, + AI_Procedure.SND_SetVolumeAmbiance, + AI_Procedure.SND_SetVolumeMenuSnd, + AI_Procedure.SND_ChangeVolumeSound, + AI_Procedure.SND_ChangeVolumeVoice, + AI_Procedure.SND_ChangeVolumeMusic, + AI_Procedure.SND_ChangeVolumeAmbiance, + AI_Procedure.SND_ChangeVolumeMenuSnd, + AI_Procedure.SND_PauseSound, + AI_Procedure.SND_PauseVoice, + AI_Procedure.SND_PauseMusic, + AI_Procedure.SND_PauseAmbiance, + AI_Procedure.SND_PauseMenuSound, + AI_Procedure.SND_PauseAllRequests, + AI_Procedure.SND_ResumeSound, + AI_Procedure.SND_ResumeVoice, + AI_Procedure.SND_ResumeMusic, + AI_Procedure.SND_ResumeAmbiance, + AI_Procedure.SND_ResumeMenuSound, + AI_Procedure.SND_ResumeAllRequests, + AI_Procedure.SND_SetDopplerEffect, + AI_Procedure.SND_SetInStereoMode, + AI_Procedure.SND_SetPrevMusicFadeOut, + AI_Procedure.SND_SetRollOffDistances, + AI_Procedure.SND_SetDefaultRollOffDistances, + AI_Procedure.SND_SaveSoundEventInSlotMemory, + AI_Procedure.SND_RestoreSoundEventInSlotMemory, + AI_Procedure.SND_ResetMusicMarkerSlot, + AI_Procedure.SND_PS2ChangeReverb, + AI_Procedure.SND_PS2SetReverbOn, + AI_Procedure.SND_SendJingleRequest, + AI_Procedure.SetSingleplayerMode, + AI_Procedure.SetMultiplayerMode, + AI_Procedure.DoNotLoadTextures, + AI_Procedure.DoNotLoadMaterialTextures, + AI_Procedure.SetFamilyToLoad, + AI_Procedure.SetActorToLoad, + AI_Procedure.MonitoringStart, + AI_Procedure.MonitoringStop, + AI_Procedure.TobyCreate, + AI_Procedure.TobyAddSegment, + AI_Procedure.TobySetTransparency, + AI_Procedure.TobyDestroy, + AI_Procedure.TobySetMaterial, + AI_Procedure.EnableWidescreen, + AI_Procedure.DisableWidescreen, + AI_Procedure.SetDisplayFrequency, + AI_Procedure.SetSaveGameAccessType, + AI_Procedure.SetFakeSpeedPercentage, + AI_Procedure.ExitFromDemo, + AI_Procedure.SetCurrentValueAsInit, + AI_Procedure.SetCheapCharacterListMinDistance, + AI_Procedure.SetCheapCharacterListMaxDistance, + AI_Procedure.SetCheapCharacterListTimer, + AI_Procedure.SetCheapCharacterListRefObj, + AI_Procedure.SetCheapCharacterListMode, + AI_Procedure.SetCheapCharacterListAura, + AI_Procedure.SetCheapCharacterNewPos, + AI_Procedure.SetCheapCharacterNewDir, + AI_Procedure.AddCheapCharacter, + AI_Procedure.ResetCheapCharacterList, + AI_Procedure.ActivateCheapCharacter, + AI_Procedure.DesactivateCheapCharacter, + AI_Procedure.SetCheapCharacterOptions, + AI_Procedure.R3SetScore, + AI_Procedure.R3SetNbCage, + AI_Procedure.R3SetCurrentEnvNumber, + AI_Procedure.R3SetNbCineOpen, + AI_Procedure.R3SetNbBonusOpen, + AI_Procedure.R3SetAutoSave, + AI_Procedure.R3SetEndOfGame, + AI_Procedure.WaterEffect_SetRandomPerturbationGeneration, + AI_Procedure.WaterEffect_GenerateImpulse, + AI_Procedure.WaterEffect_GenerateSplash, + AI_Procedure.AGO_Kill, + AI_Procedure.AGO_ReInit, + AI_Procedure.TakePicture, + AI_Procedure.ReleasePicture, + AI_Procedure.SFX_ActivateLightReflection, + AI_Procedure.SFX_ActivateWaterCircles, + AI_Procedure.SetActiveMcSlot, + AI_Procedure.GcResetToIpl, + AI_Procedure.ChangeActionSmoothProportional, + AI_Procedure.ChangeActionSmoothSymetric, + AI_Procedure.ChangeActionSmoothNoSpeed, + AI_Procedure.Begin2DMenu, + AI_Procedure.Begin2DMenuStart, + AI_Procedure.Begin2DMenuPhoto, + AI_Procedure.Begin2DMenuBonus, + AI_Procedure.Begin2DMenuBonusExit, + AI_Procedure.AllowNormalsRecomputing, + }; + } + #endregion + + } +} diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/AI/Types/Rayman3/AI_Types_R3_PS2.cs.meta b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/AI/Types/Rayman3/AI_Types_R3_PS2.cs.meta new file mode 100644 index 00000000..51b70cdf --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/AI/Types/Rayman3/AI_Types_R3_PS2.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: e8f80cedcc14a5d42aff94f129547081 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/AI/Types/RaymanArena.meta b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/AI/Types/RaymanArena.meta new file mode 100644 index 00000000..ac1bf8ac --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/AI/Types/RaymanArena.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: f988ec467b84f564195df64647f85a09 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/AI/Types/RaymanArena/AI_Types_RA_PS2.cs b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/AI/Types/RaymanArena/AI_Types_RA_PS2.cs new file mode 100644 index 00000000..5b78ae97 --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/AI/Types/RaymanArena/AI_Types_RA_PS2.cs @@ -0,0 +1,1552 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace BinarySerializer.Ubisoft.CPA { + public class AI_Types_RA_PS2 : AI_Types_R3_PS2 { + + // Checked + + #region Conditions + protected override void InitConditions() { + Conditions = new AI_Condition[] { + AI_Condition.Et, + AI_Condition.Ou, + AI_Condition.Not, + AI_Condition.XOr, + AI_Condition.Equal, + AI_Condition.Different, + AI_Condition.Lesser, + AI_Condition.Greater, + AI_Condition.LesserOrEqual, + AI_Condition.GreaterOrEqual, + AI_Condition.CollidePersoZDDNoWithPerso, + AI_Condition.CollideModuleZDDNoWithPerso, + AI_Condition.CollidePersoAllZDDWithPerso, + AI_Condition.CollidePersoZDDWithAnyPerso, + AI_Condition.CollideModuleZDDWithAnyPerso, + AI_Condition.CollidePersoZDENoWithPersoZDENo, + AI_Condition.CollideModuleZDENoWithPersoZDENo, + AI_Condition.CollidePersoZDENoWithModuleZDENo, + AI_Condition.CollideModuleZDENoWithModuleZDENo, + AI_Condition.CollidePersoZDENoWithPersoTypeZDE, + AI_Condition.CollideModuleZDENoWithPersoTypeZDE, + AI_Condition.CollidePersoTypeZDEWithPersoTypeZDE, + AI_Condition.CollidePersoAllZDEWithPersoAllZDE, + AI_Condition.CollidePersoTypeZDEWithPersoAllZDE, + AI_Condition.CollidePersoAllZDEWithPersoTypeZDE, + AI_Condition.CollidePersoZDENoWithTypeZDE, + AI_Condition.CollideModuleZDENoWithTypeZDE, + AI_Condition.CollideWithGround, + AI_Condition.CollideWithWall, + AI_Condition.CollideWithNothing, + AI_Condition.CollideWithCeiling, + AI_Condition.CollideWithPerso, + AI_Condition.CollideWithWater, + AI_Condition.CollideWithThisPerso, + AI_Condition.ZDMCollideWithGround, + AI_Condition.ZDMCollideWithWall, + AI_Condition.ZDMCollideWithNothing, + AI_Condition.ZDMCollideWithCeiling, + AI_Condition.IsPersoInList, + AI_Condition.IsModelInList, + AI_Condition.IsFamilyInList, + AI_Condition.ListEmptyTest, + AI_Condition.UserEvent_IsSet, + AI_Condition.UserEvent_IsSet2, + AI_Condition.PressedBut, + AI_Condition.JustPressedBut, + AI_Condition.ReleasedBut, + AI_Condition.JustReleasedBut, + AI_Condition.IsTimeElapsed, + AI_Condition.IsValidObject, + AI_Condition.IsValidWayPoint, + AI_Condition.IsValidGMT, + AI_Condition.IsValidVMT, + AI_Condition.IsValidAction, + AI_Condition.IsValidText, + AI_Condition.IsValidSPO, + AI_Condition.IsValidGraph, + AI_Condition.IsSpeechOver, + AI_Condition.SeePerso, + AI_Condition.IsActivable, + AI_Condition.IsAlreadyHandled, + AI_Condition.Alw_IsMine, + AI_Condition.IsPersoLightOn, + AI_Condition.IsPersoLightPulseOn, + AI_Condition.IsPersoLightGyroPhareOn, + AI_Condition.IsRLITransitionInProgress, + AI_Condition.IsInAlwaysActiveList, + AI_Condition.IsAlwaysActive, + AI_Condition.IsAnActivePad, + AI_Condition.IsMultitap, + AI_Condition.SAV2_IsValid, + AI_Condition.IsWidescreen, + AI_Condition.IsZDMCollideWithObstacle, + AI_Condition.IsZDMCollideWithWall, + AI_Condition.IsZDMCollideWithGround, + AI_Condition.IsZDMCollideWithCeiling, + AI_Condition.CmtIdentifierContainsMask, + AI_Condition.HitByCollider, + AI_Condition.IsTypeOfGMTCollide, + AI_Condition.IsInComport, + AI_Condition.IsInReflexComport, + AI_Condition.IsInAction, + AI_Condition.ChangeActionEnable, + AI_Condition.EngineReinitRequested, + AI_Condition.IsThereMechEvent, + AI_Condition.CollisionWP, + AI_Condition.IsCustomBitSet, + AI_Condition.IsPersoActive, + AI_Condition.CheckActionEnd, + AI_Condition.IsCurrentStateCustomBitSet, + AI_Condition.IsGiBlock, + AI_Condition.IsMechanicBlock, + AI_Condition.IsMechanicAnimation, + AI_Condition.IsMechanicCollide, + AI_Condition.IsMechanicGravity, + AI_Condition.IsMechanicTilt, + AI_Condition.IsMechanicGi, + AI_Condition.IsMechanicClimb, + AI_Condition.IsMechanicOnGround, + AI_Condition.IsMechanicSpider, + AI_Condition.IsMechanicShoot, + AI_Condition.IsMechanicSwim, + AI_Condition.IsMechanicNeverFall, + AI_Condition.IsMechanicCollisionControl, + AI_Condition.IsMechanicKeepSpeedZ, + AI_Condition.IsMechanicSpeedLimit, + AI_Condition.IsMechanicInertia, + AI_Condition.IsMechanicStream, + AI_Condition.IsMechanicStickOnPlatform, + AI_Condition.IsMechanicPatformCrash, + AI_Condition.IsMechanicScale, + AI_Condition.IsMechanicExec, + AI_Condition.CanFall, + AI_Condition.IsMechanicCrash, + AI_Condition.IsNullVector, + AI_Condition.HierIsSonOfActor, + AI_Condition.IsMorphing, + AI_Condition.CheckAnimEnd, + AI_Condition.CheckAnimSmooth, + AI_Condition.HasTheCapability, + AI_Condition.HasOneOfTheCapabilities, + AI_Condition.HasTheCapabilityNumber, + AI_Condition.PersoHasTheCapability, + AI_Condition.PersoHasOneOfTheCapabilities, + AI_Condition.PersoHasTheCapabilityNumber, + AI_Condition.MagnetIsActivated, + AI_Condition.NEstPasEnCollisionAvecMap, + AI_Condition.NEstPasEnCollisionAvecProjectile, + AI_Condition.NEstPasEnCollisionAvecSecondCharact, + AI_Condition.NEstPasEnCollisionAvecMainCharact, + AI_Condition.NEstPasEnCollisionAvecAutresSecteurs, + AI_Condition.IsInFamily, + AI_Condition.IsInModel, + AI_Condition.AJoypadIsConnected, + AI_Condition.AKeyJustPressed, + AI_Condition.AButtonPadJustPressed, + AI_Condition.IsInDemoMode, + AI_Condition.IsShapnessMax, + AI_Condition.IsTooFar, + AI_Condition.IsSubAnimPlaying, + AI_Condition.TestCBSubAnim, + AI_Condition.IsInSubAnim, + AI_Condition.IsSameSPO, + AI_Condition.PressedPadBut, + AI_Condition.JustPressedPadBut, + AI_Condition.ReleasedPadBut, + AI_Condition.JustReleasedPadBut, + AI_Condition.IsCinePlaying, + AI_Condition.SAV2LastError, + AI_Condition.CheckMCStatus, + AI_Condition.Cam_IsActive, + AI_Condition.Cam_IsViewportOwner, + AI_Condition.Cam_IsFlagNoDynamicTarget, + AI_Condition.Cam_IsFlagNoAverageMoveTgtPerso, + AI_Condition.Cam_IsFlagNoParseCutAngle, + AI_Condition.Cam_IsFlagNoVisibility, + AI_Condition.Cam_IsFlagNoVisibilityWithDynHie, + AI_Condition.Cam_IsFlagNoDynChangeTheta, + AI_Condition.Cam_IsFlagNoShiftUntilPosReached, + AI_Condition.Cam_IsFlagNoDynSpeed, + AI_Condition.Cam_IsFlagNoLinearParsing, + AI_Condition.Cam_IsFlagNoLinearInertia, + AI_Condition.Cam_IsFlagNoAngularParsing, + AI_Condition.Cam_IsFlagNoAngularInertia, + AI_Condition.Cam_IsFlagNoTargetParsing, + AI_Condition.Cam_IsFlagNoTargetInertia, + AI_Condition.Cam_IsFlagNoObstacle, + AI_Condition.Cam_IsFlagFixedOrientation, + AI_Condition.Cam_IsFlagForcedPosition, + AI_Condition.Cam_IsFlagForcedTarget, + AI_Condition.Cam_IsFlagForcedAxis, + AI_Condition.SND_IsInStereoMode, + AI_Condition.SND_IsMusicPlaying, + AI_Condition.NetNeedDataDescription, + AI_Condition.NetWasUpdated, + AI_Condition.NetWasBooleanUpdated, + AI_Condition.NetWasPersoUpdated, + AI_Condition.NetWasIntegerUpdated, + AI_Condition.NetWasVectorUpdated, + AI_Condition.NetWasRealUpdated, + AI_Condition.NetGetEvent, + AI_Condition.NetIsPlayerConnected, + }; + } + #endregion + + #region Functions + protected override void InitFunctions() { + Functions = new AI_Function[] { + AI_Function.GetPersoAbsolutePosition, + AI_Function.GetMyAbsolutePosition, + AI_Function.GetAngleAroundZToPerso, + AI_Function.DistanceToPerso, + AI_Function.DistanceXToPerso, + AI_Function.DistanceYToPerso, + AI_Function.DistanceZToPerso, + AI_Function.DistanceXYToPerso, + AI_Function.DistanceXZToPerso, + AI_Function.DistanceYZToPerso, + AI_Function.DistanceToPersoCenter, + AI_Function.DistanceXToPersoCenter, + AI_Function.DistanceYToPersoCenter, + AI_Function.DistanceZToPersoCenter, + AI_Function.DistanceXYToPersoCenter, + AI_Function.DistanceXZToPersoCenter, + AI_Function.DistanceYZToPersoCenter, + AI_Function.GetRadiusWP, + AI_Function.CircularInterpolationBetween3WP, + AI_Function.DistanceToWP, + AI_Function.GetWPAbsolutePosition, + AI_Function.Int, + AI_Function.RandomInt, + AI_Function.Real, + AI_Function.Sinus, + AI_Function.Cosinus, + AI_Function.Square, + AI_Function.SquareRoot, + AI_Function.RandomReal, + AI_Function.MinimumReal, + AI_Function.MaximumReal, + AI_Function.DegreeToRadian, + AI_Function.RadianToDegree, + AI_Function.AbsoluteValue, + AI_Function.LimitRealInRange, + AI_Function.Sign, + AI_Function.Cube, + AI_Function.Modulo, + AI_Function.TernInf, + AI_Function.TernSup, + AI_Function.TernEq, + AI_Function.TernInfEq, + AI_Function.TernSupEq, + AI_Function.TernOp, + AI_Function.TemporalRealCombination, + AI_Function.GetHitPoints, + AI_Function.AddAndGetHitPoints, + AI_Function.SubAndGetHitPoints, + AI_Function.GetHitPointsMax, + AI_Function.AddAndGetHitPointsMax, + AI_Function.SubAndGetHitPointsMax, + AI_Function.ListSize, + AI_Function.GivePersoInList, + AI_Function.AbsoluteVector, + AI_Function.RelativeVector, + AI_Function.VecteurLocalToGlobal, + AI_Function.VecteurGlobalToLocal, + AI_Function.GetMagnetStrength, + AI_Function.GetMagnetFar, + AI_Function.GetMagnetNear, + AI_Function.GetMagnetDuration, + AI_Function.SPO_GetDrawFlag, + AI_Function.GetSPO_GetCollidedSPO, + AI_Function.GetSPO_GetCollidedWallSPO, + AI_Function.GetSPO_GetCollidedCeilingSPO, + AI_Function.GetTime, + AI_Function.GetElapsedTime, + AI_Function.GetDeltaT, + AI_Function.GetFrameLength, + AI_Function.GetFirstActivePad, + AI_Function.InputAnalogicValueX, + AI_Function.InputAnalogicValueY, + AI_Function.InputAnalogicValue, + AI_Function.VitessePadAnalogique, + AI_Function.GenerateObject, + AI_Function.CountGeneratedObjects, + AI_Function.GetGlobalCounter, + AI_Function.GetSubMapId, + AI_Function.AddColor, + AI_Function.AddRed, + AI_Function.AddGreen, + AI_Function.AddBlue, + AI_Function.AddAlpha, + AI_Function.ColorRedGreenBlueAlpha, + AI_Function.ColorRedGreenBlue, + AI_Function.ColorRed, + AI_Function.ColorGreen, + AI_Function.ColorBlue, + AI_Function.ColorAlpha, + AI_Function.GetVMTColor, + AI_Function.GetVMTSpecularCoef, + AI_Function.GetVMTSpecularExponent, + AI_Function.GetVMTDiffuseCoef, + AI_Function.GetVMTAmbientCoef, + AI_Function.GetVMTTextureScrollingCoefU, + AI_Function.GetVMTTextureScrollingCoefV, + AI_Function.GetVMTFrame, + AI_Function.GetVMTNumberOfFrames, + AI_Function.MP_GetNumberOfPlayers, + AI_Function.MP_GetMaxNumberOfPlayers, + AI_Function.MP_GetViewPortOfPlayer, + AI_Function.MP_GetActiveMainActors, + AI_Function.GetRLITableIndex, + AI_Function.PAD2_GetGlobalVector, + AI_Function.PAD2_GetHorizontalAxis, + AI_Function.PAD2_GetVerticalAxis, + AI_Function.PAD2_GetAnalogForce, + AI_Function.PAD2_GetTrueAnalogForce, + AI_Function.PAD2_GetRotationAngle, + AI_Function.PAD2_GetPadSector, + AI_Function.TXT_GetNumberOfLines, + AI_Function.InputAnalogicValue2, + AI_Function.InputAnalogicValueV, + AI_Function.InputAnalogicValueZ, + AI_Function.SAV2_GetValue, + AI_Function.SAV2_GetValueIndex, + AI_Function.SAV2_GetNumberOfExistingSave, + AI_Function.SAV2_GetTimeSaveGame, + AI_Function.SAV2_GetDateSaveGame, + AI_Function.FFBPreCreateConstantEffect, + AI_Function.FFBCreateAndLaunchConstantEffect, + AI_Function.FFBStopEffectWithFade, + AI_Function.LitPointsDeMagie, + AI_Function.LitPointsDeMagieMax, + AI_Function.AjouteEtLitPointsDeMagie, + AI_Function.AjouteEtLitPointsDeMagieMax, + AI_Function.EnleveEtLitPointsDeMagie, + AI_Function.EnleveEtLitPointsDeMagieMax, + AI_Function.LitPointsDair, + AI_Function.LitPointsDairMax, + AI_Function.AjouteEtLitPointsDair, + AI_Function.AjouteEtLitPointsDairMax, + AI_Function.EnleveEtLitPointsDair, + AI_Function.EnleveEtLitPointsDairMax, + AI_Function.PersoLePlusProche, + AI_Function.PersoLePlusProcheExtended, + AI_Function.PersoLePlusProcheDansSecteurCourant, + AI_Function.PersoLePlusProcheDansSecteurCourantExtended, + AI_Function.NearerActorInFieldOfVision, + AI_Function.NearerActorInFieldOfVisionExtended, + AI_Function.NearerActorOfFamilyInFieldOfVision, + AI_Function.NearerActorOfFamilyInFieldOfVisionExtended, + AI_Function.NearerActorInFieldOfVisionWithOffset, + AI_Function.NearerActorInFieldOfVisionWithOffsetExtended, + AI_Function.NearerActorOfFamilyInFOVWithOffset, + AI_Function.NearerActorOfFamilyInFOVWithOffsetExtended, + AI_Function.GetNbActivePerso, + AI_Function.CibleLaPlusProche, + AI_Function.CibleLaPlusProcheExtended, + AI_Function.CibleLaPlusProcheAvecAngles, + AI_Function.CibleLaPlusProcheAvecAnglesExtended, + AI_Function.GetCloserNetwork, + AI_Function.NetWorkCloserCollisionWP, + AI_Function.ReseauWPLePlusProche, + AI_Function.ReseauWPLePlusProcheZPoids, + AI_Function.NetworkCloserWPOfType, + AI_Function.NetworkCloserCollisionWPOfType, + AI_Function.NetworkCloserWPOfExactType, + AI_Function.ReseauWPLePlusDansLAxe, + AI_Function.ReseauWPLePlusDansLAxe2, + AI_Function.ReseauWPLePlusProcheAvecAngle, + AI_Function.NetworkNextWPWithCapa, + AI_Function.NetworkNextWPWithExactCapa, + AI_Function.NetworkNextWPWithCapaOptimalWeight, + AI_Function.NetworkNextWPOfType, + AI_Function.NetworkNextWPOfExactType, + AI_Function.NetworkAffectTypeOfConnectedWP, + AI_Function.NetworkAffectTypeOfConnectedWPWithCapa, + AI_Function.ReseauCheminLePlusCourt, + AI_Function.NetworkBuildOrderedPath, + AI_Function.NetworkBuildOrderedPathCircular, + AI_Function.NetworkAllocateGraphToMSWay, + AI_Function.NetworkAllocateGraphToMSWayCircular, + AI_Function.NetworkBuildRandomPath, + AI_Function.NetworkBuildRandomCircularPath, + AI_Function.ReseauLitIndexCourant, + AI_Function.ReseauForceIndexCourant, + AI_Function.ReseauLitPremierIndex, + AI_Function.ReseauLitDernierIndex, + AI_Function.ReseauIncrementIndex, + AI_Function.ReseauDecrementIndex, + AI_Function.ReseauLitWPAIndex, + AI_Function.ReseauLitCapaciteLiaisonAIndex, + AI_Function.ReseauChangeCapaciteLiaisonAIndex, + AI_Function.ReseauLitPoidsLiaisonAIndex, + AI_Function.ReseauChangePoidsLiaisonAIndex, + AI_Function.NetworkGetIndexOfWPInMSWay, + AI_Function.NetworkForceWPToCurrent, + AI_Function.NetworkTestTheEnds, + AI_Function.ReseauLitCapaciteLiaisonDansGraph, + AI_Function.ReseauChangeCapaciteLiaisonDansGraph, + AI_Function.ReseauLitPoidsLiaisonDansGraph, + AI_Function.ReseauChangePoidsLiaisonDansGraph, + AI_Function.NetworkGetTypeOfWP, + AI_Function.GetCapabilities, + AI_Function.CapabilityAtBitNumber, + AI_Function.GetScrollSpeed, + AI_Function.MTGetScrollSpeed, + AI_Function.GetNbFrame, + AI_Function.DotProduct, + AI_Function.CrossProduct, + AI_Function.Normalize, + AI_Function.GetSPOCoordinates, + AI_Function.GetSPOSighting, + AI_Function.GetSPOHorizon, + AI_Function.GetSPOBanking, + AI_Function.GetTractionFactor, + AI_Function.GetCenterZDEType, + AI_Function.GetCenterZDMType, + AI_Function.GetCenterZDRType, + AI_Function.GetCenterZDDType, + AI_Function.TextAffiche, + AI_Function.MJTextAffiche, + AI_Function.GetCPUCounter, + AI_Function.TurnToPosition, + AI_Function.FormatMemCard, + AI_Function.GetDefaultLanguage, + AI_Function.PS2_MagicBox, + AI_Function.CINEGetGenerateEvent, + AI_Function.VitesseHorizontaleDuPerso, + AI_Function.VitesseVerticaleDuPerso, + AI_Function.GetPersoZoomFactor, + AI_Function.GetPersoSighting, + AI_Function.GetPersoHorizon, + AI_Function.GetPersoBanking, + AI_Function.LitPositionZDM, + AI_Function.LitPositionZDE, + AI_Function.LitPositionZDD, + AI_Function.LitCentreZDM, + AI_Function.LitCentreZDE, + AI_Function.LitCentreZDD, + AI_Function.LitAxeZDM, + AI_Function.LitAxeZDE, + AI_Function.LitAxeZDD, + AI_Function.LitDimensionZDM, + AI_Function.LitDimensionZDE, + AI_Function.LitDimensionZDD, + AI_Function.VecteurPointAxe, + AI_Function.VecteurPointSegment, + AI_Function.VectorContribution, + AI_Function.VectorCombination, + AI_Function.TemporalVectorCombination, + AI_Function.ScaledVector, + AI_Function.GetVectorNorm, + AI_Function.RotateVector, + AI_Function.VectorAngle, + AI_Function.VectorCos, + AI_Function.VectorSin, + AI_Function.GetNormalCollideVector, + AI_Function.GetNormalSlopeVector, + AI_Function.GetNormalSlopeVectorAndAngle, + AI_Function.GetNormalCollideVector2, + AI_Function.GetCollidePoint, + AI_Function.GetCollidePoint2, + AI_Function.GetHandsCollidePoint, + AI_Function.GetCollideRate, + AI_Function.GetCollideRate2, + AI_Function.GetCollideMaterialType, + AI_Function.GetCollideMaterialType2, + AI_Function.GetCollideMaterialDirection, + AI_Function.GetCollideMaterialCoeff, + AI_Function.GetCollideMaterialTypeForAi, + AI_Function.GetCollisionPoint, + AI_Function.GetCollisionVector, + AI_Function.GetCollisionPerso, + AI_Function.GetCollisionPointMaterial, + AI_Function.GetFirstCollisionInfo, + AI_Function.GetLastTraversedMaterialType, + AI_Function.GetLastTraversedMaterial, + AI_Function.GetCurrentCollidedGMT, + AI_Function.GetColliderType, + AI_Function.GetColliderActor, + AI_Function.GetColliderVector, + AI_Function.GetColliderReal, + AI_Function.GetLastCollisionActor, + AI_Function.ComputeRebondVector, + AI_Function.GetModuleAbsolutePosition, + AI_Function.GetModuleRelativePosition, + AI_Function.GetModuleZoomFactor, + AI_Function.GetModuleSighting, + AI_Function.GetModuleHorizon, + AI_Function.GetModuleBanking, + AI_Function.CastIntegerToChannel, + AI_Function.GetSlotDate, + AI_Function.GetSlotName, + AI_Function.GetSlotScore, + AI_Function.GetStringCharAt, + AI_Function.ScanAsciiKey, + AI_Function.GetFormattedTextInfo, + AI_Function.GetInputEntryName, + AI_Function.GetMechanicGravityFactor, + AI_Function.GetMechanicSlide, + AI_Function.GetMechanicRebound, + AI_Function.GetMechanicSlopeLimit, + AI_Function.GetMechanicInertiaX, + AI_Function.GetMechanicInertiaY, + AI_Function.GetMechanicInertiaZ, + AI_Function.GetMechanicTiltIntensity, + AI_Function.GetMechanicTiltInertia, + AI_Function.GetMechanicTiltOrigin, + AI_Function.GetMechanicMaxSpeed, + AI_Function.GetMechanicStreamPriority, + AI_Function.GetMechanicStreamSpeed, + AI_Function.GetMechanicStreamFactor, + AI_Function.GetSlideFactorX, + AI_Function.GetSlideFactorY, + AI_Function.GetSlideFactorZ, + AI_Function.JumpImpulsion, + AI_Function.GetSpeedAnim, + AI_Function.HierGetFather, + AI_Function.GetActivationZDD, + AI_Function.GetActivationZDM, + AI_Function.GetActivationZDE, + AI_Function.GetActivationZDR, + AI_Function.GetCollisionFrequency, + AI_Function.GetBrainFrequency, + AI_Function.GetLightFrequency, + AI_Function.GetBooleanInArray, + AI_Function.GetNumberOfBooleanInArray, + AI_Function.GetButtonName, + AI_Function.GetOneCustomFloat, + AI_Function.GetOneCustomLong, + AI_Function.GetOneCustomVector, + AI_Function.GetDriversAvailable, + AI_Function.GetCurrentLanguageId, + AI_Function.GetNbLanguages, + AI_Function.GetLanguageText, + AI_Function.TextToInt, + AI_Function.NbAvailableResolution, + AI_Function.CurrentResolution, + AI_Function.SaveResolution, + AI_Function.IsResolutionAvailable, + AI_Function.GetBrightness, + AI_Function.NameResolution, + AI_Function.GetTextureFiltering, + AI_Function.GetAntiAliasing, + AI_Function.GetSaturationDistance, + AI_Function.GetBackgroundDistance, + AI_Function.GetTooFarLimit, + AI_Function.GetTransparencyZoneMin, + AI_Function.GetTransparencyZoneMax, + AI_Function.GetCurrentFrame, + AI_Function.ExecuteVariable, + AI_Function.ComputeProtectKey, + AI_Function.Xor, + AI_Function.And, + AI_Function.Or, + AI_Function.Not, + AI_Function.DivUnsigned, + AI_Function.MulUnsigned, + AI_Function.AddUnsigned, + AI_Function.SubUnsigned, + AI_Function.GetMemoryValue, + AI_Function.Cam_GetShiftTarget, + AI_Function.Cam_GetShiftPos, + AI_Function.Cam_GetDistMin, + AI_Function.Cam_GetDistMax, + AI_Function.Cam_GetBoundDistMin, + AI_Function.Cam_GetBoundDistMax, + AI_Function.Cam_GetAngleAlpha, + AI_Function.Cam_GetAngleShiftAlpha, + AI_Function.Cam_GetAngleTheta, + AI_Function.Cam_GetAngleShiftTheta, + AI_Function.Cam_GetLinearSpeed, + AI_Function.Cam_GetLinearIncreaseSpeed, + AI_Function.Cam_GetLinearDecreaseSpeed, + AI_Function.Cam_GetAngularSpeed, + AI_Function.Cam_GetAngularIncreaseSpeed, + AI_Function.Cam_GetAngularDecreaseSpeed, + AI_Function.Cam_GetTargetSpeed, + AI_Function.Cam_GetTargetIncreaseSpeed, + AI_Function.Cam_GetTargetDecreaseSpeed, + AI_Function.Cam_GetFocal, + AI_Function.Cam_GetZMin, + AI_Function.Cam_GetZMax, + AI_Function.Cam_GetTargetedSuperObject, + AI_Function.Cam_GetTypeOfViewport, + AI_Function.Cam_GetCameraOfViewport, + AI_Function.Cam_GetMainCamera, + AI_Function.Cam_ComputeTargetWithTgtPerso, + AI_Function.Cam_GetCurrentTargetPosition, + AI_Function.Cam_GetSectorCameraType, + AI_Function.Cam_GetBestPos, + AI_Function.Cam_GetTransparencyFlag, + AI_Function.Cam_SetMirrorFlag, + AI_Function.Cam_GetMirrorFlag, + AI_Function.CAM_GetViewportCoordinates, + AI_Function.CSHBackMode, + AI_Function.CSHMarioMode, + AI_Function.CSHStrafeLockMode, + AI_Function.GetViewFinderDistance, + AI_Function.LinkInit, + AI_Function.LinkDoBehaviour, + AI_Function.LinkKill, + AI_Function.LinkGetNoCutpoints, + AI_Function.LinkGetCutPoint, + AI_Function.FollowLinkDirection, + + AI_Function.NetGetPersoRole, + AI_Function.NetGetCreationTime, + AI_Function.NetGetClientID, + AI_Function.NetGetPlayerID, + AI_Function.NetGetCurrentTime, + AI_Function.ActGetAlwaysGenerator, + AI_Function.ActGetCurrentActionIndex, + AI_Function.ActGetNumberOfGroups, + AI_Function.NetGetStatus, + AI_Function.NetIsPlayerStillConnected, + AI_Function.NetGetPing, + AI_Function.NetGetPlayerName, + AI_Function.NetGetNumberOfPlayers, + AI_Function.NetGetNetworkMode, + AI_Function.NetGetLANServerCount, + AI_Function.NetCreateAndConnectToLANServer, + AI_Function.NetConnectToLANServer, + AI_Function.NetGetServerGameParam, + AI_Function.NetCloseLANServer, + AI_Function.NetGetBandwidth, + AI_Function.NetGetDiscarded, + AI_Function.NetGetSendBandwidth, + + AI_Function.SND_GetSoundHandle, + AI_Function.SND_GetSendSoundRequestHandleState, + AI_Function.SND_GetSendVoiceRequestHandleState, + AI_Function.SND_GetSendMusicRequestHandleState, + AI_Function.SND_GetSendAmbianceRequestHandleState, + AI_Function.SND_GetSendMenuSndRequestHandleState, + AI_Function.SND_GetSoundVolume, + AI_Function.SND_GetVoiceVolume, + AI_Function.SND_GetMusicVolume, + AI_Function.SND_GetAmbianceVolume, + AI_Function.SND_GetMenuSndVolume, + + AI_Function.ORB_Menu_GetCurrentPage, + AI_Function.ORB_Menu_GetCurrentWindow, + AI_Function.ORB_Menu_GetCurrentOrbit, + AI_Function.ORB_Menu_GetCurrentDisc, + AI_Function.ORB_Menu_GetCurrentButtonSet, + AI_Function.ORB_Menu_GetCurrentButton, + AI_Function.ORB_Menu_GetFirstWindow, + AI_Function.ORB_Menu_GetNextWindow, + AI_Function.ORB_Menu_GetPreviousWindow, + AI_Function.ORB_Menu_GetLastWindow, + AI_Function.ORB_Menu_GetNumberOfWindows, + AI_Function.ORB_Page_GetName, + AI_Function.ORB_Window_GetName, + AI_Function.ORB_Disc_GetName, + AI_Function.ORB_Button_GetName, + AI_Function.ORB_Button_GetDescription, + AI_Function.ORB_Page_GetOrbit, + AI_Function.ORB_Page_GetBackPage, + AI_Function.ORB_Page_GetCameraWP, + AI_Function.ORB_Page_GetTargetWP, + AI_Function.ORB_Page_GetCenterWP, + AI_Function.ORB_Page_GetSideWP, + AI_Function.ORB_Window_GetTopLeftCorner, + AI_Function.ORB_Window_GetBottomRightCorner, + AI_Function.ORB_Window_GetStatus, + AI_Function.ORB_Orbit_GetFirstDisc, + AI_Function.ORB_Orbit_GetLastDisc, + AI_Function.ORB_Orbit_GetNextDisc, + AI_Function.ORB_Orbit_GetPreviousDisc, + AI_Function.ORB_Orbit_GetCurrentDisc, + AI_Function.ORB_Orbit_GetNumberOfDiscs, + AI_Function.ORB_Disc_GetFirstButtonSet, + AI_Function.ORB_Disc_GetLastButtonSet, + AI_Function.ORB_Disc_GetNextButtonSet, + AI_Function.ORB_Disc_GetPreviousButtonSet, + AI_Function.ORB_Disc_GetCurrentButtonSet, + AI_Function.ORB_Disc_GetNumberOfButtonSets, + AI_Function.ORB_ButtonSet_GetFirstButton, + AI_Function.ORB_ButtonSet_GetLastButton, + AI_Function.ORB_ButtonSet_GetNextButton, + AI_Function.ORB_ButtonSet_GetPreviousButton, + AI_Function.ORB_ButtonSet_GetCurrentButton, + AI_Function.ORB_ButtonSet_GetNumberOfButtons, + AI_Function.ORB_ButtonSet_GetStartAngle, + AI_Function.ORB_Button_GetFather, + AI_Function.ORB_Button_GetType, + AI_Function.ORB_Button_GetStatus, + AI_Function.ORB_Button_GetData, + AI_Function.ORB_Button_GetIconBasePoint, + AI_Function.ORB_Button_GetStatusFlag, + AI_Function.ORB_Disc_GetSkin, + AI_Function.ORB_ButtonSet_GetSeparator, + + AI_Function.MonitoringSetVariable, + }; + } + #endregion + + #region Procedures + protected override void InitProcedures() { + Procedures = new AI_Procedure[] { + AI_Procedure.SetHitPoints, + AI_Procedure.SetHitPointsInit, + AI_Procedure.SetHitPointsToInitValue, + AI_Procedure.SetHitPointsToMaxValue, + AI_Procedure.AddHitPoints, + AI_Procedure.SubHitPoints, + AI_Procedure.SetHitPointsMax, + AI_Procedure.SetHitPointsMaxToInitValue, + AI_Procedure.SetHitPointsMaxToMaxValue, + AI_Procedure.AddHitPointsMax, + AI_Procedure.SubHitPointsMax, + AI_Procedure.TransparentDisplay, + AI_Procedure.SetTransparency, + AI_Procedure.ACT_SetDrawFlag, + AI_Procedure.SkinMaterial, + AI_Procedure.SkinIndex, + AI_Procedure.ModuleTransparentDisplay, + AI_Procedure.ModuleTransparentDisplay2, + AI_Procedure.SetModuleTransparency, + AI_Procedure.SetModuleTransparency2, + AI_Procedure.ListAffectPersoZDD, + AI_Procedure.ListAffectModuleZDD, + AI_Procedure.ListAffectPersoZDE, + AI_Procedure.ListAffectModuleZDE, + AI_Procedure.ListAffectPersoTypeZDE, + AI_Procedure.ListAffectModuleTypeZDE, + AI_Procedure.ListAffectTypeZDEWithTypeZDE, + AI_Procedure.AddPersoInList, + AI_Procedure.AddPersoInListAt, + AI_Procedure.DeletePersoAtInList, + AI_Procedure.FindPersoAndDeleteInList, + AI_Procedure.ListSelect, + AI_Procedure.ListUnSelect, + AI_Procedure.ListSort, + AI_Procedure.ListSortByFamily, + AI_Procedure.ListSortByModel, + AI_Procedure.FillListWithAllPersoOfAFamily, + AI_Procedure.FillListWithAllPersoOfAModel, + AI_Procedure.DeleteFamilyInList, + AI_Procedure.DeleteModelInList, + AI_Procedure.ListUnion, + AI_Procedure.ListInter, + AI_Procedure.ListDiff, + AI_Procedure.ListAdd, + AI_Procedure.FogActivate, + AI_Procedure.SetFogColor, + AI_Procedure.SetFogNearFarInf, + AI_Procedure.SetFogBlend, + AI_Procedure.RestoreFog, + AI_Procedure.SaveFog, + AI_Procedure.Magnet_ActiveMagnet, + AI_Procedure.Magnet_DeactiveMagnet, + AI_Procedure.Magnet_SetStrength, + AI_Procedure.Magnet_SetFar, + AI_Procedure.Magnet_SetNear, + AI_Procedure.Magnet_SetDuration, + AI_Procedure.FootPath_AddFootPrint, + AI_Procedure.FootPath_Clear, + AI_Procedure.SinEffect_SetFreq, + AI_Procedure.SinEffect_SetAmplitude, + AI_Procedure.SinEffect_SetState, + AI_Procedure.SinEffect_SetFreq3D, + AI_Procedure.SinEffect_SetFreq3DMesh, + AI_Procedure.SinEffect_SetFreq3DRLI, + AI_Procedure.SinEffect_SetRLIAmplitude, + AI_Procedure.SinEffect_SetRLIBase, + AI_Procedure.SPO_SetDrawFlag, + AI_Procedure.SPO_SetEngineDisplayModeFlag, + AI_Procedure.DeactivateBut, + AI_Procedure.ActivateBut, + AI_Procedure.None, + AI_Procedure.Trace, + AI_Procedure.ChangeComport, + AI_Procedure.ChangeComportReflex, + AI_Procedure.ChangeMyComport, + AI_Procedure.ChangeMyComportReflex, + AI_Procedure.ChangeMyComportAndMyReflex, + AI_Procedure.ChangeAction, + AI_Procedure.ChangeActionForce, + AI_Procedure.ChangeActionRandom, + AI_Procedure.ChangeActionWithEvents, + AI_Procedure.ChangeActionSmooth, + AI_Procedure.ChangeActionForceSmooth, + AI_Procedure.ChangeActionRandomSmooth, + AI_Procedure.ChangeActionWithEventsSmooth, + AI_Procedure.ChangeActionSmoothNL, + AI_Procedure.ChangeActionForceSmoothNL, + AI_Procedure.ChangeActionRandomSmoothNL, + AI_Procedure.ChangeActionWithEventsSmoothNL, + AI_Procedure.Boucle, + AI_Procedure.FinBoucle, + AI_Procedure.Break, + AI_Procedure.PlayerIsDead, + AI_Procedure.ResetDynamicsWithCard, + AI_Procedure.BreakAI, + AI_Procedure.IgnoreTraceFlagForNextPicking, + AI_Procedure.SetMainActor, + AI_Procedure.ActivateObject, + AI_Procedure.DesactivateObject, + AI_Procedure.ChangeMap, + AI_Procedure.ChangeMapWithTransition, + AI_Procedure.ChangeMapNoAutosave, + AI_Procedure.SetActionReturn, + AI_Procedure.FactorAnimationFrameRate, + AI_Procedure.SetCharacterPriority, + AI_Procedure.ForcePersoHandling, + AI_Procedure.SetDynamicAlwaysActive, + AI_Procedure.PlayerIsDeadWithPlacement, + AI_Procedure.SwapLinkTableObjects, + AI_Procedure.ChangeCurrentObjectTable, + AI_Procedure.BuildObjectTableFromTableAndString, + AI_Procedure.BuildObjectTableFromFormattedString, + AI_Procedure.StartSpeech, + AI_Procedure.StopSpeech, + AI_Procedure.TakeModuleControl, + AI_Procedure.TakeManyModulesControl, + AI_Procedure.ReleaseModuleControl, + AI_Procedure.QuitGame, + AI_Procedure.ActivateChannel, + AI_Procedure.DeactivateChannel, + AI_Procedure.PersoLightOn, + AI_Procedure.PersoLightOff, + AI_Procedure.SetPersoLightColor, + AI_Procedure.SetPersoLightNearFar, + AI_Procedure.SetPersoLightLittleBigAlpha, + AI_Procedure.SetPersoLightGyrophare, + AI_Procedure.SetPersoLightPulse, + AI_Procedure.SetPersoLightParalleleType, + AI_Procedure.SetPersoLightSphericalType, + AI_Procedure.SetPersoLightHotSpotType, + AI_Procedure.SetPersoLightAmbientType, + AI_Procedure.DefaultDisplay, + AI_Procedure.DisplayVignette, + AI_Procedure.DeleteVignette, + AI_Procedure.PRT_SetGeneratorOn, + AI_Procedure.PRT_SetGeneratorOff, + AI_Procedure.PRT_SetGenerator, + AI_Procedure.PRT_SetModeNone, + AI_Procedure.PRT_SetModeContinuous, + AI_Procedure.PRT_SetModeCrenel, + AI_Procedure.PRT_SetModeProbability, + AI_Procedure.PRT_SetNumberConstant, + AI_Procedure.PRT_SetNumberProbabilist, + AI_Procedure.PRT_SetInfiniteLifeTime, + AI_Procedure.PRT_SetConstantLifeTime, + AI_Procedure.PRT_SetPobabilistLifeTime, + AI_Procedure.Turn, + AI_Procedure.Turn2, + AI_Procedure.DeltaTurnPerso, + AI_Procedure.TurnPerso, + AI_Procedure.KillPerso, + AI_Procedure.KillPersoAndClearVariable, + AI_Procedure.SetVMTColor, + AI_Procedure.SetVMTSpecularExponent, + AI_Procedure.SetVMTSpecularCoef, + AI_Procedure.SetVMTDiffuseCoef, + AI_Procedure.SetVMTAmbientCoef, + AI_Procedure.SetVMTAsChromed, + AI_Procedure.SetVMTTextureScrollingCoef, + AI_Procedure.LockVMT, + AI_Procedure.UnlockVMT, + AI_Procedure.SetVMTFrame, + AI_Procedure.OptionChangeDetailsValue, + AI_Procedure.OptionChangeActionKey, + AI_Procedure.OptionConfigureKey, + AI_Procedure.OptionGetCurrentKeyValue, + AI_Procedure.OptionChangeKeyValue, + AI_Procedure.OptionResetKeyValueToDefault, + AI_Procedure.BatchSetPersoAtModulePosition, + AI_Procedure.BatchSetPersoOrientation, + AI_Procedure.BatchSetPersoAtPerso, + AI_Procedure.SetPersoAbsolutePosition, + AI_Procedure.SetPersoAtModulePosition, + AI_Procedure.ForcePersoAveragePosition, + AI_Procedure.RelativeMovePerso, + AI_Procedure.ChangePersoAnySighting, + AI_Procedure.ChangePersoSightingWithOffset, + AI_Procedure.RotatePersoAroundX, + AI_Procedure.RotatePersoAroundY, + AI_Procedure.RotatePersoAroundZ, + AI_Procedure.RotatePersoAroundVector, + AI_Procedure.RotatePersoAroundVectorWithOffset, + AI_Procedure.RotatePersoAroundXwithOffset, + AI_Procedure.RotatePersoAroundYwithOffset, + AI_Procedure.RotatePersoAroundZwithOffset, + AI_Procedure.SetFullPersoOrientation, + AI_Procedure.SetFullPersoOrientationWithOffset, + AI_Procedure.ZoomPerso, + AI_Procedure.ChangeOneCustomBit, + AI_Procedure.ChangeManyCustomBits, + AI_Procedure.ChangeManyCustomBitsExtended, + AI_Procedure.ChangeOneCustomFloat, + AI_Procedure.ChangeOneCustomLong, + AI_Procedure.ChangeOneCustomVector, + AI_Procedure.ImposeSpeed, + AI_Procedure.ImposeSpeedX, + AI_Procedure.ImposeSpeedY, + AI_Procedure.ImposeSpeedZ, + AI_Procedure.ImposeSpeedXY, + AI_Procedure.ImposeSpeedXYZ, + AI_Procedure.ImposeAbsoluteSpeed, + AI_Procedure.ImposeAbsoluteSpeedX, + AI_Procedure.ImposeAbsoluteSpeedY, + AI_Procedure.ImposeAbsoluteSpeedZ, + AI_Procedure.ImposeAbsoluteSpeedXY, + AI_Procedure.ImposeAbsoluteSpeedXYZ, + AI_Procedure.ProposeSpeed, + AI_Procedure.ProposeSpeedX, + AI_Procedure.ProposeSpeedY, + AI_Procedure.ProposeSpeedZ, + AI_Procedure.ProposeSpeedXY, + AI_Procedure.ProposeSpeedXYZ, + AI_Procedure.ProposeAbsoluteSpeed, + AI_Procedure.ProposeAbsoluteSpeedX, + AI_Procedure.ProposeAbsoluteSpeedY, + AI_Procedure.ProposeAbsoluteSpeedZ, + AI_Procedure.ProposeAbsoluteSpeedXY, + AI_Procedure.ProposeAbsoluteSpeedXYZ, + AI_Procedure.FixePositionPerso, + AI_Procedure.AddSpeed, + AI_Procedure.AddSpeedX, + AI_Procedure.AddSpeedY, + AI_Procedure.AddSpeedZ, + AI_Procedure.AddSpeedXY, + AI_Procedure.AddSpeedXYZ, + AI_Procedure.AddAbsoluteSpeed, + AI_Procedure.AddAbsoluteSpeedX, + AI_Procedure.AddAbsoluteSpeedY, + AI_Procedure.AddAbsoluteSpeedZ, + AI_Procedure.AddAbsoluteSpeedXY, + AI_Procedure.AddAbsoluteSpeedXYZ, + AI_Procedure.PrepareMorph, + AI_Procedure.PrepareMorphMT, + AI_Procedure.StopMorph, + AI_Procedure.Morphing, + AI_Procedure.MorphingMT, + AI_Procedure.ReleaseAllModulesControl, + AI_Procedure.ChangeModuleSighting, + AI_Procedure.SetModuleAbsolutePosition, + AI_Procedure.RelativeMoveModule, + AI_Procedure.ChangeModuleSightingWithOffset, + AI_Procedure.RotateModuleAroundX, + AI_Procedure.RotateModuleAroundY, + AI_Procedure.RotateModuleAroundZ, + AI_Procedure.RotateModuleAroundVector, + AI_Procedure.RotateModuleAroundVectorWithOffset, + AI_Procedure.RotateModuleAroundXwithOffset, + AI_Procedure.RotateModuleAroundYwithOffset, + AI_Procedure.RotateModuleAroundZwithOffset, + AI_Procedure.SetFullModuleOrientation, + AI_Procedure.SetFullModuleOrientationWithOffset, + AI_Procedure.ZoomModule, + AI_Procedure.SetColliderType, + AI_Procedure.SetColliderActor, + AI_Procedure.SetColliderVector, + AI_Procedure.SetColliderReal, + AI_Procedure.ReinitCollider, + AI_Procedure.ResetLastCollisionActor, + AI_Procedure.ClearCollisionReport, + AI_Procedure.SetGoThroughMechanicsHandling, + AI_Procedure.EraseLastGoThroughMaterial, + AI_Procedure.ChangeTextDefaultColor, + AI_Procedure.CreateTextWithParamFormat, + AI_Procedure.CreateTextWith2ParamsFormat, + AI_Procedure.StringAddChar, + AI_Procedure.StringReplaceChar, + AI_Procedure.StringRemoveChar, + AI_Procedure.ChangeLanguage, + AI_Procedure.IntToText, + AI_Procedure.FloatToText, + AI_Procedure.SetMechanicAnimation, + AI_Procedure.SetMechanicCollide, + AI_Procedure.SetMechanicGravity, + AI_Procedure.SetMechanicTilt, + AI_Procedure.SetMechanicGi, + AI_Procedure.SetMechanicClimb, + AI_Procedure.SetMechanicOnGround, + AI_Procedure.SetMechanicSpider, + AI_Procedure.SetMechanicShoot, + AI_Procedure.SetMechanicSwim, + AI_Procedure.SetMechanicNeverFall, + AI_Procedure.SetMechanicNewMechanic, + AI_Procedure.SetMechanicCollisionControl, + AI_Procedure.SetMechanicKeepSpeedZ, + AI_Procedure.SetMechanicSpeedLimit, + AI_Procedure.SetMechanicInertia, + AI_Procedure.SetMechanicStream, + AI_Procedure.SetMechanicStickOnPlatform, + AI_Procedure.SetMechanicScale, + AI_Procedure.SetMechanicGravityFactor, + AI_Procedure.SetMechanicSlide, + AI_Procedure.SetMechanicRebound, + AI_Procedure.SetMechanicSlopeLimit, + AI_Procedure.SetMechanicInertiaX, + AI_Procedure.SetMechanicInertiaY, + AI_Procedure.SetMechanicInertiaZ, + AI_Procedure.SetMechanicInertiaXYZ, + AI_Procedure.SetMechanicTiltIntensity, + AI_Procedure.SetMechanicTiltInertia, + AI_Procedure.SetMechanicTiltOrigin, + AI_Procedure.SetMechanicSpeedMax, + AI_Procedure.SetMechanicStreamPriority, + AI_Procedure.SetMechanicStreamSpeed, + AI_Procedure.SetMechanicStreamFactor, + AI_Procedure.AddMechanicStreamSpeed, + AI_Procedure.AddMechanicStreamSpeedList, + AI_Procedure.MoveLimit, + AI_Procedure.MoveLimitX, + AI_Procedure.MoveLimitY, + AI_Procedure.MoveLimitZ, + AI_Procedure.MoveLimitXYZ, + AI_Procedure.StopMoveLimitX, + AI_Procedure.StopMoveLimitY, + AI_Procedure.StopMoveLimitZ, + AI_Procedure.StopMoveLimitXYZ, + AI_Procedure.SetPlatformLink, + AI_Procedure.FreePlatformLink, + AI_Procedure.MecSetScale, + AI_Procedure.MecSetSlideFactorXYZ, + AI_Procedure.MecSetSlideFactorX, + AI_Procedure.MecSetSlideFactorY, + AI_Procedure.MecSetSlideFactorZ, + AI_Procedure.MecSetClimbSpeedLimit, + AI_Procedure.MecSetHangingLimit, + AI_Procedure.MecSetHangingOff, + AI_Procedure.MecSetBaseCoeff, + AI_Procedure.MecSetWalkCoeff, + AI_Procedure.HierSetFather, + AI_Procedure.HierFreeFather, + AI_Procedure.HierListOfSon, + AI_Procedure.HierSetPlatformType, + AI_Procedure.HierControlLink, + AI_Procedure.HierFreezeEngine, + AI_Procedure.FixePositionZDM, + AI_Procedure.FixePositionZDD, + AI_Procedure.FixePositionZDE, + AI_Procedure.ChangeGameMaterialZDE, + AI_Procedure.ChangeLightIntensity, + AI_Procedure.SPO_ChangeFlag, + AI_Procedure.SPO_ChangeFlagRecursively, + AI_Procedure.ActChangeSpoFlag, + AI_Procedure.ChangeScreenSize, + AI_Procedure.ChangeScreenClip, + AI_Procedure.ChangeScreenPos, + AI_Procedure.ChangeScreenPosPercent, + AI_Procedure.ChangeScreenRatio, + AI_Procedure.DisplayShadow, + AI_Procedure.ChangeShadowHeight, + AI_Procedure.ChangeShadowVector, + AI_Procedure.ForceActivationZDD, + AI_Procedure.ForceActivationZDM, + AI_Procedure.ForceActivationZDE, + AI_Procedure.ForceActivationZDR, + AI_Procedure.ForceDesactivationZDD, + AI_Procedure.ForceDesactivationZDM, + AI_Procedure.ForceDesactivationZDE, + AI_Procedure.ForceDesactivationZDR, + AI_Procedure.LibereActivationZDD, + AI_Procedure.LibereActivationZDM, + AI_Procedure.LibereActivationZDE, + AI_Procedure.LibereActivationZDR, + AI_Procedure.ActiveZDR, + AI_Procedure.SetNoCollisionWithMap, + AI_Procedure.SetNoCollisionWithProjectile, + AI_Procedure.SetNoCollisionWithSecondCharact, + AI_Procedure.SetNoCollisionWithMainCharact, + AI_Procedure.SetNoCollisionWithOtherSectors, + AI_Procedure.SetNoCollisionZdeWithProjectile, + AI_Procedure.SetCollComputeFrequency, + AI_Procedure.SetBrainComputeFrequency, + AI_Procedure.SetLightComputeFrequency, + AI_Procedure.SetUsedExitIdentifier, + AI_Procedure.GetUsedExitIdentifier, + AI_Procedure.SetGlobalCounter, + AI_Procedure.ReadAnalogJoystick, + AI_Procedure.SetAnalogJoystickAxes, + AI_Procedure.GetPadCalibration, + AI_Procedure.SetPadCalibration, + AI_Procedure.CancelKeyboardInertia, + AI_Procedure.SetAnalogJoystickAxes2, + AI_Procedure.ReleaseAnalogJoystick, + AI_Procedure.SetBooleanInArray, + AI_Procedure.SetDefaultFormatCharacter, + AI_Procedure.SelectDriver, + AI_Procedure.SelectShapnessMax, + AI_Procedure.CenterScreen, + AI_Procedure.SelectResolution, + AI_Procedure.ChangeBrightness, + AI_Procedure.TexteEntier, + AI_Procedure.TexteReel, + AI_Procedure.SetTextureFiltering, + AI_Procedure.SetAntiAliasing, + AI_Procedure.DrawSegment, + AI_Procedure.UpdateChecksum, + AI_Procedure.ShellExecute, + AI_Procedure.ChangeSightingAccordingTime, + AI_Procedure.PAD2_SetGlobalVector, + AI_Procedure.PAD2_SetHorizontalAxis, + AI_Procedure.PAD2_SetVerticalAxis, + AI_Procedure.PAD2_SetAnalogForce, + AI_Procedure.PAD2_SetTrueAnalogForce, + AI_Procedure.PAD2_SetRotationAngle, + AI_Procedure.PAD2_SetPadSector, + AI_Procedure.SetModifierModeNormal, + AI_Procedure.SetModifierModeLight, + AI_Procedure.SetModifierModeRGB, + AI_Procedure.ValidateMemoryCard, + AI_Procedure.AddMemoryCardString, + AI_Procedure.FixePointsDeMagie, + AI_Procedure.FixePointsDeMagieMax, + AI_Procedure.InitPointsDeMagie, + AI_Procedure.InitPointsDeMagieMax, + AI_Procedure.AjoutePointsDeMagie, + AI_Procedure.AjoutePointsDeMagieMax, + AI_Procedure.EnlevePointsDeMagie, + AI_Procedure.EnlevePointsDeMagieMax, + AI_Procedure.FixePointsDair, + AI_Procedure.FixePointsDairMax, + AI_Procedure.InitPointsDair, + AI_Procedure.InitPointsDairMax, + AI_Procedure.AjoutePointsDair, + AI_Procedure.AjoutePointsDairMax, + AI_Procedure.EnlevePointsDair, + AI_Procedure.EnlevePointsDairMax, + AI_Procedure.FixePositionFade, + AI_Procedure.FixeLumierePersoLocal, + AI_Procedure.FixeLumierePersoOnOff, + AI_Procedure.FixeLumiereStaticOnOff, + AI_Procedure.FixeLumiereStaticNearFar, + AI_Procedure.FixeLumiereStaticColor, + AI_Procedure.CalculeLumiere, + AI_Procedure.CalculeLumiereAvecOmbres, + AI_Procedure.NoRLI, + AI_Procedure.FixeRLI, + AI_Procedure.BlendRLI, + AI_Procedure.SetRadiusWP, + AI_Procedure.SetPositionAbsWP, + AI_Procedure.SetPositionRelWP, + AI_Procedure.ChangeTypeOfWP, + AI_Procedure.SetCapabilities, + AI_Procedure.AddCapabilities, + AI_Procedure.SubCapabilities, + AI_Procedure.ChangeCapabilities, + AI_Procedure.WPIndiquePlageValeur, + AI_Procedure.ReinitGraph, + AI_Procedure.FixeVitesseTexture, + AI_Procedure.ScrollingOnOff, + AI_Procedure.FixeDecalageTexture, + AI_Procedure.ScrollingPause, + AI_Procedure.ChangeCurrFrame, + AI_Procedure.ChangeRandomFrame, + AI_Procedure.FreezeAnim, + AI_Procedure.UnFreezeAnim, + AI_Procedure.SetDiscreetSpeed, + AI_Procedure.SetSuperimposed, + AI_Procedure.MJ_SetSuperimposed, + AI_Procedure.SetSuperimposed2, + AI_Procedure.ReleaseSuperimposed, + AI_Procedure.SetSuperimposedClipping, + AI_Procedure.ResetSuperimposedClipping, + AI_Procedure.SetOutlineMode, + AI_Procedure.SetOutlineModeSPO, + AI_Procedure.SetSPOCoordinates, + AI_Procedure.SetSPOCoordinatesAndMoveType1, + AI_Procedure.SetSPOCoordinatesAndMoveType2, + AI_Procedure.SetSPOCoordinatesAndMoveType3, + AI_Procedure.SetSPOCoordinatesAndMoveType4, + AI_Procedure.SetSOLFromWorldOrigin_SPOParam, + AI_Procedure.SetSOLFromInit_SPOParam, + AI_Procedure.SetSOLFromHere_SPOParam, + AI_Procedure.SetSOLToInit_SPOParam, + AI_Procedure.ReinitSOL_SPOParam, + AI_Procedure.SetSOLFromWorldOrigin_SOLParam, + AI_Procedure.SetSOLFromInit_SOLParam, + AI_Procedure.SetSOLFromHere_SOLParam, + AI_Procedure.SetSOLToInit_SOLParam, + AI_Procedure.ReinitSOL_SOLParam, + AI_Procedure.SOLAddCharacter, + AI_Procedure.SOLAddWaypoint, + AI_Procedure.SOLAddObject, + AI_Procedure.SOLDeleteCharacter, + AI_Procedure.SOLDeleteWaypoint, + AI_Procedure.SOLDeleteObject, + AI_Procedure.SwitchSuperimposedTab, + AI_Procedure.RotateSPOAroundX, + AI_Procedure.RotateSPOAroundXType1, + AI_Procedure.RotateSPOAroundXType2, + AI_Procedure.RotateSPOAroundXType3, + AI_Procedure.RotateSPOAroundXType4, + AI_Procedure.RotateSPOAroundY, + AI_Procedure.RotateSPOAroundYType1, + AI_Procedure.RotateSPOAroundYType2, + AI_Procedure.RotateSPOAroundYType3, + AI_Procedure.RotateSPOAroundYType4, + AI_Procedure.RotateSPOAroundZ, + AI_Procedure.RotateSPOAroundZType1, + AI_Procedure.RotateSPOAroundZType2, + AI_Procedure.RotateSPOAroundZType3, + AI_Procedure.RotateSPOAroundZType4, + AI_Procedure.RotateSPOAroundAxis, + AI_Procedure.RotateSPOAroundAxisType1, + AI_Procedure.RotateSPOAroundAxisType2, + AI_Procedure.RotateSPOAroundAxisType3, + AI_Procedure.RotateSPOAroundAxisType4, + AI_Procedure.RotateSPOToIdentity, + AI_Procedure.ChangeSPOSighting, + AI_Procedure.ChangeSPOSightingType1, + AI_Procedure.ChangeSPOSightingType2, + AI_Procedure.ChangeSPOSightingType3, + AI_Procedure.ChangeSPOSightingType4, + AI_Procedure.ChangeSPOAnySighting, + AI_Procedure.ChangeSPOAnySightingType1, + AI_Procedure.ChangeSPOAnySightingType2, + AI_Procedure.ChangeSPOAnySightingType3, + AI_Procedure.ChangeSPOAnySightingType4, + AI_Procedure.SetTractionFactor, + AI_Procedure.TurnToPositionAngle, + AI_Procedure.TurnToPositionSpeed, + AI_Procedure.SortArray, + AI_Procedure.ActiveJoystickAnal, + AI_Procedure.UnActiveJoystickAnal, + AI_Procedure.SetZDMSizeSphere, + AI_Procedure.SetZDDSizeCone, + AI_Procedure.ChangeCaractere, + AI_Procedure.FormateTexte, + AI_Procedure.FormateTexteTime, + AI_Procedure.ChangePersoSighting, + AI_Procedure.PlayDemo, + AI_Procedure.PlayAutoDemo, + AI_Procedure.SetCharacterNotResearched, + AI_Procedure.InitKeyBoardDirections, + AI_Procedure.InitKeyBoardBouton, + AI_Procedure.PadSetCenterposition, + AI_Procedure.PadSetMaximalValues, + AI_Procedure.ChangeTooFarLimit, + AI_Procedure.ChangeTransparencyZone, + AI_Procedure.SetBaseFrequenceForMenu, + AI_Procedure.SaveSinusContext, + AI_Procedure.RestoreSinusContext, + AI_Procedure.TextSuperImposed, + AI_Procedure.StartSubAnim, + AI_Procedure.StopSubAnim, + AI_Procedure.WriteCBSubAnim, + AI_Procedure.EndSubAnim, + AI_Procedure.SetDynShadowLevel, + AI_Procedure.SetDynShadowClosed, + AI_Procedure.SetDynShadowSensitive, + AI_Procedure.SetCurrentLanguage, + AI_Procedure.CallSubRoutine, + AI_Procedure.ACTIndiquePlageValeur, + AI_Procedure.ActivateInternalLight, + AI_Procedure.SetInternalLightParams, + AI_Procedure.Cam_UpdatePosition, + AI_Procedure.Cam_UpdatePositionLight, + AI_Procedure.Cam_ChangeShiftTarget, + AI_Procedure.Cam_ChangeShiftPos, + AI_Procedure.Cam_ChangeDistMin, + AI_Procedure.Cam_ChangeDistMax, + AI_Procedure.Cam_ChangeBoundDistMin, + AI_Procedure.Cam_ChangeBoundDistMax, + AI_Procedure.Cam_ChangeAngleAlpha, + AI_Procedure.Cam_ChangeAngleShiftAlpha, + AI_Procedure.Cam_ChangeAngleTheta, + AI_Procedure.Cam_ChangeAngleShiftTheta, + AI_Procedure.Cam_ChangeLinearSpeed, + AI_Procedure.Cam_ChangeLinearIncreaseSpeed, + AI_Procedure.Cam_ChangeLinearDecreaseSpeed, + AI_Procedure.Cam_ChangeAngularSpeed, + AI_Procedure.Cam_ChangeAngularIncreaseSpeed, + AI_Procedure.Cam_ChangeAngularDecreaseSpeed, + AI_Procedure.Cam_ChangeTargetSpeed, + AI_Procedure.Cam_ChangeTargetIncreaseSpeed, + AI_Procedure.Cam_ChangeTargetDecreaseSpeed, + AI_Procedure.Cam_ChangeFocal, + AI_Procedure.Cam_ChangeZMin, + AI_Procedure.Cam_ChangeZMax, + AI_Procedure.Cam_ChangeTgtPerso, + AI_Procedure.Cam_ChangeSecondTgtPerso, + AI_Procedure.Cam_ChangeChannel, + AI_Procedure.Cam_Activate, + AI_Procedure.Cam_AssociateViewport, + AI_Procedure.Cam_ResetIAFlags, + AI_Procedure.Cam_SetFlagNoDynamicTarget, + AI_Procedure.Cam_SetFlagNoAverageMoveTgtPerso, + AI_Procedure.Cam_SetFlagNoParseCutAngle, + AI_Procedure.Cam_SetFlagNoVisibility, + AI_Procedure.Cam_SetFlagNoVisibilityWithDynHie, + AI_Procedure.Cam_SetFlagNoDynChangeTheta, + AI_Procedure.Cam_SetFlagNoShiftUntilPosReached, + AI_Procedure.Cam_SetFlagNoDynSpeed, + AI_Procedure.Cam_ResetDNMFlags, + AI_Procedure.Cam_SetFlagNoLinearParsing, + AI_Procedure.Cam_SetFlagNoLinearInertia, + AI_Procedure.Cam_SetFlagNoAngularParsing, + AI_Procedure.Cam_SetFlagNoAngularInertia, + AI_Procedure.Cam_SetFlagNoTargetParsing, + AI_Procedure.Cam_SetFlagNoTargetInertia, + AI_Procedure.Cam_SetFlagFixedOrientation, + AI_Procedure.Cam_SetFlagNoObstacle, + AI_Procedure.Cam_SetFlagNoCollisionWhenNotMoving, + AI_Procedure.Cam_ChangeConstants, + AI_Procedure.Cam_SaveConstants, + AI_Procedure.Cam_RestoreConstants, + AI_Procedure.Cam_ShowInfo, + AI_Procedure.Cam_ForceTarget, + AI_Procedure.Cam_ForcePosition, + AI_Procedure.Cam_ForceRefAxis, + AI_Procedure.Cam_Reset, + AI_Procedure.Cam_ForceBestPos, + AI_Procedure.Cam_ForceNormalState, + AI_Procedure.Cam_ForceMovingOnRail, + AI_Procedure.Cam_SetCameraModeForEngine, + AI_Procedure.Cam_SetCameraTransparencyFlag, + AI_Procedure.InitCamShooter, + AI_Procedure.CSHRegisterIntegerVar, + AI_Procedure.CSHRegisterFloatVar, + AI_Procedure.CSHRegisterVectorVar, + AI_Procedure.CSHRegisterPersoVar, + AI_Procedure.CSHRegisterBooleanVar, + AI_Procedure.CSHGetViewFinderVMT, + AI_Procedure.CSHGetMAComports, + AI_Procedure.CSHInitBackMode, + AI_Procedure.CSHInitMarioMode, + AI_Procedure.CSHInitStrafeLockMode, + AI_Procedure.LinkInitAll, + AI_Procedure.SetAgoLink, + AI_Procedure.SetLag, + AI_Procedure.SetGaugeSpeed, + AI_Procedure.SetSendDataRate, + AI_Procedure.SetSendStatusPeriod, + AI_Procedure.SetLaunchSpeed, + AI_Procedure.SetFlagStraight, + AI_Procedure.SetUnlaunch, + AI_Procedure.LaunchAGO, + AI_Procedure.SetAGOClipping, + AI_Procedure.SetInGameMenu, + AI_Procedure.JffTxt_Affiche, + AI_Procedure.JffTxt_AfficheVmsInitPause, + AI_Procedure.JffTxt_AffichePadInitPause, + AI_Procedure.JffTxt_AfficheMultitapInitPause, + AI_Procedure.JffTxt_DemoPressStart, + AI_Procedure.JffTxt_Extend, + AI_Procedure.JffTxt_Modify, + AI_Procedure.JffTxt_PauseDrawStringGame, + AI_Procedure.JffTxt_PauseDrawStringInv, + AI_Procedure.JffTxt_PauseEnable, + AI_Procedure.JffTxt_IAmInTheInventory, + AI_Procedure.JffTxt_PauseInitVars, + AI_Procedure.JffTxt_SetColor, + AI_Procedure.JffTxt_SetTransp, + AI_Procedure.JffTxt_DoFadeIn, + AI_Procedure.JffTxt_DoFadeOut, + AI_Procedure.JffTxt_SetFrameMode, + AI_Procedure.FadeIn, + AI_Procedure.FadeOut, + AI_Procedure.CheatDoubleSpeed, + AI_Procedure.CheatInvertPad, + AI_Procedure.CheatRandomPad, + AI_Procedure.CheatRandomVignette, + AI_Procedure.MultiPlayer_SetAspectRatio, + AI_Procedure.MultiPlayer_SetNumberOfPlayers, + AI_Procedure.MultiPlayer_SetPlayerForViewport, + AI_Procedure.MultiPlayer_InvertViewports, + AI_Procedure.MultiPlayer_LanceIcone, + AI_Procedure.MultiPlayer_LanceGauge, + AI_Procedure.MultiPlayer_LanceBitmapFile, + AI_Procedure.MultiPlayer_LanceBitmapMemory, + AI_Procedure.MultiPlayer_JFFTXT_Affiche, + AI_Procedure.MultiPlayer_JFFTXT_AfficheOver3D, + AI_Procedure.MultiPlayer_JFFTXT_AfficheOver3DAttenuated, + AI_Procedure.MultiPlayer_SetViewportSizeAndPos, + AI_Procedure.MultiPlayer_SetViewportDisplayOrder, + AI_Procedure.SinEffect_SetSinusPreMultiplier, + AI_Procedure.PrintInLogWindow, + AI_Procedure.TransitionDeRLI, + AI_Procedure.AjoutDeRLI, + AI_Procedure.BlockingRLITransitions, + AI_Procedure.EnqueueVideo, + AI_Procedure.PlayVideo, + AI_Procedure.PlayVideoAfterLevel, + AI_Procedure.VideoQuality, + AI_Procedure.SetVsyncWait, + AI_Procedure.ActiveBrainDuringTransitions, + AI_Procedure.DeactiveBrainDuringTransitions, + AI_Procedure.DisplaySegment, + AI_Procedure.EndTransition, + AI_Procedure.StartCine, + AI_Procedure.EndCine, + AI_Procedure.SkipLoading_SetLoadingLevel, + AI_Procedure.SetDataPath, + AI_Procedure.SAV2_DeclareField, + AI_Procedure.SAV2_DeleteField, + AI_Procedure.SAV2_DeleteAllPipeline, + AI_Procedure.SAV2_DeleteAll, + AI_Procedure.SAV2_SetValue, + AI_Procedure.SAV2_SetValueIndex, + AI_Procedure.SAV2_AddSingleValueInPipeline, + AI_Procedure.SAV2_AddSingleValueForSave, + AI_Procedure.SAV2_GetValueString, + AI_Procedure.SAV2_GetValueStringIndex, + AI_Procedure.SAV2_AddArrayInPipeline, + AI_Procedure.SAV2_AddArrayForSave, + AI_Procedure.SAV2_GetArray, + AI_Procedure.SAV2_SaveOnDisk, + AI_Procedure.SAV2_LoadOnDisk, + AI_Procedure.SAV2_RemoveSaveOnDisk, + AI_Procedure.SAV2_ActualizeExistingSave, + AI_Procedure.SAV2_GetSaveNameFromSaveNumber, + AI_Procedure.SCT_EnableSectorSynchro, + AI_Procedure.SCT_DisableSectorSynchro, + AI_Procedure.ActivePortal, + AI_Procedure.DeactivePortal, + AI_Procedure.FFBStartPreCreatedEffect, + AI_Procedure.FFBStopPreCreatedEffect, + AI_Procedure.FFBStopAllEffectForAPad, + AI_Procedure.FFBStopAllEffectForAllPad, + AI_Procedure.FFBPauseAllEffectForAllPad, + AI_Procedure.FFBResumeAllEffectForAllPad, + AI_Procedure.FFBDeletePreCreatedEffect, + AI_Procedure.FFBDeleteAllPreCreatedEffectForAPad, + AI_Procedure.FFBDeleteAllPreCreatedEffectForAllPad, + AI_Procedure.FFBStopEffect, + AI_Procedure.NetDescribeVarVector, + AI_Procedure.NetDescribeVarReal, + AI_Procedure.NetDescribeVarInteger, + AI_Procedure.NetDescribeVarReal2, + AI_Procedure.NetDescribeVarInteger2, + AI_Procedure.NetDescribeVarVector2, + AI_Procedure.NetDescribeVarPerso, + AI_Procedure.NetDescribeVarBoolean, + AI_Procedure.NetEndDataDescription, + AI_Procedure.NetRequestAuthority, + AI_Procedure.NetRelinquishAuthority, + AI_Procedure.NetChangeActionByIndex, + AI_Procedure.NetConnectAndLogin, + AI_Procedure.NetDisconnect, + AI_Procedure.NetGetGroupInfo, + AI_Procedure.NetEnterGroup, + AI_Procedure.NetLeaveGroup, + AI_Procedure.NetResetString, + AI_Procedure.NetDescribeVarInterpolator, + AI_Procedure.Net_Inter_SetActorToMonitor, + AI_Procedure.Net_Inter_SetInterpolationType, + AI_Procedure.Net_Inter_SetInterpolationType2, + AI_Procedure.NetSetNetworkMode, + AI_Procedure.NetUpdateLANServerList, + AI_Procedure.NetSetPlayerName, + AI_Procedure.SetServerGameParam, + AI_Procedure.DisconnectFromServer, + AI_Procedure.SND_SetMechaSoundCharacter, + AI_Procedure.SND_SetMicroActivation, + AI_Procedure.SND_SaveCurrentTheme, + AI_Procedure.SND_RestoreLastTheme, + AI_Procedure.SendSoundRequest, + AI_Procedure.SendVoiceRequest, + AI_Procedure.SendMusicRequest, + AI_Procedure.SendAmbianceRequest, + AI_Procedure.SendMenuSndRequest, + AI_Procedure.SND_SendSoundRequestSemaphore, + AI_Procedure.SND_SendVoiceRequestSemaphore, + AI_Procedure.SND_SendMusicRequestSemaphore, + AI_Procedure.SND_SendAmbianceRequestSemaphore, + AI_Procedure.SND_SendMenuSndRequestSemaphore, + AI_Procedure.SND_StopSound, + AI_Procedure.SND_StopVoice, + AI_Procedure.SND_StopMusic, + AI_Procedure.SND_StopAmbiance, + AI_Procedure.SND_StopMenuSnd, + AI_Procedure.SND_StopAllRequests, + AI_Procedure.SND_SetSemaphoreCapacity, + AI_Procedure.SND_KillSemaphore, + AI_Procedure.SND_LoadBank, + AI_Procedure.SND_UnloadBank, + AI_Procedure.SND_SetVolumeSound, + AI_Procedure.SND_SetVolumeVoice, + AI_Procedure.SND_SetVolumeMusic, + AI_Procedure.SND_SetVolumeAmbiance, + AI_Procedure.SND_SetVolumeMenuSnd, + AI_Procedure.SND_ChangeVolumeSound, + AI_Procedure.SND_ChangeVolumeVoice, + AI_Procedure.SND_ChangeVolumeMusic, + AI_Procedure.SND_ChangeVolumeAmbiance, + AI_Procedure.SND_ChangeVolumeMenuSnd, + AI_Procedure.SND_PauseSound, + AI_Procedure.SND_PauseVoice, + AI_Procedure.SND_PauseMusic, + AI_Procedure.SND_PauseAmbiance, + AI_Procedure.SND_PauseMenuSound, + AI_Procedure.SND_PauseAllRequests, + AI_Procedure.SND_ResumeSound, + AI_Procedure.SND_ResumeVoice, + AI_Procedure.SND_ResumeMusic, + AI_Procedure.SND_ResumeAmbiance, + AI_Procedure.SND_ResumeMenuSound, + AI_Procedure.SND_ResumeAllRequests, + AI_Procedure.SetDopplerEffect, + AI_Procedure.SetInStereoMode, + AI_Procedure.SND_SetPrevMusicFadeOut, + AI_Procedure.SND_SetRollOffDistances, + AI_Procedure.SND_SetDefaultRollOffDistances, + AI_Procedure.SND_SaveSoundEventInSlotMemory, + AI_Procedure.SND_RestoreSoundEventInSlotMemory, + AI_Procedure.ORB_Menu_Init, + AI_Procedure.ORB_Menu_Destroy, + AI_Procedure.ORB_Menu_SetButtonModifiers, + AI_Procedure.ORB_Menu_SetMPButtonModifiers, + AI_Procedure.ORB_Menu_AddPage, + AI_Procedure.ORB_Menu_RemovePage, + AI_Procedure.ORB_Menu_AddWindow, + AI_Procedure.ORB_Menu_RemoveWindow, + AI_Procedure.ORB_Page_AddOrbit, + AI_Procedure.ORB_Menu_RemoveOrbit, + AI_Procedure.ORB_Orbit_AddDisc, + AI_Procedure.ORB_Menu_RemoveDisc, + AI_Procedure.ORB_Disc_AddButtonSet, + AI_Procedure.ORB_Menu_RemoveButtonSet, + AI_Procedure.ORB_ButtonSet_AddButton, + AI_Procedure.ORB_Menu_RemoveButton, + AI_Procedure.ORB_Menu_SetCurrentPage, + AI_Procedure.ORB_Menu_SetCurrentWindow, + AI_Procedure.ORB_Menu_SetCurrentOrbit, + AI_Procedure.ORB_Menu_SetCurrentDisc, + AI_Procedure.ORB_Menu_SetCurrentButtonSet, + AI_Procedure.ORB_Menu_SetCurrentButton, + AI_Procedure.ORB_Page_SetData, + AI_Procedure.ORB_Window_SetData, + AI_Procedure.ORB_Orbit_SetData, + AI_Procedure.ORB_Disc_SetData, + AI_Procedure.ORB_Disc_SetCenterButtonData, + AI_Procedure.ORB_Button_SetData, + AI_Procedure.ORB_ButtonSet_AddButton_SetData, + AI_Procedure.ORB_Button_SetIconData, + AI_Procedure.ORB_Window_SetStatusFlag, + AI_Procedure.ORB_Window_ResetStatusFlag, + AI_Procedure.ORB_Button_SetStatusFlag, + AI_Procedure.ORB_Button_ResetStatusFlag, + AI_Procedure.ORB_Page_Update, + AI_Procedure.ORB_Disc_Display, + AI_Procedure.ORB_Disc_ChangePointedButtonStatus, + AI_Procedure.ORB_Disc_GenerateSeparators, + AI_Procedure.SetSingleplayerMode, + AI_Procedure.SetMultiplayerMode, + AI_Procedure.DoNotLoadTextures, + AI_Procedure.DoNotLoadMaterialTextures, + AI_Procedure.SetFamilyToLoad, + AI_Procedure.SetActorToLoad, + AI_Procedure.MonitoringStart, + AI_Procedure.MonitoringStop, + AI_Procedure.EnableWidescreen, + AI_Procedure.DisableWidescreen, + }; + } + #endregion + } +} diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/AI/Types/RaymanArena/AI_Types_RA_PS2.cs.meta b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/AI/Types/RaymanArena/AI_Types_RA_PS2.cs.meta new file mode 100644 index 00000000..df917060 --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/AI/Types/RaymanArena/AI_Types_RA_PS2.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 5ab1c53709e3f19489458f85dab695a4 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/AI/Types/TonicTrouble.meta b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/AI/Types/TonicTrouble.meta new file mode 100644 index 00000000..cd932ea0 --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/AI/Types/TonicTrouble.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 496fa41593dc53f4a9efc47d659f0590 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/AI/Types/TonicTrouble/AI_Types_TTSE.cs b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/AI/Types/TonicTrouble/AI_Types_TTSE.cs new file mode 100644 index 00000000..9d0e24d1 --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/AI/Types/TonicTrouble/AI_Types_TTSE.cs @@ -0,0 +1,684 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace BinarySerializer.Ubisoft.CPA { + public class AI_Types_TTSE : AI_Types { + // Re-checked + + #region DsgVar Types + protected override void InitVariableTypes() { + VariableTypes = new AI_DsgVarType[] { + AI_DsgVarType.Boolean, + AI_DsgVarType.SByte, + AI_DsgVarType.UByte, + AI_DsgVarType.Short, + AI_DsgVarType.UShort, + AI_DsgVarType.Int, + AI_DsgVarType.UInt, + AI_DsgVarType.Float, + AI_DsgVarType.WayPoint, + AI_DsgVarType.Way, + AI_DsgVarType.Perso, + AI_DsgVarType.List, + AI_DsgVarType.Vector, + AI_DsgVarType.Comport, + AI_DsgVarType.Action, + AI_DsgVarType.Text, + AI_DsgVarType.GameMaterial, + AI_DsgVarType.PersoArray, + AI_DsgVarType.VectorArray, + AI_DsgVarType.FloatArray, + AI_DsgVarType.IntegerArray, + AI_DsgVarType.WayPointArray, + AI_DsgVarType.TextArray, + }; + } + #endregion + + #region Node types + protected override void InitKeywords() { + InterpretTypes = new AI_InterpretType[] { + AI_InterpretType.KeyWord, // 0 + AI_InterpretType.Condition, + AI_InterpretType.Operator, + AI_InterpretType.Function, + AI_InterpretType.Procedure, + AI_InterpretType.MetaAction, // 5 + AI_InterpretType.BeginMacro, + AI_InterpretType.EndMacro, + AI_InterpretType.EndTree, + AI_InterpretType.Field, + AI_InterpretType.DsgVar, // 10 + AI_InterpretType.DsgVarRef, + AI_InterpretType.Constant, + AI_InterpretType.Real, + AI_InterpretType.Button, + AI_InterpretType.ConstantVector, // 15 + AI_InterpretType.Vector, + AI_InterpretType.Mask, + AI_InterpretType.Module, + AI_InterpretType.DsgVarId, + AI_InterpretType.String, // 20 + AI_InterpretType.LipsSynchroRef, + AI_InterpretType.FamilyRef, + AI_InterpretType.Way, + AI_InterpretType.PersoRef, + AI_InterpretType.ActionRef, // 25 + AI_InterpretType.EnvironmentRef, + AI_InterpretType.SuperObjectRef, + AI_InterpretType.SurfaceRef, + AI_InterpretType.WayPointRef, + AI_InterpretType.TextRef, // 30 + AI_InterpretType.FontRef, + AI_InterpretType.ComportRef, + AI_InterpretType.ModuleRef, + AI_InterpretType.SoundEventRef, + AI_InterpretType.ObjectTableRef, // 35 + AI_InterpretType.GameMaterialRef, + AI_InterpretType.ParticleGenerator, + AI_InterpretType.Color, + AI_InterpretType.ModelRef, + AI_InterpretType.Caps, + AI_InterpretType.GraphRef + }; + } + #endregion + + #region Keywords + protected override void InitInterpretTypes() { + Keywords = new AI_Keyword[] { + AI_Keyword.If, + AI_Keyword.Then, + AI_Keyword.Else, + AI_Keyword.EngineGoto, + AI_Keyword.Me, + AI_Keyword.MainActor, + AI_Keyword.World, + AI_Keyword.Nobody, + AI_Keyword.Nowhere + }; + } + #endregion + + #region Operators + protected override void InitOperators() { + Operators = new AI_Operator[] { + AI_Operator.ScalarPlusScalar, + AI_Operator.ScalarMinusScalar, + AI_Operator.ScalarMulScalar, + AI_Operator.ScalarDivScalar, + AI_Operator.ScalarUnaryMinus, + AI_Operator.PlusAffect, + AI_Operator.MinusAffect, + AI_Operator.MulAffect, + AI_Operator.DivAffect, + AI_Operator.PlusPlusAffect, + AI_Operator.MinusMinusAffect, + AI_Operator.Affect, + AI_Operator.Dot, + AI_Operator.GetVectorX, + AI_Operator.GetVectorY, + AI_Operator.GetVectorZ, + AI_Operator.VectorPlusVector, + AI_Operator.VectorMinusVector, + AI_Operator.VectorMulScalar, + AI_Operator.VectorDivScalar, + AI_Operator.VectorUnaryMinus, + AI_Operator.SetVectorX, + AI_Operator.SetVectorY, + AI_Operator.SetVectorZ, + AI_Operator.Ultra, + AI_Operator.ModelCast, + AI_Operator.Array, + AI_Operator.AffectArray, + }; + } + #endregion + + #region Meta Actions + protected override void InitMetaActions() { + MetaActions = new AI_MetaAction[] { + AI_MetaAction.IncrementalTurn2, + AI_MetaAction.IncrementalTurn, + AI_MetaAction.Pursuit, + AI_MetaAction.DeltaPursuit, + AI_MetaAction.ExecuteAction, + AI_MetaAction.WaitEndOfAction, + AI_MetaAction.WaitEndOfAnim, + AI_MetaAction.SpeakAndWaitEnd, + AI_MetaAction.ExecuteActionAndTakeObject, + AI_MetaAction.ExecuteActionAndPutObject, + AI_MetaAction.ExecuteActionAndLaunchObject, + AI_MetaAction.ExecuteActionAndGenerateObject, + AI_MetaAction.AdjustPersoOnObjectAxes, + AI_MetaAction.AdjustPersoOnObject, + AI_MetaAction.RunAway, + AI_MetaAction.IncrementalTurnPosition, + AI_MetaAction.IncrementalDeltaTurnPerso2, + AI_MetaAction.IncrementalTurnPerso2, + AI_MetaAction.IncrementalDeltaTurnPerso, + AI_MetaAction.IncrementalTurnPerso, + AI_MetaAction.RunAwayWP, + AI_MetaAction.GoToWP, + AI_MetaAction.GoOverWay, + AI_MetaAction.GoOverWay3D, + AI_MetaAction.GoOverWayBack, + AI_MetaAction.GoToNextWPOfWay, + AI_MetaAction.GoToNextWPOfWayBack, + AI_MetaAction.GoToPosition, + AI_MetaAction.MoveLift, + AI_MetaAction.Camera_GoToPosition, + AI_MetaAction.Camera_GoToWP, + AI_MetaAction.Camera_GoOverWay, + AI_MetaAction.Camera_GoOverWayBack, + AI_MetaAction.Camera_GoToNextWPOfWay, + AI_MetaAction.Camera_GoToNextWPOfWayBack, + AI_MetaAction.Camera_StayInWay, + AI_MetaAction.Camera_GoToFromTarget, + AI_MetaAction.Camera_Shake, + AI_MetaAction.Camera_WaitUntil, + AI_MetaAction.RotateModule, + AI_MetaAction.RotateModuleToPerso, + AI_MetaAction.SwimToSurface + }; + } + #endregion + + #region Conditions + protected override void InitConditions() { + Conditions = new AI_Condition[] { + AI_Condition.Et, + AI_Condition.Ou, + AI_Condition.Not, + AI_Condition.Equal, + AI_Condition.Different, + AI_Condition.Lesser, + AI_Condition.Greater, + AI_Condition.LesserOrEqual, + AI_Condition.GreaterOrEqual, + AI_Condition.PressedBut, + AI_Condition.JustPressedBut, + AI_Condition.ReleasedBut, + AI_Condition.JustReleasedBut, + AI_Condition.CollidePersoZDDNoWithPerso, + AI_Condition.CollideModuleZDDNoWithPerso, + AI_Condition.CollidePersoAllZDDWithPerso, + AI_Condition.CollidePersoZDDWithAnyPerso, + AI_Condition.CollideModuleZDDWithAnyPerso, + AI_Condition.CollidePersoZDENoWithPersoZDENo, + AI_Condition.CollideModuleZDENoWithPersoZDENo, + AI_Condition.CollidePersoZDENoWithModuleZDENo, + AI_Condition.CollideModuleZDENoWithModuleZDENo, + AI_Condition.CollidePersoZDENoWithPersoTypeZDE, + AI_Condition.CollideModuleZDENoWithPersoTypeZDE, + AI_Condition.CollidePersoTypeZDEWithPersoTypeZDE, + AI_Condition.CollidePersoAllZDEWithPersoAllZDE, + AI_Condition.CollidePersoTypeZDEWithPersoAllZDE, + AI_Condition.CollidePersoAllZDEWithPersoTypeZDE, + AI_Condition.CollidePersoZDENoWithTypeZDE, + AI_Condition.CollideModuleZDENoWithTypeZDE, + AI_Condition.CollideMovingZDM, + AI_Condition.CollideWithGround, + AI_Condition.CollideWithWall, + AI_Condition.CollideWithNothing, + AI_Condition.CollideWithSlope, + AI_Condition.CollideWithAttic, + AI_Condition.CollideWithCeiling, + AI_Condition.CollideWithPerso, + AI_Condition.CollideWithTrap, + AI_Condition.CollideWithPoint, + AI_Condition.CollideWithTriangle, + AI_Condition.CollideWithEdge, + AI_Condition.CollideWithSphere, + AI_Condition.CollideWithAlignedBox, + AI_Condition.ZDMCollideWithGround, + AI_Condition.ZDMCollideWithWall, + AI_Condition.ZDMCollideWithNothing, + AI_Condition.ZDMCollideWithSlope, + AI_Condition.ZDMCollideWithAttic, + AI_Condition.ZDMCollideWithCeiling, + AI_Condition.InEnvironmentAir, + AI_Condition.InEnvironmentWater, + AI_Condition.InEnvironmentFire, + AI_Condition.IsPersoInList, + AI_Condition.ListEmptyTest, + AI_Condition.IsTimeElapsed, + AI_Condition.IsInComport, + AI_Condition.ChangeActionEnable, + AI_Condition.IsInAction, + AI_Condition.IsTypeOfGMTCollide, + AI_Condition.IsThereMechEvent, + AI_Condition.IsValidObject, + AI_Condition.IsValidWayPoint, + AI_Condition.IsValidGMT, + AI_Condition.IsValidAction, + AI_Condition.InTopOfJump, + AI_Condition.CanSwim, + AI_Condition.CanSwimOnSurface, + AI_Condition.CanSwimUnderWater, + AI_Condition.IsNotOutOfDepth, + AI_Condition.IsCompletelyOutOfWater, + AI_Condition.IsSpeechOver, + AI_Condition.SeePerso, + AI_Condition.IsSectorInTranslation, + AI_Condition.IsSectorInRotation, + AI_Condition.IsCameraInState, + AI_Condition.IsCameraInInitialState, + AI_Condition.IsCameraActive, + AI_Condition.IsCameraViewportOwner, + AI_Condition.IsCameraTargetVisible, + AI_Condition.IsCameraTargetMoving, + AI_Condition.IsCameraReachedItsOptPos, + AI_Condition.IsCameraInAlphaOrientation, + AI_Condition.IsCameraInTetaOrientation, + AI_Condition.IsSurfaceHeightMoving, + AI_Condition.CanIAddObjectInInventory, + AI_Condition.TestPower, + AI_Condition.IsActivable, + AI_Condition.HasAtLeft, + AI_Condition.HasAtRight, + AI_Condition.HasBehind, + AI_Condition.HasInFront, + AI_Condition.HasAbove, + AI_Condition.HasBelow, + AI_Condition.UserEvent_IsSet, + AI_Condition.IsPersoLightOn, + AI_Condition.IsPersoLightPulseOn, + AI_Condition.IsPersoLightGyroPhareOn, + }; + } + #endregion + + #region Fields + protected override void InitFields() { + Fields = new AI_Field[] { + AI_Field.Position, + AI_Field.Orientation, + AI_Field.Speed, + AI_Field.NormSpeed, + AI_Field.SightAxis, + AI_Field.FirstCompAxis, + AI_Field.SecondCompAxis, + AI_Field.AbsoluteAxisX, + AI_Field.AbsoluteAxisY, + AI_Field.AbsoluteAxisZ, + AI_Field.PrevComportIntell, + AI_Field.PrevComportReflex, + AI_Field.CollisionFlag, + AI_Field.ShadowScaleX, + AI_Field.ShadowScaleY + }; + } + #endregion + + #region Functions + protected override void InitFunctions() { + Functions = new AI_Function[] { + AI_Function.GetPersoAbsolutePosition, + AI_Function.GetAngleAroundZToPerso, + AI_Function.GetWPAbsolutePosition, + AI_Function.DistanceToPerso, + AI_Function.DistanceXToPerso, + AI_Function.DistanceYToPerso, + AI_Function.DistanceZToPerso, + AI_Function.DistanceXYToPerso, + AI_Function.DistanceXZToPerso, + AI_Function.DistanceYZToPerso, + AI_Function.DistanceToWP, + AI_Function.CloserWP, + AI_Function.DistanceToPersoCenter, + AI_Function.DistanceXToPersoCenter, + AI_Function.DistanceYToPersoCenter, + AI_Function.DistanceZToPersoCenter, + AI_Function.DistanceXYToPersoCenter, + AI_Function.DistanceXZToPersoCenter, + AI_Function.DistanceYZToPersoCenter, + AI_Function.Real, + AI_Function.Int, + AI_Function.Sinus, + AI_Function.Cosinus, + AI_Function.Square, + AI_Function.SquareRoot, + AI_Function.RandomInt, + AI_Function.RandomReal, + AI_Function.MinimumReal, + AI_Function.MaximumReal, + AI_Function.DegreeToRadian, + AI_Function.RadianToDegree, + AI_Function.AbsoluteValue, + AI_Function.GetHitPoints, + AI_Function.AddAndGetHitPoints, + AI_Function.SubAndGetHitPoints, + AI_Function.GetHitPointsMax, + AI_Function.AddAndGetHitPointsMax, + AI_Function.SubAndGetHitPointsMax, + AI_Function.GetTime, + AI_Function.GetElapsedTime, + AI_Function.ListSize, + AI_Function.GivePersoInList, + AI_Function.InputAnalogicValue, + AI_Function.GenerateObject, + AI_Function.DepthEnv, + AI_Function.AltitudeEnv, + AI_Function.GetFather, + AI_Function.GetCamera, + AI_Function.GetMainCamera, + AI_Function.GetDistanceCameraTarget, + AI_Function.GetTargetCamera, + AI_Function.GetDistMinCamera, + AI_Function.GetDistMaxCamera, + AI_Function.GetBoundDistMin, + AI_Function.GetBoundDistMax, + AI_Function.GetAlphaCamera, + AI_Function.GetShiftAlphaCamera, + AI_Function.GetTetaCamera, + AI_Function.GetShiftTetaCamera, + AI_Function.GetOrientationXCamera, + AI_Function.GetOrientationYCamera, + AI_Function.GetOrientationZCamera, + AI_Function.GetCamLinearSpeedMin, + AI_Function.GetCamLinearSpeedMax, + AI_Function.GetCamAngularSpeed, + AI_Function.GetTgtLinearSpeed, + AI_Function.GetFocalCamera, + AI_Function.GetStateCamera, + AI_Function.GetFlagCamera, + AI_Function.GetActivationCamera, + AI_Function.GetShiftPersoCamera, + AI_Function.GetShiftVertexCamera, + AI_Function.GetLookVertexCamera, + AI_Function.ComputeAlphaAngleCameraTarget, + AI_Function.ComputeTetaAngleCameraTarget, + AI_Function.GetOrientationSpeed, + AI_Function.GetOrientationLimitX, + AI_Function.GetOrientationLimitY, + AI_Function.GetOrientationLimitZ, + AI_Function.ComputeTargetPosition, + AI_Function.GetNormSpeed, + AI_Function.GetAlphaPas, + AI_Function.GetThetaPas, + AI_Function.GetAlpha, + AI_Function.GetTheta, + AI_Function.GetCurrentObjectInInventory, + AI_Function.GetObjectNumberInInventory, + AI_Function.UseObjectFromInventory, + AI_Function.UseNObjectsFromInventory, + AI_Function.GetVectorNorm, + AI_Function.AbsoluteVector, + AI_Function.RelativeVector, + AI_Function.GetEnvironmentToxicity, + AI_Function.AddColor, + AI_Function.AddRed, + AI_Function.AddGreen, + AI_Function.AddBlue, + AI_Function.AddAlpha, + AI_Function.ColorRedGreenBlueAlpha, + AI_Function.ColorRedGreenBlue, + AI_Function.ColorRed, + AI_Function.ColorGreen, + AI_Function.ColorBlue, + AI_Function.ColorAlpha, + AI_Function.GetCurrentCollidedGMT, + AI_Function.GetMechanicalGMTAdhesionCoef, + AI_Function.GetMechanicalGMTAbsorptionCoef, + AI_Function.GetMechanicalGMTFrictionCoef, + AI_Function.GetMechanicalGMTSlideCoef, + AI_Function.GetMechanicalGMTProgressionCoef, + AI_Function.GetMechanicalGMTPenetrationCoef, + AI_Function.GetMechanicalGMTPenetrationMaxCoef, + AI_Function.GetVisualGMTColor, + AI_Function.GetVisualGMTSpecularCoef, + AI_Function.GetVisualGMTSpecularExponent, + AI_Function.GetVisualGMTDiffuseCoef, + AI_Function.GetVisualGMTAmbientCoef, + AI_Function.GetVisualGMTTextureScrollingCoefU, + AI_Function.GetVisualGMTTextureScrollingCoefV, + AI_Function.GetVisualGMTFrame, + AI_Function.GetVisualGMTNumberOfFrames, + }; + } + #endregion + + #region Procedures + protected override void InitProcedures() { + Procedures = new AI_Procedure[] { + AI_Procedure.PlayerIsDead, + AI_Procedure.SetMainActor, + AI_Procedure.ActivateObject, + AI_Procedure.DesactivateObject, + AI_Procedure.ChangeMap, + AI_Procedure.SetActionReturn, + AI_Procedure.FactorAnimationFrameRate, + AI_Procedure.PlayerIsDeadWithOption, + AI_Procedure.BecomesSonOfPerso, + AI_Procedure.BecomesFatherOfPerso, + AI_Procedure.FillListWithSons, + AI_Procedure.ActivateObjectOnPosition, + AI_Procedure.ChangeMapAtPosition, + AI_Procedure.PlayerIsDeadWithPlacement, + AI_Procedure.AllowDynamLOD, + AI_Procedure.ForbidDynamLOD, + AI_Procedure.ResetSpeed, + AI_Procedure.ResetOrientation, + AI_Procedure.SetRotationAxe, + AI_Procedure.SetAlphaAngle, + AI_Procedure.SetThetaAngle, + AI_Procedure.SetImpulse, + AI_Procedure.SetNormSpeed, + AI_Procedure.AddNormSpeed, + AI_Procedure.MulNormSpeed, + AI_Procedure.SetDirectionSpeed, + AI_Procedure.AddDirectionSpeed, + AI_Procedure.SetVectorSpeed, + AI_Procedure.SetDynamScalar, + AI_Procedure.SetTarget, + AI_Procedure.TurnAround, + AI_Procedure.GoRelative, + AI_Procedure.GoInDirection, + AI_Procedure.TurnLeft, + AI_Procedure.TurnRight, + AI_Procedure.TurnUp, + AI_Procedure.TurnDown, + AI_Procedure.Pulse, + AI_Procedure.StonePulse, + AI_Procedure.Jump, + AI_Procedure.JumpAbsolute, + AI_Procedure.JumpWithoutAddingSpeed, + AI_Procedure.Fire, + AI_Procedure.GoTarget, + AI_Procedure.ReachTarget, + AI_Procedure.SetHitPoints, + AI_Procedure.SetHitPointsToInitValue, + AI_Procedure.SetHitPointsToMaxValue, + AI_Procedure.AddHitPoints, + AI_Procedure.SubHitPoints, + AI_Procedure.SetHitPointsMax, + AI_Procedure.SetHitPointsMaxToInitValue, + AI_Procedure.SetHitPointsMaxToMaxValue, + AI_Procedure.AddHitPointsMax, + AI_Procedure.SubHitPointsMax, + AI_Procedure.ListAffectPersoZDD, + AI_Procedure.ListAffectModuleZDD, + AI_Procedure.ListAffectPersoZDE, + AI_Procedure.ListAffectModuleZDE, + AI_Procedure.ListAffectPersoTypeZDE, + AI_Procedure.ListAffectModuleTypeZDE, + AI_Procedure.ListAffectTypeZDEWithTypeZDE, + AI_Procedure.AddPersoInList, + AI_Procedure.AddPersoInListAt, + AI_Procedure.DeletePersoAtInList, + AI_Procedure.FindPersoAndDeleteInList, + AI_Procedure.ListSelect, + AI_Procedure.ListUnSelect, + AI_Procedure.ListSort, + AI_Procedure.ListSortByFamily, + AI_Procedure.FillListWithAllPersoOfAFamily, + AI_Procedure.ListUnion, + AI_Procedure.ListInter, + AI_Procedure.ListDiff, + AI_Procedure.ListAdd, + AI_Procedure.SwapLinkTableObjects, + AI_Procedure.ChangeCurrentObjectTable, + AI_Procedure.CopyObjectFromTableToTable, + AI_Procedure.StartSpeech, + AI_Procedure.StopSpeech, + AI_Procedure.TakeModuleControl, + AI_Procedure.ReleaseModuleControl, + AI_Procedure.InitModuleControlWithAnimTranslation, + AI_Procedure.InitModuleControlWithAnimRotation, + AI_Procedure.RotateSector, + AI_Procedure.RotateSectorLocalX, + AI_Procedure.RotateSectorLocalY, + AI_Procedure.RotateSectorLocalZ, + AI_Procedure.LevelSaveRotationSector, + AI_Procedure.PlayerSaveRotationSector, + AI_Procedure.TranslateSector, + AI_Procedure.TranslateLocalSector, + AI_Procedure.SaveGame, + AI_Procedure.IncHistoryAndSaveGame, + AI_Procedure.ActivateChannel, + AI_Procedure.DeactivateChannel, + AI_Procedure.FogOn, + AI_Procedure.FogOff, + AI_Procedure.SetFogColor, + AI_Procedure.SetFogNearFarInf, + AI_Procedure.PersoLightOn, + AI_Procedure.PersoLightOff, + AI_Procedure.SetPersoLightColor, + AI_Procedure.SetPersoLightNearFar, + AI_Procedure.SetPersoLightLittleBigAlpha, + AI_Procedure.SetPersoLightGyrophare, + AI_Procedure.SetPersoLightPulse, + AI_Procedure.SetPersoLightParalleleType, + AI_Procedure.SetPersoLightSphericalType, + AI_Procedure.SetPersoLightHotSpotType, + AI_Procedure.SetPersoLightAmbientType, + AI_Procedure.AddSurfaceHeight, + AI_Procedure.MoveSurfaceHeight, + AI_Procedure.AddObjectInInventory, + AI_Procedure.SendSoundRequest, + AI_Procedure.SendVoiceRequest, + AI_Procedure.SendMusicRequest, + AI_Procedure.DisplaylValue, + AI_Procedure.DisplaylChrono, + AI_Procedure.DisplayString, + AI_Procedure.ActivateString, + AI_Procedure.EraseString, + AI_Procedure.Camera_UpdatePosition, + AI_Procedure.Camera_Reset, + AI_Procedure.Camera_RestoreAfterTrame, + AI_Procedure.Camera_CancelRestoreTrame, + AI_Procedure.Camera_ShowInfo, + AI_Procedure.Camera_ChangeCamera, + AI_Procedure.Camera_ActiveCamera, + AI_Procedure.Camera_ChangeDistance, + AI_Procedure.Camera_ChangeBoundDist, + AI_Procedure.Camera_ChangeCamLinearSpeed, + AI_Procedure.Camera_ChangeCamLinearInertia, + AI_Procedure.Camera_ChangeCamAngularSpeed, + AI_Procedure.Camera_ChangeCamAngularInertia, + AI_Procedure.Camera_ChangeTgtLinearSpeed, + AI_Procedure.Camera_MoveTarget, + AI_Procedure.Camera_MoveLookTarget, + AI_Procedure.Camera_MoveShift, + AI_Procedure.Camera_ChangeAngle, + AI_Procedure.Camera_Move, + AI_Procedure.Camera_Turn, + AI_Procedure.Camera_ManageSavePos, + AI_Procedure.Camera_ChangeState, + AI_Procedure.Camera_ChangeFocal, + AI_Procedure.Camera_ActivateFocalParsing, + AI_Procedure.Camera_ChangeTargetedPerso, + AI_Procedure.Camera_RestoreInitialTargetedPerso, + AI_Procedure.Camera_Shake, + AI_Procedure.Camera_SetPosition, + AI_Procedure.Camera_ChangeFlag, + AI_Procedure.Camera_SavePositionAsOptimal, + AI_Procedure.Camera_SetAdditionnalTarget, + AI_Procedure.Camera_SetApexParameters, + AI_Procedure.Camera_SetCameraZMax, + AI_Procedure.Camera_ResetCameraZMax, + AI_Procedure.Camera_SetCameraZMin, + AI_Procedure.Camera_ResetCameraZMin, + AI_Procedure.Camera_SetCameraOrientation, + AI_Procedure.Camera_SetCameraPosition, + AI_Procedure.Camera_SetTargetPosition, + AI_Procedure.Camera_ChangeOrientationAngleMax, + AI_Procedure.Camera_ChangeOrientationAngularSpeed, + AI_Procedure.Camera_ChangeChannel, + AI_Procedure.Camera_ChangeHard, + AI_Procedure.Camera_RepositionHard, + AI_Procedure.SetPower, + AI_Procedure.SubPower, + AI_Procedure.AddPower, + AI_Procedure.TransparentDisplay, + AI_Procedure.DefaultDisplay, + AI_Procedure.SetTransparency, + AI_Procedure.DisplayFixFlag, + AI_Procedure.StartMenuWithPauseGame, + AI_Procedure.StartMenuWithoutPauseGame, + AI_Procedure.DisplayVignetteDuringTime, + AI_Procedure.PRT_SetGeneratorOn, + AI_Procedure.PRT_SetGeneratorOff, + AI_Procedure.PRT_SetGenerator, + AI_Procedure.PRT_SetModeNone, + AI_Procedure.PRT_SetModeContinuous, + AI_Procedure.PRT_SetModeCrenel, + AI_Procedure.PRT_SetModeProbability, + AI_Procedure.SetGenerationNumberConstant, + AI_Procedure.SetGenerationNumberProbabilist, + AI_Procedure.SetGenerationInfiniteLifeTime, + AI_Procedure.SetGenerationConstantLifeTime, + AI_Procedure.SetGenerationProbabilistLifeTime, + AI_Procedure.DeactivateBut, + AI_Procedure.ActivateBut, + AI_Procedure.None, + AI_Procedure.ChangeComport, + AI_Procedure.ChangeComportReflex, + AI_Procedure.ChangeMyComport, + AI_Procedure.ChangeMyComportReflex, + AI_Procedure.TurnAbsoluteDirection, + AI_Procedure.GoAbsoluteDirection, + AI_Procedure.Accelerate, + AI_Procedure.Turn, + AI_Procedure.Turn2, + AI_Procedure.DeltaTurnPerso, + AI_Procedure.TurnPerso, + AI_Procedure.ChangeAction, + AI_Procedure.ChangeActionRandom, + AI_Procedure.ReInitWay, + AI_Procedure.ReInitWayBack, + AI_Procedure.InitWayWithWp, + AI_Procedure.SwimPulse, + AI_Procedure.Ski_TurnLeft, + AI_Procedure.Ski_TurnRight, + AI_Procedure.KillPerso, + AI_Procedure.SetMechanicalGMTAdhesionCoef, + AI_Procedure.SetMechanicalGMTAbsorptionCoef, + AI_Procedure.SetMechanicalGMTFrictionCoef, + AI_Procedure.SetMechanicalGMTSlideCoef, + AI_Procedure.SetMechanicalGMTProgressionCoef, + AI_Procedure.SetMechanicalGMTPenetrationCoef, + AI_Procedure.SetMechanicalGMTPenetrationMaxCoef, + AI_Procedure.SetVisualGMTColor, + AI_Procedure.SetVisualGMTSpecularExponent, + AI_Procedure.SetVisualGMTSpecularCoef, + AI_Procedure.SetVisualGMTDiffuseCoef, + AI_Procedure.SetVisualGMTAmbientCoef, + AI_Procedure.SetVisualGMTAsChromed, + AI_Procedure.SetVisualGMTTextureScrollingCoef, + AI_Procedure.LockVisualGMT, + AI_Procedure.UnlockVisualGMT, + AI_Procedure.SetVisualGMTFrame, + AI_Procedure.FootPath_AddFootPrint, + AI_Procedure.FootPath_Clear, + }; + } + #endregion + + } + +} diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/AI/Types/TonicTrouble/AI_Types_TTSE.cs.meta b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/AI/Types/TonicTrouble/AI_Types_TTSE.cs.meta new file mode 100644 index 00000000..f6ff6227 --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/AI/Types/TonicTrouble/AI_Types_TTSE.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: d8641f0a238170741bba6e34e9f25d9d +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/COL.meta b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/COL.meta new file mode 100644 index 00000000..2fcbf039 --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/COL.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 038277b4996beaa488a05734eee2f8a7 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/COL/Enums.meta b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/COL/Enums.meta new file mode 100644 index 00000000..7098f5fc --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/COL/Enums.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 43baea5384dbd1d44bc6bc9f7f72f1a1 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/COL/Enums/COL_Type_ZDE.cs b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/COL/Enums/COL_Type_ZDE.cs new file mode 100644 index 00000000..76dcc913 --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/COL/Enums/COL_Type_ZDE.cs @@ -0,0 +1,8 @@ +namespace BinarySerializer.Ubisoft.CPA { + public enum COL_Type_ZDE { + Undefined, + JaiMal, + JeFaisMal, + Grappin, + } +} \ No newline at end of file diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/COL/Enums/COL_Type_ZDE.cs.meta b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/COL/Enums/COL_Type_ZDE.cs.meta new file mode 100644 index 00000000..a551ef7b --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/COL/Enums/COL_Type_ZDE.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 947b408de7d385840be9735ac566a49b +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/COL/Enums/COL_Type_ZDM.cs b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/COL/Enums/COL_Type_ZDM.cs new file mode 100644 index 00000000..8127991a --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/COL/Enums/COL_Type_ZDM.cs @@ -0,0 +1,11 @@ +namespace BinarySerializer.Ubisoft.CPA { + public enum COL_Type_ZDM { + Undefined, + Pieds, + Corps, + Tete, + Mains, + TraverseSol, + CollisionneEau, + } +} \ No newline at end of file diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/COL/Enums/COL_Type_ZDM.cs.meta b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/COL/Enums/COL_Type_ZDM.cs.meta new file mode 100644 index 00000000..e6ed88d7 --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/COL/Enums/COL_Type_ZDM.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 521a8ce34b60b514c836adf6cc4c72dc +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/COL/Enums/COL_Type_ZDR.cs b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/COL/Enums/COL_Type_ZDR.cs new file mode 100644 index 00000000..43acac2c --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/COL/Enums/COL_Type_ZDR.cs @@ -0,0 +1,20 @@ +namespace BinarySerializer.Ubisoft.CPA { + public enum COL_Type_ZDR { + Undefined, + Glissant, + Rebondissant, + Accrochage, + User1, + GrappinBis, + Gi, + Varappe, + Electrique, + Lave, + ChuteInfinie, + Mal, + Mort, + User2, + Eau, + NonCollisionnable, + } +} \ No newline at end of file diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/COL/Enums/COL_Type_ZDR.cs.meta b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/COL/Enums/COL_Type_ZDR.cs.meta new file mode 100644 index 00000000..c2ad22a7 --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/COL/Enums/COL_Type_ZDR.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 2c0ace0e2d4d11a4387f7a0ba74a3f22 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/COL/Types.meta b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/COL/Types.meta new file mode 100644 index 00000000..916602a6 --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/COL/Types.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 9abcdb2f97d9efa4f8d7bac66a053655 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/COL/Types/COL_Types.cs b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/COL/Types/COL_Types.cs new file mode 100644 index 00000000..97b33285 --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/COL/Types/COL_Types.cs @@ -0,0 +1,34 @@ +using System.Collections.Generic; + +namespace BinarySerializer.Ubisoft.CPA { + public abstract class COL_Types { + public COL_Type_ZDE[] ZDE { get; protected set; } + public COL_Type_ZDM[] ZDM { get; protected set; } + public COL_Type_ZDR[] ZDR { get; protected set; } + + // TODO: Add identifier names like MAX_VARAPPE + public void Init() { + InitArrays(); + CreateDictionaries(); + } + + protected abstract void InitArrays(); + + private void CreateDictionaries() { + // TODO + } + + public COL_Type_ZDE GetType_ZDE(int type) { + if (type < ZDE.Length) return ZDE[type]; + return COL_Type_ZDE.Undefined; + } + public COL_Type_ZDM GetType_ZDM(int type) { + if (type < ZDM.Length) return ZDM[type]; + return COL_Type_ZDM.Undefined; + } + public COL_Type_ZDR GetType_ZDR(int type) { + if (type < ZDR.Length) return ZDR[type]; + return COL_Type_ZDR.Undefined; + } + } +} diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/COL/Types/COL_Types.cs.meta b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/COL/Types/COL_Types.cs.meta new file mode 100644 index 00000000..302dd009 --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/COL/Types/COL_Types.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: be88e5d6fd820b24e8e9597111ff4535 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/COL/Types/COL_Types_R2.cs b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/COL/Types/COL_Types_R2.cs new file mode 100644 index 00000000..9d4cf8fb --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/COL/Types/COL_Types_R2.cs @@ -0,0 +1,54 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace BinarySerializer.Ubisoft.CPA { + public class COL_Types_R2 : COL_Types { + protected override void InitArrays() { + ZDM = new COL_Type_ZDM[] { + COL_Type_ZDM.Pieds, + COL_Type_ZDM.Corps, + COL_Type_ZDM.Tete, + COL_Type_ZDM.Mains, + COL_Type_ZDM.TraverseSol, + COL_Type_ZDM.Undefined, + COL_Type_ZDM.Undefined, + COL_Type_ZDM.Undefined, + COL_Type_ZDM.Undefined, + COL_Type_ZDM.Undefined, + COL_Type_ZDM.Undefined, + COL_Type_ZDM.Undefined, + COL_Type_ZDM.Undefined, + COL_Type_ZDM.Undefined, + COL_Type_ZDM.CollisionneEau, + COL_Type_ZDM.Undefined, + }; + ZDE = new COL_Type_ZDE[] { + COL_Type_ZDE.JaiMal, + COL_Type_ZDE.JeFaisMal, + COL_Type_ZDE.Undefined, + COL_Type_ZDE.Grappin + }; + ZDR = new COL_Type_ZDR[] { + COL_Type_ZDR.Glissant, + COL_Type_ZDR.Rebondissant, + COL_Type_ZDR.Accrochage, + COL_Type_ZDR.User1, + COL_Type_ZDR.GrappinBis, + COL_Type_ZDR.Gi, + COL_Type_ZDR.Varappe, + COL_Type_ZDR.Electrique, + COL_Type_ZDR.Lave, + COL_Type_ZDR.ChuteInfinie, + COL_Type_ZDR.Mal, + COL_Type_ZDR.Mort, + COL_Type_ZDR.User2, + COL_Type_ZDR.Undefined, + COL_Type_ZDR.Eau, + COL_Type_ZDR.NonCollisionnable + }; + } + } +} diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/COL/Types/COL_Types_R2.cs.meta b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/COL/Types/COL_Types_R2.cs.meta new file mode 100644 index 00000000..fc79c7db --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/COL/Types/COL_Types_R2.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 7dd9c1f6ba94e0a428d213a927a84d42 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/GLI.meta b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/GLI.meta new file mode 100644 index 00000000..c93e53ba --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/GLI.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: aa25079cf2c916a40a6c3c7d9732ca5d +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/GLI/GLI_FloatColor.cs b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/GLI/GLI_FloatColor.cs new file mode 100644 index 00000000..abc67b7d --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/GLI/GLI_FloatColor.cs @@ -0,0 +1,15 @@ +using System; + +namespace BinarySerializer.Ubisoft.CPA { + public class GLI_FloatColor : BaseColor { + public GLI_FloatColor() { } + public GLI_FloatColor(float r, float g, float b, float a = 1f) : base(r, g, b, a) { } + + public override void SerializeImpl(SerializerObject s) { + Red = s.Serialize(Red, name: nameof(Red)); + Green = s.Serialize(Green, name: nameof(Green)); + Blue = s.Serialize(Blue, name: nameof(Blue)); + Alpha = s.Serialize(Alpha, name: nameof(Alpha)); + } + } +} diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/GLI/GLI_FloatColor.cs.meta b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/GLI/GLI_FloatColor.cs.meta new file mode 100644 index 00000000..e2211efc --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/GLI/GLI_FloatColor.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 0b65ec0f076ee4f4ab8444685f8c1271 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/GMT.meta b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/GMT.meta new file mode 100644 index 00000000..3ea0691f --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/GMT.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: dbaaeaa5bd1a4164da9237f3ae9cb86e +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/GMT/Enums.meta b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/GMT/Enums.meta new file mode 100644 index 00000000..926e7e72 --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/GMT/Enums.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: fa9f78c9a809c1f4ea7404082160a91a +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/GMT/Enums/GMT_ZoneType.cs b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/GMT/Enums/GMT_ZoneType.cs new file mode 100644 index 00000000..875133b2 --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/GMT/Enums/GMT_ZoneType.cs @@ -0,0 +1,8 @@ +namespace BinarySerializer.Ubisoft.CPA { + public enum GMT_ZoneType : ushort { // As used in TypeOfZone in collide materials in R2 PC + ZDM = 0, + ZDR = 1, + ZDE = 2, + ZDD = 3, + } +} \ No newline at end of file diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/GMT/Enums/GMT_ZoneType.cs.meta b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/GMT/Enums/GMT_ZoneType.cs.meta new file mode 100644 index 00000000..d2a87bde --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/GMT/Enums/GMT_ZoneType.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 1b0247a8ee72d84449f2278cd0017c4c +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/HIE.meta b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/HIE.meta new file mode 100644 index 00000000..4600dfae --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/HIE.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: cb7e8125d3b45234a95aa2560ec7dae2 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/HIE/Enums.meta b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/HIE/Enums.meta new file mode 100644 index 00000000..93369303 --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/HIE/Enums.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 88b975b1da0e4a245a83014d4877497c +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/HIE/Enums/HIE_ObjectType.cs b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/HIE/Enums/HIE_ObjectType.cs new file mode 100644 index 00000000..0213c162 --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/HIE/Enums/HIE_ObjectType.cs @@ -0,0 +1,25 @@ +using System; +namespace BinarySerializer.Ubisoft.CPA { + [Flags] + public enum HIE_ObjectType : uint { + SuperObject = 0x00000001, // SO with no linked object + Actor = 0x00000002, // actor + Sector = 0x00000004, // sector + PO = 0x00000008, // Physical Object + PO_Mirror = 0x00000010, // Physical Object Mirror (?) + IPO = 0x00000020, // Instanciated Physical Object + IPO_Mirror = 0x00000040, // Instanciated Physical Object Mirror (?) + SpecialEffect = 0x00000080, // Special Effect (?) + NoAction = 0x00000100, // empty SO (?) + Mirror = 0x00000200, // Mirror (?) + EDT_Geometric = 0x00000400, // geometric object (Editor) + EDT_Light = 0x00000800, // light object (Editor) + EDT_Waypoint = 0x00001000, // Waypoint object (Editor) + EDT_ZdD = 0x00002000, // ZdD object (Editor) + EDT_ZdE = 0x00004000, // ZdE object (Editor) + EDT_ZdM = 0x00008000, // ZdM object (Editor) + EDT_ZdR = 0x00010000, // ZdR object (Editor) + EDT_BdV = 0x00020000, // Bounding Volume object (Editor) + EDT_TestPoint = 0x00040000, // TestPoint object (Editor) + } +} diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/HIE/Enums/HIE_ObjectType.cs.meta b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/HIE/Enums/HIE_ObjectType.cs.meta new file mode 100644 index 00000000..6dd82159 --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/HIE/Enums/HIE_ObjectType.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 701341ddcbb6765469ca7eb887e6ea50 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/HIE/Enums/HIE_ObjectType_98.cs b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/HIE/Enums/HIE_ObjectType_98.cs new file mode 100644 index 00000000..e61b3794 --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/HIE/Enums/HIE_ObjectType_98.cs @@ -0,0 +1,35 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace BinarySerializer.Ubisoft.CPA { + public enum HIE_ObjectType_98 : uint { + SuperObject = 0, + Physical, + Light, + Camera, + Character, + Animation, + StaticWorld, + StandardPlatForm, + Sector, + Waypoint, + Geometric, + PhysicalObject, + SpecialEffect, + InstanciatedPhysicalObject, + A3dPickableObject, + A3dUnpickableObject, + A3dInvisibleObject, + Mirror, + PoMirror, + IpoMirror, + World = 64, + StaticSubWorld, + EngineSubWorld, + InactiveEngineSubWorld, + NoAction = 128 + } +} diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/HIE/Enums/HIE_ObjectType_98.cs.meta b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/HIE/Enums/HIE_ObjectType_98.cs.meta new file mode 100644 index 00000000..e4a23288 --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/HIE/Enums/HIE_ObjectType_98.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: c8a72e8286b7bdb4db579cf495056158 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/HIE/Enums/HIE_SuperObjectFlags.cs b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/HIE/Enums/HIE_SuperObjectFlags.cs new file mode 100644 index 00000000..b8675223 --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/HIE/Enums/HIE_SuperObjectFlags.cs @@ -0,0 +1,20 @@ +using System; +namespace BinarySerializer.Ubisoft.CPA { + [Flags] + public enum HIE_SuperObjectFlags : uint { + NotPickable = 0x00000001, // no collision + Hidden = 0x00000002, // not visible + NoTransformationMatrix = 0x00000004, // The transformation matrix is always the identity + ZoomInsteadOfScale = 0x00000008, // The scale factor is the same for the three axis + TypeOfBoundingVolume = 0x00000010, // bounding volume is a sphere instead of a box + Superimposed = 0x00000020, // displayed over all C - 0 ; non collisionnable + NotHitByRayTrace = 0x00000040, // cannot be hit by ray-tracing + NoShadowOnMe = 0x00000080, // cannot have a shadow projected on it + SemiLookAt = 0x00000100, + CheckChildren = 0x00000200, // SuperObject that has one or more children that doesn't have their bounding volume included in the parent's BV + RenderOnNearPlane = 0x00000400, // Render on near plane, for Hud, etc + MagnetModification = 0x00008000, + ModuleTransparency = 0x00010000, // module transparency is setting + ExcluLight = 0x00020000, + } +} diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/HIE/Enums/HIE_SuperObjectFlags.cs.meta b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/HIE/Enums/HIE_SuperObjectFlags.cs.meta new file mode 100644 index 00000000..ff24031c --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/HIE/Enums/HIE_SuperObjectFlags.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 7f988ed75c661d44f90ac1fbbdf75fa5 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/LST2.meta b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/LST2.meta new file mode 100644 index 00000000..29d49f66 --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/LST2.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: e165864362d29894e9225d4a906ceebb +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/LST2/Enums.meta b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/LST2/Enums.meta new file mode 100644 index 00000000..10465451 --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/LST2/Enums.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: b3332b5c25af2714f91becbab1322807 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/LST2/Enums/LST2_ListType.cs b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/LST2/Enums/LST2_ListType.cs new file mode 100644 index 00000000..659911ba --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/LST2/Enums/LST2_ListType.cs @@ -0,0 +1,17 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace BinarySerializer.Ubisoft.CPA { + public enum LST2_ListType { + Static, // = change type upon serialize + Dynamic, // = change type upon serialize + DoubleLinked, + SingleLinked, + Array, + SemiOptimized, // Not fully implemented, a mixture between array & double linked? + Optimized, // Array + } +} diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/LST2/Enums/LST2_ListType.cs.meta b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/LST2/Enums/LST2_ListType.cs.meta new file mode 100644 index 00000000..0e065f5d --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/LST2/Enums/LST2_ListType.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: ebd050bf49e629d45b6382f314bf0ebf +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/LST2/LST2_DynamicList.cs b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/LST2/LST2_DynamicList.cs new file mode 100644 index 00000000..5e964485 --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/LST2/LST2_DynamicList.cs @@ -0,0 +1,7 @@ +namespace BinarySerializer.Ubisoft.CPA +{ + public class LST2_DynamicList : LST2_List where T : BinarySerializable, LST2_IEntry, new() + { + public LST2_DynamicList() : base(LST2_ListType.Dynamic) { } + } +} \ No newline at end of file diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/LST2/LST2_DynamicList.cs.meta b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/LST2/LST2_DynamicList.cs.meta new file mode 100644 index 00000000..f4804798 --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/LST2/LST2_DynamicList.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 5ed5d7a4feea35247806a911a2f615b7 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/LST2/LST2_DynamicListElement.cs b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/LST2/LST2_DynamicListElement.cs new file mode 100644 index 00000000..13f82b88 --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/LST2/LST2_DynamicListElement.cs @@ -0,0 +1,7 @@ +namespace BinarySerializer.Ubisoft.CPA +{ + public class LST2_DynamicListElement : LST2_ListElement where T : BinarySerializable, LST2_IEntry, new() + { + public LST2_DynamicListElement() : base(LST2_ListType.Dynamic) { } + } +} \ No newline at end of file diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/LST2/LST2_DynamicListElement.cs.meta b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/LST2/LST2_DynamicListElement.cs.meta new file mode 100644 index 00000000..a35b295f --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/LST2/LST2_DynamicListElement.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 868ed5ba3bed36a4b9bfde66ad3f3ffc +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/LST2/LST2_IEntry.cs b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/LST2/LST2_IEntry.cs new file mode 100644 index 00000000..1c2336f2 --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/LST2/LST2_IEntry.cs @@ -0,0 +1,6 @@ +namespace BinarySerializer.Ubisoft.CPA { + public interface LST2_IEntry where T : BinarySerializable, LST2_IEntry, new() { + public Pointer LST2_Next { get; } + public Pointer LST2_Previous { get; } + } +} diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/LST2/LST2_IEntry.cs.meta b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/LST2/LST2_IEntry.cs.meta new file mode 100644 index 00000000..af0a5635 --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/LST2/LST2_IEntry.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 07891a221049c7c43ba4b4dd63a7d220 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/LST2/LST2_List.cs b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/LST2/LST2_List.cs new file mode 100644 index 00000000..063d9acf --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/LST2/LST2_List.cs @@ -0,0 +1,316 @@ +using System; +using System.Collections; +using System.Collections.Generic; + +namespace BinarySerializer.Ubisoft.CPA { + public class LST2_List : BinarySerializable, IList where T : BinarySerializable, LST2_IEntry, new() { + #region Constructors + + public LST2_List() { } + + public LST2_List(LST2_ListType type) { + Type = type; + } + + public LST2_List(Context context, Pointer head, Pointer tail, uint elementsCount, LST2_ListType type) { + Context = context; + Head = head; + Tail = tail; + ElementsCount = elementsCount; + list = new T[elementsCount]; + + Type = type; + } + + public LST2_List(Context context, Pointer head, uint num_elements, LST2_ListType type) : + this(context, head, null, num_elements, type) { } + + #endregion + + #region Properties + + // Serialized + public Pointer Head { get; set; } + public Pointer Tail { get; set; } + public uint ElementsCount { get; set; } + + public LST2_ListType Type { get; set; } + public uint ActualElementsCount { get; set; } + + #endregion + + #region Public Methods + public void Configure(Context c) { + switch (Type) { + case LST2_ListType.Dynamic: + Type = LST2_ListType.DoubleLinked; + break; + case LST2_ListType.Static: + Type = c.GetCPASettings().StaticListType; + break; + } + } + + public override void SerializeImpl(SerializerObject s) { + Configure(s.Context); + Head = s.SerializePointer(Head, name: nameof(Head)); + if (Type == LST2_ListType.DoubleLinked) + Tail = s.SerializePointer(Tail, name: nameof(Tail)); + + ElementsCount = s.Serialize(ElementsCount, name: nameof(ElementsCount)); + ActualElementsCount = ElementsCount; + list = new T[ActualElementsCount]; + } + + public LST2_List Resolve(SerializerObject s, string name = null) { + if (Type == LST2_ListType.Array || Type == LST2_ListType.Optimized) { + s.DoAt(Head, () => { + list = s.SerializeObjectArray(list, ActualElementsCount, name: name); + }); + } else { + Pointer Element = Head; + uint elementIndex = 0; + while (Element != null && elementIndex < ActualElementsCount) { + // Just so we can use the name, we do DoAt first + s.DoAt(Element?.PointerValue, () => { + list[elementIndex] = s.SerializeObject(list[elementIndex], name: $"{name}[{elementIndex}]"); + }); + Element.Value = list[elementIndex]; + Element?.Value?.LST2_Previous?.Resolve(s); // Resolve previous pointer if it exists + + list[elementIndex] = Element?.Value; + elementIndex++; + if (Type == LST2_ListType.DoubleLinked || Type == LST2_ListType.SingleLinked || Type == LST2_ListType.SemiOptimized) { + Element = Element?.Value?.LST2_Next; + if (Element == null) { + ActualElementsCount = elementIndex; + } + } + } + } + return this; + } + + #endregion + + // TODO: Read entries implementation + /* + public delegate T ReadElement(LegacyPointer offset); + public LinkedList SerializeEntries(SerializerObject s, ReadElement readElement) { + Pointer nextPointer = Head; + bool elementPointerFirst = ((flags & LinkedList.Flags.ElementPointerFirst) != 0); + bool hasHeaderPointers = ((flags & LinkedList.Flags.HasHeaderPointers) != 0); + bool readAtPointer = ((flags & LinkedList.Flags.ReadAtPointer) != 0); + bool noPreviousPointers = ((flags & LinkedList.Flags.NoPreviousPointersForDouble) != 0); + if (nextPointer != null) { + s.DoAt(Head, () => { + for (int i = 0; i < ElementsCount; i++) { + Pointer off_element = nextPointer; + if (elementPointerFirst) off_element = LegacyPointer.Read(reader); + if (type != Type.SingleNoElementPointers && type != Type.DoubleNoElementPointers && !customEntries) { + off_next = LegacyPointer.Read(reader); + if (type == Type.Double && !noPreviousPointers) LegacyPointer.Read(reader); // previous element pointer + if (hasHeaderPointers) LegacyPointer.Read(reader); // header struct pointer + } + if (readAtPointer && !elementPointerFirst) off_element = LegacyPointer.Read(reader); + // Read element + if (!readAtPointer) { + list[i] = readElement(off_element); + } else { + LegacyPointer.DoAt(ref reader, off_element, () => { + list[i] = readElement(off_element); + }); + } + + // Goto next element + if (customEntries) { + off_next = ((ILinkedListEntry)list[i]).NextEntry; + } + if (i < num_elements - 1 && (customEntries || (type != Type.SingleNoElementPointers && type != Type.DoubleNoElementPointers))) { + if (off_next == null) { + num_elements = (uint)i + 1; + break; + } + LegacyPointer.Goto(ref reader, off_next); + } else { + off_next = LegacyPointer.Current(reader); + } + } + }); + } + return this; + } + + public void ReadEntries(ref Reader reader, ReadElement readElement, LinkedList.Flags flags = LinkedList.Flags.None) { + LegacyPointer off_next = off_head; + bool elementPointerFirst = ((flags & LinkedList.Flags.ElementPointerFirst) != 0); + bool hasHeaderPointers = ((flags & LinkedList.Flags.HasHeaderPointers) != 0); + bool readAtPointer = ((flags & LinkedList.Flags.ReadAtPointer) != 0); + bool noPreviousPointers = ((flags & LinkedList.Flags.NoPreviousPointersForDouble) != 0); + if (off_head != null) { + LegacyPointer off_current = LegacyPointer.Goto(ref reader, off_head); + for (int i = 0; i < num_elements; i++) { + LegacyPointer off_element = off_next; + if (elementPointerFirst) off_element = LegacyPointer.Read(reader); + if (type != Type.SingleNoElementPointers && type != Type.DoubleNoElementPointers && !customEntries) { + off_next = LegacyPointer.Read(reader); + if (type == Type.Double && !noPreviousPointers) LegacyPointer.Read(reader); // previous element pointer + if (hasHeaderPointers) LegacyPointer.Read(reader); // header struct pointer + } + if (readAtPointer && !elementPointerFirst) off_element = LegacyPointer.Read(reader); + // Read element + if (!readAtPointer) { + list[i] = readElement(off_element); + } else { + LegacyPointer.DoAt(ref reader, off_element, () => { + list[i] = readElement(off_element); + }); + } + + // Goto next element + if (customEntries) { + off_next = ((ILinkedListEntry)list[i]).NextEntry; + } + if (i < num_elements - 1 && (customEntries || (type != Type.SingleNoElementPointers && type != Type.DoubleNoElementPointers))) { + if (off_next == null) { + num_elements = (uint)i + 1; + break; + } + LegacyPointer.Goto(ref reader, off_next); + } else { + off_next = LegacyPointer.Current(reader); + } + } + LegacyPointer.Goto(ref reader, off_current); + } + } + + public void ReadEntriesBackwards(ref Reader reader, ReadElement readElement, LinkedList.Flags flags = LinkedList.Flags.None) { + LegacyPointer off_next = off_tail; + bool elementPointerFirst = ((flags & LinkedList.Flags.ElementPointerFirst) != 0); + bool hasHeaderPointers = ((flags & LinkedList.Flags.HasHeaderPointers) != 0); + bool readAtPointer = ((flags & LinkedList.Flags.ReadAtPointer) != 0); + bool noPreviousPointers = ((flags & LinkedList.Flags.NoPreviousPointersForDouble) != 0); + if (off_tail != null) { + LegacyPointer off_current = LegacyPointer.Goto(ref reader, off_tail); + for (int i = 0; i < num_elements; i++) { + LegacyPointer off_element = off_next; + if (elementPointerFirst) off_element = LegacyPointer.Read(reader); + if (type != Type.SingleNoElementPointers && type != Type.DoubleNoElementPointers && !customEntries) { + off_next = LegacyPointer.Read(reader); + if (type == Type.Double && !noPreviousPointers) off_next = LegacyPointer.Read(reader); // previous element pointer + if (hasHeaderPointers) LegacyPointer.Read(reader); // header struct pointer + } + if (readAtPointer && !elementPointerFirst) off_element = LegacyPointer.Read(reader); + // Read element + if (!readAtPointer) { + list[i] = readElement(off_element); + } else { + LegacyPointer.DoAt(ref reader, off_element, () => { + list[i] = readElement(off_element); + }); + } + + // Goto next element + if (customEntries) { + off_next = ((ILinkedListEntry)list[i]).PreviousEntry; + } + if (i < num_elements - 1 && (customEntries || (type != Type.SingleNoElementPointers && type != Type.DoubleNoElementPointers))) { + if (off_next == null) { + num_elements = (uint)i + 1; + break; + } + LegacyPointer.Goto(ref reader, off_next); + } else { + off_next = LegacyPointer.Current(reader); + } + } + LegacyPointer.Goto(ref reader, off_current); + } + } + + public void FillPointers(Reader reader, LegacyPointer lastEntry, LegacyPointer header, uint nextOffset = 0, uint prevOffset = 4, uint headerOffset = 8) { + LegacyPointer current_entry = lastEntry; + LegacyPointer next_entry = null; + LegacyPointer off_current = LegacyPointer.Current(reader); + while (current_entry != null) { + LegacyPointer.Goto(ref reader, current_entry); + current_entry.file.AddPointer(current_entry.offset + nextOffset, next_entry); + if (header != null) { + current_entry.file.AddPointer(current_entry.offset + headerOffset, header); + } + next_entry = current_entry; + current_entry = LegacyPointer.GetPointerAtOffset(current_entry + prevOffset); + } + LegacyPointer.Goto(ref reader, off_current); + } + */ + + #region IList implementation + + private T[] list = null; + + public int Count { + get { return (int)ElementsCount; } + set { + ElementsCount = (uint)value; + if (list.Length != ElementsCount) { + Array.Resize(ref list, (int)ElementsCount); + } + } + } + + public bool IsReadOnly { + get { return list.IsReadOnly; } + } + + public T this[int index] { + get { return list[index]; } + set { list[index] = value; } + } + + public IEnumerator GetEnumerator() { + return ((IEnumerable)list).GetEnumerator(); + } + + IEnumerator IEnumerable.GetEnumerator() { + return ((IEnumerable)list).GetEnumerator(); + } + + public int IndexOf(T item) { + return Array.IndexOf(list, item); + } + + public bool Contains(T item) { + return Array.IndexOf(list, item) >= 0; + } + + public void CopyTo(T[] array, int arrayIndex) { + list.CopyTo(array, arrayIndex); + } + + void IList.Insert(int index, T item) { + throw new NotImplementedException(); + } + + void IList.RemoveAt(int index) { + throw new NotImplementedException(); + } + + public void Add(T item) { + Array.Resize(ref list, list.Length + 1); + list[list.Length - 1] = item; + Count = Count + 1; + } + + void ICollection.Clear() { + throw new NotImplementedException(); + } + + bool ICollection.Remove(T item) { + throw new NotImplementedException(); + } + + #endregion + } +} diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/LST2/LST2_List.cs.meta b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/LST2/LST2_List.cs.meta new file mode 100644 index 00000000..ca342953 --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/LST2/LST2_List.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 6d5f3ccfd94e0764a9d7f9e1b8e1b8cf +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/LST2/LST2_ListElement.cs b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/LST2/LST2_ListElement.cs new file mode 100644 index 00000000..f6f53c52 --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/LST2/LST2_ListElement.cs @@ -0,0 +1,62 @@ +namespace BinarySerializer.Ubisoft.CPA +{ + public class LST2_ListElement : BinarySerializable, LST2_IEntry where T : BinarySerializable, LST2_IEntry, new() { + #region Constructors + + public LST2_ListElement() { } + + public LST2_ListElement(LST2_ListType type) { + Type = type; + } + + public LST2_ListElement(Context context, Pointer next, Pointer previous, Pointer> father, LST2_ListType type) { + Context = context; + NextBrother = next; + PreviousBrother = previous; + Father = father; + + Type = type; + } + + public LST2_ListElement(Context context, Pointer next, LST2_ListType type) : + this(context, next, null, null, type) { } + + #endregion + + + public Pointer NextBrother { get; set; } + public Pointer PreviousBrother { get; set; } + public Pointer> Father { get; set; } + + public LST2_ListType Type { get; set; } + + public Pointer LST2_Next => NextBrother; + public Pointer LST2_Previous => PreviousBrother; + + public void Configure(Context c) { + switch (Type) { + case LST2_ListType.Dynamic: + Type = LST2_ListType.DoubleLinked; + break; + case LST2_ListType.Static: + Type = c.GetCPASettings().StaticListType; + break; + } + } + + public override void SerializeImpl(SerializerObject s) { + Configure(s.Context); + if (Type != LST2_ListType.Array && Type != LST2_ListType.Optimized) { + NextBrother = s.SerializePointer(NextBrother, name: nameof(NextBrother)); + if (Type != LST2_ListType.SingleLinked) { + PreviousBrother = s.SerializePointer(PreviousBrother, name: nameof(PreviousBrother)); + Father = s.SerializePointer>(Father, name: nameof(Father)); + } + } + + Father?.Resolve(s); + NextBrother?.Resolve(s); + PreviousBrother?.Resolve(s); + } + } +} \ No newline at end of file diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/LST2/LST2_ListElement.cs.meta b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/LST2/LST2_ListElement.cs.meta new file mode 100644 index 00000000..47f64a7f --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/LST2/LST2_ListElement.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 31cf3484e1aac844399670a14a402f26 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/LST2/LST2_StaticList.cs b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/LST2/LST2_StaticList.cs new file mode 100644 index 00000000..1cf109eb --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/LST2/LST2_StaticList.cs @@ -0,0 +1,7 @@ +namespace BinarySerializer.Ubisoft.CPA +{ + public class LST2_StaticList : LST2_List where T : BinarySerializable, LST2_IEntry, new() + { + public LST2_StaticList() : base(LST2_ListType.Static) { } + } +} \ No newline at end of file diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/LST2/LST2_StaticList.cs.meta b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/LST2/LST2_StaticList.cs.meta new file mode 100644 index 00000000..8e038495 --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/LST2/LST2_StaticList.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 3d8e5706c04da3146b2891810aee1451 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/LST2/LST2_StaticListElement.cs b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/LST2/LST2_StaticListElement.cs new file mode 100644 index 00000000..66cfb40f --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/LST2/LST2_StaticListElement.cs @@ -0,0 +1,7 @@ +namespace BinarySerializer.Ubisoft.CPA +{ + public class LST2_StaticListElement : LST2_ListElement where T : BinarySerializable, LST2_IEntry, new() + { + public LST2_StaticListElement() : base(LST2_ListType.Static) { } + } +} \ No newline at end of file diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/LST2/LST2_StaticListElement.cs.meta b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/LST2/LST2_StaticListElement.cs.meta new file mode 100644 index 00000000..d86312c4 --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/LST2/LST2_StaticListElement.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 8442c413c3876344c85ff98be3bcdd3d +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/MAT.meta b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/MAT.meta new file mode 100644 index 00000000..e5cbb71c --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/MAT.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: a8b9443fcc664734f8b70cdab23877a6 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/MAT/Enums.meta b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/MAT/Enums.meta new file mode 100644 index 00000000..aff80507 --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/MAT/Enums.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 2fa9f857a3f454a4d941bf13f74d0c10 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/MAT/Enums/MAT_TransformationType.cs b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/MAT/Enums/MAT_TransformationType.cs new file mode 100644 index 00000000..c6c2f9f4 --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/MAT/Enums/MAT_TransformationType.cs @@ -0,0 +1,15 @@ +using System; +namespace BinarySerializer.Ubisoft.CPA { + [Flags] + public enum MAT_TransformationType : uint { + Uninitialized = 0, + Identity = 1, + Translation = 2, + Zoom = 3, + Scale = 4, + Rotation = 5, + RotationZoom = 6, + RotationScale = 7, + ComplexRotationScale = 8, + } +} diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/MAT/Enums/MAT_TransformationType.cs.meta b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/MAT/Enums/MAT_TransformationType.cs.meta new file mode 100644 index 00000000..9d9cb3ec --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/MAT/Enums/MAT_TransformationType.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: e1a14080e3fd75e44bfe7679cbd61a4e +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/MAT/MAT_ITransform.cs b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/MAT/MAT_ITransform.cs new file mode 100644 index 00000000..efc49d20 --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/MAT/MAT_ITransform.cs @@ -0,0 +1,21 @@ +using System; + +namespace BinarySerializer.Ubisoft.CPA { + // Interface for all MAT_Transform versions + public interface MAT_ITransform { + /// + /// Position vector + /// + public MTH3D_Vector Position { get; set; } + + /// + /// Rotation quaternion + /// + public MTH4D_Vector Rotation { get; set; } + + /// + /// Scale vector + /// + public MTH3D_Vector Scale { get; set; } + } +} diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/MAT/MAT_ITransform.cs.meta b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/MAT/MAT_ITransform.cs.meta new file mode 100644 index 00000000..a1011bab --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/MAT/MAT_ITransform.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 6d8580a6a1d0196408ec991726f1bded +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/MAT/MAT_Transformation.cs b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/MAT/MAT_Transformation.cs new file mode 100644 index 00000000..9284329f --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/MAT/MAT_Transformation.cs @@ -0,0 +1,48 @@ +using BinarySerializer.Ubisoft.CPA.PS1; +using System; + +namespace BinarySerializer.Ubisoft.CPA { + public class MAT_Transformation : BinarySerializable, MAT_ITransform { + public MAT_Transformation_R3 Transform_R3 { get; set; } + public MAT_Transformation_R2PS2 Transform_R2PS2 { get; set; } + public POS_CompletePosition_DC Transform_R2DC { get; set; } + public POS_CompletePosition Transform_R2 { get; set; } + public POS_CompletePosition_PS1 Transform_PS1 { get; set; } + + public MAT_ITransform SelectedTransform { + get { + if (Context.GetCPASettings().EngineVersionTree.HasParent(EngineVersion.CPA_3)) { + return Transform_R3; + } else if (Context.GetCPASettings().EngineVersionTree.HasParent(EngineVersion.Rayman2Revolution)) { + return Transform_R2PS2; + } else if (Context.GetCPASettings().Platform == Platform.DC) { + return Transform_R2DC; + } else if(Context.GetCPASettings().EngineVersionTree.HasParent(EngineVersion.CPA_PS1)) { + return Transform_PS1; + } else { + return Transform_R2; + } + } + } + + public override void SerializeImpl(SerializerObject s) { + if (s.GetCPASettings().EngineVersionTree.HasParent(EngineVersion.CPA_3)) { + Transform_R3 = s.SerializeObject(Transform_R3, name: nameof(Transform_R3)); + } else if (s.GetCPASettings().EngineVersionTree.HasParent(EngineVersion.Rayman2Revolution)) { + Transform_R2PS2 = s.SerializeObject(Transform_R2PS2, name: nameof(Transform_R2PS2)); + } else if (s.GetCPASettings().Platform == Platform.DC) { + Transform_R2DC = s.SerializeObject(Transform_R2DC, name: nameof(Transform_R2DC)); + } else if (s.GetCPASettings().EngineVersionTree.HasParent(EngineVersion.CPA_PS1)) { + Transform_PS1 = s.SerializeObject(Transform_PS1, name: nameof(Transform_PS1)); + } else { + Transform_R2 = s.SerializeObject(Transform_R2, name: nameof(Transform_R2)); + } + } + + #region MAT_ITransform implementation + public MTH3D_Vector Position { get => SelectedTransform.Position; set => SelectedTransform.Position = value; } + public MTH4D_Vector Rotation { get => SelectedTransform.Rotation; set => SelectedTransform.Rotation = value; } + public MTH3D_Vector Scale { get => SelectedTransform.Scale; set => SelectedTransform.Scale = value; } + #endregion + } +} diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/MAT/MAT_Transformation.cs.meta b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/MAT/MAT_Transformation.cs.meta new file mode 100644 index 00000000..7f8cf156 --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/MAT/MAT_Transformation.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 901c400eda76468489d1ceeafe93fc4e +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/MAT/MAT_Transformation_R2PS2.cs b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/MAT/MAT_Transformation_R2PS2.cs new file mode 100644 index 00000000..753c3163 --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/MAT/MAT_Transformation_R2PS2.cs @@ -0,0 +1,152 @@ +using System; + +namespace BinarySerializer.Ubisoft.CPA { + // Transform matrix for R2 PS2 engine versions + public class MAT_Transformation_R2PS2 : BinarySerializable, MAT_ITransform { + public MTH4D_Matrix TransformMatrix { get; set; } + public MTH4D_Vector ScaleVector { get; set; } + public MAT_TransformationType Type { get; set; } + + public override void SerializeImpl(SerializerObject s) { + TransformMatrix = s.SerializeObject(TransformMatrix, name: nameof(TransformMatrix)); + ScaleVector = s.SerializeObject(ScaleVector, name: nameof(ScaleVector)); + Type = s.Serialize(Type, name: nameof(Type)); + throw new NotImplementedException(); + + } + + #region MAT_ITransform implementation + /// + /// Position vector + /// + public MTH3D_Vector Position { + get { + if (Type == MAT_TransformationType.Identity) + return MTH3D_Vector.Zero; + else + return TransformMatrix.GetPosition(); + } + set { + TransformMatrix.SetPosition(value); + if (value.IsUniform && value.X == 0f) { + if (Type == MAT_TransformationType.Translation) + Type = MAT_TransformationType.Identity; + } else { + if (Type == MAT_TransformationType.Identity) + Type = MAT_TransformationType.Translation; + } + } + } + + /// + /// Rotation quaternion + /// + public MTH4D_Vector Rotation { + get { + switch (Type) { + case MAT_TransformationType.Rotation: + return TransformMatrix.GetRotation(); + case MAT_TransformationType.RotationZoom: + case MAT_TransformationType.Uninitialized: + case MAT_TransformationType.RotationScale: + case MAT_TransformationType.ComplexRotationScale: + return TransformMatrix.GetRotation(Scale); + default: + return MTH4D_Vector.IdentityQuaternion; + } + } + set { + switch (Type) { + case MAT_TransformationType.Scale: + Type = MAT_TransformationType.RotationScale; + break; + case MAT_TransformationType.Zoom: + Type = MAT_TransformationType.RotationZoom; + break; + case MAT_TransformationType.Translation: + case MAT_TransformationType.Identity: + Type = MAT_TransformationType.Rotation; + break; + } + throw new NotImplementedException(); + } + } + + /// + /// Scale vector + /// + public MTH3D_Vector Scale { + get { + switch (Type) { + case MAT_TransformationType.Zoom: + case MAT_TransformationType.RotationZoom: + var zoom = Zoom.Value; + return new MTH3D_Vector(zoom, zoom, zoom); + case MAT_TransformationType.Scale: + case MAT_TransformationType.RotationScale: + case MAT_TransformationType.ComplexRotationScale: + return new MTH3D_Vector(ScaleVector.X, ScaleVector.Y, ScaleVector.Z); + case MAT_TransformationType.Uninitialized: + default: + return MTH3D_Vector.One; + } + } + set { + if (value.IsUniform) { + // Set zoom value - will remove scale type if it's a (1,1,1) scale + Zoom = value.X; + } else { + if (Type == MAT_TransformationType.Identity) + Type = MAT_TransformationType.Scale; + throw new NotImplementedException(); + } + } + } + + /// + /// Zoom value for uniform scales + /// + public float? Zoom { + get { + switch (Type) { + case MAT_TransformationType.Zoom: + case MAT_TransformationType.RotationZoom: + return ScaleVector.X; + default: + return null; + } + } + set { + if (value.HasValue && value != 1f) { + switch (Type) { + case MAT_TransformationType.Rotation: + case MAT_TransformationType.RotationZoom: + case MAT_TransformationType.RotationScale: + case MAT_TransformationType.ComplexRotationScale: + Type = MAT_TransformationType.RotationZoom; + break; + case MAT_TransformationType.Uninitialized: + break; + default: + Type = MAT_TransformationType.Zoom; + break; + } + ScaleVector.X = value.Value; + } else { + switch (Type) { + case MAT_TransformationType.Zoom: + case MAT_TransformationType.Scale: + Type = MAT_TransformationType.Translation; + break; + case MAT_TransformationType.RotationZoom: + case MAT_TransformationType.RotationScale: + case MAT_TransformationType.ComplexRotationScale: + Type = MAT_TransformationType.Rotation; + break; + } + } + } + } + #endregion + } +} diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/MAT/MAT_Transformation_R2PS2.cs.meta b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/MAT/MAT_Transformation_R2PS2.cs.meta new file mode 100644 index 00000000..12b2d987 --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/MAT/MAT_Transformation_R2PS2.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 726374ccc6e99c34fafd34436930fab3 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/MAT/MAT_Transformation_R3.cs b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/MAT/MAT_Transformation_R3.cs new file mode 100644 index 00000000..5bd1cf3f --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/MAT/MAT_Transformation_R3.cs @@ -0,0 +1,154 @@ +using System; + +namespace BinarySerializer.Ubisoft.CPA { + // Transform matrix for R3 engine versions + public class MAT_Transformation_R3 : BinarySerializable, MAT_ITransform { + public MAT_TransformationType Type { get; set; } + public MTH4D_Matrix TransformMatrix { get; set; } + public MTH4D_Vector ScaleVector { get; set; } + + public override void SerializeImpl(SerializerObject s) { + Type = s.Serialize(Type, name: nameof(Type)); + + if (s.GetCPASettings().Platform == Platform.PS2) + s.SerializePadding(12, logIfNotNull: true); + + TransformMatrix = s.SerializeObject(TransformMatrix, name: nameof(TransformMatrix)); + ScaleVector = s.SerializeObject(ScaleVector, name: nameof(ScaleVector)); + } + + #region MAT_ITransform implementation + /// + /// Position vector + /// + public MTH3D_Vector Position { + get { + if (Type == MAT_TransformationType.Identity) + return MTH3D_Vector.Zero; + else + return TransformMatrix.GetPosition(); + } + set { + TransformMatrix.SetPosition(value); + if (value.IsUniform && value.X == 0f) { + if (Type == MAT_TransformationType.Translation) + Type = MAT_TransformationType.Identity; + } else { + if (Type == MAT_TransformationType.Identity) + Type = MAT_TransformationType.Translation; + } + } + } + + /// + /// Rotation quaternion + /// + public MTH4D_Vector Rotation { + get { + switch (Type) { + case MAT_TransformationType.Rotation: + return TransformMatrix.GetRotation(); + case MAT_TransformationType.RotationZoom: + case MAT_TransformationType.Uninitialized: + case MAT_TransformationType.RotationScale: + case MAT_TransformationType.ComplexRotationScale: + return TransformMatrix.GetRotation(Scale); + default: + return MTH4D_Vector.IdentityQuaternion; + } + } + set { + switch (Type) { + case MAT_TransformationType.Scale: + Type = MAT_TransformationType.RotationScale; + break; + case MAT_TransformationType.Zoom: + Type = MAT_TransformationType.RotationZoom; + break; + case MAT_TransformationType.Translation: + case MAT_TransformationType.Identity: + Type = MAT_TransformationType.Rotation; + break; + } + throw new NotImplementedException(); + } + } + + /// + /// Scale vector + /// + public MTH3D_Vector Scale { + get { + switch (Type) { + case MAT_TransformationType.Zoom: + case MAT_TransformationType.RotationZoom: + var zoom = Zoom.Value; + return new MTH3D_Vector(zoom, zoom, zoom); + case MAT_TransformationType.Scale: + case MAT_TransformationType.RotationScale: + case MAT_TransformationType.ComplexRotationScale: + return new MTH3D_Vector(ScaleVector.X, ScaleVector.Y, ScaleVector.Z); + case MAT_TransformationType.Uninitialized: + default: + return MTH3D_Vector.One; + } + } + set { + if (value.IsUniform) { + // Set zoom value - will remove scale type if it's a (1,1,1) scale + Zoom = value.X; + } else { + if (Type == MAT_TransformationType.Identity) + Type = MAT_TransformationType.Scale; + throw new NotImplementedException(); + } + } + } + + /// + /// Zoom value for uniform scales + /// + public float? Zoom { + get { + switch (Type) { + case MAT_TransformationType.Zoom: + case MAT_TransformationType.RotationZoom: + return ScaleVector.X; + default: + return null; + } + } + set { + if (value.HasValue && value != 1f) { + switch (Type) { + case MAT_TransformationType.Rotation: + case MAT_TransformationType.RotationZoom: + case MAT_TransformationType.RotationScale: + case MAT_TransformationType.ComplexRotationScale: + Type = MAT_TransformationType.RotationZoom; + break; + case MAT_TransformationType.Uninitialized: + break; + default: + Type = MAT_TransformationType.Zoom; + break; + } + ScaleVector.X = value.Value; + } else { + switch (Type) { + case MAT_TransformationType.Zoom: + case MAT_TransformationType.Scale: + Type = MAT_TransformationType.Translation; + break; + case MAT_TransformationType.RotationZoom: + case MAT_TransformationType.RotationScale: + case MAT_TransformationType.ComplexRotationScale: + Type = MAT_TransformationType.Rotation; + break; + } + } + } + } + #endregion + } +} diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/MAT/MAT_Transformation_R3.cs.meta b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/MAT/MAT_Transformation_R3.cs.meta new file mode 100644 index 00000000..1b2d45e7 --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/MAT/MAT_Transformation_R3.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 9e74406bbdb32654bac5b2491bb5af35 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/MMG.meta b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/MMG.meta new file mode 100644 index 00000000..71746494 --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/MMG.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: e37826e260fc61d4bbf56eaf1829b02c +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/MMG/Enums.meta b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/MMG/Enums.meta new file mode 100644 index 00000000..6cfcdf2d --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/MMG/Enums.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 4ff86c9cf7a19824daaa601621327910 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/MMG/Enums/MMG_BlockMode.cs b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/MMG/Enums/MMG_BlockMode.cs new file mode 100644 index 00000000..aea5331c --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/MMG/Enums/MMG_BlockMode.cs @@ -0,0 +1,12 @@ +using System; + +namespace BinarySerializer.Ubisoft.CPA { + [Flags] + public enum MMG_BlockMode : byte { + Unknown = 0, + NoFree = 1 << 0, + FillWithCleanKey = 1 << 1, + CheckAlignment = 1 << 2, + CheckOverflow = 1 << 3, + } +} diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/MMG/Enums/MMG_BlockMode.cs.meta b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/MMG/Enums/MMG_BlockMode.cs.meta new file mode 100644 index 00000000..e4148725 --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/MMG/Enums/MMG_BlockMode.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: b572d3aa9f7e8ae41a5364c84c0134ce +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/MMG/MMG_Allocation.cs b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/MMG/MMG_Allocation.cs new file mode 100644 index 00000000..35b436b8 --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/MMG/MMG_Allocation.cs @@ -0,0 +1,11 @@ +namespace BinarySerializer.Ubisoft.CPA { + public class MMG_Allocation : BinarySerializable { + public uint AllocationSize { get; set; } + public byte[] Allocation { get; set; } + + public override void SerializeImpl(SerializerObject s) { + AllocationSize = s.Serialize(AllocationSize, name: nameof(AllocationSize)); + Allocation = s.SerializeArray(Allocation, AllocationSize * 4 - 4, name: nameof(Allocation)); + } + } +} diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/MMG/MMG_Allocation.cs.meta b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/MMG/MMG_Allocation.cs.meta new file mode 100644 index 00000000..88d3de95 --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/MMG/MMG_Allocation.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: bdec7b0b42c150a47841b88013523613 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/MMG/MMG_HeaderBlockWithoutFree.cs b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/MMG/MMG_HeaderBlockWithoutFree.cs new file mode 100644 index 00000000..45036a7d --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/MMG/MMG_HeaderBlockWithoutFree.cs @@ -0,0 +1,15 @@ +namespace BinarySerializer.Ubisoft.CPA { + public class MMG_HeaderBlockWithoutFree : BinarySerializable { + public byte BoundedHeaderSize { get; set; } + public byte Alignment { get; set; } + public MMG_BlockMode Mode { get; set; } + + public override void SerializeImpl(SerializerObject s) { + BoundedHeaderSize = s.Serialize(BoundedHeaderSize, name: nameof(BoundedHeaderSize)); + Alignment = s.Serialize(Alignment, name: nameof(Alignment)); + Mode = s.Serialize(Mode, name: nameof(Mode)); + + s.SerializePadding((int)(BoundedHeaderSize - (s.CurrentAbsoluteOffset - Offset.AbsoluteOffset)), logIfNotNull: true); + } + } +} diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/MMG/MMG_HeaderBlockWithoutFree.cs.meta b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/MMG/MMG_HeaderBlockWithoutFree.cs.meta new file mode 100644 index 00000000..d55bd06d --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/MMG/MMG_HeaderBlockWithoutFree.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 921ba805e1fca4e4a846dd6896a714a0 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/MTH.meta b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/MTH.meta new file mode 100644 index 00000000..ebb8fc1b --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/MTH.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: a7b6bdd2fdea5f04eb4bdfae5e46f2ce +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/MTH/MTH2D.meta b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/MTH/MTH2D.meta new file mode 100644 index 00000000..b7ff3221 --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/MTH/MTH2D.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: a0237524644f1e345af9fedbf963ec72 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/MTH/MTH2D/MTH2D_Vector.cs b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/MTH/MTH2D/MTH2D_Vector.cs new file mode 100644 index 00000000..da1f0741 --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/MTH/MTH2D/MTH2D_Vector.cs @@ -0,0 +1,24 @@ +using System; + +namespace BinarySerializer.Ubisoft.CPA { + public class MTH2D_Vector : BinarySerializable { + public float X { get; set; } + public float Y { get; set; } + + public override void SerializeImpl(SerializerObject s) { + X = s.Serialize(X, name: nameof(X)); + Y = s.Serialize(Y, name: nameof(Y)); + } + public override bool UseShortLog => true; + public override string ToString() => $"Vector({X}, {Y})"; + + public MTH2D_Vector() { } + public MTH2D_Vector(float x, float y) { + X = x; + Y = y; + } + + public double Magnitude => Math.Sqrt(Math.Pow(X, 2) + Math.Pow(Y, 2)); + public bool IsUniform => X == Y; + } +} diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/MTH/MTH2D/MTH2D_Vector.cs.meta b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/MTH/MTH2D/MTH2D_Vector.cs.meta new file mode 100644 index 00000000..23320f1c --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/MTH/MTH2D/MTH2D_Vector.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: f423e6ddd04f1b046b0ae21e2b98ef9d +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/MTH/MTH3D.meta b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/MTH/MTH3D.meta new file mode 100644 index 00000000..709c21b8 --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/MTH/MTH3D.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 9fe09f449de9ad740a9f3c275746f4c1 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/MTH/MTH3D/MTH3D_Matrix.cs b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/MTH/MTH3D/MTH3D_Matrix.cs new file mode 100644 index 00000000..5a65b493 --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/MTH/MTH3D/MTH3D_Matrix.cs @@ -0,0 +1,75 @@ +using System; + +namespace BinarySerializer.Ubisoft.CPA { + public class MTH3D_Matrix : BinarySerializable { + public MTH3D_Vector Column0 { get; set; } + public MTH3D_Vector Column1 { get; set; } + public MTH3D_Vector Column2 { get; set; } + + public override void SerializeImpl(SerializerObject s) { + Column0 = s.SerializeObject(Column0, name: nameof(Column0)); + Column1 = s.SerializeObject(Column1, name: nameof(Column1)); + Column2 = s.SerializeObject(Column2, name: nameof(Column2)); + } + + public MTH4D_Vector GetRotation(MTH3D_Vector scaleVector = null) { + float m00, m01, m02; // Row 0 + float m10, m11, m12; // Row 1 + float m20, m21, m22; // Row 2 + + m00 = Column0.X; + m01 = Column1.X; + m02 = Column2.X; + m10 = Column0.Y; + m11 = Column1.Y; + m12 = Column2.Y; + m20 = Column0.Z; + m21 = Column1.Z; + m22 = Column2.Z; + + if (scaleVector != null && scaleVector.X != 0 && scaleVector.Y != 0 && scaleVector.Z != 0) { + m00 /= scaleVector.X; + m01 /= scaleVector.Y; + m02 /= scaleVector.Z; + m10 /= scaleVector.X; + m11 /= scaleVector.Y; + m12 /= scaleVector.Z; + m20 /= scaleVector.X; + m21 /= scaleVector.Y; + m22 /= scaleVector.Z; + } + + //float tr = m00 + m11 + m22; + MTH4D_Vector quaternion; // = new MTH4D_Vector(); + float t; + + if (m22 < 0) { + if (m00 > m11) { + t = 1 + m00 - m11 - m22; + quaternion = new MTH4D_Vector(t, m01 + m10, m20 + m02, m12 - m21); + } else { + t = 1 - m00 + m11 - m22; + quaternion = new MTH4D_Vector(m01 + m10, t, m12 + m21, m20 - m02); + } + } else { + if (m00 < -m11) { + t = 1 - m00 - m11 + m22; + quaternion = new MTH4D_Vector(m20 + m02, m12 + m21, t, m01 - m10); + } else { + t = 1 + m00 + m11 + m22; + quaternion = new MTH4D_Vector(m12 - m21, m20 - m02, m01 - m10, t); + } + } + float factor = (0.5f / (float)Math.Sqrt(t)); + quaternion.X = quaternion.X * factor; + quaternion.Y = quaternion.Y * factor; + quaternion.Z = quaternion.Z * factor; + quaternion.W = quaternion.W * -factor; + + return quaternion; + } + public MTH3D_Vector GetScale() { + return new MTH3D_Vector((float)Column0.Magnitude, (float)Column1.Magnitude, (float)Column2.Magnitude); + } + } +} diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/MTH/MTH3D/MTH3D_Matrix.cs.meta b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/MTH/MTH3D/MTH3D_Matrix.cs.meta new file mode 100644 index 00000000..a057b564 --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/MTH/MTH3D/MTH3D_Matrix.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 268436e380b38ab46acfa2def72433ff +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/MTH/MTH3D/MTH3D_Vector.cs b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/MTH/MTH3D/MTH3D_Vector.cs new file mode 100644 index 00000000..7d8b423d --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/MTH/MTH3D/MTH3D_Vector.cs @@ -0,0 +1,30 @@ +using System; + +namespace BinarySerializer.Ubisoft.CPA { + public class MTH3D_Vector : BinarySerializable { + public float X { get; set; } + public float Y { get; set; } + public float Z { get; set; } + + public override void SerializeImpl(SerializerObject s) { + X = s.Serialize(X, name: nameof(X)); + Y = s.Serialize(Y, name: nameof(Y)); + Z = s.Serialize(Z, name: nameof(Z)); + } + public override bool UseShortLog => true; + public override string ToString() => $"Vector({X}, {Y}, {Z})"; + + public MTH3D_Vector() { } + public MTH3D_Vector(float x, float y, float z) { + X = x; + Y = y; + Z = z; + } + + public double Magnitude => Math.Sqrt(Math.Pow(X, 2) + Math.Pow(Y, 2) + Math.Pow(Z, 2)); + public static MTH3D_Vector Zero => new MTH3D_Vector(); + public static MTH3D_Vector One => new MTH3D_Vector(1,1,1); + + public bool IsUniform => X == Y && X == Z; + } +} diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/MTH/MTH3D/MTH3D_Vector.cs.meta b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/MTH/MTH3D/MTH3D_Vector.cs.meta new file mode 100644 index 00000000..961c5a05 --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/MTH/MTH3D/MTH3D_Vector.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: d41e88fdbd8dc54438a111adf18515b7 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/MTH/MTH4D.meta b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/MTH/MTH4D.meta new file mode 100644 index 00000000..f46398a4 --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/MTH/MTH4D.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: a480545e86afe8746b01aa19fa488d9b +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/MTH/MTH4D/MTH4D_Matrix.cs b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/MTH/MTH4D/MTH4D_Matrix.cs new file mode 100644 index 00000000..f1c782bf --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/MTH/MTH4D/MTH4D_Matrix.cs @@ -0,0 +1,89 @@ +using System; + +namespace BinarySerializer.Ubisoft.CPA { + public class MTH4D_Matrix : BinarySerializable { + public MTH4D_Vector Column0 { get; set; } + public MTH4D_Vector Column1 { get; set; } + public MTH4D_Vector Column2 { get; set; } + public MTH4D_Vector Column3 { get; set; } + + public override void SerializeImpl(SerializerObject s) { + Column0 = s.SerializeObject(Column0, name: nameof(Column0)); + Column1 = s.SerializeObject(Column1, name: nameof(Column1)); + Column2 = s.SerializeObject(Column2, name: nameof(Column2)); + Column3 = s.SerializeObject(Column3, name: nameof(Column3)); + } + + public void SetPosition(MTH3D_Vector position) { + Column3.X = position.X; + Column3.Y = position.Y; + Column3.Z = position.Z; + } + + public MTH3D_Vector GetPosition() { + return new MTH3D_Vector(Column3.X, Column3.Y, Column3.Z); + } + + public MTH4D_Vector GetRotation(MTH3D_Vector scaleVector = null) { + // m[row][column] + float m00, m01, m02; + float m10, m11, m12; + float m20, m21, m22; + + m00 = Column0.X; + m10 = Column0.Y; + m20 = Column0.Z; + m01 = Column1.X; + m11 = Column1.Y; + m21 = Column1.Z; + m02 = Column2.X; + m12 = Column2.Y; + m22 = Column2.Z; + + if (scaleVector != null && scaleVector.X != 0 && scaleVector.Y != 0 && scaleVector.Z != 0) { + m00 /= scaleVector.X; + m10 /= scaleVector.X; + m20 /= scaleVector.X; + m01 /= scaleVector.Y; + m11 /= scaleVector.Y; + m21 /= scaleVector.Y; + m02 /= scaleVector.Z; + m12 /= scaleVector.Z; + m22 /= scaleVector.Z; + } + + //float tr = m00 + m11 + m22; + MTH4D_Vector quaternion; // = new MTH4D_Vector(); + float t; + + if (m22 < 0) { + if (m00 > m11) { + t = 1 + m00 - m11 - m22; + quaternion = new MTH4D_Vector(t, m01 + m10, m20 + m02, m12 - m21); + } else { + t = 1 - m00 + m11 - m22; + quaternion = new MTH4D_Vector(m01 + m10, t, m12 + m21, m20 - m02); + } + } else { + if (m00 < -m11) { + t = 1 - m00 - m11 + m22; + quaternion = new MTH4D_Vector(m20 + m02, m12 + m21, t, m01 - m10); + } else { + t = 1 + m00 + m11 + m22; + quaternion = new MTH4D_Vector(m12 - m21, m20 - m02, m01 - m10, t); + } + } + float factor = (0.5f / (float)Math.Sqrt(t)); + quaternion.X = quaternion.X * factor; + quaternion.Y = quaternion.Y * factor; + quaternion.Z = quaternion.Z * factor; + quaternion.W = quaternion.W * -factor; + + return quaternion; + } + + public MTH3D_Vector GetScale() { + return new MTH3D_Vector((float)Column0.Magnitude, (float)Column1.Magnitude, (float)Column2.Magnitude); + } + } +} diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/MTH/MTH4D/MTH4D_Matrix.cs.meta b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/MTH/MTH4D/MTH4D_Matrix.cs.meta new file mode 100644 index 00000000..f03d9ec7 --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/MTH/MTH4D/MTH4D_Matrix.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 9afbed73ff0672d41bd93a494e123e1f +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/MTH/MTH4D/MTH4D_Vector.cs b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/MTH/MTH4D/MTH4D_Vector.cs new file mode 100644 index 00000000..61d47fe9 --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/MTH/MTH4D/MTH4D_Vector.cs @@ -0,0 +1,31 @@ +using System; + +namespace BinarySerializer.Ubisoft.CPA { + public class MTH4D_Vector : BinarySerializable { + public float X { get; set; } + public float Y { get; set; } + public float Z { get; set; } + public float W { get; set; } + + public override void SerializeImpl(SerializerObject s) { + X = s.Serialize(X, name: nameof(X)); + Y = s.Serialize(Y, name: nameof(Y)); + Z = s.Serialize(Z, name: nameof(Z)); + W = s.Serialize(W, name: nameof(W)); + } + public override bool UseShortLog => true; + public override string ToString() => $"Vector({X}, {Y}, {Z}, {W})"; + + public MTH4D_Vector() { } + public MTH4D_Vector(float x, float y, float z, float w) { + X = x; + Y = y; + Z = z; + W = w; + } + + public double Magnitude => Math.Sqrt(Math.Pow(X, 2) + Math.Pow(Y, 2) + Math.Pow(Z, 2) + Math.Pow(W, 2)); + public static MTH4D_Vector IdentityQuaternion => new MTH4D_Vector(0,0,0,1); + public bool IsUniform => X == Y && X == Z && X == W; + } +} diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/MTH/MTH4D/MTH4D_Vector.cs.meta b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/MTH/MTH4D/MTH4D_Vector.cs.meta new file mode 100644 index 00000000..3f338edc --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/MTH/MTH4D/MTH4D_Vector.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 0ecb417060e775843a66855a5f1e45d2 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/POS.meta b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/POS.meta new file mode 100644 index 00000000..4fb9903c --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/POS.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 1669c00cbaa264a48ab550c7ea74f623 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/POS/Enums.meta b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/POS/Enums.meta new file mode 100644 index 00000000..8ca9cefd --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/POS/Enums.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 3dddc2ed1ab8eb54c9bf9c29e65d9602 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/POS/Enums/POS_TransformationType.cs b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/POS/Enums/POS_TransformationType.cs new file mode 100644 index 00000000..abe9a2ee --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/POS/Enums/POS_TransformationType.cs @@ -0,0 +1,11 @@ +using System; +namespace BinarySerializer.Ubisoft.CPA { + [Flags] + public enum POS_TransformationType : uint { + Uninitialized = 0, + Identity = 1, + Translation = 2, + Rotation = 3, + Complete = 4, + } +} diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/POS/Enums/POS_TransformationType.cs.meta b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/POS/Enums/POS_TransformationType.cs.meta new file mode 100644 index 00000000..0a277080 --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/POS/Enums/POS_TransformationType.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: a779f49b5b2f9684381a8e47b01f4936 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/POS/POS_CompletePosition.cs b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/POS/POS_CompletePosition.cs new file mode 100644 index 00000000..6a9223ba --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/POS/POS_CompletePosition.cs @@ -0,0 +1,88 @@ +using System; + +namespace BinarySerializer.Ubisoft.CPA { + // Transform matrix for R2 engine versions + public class POS_CompletePosition : BinarySerializable, MAT_ITransform { + public POS_TransformationType Type { get; set; } + public MTH3D_Vector TranslationVector { get; set; } + public MTH3D_Matrix RotationMatrix { get; set; } + public MTH3D_Matrix TransformMatrix { get; set; } // Scale + + public override void SerializeImpl(SerializerObject s) { + Type = s.Serialize(Type, name: nameof(Type)); + TranslationVector = s.SerializeObject(TranslationVector, name: nameof(TranslationVector)); + RotationMatrix = s.SerializeObject(RotationMatrix, name: nameof(RotationMatrix)); + TransformMatrix = s.SerializeObject(TransformMatrix, name: nameof(TransformMatrix)); + } + + #region MAT_ITransform implementation + /// + /// Position vector + /// + public MTH3D_Vector Position { + get { + if (Type == POS_TransformationType.Identity) + return MTH3D_Vector.Zero; + else + return TranslationVector; + } + set { + TranslationVector = value; + if (value.IsUniform && value.X == 0f) { + if (Type == POS_TransformationType.Translation) + Type = POS_TransformationType.Identity; + } else { + if (Type == POS_TransformationType.Identity) + Type = POS_TransformationType.Translation; + } + } + } + /// + /// Rotation quaternion + /// + public MTH4D_Vector Rotation { + get { + switch (Type) { + case POS_TransformationType.Rotation: + case POS_TransformationType.Complete: + case POS_TransformationType.Uninitialized: + return RotationMatrix.GetRotation(); + default: + return MTH4D_Vector.IdentityQuaternion; + } + } + set { + switch (Type) { + case POS_TransformationType.Translation: + case POS_TransformationType.Identity: + Type = POS_TransformationType.Rotation; + break; + } + throw new NotImplementedException(); + } + } + /// + /// Scale vector + /// + public MTH3D_Vector Scale { + get { + switch (Type) { + case POS_TransformationType.Complete: + return TransformMatrix.GetScale(); + default: + return MTH3D_Vector.One; + } + } + set { + if (value.IsUniform && value.X == 1f) { + // remove scale type if it's a (1,1,1) scale + if (Type == POS_TransformationType.Complete) Type = POS_TransformationType.Rotation; + } else { + Type = POS_TransformationType.Complete; + throw new NotImplementedException(); + } + } + } + #endregion + } +} diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/POS/POS_CompletePosition.cs.meta b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/POS/POS_CompletePosition.cs.meta new file mode 100644 index 00000000..8ee2dcd9 --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/POS/POS_CompletePosition.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: b42fdba10d8f0fd42861b873573b342b +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/POS/POS_CompletePosition_DC.cs b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/POS/POS_CompletePosition_DC.cs new file mode 100644 index 00000000..7321a155 --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/POS/POS_CompletePosition_DC.cs @@ -0,0 +1,86 @@ +using System; + +namespace BinarySerializer.Ubisoft.CPA { + // Transform matrix for R2 DC engine versions + public class POS_CompletePosition_DC : BinarySerializable, MAT_ITransform { + public POS_TransformationType Type { get; set; } + public MTH3D_Matrix RotationMatrix { get; set; } + public MTH4D_Matrix TransformMatrix { get; set; } + + public override void SerializeImpl(SerializerObject s) { + Type = s.Serialize(Type, name: nameof(Type)); + RotationMatrix = s.SerializeObject(RotationMatrix, name: nameof(RotationMatrix)); + TransformMatrix = s.SerializeObject(TransformMatrix, name: nameof(TransformMatrix)); + } + + #region MAT_ITransform implementation + /// + /// Position vector + /// + public MTH3D_Vector Position { + get { + if (Type == POS_TransformationType.Identity) + return MTH3D_Vector.Zero; + else + return TransformMatrix.GetPosition(); + } + set { + TransformMatrix.SetPosition(value); + if (value.IsUniform && value.X == 0f) { + if (Type == POS_TransformationType.Translation) + Type = POS_TransformationType.Identity; + } else { + if (Type == POS_TransformationType.Identity) + Type = POS_TransformationType.Translation; + } + } + } + /// + /// Rotation quaternion + /// + public MTH4D_Vector Rotation { + get { + switch (Type) { + case POS_TransformationType.Rotation: + case POS_TransformationType.Complete: + case POS_TransformationType.Uninitialized: + return RotationMatrix.GetRotation(); + default: + return MTH4D_Vector.IdentityQuaternion; + } + } + set { + switch (Type) { + case POS_TransformationType.Translation: + case POS_TransformationType.Identity: + Type = POS_TransformationType.Rotation; + break; + } + throw new NotImplementedException(); + } + } + /// + /// Scale vector + /// + public MTH3D_Vector Scale { + get { + switch (Type) { + case POS_TransformationType.Complete: + return TransformMatrix.GetScale(); + default: + return MTH3D_Vector.One; + } + } + set { + if (value.IsUniform && value.X == 1f) { + // remove scale type if it's a (1,1,1) scale + if (Type == POS_TransformationType.Complete) Type = POS_TransformationType.Rotation; + } else { + Type = POS_TransformationType.Complete; + throw new NotImplementedException(); + } + } + } + #endregion + } +} diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/POS/POS_CompletePosition_DC.cs.meta b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/POS/POS_CompletePosition_DC.cs.meta new file mode 100644 index 00000000..fe49ed98 --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/POS/POS_CompletePosition_DC.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: e41831ba27c067b41854f422a09c4f1f +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/PS1.meta b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/PS1.meta new file mode 100644 index 00000000..2f5cf0d8 --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/PS1.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 7c35c16987e16f84a84b0bec20a2f15f +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/PS1/ALW.meta b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/PS1/ALW.meta new file mode 100644 index 00000000..72cbb047 --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/PS1/ALW.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: c860fea8bf769a0489c4ac3675780e33 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/PS1/ALW/ALW_AlwaysItem.cs b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/PS1/ALW/ALW_AlwaysItem.cs new file mode 100644 index 00000000..61830842 --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/PS1/ALW/ALW_AlwaysItem.cs @@ -0,0 +1,23 @@ +namespace BinarySerializer.Ubisoft.CPA.PS1 +{ + public class ALW_AlwaysItem : BinarySerializable + { + public Pointer SuperObjectPointer { get; set; } + public uint Uint_04 { get; set; } + public uint Uint_08 { get; set; } + public uint Uint_0C { get; set; } + + // Serialized from pointers + public HIE_SuperObject SuperObject { get; set; } + + public override void SerializeImpl(SerializerObject s) + { + SuperObjectPointer = s.SerializePointer(SuperObjectPointer, name: nameof(SuperObjectPointer)); + Uint_04 = s.Serialize(Uint_04, name: nameof(Uint_04)); + Uint_08 = s.Serialize(Uint_08, name: nameof(Uint_08)); + Uint_0C = s.Serialize(Uint_0C, name: nameof(Uint_0C)); + + s.DoAt(SuperObjectPointer, () => SuperObject = s.SerializeObject(SuperObject, name: nameof(SuperObject))); + } + } +} \ No newline at end of file diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/PS1/ALW/ALW_AlwaysItem.cs.meta b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/PS1/ALW/ALW_AlwaysItem.cs.meta new file mode 100644 index 00000000..bd672d4d --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/PS1/ALW/ALW_AlwaysItem.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 40b9939429b4ce040ade820d0575c3ff +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/PS1/ALW/ALW_AlwaysList.cs b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/PS1/ALW/ALW_AlwaysList.cs new file mode 100644 index 00000000..435a693f --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/PS1/ALW/ALW_AlwaysList.cs @@ -0,0 +1,24 @@ +namespace BinarySerializer.Ubisoft.CPA.PS1 +{ + public class ALW_AlwaysList : BinarySerializable + { + public int Index { get; set; } + public int Count { get; set; } + public Pointer ItemsPointer { get; set; } + public uint InvalidPointer { get; set; } + + // Serialized from pointers + public ALW_AlwaysItem[] Items { get; set; } + + public override void SerializeImpl(SerializerObject s) + { + Index = s.Serialize(Index, name: nameof(Index)); + Count = s.Serialize(Count, name: nameof(Count)); + ItemsPointer = s.SerializePointer(ItemsPointer, name: nameof(ItemsPointer)); + InvalidPointer = s.Serialize(InvalidPointer, name: nameof(InvalidPointer)); + + // Serialize data from pointers + s.DoAt(ItemsPointer, () => Items = s.SerializeObjectArray(Items, Count, name: nameof(Items))); + } + } +} \ No newline at end of file diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/PS1/ALW/ALW_AlwaysList.cs.meta b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/PS1/ALW/ALW_AlwaysList.cs.meta new file mode 100644 index 00000000..863604c7 --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/PS1/ALW/ALW_AlwaysList.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 7a29f9562cf7d834297c0e858f839f77 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/PS1/ANIM.meta b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/PS1/ANIM.meta new file mode 100644 index 00000000..5699ae80 --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/PS1/ANIM.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 37105f61b3eb7a84fbbd0428e871f4c9 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/PS1/ANIM/ANIM_Animation.cs b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/PS1/ANIM/ANIM_Animation.cs new file mode 100644 index 00000000..85644e4f --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/PS1/ANIM/ANIM_Animation.cs @@ -0,0 +1,99 @@ +namespace BinarySerializer.Ubisoft.CPA.PS1 +{ + public class ANIM_Animation : BinarySerializable + { + public uint Speed { get; set; } + public Pointer ChannelsPointer { get; set; } + public uint ChannelsCount { get; set; } + public ushort FramesCount { get; set; } + public ushort Ushort_0E { get; set; } + public uint HierarchiesCount { get; set; } + public Pointer HierarchiesPointer { get; set; } + public uint Uint_18 { get; set; } + + public uint FileIndex { get; set; } + public uint Flags { get; set; } + public ushort Ushort_18 { get; set; } + public ushort BonesCount { get; set; } + public Pointer BonesPointer { get; set; } + public ushort Ushort_1A { get; set; } + public uint Uint_20 { get; set; } + public uint Uint_24 { get; set; } + public uint Uint_28 { get; set; } + + // Serialized from pointers + public ANIM_AnimationChannel[] Channels { get; set; } + public ANIM_AnimationHierarchy[] Hierarchies { get; set; } + public string Name { get; set; } + public ANIM_AnimationBoneChannelLinks[] Bones { get; set; } + + public override void SerializeImpl(SerializerObject s) + { + CPA_Settings settings = s.GetCPASettings(); + + if (settings.EngineVersion == EngineVersion.Rayman2_PS1) + { + Speed = s.Serialize(Speed, name: nameof(Speed)); + ChannelsPointer = s.SerializePointer(ChannelsPointer, name: nameof(ChannelsPointer)); + ChannelsCount = s.Serialize(ChannelsCount, name: nameof(ChannelsCount)); + FramesCount = s.Serialize(FramesCount, name: nameof(FramesCount)); + Ushort_0E = s.Serialize(Ushort_0E, name: nameof(Ushort_0E)); + HierarchiesCount = s.Serialize(HierarchiesCount, name: nameof(HierarchiesCount)); + HierarchiesPointer = s.SerializePointer(HierarchiesPointer, name: nameof(HierarchiesPointer)); + Uint_18 = s.Serialize(Uint_18, name: nameof(Uint_18)); + } + else if (settings.EngineVersion == EngineVersion.RaymanRush_PS1) + { + ChannelsPointer = s.SerializePointer(ChannelsPointer, name: nameof(ChannelsPointer)); + HierarchiesPointer = s.SerializePointer(HierarchiesPointer, name: nameof(HierarchiesPointer)); + HierarchiesCount = s.Serialize((ushort)HierarchiesCount, name: nameof(HierarchiesCount)); + FileIndex = s.Serialize((ushort)FileIndex, name: nameof(FileIndex)); + Speed = s.Serialize((byte)Speed, name: nameof(Speed)); + ChannelsCount = s.Serialize((byte)ChannelsCount, name: nameof(ChannelsCount)); + FramesCount = s.Serialize(FramesCount, name: nameof(FramesCount)); + } + else + { + Flags = s.Serialize(Flags, name: nameof(Flags)); + ChannelsPointer = s.SerializePointer(ChannelsPointer, name: nameof(ChannelsPointer)); + ChannelsCount = s.Serialize(ChannelsCount, name: nameof(ChannelsCount)); + FramesCount = s.Serialize(FramesCount, name: nameof(FramesCount)); + Ushort_0E = s.Serialize(Ushort_0E, name: nameof(Ushort_0E)); + HierarchiesCount = s.Serialize(HierarchiesCount, name: nameof(HierarchiesCount)); + + if (settings.EngineVersion == EngineVersion.VIP_PS1 || settings.EngineVersion == EngineVersion.JungleBook_PS1) + { + HierarchiesPointer = s.SerializePointer(HierarchiesPointer, name: nameof(HierarchiesPointer)); + Ushort_18 = s.Serialize(Ushort_18, name: nameof(Ushort_18)); + BonesCount = s.Serialize(BonesCount, name: nameof(BonesCount)); + BonesPointer = s.SerializePointer(BonesPointer, name: nameof(BonesPointer)); + FileIndex = s.Serialize(FileIndex, name: nameof(FileIndex)); + Speed = 30; + } + else + { + Speed = s.Serialize((ushort)Speed, name: nameof(Speed)); + Ushort_1A = s.Serialize(Ushort_1A, name: nameof(Ushort_1A)); + HierarchiesPointer = s.SerializePointer(HierarchiesPointer, name: nameof(HierarchiesPointer)); + Uint_20 = s.Serialize(Uint_20, name: nameof(Uint_20)); + Uint_24 = s.Serialize(Uint_24, name: nameof(Uint_24)); + Uint_28 = s.Serialize(Uint_28, name: nameof(Uint_28)); + } + } + + // Serialize data from pointers + s.DoAt(ChannelsPointer, () => + Channels = s.SerializeObjectArray(Channels, ChannelsCount, name: nameof(Channels))); + + s.DoAt(HierarchiesPointer, () => + Hierarchies = s.SerializeObjectArray(Hierarchies, HierarchiesCount, name: nameof(Hierarchies))); + + if (HierarchiesPointer != null) + s.DoAt(HierarchiesPointer - (settings.EngineVersion == EngineVersion.DonaldDuckQuackAttack_PS1 ? 0x14 : 0x10), () => + Name = s.SerializeString(Name, 0x10, name: nameof(Name))); + + s.DoAt(BonesPointer, () => + Bones = s.SerializeObjectArray(Bones, BonesCount, name: nameof(Bones))); + } + } +} \ No newline at end of file diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/PS1/ANIM/ANIM_Animation.cs.meta b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/PS1/ANIM/ANIM_Animation.cs.meta new file mode 100644 index 00000000..df0566f7 --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/PS1/ANIM/ANIM_Animation.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 045ff252c10e8f84fadb3fa9f018ffaf +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/PS1/ANIM/ANIM_AnimationBoneChannelLinks.cs b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/PS1/ANIM/ANIM_AnimationBoneChannelLinks.cs new file mode 100644 index 00000000..eececf9e --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/PS1/ANIM/ANIM_AnimationBoneChannelLinks.cs @@ -0,0 +1,22 @@ +namespace BinarySerializer.Ubisoft.CPA.PS1 +{ + public class ANIM_AnimationBoneChannelLinks : BinarySerializable + { + public ushort NTTOChannelIndex { get; set; } + public ushort IndicesCount { get; set; } + public Pointer IndicesPointer { get; set; } // Channels + + // Serialized from pointers + public ushort[] Indices { get; set; } + + public override void SerializeImpl(SerializerObject s) + { + NTTOChannelIndex = s.Serialize(NTTOChannelIndex, name: nameof(NTTOChannelIndex)); + IndicesCount = s.Serialize(IndicesCount, name: nameof(IndicesCount)); + IndicesPointer = s.SerializePointer(IndicesPointer, name: nameof(IndicesPointer)); + + // Serialize data from pointers + s.DoAt(IndicesPointer, () => Indices = s.SerializeArray(Indices, IndicesCount, name: nameof(Indices))); + } + } +} \ No newline at end of file diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/PS1/ANIM/ANIM_AnimationBoneChannelLinks.cs.meta b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/PS1/ANIM/ANIM_AnimationBoneChannelLinks.cs.meta new file mode 100644 index 00000000..cf08bcec --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/PS1/ANIM/ANIM_AnimationBoneChannelLinks.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: f8784e9d0caa9d6449df112bd30fc842 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/PS1/ANIM/ANIM_AnimationChannel.cs b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/PS1/ANIM/ANIM_AnimationChannel.cs new file mode 100644 index 00000000..8f2c3033 --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/PS1/ANIM/ANIM_AnimationChannel.cs @@ -0,0 +1,23 @@ +namespace BinarySerializer.Ubisoft.CPA.PS1 +{ + public class ANIM_AnimationChannel : BinarySerializable + { + public Pointer FramesPointer { get; set; } + public ushort FramesCount { get; set; } + public ushort ID { get; set; } + + // Serialized from pointers + public ANIM_AnimationKeyframe[] Frames { get; set; } + + public override void SerializeImpl(SerializerObject s) + { + FramesPointer = s.SerializePointer(FramesPointer, name: nameof(FramesPointer)); + FramesCount = s.Serialize(FramesCount, name: nameof(FramesCount)); + ID = s.Serialize(ID, name: nameof(ID)); + + // Serialize data from pointers + s.DoAt(FramesPointer, () => + Frames = s.SerializeObjectArray(Frames, FramesCount, name: nameof(Frames))); + } + } +} \ No newline at end of file diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/PS1/ANIM/ANIM_AnimationChannel.cs.meta b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/PS1/ANIM/ANIM_AnimationChannel.cs.meta new file mode 100644 index 00000000..87b5cd45 --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/PS1/ANIM/ANIM_AnimationChannel.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 9a698f272900262469c5e616f6d447c2 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/PS1/ANIM/ANIM_AnimationHierarchy.cs b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/PS1/ANIM/ANIM_AnimationHierarchy.cs new file mode 100644 index 00000000..f582ceed --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/PS1/ANIM/ANIM_AnimationHierarchy.cs @@ -0,0 +1,14 @@ +namespace BinarySerializer.Ubisoft.CPA.PS1 +{ + public class ANIM_AnimationHierarchy : BinarySerializable + { + public int Child { get; set; } + public int Parent { get; set; } + + public override void SerializeImpl(SerializerObject s) + { + Child = s.Serialize(Child, name: nameof(Child)); + Parent = s.Serialize(Parent, name: nameof(Parent)); + } + } +} \ No newline at end of file diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/PS1/ANIM/ANIM_AnimationHierarchy.cs.meta b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/PS1/ANIM/ANIM_AnimationHierarchy.cs.meta new file mode 100644 index 00000000..9ad3ee61 --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/PS1/ANIM/ANIM_AnimationHierarchy.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: c8a385c8f62d1cb48959f4b2deb0e5d7 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/PS1/ANIM/ANIM_AnimationIndex.cs b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/PS1/ANIM/ANIM_AnimationIndex.cs new file mode 100644 index 00000000..cdcd9e68 --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/PS1/ANIM/ANIM_AnimationIndex.cs @@ -0,0 +1,12 @@ +namespace BinarySerializer.Ubisoft.CPA.PS1 +{ + public class ANIM_AnimationIndex : BinarySerializable + { + public uint Index { get; set; } + + public override void SerializeImpl(SerializerObject s) + { + Index = s.Serialize(Index, name: nameof(Index)); + } + } +} \ No newline at end of file diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/PS1/ANIM/ANIM_AnimationIndex.cs.meta b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/PS1/ANIM/ANIM_AnimationIndex.cs.meta new file mode 100644 index 00000000..5d557b10 --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/PS1/ANIM/ANIM_AnimationIndex.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 23a6f265f5f63c540a9c0ee72788d537 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/PS1/ANIM/ANIM_AnimationKeyframe.cs b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/PS1/ANIM/ANIM_AnimationKeyframe.cs new file mode 100644 index 00000000..09b3b421 --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/PS1/ANIM/ANIM_AnimationKeyframe.cs @@ -0,0 +1,55 @@ +using System; + +namespace BinarySerializer.Ubisoft.CPA.PS1 +{ + public class ANIM_AnimationKeyframe : BinarySerializable + { + public AnimationFlags Flags { get; set; } + public short NTTO { get; set; } + public ushort Position { get; set; } + public ushort Rotation { get; set; } + public short ExtraDuration { get; set; } + public ushort Scale { get; set; } + public short MorphNTTO { get; set; } + public short MorphProgress { get; set; } + + public override void SerializeImpl(SerializerObject s) + { + Flags = s.Serialize(Flags, name: nameof(Flags)); + + if (Flags.HasFlag(AnimationFlags.NTTO)) + NTTO = s.Serialize(NTTO, name: nameof(NTTO)); + + if (Flags.HasFlag(AnimationFlags.Position)) + Position = s.Serialize(Position, name: nameof(Position)); + + if (Flags.HasFlag(AnimationFlags.Rotation)) + Rotation = s.Serialize(Rotation, name: nameof(Rotation)); + + if (Flags.HasFlag(AnimationFlags.Duration)) + ExtraDuration = s.Serialize(ExtraDuration, name: nameof(ExtraDuration)); + + if (Flags.HasFlag(AnimationFlags.Scale)) + Scale = s.Serialize(Scale, name: nameof(Scale)); + + if (Flags.HasFlag(AnimationFlags.Morph)) + { + MorphNTTO = s.Serialize(MorphNTTO, name: nameof(MorphNTTO)); + MorphProgress = s.Serialize(MorphProgress, name: nameof(MorphProgress)); + } + } + + [Flags] + public enum AnimationFlags : ushort + { + None = 0, + NTTO = 1 << 0, + Position = 1 << 1, + Rotation = 1 << 2, + Duration = 1 << 3, + Scale = 1 << 4, + Morph = 1 << 5, + FlipX = 1 << 6, + } + } +} \ No newline at end of file diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/PS1/ANIM/ANIM_AnimationKeyframe.cs.meta b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/PS1/ANIM/ANIM_AnimationKeyframe.cs.meta new file mode 100644 index 00000000..50529efe --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/PS1/ANIM/ANIM_AnimationKeyframe.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 8b83a339efef974408cb4adf72305a04 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/PS1/ANIM/ANIM_Quaternion.cs b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/PS1/ANIM/ANIM_Quaternion.cs new file mode 100644 index 00000000..53fb6bbc --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/PS1/ANIM/ANIM_Quaternion.cs @@ -0,0 +1,18 @@ +namespace BinarySerializer.Ubisoft.CPA.PS1 +{ + public class ANIM_Quaternion : BinarySerializable + { + public short X { get; set; } + public short Y { get; set; } + public short Z { get; set; } + public short W { get; set; } + + public override void SerializeImpl(SerializerObject s) + { + X = s.Serialize(X, name: nameof(X)); + Y = s.Serialize(Y, name: nameof(Y)); + Z = s.Serialize(Z, name: nameof(Z)); + W = s.Serialize(W, name: nameof(W)); + } + } +} \ No newline at end of file diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/PS1/ANIM/ANIM_Quaternion.cs.meta b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/PS1/ANIM/ANIM_Quaternion.cs.meta new file mode 100644 index 00000000..f2e1ab4a --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/PS1/ANIM/ANIM_Quaternion.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 71ce9539ec26e954280ace48fe2c4353 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/PS1/ANIM/ANIM_Vector.cs b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/PS1/ANIM/ANIM_Vector.cs new file mode 100644 index 00000000..9d765415 --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/PS1/ANIM/ANIM_Vector.cs @@ -0,0 +1,16 @@ +namespace BinarySerializer.Ubisoft.CPA.PS1 +{ + public class ANIM_Vector : BinarySerializable + { + public short X { get; set; } + public short Y { get; set; } + public short Z { get; set; } + + public override void SerializeImpl(SerializerObject s) + { + X = s.Serialize(X, name: nameof(X)); + Y = s.Serialize(Y, name: nameof(Y)); + Z = s.Serialize(Z, name: nameof(Z)); + } + } +} \ No newline at end of file diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/PS1/ANIM/ANIM_Vector.cs.meta b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/PS1/ANIM/ANIM_Vector.cs.meta new file mode 100644 index 00000000..889f7cb8 --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/PS1/ANIM/ANIM_Vector.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 8cf31c778614b074ebee56131db40bba +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/PS1/BigFile.meta b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/PS1/BigFile.meta new file mode 100644 index 00000000..23c1fba2 --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/PS1/BigFile.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 30e79be29421bc7449a560bf67f7d25f +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/PS1/BigFile/PackedFile.cs b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/PS1/BigFile/PackedFile.cs new file mode 100644 index 00000000..9c658373 --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/PS1/BigFile/PackedFile.cs @@ -0,0 +1,42 @@ +using System; +using System.Linq; + +namespace BinarySerializer.Ubisoft.CPA.PS1 +{ + /// + /// A file packed in a big file which consists of multiple, often compressed, blocks + /// + public class PackedFile : BinarySerializable + { + public PackedFileBlock[] Blocks { get; set; } + + /// + /// Combines the blocks and returns the full file data + /// + /// The full file data + public byte[] GetFileBytes() + { + int fileSize = Blocks.Sum(x => x.DecompressedSize); + + if (fileSize <= 0) + return null; + + byte[] fileData = new byte[fileSize]; + + int offset = 0; + + foreach (PackedFileBlock block in Blocks.Where(x => x.Data != null)) + { + Array.Copy(block.Data, 0, fileData, offset, block.DecompressedSize); + offset += block.DecompressedSize; + } + + return fileData; + } + + public override void SerializeImpl(SerializerObject s) + { + Blocks = s.SerializeObjectArrayUntil(Blocks, x => x.Data == null, name: nameof(Blocks)); + } + } +} \ No newline at end of file diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/PS1/BigFile/PackedFile.cs.meta b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/PS1/BigFile/PackedFile.cs.meta new file mode 100644 index 00000000..0d4ab7af --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/PS1/BigFile/PackedFile.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: a5cba1bedec2e9b47924aed607cefee6 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/PS1/BigFile/PackedFileArchive.cs b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/PS1/BigFile/PackedFileArchive.cs new file mode 100644 index 00000000..77ead9d5 --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/PS1/BigFile/PackedFileArchive.cs @@ -0,0 +1,20 @@ +namespace BinarySerializer.Ubisoft.CPA.PS1 +{ + /// + /// An archive of multiple packed files. Usually the files for a level. + /// + public class PackedFileArchive : BinarySerializable + { + public long Pre_MaxLength { get; set; } + + public PackedFile[] Files { get; set; } + + public override void SerializeImpl(SerializerObject s) + { + long endOffset = s.CurrentFileOffset + Pre_MaxLength; + + Files = s.SerializeObjectArrayUntil(Files, + x => x.Blocks[0].DecompressedSize == -1 || s.CurrentFileOffset >= endOffset, name: nameof(Files)); + } + } +} \ No newline at end of file diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/PS1/BigFile/PackedFileArchive.cs.meta b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/PS1/BigFile/PackedFileArchive.cs.meta new file mode 100644 index 00000000..9ae8006d --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/PS1/BigFile/PackedFileArchive.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 61a742f89d6e246418b6ed42e806b631 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/PS1/BigFile/PackedFileArchiveReference.cs b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/PS1/BigFile/PackedFileArchiveReference.cs new file mode 100644 index 00000000..ebccc9eb --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/PS1/BigFile/PackedFileArchiveReference.cs @@ -0,0 +1,39 @@ +namespace BinarySerializer.Ubisoft.CPA.PS1 +{ + /// + /// A reference to a . This is used in Rayman 2 in the game executable. + /// + public class PackedFileArchiveReference : BinarySerializable + { + public byte[] Bytes_00 { get; set; } + public uint Destination { get; set; } + public uint Uint_0C { get; set; } // 1 if it has sound effects + public BlockRef Main { get; set; } + public BlockRef OverlayGame { get; set; } + public BlockRef OverlayCine { get; set; } + public BlockRef[] Cinematics { get; set; } + + public override void SerializeImpl(SerializerObject s) + { + Bytes_00 = s.SerializeArray(Bytes_00, 8, name: nameof(Bytes_00)); + Destination = s.Serialize(Destination, name: nameof(Destination)); + Uint_0C = s.Serialize(Uint_0C, name: nameof(Uint_0C)); + Main = s.SerializeObject(Main, name: nameof(Main)); + OverlayGame = s.SerializeObject(OverlayGame, name: nameof(OverlayGame)); + OverlayCine = s.SerializeObject(OverlayCine, name: nameof(OverlayCine)); + Cinematics = s.SerializeObjectArray(Cinematics, 20, name: nameof(Cinematics)); + } + + public class BlockRef : BinarySerializable + { + public uint LBA { get; set; } + public uint Length { get; set; } + + public override void SerializeImpl(SerializerObject s) + { + LBA = s.Serialize(LBA, name: nameof(LBA)); + Length = s.Serialize(Length, name: nameof(Length)); + } + } + } +} \ No newline at end of file diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/PS1/BigFile/PackedFileArchiveReference.cs.meta b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/PS1/BigFile/PackedFileArchiveReference.cs.meta new file mode 100644 index 00000000..cdd4efc0 --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/PS1/BigFile/PackedFileArchiveReference.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: b4e92fe10514dea469d803e7cf24ccec +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/PS1/BigFile/PackedFileBlock.cs b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/PS1/BigFile/PackedFileBlock.cs new file mode 100644 index 00000000..34551c1e --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/PS1/BigFile/PackedFileBlock.cs @@ -0,0 +1,33 @@ +namespace BinarySerializer.Ubisoft.CPA.PS1 +{ + /// + /// A block for a packed file + /// + public class PackedFileBlock : BinarySerializable + { + public int DecompressedSize { get; set; } + public int CompressedSize { get; set; } + public byte[] Data { get; set; } + + public override void SerializeImpl(SerializerObject s) + { + DecompressedSize = s.Serialize(DecompressedSize, name: nameof(DecompressedSize)); + + // If the size is 0 we've reached the end of the file. If it's -1 we're in the padding between sectors. + if (DecompressedSize == 0 || DecompressedSize == -1) + return; + + CompressedSize = s.Serialize(CompressedSize, name: nameof(CompressedSize)); + + if (CompressedSize != DecompressedSize) + { + s.DoEncoded(new LZOEncoder(DecompressedSize, CompressedSize), + () => Data = s.SerializeArray(Data, DecompressedSize, name: nameof(Data))); + } + else + { + Data = s.SerializeArray(Data, DecompressedSize, name: nameof(Data)); + } + } + } +} \ No newline at end of file diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/PS1/BigFile/PackedFileBlock.cs.meta b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/PS1/BigFile/PackedFileBlock.cs.meta new file mode 100644 index 00000000..f46b931f --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/PS1/BigFile/PackedFileBlock.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 9602ba8ba776d4f4a9d0212ae09f5a8e +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/PS1/CAM.meta b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/PS1/CAM.meta new file mode 100644 index 00000000..abf1d81a --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/PS1/CAM.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 27be76a6055518849b15a70d4839cd30 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/PS1/CAM/CAM_CameraGraph.cs b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/PS1/CAM/CAM_CameraGraph.cs new file mode 100644 index 00000000..bb79cd5c --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/PS1/CAM/CAM_CameraGraph.cs @@ -0,0 +1,30 @@ +namespace BinarySerializer.Ubisoft.CPA.PS1 +{ + public class CAM_CameraGraph : BinarySerializable + { + public uint Uint_00 { get; set; } + public Pointer CurrentPointer { get; set; } + public Pointer LastPointer { get; set; } + public Pointer FirstPointer { get; set; } + public uint Flags { get; set; } + + // Serialized from pointers + public CAM_CameraGraphNode Current { get; set; } + public CAM_CameraGraphNode First { get; set; } + public CAM_CameraGraphNode Last { get; set; } + + public override void SerializeImpl(SerializerObject s) + { + Uint_00 = s.Serialize(Uint_00, name: nameof(Uint_00)); + CurrentPointer = s.SerializePointer(CurrentPointer, name: nameof(CurrentPointer)); + LastPointer = s.SerializePointer(LastPointer, name: nameof(LastPointer)); + FirstPointer = s.SerializePointer(FirstPointer, name: nameof(FirstPointer)); + Flags = s.Serialize(Flags, name: nameof(Flags)); + + // Serialize data from pointers + s.DoAt(CurrentPointer, () => Current = s.SerializeObject(Current, name: nameof(Current))); + s.DoAt(FirstPointer, () => First = s.SerializeObject(First, name: nameof(First))); + s.DoAt(LastPointer, () => Last = s.SerializeObject(Last, name: nameof(Last))); + } + } +} \ No newline at end of file diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/PS1/CAM/CAM_CameraGraph.cs.meta b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/PS1/CAM/CAM_CameraGraph.cs.meta new file mode 100644 index 00000000..36fa8368 --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/PS1/CAM/CAM_CameraGraph.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 6dd0c637c19e9814d94e569c8658cf7a +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/PS1/CAM/CAM_CameraGraphNode.cs b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/PS1/CAM/CAM_CameraGraphNode.cs new file mode 100644 index 00000000..89ac6959 --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/PS1/CAM/CAM_CameraGraphNode.cs @@ -0,0 +1,32 @@ +namespace BinarySerializer.Ubisoft.CPA.PS1 +{ + public class CAM_CameraGraphNode : BinarySerializable + { + public Pointer PreviousPointer { get; set; } + public Pointer NextPointer { get; set; } + public int X { get; set; } + public int Y { get; set; } + public int Z { get; set; } + public uint Uint_14 { get; set; } + public uint Uint_18 { get; set; } + + // Serialized from pointers + public CAM_CameraGraphNode Previous { get; set; } + public CAM_CameraGraphNode Next { get; set; } + + public override void SerializeImpl(SerializerObject s) + { + PreviousPointer = s.SerializePointer(PreviousPointer, name: nameof(PreviousPointer)); + NextPointer = s.SerializePointer(NextPointer, name: nameof(NextPointer)); + X = s.Serialize(X, name: nameof(X)); + Y = s.Serialize(Y, name: nameof(Y)); + Z = s.Serialize(Z, name: nameof(Z)); + Uint_14 = s.Serialize(Uint_14, name: nameof(Uint_14)); + Uint_18 = s.Serialize(Uint_18, name: nameof(Uint_18)); + + // Serialize data from pointers + s.DoAt(PreviousPointer, () => Previous = s.SerializeObject(Previous, name: nameof(Previous))); + s.DoAt(NextPointer, () => Next = s.SerializeObject(Next, name: nameof(Next))); + } + } +} \ No newline at end of file diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/PS1/CAM/CAM_CameraGraphNode.cs.meta b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/PS1/CAM/CAM_CameraGraphNode.cs.meta new file mode 100644 index 00000000..81c38c19 --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/PS1/CAM/CAM_CameraGraphNode.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 3ac8353583e1186468944ed047f3243c +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/PS1/CAM/CAM_CameraModifier.cs b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/PS1/CAM/CAM_CameraModifier.cs new file mode 100644 index 00000000..22cccb77 --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/PS1/CAM/CAM_CameraModifier.cs @@ -0,0 +1,70 @@ +namespace BinarySerializer.Ubisoft.CPA.PS1 +{ + public class CAM_CameraModifier : BinarySerializable + { + public uint Type { get; set; } + public int Int_04 { get; set; } + public int Int_08 { get; set; } + public int Int_0C { get; set; } + public int Int_10 { get; set; } + public int Int_14 { get; set; } + public int Int_18 { get; set; } + public int Int_1C { get; set; } + public Pointer DataPointer { get; set; } + public int X2 { get; set; } + public int Y2 { get; set; } + public int Z2 { get; set; } + public int Int_30 { get; set; } + public int Int_34 { get; set; } + public int X_7 { get; set; } + public int Y_7 { get; set; } + public int Z_7 { get; set; } + public int Int_44 { get; set; } + public int X { get; set; } + public int Y { get; set; } + public int Z { get; set; } + public int Int_54 { get; set; } + public int Int_58 { get; set; } + public int Int_5C { get; set; } + public int Int_60 { get; set; } + public int Int_64 { get; set; } + + // Serialized from pointers + public CAM_CameraGraph Graph { get; set; } + + public override void SerializeImpl(SerializerObject s) + { + Type = s.Serialize(Type, name: nameof(Type)); + Int_04 = s.Serialize(Int_04, name: nameof(Int_04)); + Int_08 = s.Serialize(Int_08, name: nameof(Int_08)); + Int_0C = s.Serialize(Int_0C, name: nameof(Int_0C)); + Int_10 = s.Serialize(Int_10, name: nameof(Int_10)); + Int_14 = s.Serialize(Int_14, name: nameof(Int_14)); + Int_18 = s.Serialize(Int_18, name: nameof(Int_18)); + Int_1C = s.Serialize(Int_1C, name: nameof(Int_1C)); + DataPointer = s.SerializePointer(DataPointer, name: nameof(DataPointer)); + X2 = s.Serialize(X2, name: nameof(X2)); + Y2 = s.Serialize(Y2, name: nameof(Y2)); + Z2 = s.Serialize(Z2, name: nameof(Z2)); + Int_30 = s.Serialize(Int_30, name: nameof(Int_30)); + Int_34 = s.Serialize(Int_34, name: nameof(Int_34)); + X_7 = s.Serialize(X_7, name: nameof(X_7)); + Y_7 = s.Serialize(Y_7, name: nameof(Y_7)); + Z_7 = s.Serialize(Z_7, name: nameof(Z_7)); + Int_44 = s.Serialize(Int_44, name: nameof(Int_44)); + X = s.Serialize(X, name: nameof(X)); + Y = s.Serialize(Y, name: nameof(Y)); + Z = s.Serialize(Z, name: nameof(Z)); + Int_54 = s.Serialize(Int_54, name: nameof(Int_54)); + Int_58 = s.Serialize(Int_58, name: nameof(Int_58)); + Int_5C = s.Serialize(Int_5C, name: nameof(Int_5C)); + Int_60 = s.Serialize(Int_60, name: nameof(Int_60)); + Int_64 = s.Serialize(Int_64, name: nameof(Int_64)); + + // Serialize data from pointers + if (Type == 9) + s.DoAt(DataPointer, () => Graph = s.SerializeObject(Graph, name: nameof(Graph))); + // TODO: SO if not type 9? + } + } +} \ No newline at end of file diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/PS1/CAM/CAM_CameraModifier.cs.meta b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/PS1/CAM/CAM_CameraModifier.cs.meta new file mode 100644 index 00000000..38e0f6e1 --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/PS1/CAM/CAM_CameraModifier.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: db5a60c8be5f42444b26c61628db4f27 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/PS1/CAM/CAM_CameraModifierVolume.cs b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/PS1/CAM/CAM_CameraModifierVolume.cs new file mode 100644 index 00000000..77668df2 --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/PS1/CAM/CAM_CameraModifierVolume.cs @@ -0,0 +1,38 @@ +namespace BinarySerializer.Ubisoft.CPA.PS1 +{ + public class CAM_CameraModifierVolume : BinarySerializable + { + public uint Int_00 { get; set; } + public uint Flags { get; set; } + public int X0 { get; set; } + public int Y0 { get; set; } + public int Z0 { get; set; } + public int Int_14 { get; set; } + public int Radius { get; set; } + public int X1 { get; set; } + public int Y1 { get; set; } + public int Z1 { get; set; } + public int Int_28 { get; set; } + public int Int_2C { get; set; } + public int Int_30 { get; set; } + public int Int_34 { get; set; } + + public override void SerializeImpl(SerializerObject s) + { + Int_00 = s.Serialize(Int_00, name: nameof(Int_00)); + Flags = s.Serialize(Flags, name: nameof(Flags)); + X0 = s.Serialize(X0, name: nameof(X0)); + Y0 = s.Serialize(Y0, name: nameof(Y0)); + Z0 = s.Serialize(Z0, name: nameof(Z0)); + Int_14 = s.Serialize(Int_14, name: nameof(Int_14)); + Radius = s.Serialize(Radius, name: nameof(Radius)); + X1 = s.Serialize(X1, name: nameof(X1)); + Y1 = s.Serialize(Y1, name: nameof(Y1)); + Z1 = s.Serialize(Z1, name: nameof(Z1)); + Int_28 = s.Serialize(Int_28, name: nameof(Int_28)); + Int_2C = s.Serialize(Int_2C, name: nameof(Int_2C)); + Int_30 = s.Serialize(Int_30, name: nameof(Int_30)); + Int_34 = s.Serialize(Int_34, name: nameof(Int_34)); + } + } +} \ No newline at end of file diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/PS1/CAM/CAM_CameraModifierVolume.cs.meta b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/PS1/CAM/CAM_CameraModifierVolume.cs.meta new file mode 100644 index 00000000..bbf09dd0 --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/PS1/CAM/CAM_CameraModifierVolume.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 1465cdffa0d8ea147bf1a652d2ac4871 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/PS1/COL.meta b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/PS1/COL.meta new file mode 100644 index 00000000..fb71f795 --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/PS1/COL.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 704e430fc38e3024fad34c97c2cdcd29 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/PS1/COL/COL_GeometricObjectCollide.cs b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/PS1/COL/COL_GeometricObjectCollide.cs new file mode 100644 index 00000000..fa2015a2 --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/PS1/COL/COL_GeometricObjectCollide.cs @@ -0,0 +1,46 @@ +namespace BinarySerializer.Ubisoft.CPA.PS1 +{ + public class COL_GeometricObjectCollide : BinarySerializable + { + public ushort VerticesCount { get; set; } + public ushort NormalsCount { get; set; } + public ushort TrianglesCount { get; set; } + public ushort QuadsCount { get; set; } + public byte[] Bytes_10 { get; set; } + public Pointer VerticesPointer { get; set; } + public Pointer NormalsPointer { get; set; } + public Pointer TrianglesPointer { get; set; } + public Pointer QuadsPointer { get; set; } + public uint Uint_38 { get; set; } + + // Serialized from pointers + public COL_GeometricObjectCollideVector[] Vertices { get; set; } + public COL_GeometricObjectCollideVector[] Normals { get; set; } + public COL_GeometricObjectCollidePolygon[] Triangles { get; set; } + public COL_GeometricObjectCollidePolygon[] Quads { get; set; } + + public override void SerializeImpl(SerializerObject s) + { + VerticesCount = s.Serialize(VerticesCount, name: nameof(VerticesCount)); + NormalsCount = s.Serialize(NormalsCount, name: nameof(NormalsCount)); + TrianglesCount = s.Serialize(TrianglesCount, name: nameof(TrianglesCount)); + QuadsCount = s.Serialize(QuadsCount, name: nameof(QuadsCount)); + Bytes_10 = s.SerializeArray(Bytes_10, 0x20, name: nameof(Bytes_10)); + VerticesPointer = s.SerializePointer(VerticesPointer, name: nameof(VerticesPointer)); + NormalsPointer = s.SerializePointer(NormalsPointer, name: nameof(NormalsPointer)); + TrianglesPointer = s.SerializePointer(TrianglesPointer, name: nameof(TrianglesPointer)); + QuadsPointer = s.SerializePointer(QuadsPointer, name: nameof(QuadsPointer)); + Uint_38 = s.Serialize(Uint_38, name: nameof(Uint_38)); + + // Serialize data from pointers + s.DoAt(VerticesPointer, () => + Vertices = s.SerializeObjectArray(Vertices, VerticesCount, name: nameof(Vertices))); + s.DoAt(NormalsPointer, () => + Normals = s.SerializeObjectArray(Normals, NormalsCount, onPreSerialize: v => v.Pre_CoordinateScale = (short.MaxValue / 8f), name: nameof(Normals))); + s.DoAt(TrianglesPointer, () => + Triangles = s.SerializeObjectArray(Triangles, TrianglesCount, x => x.Pre_IsQuad = false, name: nameof(Triangles))); + s.DoAt(QuadsPointer, () => + Quads = s.SerializeObjectArray(Quads, QuadsCount, x => x.Pre_IsQuad = true, name: nameof(Quads))); + } + } +} \ No newline at end of file diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/PS1/COL/COL_GeometricObjectCollide.cs.meta b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/PS1/COL/COL_GeometricObjectCollide.cs.meta new file mode 100644 index 00000000..8af3f6fa --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/PS1/COL/COL_GeometricObjectCollide.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 5d82248369f1c3341983deb94877c7cc +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/PS1/COL/COL_GeometricObjectCollidePolygon.cs b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/PS1/COL/COL_GeometricObjectCollidePolygon.cs new file mode 100644 index 00000000..efdbf2e4 --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/PS1/COL/COL_GeometricObjectCollidePolygon.cs @@ -0,0 +1,36 @@ +namespace BinarySerializer.Ubisoft.CPA.PS1 +{ + public class COL_GeometricObjectCollidePolygon : BinarySerializable + { + public bool Pre_IsQuad { get; set; } + + public byte Flag0 { get; set; } + public byte GameMaterial { get; set; } + public ushort Normal { get; set; } + + // Vertices + public ushort V0 { get; set; } + public ushort V1 { get; set; } + public ushort V2 { get; set; } + public ushort V3 { get; set; } + + // Unknown + public COL_GeometricObjectCollideVector Vector1 { get; set; } + public COL_GeometricObjectCollideVector Vector2 { get; set; } + + public override void SerializeImpl(SerializerObject s) + { + Flag0 = s.Serialize(Flag0, name: nameof(Flag0)); + GameMaterial = s.Serialize(GameMaterial, name: nameof(GameMaterial)); + Normal = s.Serialize(Normal, name: nameof(Normal)); + + V0 = s.Serialize(V0, name: nameof(V0)); + V1 = s.Serialize(V1, name: nameof(V1)); + V2 = s.Serialize(V2, name: nameof(V2)); + V3 = s.Serialize(V3, name: nameof(V3)); + + Vector1 = s.SerializeObject(Vector1, name: nameof(Vector1)); + Vector2 = s.SerializeObject(Vector2, name: nameof(Vector2)); + } + } +} \ No newline at end of file diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/PS1/COL/COL_GeometricObjectCollidePolygon.cs.meta b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/PS1/COL/COL_GeometricObjectCollidePolygon.cs.meta new file mode 100644 index 00000000..e43ef7af --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/PS1/COL/COL_GeometricObjectCollidePolygon.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 2c30727543278d04d9177c9ddc11d700 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/PS1/COL/COL_GeometricObjectCollideVector.cs b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/PS1/COL/COL_GeometricObjectCollideVector.cs new file mode 100644 index 00000000..e124715a --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/PS1/COL/COL_GeometricObjectCollideVector.cs @@ -0,0 +1,16 @@ +namespace BinarySerializer.Ubisoft.CPA.PS1 +{ + public class COL_GeometricObjectCollideVector : BinarySerializable + { + public float? Pre_CoordinateScale { get; set; } + + public MTH3D_Vector_PS1_Short Vector { get; set; } + public short GarbageData { get; set; } // ??? + + public override void SerializeImpl(SerializerObject s) + { + Vector = s.SerializeObject(Vector, onPreSerialize: v => v.Pre_CoordinateScale = Pre_CoordinateScale, name: nameof(Vector)); + GarbageData = s.Serialize(GarbageData, name: nameof(GarbageData)); + } + } +} \ No newline at end of file diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/PS1/COL/COL_GeometricObjectCollideVector.cs.meta b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/PS1/COL/COL_GeometricObjectCollideVector.cs.meta new file mode 100644 index 00000000..3baf7d43 --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/PS1/COL/COL_GeometricObjectCollideVector.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 02957bb08ea4ff54d8eacc0a7c0d9be5 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/PS1/CS.meta b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/PS1/CS.meta new file mode 100644 index 00000000..1a1d5f76 --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/PS1/CS.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: fb83a87acacb2854292ba64cee1e1bfa +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/PS1/CS/CS_ActivationList.cs b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/PS1/CS/CS_ActivationList.cs new file mode 100644 index 00000000..d8531cae --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/PS1/CS/CS_ActivationList.cs @@ -0,0 +1,21 @@ +namespace BinarySerializer.Ubisoft.CPA.PS1 +{ + public class CS_ActivationList : BinarySerializable + { + public uint ActivationZonesCount { get; set; } + public Pointer ActivationZonesPointer { get; set; } + + // Serialized from pointers + public CS_ActivationZone[] ActivationZones { get; set; } + + public override void SerializeImpl(SerializerObject s) + { + ActivationZonesCount = s.Serialize(ActivationZonesCount, name: nameof(ActivationZonesCount)); + ActivationZonesPointer = s.SerializePointer(ActivationZonesPointer, name: nameof(ActivationZonesPointer)); + + // Serialize data from pointers + s.DoAt(ActivationZonesPointer, () => + ActivationZones = s.SerializeObjectArray(ActivationZones, ActivationZonesCount, name: nameof(ActivationZones))); + } + } +} \ No newline at end of file diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/PS1/CS/CS_ActivationList.cs.meta b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/PS1/CS/CS_ActivationList.cs.meta new file mode 100644 index 00000000..0e194680 --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/PS1/CS/CS_ActivationList.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: c34c99bb8c8fc304ca101156054f38af +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/PS1/CS/CS_ActivationZone.cs b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/PS1/CS/CS_ActivationZone.cs new file mode 100644 index 00000000..398daf0d --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/PS1/CS/CS_ActivationZone.cs @@ -0,0 +1,21 @@ +namespace BinarySerializer.Ubisoft.CPA.PS1 +{ + public class CS_ActivationZone : BinarySerializable + { + public uint ActivationsCount { get; set; } + public Pointer ActivationsPointer { get; set; } + + // Serialized from pointers + public uint[] Activations { get; set; } + + public override void SerializeImpl(SerializerObject s) + { + ActivationsCount = s.Serialize(ActivationsCount, name: nameof(ActivationsCount)); + ActivationsPointer = s.SerializePointer(ActivationsPointer, name: nameof(ActivationsPointer)); + + // Serialize data from pointers + s.DoAt(ActivationsPointer, () => + Activations = s.SerializeArray(Activations, ActivationsCount, name: nameof(Activations))); + } + } +} \ No newline at end of file diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/PS1/CS/CS_ActivationZone.cs.meta b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/PS1/CS/CS_ActivationZone.cs.meta new file mode 100644 index 00000000..8631d3ad --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/PS1/CS/CS_ActivationZone.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: e298dd7bb3dfa5448a94d647f81864b6 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/PS1/CS/CS_CollSet.cs b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/PS1/CS/CS_CollSet.cs new file mode 100644 index 00000000..65c7bc07 --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/PS1/CS/CS_CollSet.cs @@ -0,0 +1,64 @@ +namespace BinarySerializer.Ubisoft.CPA.PS1 +{ + public class CS_CollSet : BinarySerializable + { + // TODO: Handle R2 data - depends on states + public uint R2_Uint_00 { get; set; } + public uint R2_Uint_04 { get; set; } + public uint R2_Uint_08 { get; set; } + public uint R2_Uint_0C { get; set; } + + public Pointer ZDDPointer { get; set; } + public Pointer ZDEPointer { get; set; } + public Pointer ZDMPointer { get; set; } + public Pointer ZDRPointer { get; set; } + + public Pointer ActivationListPointer { get; set; } + + public byte Byte_14 { get; set; } + public byte Byte_15 { get; set; } + public byte Byte_16 { get; set; } + public byte Byte_17 { get; set; } + + // Serialized from pointers + public CS_ZDXList ZDD { get; set; } + public CS_ZDXList ZDE { get; set; } + public CS_ZDXList ZDM { get; set; } + public CS_ZDXList ZDR { get; set; } + public CS_ActivationList ActivationList { get; set; } + + public override void SerializeImpl(SerializerObject s) + { + CPA_Settings settings = s.GetCPASettings(); + + if (settings.EngineVersion == EngineVersion.Rayman2_PS1) + { + R2_Uint_00 = s.Serialize(R2_Uint_00, name: nameof(R2_Uint_00)); + R2_Uint_04 = s.Serialize(R2_Uint_04, name: nameof(R2_Uint_04)); + R2_Uint_08 = s.Serialize(R2_Uint_08, name: nameof(R2_Uint_08)); + R2_Uint_0C = s.Serialize(R2_Uint_0C, name: nameof(R2_Uint_0C)); + } + else + { + ZDDPointer = s.SerializePointer(ZDDPointer, name: nameof(ZDDPointer)); + ZDEPointer = s.SerializePointer(ZDEPointer, name: nameof(ZDEPointer)); + ZDMPointer = s.SerializePointer(ZDMPointer, name: nameof(ZDMPointer)); + ZDRPointer = s.SerializePointer(ZDRPointer, name: nameof(ZDRPointer)); + } + + ActivationListPointer = s.SerializePointer(ActivationListPointer, name: nameof(ActivationListPointer)); + + Byte_14 = s.Serialize(Byte_14, name: nameof(Byte_14)); + Byte_15 = s.Serialize(Byte_15, name: nameof(Byte_15)); + Byte_16 = s.Serialize(Byte_16, name: nameof(Byte_16)); + Byte_17 = s.Serialize(Byte_17, name: nameof(Byte_17)); + + // Serialize data from pointers + s.DoAt(ZDDPointer, () => ZDD = s.SerializeObject(ZDD, name: nameof(ZDD))); + s.DoAt(ZDEPointer, () => ZDE = s.SerializeObject(ZDE, name: nameof(ZDE))); + s.DoAt(ZDMPointer, () => ZDM = s.SerializeObject(ZDM, name: nameof(ZDM))); + s.DoAt(ZDRPointer, () => ZDR = s.SerializeObject(ZDR, name: nameof(ZDR))); + s.DoAt(ActivationListPointer, () => ActivationList = s.SerializeObject(ActivationList, name: nameof(ActivationList))); + } + } +} \ No newline at end of file diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/PS1/CS/CS_CollSet.cs.meta b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/PS1/CS/CS_CollSet.cs.meta new file mode 100644 index 00000000..871221c5 --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/PS1/CS/CS_CollSet.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 77368b0c39437454c81e6e4ed4f95d26 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/PS1/CS/CS_PhysicalObjectCollision.cs b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/PS1/CS/CS_PhysicalObjectCollision.cs new file mode 100644 index 00000000..d1e13ffe --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/PS1/CS/CS_PhysicalObjectCollision.cs @@ -0,0 +1,25 @@ +namespace BinarySerializer.Ubisoft.CPA.PS1 +{ + public class CS_PhysicalObjectCollision : BinarySerializable + { + public byte[] Bytes_00 { get; set; } + public uint CollisionCount { get; set; } + public Pointer GeoCollidePointer { get; set; } + + // Serialized from pointers + public COL_GeometricObjectCollide GeoCollide { get; set; } + + public override void SerializeImpl(SerializerObject s) + { + Bytes_00 = s.SerializeArray(Bytes_00, 0x10, name: nameof(Bytes_00)); + CollisionCount = s.Serialize(CollisionCount, name: nameof(CollisionCount)); + GeoCollidePointer = s.SerializePointer(GeoCollidePointer, allowInvalid: CollisionCount == 0, name: nameof(GeoCollidePointer)); + + if(CollisionCount > 1) + s.LogWarning($"{Offset}: Encountered a {nameof(CS_PhysicalObjectCollision)} with {nameof(CollisionCount)} > 1! Check the data to find out how this is serialized"); + // Serialize data from pointers + s.DoAt(GeoCollidePointer, () => + GeoCollide = s.SerializeObject(GeoCollide, name: nameof(GeoCollide))); + } + } +} \ No newline at end of file diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/PS1/CS/CS_PhysicalObjectCollision.cs.meta b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/PS1/CS/CS_PhysicalObjectCollision.cs.meta new file mode 100644 index 00000000..3c1e12e6 --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/PS1/CS/CS_PhysicalObjectCollision.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 4ace690fa30a09a4b94734c33c26bfe9 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/PS1/CS/CS_PhysicalObjectCollisionMapping.cs b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/PS1/CS/CS_PhysicalObjectCollisionMapping.cs new file mode 100644 index 00000000..ff8fd5b6 --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/PS1/CS/CS_PhysicalObjectCollisionMapping.cs @@ -0,0 +1,22 @@ +namespace BinarySerializer.Ubisoft.CPA.PS1 +{ + public class CS_PhysicalObjectCollisionMapping : BinarySerializable + { + public Pointer CollisionPointer { get; set; } + public Pointer POListEntryPointer { get; set; } + public byte[] Bytes_08 { get; set; } + + // Serialized from pointers + public CS_PhysicalObjectCollision Collision { get; set; } + + public override void SerializeImpl(SerializerObject s) + { + CollisionPointer = s.SerializePointer(CollisionPointer, name: nameof(CollisionPointer)); + POListEntryPointer = s.SerializePointer(POListEntryPointer, name: nameof(POListEntryPointer)); + Bytes_08 = s.SerializeArray(Bytes_08, 0x24, name: nameof(Bytes_08)); + + // Serialize data from pointers + s.DoAt(CollisionPointer, () => Collision = s.SerializeObject(Collision, name: nameof(Collision))); + } + } +} \ No newline at end of file diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/PS1/CS/CS_PhysicalObjectCollisionMapping.cs.meta b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/PS1/CS/CS_PhysicalObjectCollisionMapping.cs.meta new file mode 100644 index 00000000..1f9cbb3d --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/PS1/CS/CS_PhysicalObjectCollisionMapping.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: d764afe4b9a5a8842b806b4974e1e632 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/PS1/CS/CS_ZDXBox.cs b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/PS1/CS/CS_ZDXBox.cs new file mode 100644 index 00000000..79259b61 --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/PS1/CS/CS_ZDXBox.cs @@ -0,0 +1,26 @@ +namespace BinarySerializer.Ubisoft.CPA.PS1 +{ + public class CS_ZDXBox : BinarySerializable + { + public short X0 { get; set; } + public short Y0 { get; set; } + public short Z0 { get; set; } + public short X1 { get; set; } + public short Y1 { get; set; } + public short Z1 { get; set; } + public uint GameMaterial { get; set; } + + public override void SerializeImpl(SerializerObject s) + { + X0 = s.Serialize(X0, name: nameof(X0)); + Y0 = s.Serialize(Y0, name: nameof(Y0)); + Z0 = s.Serialize(Z0, name: nameof(Z0)); + s.SerializePadding(2, logIfNotNull: true); + X1 = s.Serialize(X1, name: nameof(X1)); + Y1 = s.Serialize(Y1, name: nameof(Y1)); + Z1 = s.Serialize(Z1, name: nameof(Z1)); + s.SerializePadding(2, logIfNotNull: true); + GameMaterial = s.Serialize(GameMaterial, name: nameof(GameMaterial)); + } + } +} \ No newline at end of file diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/PS1/CS/CS_ZDXBox.cs.meta b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/PS1/CS/CS_ZDXBox.cs.meta new file mode 100644 index 00000000..cb9f843f --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/PS1/CS/CS_ZDXBox.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: b18d79a30149a9549b5dffa77b1b349a +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/PS1/CS/CS_ZDXEntry.cs b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/PS1/CS/CS_ZDXEntry.cs new file mode 100644 index 00000000..0f8bc54b --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/PS1/CS/CS_ZDXEntry.cs @@ -0,0 +1,30 @@ +namespace BinarySerializer.Ubisoft.CPA.PS1 +{ + public class CS_ZDXEntry : BinarySerializable + { + public uint SpheresCount { get; set; } + public Pointer SpheresPointer { get; set; } + public uint BoxesCount { get; set; } + public Pointer BoxesPointer { get; set; } + public uint UnknownCount { get; set; } + public Pointer UnknownPointer { get; set; } // 0x3c large + + // Serialized from pointers + public CS_ZDXSphere[] Spheres { get; set; } + public CS_ZDXBox[] Boxes { get; set; } + + public override void SerializeImpl(SerializerObject s) + { + SpheresCount = s.Serialize(SpheresCount, name: nameof(SpheresCount)); + SpheresPointer = s.SerializePointer(SpheresPointer, name: nameof(SpheresPointer)); + BoxesCount = s.Serialize(BoxesCount, name: nameof(BoxesCount)); + BoxesPointer = s.SerializePointer(BoxesPointer, name: nameof(BoxesPointer)); + UnknownCount = s.Serialize(UnknownCount, name: nameof(UnknownCount)); + UnknownPointer = s.SerializePointer(UnknownPointer, name: nameof(UnknownPointer)); + + // Serialize data from pointers + s.DoAt(SpheresPointer, () => Spheres = s.SerializeObjectArray(Spheres, SpheresCount, name: nameof(Spheres))); + s.DoAt(BoxesPointer, () => Boxes = s.SerializeObjectArray(Boxes, BoxesCount, name: nameof(Boxes))); + } + } +} \ No newline at end of file diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/PS1/CS/CS_ZDXEntry.cs.meta b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/PS1/CS/CS_ZDXEntry.cs.meta new file mode 100644 index 00000000..6cf1f092 --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/PS1/CS/CS_ZDXEntry.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 67467659bceb8624993ee1152f6ae9e9 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/PS1/CS/CS_ZDXSphere.cs b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/PS1/CS/CS_ZDXSphere.cs new file mode 100644 index 00000000..d0fdb420 --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/PS1/CS/CS_ZDXSphere.cs @@ -0,0 +1,21 @@ +namespace BinarySerializer.Ubisoft.CPA.PS1 +{ + public class CS_ZDXSphere : BinarySerializable + { + public uint Radius { get; set; } + public short X { get; set; } + public short Y { get; set; } + public short Z { get; set; } + public uint GameMaterial { get; set; } + + public override void SerializeImpl(SerializerObject s) + { + Radius = s.Serialize(Radius, name: nameof(Radius)); + X = s.Serialize(X, name: nameof(X)); + Y = s.Serialize(Y, name: nameof(Y)); + Z = s.Serialize(Z, name: nameof(Z)); + s.SerializePadding(2, logIfNotNull: true); + GameMaterial = s.Serialize(GameMaterial, name: nameof(GameMaterial)); + } + } +} \ No newline at end of file diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/PS1/CS/CS_ZDXSphere.cs.meta b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/PS1/CS/CS_ZDXSphere.cs.meta new file mode 100644 index 00000000..9f58a47f --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/PS1/CS/CS_ZDXSphere.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 0d8033dc1c6723349a982151a3ef61ee +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/PS1/CS/CS_ZdxList.cs b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/PS1/CS/CS_ZdxList.cs new file mode 100644 index 00000000..86114b22 --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/PS1/CS/CS_ZdxList.cs @@ -0,0 +1,20 @@ +namespace BinarySerializer.Ubisoft.CPA.PS1 +{ + public class CS_ZDXList : BinarySerializable + { + public uint EntriesCount { get; set; } + public Pointer EntriesPointer { get; set; } + + // Serialized from pointers + public CS_ZDXEntry[] Entries { get; set; } + + public override void SerializeImpl(SerializerObject s) + { + EntriesCount = s.Serialize(EntriesCount, name: nameof(EntriesCount)); + EntriesPointer = s.SerializePointer(EntriesPointer, name: nameof(EntriesPointer)); + + // Serialize data from pointers + s.DoAt(EntriesPointer, () => Entries = s.SerializeObjectArray(Entries, EntriesCount, name: nameof(Entries))); + } + } +} \ No newline at end of file diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/PS1/CS/CS_ZdxList.cs.meta b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/PS1/CS/CS_ZdxList.cs.meta new file mode 100644 index 00000000..86d65f44 --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/PS1/CS/CS_ZdxList.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: cf9798efd59266147b42726d1c2b5647 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/PS1/GAM.meta b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/PS1/GAM.meta new file mode 100644 index 00000000..a753fb57 --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/PS1/GAM.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: c2c6fd66e900c6e4db40e0dad5a853b2 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/PS1/GAM/GAM_GlobalPointerTable.cs b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/PS1/GAM/GAM_GlobalPointerTable.cs new file mode 100644 index 00000000..6ff2fc75 --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/PS1/GAM/GAM_GlobalPointerTable.cs @@ -0,0 +1,396 @@ +using System; +using System.Linq; +using BinarySerializer.PS1; + +namespace BinarySerializer.Ubisoft.CPA.PS1 +{ + public class GAM_GlobalPointerTable : BinarySerializable + { + public byte[] UnknownBytes1 { get; set; } + public uint DynamicGeometricObjectsCount_Cine { get; set; } + public byte[] UnknownBytes2 { get; set; } + public Pointer DynamicWorld { get; set; } + public Pointer FatherSector { get; set; } + public Pointer InactiveDynamicWorld { get; set; } + public int AlwaysCount { get; set; } + public Pointer AlwaysPointer { get; set; } + public int WayPointsCount { get; set; } + public int GraphsCount { get; set; } + public Pointer WayPointsPointer { get; set; } + public Pointer GraphsPointer { get; set; } + public short PersosCount { get; set; } + public short Ushort_0116 { get; set; } + public Pointer PersosPointer { get; set; } + public Pointer StatesPointer { get; set; } + public short StatesCount { get; set; } + public short Ushort_0122 { get; set; } + public uint Ushort_0124 { get; set; } + public uint Ushort_0128 { get; set; } + public Pointer Pointer_012C { get; set; } // This + 0x10 = main character + public Pointer Pointer_0130 { get; set; } + public uint Uint_134 { get; set; } + public uint Uint_138 { get; set; } + public uint Uint_13C { get; set; } + public uint Uint_140 { get; set; } + public uint Uint_144 { get; set; } + public int InitialCinematicStreamID { get; set; } + public Pointer AnimationPositionsPointer { get; set; } + public Pointer AnimationRotationsPointer { get; set; } + public Pointer AnimationScalesPointer { get; set; } + + // UI textures + public byte UITexturesCount { get; set; } + public byte Byte_0159 { get; set; } + public ushort Ushort_015A { get; set; } + public Pointer UITexturesNamesPointer { get; set; } + public Pointer UITexturesWidthsPointer { get; set; } + public Pointer UITexturesHeightsPointer { get; set; } + public Pointer UITexturesTSBPointer { get; set; } + public Pointer UITexturesCBAPointer { get; set; } + public Pointer UITexturesXPointer { get; set; } + public Pointer UITexturesYPointer { get; set; } + + public Pointer Pointer_0178 { get; set; } + public int Int_017C { get; set; } + public Pointer DynamicGeometricObjectsPointer { get; set; } + public Pointer StaticGeometricObjectsPointer { get; set; } + public uint DynamicGeometricObjectsCount { get; set; } + public ushort Ushort_018C { get; set; } + public ushort Ushort_018E { get; set; } + public short Short_0190 { get; set; } + public ushort Ushort_0192 { get; set; } + public uint IpoCollisionCount { get; set; } + public Pointer IpoCollisionPointer { get; set; } + public uint MeshCollisionCount { get; set; } + public uint MeshCollisionPointer { get; set; } + public Pointer SectorsPointer { get; set; } + public ushort SectorsCount { get; set; } + public ushort Ushort_01AA { get; set; } + public uint CameraModifiersCount { get; set; } + public uint Uint_01B0 { get; set; } + public uint Uint_01B4 { get; set; } + public uint Uint_01B8 { get; set; } + public uint VIP_Uint_01BC { get; set; } + public uint VIP_Uint_01C0 { get; set; } + public Pointer CameraModifiersVolumesPointer { get; set; } + public Pointer CameraModifiersPointer { get; set; } + public Pointer Rush_Pointer_0114 { get; set; } + public ushort Rush_Ushort_0118 { get; set; } + public ushort Rush_Ushort_011A { get; set; } + public Pointer GameMaterialsPointer { get; set; } + public uint GameMaterialsCount { get; set; } + public uint Uint_1CC { get; set; } + public ushort Ushort_1D0 { get; set; } + public ushort Ushort_1D2 { get; set; } + public Pointer Pointer_01D4 { get; set; } + + // AGO textures + public uint AGOTexturesCount { get; set; } + public Pointer AGOTexturesTSBPointer { get; set; } + public Pointer AGOTexturesCBAPointer { get; set; } + public Pointer AGOTexturesXPointer { get; set; } + public Pointer AGOTexturesYPointer { get; set; } + public Pointer AGOTexturesAbsoluteXPointer { get; set; } + public Pointer AGOTexturesAbsoluteYPointer { get; set; } + public uint Uint_01F4 { get; set; } + public uint Uint_01F8 { get; set; } + public uint Uint_01FC { get; set; } + public Pointer Rush_AGOTexturesWidthsPointer { get; set; } + public Pointer Rush_AGOTexturesHeightsPointer { get; set; } + + // Serialized from pointers + public ALW_AlwaysList[] Always { get; set; } + public WAY_WayPoint[] WayPoints { get; set; } + public WAY_Graph[] Graphs { get; set; } + public PERSO_Perso[] Persos { get; set; } + public Pointer[] States { get; set; } + public ANIM_Vector[] AnimationPositions { get; set; } + public ANIM_Quaternion[] AnimationRotations { get; set; } + public ANIM_Vector[] AnimationScales { get; set; } + + // UI textures + public Pointer[] UITexturesNames { get; set; } + public ushort[] UITexturesWidths { get; set; } + public ushort[] UITexturesHeights { get; set; } + public PS1_TSB[] UITexturesTSB { get; set; } + public PS1_CBA[] UITexturesCBA { get; set; } + public byte[] UITexturesX { get; set; } + public byte[] UITexturesY { get; set; } + + public PO_ObjectsTable DynamicGeometricObjects { get; set; } + public PO_ObjectsTable StaticGeometricObjects { get; set; } + public COL_GeometricObjectCollide[] IpoCollision { get; set; } + public SECT_Sector[] Sectors { get; set; } + public CAM_CameraModifierVolume[] CameraModifierVolumes { get; set; } + public CAM_CameraModifier[] CameraModifiers { get; set; } + public GMT_GameMaterial[] GameMaterials { get; set; } + + // AGO textures + public PS1_TSB[] AGOTexturesTSB { get; set; } + public PS1_CBA[] AGOTexturesCBA { get; set; } + public byte[] AGOTexturesX { get; set; } + public byte[] AGOTexturesY { get; set; } + public ushort[] AGOTexturesAbsoluteX { get; set; } + public ushort[] AGOTexturesAbsoluteY { get; set; } + public ushort[] Rush_AGOTexturesWidths { get; set; } + public ushort[] Rush_AGOTexturesHeights { get; set; } + + public override void SerializeImpl(SerializerObject s) { + s.GetLevel().GlobalPointerTable = this; + CPA_Settings settings = s.GetCPASettings(); + + if (settings.EngineVersion == EngineVersion.RaymanRush_PS1) + { + UnknownBytes1 = s.SerializeArray(UnknownBytes1, 0x40, name: nameof(UnknownBytes1)); + } + else if (settings.EngineVersion == EngineVersion.DonaldDuckQuackAttack_PS1) + { + UnknownBytes1 = s.SerializeArray(UnknownBytes1, 0x58, name: nameof(UnknownBytes1)); + } + else if (settings.EngineVersion == EngineVersion.VIP_PS1) + { + UnknownBytes1 = s.SerializeArray(UnknownBytes1, 0x28, name: nameof(UnknownBytes1)); + } + else if (settings.EngineVersion == EngineVersion.JungleBook_PS1) + { + UnknownBytes1 = s.SerializeArray(UnknownBytes1, 0xEC, name: nameof(UnknownBytes1)); + } + else + { + UnknownBytes1 = s.SerializeArray(UnknownBytes1, 0xCC, name: nameof(UnknownBytes1)); + DynamicGeometricObjectsCount_Cine = s.Serialize(DynamicGeometricObjectsCount_Cine, name: nameof(DynamicGeometricObjectsCount_Cine)); + UnknownBytes2 = s.SerializeArray(UnknownBytes2, 0x20, name: nameof(UnknownBytes2)); + } + + DynamicWorld = s.SerializePointer(DynamicWorld, name: nameof(DynamicWorld)); + FatherSector = s.SerializePointer(FatherSector, name: nameof(FatherSector)); + InactiveDynamicWorld = s.SerializePointer(InactiveDynamicWorld, name: nameof(InactiveDynamicWorld)); + + AlwaysCount = s.Serialize(AlwaysCount, name: nameof(AlwaysCount)); + AlwaysPointer = s.SerializePointer(AlwaysPointer, name: nameof(AlwaysPointer)); + + WayPointsCount = s.Serialize(WayPointsCount, name: nameof(WayPointsCount)); + GraphsCount = s.Serialize(GraphsCount, name: nameof(GraphsCount)); + WayPointsPointer = s.SerializePointer(WayPointsPointer, name: nameof(WayPointsPointer)); + GraphsPointer = s.SerializePointer(GraphsPointer, name: nameof(GraphsPointer)); + + PersosCount = s.Serialize(PersosCount, name: nameof(PersosCount)); + Ushort_0116 = s.Serialize(Ushort_0116, name: nameof(Ushort_0116)); + PersosPointer = s.SerializePointer(PersosPointer, name: nameof(PersosPointer)); + + StatesPointer = s.SerializePointer(StatesPointer, name: nameof(StatesPointer)); + StatesCount = s.Serialize(StatesCount, name: nameof(StatesCount)); + Ushort_0122 = s.Serialize(Ushort_0122, name: nameof(Ushort_0122)); + Ushort_0124 = s.Serialize(Ushort_0124, name: nameof(Ushort_0124)); + Ushort_0128 = s.Serialize(Ushort_0128, name: nameof(Ushort_0128)); + Pointer_012C = s.SerializePointer(Pointer_012C, name: nameof(Pointer_012C)); + Pointer_0130 = s.SerializePointer(Pointer_0130, name: nameof(Pointer_0130)); + Uint_134 = s.Serialize(Uint_134, name: nameof(Uint_134)); + Uint_138 = s.Serialize(Uint_138, name: nameof(Uint_138)); + Uint_13C = s.Serialize(Uint_13C, name: nameof(Uint_13C)); + Uint_140 = s.Serialize(Uint_140, name: nameof(Uint_140)); + Uint_144 = s.Serialize(Uint_144, name: nameof(Uint_144)); + InitialCinematicStreamID = s.Serialize(InitialCinematicStreamID, name: nameof(InitialCinematicStreamID)); + AnimationPositionsPointer = s.SerializePointer(AnimationPositionsPointer, name: nameof(AnimationPositionsPointer)); + AnimationRotationsPointer = s.SerializePointer(AnimationRotationsPointer, name: nameof(AnimationRotationsPointer)); + AnimationScalesPointer = s.SerializePointer(AnimationScalesPointer, name: nameof(AnimationScalesPointer)); + + if (settings.EngineVersion == EngineVersion.DonaldDuckQuackAttack_PS1) + { + // TODO: Implement + throw new NotImplementedException(); + } + else if (settings.EngineVersion == EngineVersion.VIP_PS1 || settings.EngineVersion == EngineVersion.JungleBook_PS1) + { + // TODO: Implement + throw new NotImplementedException(); + } + else + { + UITexturesCount = s.Serialize(UITexturesCount, name: nameof(UITexturesCount)); + Byte_0159 = s.Serialize(Byte_0159, name: nameof(Byte_0159)); + Ushort_015A = s.Serialize(Ushort_015A, name: nameof(Ushort_015A)); + + UITexturesNamesPointer = s.SerializePointer(UITexturesNamesPointer, name: nameof(UITexturesNamesPointer)); + UITexturesWidthsPointer = s.SerializePointer(UITexturesWidthsPointer, name: nameof(UITexturesWidthsPointer)); + UITexturesHeightsPointer = s.SerializePointer(UITexturesHeightsPointer, name: nameof(UITexturesHeightsPointer)); + UITexturesTSBPointer = s.SerializePointer(UITexturesTSBPointer, name: nameof(UITexturesTSBPointer)); + UITexturesCBAPointer = s.SerializePointer(UITexturesCBAPointer, name: nameof(UITexturesCBAPointer)); + UITexturesXPointer = s.SerializePointer(UITexturesXPointer, name: nameof(UITexturesXPointer)); + UITexturesYPointer = s.SerializePointer(UITexturesYPointer, name: nameof(UITexturesYPointer)); + + Pointer_0178 = s.SerializePointer(Pointer_0178, name: nameof(Pointer_0178)); + Int_017C = s.Serialize(Int_017C, name: nameof(Int_017C)); + + DynamicGeometricObjectsPointer = s.SerializePointer(DynamicGeometricObjectsPointer, name: nameof(DynamicGeometricObjectsPointer)); + StaticGeometricObjectsPointer = s.SerializePointer(StaticGeometricObjectsPointer, name: nameof(StaticGeometricObjectsPointer)); + DynamicGeometricObjectsCount = s.Serialize(DynamicGeometricObjectsCount, name: nameof(DynamicGeometricObjectsCount)); + } + + if (settings.EngineVersion != EngineVersion.VIP_PS1) + { + Ushort_018C = s.Serialize(Ushort_018C, name: nameof(Ushort_018C)); + Ushort_018E = s.Serialize(Ushort_018E, name: nameof(Ushort_018E)); + Short_0190 = s.Serialize(Short_0190, name: nameof(Short_0190)); + Ushort_0192 = s.Serialize(Ushort_0192, name: nameof(Ushort_0192)); + + IpoCollisionCount = s.Serialize(IpoCollisionCount, name: nameof(IpoCollisionCount)); + IpoCollisionPointer = s.SerializePointer(IpoCollisionPointer, name: nameof(IpoCollisionPointer)); + MeshCollisionCount = s.Serialize(MeshCollisionCount, name: nameof(MeshCollisionCount)); + MeshCollisionPointer = s.Serialize(MeshCollisionPointer, name: nameof(MeshCollisionPointer)); + } + else + { + // TODO: Implement + throw new NotImplementedException(); + } + + SectorsPointer = s.SerializePointer(SectorsPointer, name: nameof(SectorsPointer)); + SectorsCount = s.Serialize(SectorsCount, name: nameof(SectorsCount)); + Ushort_01AA = s.Serialize(Ushort_01AA, name: nameof(Ushort_01AA)); + + if (settings.EngineVersion != EngineVersion.DonaldDuckQuackAttack_PS1) + { + CameraModifiersCount = s.Serialize(CameraModifiersCount, name: nameof(CameraModifiersCount)); + Uint_01B0 = s.Serialize(Uint_01B0, name: nameof(Uint_01B0)); + Uint_01B4 = s.Serialize(Uint_01B4, name: nameof(Uint_01B4)); + Uint_01B8 = s.Serialize(Uint_01B8, name: nameof(Uint_01B8)); + + if (settings.EngineVersion != EngineVersion.VIP_PS1) + { + CameraModifiersVolumesPointer = s.SerializePointer(CameraModifiersVolumesPointer, name: nameof(CameraModifiersVolumesPointer)); + CameraModifiersPointer = s.SerializePointer(CameraModifiersPointer, name: nameof(CameraModifiersPointer)); + } + else + { + VIP_Uint_01BC = s.Serialize(VIP_Uint_01BC, name: nameof(VIP_Uint_01BC)); + VIP_Uint_01C0 = s.Serialize(VIP_Uint_01C0, name: nameof(VIP_Uint_01C0)); + } + + if (settings.EngineVersion == EngineVersion.RaymanRush_PS1) + { + Rush_Pointer_0114 = s.SerializePointer(Rush_Pointer_0114, name: nameof(Rush_Pointer_0114)); + Rush_Ushort_0118 = s.Serialize(Rush_Ushort_0118, name: nameof(Rush_Ushort_0118)); + Rush_Ushort_011A = s.Serialize(Rush_Ushort_011A, name: nameof(Rush_Ushort_011A)); + } + } + + GameMaterialsPointer = s.SerializePointer(GameMaterialsPointer, name: nameof(GameMaterialsPointer)); + GameMaterialsCount = s.Serialize(GameMaterialsCount, name: nameof(GameMaterialsCount)); + Uint_1CC = s.Serialize(Uint_1CC, name: nameof(Uint_1CC)); + Ushort_1D0 = s.Serialize(Ushort_1D0, name: nameof(Ushort_1D0)); + Ushort_1D2 = s.Serialize(Ushort_1D2, name: nameof(Ushort_1D2)); + Pointer_01D4 = s.SerializePointer(Pointer_01D4, name: nameof(Pointer_01D4)); + + AGOTexturesCount = s.Serialize(AGOTexturesCount, name: nameof(AGOTexturesCount)); + AGOTexturesTSBPointer = s.SerializePointer(AGOTexturesTSBPointer, name: nameof(AGOTexturesTSBPointer)); + AGOTexturesCBAPointer = s.SerializePointer(AGOTexturesCBAPointer, name: nameof(AGOTexturesCBAPointer)); + AGOTexturesXPointer = s.SerializePointer(AGOTexturesXPointer, name: nameof(AGOTexturesXPointer)); + AGOTexturesYPointer = s.SerializePointer(AGOTexturesYPointer, name: nameof(AGOTexturesYPointer)); + AGOTexturesAbsoluteXPointer = s.SerializePointer(AGOTexturesAbsoluteXPointer, name: nameof(AGOTexturesAbsoluteXPointer)); + AGOTexturesAbsoluteYPointer = s.SerializePointer(AGOTexturesAbsoluteYPointer, name: nameof(AGOTexturesAbsoluteYPointer)); + + if (settings.EngineVersion == EngineVersion.RaymanRush_PS1) + { + Rush_AGOTexturesWidthsPointer = s.SerializePointer(Rush_AGOTexturesWidthsPointer, name: nameof(Rush_AGOTexturesWidthsPointer)); + Rush_AGOTexturesHeightsPointer = s.SerializePointer(Rush_AGOTexturesHeightsPointer, name: nameof(Rush_AGOTexturesHeightsPointer)); + } + else if (settings.EngineVersion == EngineVersion.Rayman2_PS1) + { + Uint_01F4 = s.Serialize(Uint_01F4, name: nameof(Uint_01F4)); + Uint_01F8 = s.Serialize(Uint_01F8, name: nameof(Uint_01F8)); + Uint_01FC = s.Serialize(Uint_01FC, name: nameof(Uint_01FC)); + } + + // Serialize data from pointers + DynamicWorld?.Resolve(s); + FatherSector?.Resolve(s); + InactiveDynamicWorld?.Resolve(s); + + s.DoAt(AlwaysPointer, () => + Always = s.SerializeObjectArray(Always, AlwaysCount, name: nameof(Always))); + + s.DoAt(WayPointsPointer, () => + WayPoints = s.SerializeObjectArray(WayPoints, WayPointsCount, name: nameof(WayPoints))); + s.DoAt(GraphsPointer, () => + Graphs = s.SerializeObjectArray(Graphs, GraphsCount, name: nameof(Graphs))); + + s.DoAt(PersosPointer, () => + Persos = s.SerializeObjectArray(Persos, PersosCount, name: nameof(Persos))); + s.DoAt(StatesPointer, () => + States = s.SerializePointerArray(States, StatesCount, resolve: true, name: nameof(States))); + + long animPosCount = (AnimationRotationsPointer.FileOffset - AnimationPositionsPointer.FileOffset) / 6; + long animRotCount = (AnimationScalesPointer.FileOffset - AnimationRotationsPointer.FileOffset) / 8; + long animScaleCount = Persos?. + Where(x => x.Perso3DData?.Family?.Animations != null). + SelectMany(x => x.Perso3DData.Family.Animations). + Where(x => x.Channels != null). + SelectMany(x => x.Channels). + Where(x => x.Frames != null). + SelectMany(x => x.Frames). + Max(x => x.Scale) + 1 ?? 0; + + s.DoAt(AnimationPositionsPointer, () => + AnimationPositions = s.SerializeObjectArray(AnimationPositions, animPosCount, name: nameof(AnimationPositions))); + s.DoAt(AnimationRotationsPointer, () => + AnimationRotations = s.SerializeObjectArray(AnimationRotations, animRotCount, name: nameof(AnimationRotations))); + s.DoAt(AnimationScalesPointer, () => + AnimationScales = s.SerializeObjectArray(AnimationScales, animScaleCount, name: nameof(AnimationScales))); + + s.DoAt(UITexturesNamesPointer, () => + UITexturesNames = s.SerializePointerArray(UITexturesNames, UITexturesCount, resolve: true, name: nameof(UITexturesNames))); + s.DoAt(UITexturesWidthsPointer, () => + UITexturesWidths = s.SerializeArray(UITexturesWidths, UITexturesCount, name: nameof(UITexturesWidths))); + s.DoAt(UITexturesHeightsPointer, () => + UITexturesHeights = s.SerializeArray(UITexturesHeights, UITexturesCount, name: nameof(UITexturesHeights))); + s.DoAt(UITexturesTSBPointer, () => + UITexturesTSB = s.SerializeObjectArray(UITexturesTSB, UITexturesCount, name: nameof(UITexturesTSB))); + s.DoAt(UITexturesCBAPointer, () => + UITexturesCBA = s.SerializeObjectArray(UITexturesCBA, UITexturesCount, name: nameof(UITexturesCBA))); + s.DoAt(UITexturesXPointer, () => + UITexturesX = s.SerializeArray(UITexturesX, UITexturesCount, name: nameof(UITexturesX))); + s.DoAt(UITexturesYPointer, () => + UITexturesY = s.SerializeArray(UITexturesY, UITexturesCount, name: nameof(UITexturesY))); + + uint dynamicGeoCount = DynamicGeometricObjectsCount - 2; + uint? staticGeoCount = settings.EngineVersion == EngineVersion.Rayman2_PS1 ? IpoCollisionCount : (uint?)null; + + s.DoAt(DynamicGeometricObjectsPointer, () => + DynamicGeometricObjects = s.SerializeObject(DynamicGeometricObjects, x => x.Pre_Length = dynamicGeoCount, name: nameof(DynamicGeometricObjects))); + s.DoAt(StaticGeometricObjectsPointer, () => + StaticGeometricObjects = s.SerializeObject(StaticGeometricObjects, x => x.Pre_Length = staticGeoCount, name: nameof(StaticGeometricObjects))); + + s.DoAt(IpoCollisionPointer, () => + IpoCollision = s.SerializeObjectArray(IpoCollision, IpoCollisionCount, name: nameof(IpoCollision))); + + s.DoAt(SectorsPointer, () => + Sectors = s.SerializeObjectArray(Sectors, SectorsCount, name: nameof(Sectors))); + + s.DoAt(CameraModifiersVolumesPointer, () => + CameraModifierVolumes = s.SerializeObjectArray(CameraModifierVolumes, CameraModifiersCount, name: nameof(CameraModifierVolumes))); + s.DoAt(CameraModifiersPointer, () => + CameraModifiers = s.SerializeObjectArray(CameraModifiers, CameraModifiersCount, name: nameof(CameraModifiers))); + + s.DoAt(GameMaterialsPointer, () => + GameMaterials = s.SerializeObjectArray(GameMaterials, GameMaterialsCount, name: nameof(GameMaterials))); + + s.DoAt(AGOTexturesTSBPointer, () => + AGOTexturesTSB = s.SerializeObjectArray(AGOTexturesTSB, AGOTexturesCount, name: nameof(AGOTexturesTSB))); + s.DoAt(AGOTexturesCBAPointer, () => + AGOTexturesCBA = s.SerializeObjectArray(AGOTexturesCBA, AGOTexturesCount, name: nameof(AGOTexturesCBA))); + s.DoAt(AGOTexturesXPointer, () => + AGOTexturesX = s.SerializeArray(AGOTexturesX, AGOTexturesCount, name: nameof(AGOTexturesX))); + s.DoAt(AGOTexturesYPointer, () => + AGOTexturesY = s.SerializeArray(AGOTexturesY, AGOTexturesCount, name: nameof(AGOTexturesY))); + s.DoAt(AGOTexturesAbsoluteXPointer, () => + AGOTexturesAbsoluteX = s.SerializeArray(AGOTexturesAbsoluteX, AGOTexturesCount, name: nameof(AGOTexturesAbsoluteX))); + s.DoAt(AGOTexturesAbsoluteYPointer, () => + AGOTexturesAbsoluteY = s.SerializeArray(AGOTexturesAbsoluteY, AGOTexturesCount, name: nameof(AGOTexturesAbsoluteY))); + s.DoAt(Rush_AGOTexturesWidthsPointer, () => + Rush_AGOTexturesWidths = s.SerializeArray(Rush_AGOTexturesWidths, AGOTexturesCount, name: nameof(Rush_AGOTexturesWidths))); + s.DoAt(Rush_AGOTexturesHeightsPointer, () => + Rush_AGOTexturesHeights = s.SerializeArray(Rush_AGOTexturesHeights, AGOTexturesCount, name: nameof(Rush_AGOTexturesHeights))); + } + } +} \ No newline at end of file diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/PS1/GAM/GAM_GlobalPointerTable.cs.meta b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/PS1/GAM/GAM_GlobalPointerTable.cs.meta new file mode 100644 index 00000000..04ed199f --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/PS1/GAM/GAM_GlobalPointerTable.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 87a656998d0b03c44a7f4f4895154983 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/PS1/GAM/GAM_Level_PS1.cs b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/PS1/GAM/GAM_Level_PS1.cs new file mode 100644 index 00000000..494886e4 --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/PS1/GAM/GAM_Level_PS1.cs @@ -0,0 +1,22 @@ +using System; +using BinarySerializer.PS1; + +namespace BinarySerializer.Ubisoft.CPA.PS1 { + public class GAM_Level_PS1 { + public Context Context { get; set; } + + public float CoordinateFactor { get; set; } = 100f; + public GAM_GlobalPointerTable GlobalPointerTable { get; set; } + public GLI_TextureCache TextureCache { get; set; } + public PS1_VRAM VRAM { get; set; } + + public GAM_Level_PS1(Context c) { + Context = c; + c.StoreObject(ContextKey, this); + + TextureCache = new GLI_TextureCache(Context); + } + + public static string ContextKey => nameof(GAM_Level_PS1); + } +} diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/PS1/GAM/GAM_Level_PS1.cs.meta b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/PS1/GAM/GAM_Level_PS1.cs.meta new file mode 100644 index 00000000..47b2d7ce --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/PS1/GAM/GAM_Level_PS1.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 8cd3e043d4a71ee40970dd154884d5e9 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/PS1/GEO.meta b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/PS1/GEO.meta new file mode 100644 index 00000000..64c02e7e --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/PS1/GEO.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: e9de4221bc6a3384ab727617befc1c26 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/PS1/GEO/Deform.meta b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/PS1/GEO/Deform.meta new file mode 100644 index 00000000..5a93b166 --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/PS1/GEO/Deform.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 438b6587de9faf74fa1c5f02c2613662 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/PS1/GEO/Deform/GEO_DeformationBone.cs b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/PS1/GEO/Deform/GEO_DeformationBone.cs new file mode 100644 index 00000000..786b6c70 --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/PS1/GEO/Deform/GEO_DeformationBone.cs @@ -0,0 +1,30 @@ +using BinarySerializer.PS1; + +namespace BinarySerializer.Ubisoft.CPA.PS1 +{ + public class GEO_DeformationBone : BinarySerializable { + public ushort VerticesCount { get; set; } + public short Short_02 { get; set; } + public MTH3D_Vector_PS1_Short TranslationVector { get; set; } + public short Short_0A { get; set; } + public Pointer VerticesPointer { get; set; } + public MTH3D_Matrix_PS1 RotationMatrix { get; set; } + + public ushort[] Unknown { get; set; } + public ushort[] Vertices { get; set; } + + public override void SerializeImpl(SerializerObject s) { + VerticesCount = s.Serialize(VerticesCount, name: nameof(VerticesCount)); + Short_02 = s.Serialize(Short_02, name: nameof(Short_02)); + TranslationVector = s.SerializeObject(TranslationVector, name: nameof(TranslationVector)); + Short_0A = s.Serialize(Short_0A, name: nameof(Short_0A)); + VerticesPointer = s.SerializePointer(VerticesPointer, allowInvalid: VerticesCount == 0, name: nameof(VerticesPointer)); + RotationMatrix = s.SerializeObject(RotationMatrix, name: nameof(RotationMatrix)); + + Unknown = s.SerializeArray(Unknown, 7, name: nameof(Unknown)); + + s.DoAt(VerticesPointer, () => + Vertices = s.SerializeArray(Vertices, VerticesCount, name: nameof(Vertices))); + } + } +} \ No newline at end of file diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/PS1/GEO/Deform/GEO_DeformationBone.cs.meta b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/PS1/GEO/Deform/GEO_DeformationBone.cs.meta new file mode 100644 index 00000000..6b522608 --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/PS1/GEO/Deform/GEO_DeformationBone.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 1c63629d6e090bf42bf14923a3362f73 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/PS1/GEO/Deform/GEO_DeformationUnknown.cs b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/PS1/GEO/Deform/GEO_DeformationUnknown.cs new file mode 100644 index 00000000..28254f54 --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/PS1/GEO/Deform/GEO_DeformationUnknown.cs @@ -0,0 +1,16 @@ +namespace BinarySerializer.Ubisoft.CPA.PS1 +{ + public class GEO_DeformationUnknown : BinarySerializable { + public ushort VertexIndex { get; set; } + public ushort UShort_02 { get; set; } + + public short[] Unknown { get; set; } + + public override void SerializeImpl(SerializerObject s) { + VertexIndex = s.Serialize(VertexIndex, name: nameof(VertexIndex)); + UShort_02 = s.Serialize(UShort_02, name: nameof(UShort_02)); + + Unknown = s.SerializeArray(Unknown, 4, name: nameof(Unknown)); + } + } +} \ No newline at end of file diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/PS1/GEO/Deform/GEO_DeformationUnknown.cs.meta b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/PS1/GEO/Deform/GEO_DeformationUnknown.cs.meta new file mode 100644 index 00000000..fd99ba2a --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/PS1/GEO/Deform/GEO_DeformationUnknown.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: f30d3978ff73ed14189702276dc81250 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/PS1/GEO/Deform/GEO_DeformationVertexWeightSet.cs b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/PS1/GEO/Deform/GEO_DeformationVertexWeightSet.cs new file mode 100644 index 00000000..1981874e --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/PS1/GEO/Deform/GEO_DeformationVertexWeightSet.cs @@ -0,0 +1,33 @@ +namespace BinarySerializer.Ubisoft.CPA.PS1 +{ + public class GEO_DeformationVertexWeightSet : BinarySerializable { + public ushort WeightsCount { get; set; } + public ushort VertexIndex { get; set; } + public Pointer WeightsPointer { get; set; } + + public short[] Unknown { get; set; } + + public BoneWeight[] Weights { get; set; } + + public override void SerializeImpl(SerializerObject s) { + WeightsCount = s.Serialize(WeightsCount, name: nameof(WeightsCount)); + VertexIndex = s.Serialize(VertexIndex, name: nameof(VertexIndex)); + WeightsPointer = s.SerializePointer(WeightsPointer, allowInvalid: WeightsCount == 0, name: nameof(WeightsPointer)); + + Unknown = s.SerializeArray(Unknown, 4, name: nameof(Unknown)); + + s.DoAt(WeightsPointer, () => + Weights = s.SerializeObjectArray(Weights, WeightsCount, name: nameof(Weights))); + } + + public class BoneWeight : BinarySerializable { + public ushort Bone { get; set; } + public ushort Weight { get; set; } + + public override void SerializeImpl(SerializerObject s) { + Bone = s.Serialize(Bone, name: nameof(Bone)); + Weight = s.Serialize(Weight, name: nameof(Weight)); + } + } + } +} \ No newline at end of file diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/PS1/GEO/Deform/GEO_DeformationVertexWeightSet.cs.meta b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/PS1/GEO/Deform/GEO_DeformationVertexWeightSet.cs.meta new file mode 100644 index 00000000..e5c2024e --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/PS1/GEO/Deform/GEO_DeformationVertexWeightSet.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 149dae3d7c2e98546b12dd024fdf1144 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/PS1/GEO/GEO_GeometricObject.cs b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/PS1/GEO/GEO_GeometricObject.cs new file mode 100644 index 00000000..10fa3840 --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/PS1/GEO/GEO_GeometricObject.cs @@ -0,0 +1,87 @@ +using System; + +namespace BinarySerializer.Ubisoft.CPA.PS1 +{ + public class GEO_GeometricObject : BinarySerializable + { + public uint UInt_00 { get; set; } + public ushort VerticesCount { get; set; } + public ushort PolygonListsCount { get; set; } + public short Short_08 { get; set; } + public short Short_0A { get; set; } + public short Short_0C { get; set; } + public ushort Ushort_0E { get; set; } + public Pointer VerticesPointer { get; set; } + public Pointer PolygonListsPointer { get; set; } + public short Short_18 { get; set; } + public short Short_1A { get; set; } + public short CurrentScrollValue { get; set; } + public short Short_1E { get; set; } + + // VIP, Jungle Book + public ushort BonesCount { get; set; } + public ushort BoneWeightsCount { get; set; } + public ushort BonesUnknownCount { get; set; } + public ushort Unknown4Count { get; set; } + public Pointer BonesPointer { get; set; } + public Pointer BoneWeightsPointer { get; set; } + public Pointer BonesUnknownPointer { get; set; } + public Pointer Unknown4Pointer { get; set; } + + // Serialized from pointers + public GEO_Vertex[] Vertices { get; set; } + public GEO_PolygonList[] PolygonLists { get; set; } + + public GEO_DeformationBone[] Bones { get; set; } + public GEO_DeformationVertexWeightSet[] BoneWeights { get; set; } + public GEO_DeformationUnknown[] BonesUnknown { get; set; } + + public override void SerializeImpl(SerializerObject s) + { + CPA_Settings settings = s.GetCPASettings(); + + UInt_00 = s.Serialize(UInt_00, name: nameof(UInt_00)); + VerticesCount = s.Serialize(VerticesCount, name: nameof(VerticesCount)); + PolygonListsCount = s.Serialize(PolygonListsCount, name: nameof(PolygonListsCount)); + Short_08 = s.Serialize(Short_08, name: nameof(Short_08)); + Short_0A = s.Serialize(Short_0A, name: nameof(Short_0A)); + Short_0C = s.Serialize(Short_0C, name: nameof(Short_0C)); + Ushort_0E = s.Serialize(Ushort_0E, name: nameof(Ushort_0E)); + VerticesPointer = s.SerializePointer(VerticesPointer, name: nameof(VerticesPointer)); + PolygonListsPointer = s.SerializePointer(PolygonListsPointer, name: nameof(PolygonListsPointer)); + + if (settings.EngineVersion == EngineVersion.VIP_PS1 || settings.EngineVersion == EngineVersion.JungleBook_PS1) + { + BonesCount = s.Serialize(BonesCount, name: nameof(BonesCount)); + BoneWeightsCount = s.Serialize(BoneWeightsCount, name: nameof(BoneWeightsCount)); + BonesUnknownCount = s.Serialize(BonesUnknownCount, name: nameof(BonesUnknownCount)); + Unknown4Count = s.Serialize(Unknown4Count, name: nameof(Unknown4Count)); + + BonesPointer = s.SerializePointer(BonesPointer, allowInvalid: BonesCount == 0, name: nameof(BonesPointer)); + BoneWeightsPointer = s.SerializePointer(BoneWeightsPointer, allowInvalid: BoneWeightsCount == 0, name: nameof(BoneWeightsPointer)); + BonesUnknownPointer = s.SerializePointer(BonesUnknownPointer, allowInvalid: BonesUnknownCount == 0, name: nameof(BonesUnknownPointer)); + Unknown4Pointer = s.SerializePointer(Unknown4Pointer, allowInvalid: Unknown4Count == 0, name: nameof(Unknown4Pointer)); + } + else + { + Short_18 = s.Serialize(Short_18, name: nameof(Short_18)); + Short_1A = s.Serialize(Short_1A, name: nameof(Short_1A)); + CurrentScrollValue = s.Serialize(CurrentScrollValue, name: nameof(CurrentScrollValue)); + Short_1E = s.Serialize(Short_1E, name: nameof(Short_1E)); + } + + // Serialize data from pointers + s.DoAt(VerticesPointer, () => + Vertices = s.SerializeObjectArray(Vertices, VerticesCount, name: nameof(Vertices))); + s.DoAt(PolygonListsPointer, () => + PolygonLists = s.SerializeObjectArray(PolygonLists, PolygonListsCount, name: nameof(PolygonLists))); + + s.DoAt(BonesPointer, () => + Bones = s.SerializeObjectArray(Bones, BonesCount, name: nameof(Bones))); + s.DoAt(BoneWeightsPointer, () => + BoneWeights = s.SerializeObjectArray(BoneWeights, BoneWeightsCount, name: nameof(BoneWeights))); + s.DoAt(BonesUnknownPointer, () => + BonesUnknown = s.SerializeObjectArray(BonesUnknown, BonesUnknownCount, name: nameof(BonesUnknown))); + } + } +} \ No newline at end of file diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/PS1/GEO/GEO_GeometricObject.cs.meta b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/PS1/GEO/GEO_GeometricObject.cs.meta new file mode 100644 index 00000000..d01966eb --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/PS1/GEO/GEO_GeometricObject.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: cb3811611fa446a49ad02ef831f7f0d1 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/PS1/GEO/GEO_PolygonList.cs b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/PS1/GEO/GEO_PolygonList.cs new file mode 100644 index 00000000..4ec608b2 --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/PS1/GEO/GEO_PolygonList.cs @@ -0,0 +1,88 @@ +using System; + +namespace BinarySerializer.Ubisoft.CPA.PS1 +{ + public class GEO_PolygonList : BinarySerializable + { + public PolygonListType Type { get; set; } + public ushort Ushort_02 { get; set; } + public Pointer PolygonsPointer { get; set; } + + // Serialized from pointers + public uint PolygonsCount { get; set; } + public GEO_Sprite[] Sprites { get; set; } + public GEO_QuadLOD[] QuadLODs { get; set; } + public GEO_TriangleNoTexture[] TriangleNoTextures { get; set; } + public GEO_QuadNoTexture[] QuadNoTextures { get; set; } + public GEO_Triangle[] Triangles { get; set; } + public GEO_Quad[] Quads { get; set; } + + public GEO_IPS1Polygon[] Polygons { + get { + switch (Type) { + case PolygonListType.Quad: return Quads; + case PolygonListType.QuadLOD: return QuadLODs; + case PolygonListType.QuadNoTexture: return QuadNoTextures; + case PolygonListType.Triangle: return Triangles; + case PolygonListType.TriangleNoTexture: return TriangleNoTextures; + case PolygonListType.Sprite: return Sprites; + default: throw new BinarySerializableException(this, $"Invalid polygon type {Type}"); + } + } + } + + public override void SerializeImpl(SerializerObject s) + { + Type = s.Serialize(Type, name: nameof(Type)); + Ushort_02 = s.Serialize(Ushort_02, name: nameof(Ushort_02)); + PolygonsPointer = s.SerializePointer(PolygonsPointer, name: nameof(PolygonsPointer)); + + // Serialize data from pointers + s.DoAt(PolygonsPointer, () => + { + PolygonsCount = s.Serialize(PolygonsCount, name: nameof(PolygonsCount)); + + switch (Type) + { + case PolygonListType.Sprite: + Sprites = s.SerializeObjectArray(Sprites, PolygonsCount, name: nameof(Sprites)); + break; + + case PolygonListType.QuadLOD: + QuadLODs = s.SerializeObjectArray(QuadLODs, PolygonsCount, name: nameof(QuadLODs)); + break; + + case PolygonListType.TriangleNoTexture: + TriangleNoTextures = s.SerializeObjectArray(TriangleNoTextures, PolygonsCount, name: nameof(TriangleNoTextures)); + break; + + case PolygonListType.QuadNoTexture: + QuadNoTextures = s.SerializeObjectArray(QuadNoTextures, PolygonsCount, name: nameof(QuadNoTextures)); + break; + + case PolygonListType.Triangle: + Triangles = s.SerializeObjectArray(Triangles, PolygonsCount, name: nameof(Triangles)); + break; + + case PolygonListType.Quad: + Quads = s.SerializeObjectArray(Quads, PolygonsCount, name: nameof(Quads)); + break; + + default: + throw new ArgumentOutOfRangeException(nameof(Type), Type, null); + } + }); + } + + public enum PolygonListType : ushort + { + Sprite = 0, + QuadLOD = 1, + + TriangleNoTexture = 3, + QuadNoTexture = 4, + Triangle = 5, + Quad = 6, + } + } +} \ No newline at end of file diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/PS1/GEO/GEO_PolygonList.cs.meta b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/PS1/GEO/GEO_PolygonList.cs.meta new file mode 100644 index 00000000..4310bd7c --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/PS1/GEO/GEO_PolygonList.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 7e0297062fd9e444d825133e1138cbb5 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/PS1/GEO/GEO_Vertex.cs b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/PS1/GEO/GEO_Vertex.cs new file mode 100644 index 00000000..1484195d --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/PS1/GEO/GEO_Vertex.cs @@ -0,0 +1,16 @@ +namespace BinarySerializer.Ubisoft.CPA.PS1 +{ + public class GEO_Vertex : BinarySerializable + { + public MTH3D_Vector_PS1_Short Position { get; set; } + public RGB888Color Color { get; set; } // Range is 0-2 + + public override void SerializeImpl(SerializerObject s) + { + Position = s.SerializeObject(Position, name: nameof(Position)); + s.SerializePadding(2, logIfNotNull: true); + Color = s.SerializeObject(Color, name: nameof(Color)); + s.SerializePadding(1, logIfNotNull: true); + } + } +} \ No newline at end of file diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/PS1/GEO/GEO_Vertex.cs.meta b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/PS1/GEO/GEO_Vertex.cs.meta new file mode 100644 index 00000000..34da0818 --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/PS1/GEO/GEO_Vertex.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 38e20287d8ec79c4bb027db80e833d2a +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/PS1/GEO/Polygons.meta b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/PS1/GEO/Polygons.meta new file mode 100644 index 00000000..f11f5c15 --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/PS1/GEO/Polygons.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: dee7b81c854ace142967bc254b222f44 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/PS1/GEO/Polygons/GEO_IPS1Polygon.cs b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/PS1/GEO/Polygons/GEO_IPS1Polygon.cs new file mode 100644 index 00000000..ed3eec51 --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/PS1/GEO/Polygons/GEO_IPS1Polygon.cs @@ -0,0 +1,12 @@ +using BinarySerializer.PS1; + +namespace BinarySerializer.Ubisoft.CPA.PS1 +{ + public interface GEO_IPS1Polygon + { + public Pointer Offset { get; } + public void RegisterTexture(); + public GLI_Texture Texture { get; } + public GLI_VisualMaterial Material { get; } + } +} \ No newline at end of file diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/PS1/GEO/Polygons/GEO_IPS1Polygon.cs.meta b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/PS1/GEO/Polygons/GEO_IPS1Polygon.cs.meta new file mode 100644 index 00000000..33f2742f --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/PS1/GEO/Polygons/GEO_IPS1Polygon.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 6f54351fbdb8cf449838958ef52b053c +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/PS1/GEO/Polygons/GEO_Quad.cs b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/PS1/GEO/Polygons/GEO_Quad.cs new file mode 100644 index 00000000..16dac56f --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/PS1/GEO/Polygons/GEO_Quad.cs @@ -0,0 +1,70 @@ +using BinarySerializer.PS1; +using System.Linq; + +namespace BinarySerializer.Ubisoft.CPA.PS1 +{ + public class GEO_Quad : BinarySerializable, GEO_IPS1Polygon + { + public ushort V0 { get; set; } + public ushort V1 { get; set; } + public ushort V2 { get; set; } + public ushort V3 { get; set; } + public byte MaterialFlags { get; set; } + public byte Scroll { get; set; } + public ushort Ushort_0A { get; set; } + public byte X0 { get; set; } + public byte Y0 { get; set; } + public PS1_CBA CBA { get; set; } + public byte X1 { get; set; } + public byte Y1 { get; set; } + public PS1_TSB TSB { get; set; } + public byte X2 { get; set; } + public byte Y2 { get; set; } + public byte X3 { get; set; } + public byte Y3 { get; set; } + + public override void SerializeImpl(SerializerObject s) + { + V0 = s.Serialize(V0, name: nameof(V0)); + V1 = s.Serialize(V1, name: nameof(V1)); + V2 = s.Serialize(V2, name: nameof(V2)); + V3 = s.Serialize(V3, name: nameof(V3)); + MaterialFlags = s.Serialize(MaterialFlags, name: nameof(MaterialFlags)); + Scroll = s.Serialize(Scroll, name: nameof(Scroll)); + Ushort_0A = s.Serialize(Ushort_0A, name: nameof(Ushort_0A)); + X0 = s.Serialize(X0, name: nameof(X0)); + Y0 = s.Serialize(Y0, name: nameof(Y0)); + CBA = s.SerializeObject(CBA, name: nameof(CBA)); + X1 = s.Serialize(X1, name: nameof(X1)); + Y1 = s.Serialize(Y1, name: nameof(Y1)); + TSB = s.SerializeObject(TSB, name: nameof(TSB)); + X2 = s.Serialize(X2, name: nameof(X2)); + Y2 = s.Serialize(Y2, name: nameof(Y2)); + X3 = s.Serialize(X3, name: nameof(X3)); + Y3 = s.Serialize(Y3, name: nameof(Y3)); + + RegisterTexture(); + } + #region GEO_IPS1Polygon implementation + public GLI_Texture Texture => Context?.GetLevel()?.TextureCache?.GetTexture(TSB, CBA, X0, Y0); + + public GLI_VisualMaterial Material => new GLI_VisualMaterial(Context) { + Texture = Texture, + Scroll = Scroll, + MaterialFlags = MaterialFlags, + }; + + public void RegisterTexture() { + byte[] x = new[] { X0, X1, X2, X3 }; + byte[] y = new[] { Y0, Y1, Y2, Y3 }; + int xMin = x.Min(); + int xMax = x.Max() + 1; + int yMin = y.Min(); + int yMax = y.Max() + 1; + int w = xMax - xMin; + int h = yMax - yMin; + Context?.GetLevel()?.TextureCache?.RegisterTexture(TSB, CBA, xMin, xMax, yMin, yMax); + } + #endregion + } +} \ No newline at end of file diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/PS1/GEO/Polygons/GEO_Quad.cs.meta b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/PS1/GEO/Polygons/GEO_Quad.cs.meta new file mode 100644 index 00000000..96715b92 --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/PS1/GEO/Polygons/GEO_Quad.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 9e376ef9a075a794a81bf09d48568e70 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/PS1/GEO/Polygons/GEO_QuadLOD.cs b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/PS1/GEO/Polygons/GEO_QuadLOD.cs new file mode 100644 index 00000000..d22cb33c --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/PS1/GEO/Polygons/GEO_QuadLOD.cs @@ -0,0 +1,57 @@ +namespace BinarySerializer.Ubisoft.CPA.PS1 +{ + public class GEO_QuadLOD : BinarySerializable, GEO_IPS1Polygon + { + public ushort V0 { get; set; } + public ushort V1 { get; set; } + public ushort V2 { get; set; } + public ushort V3 { get; set; } + public ushort Ushort_08 { get; set; } + public ushort Ushort_0A { get; set; } + public ushort Ushort_0C { get; set; } + public ushort Ushort_0E { get; set; } + public ushort Ushort_10 { get; set; } + public ushort Ushort_12 { get; set; } + public ushort Ushort_14 { get; set; } + public ushort Ushort_16 { get; set; } + public Pointer QuadsPointer { get; set; } + + // Serialized from pointers + public uint QuadsCount { get; set; } + public GEO_Quad[] Quads { get; set; } + + public override void SerializeImpl(SerializerObject s) + { + V0 = s.Serialize(V0, name: nameof(V0)); + V1 = s.Serialize(V1, name: nameof(V1)); + V2 = s.Serialize(V2, name: nameof(V2)); + V3 = s.Serialize(V3, name: nameof(V3)); + Ushort_08 = s.Serialize(Ushort_08, name: nameof(Ushort_08)); + Ushort_0A = s.Serialize(Ushort_0A, name: nameof(Ushort_0A)); + Ushort_0C = s.Serialize(Ushort_0C, name: nameof(Ushort_0C)); + Ushort_0E = s.Serialize(Ushort_0E, name: nameof(Ushort_0E)); + Ushort_10 = s.Serialize(Ushort_10, name: nameof(Ushort_10)); + Ushort_12 = s.Serialize(Ushort_12, name: nameof(Ushort_12)); + Ushort_14 = s.Serialize(Ushort_14, name: nameof(Ushort_14)); + Ushort_16 = s.Serialize(Ushort_16, name: nameof(Ushort_16)); + QuadsPointer = s.SerializePointer(QuadsPointer, name: nameof(QuadsPointer)); + + // Serialize data from pointers + s.DoAt(QuadsPointer, () => + { + QuadsCount = s.Serialize(QuadsCount, name: nameof(QuadsCount)); + Quads = s.SerializeObjectArray(Quads, QuadsCount, name: nameof(Quads)); + }); + } + + #region GEO_IPS1Polygon implementation + public GLI_Texture Texture => null; + + public GLI_VisualMaterial Material => null; + + public void RegisterTexture() { + throw new System.NotImplementedException(); + } + #endregion + } +} \ No newline at end of file diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/PS1/GEO/Polygons/GEO_QuadLOD.cs.meta b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/PS1/GEO/Polygons/GEO_QuadLOD.cs.meta new file mode 100644 index 00000000..4f6f6435 --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/PS1/GEO/Polygons/GEO_QuadLOD.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: b204b25c89c18604a88b0f6678b6d945 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/PS1/GEO/Polygons/GEO_QuadNoTexture.cs b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/PS1/GEO/Polygons/GEO_QuadNoTexture.cs new file mode 100644 index 00000000..40904567 --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/PS1/GEO/Polygons/GEO_QuadNoTexture.cs @@ -0,0 +1,33 @@ +namespace BinarySerializer.Ubisoft.CPA.PS1 +{ + public class GEO_QuadNoTexture : BinarySerializable, GEO_IPS1Polygon + { + public ushort V0 { get; set; } + public ushort V1 { get; set; } + public ushort V2 { get; set; } + public ushort V3 { get; set; } + public ushort Ushort_08 { get; set; } + public ushort Ushort_0A { get; set; } + + public override void SerializeImpl(SerializerObject s) + { + V0 = s.Serialize(V0, name: nameof(V0)); + V1 = s.Serialize(V1, name: nameof(V1)); + V2 = s.Serialize(V2, name: nameof(V2)); + V3 = s.Serialize(V3, name: nameof(V3)); + Ushort_08 = s.Serialize(Ushort_08, name: nameof(Ushort_08)); + Ushort_0A = s.Serialize(Ushort_0A, name: nameof(Ushort_0A)); + } + + + #region GEO_IPS1Polygon implementation + public GLI_Texture Texture => null; + + public GLI_VisualMaterial Material => null; + + public void RegisterTexture() { + throw new System.NotImplementedException(); + } + #endregion + } +} \ No newline at end of file diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/PS1/GEO/Polygons/GEO_QuadNoTexture.cs.meta b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/PS1/GEO/Polygons/GEO_QuadNoTexture.cs.meta new file mode 100644 index 00000000..f57f8935 --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/PS1/GEO/Polygons/GEO_QuadNoTexture.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: f07cd9f310614c8499c74af34288ed8f +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/PS1/GEO/Polygons/GEO_Sprite.cs b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/PS1/GEO/Polygons/GEO_Sprite.cs new file mode 100644 index 00000000..cbf4d36a --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/PS1/GEO/Polygons/GEO_Sprite.cs @@ -0,0 +1,66 @@ +using BinarySerializer.PS1; +using System.Linq; + +namespace BinarySerializer.Ubisoft.CPA.PS1 +{ + public class GEO_Sprite : BinarySerializable, GEO_IPS1Polygon + { + public byte MaterialFlags { get; set; } + public byte Scroll { get; set; } + public ushort Width { get; set; } + public ushort V0 { get; set; } + public ushort Height { get; set; } + public byte X0 { get; set; } + public byte Y0 { get; set; } + public PS1_CBA CBA { get; set; } + public byte X1 { get; set; } + public byte Y1 { get; set; } + public PS1_TSB TSB { get; set; } + public byte X2 { get; set; } + public byte Y2 { get; set; } + public byte X3 { get; set; } + public byte Y3 { get; set; } + + public override void SerializeImpl(SerializerObject s) + { + MaterialFlags = s.Serialize(MaterialFlags, name: nameof(MaterialFlags)); + Scroll = s.Serialize(Scroll, name: nameof(Scroll)); + Width = s.Serialize(Width, name: nameof(Width)); + V0 = s.Serialize(V0, name: nameof(V0)); + Height = s.Serialize(Height, name: nameof(Height)); + X0 = s.Serialize(X0, name: nameof(X0)); + Y0 = s.Serialize(Y0, name: nameof(Y0)); + CBA = s.SerializeObject(CBA, name: nameof(CBA)); + X1 = s.Serialize(X1, name: nameof(X1)); + Y1 = s.Serialize(Y1, name: nameof(Y1)); + TSB = s.SerializeObject(TSB, name: nameof(TSB)); + X2 = s.Serialize(X2, name: nameof(X2)); + Y2 = s.Serialize(Y2, name: nameof(Y2)); + X3 = s.Serialize(X3, name: nameof(X3)); + Y3 = s.Serialize(Y3, name: nameof(Y3)); + + RegisterTexture(); + } + #region GEO_IPS1Polygon implementation + public GLI_Texture Texture => Context?.GetLevel()?.TextureCache?.GetTexture(TSB, CBA, X0, Y0); + + public GLI_VisualMaterial Material => new GLI_VisualMaterial(Context) { + Texture = Texture, + Scroll = Scroll, + MaterialFlags = MaterialFlags, + }; + + public void RegisterTexture() { + byte[] x = new[] { X0, X1, X2, X3 }; + byte[] y = new[] { Y0, Y1, Y2, Y3 }; + int xMin = x.Min(); + int xMax = x.Max() + 1; + int yMin = y.Min(); + int yMax = y.Max() + 1; + int w = xMax - xMin; + int h = yMax - yMin; + Context?.GetLevel()?.TextureCache?.RegisterTexture(TSB, CBA, xMin, xMax, yMin, yMax); + } + #endregion + } +} \ No newline at end of file diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/PS1/GEO/Polygons/GEO_Sprite.cs.meta b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/PS1/GEO/Polygons/GEO_Sprite.cs.meta new file mode 100644 index 00000000..bceeec83 --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/PS1/GEO/Polygons/GEO_Sprite.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 2643ae69e64b96d4e959519a7f380121 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/PS1/GEO/Polygons/GEO_Triangle.cs b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/PS1/GEO/Polygons/GEO_Triangle.cs new file mode 100644 index 00000000..f2950f3a --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/PS1/GEO/Polygons/GEO_Triangle.cs @@ -0,0 +1,64 @@ +using BinarySerializer.PS1; +using System.Linq; + +namespace BinarySerializer.Ubisoft.CPA.PS1 +{ + public class GEO_Triangle : BinarySerializable, GEO_IPS1Polygon + { + public ushort V0 { get; set; } + public ushort V1 { get; set; } + public ushort V2 { get; set; } + public byte MaterialFlags { get; set; } + public byte Scroll { get; set; } + public byte X0 { get; set; } + public byte Y0 { get; set; } + public PS1_CBA CBA { get; set; } + public byte X1 { get; set; } + public byte Y1 { get; set; } + public PS1_TSB TSB { get; set; } + public byte X2 { get; set; } + public byte Y2 { get; set; } + public ushort Ushort_12 { get; set; } + + public override void SerializeImpl(SerializerObject s) + { + V0 = s.Serialize(V0, name: nameof(V0)); + V1 = s.Serialize(V1, name: nameof(V1)); + V2 = s.Serialize(V2, name: nameof(V2)); + MaterialFlags = s.Serialize(MaterialFlags, name: nameof(MaterialFlags)); + Scroll = s.Serialize(Scroll, name: nameof(Scroll)); + X0 = s.Serialize(X0, name: nameof(X0)); + Y0 = s.Serialize(Y0, name: nameof(Y0)); + CBA = s.SerializeObject(CBA, name: nameof(CBA)); + X1 = s.Serialize(X1, name: nameof(X1)); + Y1 = s.Serialize(Y1, name: nameof(Y1)); + TSB = s.SerializeObject(TSB, name: nameof(TSB)); + X2 = s.Serialize(X2, name: nameof(X2)); + Y2 = s.Serialize(Y2, name: nameof(Y2)); + Ushort_12 = s.Serialize(Ushort_12, name: nameof(Ushort_12)); + + RegisterTexture(); + } + #region GEO_IPS1Polygon implementation + public GLI_Texture Texture => Context?.GetLevel()?.TextureCache?.GetTexture(TSB, CBA, X0, Y0); + + public GLI_VisualMaterial Material => new GLI_VisualMaterial(Context) { + Texture = Texture, + Scroll = Scroll, + MaterialFlags = MaterialFlags, + }; + + public void RegisterTexture() { + byte[] x = new[] { X0, X1, X2 }; + byte[] y = new[] { Y0, Y1, Y2 }; + int xMin = x.Min(); + int xMax = x.Max() + 1; + int yMin = y.Min(); + int yMax = y.Max() + 1; + int w = xMax - xMin; + int h = yMax - yMin; + Context?.GetLevel()?.TextureCache?.RegisterTexture(TSB, CBA, xMin, xMax, yMin, yMax); + } + #endregion + } +} \ No newline at end of file diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/PS1/GEO/Polygons/GEO_Triangle.cs.meta b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/PS1/GEO/Polygons/GEO_Triangle.cs.meta new file mode 100644 index 00000000..7193f3ac --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/PS1/GEO/Polygons/GEO_Triangle.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 9cc8e25de799c0240bfb0dcaad8c45b8 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/PS1/GEO/Polygons/GEO_TriangleNoTexture.cs b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/PS1/GEO/Polygons/GEO_TriangleNoTexture.cs new file mode 100644 index 00000000..c2bc89c9 --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/PS1/GEO/Polygons/GEO_TriangleNoTexture.cs @@ -0,0 +1,28 @@ +namespace BinarySerializer.Ubisoft.CPA.PS1 +{ + public class GEO_TriangleNoTexture : BinarySerializable, GEO_IPS1Polygon + { + public ushort V0 { get; set; } + public ushort V1 { get; set; } + public ushort V2 { get; set; } + public ushort Ushort_06 { get; set; } + + public override void SerializeImpl(SerializerObject s) + { + V0 = s.Serialize(V0, name: nameof(V0)); + V1 = s.Serialize(V1, name: nameof(V1)); + V2 = s.Serialize(V2, name: nameof(V2)); + Ushort_06 = s.Serialize(Ushort_06, name: nameof(Ushort_06)); + } + + #region GEO_IPS1Polygon implementation + public GLI_Texture Texture => null; + + public GLI_VisualMaterial Material => null; + + public void RegisterTexture() { + throw new System.NotImplementedException(); + } + #endregion + } +} \ No newline at end of file diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/PS1/GEO/Polygons/GEO_TriangleNoTexture.cs.meta b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/PS1/GEO/Polygons/GEO_TriangleNoTexture.cs.meta new file mode 100644 index 00000000..6bb2a283 --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/PS1/GEO/Polygons/GEO_TriangleNoTexture.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: c375769d0057c0d4b8ce2123c05b5f46 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/PS1/GLI.meta b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/PS1/GLI.meta new file mode 100644 index 00000000..95e93a85 --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/PS1/GLI.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 04146464dbda0cd4c9be17b72ab0556d +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/PS1/GLI/GLI_Texture.cs b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/PS1/GLI/GLI_Texture.cs new file mode 100644 index 00000000..9aff9da4 --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/PS1/GLI/GLI_Texture.cs @@ -0,0 +1,47 @@ +using System; +using BinarySerializer.PS1; + +namespace BinarySerializer.Ubisoft.CPA.PS1 { + public class GLI_Texture { + public Context Context { get; private set; } + + public PS1_TSB TSB; // Page Info + public PS1_CBA CBA; // Palette info + public int xMin; + public int xMax; + public int yMin; + public int yMax; + public int Width => xMax - xMin; + public int Height => yMax - yMin; + + public PS1_TSB.TexturePageTP BitDepth => TSB.TP; + + public GLI_Texture(Context c) { + Context = c; + } + + public bool HasOverlap(GLI_Texture b) { + // Check CBA & TSB equality + if (b.CBA != CBA || b.TSB != TSB) + return false; + + // Check overlap + bool xOverlap = (xMin >= b.xMin || xMin <= b.xMax) && (xMax >= b.xMin || xMax <= b.xMax); + bool yOverlap = (yMin >= b.yMin || yMin <= b.yMax) && (yMax >= b.yMin || yMax <= b.yMax); + return xOverlap && yOverlap; + } + + public void ExpandWithBounds(GLI_Texture b) { + xMin = Math.Min(xMin, b.xMin); + xMax = Math.Max(xMax, b.xMax); + yMin = Math.Min(yMin, b.yMin); + yMax = Math.Max(yMax, b.yMax); + } + + public MTH2D_Vector CalculateUV(int x, int y) { + float relativeX = (x - xMin) / (float)(Width - 1); + float relativeY = (y - yMin) / (float)(Height - 1); + return new MTH2D_Vector(relativeX, 1f - relativeY); + } + } +} diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/PS1/GLI/GLI_Texture.cs.meta b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/PS1/GLI/GLI_Texture.cs.meta new file mode 100644 index 00000000..1455366d --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/PS1/GLI/GLI_Texture.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: e1a8b6231c1494243b3bb12727a1c43e +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/PS1/GLI/GLI_TextureCache.cs b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/PS1/GLI/GLI_TextureCache.cs new file mode 100644 index 00000000..8260a942 --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/PS1/GLI/GLI_TextureCache.cs @@ -0,0 +1,72 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using BinarySerializer.PS1; + +namespace BinarySerializer.Ubisoft.CPA.PS1 { + public class GLI_TextureCache { + public Context Context { get; private set; } + + public GLI_TextureCache(Context c) { + Context = c; + } + + private List textures = new List(); + + public void Clear() { + textures.Clear(); + } + + public void RegisterTexture(PS1_TSB tsb, PS1_CBA cba, int xMin, int xMax, int yMin, int yMax) { + GLI_Texture b = new GLI_Texture(Context) { + TSB = tsb, + CBA = cba, + xMin = xMin, + xMax = xMax, + yMin = yMin, + yMax = yMax + }; + + bool newTexture = true; + foreach (GLI_Texture u in textures) { + if (u.HasOverlap(b)) { + u.ExpandWithBounds(b); + newTexture = false; + break; + } + } + + if (newTexture) { + textures.Add(b); + } + } + + /*public void CalculateTextures() { + int i = 0; + foreach (GLI_Texture b in textureBounds) { + int w = b.xMax - b.xMin; + int h = b.yMax - b.yMin; + //print(w + " - " + h + " - " + b.xMin + " - " + b.yMin + " - " + b.pageInfo + " - " + b.paletteInfo); + Texture2D tex = vram.GetTexture((ushort)w, (ushort)h, b.pageInfo, b.paletteInfo, b.xMin, b.yMin); + if (tex == null) { + Debug.LogWarning($"Corrupted texture found! Details: {w}x{h} - ({b.xMin},{b.yMin}) - Page:{b.pageInfo} - Pal:{b.paletteInfo}"); + tex = new Texture2D(w, h); + tex.SetPixels(Enumerable.Repeat(Color.clear, w * h).ToArray()); + tex.Apply(); + } + tex.wrapMode = TextureWrapMode.Clamp; + b.texture = tex; + if (exportTextures) { + Util.ByteArrayToFile(gameDataBinFolder + "textures/main/" + lvlName + "/" + i++ + $"_{string.Format("{0:X4}", b.pageInfo)}_{b.xMin}_{b.yMin}_{w}_{h}" + ".png", tex.EncodeToPNG()); + } + } + }*/ + + public GLI_Texture GetTexture(PS1_TSB tsb, PS1_CBA cba, int x, int y) { + return textures.FirstOrDefault( + t => t.CBA == cba && t.TSB == tsb && + x >= t.xMin && x < t.xMax && + y >= t.yMin && y < t.yMax); + } + } +} diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/PS1/GLI/GLI_TextureCache.cs.meta b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/PS1/GLI/GLI_TextureCache.cs.meta new file mode 100644 index 00000000..90502078 --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/PS1/GLI/GLI_TextureCache.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 222084a32aa8ea0409f5d55b5ee6e9cf +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/PS1/GLI/GLI_VisualMaterial.cs b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/PS1/GLI/GLI_VisualMaterial.cs new file mode 100644 index 00000000..6f3052f9 --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/PS1/GLI/GLI_VisualMaterial.cs @@ -0,0 +1,98 @@ +using System; +using BinarySerializer.PS1; + +namespace BinarySerializer.Ubisoft.CPA.PS1 { + public class GLI_VisualMaterial : IEquatable { + public Context Context { get; set; } + + public GLI_Texture Texture { get; set; } + public byte MaterialFlags { get; set; } + public byte Scroll { get; set; } + + public GLI_VisualMaterial(Context c) { + Context = c; + } + + public SemiTransparentMode BlendMode { + get { + if (Texture == null) return SemiTransparentMode.One; + int abr = Texture.TSB.ABR; + return (SemiTransparentMode)abr; + } + + } + public float ScrollX { + get { + int scr = (Scroll >> 5); + if (scr == 0) return 0f; + bool special = (MaterialFlags & 0x40) != 0; // sets 0x80 + int width = 0; + float speed = 1f; + ScrollMode mode = (ScrollMode)scr; + switch (mode) { + case ScrollMode.None: + return 0f; + case ScrollMode.Width64: + width = 64; + speed /= 2f; + if (special) speed *= 4; + break; + case ScrollMode.Width128_2: + case ScrollMode.Width128_3: + case ScrollMode.Width128_5: + width = 128; + if (!special) { + speed /= 2; + } else { + speed *= 4; + } + break; + + } + if (width == 0) return 0f; + float scrf = (speed / width); + return scrf; + //return (scr & 0b1000) != 0 ? -scrf : scrf; + } + } + public float ScrollY => 0f; + public bool ScrollingEnabled => (Scroll >> 5) != 0; + public bool IsLight => (MaterialFlags & 0x80) == 0x80; + + public override bool Equals(System.Object obj) { + return obj is GLI_VisualMaterial && this == (GLI_VisualMaterial)obj; + } + public override int GetHashCode() { + return Texture.GetHashCode() ^ MaterialFlags.GetHashCode() ^ Scroll.GetHashCode(); + } + + public bool Equals(GLI_VisualMaterial other) { + return this == (GLI_VisualMaterial)other; + } + + public static bool operator ==(GLI_VisualMaterial x, GLI_VisualMaterial y) { + if (ReferenceEquals(x, y)) return true; + if (ReferenceEquals(x, null)) return false; + if (ReferenceEquals(y, null)) return false; + return x.Texture.Equals(y.Texture) && x.Scroll == y.Scroll && x.MaterialFlags == y.MaterialFlags; + } + public static bool operator !=(GLI_VisualMaterial x, GLI_VisualMaterial y) { + return !(x == y); + } + + public enum ScrollMode { + None = 0, + Width64, + Width128_2, + Width128_3, + Backwards, + Width128_5, + } + public enum SemiTransparentMode { + Point5 = 0, + One, + MinusOne, + Point25 + } + } +} diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/PS1/GLI/GLI_VisualMaterial.cs.meta b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/PS1/GLI/GLI_VisualMaterial.cs.meta new file mode 100644 index 00000000..43690cfc --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/PS1/GLI/GLI_VisualMaterial.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 0e60e256c959a994e9fcf922cb19141e +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/PS1/GMT.meta b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/PS1/GMT.meta new file mode 100644 index 00000000..09080ebb --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/PS1/GMT.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: a1a1becb82ed9cd4bb3700c204aa9682 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/PS1/GMT/GMT_CollideMaterial.cs b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/PS1/GMT/GMT_CollideMaterial.cs new file mode 100644 index 00000000..fed78e80 --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/PS1/GMT/GMT_CollideMaterial.cs @@ -0,0 +1,14 @@ +namespace BinarySerializer.Ubisoft.CPA.PS1 +{ + public class GMT_CollideMaterial : BinarySerializable + { + public GMT_ZoneType ZoneType { get; set; } + public ushort Identifier { get; set; } // TODO: Flags + + public override void SerializeImpl(SerializerObject s) + { + ZoneType = s.Serialize(ZoneType, name: nameof(ZoneType)); + Identifier = s.Serialize(Identifier, name: nameof(Identifier)); + } + } +} \ No newline at end of file diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/PS1/GMT/GMT_CollideMaterial.cs.meta b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/PS1/GMT/GMT_CollideMaterial.cs.meta new file mode 100644 index 00000000..f472d2b3 --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/PS1/GMT/GMT_CollideMaterial.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 686a7d1557891d8469fccd1bfd244498 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/PS1/GMT/GMT_GameMaterial.cs b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/PS1/GMT/GMT_GameMaterial.cs new file mode 100644 index 00000000..b458518d --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/PS1/GMT/GMT_GameMaterial.cs @@ -0,0 +1,20 @@ +namespace BinarySerializer.Ubisoft.CPA.PS1 +{ + public class GMT_GameMaterial : BinarySerializable + { + public ushort Ushort_00 { get; set; } + public ushort Ushort_02 { get; set; } + public Pointer CollideMaterial { get; set; } + public int Int_08 { get; set; } + public uint Uint_0C { get; set; } + + public override void SerializeImpl(SerializerObject s) + { + Ushort_00 = s.Serialize(Ushort_00, name: nameof(Ushort_00)); + Ushort_02 = s.Serialize(Ushort_02, name: nameof(Ushort_02)); + CollideMaterial = s.SerializePointer(CollideMaterial, name: nameof(CollideMaterial))?.Resolve(s); + Int_08 = s.Serialize(Int_08, name: nameof(Int_08)); + Uint_0C = s.Serialize(Uint_0C, name: nameof(Uint_0C)); + } + } +} \ No newline at end of file diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/PS1/GMT/GMT_GameMaterial.cs.meta b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/PS1/GMT/GMT_GameMaterial.cs.meta new file mode 100644 index 00000000..a044de80 --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/PS1/GMT/GMT_GameMaterial.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: f494fe49fe449714d905ac74c8a04adf +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/PS1/HIE.meta b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/PS1/HIE.meta new file mode 100644 index 00000000..1b09ef72 --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/PS1/HIE.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: afa61ce3d5404824499fee6784249e91 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/PS1/HIE/HIE_SuperObject.cs b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/PS1/HIE/HIE_SuperObject.cs new file mode 100644 index 00000000..8cfd00fd --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/PS1/HIE/HIE_SuperObject.cs @@ -0,0 +1,104 @@ +using System; + +namespace BinarySerializer.Ubisoft.CPA.PS1 +{ + public class HIE_SuperObject : BinarySerializable, LST2_IEntry + { + public bool Pre_IsDynamic { get; set; } + + public HIE_ObjectType_98 Type { get; set; } + public int DataIndex { get; set; } + public LST2_DynamicList Children { get; set; } + public Pointer NextBrother { get; set; } + public Pointer PreviousBrother { get; set; } + public Pointer Parent { get; set; } + public Pointer LocalMatrix { get; set; } + public Pointer GlobalMatrix { get; set; } + public short Short_28 { get; set; } + public short Short_2A { get; set; } + public short Short_2C { get; set; } + public short Short_2E { get; set; } + public short Short_30 { get; set; } + public short Short_32 { get; set; } + public short Short_34 { get; set; } + public short Short_36 { get; set; } + public uint Uint_38 { get; set; } + public Pointer Pointer_38 { get; set; } + public short Short_3C { get; set; } + public short Short_3E { get; set; } + public short Short_40 { get; set; } + public short Short_42 { get; set; } + public short Short_44 { get; set; } + public short Short_46 { get; set; } + public short Short_48 { get; set; } + public short Short_4A { get; set; } + + public Pointer LST2_Next => NextBrother; + public Pointer LST2_Previous => PreviousBrother; + + public override void SerializeImpl(SerializerObject s) + { + CPA_Settings settings = s.GetCPASettings(); + + Type = s.Serialize(Type, name: nameof(Type)); + DataIndex = s.Serialize(DataIndex, name: nameof(DataIndex)); + Children = s.SerializeObject>(Children, name: nameof(Children)); + NextBrother = s.SerializePointer(NextBrother, name: nameof(NextBrother)); + PreviousBrother = s.SerializePointer(PreviousBrother, name: nameof(PreviousBrother)); + Parent = s.SerializePointer(Parent, name: nameof(Parent)); + LocalMatrix = s.SerializePointer(LocalMatrix, name: nameof(LocalMatrix))?.Resolve(s); + + if (settings.EngineVersion != EngineVersion.RaymanRush_PS1) + { + GlobalMatrix = s.SerializePointer(GlobalMatrix, name: nameof(GlobalMatrix))?.Resolve(s); + Short_28 = s.Serialize(Short_28, name: nameof(Short_28)); + Short_2A = s.Serialize(Short_2A, name: nameof(Short_2A)); + Short_2C = s.Serialize(Short_2C, name: nameof(Short_2C)); + Short_2E = s.Serialize(Short_2E, name: nameof(Short_2E)); + Short_30 = s.Serialize(Short_30, name: nameof(Short_30)); + Short_32 = s.Serialize(Short_32, name: nameof(Short_32)); + Short_34 = s.Serialize(Short_34, name: nameof(Short_34)); + Short_36 = s.Serialize(Short_36, name: nameof(Short_36)); + + //if (Pre_IsDynamic) + Uint_38 = s.Serialize(Uint_38, name: nameof(Uint_38)); + /*else + Pointer_38 = s.SerializePointer(Pointer_38, name: nameof(Pointer_38));*/ + + Short_3C = s.Serialize(Short_3C, name: nameof(Short_3C)); + Short_3E = s.Serialize(Short_3E, name: nameof(Short_3E)); + Short_40 = s.Serialize(Short_40, name: nameof(Short_40)); + Short_42 = s.Serialize(Short_42, name: nameof(Short_42)); + Short_44 = s.Serialize(Short_44, name: nameof(Short_44)); + Short_46 = s.Serialize(Short_46, name: nameof(Short_46)); + Short_48 = s.Serialize(Short_48, name: nameof(Short_48)); + Short_4A = s.Serialize(Short_4A, name: nameof(Short_4A)); + } + + // Resolve hierarchy + Children?.Resolve(s, name: nameof(Children)); + if (Parent?.PointerValue == null) { + NextBrother?.Resolve(s); + PreviousBrother?.Resolve(s); + } + Parent?.Resolve(s); + } + + public BinarySerializable LinkedObject { + get { + GAM_GlobalPointerTable gpt = Context.GetLevel().GlobalPointerTable; + if (Type == HIE_ObjectType_98.InstanciatedPhysicalObject) { + if ((DataIndex >> 1) >= gpt.StaticGeometricObjects.Entries.Length) throw new Exception("IPO SO data index was too high! " + gpt.StaticGeometricObjects.Entries.Length + " - " + DataIndex); + return gpt.StaticGeometricObjects.Entries[DataIndex >> 1].GeometricObject; + } else if (Type == HIE_ObjectType_98.Character) { + if (DataIndex >= gpt.Persos.Length) throw new Exception("Perso SO data index was too high! " + gpt.Persos.Length + " - " + DataIndex); + return gpt.Persos[DataIndex]; + } else if (Type == HIE_ObjectType_98.Sector) { + if (DataIndex >= gpt.Sectors.Length) throw new Exception("Sector SO data index was too high! " + gpt.Sectors.Length + " - " + DataIndex); + return gpt.Sectors[DataIndex]; + } + return null; + } + } + } +} \ No newline at end of file diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/PS1/HIE/HIE_SuperObject.cs.meta b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/PS1/HIE/HIE_SuperObject.cs.meta new file mode 100644 index 00000000..1e6fc291 --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/PS1/HIE/HIE_SuperObject.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: f46f36c00cc4c6545a7aaff15fe5ef25 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/PS1/MTH.meta b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/PS1/MTH.meta new file mode 100644 index 00000000..7ee5a043 --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/PS1/MTH.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: c77ad38edc4284448a902096dba5ac89 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/PS1/MTH/MTH3D.meta b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/PS1/MTH/MTH3D.meta new file mode 100644 index 00000000..372cd0b6 --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/PS1/MTH/MTH3D.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 2fd3fb5797ecd414a8ca823cd8945efd +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/PS1/MTH/MTH3D/MTH3D_Matrix_PS1.cs b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/PS1/MTH/MTH3D/MTH3D_Matrix_PS1.cs new file mode 100644 index 00000000..edadf076 --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/PS1/MTH/MTH3D/MTH3D_Matrix_PS1.cs @@ -0,0 +1,98 @@ +using System; + +namespace BinarySerializer.Ubisoft.CPA { + public class MTH3D_Matrix_PS1 : BinarySerializable { + // TODO: Serialize as array [3][3] + // But watch out: row-major order! not column-major like regular CPA. So Row0, Row1, Row2. + public FixedPointInt16 M00 { get; set; } + public FixedPointInt16 M01 { get; set; } + public FixedPointInt16 M02 { get; set; } + public FixedPointInt16 M10 { get; set; } + public FixedPointInt16 M11 { get; set; } + public FixedPointInt16 M12 { get; set; } + public FixedPointInt16 M20 { get; set; } + public FixedPointInt16 M21 { get; set; } + public FixedPointInt16 M22 { get; set; } + + public override void SerializeImpl(SerializerObject s) { + M00 = s.SerializeObject(M00, x => x.Pre_PointPosition = 12, name: nameof(M00)); + M01 = s.SerializeObject(M01, x => x.Pre_PointPosition = 12, name: nameof(M01)); + M02 = s.SerializeObject(M02, x => x.Pre_PointPosition = 12, name: nameof(M02)); + M10 = s.SerializeObject(M10, x => x.Pre_PointPosition = 12, name: nameof(M10)); + M11 = s.SerializeObject(M11, x => x.Pre_PointPosition = 12, name: nameof(M11)); + M12 = s.SerializeObject(M12, x => x.Pre_PointPosition = 12, name: nameof(M12)); + M20 = s.SerializeObject(M20, x => x.Pre_PointPosition = 12, name: nameof(M20)); + M21 = s.SerializeObject(M21, x => x.Pre_PointPosition = 12, name: nameof(M21)); + M22 = s.SerializeObject(M22, x => x.Pre_PointPosition = 12, name: nameof(M22)); + } + + public MTH3D_Matrix_PS1 InvertedMatrix => new MTH3D_Matrix_PS1() { + M00 = M00, + M01 = M10, + M02 = M20, + M10 = M01, + M11 = M11, + M12 = M21, + M20 = M02, + M21 = M12, + M22 = M22, + }; + + public MTH4D_Vector GetRotation(MTH3D_Vector scaleVector = null) { + float m00, m01, m02; // Row 0 + float m10, m11, m12; // Row 1 + float m20, m21, m22; // Row 2 + + m00 = M00; + m01 = M01; + m02 = M02; + m10 = M10; + m11 = M11; + m12 = M12; + m20 = M20; + m21 = M21; + m22 = M22; + + if (scaleVector != null && scaleVector.X != 0 && scaleVector.Y != 0 && scaleVector.Z != 0) { + m00 /= scaleVector.X; + m01 /= scaleVector.Y; + m02 /= scaleVector.Z; + m10 /= scaleVector.X; + m11 /= scaleVector.Y; + m12 /= scaleVector.Z; + m20 /= scaleVector.X; + m21 /= scaleVector.Y; + m22 /= scaleVector.Z; + } + + //float tr = m00 + m11 + m22; + MTH4D_Vector quaternion; // = new MTH4D_Vector(); + float t; + + if (m22 < 0) { + if (m00 > m11) { + t = 1 + m00 - m11 - m22; + quaternion = new MTH4D_Vector(t, m01 + m10, m20 + m02, m12 - m21); + } else { + t = 1 - m00 + m11 - m22; + quaternion = new MTH4D_Vector(m01 + m10, t, m12 + m21, m20 - m02); + } + } else { + if (m00 < -m11) { + t = 1 - m00 - m11 + m22; + quaternion = new MTH4D_Vector(m20 + m02, m12 + m21, t, m01 - m10); + } else { + t = 1 + m00 + m11 + m22; + quaternion = new MTH4D_Vector(m12 - m21, m20 - m02, m01 - m10, t); + } + } + float factor = (0.5f / (float)Math.Sqrt(t)); + quaternion.X = quaternion.X * factor; + quaternion.Y = quaternion.Y * factor; + quaternion.Z = quaternion.Z * factor; + quaternion.W = quaternion.W * -factor; + + return quaternion; + } + } +} diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/PS1/MTH/MTH3D/MTH3D_Matrix_PS1.cs.meta b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/PS1/MTH/MTH3D/MTH3D_Matrix_PS1.cs.meta new file mode 100644 index 00000000..87927ba7 --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/PS1/MTH/MTH3D/MTH3D_Matrix_PS1.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: c4609ba7d5b03424ab115f76f0229703 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/PS1/MTH/MTH3D/MTH3D_Vector_PS1_Int.cs b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/PS1/MTH/MTH3D/MTH3D_Vector_PS1_Int.cs new file mode 100644 index 00000000..d6f34d13 --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/PS1/MTH/MTH3D/MTH3D_Vector_PS1_Int.cs @@ -0,0 +1,45 @@ +using System; + +namespace BinarySerializer.Ubisoft.CPA.PS1 { + public class MTH3D_Vector_PS1_Int : BinarySerializable { + public int X_Int { get; set; } + public int Y_Int { get; set; } + public int Z_Int { get; set; } + + public float CoordinateScale => Context.GetLevel().CoordinateFactor; + public float X { + get => X_Int / CoordinateScale; + set => X_Int = (int)(value * CoordinateScale); + } + public float Y { + get => Y_Int / CoordinateScale; + set => Y_Int = (int)(value * CoordinateScale); + } + public float Z { + get => Z_Int / CoordinateScale; + set => Z_Int = (int)(value * CoordinateScale); + } + + public override void SerializeImpl(SerializerObject s) { + X_Int = s.Serialize(X_Int, name: nameof(X_Int)); + Y_Int = s.Serialize(Y_Int, name: nameof(Y_Int)); + Z_Int = s.Serialize(Z_Int, name: nameof(Z_Int)); + } + + public override bool UseShortLog => true; + public override string ToString() => $"Vector({X}, {Y}, {Z})"; + + public MTH3D_Vector_PS1_Int() { } + public MTH3D_Vector_PS1_Int(float x, float y, float z) { + X = x; + Y = y; + Z = z; + } + + public double Magnitude => Math.Sqrt(Math.Pow(X, 2) + Math.Pow(Y, 2) + Math.Pow(Z, 2)); + public static MTH3D_Vector Zero => new MTH3D_Vector(); + public static MTH3D_Vector One => new MTH3D_Vector(1, 1, 1); + + public bool IsUniform => X == Y && X == Z; + } +} diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/PS1/MTH/MTH3D/MTH3D_Vector_PS1_Int.cs.meta b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/PS1/MTH/MTH3D/MTH3D_Vector_PS1_Int.cs.meta new file mode 100644 index 00000000..f758af80 --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/PS1/MTH/MTH3D/MTH3D_Vector_PS1_Int.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 31f87fc171434a4449b1e09d2cf98e7c +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/PS1/MTH/MTH3D/MTH3D_Vector_PS1_Short.cs b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/PS1/MTH/MTH3D/MTH3D_Vector_PS1_Short.cs new file mode 100644 index 00000000..b658358c --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/PS1/MTH/MTH3D/MTH3D_Vector_PS1_Short.cs @@ -0,0 +1,47 @@ +using System; + +namespace BinarySerializer.Ubisoft.CPA.PS1 { + public class MTH3D_Vector_PS1_Short : BinarySerializable { + public float? Pre_CoordinateScale { get; set; } + + public short X_Short { get; set; } + public short Y_Short { get; set; } + public short Z_Short { get; set; } + + public float CoordinateScale => Pre_CoordinateScale ?? Context.GetLevel().CoordinateFactor; + public float X { + get => X_Short / CoordinateScale; + set => X_Short = (short)(value * CoordinateScale); + } + public float Y { + get => Y_Short / CoordinateScale; + set => Y_Short = (short)(value * CoordinateScale); + } + public float Z { + get => Z_Short / CoordinateScale; + set => Z_Short = (short)(value * CoordinateScale); + } + + public override void SerializeImpl(SerializerObject s) { + X_Short = s.Serialize(X_Short, name: nameof(X_Short)); + Y_Short = s.Serialize(Y_Short, name: nameof(Y_Short)); + Z_Short = s.Serialize(Z_Short, name: nameof(Z_Short)); + } + + public override bool UseShortLog => true; + public override string ToString() => $"Vector({X}, {Y}, {Z})"; + + public MTH3D_Vector_PS1_Short() { } + public MTH3D_Vector_PS1_Short(float x, float y, float z) { + X = x; + Y = y; + Z = z; + } + + public double Magnitude => Math.Sqrt(Math.Pow(X, 2) + Math.Pow(Y, 2) + Math.Pow(Z, 2)); + public static MTH3D_Vector Zero => new MTH3D_Vector(); + public static MTH3D_Vector One => new MTH3D_Vector(1, 1, 1); + + public bool IsUniform => X == Y && X == Z; + } +} diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/PS1/MTH/MTH3D/MTH3D_Vector_PS1_Short.cs.meta b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/PS1/MTH/MTH3D/MTH3D_Vector_PS1_Short.cs.meta new file mode 100644 index 00000000..0fe8b25b --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/PS1/MTH/MTH3D/MTH3D_Vector_PS1_Short.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: a9b58fe21a1b3f947a76c7b3c83d9a79 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/PS1/PERSO.meta b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/PS1/PERSO.meta new file mode 100644 index 00000000..46175d2b --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/PS1/PERSO.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 4c4054705852cb14bbf7ae27fd2222d7 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/PS1/PERSO/PERSO_Family.cs b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/PS1/PERSO/PERSO_Family.cs new file mode 100644 index 00000000..b0b5a866 --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/PS1/PERSO/PERSO_Family.cs @@ -0,0 +1,39 @@ +namespace BinarySerializer.Ubisoft.CPA.PS1 +{ + public class PERSO_Family : BinarySerializable + { + public string Name { get; set; } + + public uint Uint_00 { get; set; } + public uint Uint_04 { get; set; } + public Pointer AnimationsPointer { get; set; } + public uint AnimationsCount { get; set; } + public uint Uint_10 { get; set; } + public uint Uint_14 { get; set; } + public int Int_18 { get; set; } + public int Int_1C { get; set; } + + // Serialized from pointers + public ANIM_Animation[] Animations { get; set; } + + public override void SerializeImpl(SerializerObject s) + { + // TODO: Find better solution to this since this will cause issues when writing. Perhaps start the class at the + // name and do Pointer - 0x24 whenever serializing this object? + s.DoAt(s.CurrentPointer - 0x24, () => Name = s.SerializeString(Name, 0x24, name: nameof(Name))); + + Uint_00 = s.Serialize(Uint_00, name: nameof(Uint_00)); + Uint_04 = s.Serialize(Uint_04, name: nameof(Uint_04)); + AnimationsPointer = s.SerializePointer(AnimationsPointer, name: nameof(AnimationsPointer)); + AnimationsCount = s.Serialize(AnimationsCount, name: nameof(AnimationsCount)); + Uint_10 = s.Serialize(Uint_10, name: nameof(Uint_10)); + Uint_14 = s.Serialize(Uint_14, name: nameof(Uint_14)); + Int_18 = s.Serialize(Int_18, name: nameof(Int_18)); + Int_1C = s.Serialize(Int_1C, name: nameof(Int_1C)); + + // Serialize data from pointers + s.DoAt(AnimationsPointer, () => + Animations = s.SerializeObjectArray(Animations, AnimationsCount, name: nameof(Animations))); + } + } +} \ No newline at end of file diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/PS1/PERSO/PERSO_Family.cs.meta b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/PS1/PERSO/PERSO_Family.cs.meta new file mode 100644 index 00000000..03ff9100 --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/PS1/PERSO/PERSO_Family.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: d488badc526bf5d42a76ead26b511c46 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/PS1/PERSO/PERSO_Perso.cs b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/PS1/PERSO/PERSO_Perso.cs new file mode 100644 index 00000000..d3e9a27f --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/PS1/PERSO/PERSO_Perso.cs @@ -0,0 +1,54 @@ +namespace BinarySerializer.Ubisoft.CPA.PS1 +{ + public class PERSO_Perso : BinarySerializable + { + public Pointer P3DDataPointer { get; set; } + public Pointer SuperObjectReferencePointer { get; set; } + public Pointer Pointer_08 { get; set; } // Dynamics + public Pointer Pointer_0C { get; set; } // Struct with size 0x18 + public Pointer CollSetPointer { get; set; } + public Pointer SectorSuperObjectPointer { get; set; } + + // Serialized from pointers + public PERSO_Perso3DData Perso3DData { get; set; } + public Pointer SuperObjectPointer { get; set; } + public Pointer NamePointer { get; set; } + public string Name { get; set; } + public HIE_SuperObject SuperObject { get; set; } + public CS_CollSet CollSet { get; set; } + + public override void SerializeImpl(SerializerObject s) + { + P3DDataPointer = s.SerializePointer(P3DDataPointer, name: nameof(P3DDataPointer)); + SuperObjectReferencePointer = s.SerializePointer(SuperObjectReferencePointer, name: nameof(SuperObjectReferencePointer)); + Pointer_08 = s.SerializePointer(Pointer_08, name: nameof(Pointer_08)); + Pointer_0C = s.SerializePointer(Pointer_0C, name: nameof(Pointer_0C)); + CollSetPointer = s.SerializePointer(CollSetPointer, name: nameof(CollSetPointer)); + SectorSuperObjectPointer = s.SerializePointer(SectorSuperObjectPointer, name: nameof(SectorSuperObjectPointer)); + + // Serialize data from pointers + s.DoAt(P3DDataPointer, () => Perso3DData = s.SerializeObject(Perso3DData, name: nameof(Perso3DData))); + s.DoAt(SuperObjectReferencePointer, () => + { + SuperObjectPointer = s.SerializePointer(SuperObjectPointer, name: nameof(SuperObjectPointer)); + + CPA_Settings settings = s.GetCPASettings(); + + if (settings.EngineVersion == EngineVersion.RaymanRush_PS1) + { + NamePointer = s.SerializePointer(NamePointer, name: nameof(NamePointer)); + + s.DoAt(NamePointer, () => Name = s.SerializeString(Name, name: nameof(Name))); + } + else + { + Name = s.SerializeString(Name, name: nameof(Name)); + } + + s.DoAt(SuperObjectPointer, () => + SuperObject = s.SerializeObject(SuperObject, name: nameof(SuperObject))); + }); + s.DoAt(CollSetPointer, () => CollSet = s.SerializeObject(CollSet, name: nameof(CollSet))); + } + } +} \ No newline at end of file diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/PS1/PERSO/PERSO_Perso.cs.meta b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/PS1/PERSO/PERSO_Perso.cs.meta new file mode 100644 index 00000000..409e072d --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/PS1/PERSO/PERSO_Perso.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: eb13bab1648639241b2f91c1836835d3 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/PS1/PERSO/PERSO_Perso3DData.cs b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/PS1/PERSO/PERSO_Perso3DData.cs new file mode 100644 index 00000000..859665ca --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/PS1/PERSO/PERSO_Perso3DData.cs @@ -0,0 +1,84 @@ +using System; + +namespace BinarySerializer.Ubisoft.CPA.PS1 +{ + public class PERSO_Perso3DData : BinarySerializable + { + // TODO: Serialize as booleans with DoBits? + public uint Flags { get; set; } + public DataFlags_RR Flags_RR { get; set; } + public DataFlags_JB Flags_JB { get; set; } + + public Pointer FamilyPointer { get; set; } + public byte[] Bytes_08 { get; set; } + public Pointer Pointer_58 { get; set; } // 3 structs of size 0x8 (no pointers) + public ushort Ushort_5C { get; set; } + public short Short_5E { get; set; } + public Pointer AnimationBufferPointer { get; set; } + public Pointer Pointer_64 { get; set; } // Short_5E * 0x4 + public Pointer Pointer_68 { get; set; } // Short_5E * 0x2 + public Pointer Pointer_6C { get; set; } + public int CollisionObjectsCount { get; set; } + public Pointer CollisionObjectsPointer { get; set; } + public uint StateIndex { get; set; } + public Pointer Runtime_CurrentStatePointer { get; set; } + public byte[] Bytes_80 { get; set; } // At 0x92: scale shorts + + // Serialized from pointers + public PERSO_Family Family { get; set; } + public CS_PhysicalObjectCollisionMapping[] CollisionMapping { get; set; } + + public override void SerializeImpl(SerializerObject s) + { + CPA_Settings settings = s.GetCPASettings(); + + if (settings.EngineVersion == EngineVersion.RaymanRush_PS1) + Flags_RR = s.Serialize(Flags_RR, name: nameof(Flags_RR)); + else if (settings.EngineVersion == EngineVersion.JungleBook_PS1) + Flags_JB = s.Serialize(Flags_JB, name: nameof(Flags_JB)); + else + Flags = s.Serialize(Flags, name: nameof(Flags)); + + FamilyPointer = s.SerializePointer(FamilyPointer, name: nameof(FamilyPointer)); + Bytes_08 = s.SerializeArray(Bytes_08, 0x50, name: nameof(Bytes_08)); + Pointer_58 = s.SerializePointer(Pointer_58, name: nameof(Pointer_58)); + Ushort_5C = s.Serialize(Ushort_5C, name: nameof(Ushort_5C)); + + Short_5E = s.Serialize(Short_5E, name: nameof(Short_5E)); + AnimationBufferPointer = s.SerializePointer(AnimationBufferPointer, name: nameof(AnimationBufferPointer)); + Pointer_64 = s.SerializePointer(Pointer_64, name: nameof(Pointer_64)); + Pointer_68 = s.SerializePointer(Pointer_68, name: nameof(Pointer_68)); + + Pointer_6C = s.SerializePointer(Pointer_6C, name: nameof(Pointer_6C)); + CollisionObjectsCount = s.Serialize(CollisionObjectsCount, name: nameof(CollisionObjectsCount)); + CollisionObjectsPointer = s.SerializePointer(CollisionObjectsPointer, allowInvalid: CollisionObjectsCount == 0, name: nameof(CollisionObjectsPointer)); + + StateIndex = s.Serialize(StateIndex, name: nameof(StateIndex)); + Runtime_CurrentStatePointer = s.SerializePointer(Runtime_CurrentStatePointer, name: nameof(Runtime_CurrentStatePointer)); + + Bytes_80 = s.SerializeArray(Bytes_80, 0x24, name: nameof(Bytes_80)); + + // Serialize data from pointers + s.DoAt(FamilyPointer, () => + Family = s.SerializeObject(Family, name: nameof(Family))); + s.DoAt(CollisionObjectsPointer, () => + CollisionMapping = s.SerializeObjectArray(CollisionMapping, CollisionObjectsCount, name: nameof(CollisionMapping))); + } + + [Flags] + public enum DataFlags_RR : uint + { + None = 0, + Actor1 = 1 << 16, + Actor2 = 1 << 17, + } + + [Flags] + public enum DataFlags_JB : uint + { + None = 0, + Actor1 = 1 << 15, + Actor2 = 1 << 16, + } + } +} \ No newline at end of file diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/PS1/PERSO/PERSO_Perso3DData.cs.meta b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/PS1/PERSO/PERSO_Perso3DData.cs.meta new file mode 100644 index 00000000..0d0c978a --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/PS1/PERSO/PERSO_Perso3DData.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 7b4a5617994fe7d4da5b5b90b4867825 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/PS1/PLA.meta b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/PS1/PLA.meta new file mode 100644 index 00000000..25240055 --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/PS1/PLA.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: f2c674e4e6f65594abea35c48e1f4e0b +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/PS1/PLA/PLA_State.cs b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/PS1/PLA/PLA_State.cs new file mode 100644 index 00000000..6620bda7 --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/PS1/PLA/PLA_State.cs @@ -0,0 +1,52 @@ +namespace BinarySerializer.Ubisoft.CPA.PS1 +{ + public class PLA_State : BinarySerializable + { + public Pointer AnimationIndexPointer { get; set; } + public short ZoneZDM { get; set; } + public short ZoneZDE { get; set; } + public short ZoneZDD { get; set; } + public short ZoneZDR { get; set; } + public Pointer TransitionsPointer { get; set; } + public uint TransitionsCount { get; set; } + public Pointer AutoStatePointer { get; set; } + public Pointer Pointer_18 { get; set; } + public byte Byte_1C { get; set; } + public byte Speed { get; set; } + public ushort Ushort_1E { get; set; } + + // Serialized from pointers + public ANIM_AnimationIndex AnimationIndex { get; set; } + public PLA_StateTransition[] Transitions { get; set; } + public PLA_State AutoState { get; set; } + + public override void SerializeImpl(SerializerObject s) + { + CPA_Settings settings = s.GetCPASettings(); + + AnimationIndexPointer = s.SerializePointer(AnimationIndexPointer, name: nameof(AnimationIndexPointer)); + ZoneZDM = s.Serialize(ZoneZDM, name: nameof(ZoneZDM)); + ZoneZDE = s.Serialize(ZoneZDE, name: nameof(ZoneZDE)); + ZoneZDD = s.Serialize(ZoneZDD, name: nameof(ZoneZDD)); + ZoneZDR = s.Serialize(ZoneZDR, name: nameof(ZoneZDR)); + TransitionsPointer = s.SerializePointer(TransitionsPointer, name: nameof(TransitionsPointer)); + TransitionsCount = s.Serialize(TransitionsCount, name: nameof(TransitionsCount)); + AutoStatePointer = s.SerializePointer(AutoStatePointer, name: nameof(AutoStatePointer)); + + if (settings.EngineVersion != EngineVersion.RaymanRush_PS1) + Pointer_18 = s.SerializePointer(Pointer_18, name: nameof(Pointer_18)); + + Byte_1C = s.Serialize(Byte_1C, name: nameof(Byte_1C)); + Speed = s.Serialize(Speed, name: nameof(Speed)); + Ushort_1E = s.Serialize(Ushort_1E, name: nameof(Ushort_1E)); + + // Serialize data from pointers + s.DoAt(AnimationIndexPointer, () => + AnimationIndex = s.SerializeObject(AnimationIndex, name: nameof(AnimationIndex))); + s.DoAt(TransitionsPointer, () => + Transitions = s.SerializeObjectArray(Transitions, TransitionsCount, name: nameof(Transitions))); + s.DoAt(AutoStatePointer, () => + AutoState = s.SerializeObject(AutoState, name: nameof(AutoState))); + } + } +} \ No newline at end of file diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/PS1/PLA/PLA_State.cs.meta b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/PS1/PLA/PLA_State.cs.meta new file mode 100644 index 00000000..ae0f634b --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/PS1/PLA/PLA_State.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: d17e58f1a748c294289756c0fb18863d +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/PS1/PLA/PLA_StateTransition.cs b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/PS1/PLA/PLA_StateTransition.cs new file mode 100644 index 00000000..3a3a24be --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/PS1/PLA/PLA_StateTransition.cs @@ -0,0 +1,22 @@ +namespace BinarySerializer.Ubisoft.CPA.PS1 +{ + public class PLA_StateTransition : BinarySerializable + { + public Pointer TargetStatePointer { get; set; } + public Pointer StateToGoPointer { get; set; } + + // Serialized from pointers + public PLA_State TargetState { get; set; } + public PLA_State StateToGo { get; set; } + + public override void SerializeImpl(SerializerObject s) + { + TargetStatePointer = s.SerializePointer(TargetStatePointer, name: nameof(TargetStatePointer)); + StateToGoPointer = s.SerializePointer(StateToGoPointer, name: nameof(StateToGoPointer)); + + // Serialize data from pointers + s.DoAt(TargetStatePointer, () => TargetState = s.SerializeObject(TargetState, name: nameof(TargetState))); + s.DoAt(StateToGoPointer, () => StateToGo = s.SerializeObject(StateToGo, name: nameof(StateToGo))); + } + } +} \ No newline at end of file diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/PS1/PLA/PLA_StateTransition.cs.meta b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/PS1/PLA/PLA_StateTransition.cs.meta new file mode 100644 index 00000000..38b40acf --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/PS1/PLA/PLA_StateTransition.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: e3c6776dd4c2dda46ae6074a3688a4ea +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/PS1/PO.meta b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/PS1/PO.meta new file mode 100644 index 00000000..1c217a7b --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/PS1/PO.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 6c6d7d13418d2ed408dd7c961b0baa24 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/PS1/PO/PO_ObjectsTable.cs b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/PS1/PO/PO_ObjectsTable.cs new file mode 100644 index 00000000..8fb2f46a --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/PS1/PO/PO_ObjectsTable.cs @@ -0,0 +1,22 @@ +namespace BinarySerializer.Ubisoft.CPA.PS1 +{ + public class PO_ObjectsTable : BinarySerializable + { + public uint? Pre_Length { get; set; } + + public uint Uint_00 { get; set; } + public uint Uint_04 { get; set; } + public PO_PhysicalObject[] Entries { get; set; } + + public override void SerializeImpl(SerializerObject s) + { + Uint_00 = s.Serialize(Uint_00, name: nameof(Uint_00)); + Uint_04 = s.Serialize(Uint_04, name: nameof(Uint_04)); + + if (Pre_Length != null) + Entries = s.SerializeObjectArray(Entries, Pre_Length.Value, name: nameof(Entries)); + else + Entries = s.SerializeObjectArrayUntil(Entries, x => x.GeometricObjectPointer == null, name: nameof(Entries)); + } + } +} \ No newline at end of file diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/PS1/PO/PO_ObjectsTable.cs.meta b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/PS1/PO/PO_ObjectsTable.cs.meta new file mode 100644 index 00000000..15736336 --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/PS1/PO/PO_ObjectsTable.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 5a39bf300a2b30546b6152a6c2684df0 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/PS1/PO/PO_PhysicalObject.cs b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/PS1/PO/PO_PhysicalObject.cs new file mode 100644 index 00000000..a39989bd --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/PS1/PO/PO_PhysicalObject.cs @@ -0,0 +1,21 @@ +namespace BinarySerializer.Ubisoft.CPA.PS1 +{ + public class PO_PhysicalObject : BinarySerializable + { + public Pointer Pointer_00 { get; set; } // Object of 0x50, 5 rows of 0x10 + public Pointer GeometricObjectPointer { get; set; } + + // Serialized from pointers + public GEO_GeometricObject GeometricObject { get; set; } + + public override void SerializeImpl(SerializerObject s) + { + Pointer_00 = s.SerializePointer(Pointer_00, name: nameof(Pointer_00)); + GeometricObjectPointer = s.SerializePointer(GeometricObjectPointer, name: nameof(GeometricObjectPointer)); + + // Serialize data from pointers + s.DoAt(GeometricObjectPointer, () => + GeometricObject = s.SerializeObject(GeometricObject, name: nameof(GeometricObject))); + } + } +} \ No newline at end of file diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/PS1/PO/PO_PhysicalObject.cs.meta b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/PS1/PO/PO_PhysicalObject.cs.meta new file mode 100644 index 00000000..3c9822b3 --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/PS1/PO/PO_PhysicalObject.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 08415523ecdf76f4db8605d0ff4463d2 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/PS1/POS.meta b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/PS1/POS.meta new file mode 100644 index 00000000..1a34c4eb --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/PS1/POS.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: afc3e337d50932640a4c4ac221e162fb +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/PS1/POS/POS_CompletePosition_PS1.cs b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/PS1/POS/POS_CompletePosition_PS1.cs new file mode 100644 index 00000000..8498e42d --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/PS1/POS/POS_CompletePosition_PS1.cs @@ -0,0 +1,37 @@ +namespace BinarySerializer.Ubisoft.CPA.PS1 +{ + public class POS_CompletePosition_PS1 : BinarySerializable, MAT_ITransform + { + public MTH3D_Matrix_PS1 RotationMatrix { get; set; } + public ushort Ushort_12 { get; set; } + + public MTH3D_Vector_PS1_Int TranslationVector { get; set; } + public ushort Ushort_20 { get; set; } + public ushort Ushort_22 { get; set; } + + public override void SerializeImpl(SerializerObject s) + { + RotationMatrix = s.SerializeObject(RotationMatrix, name: nameof(RotationMatrix)); + Ushort_12 = s.Serialize(Ushort_12, name: nameof(Ushort_12)); + + TranslationVector = s.SerializeObject(TranslationVector, name: nameof(TranslationVector)); + Ushort_20 = s.Serialize(Ushort_20, name: nameof(Ushort_20)); + Ushort_22 = s.Serialize(Ushort_22, name: nameof(Ushort_22)); + } + + #region MAT_ITransform implementation + public MTH3D_Vector Position { + get => new MTH3D_Vector(TranslationVector.X, TranslationVector.Y, TranslationVector.Z); + set => TranslationVector = new MTH3D_Vector_PS1_Int(value.X, value.Y, value.Z); + } + public MTH4D_Vector Rotation { + get => RotationMatrix.GetRotation(); + set => throw new System.NotImplementedException(); + } + public MTH3D_Vector Scale { + get => MTH3D_Vector.One; + set => throw new System.NotImplementedException(); + } + #endregion + } +} \ No newline at end of file diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/PS1/POS/POS_CompletePosition_PS1.cs.meta b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/PS1/POS/POS_CompletePosition_PS1.cs.meta new file mode 100644 index 00000000..f8bb57ac --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/PS1/POS/POS_CompletePosition_PS1.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: db77276ad9788da4aacb2ef3ce537b67 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/PS1/SECT.meta b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/PS1/SECT.meta new file mode 100644 index 00000000..e4828cc9 --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/PS1/SECT.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: fcadf80e8444c1a45889ef31de32a5e3 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/PS1/SECT/SECT_NeighborSector.cs b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/PS1/SECT/SECT_NeighborSector.cs new file mode 100644 index 00000000..7cbc67ed --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/PS1/SECT/SECT_NeighborSector.cs @@ -0,0 +1,30 @@ +namespace BinarySerializer.Ubisoft.CPA.PS1 +{ + public class SECT_NeighborSector : BinarySerializable + { + public Pointer SectorSuperObjectPointer { get; set; } + public short Short_04 { get; set; } + public short Short_06 { get; set; } + + // Serialized from pointers + public HIE_SuperObject SectorSuperObject { get; set; } + + public override void SerializeImpl(SerializerObject s) + { + CPA_Settings settings = s.GetCPASettings(); + + SectorSuperObjectPointer = s.SerializePointer(SectorSuperObjectPointer, name: nameof(SectorSuperObjectPointer)); + + if (settings.EngineVersion != EngineVersion.DonaldDuckQuackAttack_PS1 && + settings.EngineVersion != EngineVersion.JungleBook_PS1) + { + Short_04 = s.Serialize(Short_04, name: nameof(Short_04)); + Short_06 = s.Serialize(Short_06, name: nameof(Short_06)); + } + + // Serialize data from pointers + s.DoAt(SectorSuperObjectPointer, () => + SectorSuperObject = s.SerializeObject(SectorSuperObject, name: nameof(SectorSuperObject))); + } + } +} \ No newline at end of file diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/PS1/SECT/SECT_NeighborSector.cs.meta b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/PS1/SECT/SECT_NeighborSector.cs.meta new file mode 100644 index 00000000..bba5055a --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/PS1/SECT/SECT_NeighborSector.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 991a111541050b24fab13f605f2cd783 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/PS1/SECT/SECT_Sector.cs b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/PS1/SECT/SECT_Sector.cs new file mode 100644 index 00000000..5c4d3e8e --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/PS1/SECT/SECT_Sector.cs @@ -0,0 +1,129 @@ +namespace BinarySerializer.Ubisoft.CPA.PS1 +{ + public class SECT_Sector : BinarySerializable + { + public Pointer PersosPointer { get; set; } + public Pointer GraphicSectorsPointer { get; set; } + public Pointer CollisionSectorsPointer { get; set; } + public Pointer ActivitySectorsPointer { get; set; } + public Pointer Pointer_10 { get; set; } // Sound sectors? + public Pointer IPOsPointer { get; set; } + public Pointer Pointer_18 { get; set; } + public int Int_18 { get; set; } + public int MinX { get; set; } + public int MinY { get; set; } + public int MinZ { get; set; } + public int Int_28 { get; set; } + public int MaxX { get; set; } + public int MaxY { get; set; } + public int MaxZ { get; set; } + public int Int_38 { get; set; } + public int Int_3C { get; set; } + public short Short_40 { get; set; } + public short Short_42 { get; set; } + public short Short_44 { get; set; } + public short Short_46 { get; set; } + public short Short_48 { get; set; } + public short Short_4A { get; set; } + public int Int_4C { get; set; } + public int Int_50 { get; set; } + + public ushort Vip_Ushort_08 { get; set; } + public ushort Vip_Ushort_0A { get; set; } + public uint Vip_Uint_0C { get; set; } + public Pointer SoPointer { get; set; } + + // Serialized from pointers + //public SectorArray Persos { get; set; } + public SectorArray GraphicSectors { get; set; } + public SectorArray CollisionSectors { get; set; } + public SectorArray ActivitySectors { get; set; } + + public override void SerializeImpl(SerializerObject s) + { + CPA_Settings settings = s.GetCPASettings(); + + PersosPointer = s.SerializePointer(PersosPointer, name: nameof(PersosPointer)); + GraphicSectorsPointer = s.SerializePointer(GraphicSectorsPointer, name: nameof(GraphicSectorsPointer)); + + if (settings.EngineVersion != EngineVersion.Rayman2_PS1 && settings.EngineVersion != EngineVersion.RaymanRush_PS1) + { + Vip_Ushort_08 = s.Serialize(Vip_Ushort_08, name: nameof(Vip_Ushort_08)); + Vip_Ushort_0A = s.Serialize(Vip_Ushort_0A, name: nameof(Vip_Ushort_0A)); + Vip_Uint_0C = s.Serialize(Vip_Uint_0C, name: nameof(Vip_Uint_0C)); + } + + CollisionSectorsPointer = s.SerializePointer(CollisionSectorsPointer, name: nameof(CollisionSectorsPointer)); + ActivitySectorsPointer = s.SerializePointer(ActivitySectorsPointer, name: nameof(ActivitySectorsPointer)); + Pointer_10 = s.SerializePointer(Pointer_10, name: nameof(Pointer_10)); + IPOsPointer = s.SerializePointer(IPOsPointer, name: nameof(IPOsPointer)); + + if (settings.EngineVersion != EngineVersion.Rayman2_PS1 && settings.EngineVersion != EngineVersion.RaymanRush_PS1) + Int_18 = s.Serialize(Int_18, name: nameof(Int_18)); + else + Pointer_18 = s.SerializePointer(Pointer_18, name: nameof(Pointer_18)); + + MinX = s.Serialize(MinX, name: nameof(MinX)); + MinY = s.Serialize(MinY, name: nameof(MinY)); + MinZ = s.Serialize(MinZ, name: nameof(MinZ)); + + Int_28 = s.Serialize(Int_28, name: nameof(Int_28)); + + MaxX = s.Serialize(MaxX, name: nameof(MaxX)); + MaxY = s.Serialize(MaxY, name: nameof(MaxY)); + MaxZ = s.Serialize(MaxZ, name: nameof(MaxZ)); + + Int_38 = s.Serialize(Int_38, name: nameof(Int_38)); + Int_3C = s.Serialize(Int_3C, name: nameof(Int_3C)); + Short_40 = s.Serialize(Short_40, name: nameof(Short_40)); + Short_42 = s.Serialize(Short_42, name: nameof(Short_42)); + Short_44 = s.Serialize(Short_44, name: nameof(Short_44)); + Short_46 = s.Serialize(Short_46, name: nameof(Short_46)); + + if (settings.EngineVersion != EngineVersion.JungleBook_PS1 && settings.EngineVersion != EngineVersion.VIP_PS1) + { + Short_48 = s.Serialize(Short_48, name: nameof(Short_48)); + Short_4A = s.Serialize(Short_4A, name: nameof(Short_4A)); + Int_4C = s.Serialize(Int_4C, name: nameof(Int_4C)); + + if (settings.EngineVersion == EngineVersion.Rayman2_PS1 || settings.EngineVersion == EngineVersion.RaymanRush_PS1) + Int_50 = s.Serialize(Int_50, name: nameof(Int_50)); + } + else + { + Int_4C = s.Serialize(Int_4C, name: nameof(Int_4C)); + Int_50 = s.Serialize(Int_50, name: nameof(Int_50)); + SoPointer = s.SerializePointer(SoPointer, name: nameof(SoPointer)); + } + + // Serialize data from pointers + //s.DoAt(PersosPointer, () => + // Persos = s.SerializeObject>(Persos, name: nameof(Persos))); + s.DoAt(GraphicSectorsPointer, () => + GraphicSectors = s.SerializeObject>(GraphicSectors, name: nameof(GraphicSectors))); + s.DoAt(CollisionSectorsPointer, () => + CollisionSectors = s.SerializeObject>(CollisionSectors, name: nameof(CollisionSectors))); + s.DoAt(ActivitySectorsPointer, () => + ActivitySectors = s.SerializeObject>(ActivitySectors, name: nameof(ActivitySectors))); + } + + public class SectorArray : BinarySerializable + where T : BinarySerializable, new() + { + public uint Count { get; set; } + public Pointer ItemsPointer { get; set; } + + // Serialized from pointers + public T[] Items { get; set; } + + public override void SerializeImpl(SerializerObject s) + { + Count = s.Serialize(Count, name: nameof(Count)); + ItemsPointer = s.SerializePointer(ItemsPointer, allowInvalid: Count == 0, name: nameof(ItemsPointer)); + + // Serialize data from pointers + s.DoAt(ItemsPointer, () => Items = s.SerializeObjectArray(Items, Count, name: nameof(Items))); + } + } + } +} \ No newline at end of file diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/PS1/SECT/SECT_Sector.cs.meta b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/PS1/SECT/SECT_Sector.cs.meta new file mode 100644 index 00000000..1de4335e --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/PS1/SECT/SECT_Sector.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: fbb48fc08a25db34bb61c2c637c80781 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/PS1/UITextureName.cs b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/PS1/UITextureName.cs new file mode 100644 index 00000000..91ee6670 --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/PS1/UITextureName.cs @@ -0,0 +1,12 @@ +namespace BinarySerializer.Ubisoft.CPA.PS1 +{ + public class UITextureName : BinarySerializable + { + public string Name { get; set; } + + public override void SerializeImpl(SerializerObject s) + { + Name = s.SerializeString(Name, 0x1C, name: nameof(Name)); + } + } +} \ No newline at end of file diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/PS1/UITextureName.cs.meta b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/PS1/UITextureName.cs.meta new file mode 100644 index 00000000..47609b77 --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/PS1/UITextureName.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 5489522e62bae48469ff171ffaf51ce1 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/PS1/WAY.meta b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/PS1/WAY.meta new file mode 100644 index 00000000..a2545874 --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/PS1/WAY.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: a955f7d72fe1898468e9194e1d6c5c7d +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/PS1/WAY/WAY_Arc.cs b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/PS1/WAY/WAY_Arc.cs new file mode 100644 index 00000000..aae7d5a3 --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/PS1/WAY/WAY_Arc.cs @@ -0,0 +1,28 @@ +namespace BinarySerializer.Ubisoft.CPA.PS1 +{ + public class WAY_Arc : BinarySerializable + { + public Pointer Node1Pointer { get; set; } + public Pointer Node2Pointer { get; set; } + public uint Uint_08 { get; set; } + public ushort Ushort_0C { get; set; } + public ushort Ushort_0E { get; set; } + + // Serialized from pointers + public WAY_WayPoint Node1 { get; set; } + public WAY_WayPoint Node2 { get; set; } + + public override void SerializeImpl(SerializerObject s) + { + Node1Pointer = s.SerializePointer(Node1Pointer, name: nameof(Node1Pointer)); + Node2Pointer = s.SerializePointer(Node2Pointer, name: nameof(Node2Pointer)); + Uint_08 = s.Serialize(Uint_08, name: nameof(Uint_08)); + Ushort_0C = s.Serialize(Ushort_0C, name: nameof(Ushort_0C)); + Ushort_0E = s.Serialize(Ushort_0E, name: nameof(Ushort_0E)); + + // Serialize data from pointers + s.DoAt(Node1Pointer, () => Node1 = s.SerializeObject(Node1, name: nameof(Node1))); + s.DoAt(Node2Pointer, () => Node2 = s.SerializeObject(Node2, name: nameof(Node2))); + } + } +} \ No newline at end of file diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/PS1/WAY/WAY_Arc.cs.meta b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/PS1/WAY/WAY_Arc.cs.meta new file mode 100644 index 00000000..f39ae364 --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/PS1/WAY/WAY_Arc.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: c27dbc7815de77d4bbef5552c5aefeb5 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/PS1/WAY/WAY_Graph.cs b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/PS1/WAY/WAY_Graph.cs new file mode 100644 index 00000000..5e364436 --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/PS1/WAY/WAY_Graph.cs @@ -0,0 +1,26 @@ +namespace BinarySerializer.Ubisoft.CPA.PS1 +{ + public class WAY_Graph : BinarySerializable + { + public int ArcsCount { get; set; } + public Pointer FirstNodePointer { get; set; } + public Pointer ArcsPointer { get; set; } + public int NodesCount { get; set; } + public byte[] Bytes_10 { get; set; } + + // Serialized from pointers + public WAY_Arc[] Arcs { get; set; } + + public override void SerializeImpl(SerializerObject s) + { + ArcsCount = s.Serialize(ArcsCount, name: nameof(ArcsCount)); + FirstNodePointer = s.SerializePointer(FirstNodePointer, allowInvalid: ArcsCount == 0, name: nameof(FirstNodePointer)); + ArcsPointer = s.SerializePointer(ArcsPointer, allowInvalid: ArcsCount == 0, name: nameof(ArcsPointer)); + NodesCount = s.Serialize(NodesCount, name: nameof(NodesCount)); + Bytes_10 = s.SerializeArray(Bytes_10, 0x58, name: nameof(Bytes_10)); + + // Serialize data from pointers + s.DoAt(ArcsPointer, () => Arcs = s.SerializeObjectArray(Arcs, ArcsCount, name: nameof(Arcs))); + } + } +} \ No newline at end of file diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/PS1/WAY/WAY_Graph.cs.meta b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/PS1/WAY/WAY_Graph.cs.meta new file mode 100644 index 00000000..a047266d --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/PS1/WAY/WAY_Graph.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: fa8fb2ada1f29284e8072982b1a5dbca +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/PS1/WAY/WAY_WayPoint.cs b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/PS1/WAY/WAY_WayPoint.cs new file mode 100644 index 00000000..4d45202d --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/PS1/WAY/WAY_WayPoint.cs @@ -0,0 +1,24 @@ +namespace BinarySerializer.Ubisoft.CPA.PS1 +{ + public class WAY_WayPoint : BinarySerializable + { + public int X { get; set; } + public int Y { get; set; } + public int Z { get; set; } + public short Short_0C { get; set; } + public short Short_0E { get; set; } + public short Radius { get; set; } + public short Short_12 { get; set; } + + public override void SerializeImpl(SerializerObject s) + { + X = s.Serialize(X, name: nameof(X)); + Y = s.Serialize(Y, name: nameof(Y)); + Z = s.Serialize(Z, name: nameof(Z)); + Short_0C = s.Serialize(Short_0C, name: nameof(Short_0C)); + Short_0E = s.Serialize(Short_0E, name: nameof(Short_0E)); + Radius = s.Serialize(Radius, name: nameof(Radius)); + Short_12 = s.Serialize(Short_12, name: nameof(Short_12)); + } + } +} \ No newline at end of file diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/PS1/WAY/WAY_WayPoint.cs.meta b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/PS1/WAY/WAY_WayPoint.cs.meta new file mode 100644 index 00000000..dcbec063 --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/PS1/WAY/WAY_WayPoint.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 595bca0be06e95548b73e75245cd93b6 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/SNA.meta b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/SNA.meta new file mode 100644 index 00000000..fe157c98 --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/SNA.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 48b4b7fb912546d43bae606739f0b8ef +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/SNA/Description.meta b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/SNA/Description.meta new file mode 100644 index 00000000..e04f889f --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/SNA/Description.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 112e8503671e1dc46bbbc5f8f390333b +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/SNA/Description/Data.meta b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/SNA/Description/Data.meta new file mode 100644 index 00000000..6ff718e5 --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/SNA/Description/Data.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: a587c17a525af294a905e6f5896a2d17 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/SNA/Description/Data/SNA_Description_Color.cs b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/SNA/Description/Data/SNA_Description_Color.cs new file mode 100644 index 00000000..c845ae66 --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/SNA/Description/Data/SNA_Description_Color.cs @@ -0,0 +1,11 @@ +namespace BinarySerializer.Ubisoft.CPA { + public class SNA_Description_Color : SNA_Description_Data { + public GLI_FloatColor Value { get; set; } + + public override void SerializeImpl(SerializerObject s) { + Value = s.SerializeObject(Value, name: nameof(Value)); + } + public override string ShortLog => Value.ToString(); + public override bool UseShortLog => true; + } +} diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/SNA/Description/Data/SNA_Description_Color.cs.meta b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/SNA/Description/Data/SNA_Description_Color.cs.meta new file mode 100644 index 00000000..ea8d98eb --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/SNA/Description/Data/SNA_Description_Color.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 9387ef85120a9e842b00447711885cb4 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/SNA/Description/Data/SNA_Description_Data.cs b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/SNA/Description/Data/SNA_Description_Data.cs new file mode 100644 index 00000000..9680cedc --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/SNA/Description/Data/SNA_Description_Data.cs @@ -0,0 +1,4 @@ +namespace BinarySerializer.Ubisoft.CPA { + public abstract class SNA_Description_Data : BinarySerializable { + } +} diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/SNA/Description/Data/SNA_Description_Data.cs.meta b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/SNA/Description/Data/SNA_Description_Data.cs.meta new file mode 100644 index 00000000..bdf10b88 --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/SNA/Description/Data/SNA_Description_Data.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: e49d76b2b28cb98448820bf58e55653a +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/SNA/Description/Data/SNA_Description_FrameSynchro.cs b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/SNA/Description/Data/SNA_Description_FrameSynchro.cs new file mode 100644 index 00000000..d9fb06b1 --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/SNA/Description/Data/SNA_Description_FrameSynchro.cs @@ -0,0 +1,13 @@ +namespace BinarySerializer.Ubisoft.CPA { + public class SNA_Description_FrameSynchro : SNA_Description_Data { + public SNA_Description_String OnOff { get; set; } + public SNA_Description_String FramesCount { get; set; } + public SNA_Description_String LowLimitPercent { get; set; } + + public override void SerializeImpl(SerializerObject s) { + OnOff = s.SerializeObject(OnOff, name: nameof(OnOff)); + FramesCount = s.SerializeObject(FramesCount, name: nameof(FramesCount)); + LowLimitPercent = s.SerializeObject(LowLimitPercent, name: nameof(LowLimitPercent)); + } + } +} diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/SNA/Description/Data/SNA_Description_FrameSynchro.cs.meta b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/SNA/Description/Data/SNA_Description_FrameSynchro.cs.meta new file mode 100644 index 00000000..87ec82a2 --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/SNA/Description/Data/SNA_Description_FrameSynchro.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 958b1c28b94285047af727d581ec15e1 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/SNA/Description/Data/SNA_Description_Gradient.cs b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/SNA/Description/Data/SNA_Description_Gradient.cs new file mode 100644 index 00000000..f1ff42f2 --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/SNA/Description/Data/SNA_Description_Gradient.cs @@ -0,0 +1,15 @@ +namespace BinarySerializer.Ubisoft.CPA { + public class SNA_Description_Gradient : SNA_Description_Data { + public GLI_FloatColor UpLeft { get; set; } + public GLI_FloatColor UpRight { get; set; } + public GLI_FloatColor DownLeft { get; set; } + public GLI_FloatColor DownRight { get; set; } + + public override void SerializeImpl(SerializerObject s) { + UpLeft = s.SerializeObject(UpLeft, name: nameof(UpLeft)); + UpRight = s.SerializeObject(UpRight, name: nameof(UpRight)); + DownLeft = s.SerializeObject(DownLeft, name: nameof(DownLeft)); + DownRight = s.SerializeObject(DownRight, name: nameof(DownRight)); + } + } +} diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/SNA/Description/Data/SNA_Description_Gradient.cs.meta b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/SNA/Description/Data/SNA_Description_Gradient.cs.meta new file mode 100644 index 00000000..e7583580 --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/SNA/Description/Data/SNA_Description_Gradient.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: eee3992f6e6f6d848a6e25afb376d0d3 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/SNA/Description/Data/SNA_Description_LevelNameSection.cs b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/SNA/Description/Data/SNA_Description_LevelNameSection.cs new file mode 100644 index 00000000..bb155de6 --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/SNA/Description/Data/SNA_Description_LevelNameSection.cs @@ -0,0 +1,10 @@ +namespace BinarySerializer.Ubisoft.CPA { + public class SNA_Description_LevelNameSection : SNA_Description_Section { + public int CurrentLevel { get; set; } + + public override void SerializeImpl(SerializerObject s) { + CurrentLevel = s.Serialize(CurrentLevel, name: nameof(CurrentLevel)); + base.SerializeImpl(s); + } + } +} diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/SNA/Description/Data/SNA_Description_LevelNameSection.cs.meta b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/SNA/Description/Data/SNA_Description_LevelNameSection.cs.meta new file mode 100644 index 00000000..581817df --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/SNA/Description/Data/SNA_Description_LevelNameSection.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 678d3fcf6a5ac4d4d85cb0ed08642185 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/SNA/Description/Data/SNA_Description_Long.cs b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/SNA/Description/Data/SNA_Description_Long.cs new file mode 100644 index 00000000..68bb0bc0 --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/SNA/Description/Data/SNA_Description_Long.cs @@ -0,0 +1,12 @@ +namespace BinarySerializer.Ubisoft.CPA { + public class SNA_Description_Long : SNA_Description_Data { + public int Value { get; set; } + + public override void SerializeImpl(SerializerObject s) { + Value = s.Serialize(Value, name: nameof(Value)); + } + + public override string ShortLog => Value.ToString(); + public override bool UseShortLog => true; + } +} diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/SNA/Description/Data/SNA_Description_Long.cs.meta b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/SNA/Description/Data/SNA_Description_Long.cs.meta new file mode 100644 index 00000000..8d983074 --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/SNA/Description/Data/SNA_Description_Long.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: ddc8462298951534eae8ab530f6c241a +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/SNA/Description/Data/SNA_Description_LongLong.cs b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/SNA/Description/Data/SNA_Description_LongLong.cs new file mode 100644 index 00000000..18b5cb52 --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/SNA/Description/Data/SNA_Description_LongLong.cs @@ -0,0 +1,11 @@ +namespace BinarySerializer.Ubisoft.CPA { + public class SNA_Description_LongLong : SNA_Description_Data { + public int Value0 { get; set; } + public int Value1 { get; set; } + + public override void SerializeImpl(SerializerObject s) { + Value0 = s.Serialize(Value0, name: nameof(Value0)); + Value1 = s.Serialize(Value1, name: nameof(Value1)); + } + } +} diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/SNA/Description/Data/SNA_Description_LongLong.cs.meta b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/SNA/Description/Data/SNA_Description_LongLong.cs.meta new file mode 100644 index 00000000..0b9f5e55 --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/SNA/Description/Data/SNA_Description_LongLong.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 5ffa58cba0aa2de41b70c74c3e56aed8 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/SNA/Description/Data/SNA_Description_RandomDesc.cs b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/SNA/Description/Data/SNA_Description_RandomDesc.cs new file mode 100644 index 00000000..9c5137d7 --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/SNA/Description/Data/SNA_Description_RandomDesc.cs @@ -0,0 +1,10 @@ +namespace BinarySerializer.Ubisoft.CPA { + public class SNA_Description_RandomDesc : SNA_Description_Section { + public int SizeOfTable { get; set; } + + public override void SerializeImpl(SerializerObject s) { + SizeOfTable = s.Serialize(SizeOfTable, name: nameof(SizeOfTable)); + base.SerializeImpl(s); + } + } +} diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/SNA/Description/Data/SNA_Description_RandomDesc.cs.meta b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/SNA/Description/Data/SNA_Description_RandomDesc.cs.meta new file mode 100644 index 00000000..a4bbdf15 --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/SNA/Description/Data/SNA_Description_RandomDesc.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 67440aeb67939ba4baa1e63cac1fec2b +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/SNA/Description/Data/SNA_Description_RandomTable.cs b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/SNA/Description/Data/SNA_Description_RandomTable.cs new file mode 100644 index 00000000..a8f7840a --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/SNA/Description/Data/SNA_Description_RandomTable.cs @@ -0,0 +1,12 @@ +namespace BinarySerializer.Ubisoft.CPA { + public class SNA_Description_RandomTable : SNA_Description_Data { + public SNA_Description_RandomDesc Pre_RandomDesc { get; set; } + public int SizeOfTable => Pre_RandomDesc.SizeOfTable; + + public uint[] Table { get; set; } + + public override void SerializeImpl(SerializerObject s) { + Table = s.SerializeArray(Table, SizeOfTable, name: nameof(Table)); + } + } +} diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/SNA/Description/Data/SNA_Description_RandomTable.cs.meta b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/SNA/Description/Data/SNA_Description_RandomTable.cs.meta new file mode 100644 index 00000000..ea160cb2 --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/SNA/Description/Data/SNA_Description_RandomTable.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 22f71fbde401b3d4abed70ff17d4b5b7 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/SNA/Description/Data/SNA_Description_Rectangle.cs b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/SNA/Description/Data/SNA_Description_Rectangle.cs new file mode 100644 index 00000000..b9cb5e5a --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/SNA/Description/Data/SNA_Description_Rectangle.cs @@ -0,0 +1,15 @@ +namespace BinarySerializer.Ubisoft.CPA { + public class SNA_Description_Rectangle : SNA_Description_Data { + public int XMin { get; set; } + public int YMin { get; set; } + public int XMax { get; set; } + public int YMax { get; set; } + + public override void SerializeImpl(SerializerObject s) { + XMin = s.Serialize(XMin, name: nameof(XMin)); + YMin = s.Serialize(YMin, name: nameof(YMin)); + XMax = s.Serialize(XMax, name: nameof(XMax)); + YMax = s.Serialize(YMax, name: nameof(YMax)); + } + } +} diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/SNA/Description/Data/SNA_Description_Rectangle.cs.meta b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/SNA/Description/Data/SNA_Description_Rectangle.cs.meta new file mode 100644 index 00000000..9d82dd79 --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/SNA/Description/Data/SNA_Description_Rectangle.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 3669a30fe812c5245af88f6143763632 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/SNA/Description/Data/SNA_Description_Section.cs b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/SNA/Description/Data/SNA_Description_Section.cs new file mode 100644 index 00000000..3b68c5c3 --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/SNA/Description/Data/SNA_Description_Section.cs @@ -0,0 +1,14 @@ +namespace BinarySerializer.Ubisoft.CPA { + public class SNA_Description_Section : SNA_Description_Data { + public SNA_Description_Item[] Items { get; set; } + + public override void SerializeImpl(SerializerObject s) { + Items = s.SerializeObjectArrayUntil(Items, + i => + (s.CurrentAbsoluteOffset >= s.CurrentLength-3 + || i.Type == SNA_DescriptionType.EndOfDescSection), + onPreSerialize: (i,_) => i.Pre_ParentData = this, + name: nameof(Items)); + } + } +} diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/SNA/Description/Data/SNA_Description_Section.cs.meta b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/SNA/Description/Data/SNA_Description_Section.cs.meta new file mode 100644 index 00000000..29c1de15 --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/SNA/Description/Data/SNA_Description_Section.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: c76bca825c95af54081f5e9e2bc8c858 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/SNA/Description/Data/SNA_Description_SoundBanksArray.cs b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/SNA/Description/Data/SNA_Description_SoundBanksArray.cs new file mode 100644 index 00000000..b9429b27 --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/SNA/Description/Data/SNA_Description_SoundBanksArray.cs @@ -0,0 +1,11 @@ +namespace BinarySerializer.Ubisoft.CPA { + public class SNA_Description_SoundBanksArray : SNA_Description_Data { + public int Count { get; set; } + public int[] SoundBankIndices { get; set; } + + public override void SerializeImpl(SerializerObject s) { + Count = s.Serialize(Count, name: nameof(Count)); + SoundBankIndices = s.SerializeArray(SoundBankIndices, Count, name: nameof(SoundBankIndices)); + } + } +} diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/SNA/Description/Data/SNA_Description_SoundBanksArray.cs.meta b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/SNA/Description/Data/SNA_Description_SoundBanksArray.cs.meta new file mode 100644 index 00000000..5c740e9b --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/SNA/Description/Data/SNA_Description_SoundBanksArray.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 497bec6e03867ec4caa09839b00b5116 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/SNA/Description/Data/SNA_Description_String.cs b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/SNA/Description/Data/SNA_Description_String.cs new file mode 100644 index 00000000..b8863560 --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/SNA/Description/Data/SNA_Description_String.cs @@ -0,0 +1,18 @@ +namespace BinarySerializer.Ubisoft.CPA { + public class SNA_Description_String : SNA_Description_Data { + public ushort Length { get; set; } + public string Value { get; set; } + + public override void SerializeImpl(SerializerObject s) { + if (s.GetCPASettings().EngineVersionTree.HasParent(EngineVersion.CPA_Montreal)) { + Length = s.Serialize((byte)Length, name: nameof(Length)); + } else { + Length = s.Serialize(Length, name: nameof(Length)); + } + Value = s.SerializeString(Value, length: Length, name: nameof(Value)); + } + + public override string ShortLog => Value.ToString(); + public override bool UseShortLog => true; + } +} diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/SNA/Description/Data/SNA_Description_String.cs.meta b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/SNA/Description/Data/SNA_Description_String.cs.meta new file mode 100644 index 00000000..b966bb6b --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/SNA/Description/Data/SNA_Description_String.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 18516e0239e388c4babc975c46215520 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/SNA/Description/Enums.meta b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/SNA/Description/Enums.meta new file mode 100644 index 00000000..cae4c0fc --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/SNA/Description/Enums.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 4d88e646e3ddbe24691e4b834cc1d667 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/SNA/Description/Enums/SNA_DescriptionType.cs b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/SNA/Description/Enums/SNA_DescriptionType.cs new file mode 100644 index 00000000..787564a9 --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/SNA/Description/Enums/SNA_DescriptionType.cs @@ -0,0 +1,126 @@ +namespace BinarySerializer.Ubisoft.CPA { + public enum SNA_DescriptionType : uint { + // From Game.mem + MemoryDescTitle = 0, + GAMFixMemory = 1, + ACPFixMemory = 2, + ACPTextMemory = 3, + AIFixMemory = 4, + TMPFixMemory = 5, + IPTMemory = 6, + SAIFixMemory = 7, + FontMemory = 8, + PositionMemory = 9, + + // From level.mem + GAMLevelMemory = 11, + AILevelMemory = 12, + ACPLevelMemory = 13, + SAILevelMemory = 14, + TMPLevelMemory = 15, + + // From both + ScriptMemory = 16, + + // From game.dsc: level description + LevelNameTitle = 30, + LevelName = 31, + + // From game.dsc and game.rnd: random description + RandomDescTitle = 32, + RandomComputeTable = 33, + RandomReadTable = 34, + + // From game.dsc : Directories description + DirectoryDescTitle = 40, + DirectoryOfEngineDLL = 41, + DirectoryOfGameData = 42, + DirectoryOfTexts = 43, + DirectoryOfWorld = 44, + DirectoryOfLevels = 45, + DirectoryOfFamilies = 46, + DirectoryOfCharacters = 47, + DirectoryOfAnimations = 48, + DirectoryOfGraphicsClasses = 49, + DirectoryOfGraphicsBanks = 50, + DirectoryOfMechanics = 51, + DirectoryOfSound = 52, + DirectoryOfVisuals = 53, + DirectoryOfEnvironment = 54, + DirectoryOfMaterials = 55, + DirectoryOfSaveGame = 56, + DirectoryOfExtras = 57, + DirectoryOfTexture = 58, + DirectoryOfVignettes = 59, + DirectoryOfOptions = 60, + DirectoryOfLipsSync = 61, + DirectoryOfZdx = 62, + DirectoryOfEffects = 63, + + // From game.dsc: big file description + BigFileDescTitle = 64, + BigFileVignettes = 65, + BigFileTextures = 66, + + // From game.pbg & level.pbg: Vignette description + VignetteDescTitle = 70, + LoadVignette = 71, + LoadLevelVignette = 72, + InitVignette = 73, + FreeVignette = 74, + DisplayVignette = 75, + InitBarOutlineColor = 76, + InitBarInsideColor = 77, + InitBarColor = 78, + CreateBar = 79, + AddBar = 80, + MaxValueBar = 81, + + // From level.dsc + LevelDscTitle = 90, + NumberOfAlways = 91, + LevelDscLevelSoundBanks = 92, + LevelLoadMap = 93, + LevelLoadSoundBank = 94, + + // From game.dsc: game options description + GameOptionDescTitle = 100, + DefaultFile = 101, + CurrentFile = 102, + FrameSynchro = 103, + + // from game.dsc, input description + InitInputDeviceManager = 110, + + // from Device.ipt, active devices description + ActivateDeviceTitle = 120, + ActivatePadAction = 121, + ActivateJoystickAction = 122, + ActivateKeyboardAction = 123, + ActivateMouseAction = 124, + + // Final section + EndOfDescSection = 0xffff, + + // Tonic Trouble + TT_MenuMemory = 0x10000 + 2, + TT_FontMemory = 0x10000 + 3, + TT_InventoryMemory = 0x10000 + 13, + TT_LipsSynchMemory = 0x10000 + 16, + TT_PLAMaxSuperObject = 0x10000 + 17, + TT_PLAMaxMatrix = 0x10000 + 18, + TT_BigFileCredits = 0x10000 + 19, + TT_CreditsLevelName = 0x10000 + 22, + TT_SkipMainMenu = 0x10000 + 23, + + // Tonic Trouble (Directories) + DirectoryOfMenu = 0x20000 + 0, + DirectoryOfMenuAnimations = 0x20000 + 1, + DirectoryOfCollideMaterials = 0x20000 + 2, // all DirectoryOfMaterials + DirectoryOfSoundMaterials = 0x20000 + 3, + DirectoryOfMechanicsMaterials = 0x20000 + 4, + DirectoryOfGameMaterials = 0x20000 + 5, + DirectoryOfFixTexture = 0x20000 + 6, + DirectoryOfInventory = 0x20000 + 7, + } +} diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/SNA/Description/Enums/SNA_DescriptionType.cs.meta b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/SNA/Description/Enums/SNA_DescriptionType.cs.meta new file mode 100644 index 00000000..d7b916d2 --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/SNA/Description/Enums/SNA_DescriptionType.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 1269d21ac2d544e4f8268e3f0fa062bc +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/SNA/Description/Montreal.meta b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/SNA/Description/Montreal.meta new file mode 100644 index 00000000..c9a2c866 --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/SNA/Description/Montreal.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 4c45714dbb16d4f45b2b0a744bf9a14d +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/SNA/Description/Montreal/SNA_Description_Montreal_Game.cs b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/SNA/Description/Montreal/SNA_Description_Montreal_Game.cs new file mode 100644 index 00000000..ab0adc0c --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/SNA/Description/Montreal/SNA_Description_Montreal_Game.cs @@ -0,0 +1,38 @@ +namespace BinarySerializer.Ubisoft.CPA { + public class SNA_Description_Montreal_Game : BinarySerializable, SNA_IDescription { + public SNA_Description_String[] Directories { get; set; } + public SNA_Description_String BigFileVignettes { get; set; } + public SNA_Description_String BigFileTextures { get; set; } + public uint RandomTableSize { get; set; } + public byte UseA3b { get; set; } + public byte UseBinaryMod { get; set; } + public SNA_Description_String GameOptionsDefaultFile { get; set; } + public SNA_Description_String GameOptionsCurrentFile { get; set; } + public SNA_Description_String FirstLevelName { get; set; } + + public int DirectoryIndex(SNA_DescriptionType directoryType) { + return Context.GetCPASettings().SNATypes.GetInt(directoryType) - 0x10000; + } + public SNA_DescriptionType DirectoryType(int directoryIndex) { + return Context.GetCPASettings().SNATypes.GetType(directoryIndex + 0x10000); + } + + public override void SerializeImpl(SerializerObject s) { + Directories = s.SerializeObjectArray(Directories, 10, name: nameof(Directories)); + BigFileVignettes = s.SerializeObject(BigFileVignettes, name: nameof(BigFileVignettes)); + BigFileTextures = s.SerializeObject(BigFileTextures, name: nameof(BigFileTextures)); + RandomTableSize = s.Serialize(RandomTableSize, name: nameof(RandomTableSize)); + UseA3b = s.Serialize(UseA3b, name: nameof(UseA3b)); + UseBinaryMod = s.Serialize(UseBinaryMod, name: nameof(UseBinaryMod)); + GameOptionsDefaultFile = s.SerializeObject(GameOptionsDefaultFile, name: nameof(GameOptionsDefaultFile)); + GameOptionsCurrentFile = s.SerializeObject(GameOptionsCurrentFile, name: nameof(GameOptionsCurrentFile)); + FirstLevelName = s.SerializeObject(FirstLevelName, name: nameof(FirstLevelName)); + } + + public string GetDirectory(SNA_DescriptionType type) { + var ind = DirectoryIndex(type); + + return Directories[ind]?.Value; + } + } +} diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/SNA/Description/Montreal/SNA_Description_Montreal_Game.cs.meta b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/SNA/Description/Montreal/SNA_Description_Montreal_Game.cs.meta new file mode 100644 index 00000000..49af928d --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/SNA/Description/Montreal/SNA_Description_Montreal_Game.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: f7d95e28108b90448817d32da5fa4f55 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/SNA/Description/Montreal/SNA_Description_Montreal_LevelPGB.cs b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/SNA/Description/Montreal/SNA_Description_Montreal_LevelPGB.cs new file mode 100644 index 00000000..ec6b5c78 --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/SNA/Description/Montreal/SNA_Description_Montreal_LevelPGB.cs @@ -0,0 +1,38 @@ +namespace BinarySerializer.Ubisoft.CPA { + public class SNA_Description_Montreal_LevelPGB : BinarySerializable { + public uint VignetteNameLength { get; set; } + public string VignetteName { get; set; } + public uint UnknownLength { get; set; } + public string UnknownName { get; set; } + public int YMin { get; set; } + public int YMax { get; set; } + public int XMin { get; set; } + public int XMax { get; set; } + public GLI_FloatColor BarOutlineColor { get; set; } + public GLI_FloatColor BarInsideColor { get; set; } + public SNA_Description_Gradient BarColor { get; set; } + public SNA_Description_Rectangle BarRectangle { get; set; } + public uint MaxValueBar { get; set; } + + public override void SerializeImpl(SerializerObject s) { + VignetteNameLength = s.Serialize(VignetteNameLength, name: nameof(VignetteNameLength)); + s.DoXOR(new SNA_MontrealXORCalculator(3, -7), () => { + VignetteName = s.SerializeString(VignetteName, length: VignetteNameLength, name: nameof(VignetteName)); + }); + UnknownLength = s.Serialize(UnknownLength, name: nameof(UnknownLength)); + s.DoXOR(new SNA_MontrealXORCalculator(6, -11), () => { + UnknownName = s.SerializeString(UnknownName, length: UnknownLength, name: nameof(UnknownName)); + }); + YMin = s.Serialize(YMin, name: nameof(YMin)); + YMax = s.Serialize(YMax, name: nameof(YMax)); + XMin = s.Serialize(XMin, name: nameof(XMin)); + XMax = s.Serialize(XMax, name: nameof(XMax)); + BarOutlineColor = s.SerializeObject(BarOutlineColor, name: nameof(BarOutlineColor)); + BarInsideColor = s.SerializeObject(BarInsideColor, name: nameof(BarInsideColor)); + BarColor = s.SerializeObject(BarColor, name: nameof(BarColor)); + BarRectangle = s.SerializeObject(BarRectangle, name: nameof(BarRectangle)); + MaxValueBar = s.Serialize(MaxValueBar, name: nameof(MaxValueBar)); + + } + } +} diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/SNA/Description/Montreal/SNA_Description_Montreal_LevelPGB.cs.meta b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/SNA/Description/Montreal/SNA_Description_Montreal_LevelPGB.cs.meta new file mode 100644 index 00000000..161e611c --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/SNA/Description/Montreal/SNA_Description_Montreal_LevelPGB.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 842f269354499c3478fa1772a77da2ab +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/SNA/Description/SNA_Description.cs b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/SNA/Description/SNA_Description.cs new file mode 100644 index 00000000..94b05137 --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/SNA/Description/SNA_Description.cs @@ -0,0 +1,46 @@ +using System.Linq; + +namespace BinarySerializer.Ubisoft.CPA { + public class SNA_Description : BinarySerializable, SNA_IDescription { + public SNA_Description_Item[] Items { get; set; } + + public override void SerializeImpl(SerializerObject s) { + Items = s.SerializeObjectArrayUntil(Items, + i => + (s.CurrentAbsoluteOffset >= s.CurrentLength - 3 + || i.Type == SNA_DescriptionType.EndOfDescSection) + , name: nameof(Items)); + } + + public string GetDirectory(SNA_DescriptionType type) { + var directoryDesc = Items + .FirstOrDefault(i => i.Type == SNA_DescriptionType.DirectoryDescTitle)? + .Data as SNA_Description_Section; + if(directoryDesc == null) return null; + + var str = directoryDesc.Items.FirstOrDefault(i => i.Type == type)?.Data as SNA_Description_String; + if(str == null) return null; + + return str.Value; + } + + public int? GetMapIndex(string mapName) { + var levelNameDesc = Items + .FirstOrDefault(i => i.Type == SNA_DescriptionType.LevelNameTitle)? + .Data as SNA_Description_Section; + if (levelNameDesc == null) return null; + + int mapIndex = 0; + var lowerMapName = mapName.ToLowerInvariant(); + foreach (var item in levelNameDesc.Items) { + if (item.Type != SNA_DescriptionType.LevelName) continue; + var name = (SNA_Description_String)item.Data; + if (name.Value.ToLowerInvariant() == lowerMapName) + return mapIndex; + + mapIndex++; + } + return null; + } + } +} diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/SNA/Description/SNA_Description.cs.meta b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/SNA/Description/SNA_Description.cs.meta new file mode 100644 index 00000000..ab72c82a --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/SNA/Description/SNA_Description.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 7c7d15a80f30c6244886c26f2c3e4176 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/SNA/Description/SNA_Description_Item.cs b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/SNA/Description/SNA_Description_Item.cs new file mode 100644 index 00000000..c4f2a161 --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/SNA/Description/SNA_Description_Item.cs @@ -0,0 +1,171 @@ +using System; + +namespace BinarySerializer.Ubisoft.CPA { + public class SNA_Description_Item : BinarySerializable { + public SNA_Description_Data Pre_ParentData { get; set; } + + public int TypeInt { get; set; } + public SNA_DescriptionType Type { + get { + var snaTypes = Context.GetCPASettings().SNATypes; + return snaTypes.GetType(TypeInt); + } + set { + var snaTypes = Context.GetCPASettings().SNATypes; + TypeInt = snaTypes.GetInt(value); + } + } + public SNA_Description_Data Data { get; set; } + + public override void SerializeImpl(SerializerObject s) { + TypeInt = s.Serialize(TypeInt, name: nameof(TypeInt)); + s.Log("Type: {0}", Type); + + var snaTypes = Context.GetCPASettings().SNATypes; + var type = snaTypes.GetType(TypeInt); + + void SerializeData() where T : SNA_Description_Data, new() { + Data = s.SerializeObject((T)Data, name: nameof(Data)); + } + + switch (type) { + case SNA_DescriptionType.MemoryDescTitle: + case SNA_DescriptionType.DirectoryDescTitle: + case SNA_DescriptionType.BigFileDescTitle: + case SNA_DescriptionType.VignetteDescTitle: + case SNA_DescriptionType.LevelDscTitle: + case SNA_DescriptionType.LevelDscLevelSoundBanks: + case SNA_DescriptionType.GameOptionDescTitle: + case SNA_DescriptionType.ActivateDeviceTitle: + SerializeData(); + break; + + case SNA_DescriptionType.RandomDescTitle: + SerializeData(); + break; + + case SNA_DescriptionType.LevelNameTitle: + SerializeData(); + break; + + case SNA_DescriptionType.GAMFixMemory: + case SNA_DescriptionType.ACPFixMemory: + case SNA_DescriptionType.ACPTextMemory: + case SNA_DescriptionType.AIFixMemory: + case SNA_DescriptionType.TMPFixMemory: + case SNA_DescriptionType.IPTMemory: + case SNA_DescriptionType.SAIFixMemory: + case SNA_DescriptionType.FontMemory: + case SNA_DescriptionType.PositionMemory: + case SNA_DescriptionType.GAMLevelMemory: + case SNA_DescriptionType.AILevelMemory: + case SNA_DescriptionType.ACPLevelMemory: + case SNA_DescriptionType.SAILevelMemory: + case SNA_DescriptionType.TMPLevelMemory: + case SNA_DescriptionType.TT_LipsSynchMemory: + case SNA_DescriptionType.TT_PLAMaxSuperObject: + case SNA_DescriptionType.TT_PLAMaxMatrix: + + case SNA_DescriptionType.MaxValueBar: + + case SNA_DescriptionType.InitInputDeviceManager: // HistoricSize + + case SNA_DescriptionType.ActivatePadAction: // PadNumber + case SNA_DescriptionType.ActivateJoystickAction: // PadNumber + + case SNA_DescriptionType.LevelLoadSoundBank: // Bank index + SerializeData(); + break; + + case SNA_DescriptionType.ScriptMemory: + case SNA_DescriptionType.TT_MenuMemory: + case SNA_DescriptionType.TT_InventoryMemory: + case SNA_DescriptionType.TT_FontMemory: + SerializeData(); + break; + + case SNA_DescriptionType.DirectoryOfEngineDLL: + case SNA_DescriptionType.DirectoryOfGameData: + case SNA_DescriptionType.DirectoryOfTexts: + case SNA_DescriptionType.DirectoryOfWorld: + case SNA_DescriptionType.DirectoryOfLevels: + case SNA_DescriptionType.DirectoryOfFamilies: + case SNA_DescriptionType.DirectoryOfCharacters: + case SNA_DescriptionType.DirectoryOfAnimations: + case SNA_DescriptionType.DirectoryOfGraphicsClasses: + case SNA_DescriptionType.DirectoryOfGraphicsBanks: + case SNA_DescriptionType.DirectoryOfMechanics: + case SNA_DescriptionType.DirectoryOfSound: + case SNA_DescriptionType.DirectoryOfVisuals: + case SNA_DescriptionType.DirectoryOfEnvironment: + case SNA_DescriptionType.DirectoryOfMaterials: + case SNA_DescriptionType.DirectoryOfSaveGame: + case SNA_DescriptionType.DirectoryOfExtras: + case SNA_DescriptionType.DirectoryOfTexture: + case SNA_DescriptionType.DirectoryOfVignettes: + case SNA_DescriptionType.DirectoryOfOptions: + case SNA_DescriptionType.DirectoryOfLipsSync: + case SNA_DescriptionType.DirectoryOfZdx: + case SNA_DescriptionType.DirectoryOfEffects: + + case SNA_DescriptionType.BigFileVignettes: + case SNA_DescriptionType.BigFileTextures: + case SNA_DescriptionType.TT_BigFileCredits: + + case SNA_DescriptionType.LoadVignette: + case SNA_DescriptionType.LoadLevelVignette: + + case SNA_DescriptionType.DefaultFile: + case SNA_DescriptionType.CurrentFile: + + case SNA_DescriptionType.LevelName: + case SNA_DescriptionType.TT_CreditsLevelName: + SerializeData(); + break; + + case SNA_DescriptionType.InitBarOutlineColor: + case SNA_DescriptionType.InitBarInsideColor: + SerializeData(); + break; + + case SNA_DescriptionType.InitBarColor: + SerializeData(); + break; + + case SNA_DescriptionType.CreateBar: + SerializeData(); + break; + + case SNA_DescriptionType.RandomReadTable: + Data = s.SerializeObject( + (SNA_Description_RandomTable)Data, + onPreSerialize: t => t.Pre_RandomDesc = (SNA_Description_RandomDesc)Pre_ParentData, + name: nameof(Data)); + break; + + case SNA_DescriptionType.FrameSynchro: + SerializeData(); + break; + + case SNA_DescriptionType.LevelLoadMap: + SerializeData(); + break; + + case SNA_DescriptionType.EndOfDescSection: + + case SNA_DescriptionType.InitVignette: + case SNA_DescriptionType.FreeVignette: + case SNA_DescriptionType.DisplayVignette: + case SNA_DescriptionType.AddBar: + + case SNA_DescriptionType.ActivateKeyboardAction: + case SNA_DescriptionType.ActivateMouseAction: + + case SNA_DescriptionType.RandomComputeTable: + break; + default: + throw new NotImplementedException(); + } + } + } +} diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/SNA/Description/SNA_Description_Item.cs.meta b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/SNA/Description/SNA_Description_Item.cs.meta new file mode 100644 index 00000000..bdc8cf85 --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/SNA/Description/SNA_Description_Item.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 2d277c256fec3c447a0a1c6e4534dec4 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/SNA/Description/SNA_IDescription.cs b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/SNA/Description/SNA_IDescription.cs new file mode 100644 index 00000000..c6dd81c7 --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/SNA/Description/SNA_IDescription.cs @@ -0,0 +1,5 @@ +namespace BinarySerializer.Ubisoft.CPA { + public interface SNA_IDescription { + public string GetDirectory(SNA_DescriptionType type); + } +} diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/SNA/Description/SNA_IDescription.cs.meta b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/SNA/Description/SNA_IDescription.cs.meta new file mode 100644 index 00000000..b24ff932 --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/SNA/Description/SNA_IDescription.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 62141a08cf28ab048b641dfbf3cdfde6 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/SNA/Description/TonicTrouble.meta b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/SNA/Description/TonicTrouble.meta new file mode 100644 index 00000000..16a2e577 --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/SNA/Description/TonicTrouble.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 43cc68a2daf162144b2db4c917e70054 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/SNA/Description/TonicTrouble/SNA_Description_TT_Game.cs b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/SNA/Description/TonicTrouble/SNA_Description_TT_Game.cs new file mode 100644 index 00000000..7adfe9bb --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/SNA/Description/TonicTrouble/SNA_Description_TT_Game.cs @@ -0,0 +1,38 @@ +namespace BinarySerializer.Ubisoft.CPA { + public class SNA_Description_TT_Game : SNA_Description_TT_Level, SNA_IDescription { + public SNA_Description_String[] Directories { get; set; } + public SNA_Description_Section BigFiles { get; set; } + public SNA_Description_String LoadVignette { get; set; } + public SNA_Description_String InputDeviceFile { get; set; } + public SNA_Description_TT_Text Text { get; set; } + public SNA_Description_Section GameOptionsFile { get; set; } + public SNA_Description_String Unknown { get; set; } // First level index? + public SNA_Description_String FirstLevelName { get; set; } + + public int DirectoryIndex(SNA_DescriptionType directoryType) { + return Context.GetCPASettings().SNATypes.GetInt(directoryType) - 0x10000; + } + public SNA_DescriptionType DirectoryType(int directoryIndex) { + return Context.GetCPASettings().SNATypes.GetType(directoryIndex + 0x10000); + } + + public override void SerializeImpl(SerializerObject s) { + base.SerializeImpl(s); + Directories = s.SerializeObjectArray(Directories, 30, name: nameof(Directories)); + BigFiles = s.SerializeObject(BigFiles, name: nameof(BigFiles)); + LoadVignette = s.SerializeObject(LoadVignette, name: nameof(LoadVignette)); + InputDeviceFile = s.SerializeObject(InputDeviceFile, name: nameof(InputDeviceFile)); + Text = s.SerializeObject(Text, name: nameof(Text)); + GameOptionsFile = s.SerializeObject(GameOptionsFile, name: nameof(GameOptionsFile)); + Unknown = s.SerializeObject(Unknown, name: nameof(Unknown)); + FirstLevelName = s.SerializeObject(FirstLevelName, name: nameof(FirstLevelName)); + } + + + public string GetDirectory(SNA_DescriptionType type) { + var ind = DirectoryIndex(type); + + return Directories[ind]?.Value; + } + } +} diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/SNA/Description/TonicTrouble/SNA_Description_TT_Game.cs.meta b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/SNA/Description/TonicTrouble/SNA_Description_TT_Game.cs.meta new file mode 100644 index 00000000..ff81b703 --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/SNA/Description/TonicTrouble/SNA_Description_TT_Game.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 08e1567d0cc3894429e413eba2f7986d +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/SNA/Description/TonicTrouble/SNA_Description_TT_Level.cs b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/SNA/Description/TonicTrouble/SNA_Description_TT_Level.cs new file mode 100644 index 00000000..e030e5c9 --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/SNA/Description/TonicTrouble/SNA_Description_TT_Level.cs @@ -0,0 +1,11 @@ +namespace BinarySerializer.Ubisoft.CPA { + public class SNA_Description_TT_Level : BinarySerializable { + public SNA_Description_Section Memory { get; set; } + public uint MemorySnapShot { get; set; } + + public override void SerializeImpl(SerializerObject s) { + Memory = s.SerializeObject(Memory, name: nameof(Memory)); + MemorySnapShot = s.Serialize(MemorySnapShot, name: nameof(MemorySnapShot)); + } + } +} diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/SNA/Description/TonicTrouble/SNA_Description_TT_Level.cs.meta b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/SNA/Description/TonicTrouble/SNA_Description_TT_Level.cs.meta new file mode 100644 index 00000000..83946a94 --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/SNA/Description/TonicTrouble/SNA_Description_TT_Level.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 2e70ed2421952ac4897b228fdd2419cc +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/SNA/Description/TonicTrouble/SNA_Description_TT_Text.cs b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/SNA/Description/TonicTrouble/SNA_Description_TT_Text.cs new file mode 100644 index 00000000..0193c81f --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/SNA/Description/TonicTrouble/SNA_Description_TT_Text.cs @@ -0,0 +1,62 @@ +namespace BinarySerializer.Ubisoft.CPA { + public class SNA_Description_TT_Text : BinarySerializable { + public uint MaxStringCount { get; set; } + public File[] Files { get; set; } + + public override void SerializeImpl(SerializerObject s) { + MaxStringCount = s.Serialize(MaxStringCount, name: nameof(MaxStringCount)); + Files = s.SerializeObjectArrayUntil(Files, f => f.IsLastFile, name: nameof(Files)); + } + + public class File : BinarySerializable { + public SNA_Description_String FileName { get; set; } + public Entry[] Entries { get; set; } + + public const string EndFile = "ENDTXT"; + public bool IsLastFile => FileName.Value == EndFile; + + public override void SerializeImpl(SerializerObject s) { + FileName = s.SerializeObject(FileName, name: nameof(FileName)); + if (!IsLastFile) { + Entries = s.SerializeObjectArrayUntil(Entries, f => f.IsLastEntry, name: nameof(Files)); + } + } + } + + public class Entry : BinarySerializable { + public SNA_Description_String Command { get; set; } + + public SNA_Description_String Key { get; set; } + public SNA_Description_String StringValue { get; set; } + public SNA_Description_String Type { get; set; } + public uint StringLengthValue { get; set; } + + public const string EndCommand = "END"; + public const string NewStringLength = "NewStringLenght"; + public const string NewString = "NewString"; + public const string NewUpperString = "NewUpperString"; + public bool IsLastEntry => Command.Value == EndCommand; + + public override void SerializeImpl(SerializerObject s) { + Command = s.SerializeObject(Command, name: nameof(Command)); + switch (Command.Value) { + case NewString: + case NewUpperString: + Key = s.SerializeObject(Key, name: nameof(Key)); + StringValue = s.SerializeObject(StringValue, name: nameof(StringValue)); + Type = s.SerializeObject(Type, name: nameof(Type)); + break; + case NewStringLength: + Key = s.SerializeObject(Key, name: nameof(Key)); + StringLengthValue = s.Serialize(StringLengthValue, name: nameof(StringLengthValue)); + Type = s.SerializeObject(Type, name: nameof(Type)); + break; + case EndCommand: + break; + default: + throw new BinarySerializableException(this, $"Unimplemented command {Command.Value}"); + } + } + } + } +} diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/SNA/Description/TonicTrouble/SNA_Description_TT_Text.cs.meta b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/SNA/Description/TonicTrouble/SNA_Description_TT_Text.cs.meta new file mode 100644 index 00000000..c21b6c3b --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/SNA/Description/TonicTrouble/SNA_Description_TT_Text.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: ce1ed75f17724624ea74f8aa4382f446 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/SNA/Description/Types.meta b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/SNA/Description/Types.meta new file mode 100644 index 00000000..a9209399 --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/SNA/Description/Types.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 67ac10658cc140c45a519e63cefbd37f +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/SNA/Description/Types/SNA_Types.cs b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/SNA/Description/Types/SNA_Types.cs new file mode 100644 index 00000000..eaffac1e --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/SNA/Description/Types/SNA_Types.cs @@ -0,0 +1,25 @@ +using System.Collections.Generic; + +namespace BinarySerializer.Ubisoft.CPA { + public abstract class SNA_Types { + public Dictionary DSBTypes { get; protected set; } + public Dictionary DSBTypes_Reverse { get; protected set; } + + public void Init() { + InitArrays(); + CreateDictionaries(); + } + + protected abstract void InitArrays(); + + private void CreateDictionaries() { + DSBTypes_Reverse = new Dictionary(); + foreach (var kv in DSBTypes) { + DSBTypes_Reverse[kv.Value] = kv.Key; + } + } + + public SNA_DescriptionType GetType(int type) => DSBTypes[type]; + public int GetInt(SNA_DescriptionType type) => DSBTypes_Reverse[type]; + } +} diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/SNA/Description/Types/SNA_Types.cs.meta b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/SNA/Description/Types/SNA_Types.cs.meta new file mode 100644 index 00000000..827a524b --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/SNA/Description/Types/SNA_Types.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 82619b917b1e8044c9a2534e719f8d06 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/SNA/Description/Types/SNA_Types_Montreal.cs b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/SNA/Description/Types/SNA_Types_Montreal.cs new file mode 100644 index 00000000..ad0d070b --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/SNA/Description/Types/SNA_Types_Montreal.cs @@ -0,0 +1,22 @@ +using System.Collections.Generic; + +namespace BinarySerializer.Ubisoft.CPA { + public class SNA_Types_Montreal : SNA_Types { + protected override void InitArrays() { + DSBTypes = new Dictionary() { + [0xffff] = SNA_DescriptionType.EndOfDescSection, + + [0x10000] = SNA_DescriptionType.DirectoryOfEngineDLL, + [0x10001] = SNA_DescriptionType.DirectoryOfGameData, + [0x10002] = SNA_DescriptionType.DirectoryOfWorld, + [0x10003] = SNA_DescriptionType.DirectoryOfLevels, + [0x10004] = SNA_DescriptionType.DirectoryOfSound, + [0x10005] = SNA_DescriptionType.DirectoryOfSaveGame, + [0x10006] = SNA_DescriptionType.DirectoryOfTexture, + [0x10007] = SNA_DescriptionType.DirectoryOfFixTexture, + [0x10008] = SNA_DescriptionType.DirectoryOfVignettes, + [0x10009] = SNA_DescriptionType.DirectoryOfOptions, + }; + } + } +} diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/SNA/Description/Types/SNA_Types_Montreal.cs.meta b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/SNA/Description/Types/SNA_Types_Montreal.cs.meta new file mode 100644 index 00000000..cfd4cbb9 --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/SNA/Description/Types/SNA_Types_Montreal.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 7ff3ad3c014e67e41a097d73bb93e422 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/SNA/Description/Types/SNA_Types_R2.cs b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/SNA/Description/Types/SNA_Types_R2.cs new file mode 100644 index 00000000..dffca501 --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/SNA/Description/Types/SNA_Types_R2.cs @@ -0,0 +1,19 @@ +using System.Collections.Generic; + +namespace BinarySerializer.Ubisoft.CPA { + public class SNA_Types_R2 : SNA_Types_R2_Demo { + protected override void InitArrays() { + base.InitArrays(); + for (int i = 43; i <= 63; i++) { + DSBTypes.Remove(i); + } + DSBTypes[43] = SNA_DescriptionType.DirectoryOfWorld; + DSBTypes[44] = SNA_DescriptionType.DirectoryOfLevels; + DSBTypes[45] = SNA_DescriptionType.DirectoryOfSound; // And GraphicsClasses for some reason. And this directory/languageID as 2nd sound path + DSBTypes[46] = SNA_DescriptionType.DirectoryOfSaveGame; + DSBTypes[47] = SNA_DescriptionType.DirectoryOfTexture; + DSBTypes[48] = SNA_DescriptionType.DirectoryOfVignettes; + DSBTypes[49] = SNA_DescriptionType.DirectoryOfOptions; + } + } +} diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/SNA/Description/Types/SNA_Types_R2.cs.meta b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/SNA/Description/Types/SNA_Types_R2.cs.meta new file mode 100644 index 00000000..3a6260ae --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/SNA/Description/Types/SNA_Types_R2.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 7e278c1ccd5b86b42b12803fd7f6bfec +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/SNA/Description/Types/SNA_Types_R2_Demo.cs b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/SNA/Description/Types/SNA_Types_R2_Demo.cs new file mode 100644 index 00000000..ae5c5f2b --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/SNA/Description/Types/SNA_Types_R2_Demo.cs @@ -0,0 +1,111 @@ +using System.Collections.Generic; + +namespace BinarySerializer.Ubisoft.CPA { + public class SNA_Types_R2_Demo : SNA_Types { + protected override void InitArrays() { + DSBTypes = new Dictionary() { + // From Game.mem + [0] = SNA_DescriptionType.MemoryDescTitle, + [1] = SNA_DescriptionType.GAMFixMemory, + [2] = SNA_DescriptionType.ACPFixMemory, + [3] = SNA_DescriptionType.ACPTextMemory, + [4] = SNA_DescriptionType.AIFixMemory, + [5] = SNA_DescriptionType.TMPFixMemory, + [6] = SNA_DescriptionType.IPTMemory, + [7] = SNA_DescriptionType.SAIFixMemory, + [8] = SNA_DescriptionType.FontMemory, + [9] = SNA_DescriptionType.PositionMemory, + + // From level.mem + [11] = SNA_DescriptionType.GAMLevelMemory, + [12] = SNA_DescriptionType.AILevelMemory, + [13] = SNA_DescriptionType.ACPLevelMemory, + [14] = SNA_DescriptionType.SAILevelMemory, + [15] = SNA_DescriptionType.TMPLevelMemory, + + // From both + [16] = SNA_DescriptionType.ScriptMemory, + + // From game.dsc: level description + [30] = SNA_DescriptionType.LevelNameTitle, + [31] = SNA_DescriptionType.LevelName, + + // From game.dsc and game.rnd: random description + [32] = SNA_DescriptionType.RandomDescTitle, + [33] = SNA_DescriptionType.RandomComputeTable, + [34] = SNA_DescriptionType.RandomReadTable, + + // From game.dsc : Directories description + [40] = SNA_DescriptionType.DirectoryDescTitle, + [41] = SNA_DescriptionType.DirectoryOfEngineDLL, + [42] = SNA_DescriptionType.DirectoryOfGameData, + [43] = SNA_DescriptionType.DirectoryOfTexts, + [44] = SNA_DescriptionType.DirectoryOfWorld, + [45] = SNA_DescriptionType.DirectoryOfLevels, + [46] = SNA_DescriptionType.DirectoryOfFamilies, + [47] = SNA_DescriptionType.DirectoryOfCharacters, + [48] = SNA_DescriptionType.DirectoryOfAnimations, + [49] = SNA_DescriptionType.DirectoryOfGraphicsClasses, + [50] = SNA_DescriptionType.DirectoryOfGraphicsBanks, + [51] = SNA_DescriptionType.DirectoryOfMechanics, + [52] = SNA_DescriptionType.DirectoryOfSound, + [53] = SNA_DescriptionType.DirectoryOfVisuals, + [54] = SNA_DescriptionType.DirectoryOfEnvironment, + [55] = SNA_DescriptionType.DirectoryOfMaterials, + [56] = SNA_DescriptionType.DirectoryOfSaveGame, + [57] = SNA_DescriptionType.DirectoryOfExtras, + [58] = SNA_DescriptionType.DirectoryOfTexture, + [59] = SNA_DescriptionType.DirectoryOfVignettes, + [60] = SNA_DescriptionType.DirectoryOfOptions, + [61] = SNA_DescriptionType.DirectoryOfLipsSync, + [62] = SNA_DescriptionType.DirectoryOfZdx, + [63] = SNA_DescriptionType.DirectoryOfEffects, + + // From game.dsc: big file description + [64] = SNA_DescriptionType.BigFileDescTitle, + [65] = SNA_DescriptionType.BigFileVignettes, + [66] = SNA_DescriptionType.BigFileTextures, + + // From game.pbg & level.pbg: Vignette description + [70] = SNA_DescriptionType.VignetteDescTitle, + [71] = SNA_DescriptionType.LoadVignette, + [72] = SNA_DescriptionType.LoadLevelVignette, + [73] = SNA_DescriptionType.InitVignette, + [74] = SNA_DescriptionType.FreeVignette, + [75] = SNA_DescriptionType.DisplayVignette, + [76] = SNA_DescriptionType.InitBarOutlineColor, + [77] = SNA_DescriptionType.InitBarInsideColor, + [78] = SNA_DescriptionType.InitBarColor, + [79] = SNA_DescriptionType.CreateBar, + [80] = SNA_DescriptionType.AddBar, + [81] = SNA_DescriptionType.MaxValueBar, + + // From level.dsc + [90] = SNA_DescriptionType.LevelDscTitle, + [91] = SNA_DescriptionType.NumberOfAlways, + [92] = SNA_DescriptionType.LevelDscLevelSoundBanks, + [93] = SNA_DescriptionType.LevelLoadMap, + [94] = SNA_DescriptionType.LevelLoadSoundBank, + + // From game.dsc: game options description + [100] = SNA_DescriptionType.GameOptionDescTitle, + [101] = SNA_DescriptionType.DefaultFile, + [102] = SNA_DescriptionType.CurrentFile, + [103] = SNA_DescriptionType.FrameSynchro, + + // from game.dsc, input description + [110] = SNA_DescriptionType.InitInputDeviceManager, + + // from Device.ipt, active devices description + [120] = SNA_DescriptionType.ActivateDeviceTitle, + [121] = SNA_DescriptionType.ActivatePadAction, + [122] = SNA_DescriptionType.ActivateJoystickAction, + [123] = SNA_DescriptionType.ActivateKeyboardAction, + [124] = SNA_DescriptionType.ActivateMouseAction, + + // Final section + [0xffff] = SNA_DescriptionType.EndOfDescSection, + }; + } + } +} diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/SNA/Description/Types/SNA_Types_R2_Demo.cs.meta b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/SNA/Description/Types/SNA_Types_R2_Demo.cs.meta new file mode 100644 index 00000000..e0dd0720 --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/SNA/Description/Types/SNA_Types_R2_Demo.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 878f41f688f7ef44595cb08fc3be4304 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/SNA/Description/Types/SNA_Types_TT.cs b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/SNA/Description/Types/SNA_Types_TT.cs new file mode 100644 index 00000000..b9e95fce --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/SNA/Description/Types/SNA_Types_TT.cs @@ -0,0 +1,74 @@ +using System.Collections.Generic; + +namespace BinarySerializer.Ubisoft.CPA { + public class SNA_Types_TT : SNA_Types { + protected override void InitArrays() { + DSBTypes = new Dictionary() { + // Memory + [0] = SNA_DescriptionType.GAMFixMemory, + [1] = SNA_DescriptionType.GAMLevelMemory, + [2] = SNA_DescriptionType.TT_MenuMemory, + [3] = SNA_DescriptionType.TT_FontMemory, + [4] = SNA_DescriptionType.SAIFixMemory, + [5] = SNA_DescriptionType.SAILevelMemory, + [6] = SNA_DescriptionType.AIFixMemory, + [7] = SNA_DescriptionType.AILevelMemory, + [8] = SNA_DescriptionType.TMPFixMemory, + [9] = SNA_DescriptionType.TMPLevelMemory, + [10] = SNA_DescriptionType.ACPTextMemory, + [11] = SNA_DescriptionType.ACPFixMemory, + [12] = SNA_DescriptionType.ACPLevelMemory, + [13] = SNA_DescriptionType.TT_InventoryMemory, + [14] = SNA_DescriptionType.PositionMemory, + [15] = SNA_DescriptionType.ScriptMemory, + [16] = SNA_DescriptionType.TT_LipsSynchMemory, + [17] = SNA_DescriptionType.TT_PLAMaxSuperObject, + [18] = SNA_DescriptionType.TT_PLAMaxMatrix, + + // BigFiles + [19] = SNA_DescriptionType.BigFileVignettes, + [20] = SNA_DescriptionType.BigFileTextures, + [21] = SNA_DescriptionType.TT_BigFileCredits, + + // GameOptionsFile + [22] = SNA_DescriptionType.TT_CreditsLevelName, + [23] = SNA_DescriptionType.TT_SkipMainMenu, + [24] = SNA_DescriptionType.DefaultFile, + [25] = SNA_DescriptionType.CurrentFile, + + [0xffff] = SNA_DescriptionType.EndOfDescSection, + + [0x10000] = SNA_DescriptionType.DirectoryOfEngineDLL, + [0x10001] = SNA_DescriptionType.DirectoryOfMenu, + [0x10002] = SNA_DescriptionType.DirectoryOfMenuAnimations, + [0x10003] = SNA_DescriptionType.DirectoryOfGameData, + [0x10004] = SNA_DescriptionType.DirectoryOfTexts, + [0x10005] = SNA_DescriptionType.DirectoryOfWorld, + [0x10006] = SNA_DescriptionType.DirectoryOfLevels, + [0x10007] = SNA_DescriptionType.DirectoryOfFamilies, + [0x10008] = SNA_DescriptionType.DirectoryOfCharacters, + [0x10009] = SNA_DescriptionType.DirectoryOfAnimations, + [0x1000A] = SNA_DescriptionType.DirectoryOfGraphicsClasses, + [0x1000B] = SNA_DescriptionType.DirectoryOfGraphicsBanks, + [0x1000C] = SNA_DescriptionType.DirectoryOfMechanics, + [0x1000D] = SNA_DescriptionType.DirectoryOfSound, + [0x1000E] = SNA_DescriptionType.DirectoryOfVisuals, + [0x1000F] = SNA_DescriptionType.DirectoryOfEnvironment, + [0x10010] = SNA_DescriptionType.DirectoryOfCollideMaterials, // all DirectoryOfMaterials + [0x10011] = SNA_DescriptionType.DirectoryOfSoundMaterials, + [0x10012] = SNA_DescriptionType.DirectoryOfMechanicsMaterials, + [0x10013] = SNA_DescriptionType.DirectoryOfGameMaterials, + [0x10014] = SNA_DescriptionType.DirectoryOfSaveGame, + [0x10015] = SNA_DescriptionType.DirectoryOfExtras, + [0x10016] = SNA_DescriptionType.DirectoryOfTexture, + [0x10017] = SNA_DescriptionType.DirectoryOfFixTexture, + [0x10018] = SNA_DescriptionType.DirectoryOfVignettes, + [0x10019] = SNA_DescriptionType.DirectoryOfOptions, + [0x1001A] = SNA_DescriptionType.DirectoryOfLipsSync, + [0x1001B] = SNA_DescriptionType.DirectoryOfZdx, + [0x1001C] = SNA_DescriptionType.DirectoryOfEffects, + [0x1001D] = SNA_DescriptionType.DirectoryOfInventory, + }; + } + } +} diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/SNA/Description/Types/SNA_Types_TT.cs.meta b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/SNA/Description/Types/SNA_Types_TT.cs.meta new file mode 100644 index 00000000..5cc351bd --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/SNA/Description/Types/SNA_Types_TT.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 1e943d179fe1d8f4aa0c54a60c8158ff +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/SNA/Relocation.meta b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/SNA/Relocation.meta new file mode 100644 index 00000000..cf852753 --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/SNA/Relocation.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 47b52426d41362a428e1a1541da80d8b +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/SNA/Relocation/Enums.meta b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/SNA/Relocation/Enums.meta new file mode 100644 index 00000000..bf7ff18d --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/SNA/Relocation/Enums.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 0da626297be518b4da9ba8fef13c859b +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/SNA/Relocation/Enums/SNA_RelocationType.cs b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/SNA/Relocation/Enums/SNA_RelocationType.cs new file mode 100644 index 00000000..b8d13b1f --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/SNA/Relocation/Enums/SNA_RelocationType.cs @@ -0,0 +1,13 @@ +namespace BinarySerializer.Ubisoft.CPA { + public enum SNA_RelocationType { + SNA = 0, + GlobalPointers = 1, // Global Pointer file (GPT) + Sound = 2, + Textures = 3, // Texture file (PTX) + // ^ in Rayman 2 | v Not in Rayman 2 + LipsSync = 4, + Dialog = 5, // Language pointer file (DLG) + RTG = 6, // Language-specific SNA blocks (lng) + Video = 7, + } +} diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/SNA/Relocation/Enums/SNA_RelocationType.cs.meta b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/SNA/Relocation/Enums/SNA_RelocationType.cs.meta new file mode 100644 index 00000000..f0b081c5 --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/SNA/Relocation/Enums/SNA_RelocationType.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 98237fe5fd272414ab9e59c3d131af24 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/SNA/Relocation/SNA_RelocationBigFile.cs b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/SNA/Relocation/SNA_RelocationBigFile.cs new file mode 100644 index 00000000..0186faae --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/SNA/Relocation/SNA_RelocationBigFile.cs @@ -0,0 +1,126 @@ +using System; +using System.Threading.Tasks; + +namespace BinarySerializer.Ubisoft.CPA { + // PC Protection + public class SNA_RelocationBigFile : BinarySerializable { + public static uint MainHeaderSize => 8*4; + + public uint RelocationTablesCount { get; set; } // = MapsCount * 4 + public uint OccurCount { get; set; } + public uint HeaderStep { get; set; } + public uint FirstHeaderSize { get; set; } + public uint FileStep { get; set; } + public uint SectorSize { get; set; } + public uint SectorsCount { get; set; } + public uint ConnectedFilesCount { get; set; } + + public Pointer[] Occurs { get; set; } + + public override void SerializeImpl(SerializerObject s) { + s.DoEncoded(new PTC_BigFileEncoder(MainHeaderSize), () => { + if (s.GetCPASettings().EngineVersionTree.HasParent(EngineVersion.Rayman2)) { + // Different order in R2 + HeaderStep = s.Serialize(HeaderStep, name: nameof(HeaderStep)); // Unclear. Could be FileStep too + SectorsCount = s.Serialize(SectorsCount, name: nameof(SectorsCount)); + RelocationTablesCount = s.Serialize(RelocationTablesCount, name: nameof(RelocationTablesCount)); + FileStep = s.Serialize(FileStep, name: nameof(FileStep)); // Unclear. Could be HeaderStep too + OccurCount = s.Serialize(OccurCount, name: nameof(OccurCount)); + ConnectedFilesCount = s.Serialize(ConnectedFilesCount, name: nameof(ConnectedFilesCount)); + FirstHeaderSize = s.Serialize(FirstHeaderSize, name: nameof(FirstHeaderSize)); + SectorSize = s.Serialize(SectorSize, name: nameof(SectorSize)); + } else { + RelocationTablesCount = s.Serialize(RelocationTablesCount, name: nameof(RelocationTablesCount)); + OccurCount = s.Serialize(OccurCount, name: nameof(OccurCount)); + HeaderStep = s.Serialize(HeaderStep, name: nameof(HeaderStep)); + FirstHeaderSize = s.Serialize(FirstHeaderSize, name: nameof(FirstHeaderSize)); + FileStep = s.Serialize(FileStep, name: nameof(FileStep)); + SectorSize = s.Serialize(SectorSize, name: nameof(SectorSize)); + SectorsCount = s.Serialize(SectorsCount, name: nameof(SectorsCount)); + ConnectedFilesCount = s.Serialize(ConnectedFilesCount, name: nameof(ConnectedFilesCount)); + } + }); + } + + public async Task SerializeOccur(SerializerObject s, int i) { + if(Occurs == null) Occurs = new Pointer[OccurCount]; + Occurs[i] = GetOccurOffset(i); + Pointer curPos = s.CurrentPointer; + s.Goto(Occurs[i]); + await s.FillCacheForReadAsync(RelocationTablesCount * 4 + PTC_BigFileEncoder.KeysSize); + s.Goto(curPos); + Occurs[i].Resolve(s, onPreSerialize: o => o.Pre_OffsetsCount = RelocationTablesCount); + } + + public async Task SerializeRelocationTable(SerializerObject s, SNA_RelocationTable table, int occur, int mapNumber, SNA_RelocationType type) { + if((int)type < 0 || (int)type > 3) + throw new Exception($"Invalid relocation type: {type}"); + + uint GetKey() { + long key = 0; + key = BitHelpers.SetBits64(key, mapNumber, 8, 0); + key = BitHelpers.SetBits64(key, (int)type, 8, 8); + key = BitHelpers.SetBits64(key, occur, 8, 16); + key = BitHelpers.SetBits64(key, ~occur, 8, 24); + return (uint)key; + } + + if(Occurs == null || Occurs[occur] == null) await SerializeOccur(s, occur); + + var off = Occurs[occur].Value.Entries[mapNumber * 4 + (int)type]; + var key = GetKey(); + uint ProtectionKey = SNA_XORCalculator.GetProtectionKey(key); + var oldProtectionKey = ProtectionKey; + SNA_RelocationTable RelocationTable = table; + + Pointer curOff = s.CurrentPointer; + try { + s.Goto(off); + await s.FillCacheForReadAsync(1024 * 1024); // 1 MB cache + s.DoXOR(new SNA_XORCalculator(SNA_XORCalculator.GetCryptKey(key)), () => { + ProtectionKey = s.Serialize(ProtectionKey, name: nameof(ProtectionKey)); + if (oldProtectionKey != ProtectionKey) { + s.LogWarning($"SNA: Incorrect protection key algorithm. Calculated {oldProtectionKey:X8}, but read {ProtectionKey}"); + } + RelocationTable = s.SerializeObject(RelocationTable, name: nameof(RelocationTable)); + }); + } finally { + s.Goto(curOff); + } + + return RelocationTable; + } + + public Pointer GetOccurOffset(int occur) { + occur = occur % (int)OccurCount; + + // Sinus header + double a = 0.69314; + double b = 1.69314; + double c = 0.52658; + double n = 1.06913; + + for (int i = 0; i < occur; i++) { + n = n + a * Math.Abs(Math.Sin(b * i * i)) + c; + } + double value = Math.Floor((n % 1.0) * 1000000.0) / 1000000.0; + return new Pointer(Offset + SectorSize * (uint)Math.Floor(value * SectorsCount) + FirstHeaderSize); + } + + public class OffsetTable : BinarySerializable { + public uint Pre_OffsetsCount { get; set; } + + public Pointer[] Entries { get; set; } + + public override void SerializeImpl(SerializerObject s) { + s.DoEncoded(new PTC_BigFileEncoder(Pre_OffsetsCount * 4), () => { + s.DoWithDefaults(new SerializerDefaults() { + PointerFile = Offset.File + }, () => { + Entries = s.SerializePointerArray(Entries, Pre_OffsetsCount, name: nameof(Entries)); + }); + }); + } + } + } +} diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/SNA/Relocation/SNA_RelocationBigFile.cs.meta b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/SNA/Relocation/SNA_RelocationBigFile.cs.meta new file mode 100644 index 00000000..ddbc76d4 --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/SNA/Relocation/SNA_RelocationBigFile.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 8b6fedfc58208514e9889277cd238c14 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/SNA/Relocation/SNA_RelocationTable.cs b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/SNA/Relocation/SNA_RelocationTable.cs new file mode 100644 index 00000000..b0f13160 --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/SNA/Relocation/SNA_RelocationTable.cs @@ -0,0 +1,30 @@ +namespace BinarySerializer.Ubisoft.CPA { + public class SNA_RelocationTable : BinarySerializable { + public byte BlocksCount { get; set; } + public uint Checksum { get; set; } + public SNA_RelocationTableBlock[] Blocks { get; set; } + + public override void SerializeImpl(SerializerObject s) { + BlocksCount = s.Serialize(BlocksCount, name: nameof(BlocksCount)); + + if (s.GetCPASettings().EngineVersionTree.HasParent(EngineVersion.Rayman2)) + Checksum = s.Serialize(Checksum, name: nameof(Checksum)); + + Blocks = s.SerializeObjectArray(Blocks, BlocksCount, name: nameof(Blocks)); + } + + public static string GetExtension(SNA_RelocationType type) { + return type switch { + SNA_RelocationType.SNA => "rtb", + SNA_RelocationType.GlobalPointers => "rtp", + SNA_RelocationType.Sound => "rts", + SNA_RelocationType.Textures => "rtt", + SNA_RelocationType.LipsSync => "rtl", + SNA_RelocationType.Dialog => "rtd", + SNA_RelocationType.RTG => "rtg", + SNA_RelocationType.Video => "rtv", + _ => null + }; + } + } +} diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/SNA/Relocation/SNA_RelocationTable.cs.meta b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/SNA/Relocation/SNA_RelocationTable.cs.meta new file mode 100644 index 00000000..f2bb32c4 --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/SNA/Relocation/SNA_RelocationTable.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 483b0e24bf3f22a46ad0678b37bc7062 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/SNA/Relocation/SNA_RelocationTableBlock.cs b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/SNA/Relocation/SNA_RelocationTableBlock.cs new file mode 100644 index 00000000..dea19085 --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/SNA/Relocation/SNA_RelocationTableBlock.cs @@ -0,0 +1,23 @@ +using System; +using System.Threading.Tasks; + +namespace BinarySerializer.Ubisoft.CPA { + public class SNA_RelocationTableBlock : BinarySerializable { + public byte Module { get; set; } + public byte Block { get; set; } + public uint Count { get; set; } + + public SNA_RelocationTablePointer[] Pointers { get; set; } + + + public override void SerializeImpl(SerializerObject s) { + Module = s.Serialize(Module, name: nameof(Module)); + Block = s.Serialize(Block, name: nameof(Block)); + Count = s.Serialize(Count, name: nameof(Count)); + + s.DoEncoded(SNA_LZOEncoder.GetIfRequired(s.GetCPASettings(), Count), () => { + Pointers = s.SerializeObjectArray(Pointers, Count, name: nameof(Pointers)); + }); + } + } +} diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/SNA/Relocation/SNA_RelocationTableBlock.cs.meta b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/SNA/Relocation/SNA_RelocationTableBlock.cs.meta new file mode 100644 index 00000000..fd4376c9 --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/SNA/Relocation/SNA_RelocationTableBlock.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 119614bf5556dfa4d88310840fd3b4d8 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/SNA/Relocation/SNA_RelocationTablePointer.cs b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/SNA/Relocation/SNA_RelocationTablePointer.cs new file mode 100644 index 00000000..0930e526 --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/SNA/Relocation/SNA_RelocationTablePointer.cs @@ -0,0 +1,20 @@ +using System; +using System.Threading.Tasks; + +namespace BinarySerializer.Ubisoft.CPA { + public class SNA_RelocationTablePointer : BinarySerializable { + public uint Pointer { get; set; } // Absolute pointer to an offset in the block determined by TargetModule & TargetBlock + public byte TargetModule { get; set; } + public byte TargetBlock { get; set; } + + public override void SerializeImpl(SerializerObject s) { + Pointer = s.Serialize(Pointer, name: nameof(Pointer)); + TargetModule = s.Serialize(TargetModule, name: nameof(TargetModule)); + TargetBlock = s.Serialize(TargetBlock, name: nameof(TargetBlock)); + if (s.GetCPASettings().EngineVersionTree.HasParent(EngineVersion.CPA_2) + || (s.GetCPASettings().EngineVersionTree.HasParent(EngineVersion.PlaymobilHype))) { + s.SerializePadding(2); // 0xCD 0xCD + } + } + } +} diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/SNA/Relocation/SNA_RelocationTablePointer.cs.meta b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/SNA/Relocation/SNA_RelocationTablePointer.cs.meta new file mode 100644 index 00000000..894dd535 --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/SNA/Relocation/SNA_RelocationTablePointer.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 2dbfd64c92a6726489d890a4d5b1317f +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/SNA/SNA_File.cs b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/SNA/SNA_File.cs new file mode 100644 index 00000000..e328e2db --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/SNA/SNA_File.cs @@ -0,0 +1,29 @@ +namespace BinarySerializer.Ubisoft.CPA { + public class SNA_File : BinarySerializable where T : BinarySerializable, new() { + public uint CryptKey { get; set; } = SNA_XORCalculator.DefaultCryptKey; + + public T Value { get; set; } + + private SNA_XORCalculator.DecodeMode Mode => + Context.GetCPASettings().EngineVersionTree.HasParent(EngineVersion.RedPlanet) + ? SNA_XORCalculator.DecodeMode.RedPlanet + : SNA_XORCalculator.DecodeMode.Rayman2; + private bool UseCryptKey => !Context.GetCPASettings().EngineVersionTree.HasParent(EngineVersion.RedPlanet); + + public override void SerializeImpl(SerializerObject s) { + if (s.GetCPASettings().EngineVersionTree.HasParent(EngineVersion.CPA_2)) { + CryptKey = s.Serialize(CryptKey, name: nameof(CryptKey)); + + s.DoXOR(new SNA_XORCalculator(key: UseCryptKey ? CryptKey : SNA_XORCalculator.DefaultCryptKey, mode: Mode), () => { + Value = s.SerializeObject(Value, name: nameof(Value)); + }); + } else if (s.GetCPASettings().EngineVersionTree.HasParent(EngineVersion.TonicTrouble)) { + s.DoEncoded(new SNA_TTWindowEncoder(), () => { + Value = s.SerializeObject(Value, name: nameof(Value)); + }); + } else { + Value = s.SerializeObject(Value, name: nameof(Value)); + } + } + } +} diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/SNA/SNA_File.cs.meta b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/SNA/SNA_File.cs.meta new file mode 100644 index 00000000..fd252dea --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/SNA/SNA_File.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: a1f21a2080728a949a092e2d6a9e7f44 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/SNA/SNA_PointerFile.cs b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/SNA/SNA_PointerFile.cs new file mode 100644 index 00000000..a3bafac2 --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/SNA/SNA_PointerFile.cs @@ -0,0 +1,19 @@ +namespace BinarySerializer.Ubisoft.CPA { + /// + /// Used for small files like GlobalPointerTable, PTX and relocation files + /// + /// Content of file + public class SNA_PointerFile : BinarySerializable where T : BinarySerializable, new() { + public T Value { get; set; } + + public override void SerializeImpl(SerializerObject s) { + if (s.GetCPASettings().EngineVersion == EngineVersion.TonicTrouble) { + s.DoEncoded(new SNA_TTWindowEncoder(), () => { + Value = s.SerializeObject(Value, name: nameof(Value)); + }); + } else { + Value = s.SerializeObject(Value, name: nameof(Value)); + } + } + } +} diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/SNA/SNA_PointerFile.cs.meta b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/SNA/SNA_PointerFile.cs.meta new file mode 100644 index 00000000..b2f494a9 --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/SNA/SNA_PointerFile.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: db1a5002088a6394b97cc11b9653c2c0 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/SNA/Snapshot.meta b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/SNA/Snapshot.meta new file mode 100644 index 00000000..be0d70ce --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/SNA/Snapshot.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 0725b64bb10e97a48bc8b6bfdc929881 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/SNA/Snapshot/Enums.meta b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/SNA/Snapshot/Enums.meta new file mode 100644 index 00000000..00f9cf5f --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/SNA/Snapshot/Enums.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 9973b20e06bdcaf48a75cb474dea746a +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/SNA/Snapshot/Enums/SNA_MemoryBlockType.cs b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/SNA/Snapshot/Enums/SNA_MemoryBlockType.cs new file mode 100644 index 00000000..f18b362f --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/SNA/Snapshot/Enums/SNA_MemoryBlockType.cs @@ -0,0 +1,8 @@ +namespace BinarySerializer.Ubisoft.CPA { + public enum SNA_MemoryBlockType : sbyte { + Empty = -1, + Unknown = 0, + Fix = 1, + Level = 2, + } +} diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/SNA/Snapshot/Enums/SNA_MemoryBlockType.cs.meta b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/SNA/Snapshot/Enums/SNA_MemoryBlockType.cs.meta new file mode 100644 index 00000000..30ddef1a --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/SNA/Snapshot/Enums/SNA_MemoryBlockType.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 3e7caa33256e41c43bc06b41682dc2bf +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/SNA/Snapshot/SNA_MemoryBlock.cs b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/SNA/Snapshot/SNA_MemoryBlock.cs new file mode 100644 index 00000000..e410056f --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/SNA/Snapshot/SNA_MemoryBlock.cs @@ -0,0 +1,59 @@ +namespace BinarySerializer.Ubisoft.CPA { + public class SNA_MemoryBlock : BinarySerializable { + public byte Module { get; set; } + public byte Bloc { get; set; } + public SNA_MemoryBlockType Type { get; set; } // Unused + public uint BeginBlock { get; set; } // Absolute start position of the block + public uint EndBlock { get; set; } // Absolute end position of the block + public uint FirstFree { get; set; } // First free memory entry inside block + public uint MaxMem { get; set; } // Last byte position that has occupied memory + public bool TT_UnknownXORRelated { get; set; } + + public uint BlockSize { get; set; } // Memory data size. 0 if this is an "info", otherwise = MaxMem-BeginBlock+1+8 (8 for the BlockInfo) + + public byte[] Block { get; set; } // Memory data + + // For testing purposes: to read allocations separately + public static bool TestAllocations = false; + public MMG_HeaderBlockWithoutFree HeaderWithoutFree { get; set; } + public MMG_Allocation[] Allocations { get; set; } + + public const uint InvalidBeginBlock = uint.MaxValue; + + public override void SerializeImpl(SerializerObject s) { + Module = s.Serialize(Module, name: nameof(Module)); + Bloc = s.Serialize(Bloc, name: nameof(Bloc)); + + if(s.GetCPASettings().EngineVersionTree.HasParent(EngineVersion.CPA_2)) + Type = s.Serialize(Type, name: nameof(Type)); + + BeginBlock = s.Serialize(BeginBlock, name: nameof(BeginBlock)); + if (BeginBlock != InvalidBeginBlock) { + EndBlock = s.Serialize(EndBlock, name: nameof(EndBlock)); + FirstFree = s.Serialize(FirstFree, name: nameof(FirstFree)); + MaxMem = s.Serialize(MaxMem, name: nameof(MaxMem)); + BlockSize = s.Serialize(BlockSize, name: nameof(BlockSize)); + + if(s.GetCPASettings().EngineVersion == EngineVersion.TonicTrouble) + TT_UnknownXORRelated = s.Serialize(TT_UnknownXORRelated, name: nameof(TT_UnknownXORRelated)); + + s.DoEncoded(SNA_LZOEncoder.GetIfRequired(s.GetCPASettings(), BlockSize), () => { + var blockStart = s.CurrentAbsoluteOffset; + if (!TestAllocations) { + Block = s.SerializeArray(Block, BlockSize, name: nameof(Block)); + } else { + if (BlockSize > 0) { + if (FirstFree == 0xFFFFFFFF) { + HeaderWithoutFree = s.SerializeObject(HeaderWithoutFree, name: nameof(HeaderWithoutFree)); + Block = s.SerializeArray(Block, BlockSize - 4, name: nameof(Block)); + } else { + Allocations = s.SerializeObjectArrayUntil(Allocations, a => s.CurrentAbsoluteOffset >= blockStart + BlockSize - 8, name: nameof(Allocations)); + Block = s.SerializeArray(Block, 8, name: nameof(Block)); + } + } + } + }); + } + } + } +} diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/SNA/Snapshot/SNA_MemoryBlock.cs.meta b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/SNA/Snapshot/SNA_MemoryBlock.cs.meta new file mode 100644 index 00000000..cf887110 --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/SNA/Snapshot/SNA_MemoryBlock.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 6aa4c2da273ae1c4eb34c6b803bf7d44 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/SNA/Snapshot/SNA_MemorySnapshot.cs b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/SNA/Snapshot/SNA_MemorySnapshot.cs new file mode 100644 index 00000000..57331d39 --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/SNA/Snapshot/SNA_MemorySnapshot.cs @@ -0,0 +1,21 @@ +namespace BinarySerializer.Ubisoft.CPA { + public class SNA_MemorySnapshot : BinarySerializable { + public ushort TT_PathLength { get; set; } + public string TT_Path { get; set; } + public const byte TT_NameXORKey = 0xA5; + + public SNA_MemoryBlock[] Blocks { get; set; } + + public override void SerializeImpl(SerializerObject s) { + if (s.GetCPASettings().EngineVersion == EngineVersion.TonicTrouble) { + TT_PathLength = s.Serialize(TT_PathLength, name: nameof(TT_PathLength)); + s.DoXOR(TT_NameXORKey, () => { + TT_Path = s.SerializeString(TT_Path, length: TT_PathLength-1, name: nameof(TT_Path)); + }); + } + Blocks = s.SerializeObjectArrayUntil(Blocks, + b => s.CurrentAbsoluteOffset >= s.CurrentLength, + name: nameof(Blocks)); + } + } +} diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/SNA/Snapshot/SNA_MemorySnapshot.cs.meta b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/SNA/Snapshot/SNA_MemorySnapshot.cs.meta new file mode 100644 index 00000000..5ce1cdbb --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/SNA/Snapshot/SNA_MemorySnapshot.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 8c6a85913a7578745b01b99b34b23c3f +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64.meta b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64.meta new file mode 100644 index 00000000..d42473f7 --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 8ee9bb60c95311b46b9b2e216b41ae3f +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/A3D.meta b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/A3D.meta new file mode 100644 index 00000000..8d1ea944 --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/A3D.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 9ce89b7f61419d74e8860c067e69fbcb +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/A3D/A3D_Animation.cs b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/A3D/A3D_Animation.cs new file mode 100644 index 00000000..c86ed686 --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/A3D/A3D_Animation.cs @@ -0,0 +1,37 @@ +namespace BinarySerializer.Ubisoft.CPA.U64 { + public class A3D_Animation : BinarySerializable { + public long Pre_DataSize { get; set; } + + public A3D_General Header { get; set; } + public A3D_Vector[] Vectors { get; set; } + public A3D_Quaternion[] Quaternions { get; set; } + public A3D_Hierarchy[] Hierarchies { get; set; } + public A3D_NTTO[] NTTOs { get; set; } + public A3D_Frame[] SavedFrames { get; set; } + public A3D_OnlyFrame[] OnlyFrames { get; set; } + public A3D_Channel[] Channels { get; set; } + public A3D_KeyFrame[] KeyFrames { get; set; } + public A3D_Event[] Events { get; set; } + public A3D_MorphData[] MorphData { get; set; } + + public override void SerializeImpl(SerializerObject s) { + Header = s.SerializeObject(Header, name: nameof(Header)); + Vectors = s.SerializeObjectArray(Vectors, Header.VectorsCount, name: nameof(Vectors)); + Quaternions = s.SerializeObjectArray(Quaternions, Header.QuaternionsCount, name: nameof(Quaternions)); + Hierarchies = s.SerializeObjectArray(Hierarchies, Header.HierarchiesCount, name: nameof(Hierarchies)); + NTTOs = s.SerializeObjectArray(NTTOs, Header.NTTOCount, name: nameof(NTTOs)); + OnlyFrames = s.SerializeObjectArray(OnlyFrames, Header.EndFrame - Header.StartFrame, name: nameof(OnlyFrames)); + Channels = s.SerializeObjectArray(Channels, Header.ChannelsCount, name: nameof(Channels)); + SavedFrames = s.SerializeObjectArray(SavedFrames, Header.ChannelsCount * Header.SavedFramesCount, name: nameof(SavedFrames)); + KeyFrames = s.SerializeObjectArray(KeyFrames, Header.KeyFramesCount, name: nameof(KeyFrames)); + s.Align(4, Offset); + Events = s.SerializeObjectArray(Events, Header.EventsCount, name: nameof(Events)); + MorphData = s.SerializeObjectArray(MorphData, Header.MorphDataCount, name: nameof(MorphData)); + + if (s.CurrentAbsoluteOffset != Offset.AbsoluteOffset + Pre_DataSize) { + long readSize = s.CurrentAbsoluteOffset - Offset.AbsoluteOffset; + throw new BinarySerializableException(this, $"Animation was not fully read. Filesize: {Pre_DataSize} vs. read: {readSize}"); + } + } + } +} \ No newline at end of file diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/A3D/A3D_Animation.cs.meta b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/A3D/A3D_Animation.cs.meta new file mode 100644 index 00000000..a4840133 --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/A3D/A3D_Animation.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: b71aa6190acf2e04c8b28a451d9b699a +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/A3D/A3D_AnimationCut.cs b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/A3D/A3D_AnimationCut.cs new file mode 100644 index 00000000..e7d7ec89 --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/A3D/A3D_AnimationCut.cs @@ -0,0 +1,19 @@ +namespace BinarySerializer.Ubisoft.CPA.U64 { + public class A3D_AnimationCut : BinarySerializable { + public ushort StartFrame { get; set; } + public ushort EndFrame { get; set; } + public ushort PreviousAnimation { get; set; } + public ushort NextAnimation { get; set; } + public ushort MaxElementsCount { get; set; } + public ushort Align { get; set; } + + public override void SerializeImpl(SerializerObject s) { + StartFrame = s.Serialize(StartFrame, name: nameof(StartFrame)); + EndFrame = s.Serialize(EndFrame, name: nameof(EndFrame)); + PreviousAnimation = s.Serialize(PreviousAnimation, name: nameof(PreviousAnimation)); + NextAnimation = s.Serialize(NextAnimation, name: nameof(NextAnimation)); + MaxElementsCount = s.Serialize(MaxElementsCount, name: nameof(MaxElementsCount)); + Align = s.Serialize(Align, name: nameof(Align)); + } + } +} \ No newline at end of file diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/A3D/A3D_AnimationCut.cs.meta b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/A3D/A3D_AnimationCut.cs.meta new file mode 100644 index 00000000..dc71977a --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/A3D/A3D_AnimationCut.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 2edba3c6677860a4682a37157b1faa9f +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/A3D/A3D_ShortAnimation.cs b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/A3D/A3D_ShortAnimation.cs new file mode 100644 index 00000000..48bd3700 --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/A3D/A3D_ShortAnimation.cs @@ -0,0 +1,23 @@ +namespace BinarySerializer.Ubisoft.CPA.U64 { + public class A3D_ShortAnimation : BinarySerializable { + public ushort FramesCount { get; set; } + public ushort FrameRate { get; set; } + public ushort MaxElementsCount { get; set; } + public ushort EventsCount { get; set; } + public ushort MorphDataCount { get; set; } + public ushort Align { get; set; } + public CPA.MTH3D_Vector Translation { get; set; } + public MTH4D_ShortQuaternion Rotation { get; set; } + + public override void SerializeImpl(SerializerObject s) { + FramesCount = s.Serialize(FramesCount, name: nameof(FramesCount)); + FrameRate = s.Serialize(FrameRate, name: nameof(FrameRate)); + MaxElementsCount = s.Serialize(MaxElementsCount, name: nameof(MaxElementsCount)); + EventsCount = s.Serialize(EventsCount, name: nameof(EventsCount)); + MorphDataCount = s.Serialize(MorphDataCount, name: nameof(MorphDataCount)); + Align = s.Serialize(Align, name: nameof(Align)); + Translation = s.SerializeObject(Translation, name: nameof(Translation)); + Rotation = s.SerializeObject(Rotation, name: nameof(Rotation)); + } + } +} \ No newline at end of file diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/A3D/A3D_ShortAnimation.cs.meta b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/A3D/A3D_ShortAnimation.cs.meta new file mode 100644 index 00000000..a51a0eee --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/A3D/A3D_ShortAnimation.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: ae6253425d01349499822acfa370ec28 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/A3D/BinFile.meta b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/A3D/BinFile.meta new file mode 100644 index 00000000..cfe4c649 --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/A3D/BinFile.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: b5116ec91ed429c4298e0c9ac8ca9c34 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/A3D/BinFile/A3D_AnimationCutTable.cs b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/A3D/BinFile/A3D_AnimationCutTable.cs new file mode 100644 index 00000000..e57b8ad6 --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/A3D/BinFile/A3D_AnimationCutTable.cs @@ -0,0 +1,37 @@ +using System; +using System.Collections.Generic; + +namespace BinarySerializer.Ubisoft.CPA.U64 { + public class A3D_AnimationCutTable : BinarySerializable { + public A3D_AnimationCut[] Cuts { get; set; } + + public override void SerializeImpl(SerializerObject s) { + var anims = s.GetLoader().AnimationsFile; + Cuts = s.SerializeObjectArray(Cuts, anims.AnimationsCount, name: nameof(Cuts)); + } + + public void ReadData(SerializerObject s, ushort index) { + if (index != 0xFFFF && index < Cuts.Length) { + var anims = s.GetLoader().AnimationsFile; + ushort currentIndex = index; + while (currentIndex != 0xFFFF) { + anims.LoadAnimation(s, currentIndex); + currentIndex = Cuts[currentIndex].NextAnimation; + } + } + } + + public A3D_AnimationCut[] GetAnimationChain(ushort index) { + if (index != 0xFFFF && index < Cuts.Length) { + var cuts = new List(); + ushort currentIndex = index; + while (currentIndex != 0xFFFF) { + cuts.Add(Cuts[currentIndex]); + currentIndex = Cuts[currentIndex].NextAnimation; + } + return cuts.ToArray(); + } + return null; + } + } +} \ No newline at end of file diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/A3D/BinFile/A3D_AnimationCutTable.cs.meta b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/A3D/BinFile/A3D_AnimationCutTable.cs.meta new file mode 100644 index 00000000..39864c26 --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/A3D/BinFile/A3D_AnimationCutTable.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 7acada22ce89c0f4783d60401b196a43 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/A3D/BinFile/A3D_AnimationOffset.cs b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/A3D/BinFile/A3D_AnimationOffset.cs new file mode 100644 index 00000000..da6b6666 --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/A3D/BinFile/A3D_AnimationOffset.cs @@ -0,0 +1,20 @@ +using System; + +namespace BinarySerializer.Ubisoft.CPA.U64 +{ + public class A3D_AnimationOffset : BinarySerializable + { + public uint AnimationOffset { get; set; } + public bool IsCompressed { get; set; } + + public Pointer AnimationPointer(Pointer anchor) => anchor + AnimationOffset; + + public override void SerializeImpl(SerializerObject s) + { + s.DoBits(b => { + AnimationOffset = b.SerializeBits(AnimationOffset, 31, name: nameof(AnimationOffset)); + IsCompressed = b.SerializeBits(IsCompressed, 1, name: nameof(IsCompressed)); + }); + } + } +} \ No newline at end of file diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/A3D/BinFile/A3D_AnimationOffset.cs.meta b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/A3D/BinFile/A3D_AnimationOffset.cs.meta new file mode 100644 index 00000000..be601336 --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/A3D/BinFile/A3D_AnimationOffset.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 75f82be0f7de60849a0538b28285d7c3 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/A3D/BinFile/A3D_AnimationsFile.cs b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/A3D/BinFile/A3D_AnimationsFile.cs new file mode 100644 index 00000000..313377ba --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/A3D/BinFile/A3D_AnimationsFile.cs @@ -0,0 +1,55 @@ +using BinarySerializer.Nintendo.N64; + +namespace BinarySerializer.Ubisoft.CPA.U64 +{ + public class A3D_AnimationsFile : BinarySerializable + { + public uint AnimationsCount { get; set; } + public uint IntAnimationsCount { get; set; } + public uint MaxRamSizeOfAnim { get; set; } + public uint MaxRomSizeOfAnim { get; set; } + public A3D_AnimationOffset[] AnimationOffsets { get; set; } + public Pointer EndOfFile { get; set; } + + // Parsed + public A3D_Animation[] Animations { get; set; } + + public override void SerializeImpl(SerializerObject s) + { + AnimationsCount = s.Serialize(AnimationsCount, name: nameof(AnimationsCount)); + IntAnimationsCount = s.Serialize(IntAnimationsCount, name: nameof(IntAnimationsCount)); + MaxRamSizeOfAnim = s.Serialize(MaxRamSizeOfAnim, name: nameof(MaxRamSizeOfAnim)); + MaxRomSizeOfAnim = s.Serialize(MaxRomSizeOfAnim, name: nameof(MaxRomSizeOfAnim)); + AnimationOffsets = s.SerializeObjectArray(AnimationOffsets, AnimationsCount, name: nameof(AnimationOffsets)); + EndOfFile = s.SerializePointer(EndOfFile, anchor: Offset, name: nameof(EndOfFile)); + } + + public A3D_Animation LoadAnimation(SerializerObject s, int index) { + var offset = AnimationOffsets[index]; + var ptr = Offset + offset.AnimationOffset; + + if(Animations == null) Animations = new A3D_Animation[AnimationsCount]; + if (Animations[index] == null) { + // Calculate size + long size; + if (index + 1 < AnimationsCount) { + size = AnimationOffsets[index + 1].AnimationOffset - AnimationOffsets[index].AnimationOffset; + } else { + size = EndOfFile - ptr; + } + if (size == 0) return null; + + s.DoAt(ptr, () => { + if (offset.IsCompressed) { + s.DoEncoded(new YAY0Encoder(), () => { + Animations[index] = s.SerializeObject(Animations[index], onPreSerialize: a => a.Pre_DataSize = s.CurrentLength, name: $"{nameof(Animations)}[{index}]"); + }); + } else { + Animations[index] = s.SerializeObject(Animations[index], onPreSerialize: a => a.Pre_DataSize = size, name: $"{nameof(Animations)}[{index}]"); + } + }); + } + return Animations[index]; + } + } +} \ No newline at end of file diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/A3D/BinFile/A3D_AnimationsFile.cs.meta b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/A3D/BinFile/A3D_AnimationsFile.cs.meta new file mode 100644 index 00000000..fad2b9f3 --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/A3D/BinFile/A3D_AnimationsFile.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: a61acdf581ed73c4a833d9a93cccbfd1 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/A3D/BinFile/A3D_ShortAnimationsFile.cs b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/A3D/BinFile/A3D_ShortAnimationsFile.cs new file mode 100644 index 00000000..43d9218a --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/A3D/BinFile/A3D_ShortAnimationsFile.cs @@ -0,0 +1,12 @@ +using System; + +namespace BinarySerializer.Ubisoft.CPA.U64 { + public class A3D_ShortAnimationsFile : BinarySerializable { + public A3D_ShortAnimation[] ShortAnimations { get; set; } + + public override void SerializeImpl(SerializerObject s) { + // TODO: Get actual count + ShortAnimations = s.SerializeObjectArrayUntil(ShortAnimations, _ => s.CurrentFileOffset >= s.CurrentLength, name: nameof(ShortAnimations)); + } + } +} \ No newline at end of file diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/A3D/BinFile/A3D_ShortAnimationsFile.cs.meta b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/A3D/BinFile/A3D_ShortAnimationsFile.cs.meta new file mode 100644 index 00000000..05d683cd --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/A3D/BinFile/A3D_ShortAnimationsFile.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 60ec214e3f7ee4b4fb2e35cfe1ec1e6c +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/A3D/Component.meta b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/A3D/Component.meta new file mode 100644 index 00000000..90d50e7e --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/A3D/Component.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 3f8d53988fefd024a98a3dfa27e98381 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/A3D/Component/A3D_Channel.cs b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/A3D/Component/A3D_Channel.cs new file mode 100644 index 00000000..c07a0e4d --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/A3D/Component/A3D_Channel.cs @@ -0,0 +1,20 @@ +using System; + +namespace BinarySerializer.Ubisoft.CPA.U64 +{ + public class A3D_Channel : BinarySerializable + { + public ushort KeysCount { get; set; } + public ushort ChannelNumber { get; set; } + public ushort LocalPivotPosIndex { get; set; } + public ushort Align { get; set; } + + public override void SerializeImpl(SerializerObject s) + { + KeysCount = s.Serialize(KeysCount, name: nameof(KeysCount)); + ChannelNumber = s.Serialize(ChannelNumber, name: nameof(ChannelNumber)); + LocalPivotPosIndex = s.Serialize(LocalPivotPosIndex, name: nameof(LocalPivotPosIndex)); + Align = s.Serialize(Align, name: nameof(Align)); + } + } +} \ No newline at end of file diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/A3D/Component/A3D_Channel.cs.meta b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/A3D/Component/A3D_Channel.cs.meta new file mode 100644 index 00000000..a9ee7285 --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/A3D/Component/A3D_Channel.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 38c75b4e5d04ae541b122a4ba5a77745 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/A3D/Component/A3D_Event.cs b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/A3D/Component/A3D_Event.cs new file mode 100644 index 00000000..37d9e840 --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/A3D/Component/A3D_Event.cs @@ -0,0 +1,20 @@ +using System; + +namespace BinarySerializer.Ubisoft.CPA.U64 +{ + public class A3D_Event : BinarySerializable + { + public ushort EventIndexInTBL { get; set; } + public ushort FrameIndex { get; set; } + public ushort ChannelIndex { get; set; } + public ushort Align { get; set; } + + public override void SerializeImpl(SerializerObject s) + { + EventIndexInTBL = s.Serialize(EventIndexInTBL, name: nameof(EventIndexInTBL)); + FrameIndex = s.Serialize(FrameIndex, name: nameof(FrameIndex)); + ChannelIndex = s.Serialize(ChannelIndex, name: nameof(ChannelIndex)); + Align = s.Serialize(Align, name: nameof(Align)); + } + } +} \ No newline at end of file diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/A3D/Component/A3D_Event.cs.meta b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/A3D/Component/A3D_Event.cs.meta new file mode 100644 index 00000000..b3f96421 --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/A3D/Component/A3D_Event.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: e4b39f361fd0a0140a814c45deb24b62 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/A3D/Component/A3D_Frame.cs b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/A3D/Component/A3D_Frame.cs new file mode 100644 index 00000000..5d03d745 --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/A3D/Component/A3D_Frame.cs @@ -0,0 +1,14 @@ +using System; + +namespace BinarySerializer.Ubisoft.CPA.U64 +{ + public class A3D_Frame : BinarySerializable + { + public ushort NTTOIndex { get; set; } + + public override void SerializeImpl(SerializerObject s) + { + NTTOIndex = s.Serialize(NTTOIndex, name: nameof(NTTOIndex)); + } + } +} \ No newline at end of file diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/A3D/Component/A3D_Frame.cs.meta b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/A3D/Component/A3D_Frame.cs.meta new file mode 100644 index 00000000..38299aa1 --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/A3D/Component/A3D_Frame.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 156358325ebc6f74b920c3b0a7a8e50b +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/A3D/Component/A3D_General.cs b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/A3D/Component/A3D_General.cs new file mode 100644 index 00000000..ca654907 --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/A3D/Component/A3D_General.cs @@ -0,0 +1,58 @@ +using System; + +namespace BinarySerializer.Ubisoft.CPA.U64 +{ + public class A3D_General : BinarySerializable + { + public ushort AnimationSpeed { get; set; } + + public ushort VectorsCount { get; set; } + public ushort QuaternionsCount { get; set; } + public ushort HierarchiesCount { get; set; } + public ushort NTTOCount { get; set; } + public ushort SavedFramesCount { get; set; } // NumNTTO + + public ushort ChannelsCount { get; set; } + public ushort FramesCount { get; set; } + public ushort KeyFramesCount { get; set; } + public ushort EventsCount { get; set; } + public ushort FirstPositionCount { get; set; } + + public ushort StartFrame { get; set; } + public ushort EndFrame { get; set; } + public ushort FakeAnimSpeed { get; set; } + public ushort Flags { get; set; } + + public ushort NumOfAnimationTranslationOffset { get; set; } + public ushort NumOfAnimationRotationOffset { get; set; } + + public ushort MorphDataCount { get; set; } + + public override void SerializeImpl(SerializerObject s) + { + AnimationSpeed = s.Serialize(AnimationSpeed, name: nameof(AnimationSpeed)); + + VectorsCount = s.Serialize(VectorsCount, name: nameof(VectorsCount)); + QuaternionsCount = s.Serialize(QuaternionsCount, name: nameof(QuaternionsCount)); + HierarchiesCount = s.Serialize(HierarchiesCount, name: nameof(HierarchiesCount)); + NTTOCount = s.Serialize(NTTOCount, name: nameof(NTTOCount)); + SavedFramesCount = s.Serialize(SavedFramesCount, name: nameof(SavedFramesCount)); + + ChannelsCount = s.Serialize(ChannelsCount, name: nameof(ChannelsCount)); + FramesCount = s.Serialize(FramesCount, name: nameof(FramesCount)); + KeyFramesCount = s.Serialize(KeyFramesCount, name: nameof(KeyFramesCount)); + EventsCount = s.Serialize(EventsCount, name: nameof(EventsCount)); + FirstPositionCount = s.Serialize(FirstPositionCount, name: nameof(FirstPositionCount)); + + StartFrame = s.Serialize(StartFrame, name: nameof(StartFrame)); + EndFrame = s.Serialize(EndFrame, name: nameof(EndFrame)); + FakeAnimSpeed = s.Serialize(FakeAnimSpeed, name: nameof(FakeAnimSpeed)); + Flags = s.Serialize(Flags, name: nameof(Flags)); + + NumOfAnimationTranslationOffset = s.Serialize(NumOfAnimationTranslationOffset, name: nameof(NumOfAnimationTranslationOffset)); + NumOfAnimationRotationOffset = s.Serialize(NumOfAnimationRotationOffset, name: nameof(NumOfAnimationRotationOffset)); + + MorphDataCount = s.Serialize(MorphDataCount, name: nameof(MorphDataCount)); + } + } +} \ No newline at end of file diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/A3D/Component/A3D_General.cs.meta b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/A3D/Component/A3D_General.cs.meta new file mode 100644 index 00000000..6488d798 --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/A3D/Component/A3D_General.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: e2cdf0d91fe8073419fdeb9e3e47e09f +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/A3D/Component/A3D_Hierarchy.cs b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/A3D/Component/A3D_Hierarchy.cs new file mode 100644 index 00000000..2193b9c1 --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/A3D/Component/A3D_Hierarchy.cs @@ -0,0 +1,16 @@ +using System; + +namespace BinarySerializer.Ubisoft.CPA.U64 +{ + public class A3D_Hierarchy : BinarySerializable + { + public ushort Child { get; set; } + public ushort Father { get; set; } + + public override void SerializeImpl(SerializerObject s) + { + Child = s.Serialize(Child, name: nameof(Child)); + Father = s.Serialize(Father, name: nameof(Father)); + } + } +} \ No newline at end of file diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/A3D/Component/A3D_Hierarchy.cs.meta b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/A3D/Component/A3D_Hierarchy.cs.meta new file mode 100644 index 00000000..3e89b8db --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/A3D/Component/A3D_Hierarchy.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: ef759c6767170c440adf85eceff88122 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/A3D/Component/A3D_KeyFrame.cs b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/A3D/Component/A3D_KeyFrame.cs new file mode 100644 index 00000000..2fc68e84 --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/A3D/Component/A3D_KeyFrame.cs @@ -0,0 +1,30 @@ +using System; + +namespace BinarySerializer.Ubisoft.CPA.U64 +{ + public class A3D_KeyFrame : BinarySerializable + { + public ushort FrameIndex { get; set; } + public ushort Mask { get; set; } + + public ushort QuaternionOrientationIndex { get; set; } + public ushort QuaternionScaleIndex { get; set; } + public ushort VectorScaleIndex { get; set; } + public ushort VectorPositionIndex { get; set; } + + public short InterpolationParameter { get; set; } + + public override void SerializeImpl(SerializerObject s) + { + FrameIndex = s.Serialize(FrameIndex, name: nameof(FrameIndex)); + Mask = s.Serialize(Mask, name: nameof(Mask)); + + QuaternionOrientationIndex = s.Serialize(QuaternionOrientationIndex, name: nameof(QuaternionOrientationIndex)); + QuaternionScaleIndex = s.Serialize(QuaternionScaleIndex, name: nameof(QuaternionScaleIndex)); + VectorScaleIndex = s.Serialize(VectorScaleIndex, name: nameof(VectorScaleIndex)); + VectorPositionIndex = s.Serialize(VectorPositionIndex, name: nameof(VectorPositionIndex)); + + InterpolationParameter = s.Serialize(InterpolationParameter, name: nameof(InterpolationParameter)); + } + } +} \ No newline at end of file diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/A3D/Component/A3D_KeyFrame.cs.meta b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/A3D/Component/A3D_KeyFrame.cs.meta new file mode 100644 index 00000000..65d64866 --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/A3D/Component/A3D_KeyFrame.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 92e485d5b51247b4ea033e768cbbd35a +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/A3D/Component/A3D_MorphData.cs b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/A3D/Component/A3D_MorphData.cs new file mode 100644 index 00000000..099dfd2a --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/A3D/Component/A3D_MorphData.cs @@ -0,0 +1,24 @@ +using System; + +namespace BinarySerializer.Ubisoft.CPA.U64 +{ + public class A3D_MorphData : BinarySerializable + { + public byte Target { get; set; } + public byte MorphingAmount { get; set; } + public ushort ChannelIndex { get; set; } + public ushort FrameIndex { get; set; } + + public ushort Align { get; set; } + + public override void SerializeImpl(SerializerObject s) + { + Target = s.Serialize(Target, name: nameof(Target)); + MorphingAmount = s.Serialize(MorphingAmount, name: nameof(MorphingAmount)); + ChannelIndex = s.Serialize(ChannelIndex, name: nameof(ChannelIndex)); + FrameIndex = s.Serialize(FrameIndex, name: nameof(FrameIndex)); + + Align = s.Serialize(Align, name: nameof(Align)); + } + } +} \ No newline at end of file diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/A3D/Component/A3D_MorphData.cs.meta b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/A3D/Component/A3D_MorphData.cs.meta new file mode 100644 index 00000000..ef554f04 --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/A3D/Component/A3D_MorphData.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: d2aea96bb32c5ba4a9a194be80faf0be +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/A3D/Component/A3D_NTTO.cs b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/A3D/Component/A3D_NTTO.cs new file mode 100644 index 00000000..bc418bec --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/A3D/Component/A3D_NTTO.cs @@ -0,0 +1,45 @@ +using System; + +namespace BinarySerializer.Ubisoft.CPA.U64 +{ + public class A3D_NTTO : BinarySerializable + { + public ushort TypeOfObject { get; set; } + public byte IndexInTable { get; set; } + public byte Transparency { get; set; } + + // Parsed + public ElementType Type { get; set; } + public ElementTypeFlags TypeFlags { get; set; } + + + public override void SerializeImpl(SerializerObject s) + { + TypeOfObject = s.Serialize(TypeOfObject, name: nameof(TypeOfObject)); + s.DoAt(Offset, () => { + s.DoBits(b => { + Type = b.SerializeBits(Type, 8, name: nameof(Type)); + TypeFlags = b.SerializeBits(TypeFlags, 8, name: nameof(TypeFlags)); + }); + }); + IndexInTable = s.Serialize(IndexInTable, name: nameof(IndexInTable)); + Transparency = s.Serialize(Transparency, name: nameof(Transparency)); + } + + public enum ElementType { + GraphicObject = 0, + SubAnimation = 1, + EmptyObject = 2, + Event = 3, + Light = 4, + Fake = 5, + Undefined = 6, + } + public enum ElementTypeFlags { + WrapLastKey = 1 << 1, + ChangeOfHierarchy = 1 << 2, + Hierarchized = 1 << 3, + SoundEvent = 1 << 4, + } + } +} \ No newline at end of file diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/A3D/Component/A3D_NTTO.cs.meta b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/A3D/Component/A3D_NTTO.cs.meta new file mode 100644 index 00000000..3063a261 --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/A3D/Component/A3D_NTTO.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: e79c39adeab884345b346fe9e80db2d9 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/A3D/Component/A3D_OnlyFrame.cs b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/A3D/Component/A3D_OnlyFrame.cs new file mode 100644 index 00000000..bd9ffd7b --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/A3D/Component/A3D_OnlyFrame.cs @@ -0,0 +1,24 @@ +using System; + +namespace BinarySerializer.Ubisoft.CPA.U64 +{ + public class A3D_OnlyFrame : BinarySerializable + { + public ushort AngularSpeedQuaternionIndex { get; set; } + public ushort SpeedVectorIndex { get; set; } + public ushort HierarchiesCount { get; set; } + public ushort FirstHierarchyIndex { get; set; } + public ushort SavedFrameIndex { get; set; } // NumOfNTTO / A3D_Frame + public ushort Align { get; set; } // Commented out in source? + + public override void SerializeImpl(SerializerObject s) + { + AngularSpeedQuaternionIndex = s.Serialize(AngularSpeedQuaternionIndex, name: nameof(AngularSpeedQuaternionIndex)); + SpeedVectorIndex = s.Serialize(SpeedVectorIndex, name: nameof(SpeedVectorIndex)); + HierarchiesCount = s.Serialize(HierarchiesCount, name: nameof(HierarchiesCount)); + FirstHierarchyIndex = s.Serialize(FirstHierarchyIndex, name: nameof(FirstHierarchyIndex)); + SavedFrameIndex = s.Serialize(SavedFrameIndex, name: nameof(SavedFrameIndex)); + Align = s.Serialize(Align, name: nameof(Align)); + } + } +} \ No newline at end of file diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/A3D/Component/A3D_OnlyFrame.cs.meta b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/A3D/Component/A3D_OnlyFrame.cs.meta new file mode 100644 index 00000000..df93b24d --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/A3D/Component/A3D_OnlyFrame.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 776da5699e311574d9aad1eba748a905 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/A3D/Component/A3D_Quaternion.cs b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/A3D/Component/A3D_Quaternion.cs new file mode 100644 index 00000000..3f1dc227 --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/A3D/Component/A3D_Quaternion.cs @@ -0,0 +1,11 @@ +using System; + +namespace BinarySerializer.Ubisoft.CPA.U64 { + public class A3D_Quaternion : BinarySerializable { + public MTH4D_ShortQuaternion Quaternion { get; set; } + + public override void SerializeImpl(SerializerObject s) { + Quaternion = s.SerializeObject(Quaternion, name: nameof(Quaternion)); + } + } +} \ No newline at end of file diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/A3D/Component/A3D_Quaternion.cs.meta b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/A3D/Component/A3D_Quaternion.cs.meta new file mode 100644 index 00000000..0b8ccc46 --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/A3D/Component/A3D_Quaternion.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: bf99390173665e34a93003ddf2d842bc +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/A3D/Component/A3D_Vector.cs b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/A3D/Component/A3D_Vector.cs new file mode 100644 index 00000000..b096e48b --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/A3D/Component/A3D_Vector.cs @@ -0,0 +1,19 @@ +namespace BinarySerializer.Ubisoft.CPA.U64 { + public class A3D_Vector : BinarySerializable { + public int IntX { get; set; } // Divide by 4096 to get float + public int IntY { get; set; } + public int IntZ { get; set; } + + public CPA.MTH3D_Vector Vector { get; set; } + + public override void SerializeImpl(SerializerObject s) { + if (s.GetCPASettings().Platform == Platform.N64) { + Vector = s.SerializeObject(Vector, name: nameof(Vector)); + } else { + IntX = s.Serialize(IntX, name: nameof(IntX)); + IntY = s.Serialize(IntY, name: nameof(IntY)); + IntZ = s.Serialize(IntZ, name: nameof(IntZ)); + } + } + } +} \ No newline at end of file diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/A3D/Component/A3D_Vector.cs.meta b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/A3D/Component/A3D_Vector.cs.meta new file mode 100644 index 00000000..08c2e1be --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/A3D/Component/A3D_Vector.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 47dbae691824bab4fa59327cbc80c587 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/AI.meta b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/AI.meta new file mode 100644 index 00000000..09dd385a --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/AI.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 48601ab41034a8d45ab2ae331ccbff6a +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/AI/AI_AIModel.cs b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/AI/AI_AIModel.cs new file mode 100644 index 00000000..da89f055 --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/AI/AI_AIModel.cs @@ -0,0 +1,37 @@ +using System; + +namespace BinarySerializer.Ubisoft.CPA.U64 { + public class AI_AIModel : U64_Struct { + public U64_Reference VariableDeclaration { get; set; } + public U64_Reference Intelligence { get; set; } + public U64_Reference Reflex { get; set; } + + // For FastC + public U64_Reference Reference { get; set; } + public U64_ArrayReference ReferenceTree { get; set; } // Full NodeInterpret reference! + public ushort ReferenceTreeSize { get; set; } + public short CFast_FunctionIndex { get; set; } + public bool CFast_IsC { get; set; } + + public override void SerializeImpl(SerializerObject s) { + VariableDeclaration = s.SerializeObject>(VariableDeclaration, name: nameof(VariableDeclaration))?.Resolve(s); + Intelligence = s.SerializeObject>(Intelligence, name: nameof(Intelligence))?.Resolve(s); + Reflex = s.SerializeObject>(Reflex, name: nameof(Reflex))?.Resolve(s); + + // For FastC + Reference = s.SerializeObject>(Reference, name: nameof(Reference)); + ReferenceTree = s.SerializeObject>(ReferenceTree, name: nameof(ReferenceTree)); + ReferenceTreeSize = s.Serialize(ReferenceTreeSize, name: nameof(ReferenceTreeSize)); + CFast_FunctionIndex = s.Serialize(CFast_FunctionIndex, name: nameof(CFast_FunctionIndex)); + s.DoBits(b => { + CFast_IsC = b.SerializeBits(CFast_IsC, 1, name: nameof(CFast_IsC)); + }); + + + if (CFast_IsC && !Reference.IsNull) { + Reference?.Resolve(s); + ReferenceTree?.Resolve(s, ReferenceTreeSize / AI_NodeInterpretFull.StructSize); + } + } + } +} diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/AI/AI_AIModel.cs.meta b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/AI/AI_AIModel.cs.meta new file mode 100644 index 00000000..e5d7355f --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/AI/AI_AIModel.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: bfd21cfcdde2be94c859e8158723eb37 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/AI/AI_Comport.cs b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/AI/AI_Comport.cs new file mode 100644 index 00000000..2f49438d --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/AI/AI_Comport.cs @@ -0,0 +1,13 @@ +using System; + +namespace BinarySerializer.Ubisoft.CPA.U64 { + public class AI_Comport : U64_Struct { + public U64_Reference Schedule { get; set; } + public LST_ReferenceList Rules { get; set; } + + public override void SerializeImpl(SerializerObject s) { + Schedule = s.SerializeObject>(Schedule, name: nameof(Schedule))?.Resolve(s); + Rules = s.SerializeObject>(Rules, name: nameof(Rules))?.Resolve(s); + } + } +} diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/AI/AI_Comport.cs.meta b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/AI/AI_Comport.cs.meta new file mode 100644 index 00000000..e2aade60 --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/AI/AI_Comport.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 63d2b4000cbed104fa7cc5983f199e0f +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/AI/AI_Intelligence.cs b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/AI/AI_Intelligence.cs new file mode 100644 index 00000000..1bc3edeb --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/AI/AI_Intelligence.cs @@ -0,0 +1,19 @@ +using System; + +namespace BinarySerializer.Ubisoft.CPA.U64 { + public class AI_Intelligence : U64_Struct { + public U64_ArrayReference> ComportList { get; set; } + public U64_Reference ComportInit { get; set; } + public ushort ComportCount { get; set; } + public ushort ActionTableEntriesCount { get; set; } + + public override void SerializeImpl(SerializerObject s) { + ComportList = s.SerializeObject>>(ComportList, name: nameof(ComportList)); + ComportInit = s.SerializeObject>(ComportInit, name: nameof(ComportInit))?.Resolve(s); + ComportCount = s.Serialize(ComportCount, name: nameof(ComportCount)); + ActionTableEntriesCount = s.Serialize(ActionTableEntriesCount, name: nameof(ActionTableEntriesCount)); + + ComportList?.Resolve(s, ComportCount); + } + } +} diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/AI/AI_Intelligence.cs.meta b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/AI/AI_Intelligence.cs.meta new file mode 100644 index 00000000..6a48ef87 --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/AI/AI_Intelligence.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: f3bdfd875cac24942b2518bbb59971f5 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/AI/AI_Node.cs b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/AI/AI_Node.cs new file mode 100644 index 00000000..abfe0089 --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/AI/AI_Node.cs @@ -0,0 +1,128 @@ +using System; + +namespace BinarySerializer.Ubisoft.CPA.U64 { + public class AI_Node : U64_Struct { + // Main struct + public byte Type { get; set; } + public byte Depth { get; set; } + public ushort IdOrValue { get; set; } + + // Different value types + public U64_Reference ValueConstant { get; set; } + public U64_Reference ValueFloat { get; set; } + public U64_Reference ValueVector { get; set; } + public U64_Reference ValueModelRef { get; set; } + public U64_Reference ValueGraph { get; set; } + public U64_Reference ValueCaps { get; set; } + public U64_Reference ValueMacroRef { get; set; } + public U64_Reference ValuePersoRef { get; set; } + public U64_Reference ValueActionRef { get; set; } + public U64_Reference ValueWayPointRef { get; set; } + public U64_Reference ValueComportRef { get; set; } + public U64_Reference ValueButton { get; set; } + public U64_Reference ValueString { get; set; } + public U64_Reference ValueSuperObject { get; set; } + public U64_Reference ValueFamilyRef { get; set; } + public U64_Reference ValueSoundEventRef { get; set; } + public U64_Reference ValueObjectTableRef { get; set; } + public U64_Reference ValueGameMaterialRef { get; set; } + public U64_Reference ValueLight { get; set; } + public U64_Index ValueTextRef { get; set; } + + public override void SerializeImpl(SerializerObject s) { + Type = s.Serialize(Type, name: nameof(Type)); + Depth = s.Serialize(Depth, name: nameof(Depth)); + SerializeValue(s); + } + + private void SerializeValue(SerializerObject s) { + // Serialize differently depending on type + var aiTypes = Context.GetCPASettings().AITypes; + var nodeType = aiTypes.GetNodeType(Type); + switch (nodeType) { + case AI_InterpretType.Constant: + ValueConstant = s.SerializeObject>(ValueConstant, name: nameof(ValueConstant))?.Resolve(s); + break; + case AI_InterpretType.Real: + ValueFloat = s.SerializeObject>(ValueFloat, name: nameof(ValueFloat))?.Resolve(s); + break; + case AI_InterpretType.ConstantVector: + ValueVector = s.SerializeObject>(ValueVector, name: nameof(ValueVector))?.Resolve(s); + break; + case AI_InterpretType.ModelRef: + ValueModelRef = s.SerializeObject>(ValueModelRef, name: nameof(ValueModelRef))?.Resolve(s); + break; + case AI_InterpretType.Graph: + ValueGraph = s.SerializeObject>(ValueGraph, name: nameof(ValueGraph))?.Resolve(s); + break; + case AI_InterpretType.Caps: + ValueCaps = s.SerializeObject>(ValueCaps, name: nameof(ValueCaps))?.Resolve(s); + break; + case AI_InterpretType.MacroRef__Subroutine: + ValueMacroRef = s.SerializeObject>(ValueMacroRef, name: nameof(ValueMacroRef))?.Resolve(s); + break; + case AI_InterpretType.PersoRef: + ValuePersoRef = s.SerializeObject>(ValuePersoRef, name: nameof(ValuePersoRef))?.Resolve(s); + break; + case AI_InterpretType.ActionRef: + ValueActionRef = s.SerializeObject>(ValueActionRef, name: nameof(ValueActionRef))?.Resolve(s); + break; + case AI_InterpretType.WayPointRef: + ValueWayPointRef = s.SerializeObject>(ValueWayPointRef, name: nameof(ValueWayPointRef))?.Resolve(s); + break; + case AI_InterpretType.ComportRef: + ValueComportRef = s.SerializeObject>(ValueComportRef, name: nameof(ValueComportRef))?.Resolve(s); + break; + case AI_InterpretType.Button: + ValueButton = s.SerializeObject>(ValueButton, name: nameof(ValueButton))?.Resolve(s); + break; + case AI_InterpretType.String: + ValueString = s.SerializeObject>(ValueString, name: nameof(ValueString))?.Resolve(s); + break; + case AI_InterpretType.SuperObjectRef: + ValueSuperObject = s.SerializeObject>(ValueSuperObject, name: nameof(ValueSuperObject))?.Resolve(s); + break; + case AI_InterpretType.FamilyRef: + ValueFamilyRef = s.SerializeObject>(ValueFamilyRef, name: nameof(ValueFamilyRef))?.Resolve(s); + break; + case AI_InterpretType.SoundEventRef: + ValueSoundEventRef = s.SerializeObject>(ValueSoundEventRef, name: nameof(ValueSoundEventRef))?.Resolve(s); + break; + case AI_InterpretType.ObjectTableRef: + ValueObjectTableRef = s.SerializeObject>(ValueObjectTableRef, name: nameof(ValueObjectTableRef))?.Resolve(s); + break; + case AI_InterpretType.GameMaterialRef: + ValueGameMaterialRef = s.SerializeObject>(ValueGameMaterialRef, name: nameof(ValueGameMaterialRef))?.Resolve(s); + break; + case AI_InterpretType.Light: + ValueLight = s.SerializeObject>(ValueLight, name: nameof(ValueLight))?.Resolve(s); + break; + case AI_InterpretType.TextRef: + ValueTextRef = s.SerializeObject>(ValueTextRef, name: nameof(ValueTextRef)); + break; + default: + IdOrValue = s.Serialize(IdOrValue, name: nameof(IdOrValue)); + break; + } + } + + public override bool UseShortLog => true; + public override string ShortLog => ToString(); + + public override string ToString() { + var aiTypes = Context.GetCPASettings().AITypes; + var nodeType = aiTypes.GetNodeType(Type); + string translatedValue = nodeType switch { + AI_InterpretType.KeyWord => aiTypes.GetKeyword(IdOrValue)?.ToString(), + AI_InterpretType.Procedure => aiTypes.GetProcedure(IdOrValue)?.ToString(), + AI_InterpretType.Function => aiTypes.GetFunction(IdOrValue)?.ToString(), + AI_InterpretType.Field => aiTypes.GetField(IdOrValue)?.ToString(), + AI_InterpretType.Operator => aiTypes.GetOperator(IdOrValue)?.ToString(), + AI_InterpretType.MetaAction => aiTypes.GetMetaAction(IdOrValue)?.ToString(), + AI_InterpretType.Condition => aiTypes.GetCondition(IdOrValue)?.ToString(), + _ => $"{nodeType}_{IdOrValue:X4}" + }; + return $"({Type:X2},{Depth:X2},{IdOrValue:X4}){new string(' ',4*Depth)}{translatedValue}"; + } + } +} diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/AI/AI_Node.cs.meta b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/AI/AI_Node.cs.meta new file mode 100644 index 00000000..065ec56c --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/AI/AI_Node.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 803e8b1f6436d7b4d9543f3d23426dbc +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/AI/AI_NodeInterpretFull.cs b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/AI/AI_NodeInterpretFull.cs new file mode 100644 index 00000000..70d78c27 --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/AI/AI_NodeInterpretFull.cs @@ -0,0 +1,20 @@ +using System; + +namespace BinarySerializer.Ubisoft.CPA.U64 { + // Full NodeInterpret struct on DS/N64. Used only for NODFile struct type + public class AI_NodeInterpretFull : U64_Struct { + public uint Param { get; set; } + public ushort NodesToSkip { get; set; } + public byte Type { get; set; } + + public override void SerializeImpl(SerializerObject s) { + s.LogWarning($"{GetType()} is being serialized! Check if serialized correctly"); + Param = s.Serialize(Param, name: nameof(Param)); + NodesToSkip = s.Serialize(NodesToSkip, name: nameof(NodesToSkip)); + Type = s.Serialize(Type, name: nameof(Type)); + s.SerializePadding(1, logIfNotNull: true); + } + + public static uint StructSize => 8; + } +} diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/AI/AI_NodeInterpretFull.cs.meta b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/AI/AI_NodeInterpretFull.cs.meta new file mode 100644 index 00000000..fffb19a9 --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/AI/AI_NodeInterpretFull.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: be226066de2d1ac46b52f929008c74ce +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/AI/AI_Rule.cs b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/AI/AI_Rule.cs new file mode 100644 index 00000000..4d4cda4d --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/AI/AI_Rule.cs @@ -0,0 +1,11 @@ +using System; + +namespace BinarySerializer.Ubisoft.CPA.U64 { + public class AI_Rule : U64_Struct { + public LST_List Nodes { get; set; } + + public override void SerializeImpl(SerializerObject s) { + Nodes = s.SerializeObject>(Nodes, name: nameof(Nodes))?.Resolve(s); + } + } +} diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/AI/AI_Rule.cs.meta b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/AI/AI_Rule.cs.meta new file mode 100644 index 00000000..2ca8c9f5 --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/AI/AI_Rule.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 61289285080ddea479f5587722c33572 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/AI/Node.meta b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/AI/Node.meta new file mode 100644 index 00000000..66d25896 --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/AI/Node.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 2e67fa0563756d34a80d25a332a6d301 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/AI/Node/AI_Node_Float.cs b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/AI/Node/AI_Node_Float.cs new file mode 100644 index 00000000..c03aeaaa --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/AI/Node/AI_Node_Float.cs @@ -0,0 +1,9 @@ +namespace BinarySerializer.Ubisoft.CPA.U64 { + public class AI_Node_Float : U64_Struct { + public float Value { get; set; } + + public override void SerializeImpl(SerializerObject s) { + Value = s.Serialize(Value, name: nameof(Value)); + } + } +} diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/AI/Node/AI_Node_Float.cs.meta b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/AI/Node/AI_Node_Float.cs.meta new file mode 100644 index 00000000..24029942 --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/AI/Node/AI_Node_Float.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 4c882c11f5b0a1847a36484b3644bcd1 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/AI/Node/AI_Node_Long.cs b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/AI/Node/AI_Node_Long.cs new file mode 100644 index 00000000..7846bca0 --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/AI/Node/AI_Node_Long.cs @@ -0,0 +1,9 @@ +namespace BinarySerializer.Ubisoft.CPA.U64 { + public class AI_Node_Long : U64_Struct { + public int Value { get; set; } + + public override void SerializeImpl(SerializerObject s) { + Value = s.Serialize(Value, name: nameof(Value)); + } + } +} diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/AI/Node/AI_Node_Long.cs.meta b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/AI/Node/AI_Node_Long.cs.meta new file mode 100644 index 00000000..425ef5bb --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/AI/Node/AI_Node_Long.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 472a0486d0d764b47b7f96543daf405a +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/AI/Node/AI_Node_String.cs b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/AI/Node/AI_Node_String.cs new file mode 100644 index 00000000..69def53d --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/AI/Node/AI_Node_String.cs @@ -0,0 +1,9 @@ +namespace BinarySerializer.Ubisoft.CPA.U64 { + public class AI_Node_String : U64_Struct { + public U64_String String { get; set; } + + public override void SerializeImpl(SerializerObject s) { + String = s.SerializeObject(String, name: nameof(String)); + } + } +} diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/AI/Node/AI_Node_String.cs.meta b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/AI/Node/AI_Node_String.cs.meta new file mode 100644 index 00000000..c69d6074 --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/AI/Node/AI_Node_String.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 9325d742622fb9647ac95c2d473f0776 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/AI/Node/AI_Node_Vector3D.cs b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/AI/Node/AI_Node_Vector3D.cs new file mode 100644 index 00000000..46d83af1 --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/AI/Node/AI_Node_Vector3D.cs @@ -0,0 +1,9 @@ +namespace BinarySerializer.Ubisoft.CPA.U64 { + public class AI_Node_Vector3D : U64_Struct { + public MTH3D_Vector Value { get; set; } + + public override void SerializeImpl(SerializerObject s) { + Value = s.SerializeObject(Value, name: nameof(Value)); + } + } +} diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/AI/Node/AI_Node_Vector3D.cs.meta b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/AI/Node/AI_Node_Vector3D.cs.meta new file mode 100644 index 00000000..9c7a295b --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/AI/Node/AI_Node_Vector3D.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 3ab8bc25e810d084caf2f7ac15d5e05d +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/AI/Variables.meta b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/AI/Variables.meta new file mode 100644 index 00000000..c670fad3 --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/AI/Variables.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 77f39966484bade4d801473527020ed6 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/AI/Variables/AI_TypeVariable.cs b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/AI/Variables/AI_TypeVariable.cs new file mode 100644 index 00000000..d15b9eec --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/AI/Variables/AI_TypeVariable.cs @@ -0,0 +1,11 @@ +namespace BinarySerializer.Ubisoft.CPA.U64 { + public class AI_TypeVariable : U64_Struct { + public ushort VariableId { get; set; } + public ushort Type { get; set; } + + public override void SerializeImpl(SerializerObject s) { + VariableId = s.Serialize(VariableId, name: nameof(VariableId)); + Type = s.Serialize(Type, name: nameof(Type)); + } + } +} diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/AI/Variables/AI_TypeVariable.cs.meta b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/AI/Variables/AI_TypeVariable.cs.meta new file mode 100644 index 00000000..64a54213 --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/AI/Variables/AI_TypeVariable.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: f957a5172f5460f4ca991e26997cddac +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/AI/Variables/Declaration.meta b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/AI/Variables/Declaration.meta new file mode 100644 index 00000000..39e51eb4 --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/AI/Variables/Declaration.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 24d0a11605f46cb4c8fdccd29bccb700 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/AI/Variables/Declaration/AI_Declaration.cs b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/AI/Variables/Declaration/AI_Declaration.cs new file mode 100644 index 00000000..e59ea748 --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/AI/Variables/Declaration/AI_Declaration.cs @@ -0,0 +1,27 @@ +namespace BinarySerializer.Ubisoft.CPA.U64 { + public class AI_Declaration : U64_Struct { + public ushort BlockSize { get; set; } // Size of Buffer + public U64_ArrayReference Variables { get; set; } + public U64_ArrayReference> SaveTypes { get; set; } + public U64_ArrayReference> InitTypes { get; set; } + public ushort VariablesCountInBuffer { get; set; } // In buffer + public ushort VariablesCount { get; set; } + public ushort SaveTypesCount { get; set; } + public ushort InitTypesCount { get; set; } + + public override void SerializeImpl(SerializerObject s) { + BlockSize = s.Serialize(BlockSize, name: nameof(BlockSize)); + Variables = s.SerializeObject>(Variables, name: nameof(Variables)); + SaveTypes = s.SerializeObject>>(SaveTypes, name: nameof(SaveTypes)); + InitTypes = s.SerializeObject>>(InitTypes, name: nameof(InitTypes)); + VariablesCountInBuffer = s.Serialize(VariablesCountInBuffer, name: nameof(VariablesCountInBuffer)); + VariablesCount = s.Serialize(VariablesCount, name: nameof(VariablesCount)); + SaveTypesCount = s.Serialize(SaveTypesCount, name: nameof(SaveTypesCount)); + InitTypesCount = s.Serialize(InitTypesCount, name: nameof(InitTypesCount)); + + Variables?.Resolve(s, VariablesCount); + SaveTypes?.Resolve(s, SaveTypesCount); + InitTypes?.Resolve(s, InitTypesCount); + } + } +} diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/AI/Variables/Declaration/AI_Declaration.cs.meta b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/AI/Variables/Declaration/AI_Declaration.cs.meta new file mode 100644 index 00000000..0db24282 --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/AI/Variables/Declaration/AI_Declaration.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 050ca1420b49d964797010dcbacf5fd6 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/AI/Variables/Declaration/AI_DeclarationVariable.cs b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/AI/Variables/Declaration/AI_DeclarationVariable.cs new file mode 100644 index 00000000..2ed14cda --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/AI/Variables/Declaration/AI_DeclarationVariable.cs @@ -0,0 +1,11 @@ +namespace BinarySerializer.Ubisoft.CPA.U64 { + public class AI_DeclarationVariable : U64_Struct { + public AI_Variable_Value Value { get; set; } + public ushort OffsetInBuffer { get; set; } + + public override void SerializeImpl(SerializerObject s) { + Value = s.SerializeObject(Value, name: nameof(Value)); + OffsetInBuffer = s.Serialize(OffsetInBuffer, name: nameof(OffsetInBuffer)); + } + } +} diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/AI/Variables/Declaration/AI_DeclarationVariable.cs.meta b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/AI/Variables/Declaration/AI_DeclarationVariable.cs.meta new file mode 100644 index 00000000..72b9e792 --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/AI/Variables/Declaration/AI_DeclarationVariable.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 68ef8c9f8241ac14e910899673cbea2c +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/AI/Variables/Initialization.meta b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/AI/Variables/Initialization.meta new file mode 100644 index 00000000..75ca4ca4 --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/AI/Variables/Initialization.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 975224523f466ee4593d09477dcf10e5 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/AI/Variables/Initialization/AI_Initialization.cs b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/AI/Variables/Initialization/AI_Initialization.cs new file mode 100644 index 00000000..f64f742a --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/AI/Variables/Initialization/AI_Initialization.cs @@ -0,0 +1,9 @@ +namespace BinarySerializer.Ubisoft.CPA.U64 { + public class AI_Initialization : U64_Struct { + public LST_ReferenceList Variables { get; set; } + + public override void SerializeImpl(SerializerObject s) { + Variables = s.SerializeObject>(Variables, name: nameof(Variables))?.Resolve(s); + } + } +} diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/AI/Variables/Initialization/AI_Initialization.cs.meta b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/AI/Variables/Initialization/AI_Initialization.cs.meta new file mode 100644 index 00000000..0c84922e --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/AI/Variables/Initialization/AI_Initialization.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 8f2551f9a0f66dc42a1a1e5cfc11a7e8 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/AI/Variables/Initialization/AI_InitializationVariable.cs b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/AI/Variables/Initialization/AI_InitializationVariable.cs new file mode 100644 index 00000000..3fa76724 --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/AI/Variables/Initialization/AI_InitializationVariable.cs @@ -0,0 +1,11 @@ +namespace BinarySerializer.Ubisoft.CPA.U64 { + public class AI_InitializationVariable : U64_Struct { + public ushort VariableId { get; set; } // Index in Declaration + public AI_Variable_Value Value { get; set; } + + public override void SerializeImpl(SerializerObject s) { + VariableId = s.Serialize(VariableId, name: nameof(VariableId)); + Value = s.SerializeObject(Value, name: nameof(Value)); + } + } +} diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/AI/Variables/Initialization/AI_InitializationVariable.cs.meta b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/AI/Variables/Initialization/AI_InitializationVariable.cs.meta new file mode 100644 index 00000000..3586a4fe --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/AI/Variables/Initialization/AI_InitializationVariable.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 746810ab2c3e2f143bd5a4168cdd379c +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/AI/Variables/Value.meta b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/AI/Variables/Value.meta new file mode 100644 index 00000000..ef0f9672 --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/AI/Variables/Value.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: ed2109e4d6341414c992ab9620667cec +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/AI/Variables/Value/AI_Declaration_ArrayEntry.cs b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/AI/Variables/Value/AI_Declaration_ArrayEntry.cs new file mode 100644 index 00000000..3090df38 --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/AI/Variables/Value/AI_Declaration_ArrayEntry.cs @@ -0,0 +1,74 @@ +using System; + +namespace BinarySerializer.Ubisoft.CPA.U64 { + public class AI_Declaration_ArrayEntry : U64_Struct { + // Set in onPreSerialize + public ushort Pre_Type { get; set; } + + // Struct members + public int ValueInt { get; set; } + public uint ValueUInt { get; set; } + public float ValueFloat { get; set; } + public U64_Reference ValueWayPoint { get; set; } + public U64_Reference ValuePerso { get; set; } + public U64_Reference ValueVector { get; set; } + public U64_Index ValueText { get; set; } + + public ushort ArrayIndex { get; set; } // Index of variable (which is the array) + public ushort EntryIndex { get; set; } // Index in array + + public override void SerializeImpl(SerializerObject s) { + SerializeValue(s); + ArrayIndex = s.Serialize(ArrayIndex, name: nameof(ArrayIndex)); + EntryIndex = s.Serialize(EntryIndex, name: nameof(EntryIndex)); + } + + private void SerializeValue(SerializerObject s) { + void SerializeShort(Action a) { + // Serialize padding for different endians, since this is actually an int. + if (s.GetCPASettings().GetEndian == Endian.Big) s.SerializePadding(2, logIfNotNull: true); + a(); + if (s.GetCPASettings().GetEndian == Endian.Little) s.SerializePadding(2, logIfNotNull: true); + } + + + // Serialize differently depending on type + var aiTypes = Context.GetCPASettings().AITypes; + var nodeType = aiTypes.GetDsgVarType(Pre_Type); + switch (nodeType) { + case AI_DsgVarType.Float: + ValueFloat = s.Serialize(ValueFloat, name: nameof(ValueFloat)); + break; + case AI_DsgVarType.Int: + ValueInt = s.Serialize(ValueInt, name: nameof(ValueInt)); + break; + case AI_DsgVarType.UInt: + ValueUInt = s.Serialize(ValueUInt, name: nameof(ValueUInt)); + break; + case AI_DsgVarType.Perso: + SerializeShort(() => { + ValuePerso = s.SerializeObject>(ValuePerso, name: nameof(ValuePerso))?.Resolve(s); + }); + break; + case AI_DsgVarType.WayPoint: + SerializeShort(() => { + ValueWayPoint = s.SerializeObject>(ValueWayPoint, name: nameof(ValueWayPoint))?.Resolve(s); + }); + break; + case AI_DsgVarType.Vector: + SerializeShort(() => { + ValueVector = s.SerializeObject>(ValueVector, name: nameof(ValueVector))?.Resolve(s); + }); + break; + case AI_DsgVarType.Text: + SerializeShort(() => { + ValueText = s.SerializeObject>(ValueText, name: nameof(ValueText)); + }); + break; + + default: + throw new BinarySerializableException(this, $"Untreated DeclarationType {nodeType}:{Pre_Type} for ArrayEntry"); + } + } + } +} diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/AI/Variables/Value/AI_Declaration_ArrayEntry.cs.meta b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/AI/Variables/Value/AI_Declaration_ArrayEntry.cs.meta new file mode 100644 index 00000000..7a896149 --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/AI/Variables/Value/AI_Declaration_ArrayEntry.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: ab7283f7227cf3446a84c12fea5b78f7 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/AI/Variables/Value/AI_Declaration_Float.cs b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/AI/Variables/Value/AI_Declaration_Float.cs new file mode 100644 index 00000000..110bf78f --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/AI/Variables/Value/AI_Declaration_Float.cs @@ -0,0 +1,9 @@ +namespace BinarySerializer.Ubisoft.CPA.U64 { + public class AI_Declaration_Float : U64_Struct { + public float Value { get; set; } + + public override void SerializeImpl(SerializerObject s) { + Value = s.Serialize(Value, name: nameof(Value)); + } + } +} diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/AI/Variables/Value/AI_Declaration_Float.cs.meta b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/AI/Variables/Value/AI_Declaration_Float.cs.meta new file mode 100644 index 00000000..cbe82f98 --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/AI/Variables/Value/AI_Declaration_Float.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: afb2d45a4cdac70479afb75995877236 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/AI/Variables/Value/AI_Declaration_Long.cs b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/AI/Variables/Value/AI_Declaration_Long.cs new file mode 100644 index 00000000..c9755de0 --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/AI/Variables/Value/AI_Declaration_Long.cs @@ -0,0 +1,9 @@ +namespace BinarySerializer.Ubisoft.CPA.U64 { + public class AI_Declaration_Long : U64_Struct { + public int Value { get; set; } + + public override void SerializeImpl(SerializerObject s) { + Value = s.Serialize(Value, name: nameof(Value)); + } + } +} diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/AI/Variables/Value/AI_Declaration_Long.cs.meta b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/AI/Variables/Value/AI_Declaration_Long.cs.meta new file mode 100644 index 00000000..6a3054c9 --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/AI/Variables/Value/AI_Declaration_Long.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: a8c1e61a88fd8dc4e973365062ae1f82 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/AI/Variables/Value/AI_Declaration_UnsignedLong.cs b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/AI/Variables/Value/AI_Declaration_UnsignedLong.cs new file mode 100644 index 00000000..86a53ae8 --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/AI/Variables/Value/AI_Declaration_UnsignedLong.cs @@ -0,0 +1,9 @@ +namespace BinarySerializer.Ubisoft.CPA.U64 { + public class AI_Declaration_UnsignedLong : U64_Struct { + public uint Value { get; set; } + + public override void SerializeImpl(SerializerObject s) { + Value = s.Serialize(Value, name: nameof(Value)); + } + } +} diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/AI/Variables/Value/AI_Declaration_UnsignedLong.cs.meta b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/AI/Variables/Value/AI_Declaration_UnsignedLong.cs.meta new file mode 100644 index 00000000..77502c3a --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/AI/Variables/Value/AI_Declaration_UnsignedLong.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: f5c90e03a64ced64ca744af3b7aea50d +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/AI/Variables/Value/AI_Declaration_Vector3D.cs b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/AI/Variables/Value/AI_Declaration_Vector3D.cs new file mode 100644 index 00000000..4a978139 --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/AI/Variables/Value/AI_Declaration_Vector3D.cs @@ -0,0 +1,9 @@ +namespace BinarySerializer.Ubisoft.CPA.U64 { + public class AI_Declaration_Vector3D : U64_Struct { + public MTH3D_Vector Value { get; set; } + + public override void SerializeImpl(SerializerObject s) { + Value = s.SerializeObject(Value, name: nameof(Value)); + } + } +} diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/AI/Variables/Value/AI_Declaration_Vector3D.cs.meta b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/AI/Variables/Value/AI_Declaration_Vector3D.cs.meta new file mode 100644 index 00000000..7b248585 --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/AI/Variables/Value/AI_Declaration_Vector3D.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: d12a23881ea03404cb58ee61dd6fa6a3 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/AI/Variables/Value/AI_Variable_Value.cs b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/AI/Variables/Value/AI_Variable_Value.cs new file mode 100644 index 00000000..fb182d57 --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/AI/Variables/Value/AI_Variable_Value.cs @@ -0,0 +1,123 @@ +using System; + +namespace BinarySerializer.Ubisoft.CPA.U64 { + public class AI_Variable_Value : U64_Struct { + public bool IsArrayEntry { get; set; } + public ushort Type { get; set; } + + // Value types + public U64_Reference ValueArrayEntry { get; set; } + public bool ValueBoolean { get; set; } + public sbyte ValueSByte { get; set; } + public byte ValueUByte { get; set; } + public short ValueShort { get; set; } + public ushort ValueUShort { get; set; } + public byte ValueListMaxSize { get; set; } + public U64_Reference ValueInt { get; set; } + public U64_Reference ValueUInt { get; set; } + public U64_Reference ValueFloat { get; set; } + public U64_Reference ValueVector { get; set; } + public U64_Reference ValueWayPoint { get; set; } + public U64_Reference ValuePerso { get; set; } + public U64_Index ValueText { get; set; } + public U64_Reference ValueGraph { get; set; } + public U64_Reference ValueComport { get; set; } + public U64_Reference ValueAction { get; set; } + public U64_Reference ValueCaps { get; set; } + public ushort ValueArraySize { get; set; } + + public override void SerializeImpl(SerializerObject s) { + s.DoBits(b => { + Type = b.SerializeBits(Type, 15, name: nameof(Type)); + IsArrayEntry = b.SerializeBits(IsArrayEntry, 1, name: nameof(IsArrayEntry)); + }); + SerializeValue(s); + } + + private void SerializeValue(SerializerObject s) { + // Serialize differently depending on type + var aiTypes = Context.GetCPASettings().AITypes; + var nodeType = aiTypes.GetDsgVarType(Type); + if (IsArrayEntry) { + ValueArrayEntry = s.SerializeObject>(ValueArrayEntry, name: nameof(ValueArrayEntry)) + ?.Resolve(s, onPreSerialize: (_,a) => a.Pre_Type = Type); + } else { + switch (nodeType) { + case AI_DsgVarType.Boolean: + s.DoBits(b => { + ValueBoolean = b.SerializeBits(ValueBoolean, 1, name: nameof(ValueBoolean)); + b.SerializePadding(15, logIfNotNull: true); + }); + break; + case AI_DsgVarType.SByte: + s.DoBits(b => { + ValueSByte = b.SerializeBits(ValueSByte, 8, SignedNumberRepresentation.TwosComplement, name: nameof(ValueSByte)); + b.SerializePadding(8, logIfNotNull: false); // Don't log. Can be 0xFF because the value was expanded to a short + }); + break; + case AI_DsgVarType.UByte: + s.DoBits(b => { + ValueUByte = b.SerializeBits(ValueUByte, 8, name: nameof(ValueUByte)); + b.SerializePadding(8, logIfNotNull: true); + }); + break; + case AI_DsgVarType.Short: + ValueShort = s.Serialize(ValueShort, name: nameof(ValueShort)); + break; + case AI_DsgVarType.UShort: + ValueUShort = s.Serialize(ValueUShort, name: nameof(ValueUShort)); + break; + case AI_DsgVarType.Int: + ValueInt = s.SerializeObject>(ValueInt, name: nameof(ValueInt))?.Resolve(s); + break; + case AI_DsgVarType.UInt: + ValueUInt = s.SerializeObject>(ValueUInt, name: nameof(ValueUInt))?.Resolve(s); + break; + case AI_DsgVarType.Float: + ValueFloat = s.SerializeObject>(ValueFloat, name: nameof(ValueFloat))?.Resolve(s); + break; + case AI_DsgVarType.Vector: + ValueVector = s.SerializeObject>(ValueVector, name: nameof(ValueVector))?.Resolve(s); + break; + case AI_DsgVarType.Perso: + ValuePerso = s.SerializeObject>(ValuePerso, name: nameof(ValuePerso))?.Resolve(s); + break; + case AI_DsgVarType.WayPoint: + ValueWayPoint = s.SerializeObject>(ValueWayPoint, name: nameof(ValueWayPoint))?.Resolve(s); + break; + case AI_DsgVarType.Text: + ValueText = s.SerializeObject>(ValueText, name: nameof(ValueText)); + break; + case AI_DsgVarType.Comport: + ValueComport = s.SerializeObject>(ValueComport, name: nameof(ValueComport))?.Resolve(s); + break; + case AI_DsgVarType.Graph: + ValueGraph = s.SerializeObject>(ValueGraph, name: nameof(ValueGraph))?.Resolve(s); + break; + case AI_DsgVarType.Action: + ValueAction = s.SerializeObject>(ValueAction, name: nameof(ValueAction))?.Resolve(s); + break; + case AI_DsgVarType.Caps: + ValueCaps = s.SerializeObject>(ValueCaps, name: nameof(ValueCaps))?.Resolve(s); + break; + case AI_DsgVarType.List: + s.DoBits(b => { + ValueListMaxSize = b.SerializeBits(ValueListMaxSize, 8, name: nameof(ValueListMaxSize)); + b.SerializePadding(8, logIfNotNull: true); + }); + break; + case AI_DsgVarType.IntegerArray: + case AI_DsgVarType.FloatArray: + case AI_DsgVarType.PersoArray: + case AI_DsgVarType.WayPointArray: + case AI_DsgVarType.VectorArray: + case AI_DsgVarType.TextArray: + ValueArraySize = s.Serialize(ValueArraySize, name: nameof(ValueArraySize)); + break; + default: + throw new BinarySerializableException(this, $"Unimplemented dsgvar type {nodeType} ({Type})"); + } + } + } + } +} diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/AI/Variables/Value/AI_Variable_Value.cs.meta b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/AI/Variables/Value/AI_Variable_Value.cs.meta new file mode 100644 index 00000000..5f0f2bed --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/AI/Variables/Value/AI_Variable_Value.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 77c7ea4bb2859aa4d92c944d6f1a9df8 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/FON.meta b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/FON.meta new file mode 100644 index 00000000..5cc12038 --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/FON.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: ff07913599e2f13498c4b17feb1fad24 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/FON/FON_LanguageString.cs b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/FON/FON_LanguageString.cs new file mode 100644 index 00000000..98fefe0e --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/FON/FON_LanguageString.cs @@ -0,0 +1,15 @@ +namespace BinarySerializer.Ubisoft.CPA.U64 { + public class FON_LanguageString : U64_Struct { + public LST_ReferenceList StringList { get; set; } + public LST_ReferenceList StringLengthList { get; set; } + public ushort Language { get; set; } + public string LanguageName { get; set; } + + public override void SerializeImpl(SerializerObject s) { + StringList = s.SerializeObject>(StringList, name: nameof(StringList))?.Resolve(s); + StringLengthList = s.SerializeObject>(StringLengthList, name: nameof(StringLengthList))?.Resolve(s); + Language = s.Serialize(Language, name: nameof(Language)); + LanguageName = s.SerializeString(LanguageName, 18, name: nameof(LanguageName)); + } + } +} diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/FON/FON_LanguageString.cs.meta b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/FON/FON_LanguageString.cs.meta new file mode 100644 index 00000000..7d079cf7 --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/FON/FON_LanguageString.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 15b2e1e35a7221c49afe1d3a09605cfa +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/FON/FON_LanguagesCount.cs b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/FON/FON_LanguagesCount.cs new file mode 100644 index 00000000..d104e420 --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/FON/FON_LanguagesCount.cs @@ -0,0 +1,9 @@ +namespace BinarySerializer.Ubisoft.CPA.U64 { + public class FON_LanguagesCount : U64_Struct { + public ushort LanguagesCount { get; set; } + + public override void SerializeImpl(SerializerObject s) { + LanguagesCount = s.Serialize(LanguagesCount, name: nameof(LanguagesCount)); + } + } +} diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/FON/FON_LanguagesCount.cs.meta b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/FON/FON_LanguagesCount.cs.meta new file mode 100644 index 00000000..27ae5c43 --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/FON/FON_LanguagesCount.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 5e82b73cbe34ef84fac04a9df6350aea +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/FON/FON_StringLength.cs b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/FON/FON_StringLength.cs new file mode 100644 index 00000000..59570331 --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/FON/FON_StringLength.cs @@ -0,0 +1,18 @@ +using System.Text; + +namespace BinarySerializer.Ubisoft.CPA.U64 { + public class FON_StringLength : U64_Struct { + public U64_String String { get; set; } + + public byte Length { + get { + if(String?.Value?.Value?.BinaryValue == null) return 0; + return String.Value.Value.BinaryValue[0]; + } + } + + public override void SerializeImpl(SerializerObject s) { + String = s.SerializeObject(String, onPreSerialize: str => str.Pre_IsBinary = true, name: nameof(String)); + } + } +} diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/FON/FON_StringLength.cs.meta b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/FON/FON_StringLength.cs.meta new file mode 100644 index 00000000..939f6399 --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/FON/FON_StringLength.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 38f7823b44fb6ba479187ab04b22c1dc +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/FON/FON_TextString.cs b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/FON/FON_TextString.cs new file mode 100644 index 00000000..d57f67b4 --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/FON/FON_TextString.cs @@ -0,0 +1,9 @@ +namespace BinarySerializer.Ubisoft.CPA.U64 { + public class FON_TextString : U64_Struct { + public U64_String String { get; set; } + + public override void SerializeImpl(SerializerObject s) { + String = s.SerializeObject(String, name: nameof(String)); + } + } +} diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/FON/FON_TextString.cs.meta b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/FON/FON_TextString.cs.meta new file mode 100644 index 00000000..3cd42d28 --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/FON/FON_TextString.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 5ca0504e6d1b4e549b0be8736db25477 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/GAM.meta b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/GAM.meta new file mode 100644 index 00000000..579378e4 --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/GAM.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 5f77e8555c195b84c8e797f0cde27fe9 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/GAM/Character.meta b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/GAM/Character.meta new file mode 100644 index 00000000..3d3eb670 --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/GAM/Character.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 92d21a3efa0277c4eb95529c0a4634b0 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/GAM/Character/GAM_Character.cs b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/GAM/Character/GAM_Character.cs new file mode 100644 index 00000000..fee61357 --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/GAM/Character/GAM_Character.cs @@ -0,0 +1,30 @@ +namespace BinarySerializer.Ubisoft.CPA.U64 { + // Loaded into EngineObject + public class GAM_Character : U64_Struct { + public U64_Reference _3dData { get; set; } + public U64_Reference Brain { get; set; } + public U64_Reference CineInfo { get; set; } + public U64_Reference CollSet { get; set; } + public U64_Reference Light { get; set; } + public U64_Reference Micro { get; set; } + public U64_Reference StandardGame { get; set; } + // Tonic Trouble: Stream, Stocklist, World, Way + public U64_Reference Dynamics { get; set; } + public U64_Reference Sound { get; set; } + public byte AllocWay { get; set; } + + public override void SerializeImpl(SerializerObject s) { + _3dData = s.SerializeObject>(_3dData, name: nameof(_3dData))?.Resolve(s); + Brain = s.SerializeObject>(Brain, name: nameof(Brain))?.Resolve(s); + CineInfo = s.SerializeObject>(CineInfo, name: nameof(CineInfo))?.Resolve(s); + CollSet = s.SerializeObject>(CollSet, name: nameof(CollSet))?.Resolve(s); + Light = s.SerializeObject>(Light, name: nameof(Light))?.Resolve(s); + Micro = s.SerializeObject>(Micro, name: nameof(Micro))?.Resolve(s); + StandardGame = s.SerializeObject>(StandardGame, name: nameof(StandardGame))?.Resolve(s); + Dynamics = s.SerializeObject>(Dynamics, name: nameof(Dynamics))?.Resolve(s); + Sound = s.SerializeObject>(Sound, name: nameof(Sound))?.Resolve(s); + AllocWay = s.Serialize(AllocWay, name: nameof(AllocWay)); + s.SerializePadding(1, logIfNotNull: false); // Can be 0xFF + } + } +} diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/GAM/Character/GAM_Character.cs.meta b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/GAM/Character/GAM_Character.cs.meta new file mode 100644 index 00000000..4a781e70 --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/GAM/Character/GAM_Character.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 3aaa509efeff13c4aac5707492748166 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/GAM/Character/MicroStructures.meta b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/GAM/Character/MicroStructures.meta new file mode 100644 index 00000000..89016bec --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/GAM/Character/MicroStructures.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: adf7a207c42006c428ccf7ee2f95d2cf +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/GAM/Character/MicroStructures/GAM_Character3dData.cs b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/GAM/Character/MicroStructures/GAM_Character3dData.cs new file mode 100644 index 00000000..387a1854 --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/GAM/Character/MicroStructures/GAM_Character3dData.cs @@ -0,0 +1,60 @@ +using System; + +namespace BinarySerializer.Ubisoft.CPA.U64 { + public class GAM_Character3dData : U64_Struct { + public DrawMaskFlags DrawMask { get; set; } + public MTH2D_Vector ShadowScale { get; set; } + public U64_Reference InitialState { get; set; } + public U64_Reference InitialObjectsTable { get; set; } + public byte BrainComputationFrequency { get; set; } + public bool IsAlphabet { get; set; } + + public override void SerializeImpl(SerializerObject s) { + DrawMask = s.Serialize(DrawMask, name: nameof(DrawMask)); + ShadowScale = s.SerializeObject(ShadowScale, name: nameof(ShadowScale)); + InitialState = s.SerializeObject>(InitialState, name: nameof(InitialState))?.Resolve(s); + InitialObjectsTable = s.SerializeObject>(InitialObjectsTable, name: nameof(InitialObjectsTable))?.Resolve(s); + BrainComputationFrequency = s.Serialize(BrainComputationFrequency, name: nameof(BrainComputationFrequency)); + IsAlphabet = s.Serialize(IsAlphabet, name: nameof(IsAlphabet)); + s.SerializePadding(2, logIfNotNull: true); + } + + [Flags] + public enum DrawMaskFlags : uint { + None = 0, + IsTextured = 1, + IsGouraud = 2, // else is flat + IsNotWired = 4, // so is solid + IsNotGrided = 8, + IsNotDoted = 16, // means draw only the points + IsNotOutlined = 32, // means draw only the points + IsNotDrawCollideInformation = 64, // means draw collision spheres & box + IsNotDrawCollideInformationLight = 128, // Draw only periferical + IsNotForceDefaultMaterial = 256, // Draw only periferical + IsNotForceColorMaterial = 512, // draw triangles with a single color set in the material + IsTestingBackface = 1024, + IsNotDrawingSuperObjectBoundingVolume = 2048, + IsUseRLI = 4096, + IsNotComputeSpecular = 8192, + HasNotPriority = 16384, // 14th bit : Means this object has no priority + IsUseStaticLights = 32768, + IsUseShadow = 65536, + CameraIsUnderWater = 131072, + NotForceZSorting = 262144, + NotInvertBackfaces = 524288, + NotHideWhatIsUnderWater = 0x100000, + DrawNothing = 0x200000, + IsNotChromed = 0x400000, + IsNotVisibleInRealWorld = 0x800000, + IsNotVisibleInSymetricWorld = 0x1000000, + IsNotDrawingInMirror = 0x2000000, + IsNotLightAlphaSensitive = 0x4000000, + IsWriteZBuffer = 0x8000000, + HasNoMirror = 0x10000000, + IsNotSinusEffectOnRLI = 0x20000000, + IsEnableZSorting = 0x40000000, + HasNotSinusEffect = 0x80000000, + EnableAll = 0xFFFFFFFF + } + } +} diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/GAM/Character/MicroStructures/GAM_Character3dData.cs.meta b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/GAM/Character/MicroStructures/GAM_Character3dData.cs.meta new file mode 100644 index 00000000..93b645d3 --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/GAM/Character/MicroStructures/GAM_Character3dData.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 1c4e8d84530e616459dedf20a0ea7ce2 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/GAM/Character/MicroStructures/GAM_CharacterBrain.cs b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/GAM/Character/MicroStructures/GAM_CharacterBrain.cs new file mode 100644 index 00000000..60bf1221 --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/GAM/Character/MicroStructures/GAM_CharacterBrain.cs @@ -0,0 +1,17 @@ +using System; + +namespace BinarySerializer.Ubisoft.CPA.U64 { + public class GAM_CharacterBrain : U64_Struct { + public U64_Reference AIModel { get; set; } + public U64_Reference InitComportIntelligence { get; set; } + public U64_Reference InitComportReflex { get; set; } + public U64_Reference InitVariables { get; set; } + + public override void SerializeImpl(SerializerObject s) { + AIModel = s.SerializeObject>(AIModel, name: nameof(AIModel))?.Resolve(s); + InitComportIntelligence = s.SerializeObject>(InitComportIntelligence, name: nameof(InitComportIntelligence))?.Resolve(s); + InitComportReflex = s.SerializeObject>(InitComportReflex, name: nameof(InitComportReflex))?.Resolve(s); + InitVariables = s.SerializeObject>(InitVariables, name: nameof(InitVariables))?.Resolve(s); + } + } +} diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/GAM/Character/MicroStructures/GAM_CharacterBrain.cs.meta b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/GAM/Character/MicroStructures/GAM_CharacterBrain.cs.meta new file mode 100644 index 00000000..bb66648d --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/GAM/Character/MicroStructures/GAM_CharacterBrain.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 6bdda29229fc2f7449b72d6e648d666e +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/GAM/Character/MicroStructures/GAM_CharacterCineInfo.cs b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/GAM/Character/MicroStructures/GAM_CharacterCineInfo.cs new file mode 100644 index 00000000..96ca9a9b --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/GAM/Character/MicroStructures/GAM_CharacterCineInfo.cs @@ -0,0 +1,70 @@ +using System; + +namespace BinarySerializer.Ubisoft.CPA.U64 { + public class GAM_CharacterCineInfo : U64_Struct { + public MTH3D_Vector ShiftTarget { get; set; } + public MTH3D_Vector ShiftPosition { get; set; } + public Speed LinearSpeed { get; set; } + public Speed AngularSpeed { get; set; } + public Speed TargetSpeed { get; set; } + public MinMax Distance { get; set; } + public MinMax BoundDistance { get; set; } + public MinMax Z { get; set; } + public Angle Alpha { get; set; } + public Angle Theta { get; set; } + public float Focal { get; set; } + public ushort DNMFlags { get; set; } + public ushort AIFlags { get; set; } + public ushort Viewport { get; set; } + public ushort Activation { get; set; } + public short Channel { get; set; } + + public override void SerializeImpl(SerializerObject s) { + ShiftTarget = s.SerializeObject(ShiftTarget, name: nameof(ShiftTarget)); + ShiftPosition = s.SerializeObject(ShiftPosition, name: nameof(ShiftPosition)); + LinearSpeed = s.SerializeObject(LinearSpeed, name: nameof(LinearSpeed)); + AngularSpeed = s.SerializeObject(AngularSpeed, name: nameof(AngularSpeed)); + TargetSpeed = s.SerializeObject(TargetSpeed, name: nameof(TargetSpeed)); + Distance = s.SerializeObject(Distance, name: nameof(Distance)); + BoundDistance = s.SerializeObject(BoundDistance, name: nameof(BoundDistance)); + Z = s.SerializeObject(Z, name: nameof(Z)); + Alpha = s.SerializeObject(Alpha, name: nameof(Alpha)); + Theta = s.SerializeObject(Theta, name: nameof(Theta)); + Focal = s.Serialize(Focal, name: nameof(Focal)); + DNMFlags = s.Serialize(DNMFlags, name: nameof(DNMFlags)); + AIFlags = s.Serialize(AIFlags, name: nameof(AIFlags)); + Viewport = s.Serialize(Viewport, name: nameof(Viewport)); + Activation = s.Serialize(Activation, name: nameof(Activation)); + Channel = s.Serialize(Channel, name: nameof(Channel)); + s.SerializePadding(2, logIfNotNull: true); + } + + public class Speed : BinarySerializable { + public float Value { get; set; } + public float ValueIncrease { get; set; } + public float ValueDecrease { get; set; } + + public override void SerializeImpl(SerializerObject s) { + Value = s.Serialize(Value, name: nameof(Value)); + ValueIncrease = s.Serialize(ValueIncrease, name: nameof(ValueIncrease)); + ValueDecrease = s.Serialize(ValueDecrease, name: nameof(ValueDecrease)); + } + } + public class MinMax : BinarySerializable { + public float Min { get; set; } + public float Max { get; set; } + public override void SerializeImpl(SerializerObject s) { + Min = s.Serialize(Min, name: nameof(Min)); + Max = s.Serialize(Max, name: nameof(Max)); + } + } + public class Angle : BinarySerializable { + public float Value { get; set; } + public float ValueShift { get; set; } + public override void SerializeImpl(SerializerObject s) { + Value = s.Serialize(Value, name: nameof(Value)); + ValueShift = s.Serialize(ValueShift, name: nameof(ValueShift)); + } + } + } +} diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/GAM/Character/MicroStructures/GAM_CharacterCineInfo.cs.meta b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/GAM/Character/MicroStructures/GAM_CharacterCineInfo.cs.meta new file mode 100644 index 00000000..2bfbfa09 --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/GAM/Character/MicroStructures/GAM_CharacterCineInfo.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 87abd93e7d7ff4e4e81d2ac04117dc90 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/GAM/Character/MicroStructures/GAM_CharacterCollSet.cs b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/GAM/Character/MicroStructures/GAM_CharacterCollSet.cs new file mode 100644 index 00000000..c52b9baf --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/GAM/Character/MicroStructures/GAM_CharacterCollSet.cs @@ -0,0 +1,29 @@ +using System; + +namespace BinarySerializer.Ubisoft.CPA.U64 { + public class GAM_CharacterCollSet : U64_Struct { + public U64_Reference[] ZdxTables { get; set; } + public U64_Reference[] ActivationTables { get; set; } + public short CharacterPriority { get; set; } + public byte CollisionFlag { get; set; } + public byte CollisionComputeFrequency { get; set; } + + public override void SerializeImpl(SerializerObject s) { + ZdxTables = s.SerializeObjectArray>(ZdxTables, 4, name: nameof(ZdxTables)); + foreach(var zdx in ZdxTables) zdx?.Resolve(s); + ActivationTables = s.SerializeObjectArray>(ActivationTables, 4, name: nameof(ActivationTables)); + foreach(var zdx in ActivationTables) zdx?.Resolve(s); + + CharacterPriority = s.Serialize(CharacterPriority, name: nameof(CharacterPriority)); + CollisionFlag = s.Serialize(CollisionFlag, name: nameof(CollisionFlag)); + CollisionComputeFrequency = s.Serialize(CollisionComputeFrequency, name: nameof(CollisionComputeFrequency)); + } + + public enum ZoneType : byte { + Zdd = 0, + Zdm = 1, + Zde = 2, + Zdr = 3 + } + } +} diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/GAM/Character/MicroStructures/GAM_CharacterCollSet.cs.meta b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/GAM/Character/MicroStructures/GAM_CharacterCollSet.cs.meta new file mode 100644 index 00000000..7e21fd60 --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/GAM/Character/MicroStructures/GAM_CharacterCollSet.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 645e1ef1d02067949a3c3e076a49f245 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/GAM/Character/MicroStructures/GAM_CharacterDynamics.cs b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/GAM/Character/MicroStructures/GAM_CharacterDynamics.cs new file mode 100644 index 00000000..52c9be11 --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/GAM/Character/MicroStructures/GAM_CharacterDynamics.cs @@ -0,0 +1,35 @@ +using System; + +namespace BinarySerializer.Ubisoft.CPA.U64 { + public class GAM_CharacterDynamics : U64_Struct { + public MTH3D_Vector SlideFactor { get; set; } + public DynamFlags Flags { get; set; } // Saved, but not actually loaded by the DS engine! + public StructSize DynamSize { get; set; } + public bool Collision { get; set; } + + public override void SerializeImpl(SerializerObject s) { + SlideFactor = s.SerializeObject(SlideFactor, name: nameof(SlideFactor)); + Flags = s.Serialize(Flags, name: nameof(Flags)); + DynamSize = s.Serialize(DynamSize, name: nameof(DynamSize)); + Collision = s.Serialize(Collision, name: nameof(Collision)); + } + + public enum StructSize : byte { + Base = 0, + Advanced = 1, + Complex = 2 + } + + [Flags] + public enum DynamFlags : ushort { + Unknown = 0, + Solid = 1 << 0, + Liquid = 1 << 1, + Gas = 1 << 2, + Plasma = 1 << 3, + IsMobile = 1 << 4, + CanHangSmthgOn = 1 << 5, + TakeCareOfTheEnvironment = 1 << 6, + } + } +} diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/GAM/Character/MicroStructures/GAM_CharacterDynamics.cs.meta b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/GAM/Character/MicroStructures/GAM_CharacterDynamics.cs.meta new file mode 100644 index 00000000..669607db --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/GAM/Character/MicroStructures/GAM_CharacterDynamics.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: d3772d0b9a56db24ea762cb5194cfeb5 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/GAM/Character/MicroStructures/GAM_CharacterLight.cs b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/GAM/Character/MicroStructures/GAM_CharacterLight.cs new file mode 100644 index 00000000..5326de1c --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/GAM/Character/MicroStructures/GAM_CharacterLight.cs @@ -0,0 +1,72 @@ +using System; + +namespace BinarySerializer.Ubisoft.CPA.U64 { + public class GAM_CharacterLight : U64_Struct { + public float Far { get; set; } + public float Near { get; set; } + public float LittleAlpha { get; set; } + public float BigAlpha { get; set; } + public float LittleTangent { get; set; } + public float BigTangent { get; set; } + public GLI_FloatColor Color { get; set; } + public float Gyrophare { get; set; } + public float PulseStep { get; set; } + public float PulseMaxRange { get; set; } + public MTH3D_Vector LightOffset { get; set; } + public MTH3D_Vector LightDirection { get; set; } + public MTH3D_Vector InterMinPos { get; set; } + public MTH3D_Vector InterMaxPos { get; set; } + public MTH3D_Vector ExterMinPos { get; set; } + public MTH3D_Vector ExterMaxPos { get; set; } + public float IntensityMin { get; set; } + public float IntensityMax { get; set; } + + // Flags + public LightType Type { get; set; } + public bool IsOn { get; set; } + public ushort Flags { get; set; } + + public bool IsGyroPhare { get; set; } + public bool IsPulse { get; set; } + public bool IsLocal { get; set; } // Unused on DS + public bool IsOnlyLocal { get; set; } // Unused on DS + + public override void SerializeImpl(SerializerObject s) { + Far = s.Serialize(Far, name: nameof(Far)); + Near = s.Serialize(Near, name: nameof(Near)); + LittleAlpha = s.Serialize(LittleAlpha, name: nameof(LittleAlpha)); + BigAlpha = s.Serialize(BigAlpha, name: nameof(BigAlpha)); + LittleTangent = s.Serialize(LittleTangent, name: nameof(LittleTangent)); + BigTangent = s.Serialize(BigTangent, name: nameof(BigTangent)); + Color = s.SerializeObject(Color, name: nameof(Color)); + Gyrophare = s.Serialize(Gyrophare, name: nameof(Gyrophare)); + PulseStep = s.Serialize(PulseStep, name: nameof(PulseStep)); + PulseMaxRange = s.Serialize(PulseMaxRange, name: nameof(PulseMaxRange)); + LightOffset = s.SerializeObject(LightOffset, name: nameof(LightOffset)); + LightDirection = s.SerializeObject(LightDirection, name: nameof(LightDirection)); + InterMinPos = s.SerializeObject(InterMinPos, name: nameof(InterMinPos)); + InterMaxPos = s.SerializeObject(InterMaxPos, name: nameof(InterMaxPos)); + ExterMinPos = s.SerializeObject(ExterMinPos, name: nameof(ExterMinPos)); + ExterMaxPos = s.SerializeObject(ExterMaxPos, name: nameof(ExterMaxPos)); + IntensityMin = s.Serialize(IntensityMin, name: nameof(IntensityMin)); + IntensityMax = s.Serialize(IntensityMax, name: nameof(IntensityMax)); + s.DoBits(b => { + Type = b.SerializeBits(Type, 2, name: nameof(Type)); + IsOn = b.SerializeBits(IsOn, 1, name: nameof(IsOn)); + Flags = b.SerializeBits(Flags, 16-3, name: nameof(Flags)); + }); + IsGyroPhare = s.Serialize(IsGyroPhare, name: nameof(IsGyroPhare)); + IsPulse = s.Serialize(IsPulse, name: nameof(IsPulse)); + IsLocal = s.Serialize(IsLocal, name: nameof(IsLocal)); + IsOnlyLocal = s.Serialize(IsOnlyLocal, name: nameof(IsOnlyLocal)); + s.SerializePadding(2, logIfNotNull: true); + } + + public enum LightType : byte { + Ambient = 0, + Parallel = 1, + Spherical = 2, + HotSpot = 3 + } + } +} diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/GAM/Character/MicroStructures/GAM_CharacterLight.cs.meta b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/GAM/Character/MicroStructures/GAM_CharacterLight.cs.meta new file mode 100644 index 00000000..3342cd78 --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/GAM/Character/MicroStructures/GAM_CharacterLight.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 07b3fd6f848e2eb4ea0c489badd05756 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/GAM/Character/MicroStructures/GAM_CharacterMicro.cs b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/GAM/Character/MicroStructures/GAM_CharacterMicro.cs new file mode 100644 index 00000000..640cf559 --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/GAM/Character/MicroStructures/GAM_CharacterMicro.cs @@ -0,0 +1,21 @@ +using System; + +namespace BinarySerializer.Ubisoft.CPA.U64 { + public class GAM_CharacterMicro : U64_Struct { + public MTH3D_Matrix Rotation { get; set; } + public U64_Index Translation { get; set; } + public MicroFlags Flags { get; set; } + + public override void SerializeImpl(SerializerObject s) { + Rotation = s.SerializeObject(Rotation, name: nameof(Rotation)); + Translation = s.SerializeObject>(Translation, name: nameof(Translation))?.SetAction(GAM_Fix.GetVector3DIndex); + Flags = s.Serialize(Flags, name: nameof(Flags)); + } + + [Flags] + public enum MicroFlags : ushort { + None = 0, + IsActive = (1 << 0), + } + } +} diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/GAM/Character/MicroStructures/GAM_CharacterMicro.cs.meta b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/GAM/Character/MicroStructures/GAM_CharacterMicro.cs.meta new file mode 100644 index 00000000..6d131387 --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/GAM/Character/MicroStructures/GAM_CharacterMicro.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 8908cf92866ec414c8ee7681cee4975d +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/GAM/Character/MicroStructures/GAM_CharacterSound.cs b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/GAM/Character/MicroStructures/GAM_CharacterSound.cs new file mode 100644 index 00000000..6cd33177 --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/GAM/Character/MicroStructures/GAM_CharacterSound.cs @@ -0,0 +1,13 @@ +using System; + +namespace BinarySerializer.Ubisoft.CPA.U64 { + public class GAM_CharacterSound : U64_Struct { + public FixedPointInt32 SaturationDistance { get; set; } + public FixedPointInt32 BackgroundDistance { get; set; } + + public override void SerializeImpl(SerializerObject s) { + SaturationDistance = s.SerializeObject(SaturationDistance, onPreSerialize: d => d.Pre_PointPosition = 16, name: nameof(SaturationDistance)); + BackgroundDistance = s.SerializeObject(BackgroundDistance, onPreSerialize: d => d.Pre_PointPosition = 16, name: nameof(BackgroundDistance)); + } + } +} diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/GAM/Character/MicroStructures/GAM_CharacterSound.cs.meta b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/GAM/Character/MicroStructures/GAM_CharacterSound.cs.meta new file mode 100644 index 00000000..690a89a3 --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/GAM/Character/MicroStructures/GAM_CharacterSound.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 4acef1a3076198c41b3fe879f590e567 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/GAM/Character/MicroStructures/GAM_CharacterStandardGame.cs b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/GAM/Character/MicroStructures/GAM_CharacterStandardGame.cs new file mode 100644 index 00000000..5e5c0cf2 --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/GAM/Character/MicroStructures/GAM_CharacterStandardGame.cs @@ -0,0 +1,51 @@ +using System; + +namespace BinarySerializer.Ubisoft.CPA.U64 { + public class GAM_CharacterStandardGame : U64_Struct { + public uint CustomBitsInit { get; set; } + public uint Capabilities { get; set; } + public U64_Reference Family { get; set; } + public short HitPointsInit { get; set; } + public short HitPointsMaxInit { get; set; } + public short HitPointsMaxMax { get; set; } + public StdInitFlag Flags { get; set; } + public ushort SpecialPositionFlags { get; set; } // Unused in Rayman 2 + public Platform PlatformType { get; set; } + public byte TransparencyZoneMin { get; set; } + public byte TransparencyZoneMax { get; set; } + public byte TooFarLimit { get; set; } + + public override void SerializeImpl(SerializerObject s) { + CustomBitsInit = s.Serialize(CustomBitsInit, name: nameof(CustomBitsInit)); + Capabilities = s.Serialize(Capabilities, name: nameof(Capabilities)); + Family = s.SerializeObject>(Family, name: nameof(Family))?.Resolve(s); + HitPointsInit = s.Serialize(HitPointsInit, name: nameof(HitPointsInit)); + HitPointsMaxInit = s.Serialize(HitPointsMaxInit, name: nameof(HitPointsMaxInit)); + HitPointsMaxMax = s.Serialize(HitPointsMaxMax, name: nameof(HitPointsMaxMax)); + Flags = s.Serialize(Flags, name: nameof(Flags)); + SpecialPositionFlags = s.Serialize(SpecialPositionFlags, name: nameof(SpecialPositionFlags)); + PlatformType = s.Serialize(PlatformType, name: nameof(PlatformType)); + TransparencyZoneMin = s.Serialize(TransparencyZoneMin, name: nameof(TransparencyZoneMin)); + TransparencyZoneMax = s.Serialize(TransparencyZoneMax, name: nameof(TransparencyZoneMax)); + TooFarLimit = s.Serialize(TooFarLimit, name: nameof(TooFarLimit)); + } + + [Flags] + public enum StdInitFlag : ushort { + None = 0, + WhenOutOfZoneNeverBack = 1 << 0, + WhenOutOfZoneGoOutOfZone = 1 << 1, + WhenDeadOrTakenNeverBack = 1 << 2, + WhenDeadOrTakenGoOutOfZone = 1 << 3, + WhenDeadOrTakenAlways = 1 << 4, + WhenDeadOrTakenPlayerDead = 1 << 5, + WhenDeadOrTakenMapLoaded = 1 << 6, + WhenDeadOrTakenSavedGameLoaded = 1 << 7, + } + + public enum Platform : byte { + None = 0, + StandardPlatform = 1 + } + } +} diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/GAM/Character/MicroStructures/GAM_CharacterStandardGame.cs.meta b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/GAM/Character/MicroStructures/GAM_CharacterStandardGame.cs.meta new file mode 100644 index 00000000..a3d9d372 --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/GAM/Character/MicroStructures/GAM_CharacterStandardGame.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 195a09fe426917444a49b6dd5896aace +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/GAM/Character/Zdx.meta b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/GAM/Character/Zdx.meta new file mode 100644 index 00000000..d97f304f --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/GAM/Character/Zdx.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: f24b1b78a4a23bf438e07d5d758c0ad0 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/GAM/Character/Zdx/GAM_ActivationZone.cs b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/GAM/Character/Zdx/GAM_ActivationZone.cs new file mode 100644 index 00000000..e2f57e4c --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/GAM/Character/Zdx/GAM_ActivationZone.cs @@ -0,0 +1,11 @@ +using System; + +namespace BinarySerializer.Ubisoft.CPA.U64 { + public class GAM_ActivationZone : U64_Struct { // List of indices of Zdx to be activated when this zone is enabled + public LST_List ZdxIndices { get; set; } + + public override void SerializeImpl(SerializerObject s) { + ZdxIndices = s.SerializeObject>(ZdxIndices, name: nameof(ZdxIndices))?.Resolve(s); + } + } +} diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/GAM/Character/Zdx/GAM_ActivationZone.cs.meta b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/GAM/Character/Zdx/GAM_ActivationZone.cs.meta new file mode 100644 index 00000000..199df2ab --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/GAM/Character/Zdx/GAM_ActivationZone.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 714a28ec6d2824c4fb6bacac4b589f1d +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/GAM/Character/Zdx/GAM_ZdxArray.cs b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/GAM/Character/Zdx/GAM_ZdxArray.cs new file mode 100644 index 00000000..1c4e7c5e --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/GAM/Character/Zdx/GAM_ZdxArray.cs @@ -0,0 +1,11 @@ +using System; + +namespace BinarySerializer.Ubisoft.CPA.U64 { + public class GAM_ZdxArray : U64_Struct { + public LST_ReferenceList GeometricObjects { get; set; } + + public override void SerializeImpl(SerializerObject s) { + GeometricObjects = s.SerializeObject>(GeometricObjects, name: nameof(GeometricObjects))?.Resolve(s); + } + } +} diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/GAM/Character/Zdx/GAM_ZdxArray.cs.meta b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/GAM/Character/Zdx/GAM_ZdxArray.cs.meta new file mode 100644 index 00000000..4fca8c6a --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/GAM/Character/Zdx/GAM_ZdxArray.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 7a4e1ca4c65fa2c4fb3a2d6ef416e040 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/GAM/Character/Zdx/GAM_ZdxIndex.cs b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/GAM/Character/Zdx/GAM_ZdxIndex.cs new file mode 100644 index 00000000..1888ee1d --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/GAM/Character/Zdx/GAM_ZdxIndex.cs @@ -0,0 +1,11 @@ +using System; + +namespace BinarySerializer.Ubisoft.CPA.U64 { + public class GAM_ZdxIndex : U64_Struct { + public short Index { get; set; } + + public override void SerializeImpl(SerializerObject s) { + Index = s.Serialize(Index, name: nameof(Index)); + } + } +} diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/GAM/Character/Zdx/GAM_ZdxIndex.cs.meta b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/GAM/Character/Zdx/GAM_ZdxIndex.cs.meta new file mode 100644 index 00000000..db9fbde0 --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/GAM/Character/Zdx/GAM_ZdxIndex.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 30169b6ad14995e4c8222036fb32a8eb +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/GAM/Character/Zdx/GAM_ZoneSet.cs b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/GAM/Character/Zdx/GAM_ZoneSet.cs new file mode 100644 index 00000000..ecb3ed11 --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/GAM/Character/Zdx/GAM_ZoneSet.cs @@ -0,0 +1,13 @@ +using System; + +namespace BinarySerializer.Ubisoft.CPA.U64 { + public class GAM_ZoneSet : U64_Struct { // State - Activation zone pair + public U64_Reference ActivationZone { get; set; } + public U64_Reference State { get; set; } + + public override void SerializeImpl(SerializerObject s) { + ActivationZone = s.SerializeObject>(ActivationZone, name: nameof(ActivationZone))?.Resolve(s); + State = s.SerializeObject>(State, name: nameof(State))?.Resolve(s); + } + } +} diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/GAM/Character/Zdx/GAM_ZoneSet.cs.meta b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/GAM/Character/Zdx/GAM_ZoneSet.cs.meta new file mode 100644 index 00000000..f1155f2f --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/GAM/Character/Zdx/GAM_ZoneSet.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 5ea52bde4ee5e1b409083ac56e14da34 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/GAM/Character/Zdx/GAM_ZoneSetArray.cs b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/GAM/Character/Zdx/GAM_ZoneSetArray.cs new file mode 100644 index 00000000..16393819 --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/GAM/Character/Zdx/GAM_ZoneSetArray.cs @@ -0,0 +1,11 @@ +using System; + +namespace BinarySerializer.Ubisoft.CPA.U64 { + public class GAM_ZoneSetArray : U64_Struct { // Contains state - activation zone pairs + public LST_List ZoneSets { get; set; } + + public override void SerializeImpl(SerializerObject s) { + ZoneSets = s.SerializeObject>(ZoneSets, name: nameof(ZoneSets))?.Resolve(s); + } + } +} diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/GAM/Character/Zdx/GAM_ZoneSetArray.cs.meta b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/GAM/Character/Zdx/GAM_ZoneSetArray.cs.meta new file mode 100644 index 00000000..4a17295f --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/GAM/Character/Zdx/GAM_ZoneSetArray.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 3fb8dcdba622a5e4f99c74bbbd3a608d +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/GAM/Family.meta b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/GAM/Family.meta new file mode 100644 index 00000000..053f321d --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/GAM/Family.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 1cccd22960726d64a85babc5817c4d30 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/GAM/Family/GAM_AnimInfo.cs b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/GAM/Family/GAM_AnimInfo.cs new file mode 100644 index 00000000..39555fa9 --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/GAM/Family/GAM_AnimInfo.cs @@ -0,0 +1,19 @@ +using System; + +namespace BinarySerializer.Ubisoft.CPA.U64 { + public class GAM_AnimInfo : U64_Struct { + public U64_Reference AnimListTable { get; set; } + public ushort ChannelsCount { get; set; } + public ushort FramesCount { get; set; } + public ushort InterpolatedAnimationIndex { get; set; } + + public override void SerializeImpl(SerializerObject s) { + AnimListTable = s.SerializeObject>(AnimListTable, name: nameof(AnimListTable))?.Resolve(s); + ChannelsCount = s.Serialize(ChannelsCount, name: nameof(ChannelsCount)); + FramesCount = s.Serialize(FramesCount, name: nameof(FramesCount)); + InterpolatedAnimationIndex = s.Serialize(InterpolatedAnimationIndex, name: nameof(InterpolatedAnimationIndex)); // Index in CutTable + + s.GetLoader().LoadInterpolatedAnimation(InterpolatedAnimationIndex); + } + } +} diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/GAM/Family/GAM_AnimInfo.cs.meta b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/GAM/Family/GAM_AnimInfo.cs.meta new file mode 100644 index 00000000..c6a479e8 --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/GAM/Family/GAM_AnimInfo.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 3ffc6e10c2fc9534fa836b7cebebf9b4 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/GAM/Family/GAM_Family.cs b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/GAM/Family/GAM_Family.cs new file mode 100644 index 00000000..564e36b1 --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/GAM/Family/GAM_Family.cs @@ -0,0 +1,17 @@ +using System; + +namespace BinarySerializer.Ubisoft.CPA.U64 { + public class GAM_Family : U64_Struct { + public U64_Reference StateRef { get; set; } + public U64_Reference ObjectsTable { get; set; } + public U64_Reference BoundingVolume { get; set; } + public ushort ChannelsCount { get; set; } + + public override void SerializeImpl(SerializerObject s) { + StateRef = s.SerializeObject>(StateRef, name: nameof(StateRef))?.Resolve(s); + ObjectsTable = s.SerializeObject>(ObjectsTable, name: nameof(ObjectsTable))?.Resolve(s); + BoundingVolume = s.SerializeObject>(BoundingVolume, name: nameof(BoundingVolume))?.Resolve(s); + ChannelsCount = s.Serialize(ChannelsCount, name: nameof(ChannelsCount)); + } + } +} diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/GAM/Family/GAM_Family.cs.meta b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/GAM/Family/GAM_Family.cs.meta new file mode 100644 index 00000000..79750c72 --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/GAM/Family/GAM_Family.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: f70d5df65b37597419ff614d35cc9021 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/GAM/Family/GAM_ObjectsTable.cs b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/GAM/Family/GAM_ObjectsTable.cs new file mode 100644 index 00000000..17163804 --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/GAM/Family/GAM_ObjectsTable.cs @@ -0,0 +1,18 @@ +using System; + +namespace BinarySerializer.Ubisoft.CPA.U64 { + public class GAM_ObjectsTable : U64_Struct { + public U64_ArrayReference ObjectsTableList { get; set; } + public ushort PhysicalObjectsCount { get; set; } + public ushort ZDxUsed { get; set; } + + public override void SerializeImpl(SerializerObject s) { + ObjectsTableList = s.SerializeObject>(ObjectsTableList, name: nameof(ObjectsTableList)); + PhysicalObjectsCount = s.Serialize(PhysicalObjectsCount, name: nameof(PhysicalObjectsCount)); + ZDxUsed = s.Serialize(ZDxUsed, name: nameof(ZDxUsed)); + s.SerializePadding(2, logIfNotNull: true); + + ObjectsTableList?.Resolve(s, PhysicalObjectsCount); + } + } +} diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/GAM/Family/GAM_ObjectsTable.cs.meta b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/GAM/Family/GAM_ObjectsTable.cs.meta new file mode 100644 index 00000000..c9d1e64c --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/GAM/Family/GAM_ObjectsTable.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 1967ae6c2c4f186408fd719343d1d96f +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/GAM/Family/GAM_ObjectsTableEntry.cs b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/GAM/Family/GAM_ObjectsTableEntry.cs new file mode 100644 index 00000000..a4bcaabf --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/GAM/Family/GAM_ObjectsTableEntry.cs @@ -0,0 +1,65 @@ +using System; + +namespace BinarySerializer.Ubisoft.CPA.U64 { + public class GAM_ObjectsTableEntry : U64_Struct { + public Type TypeOfLinkedObject { get; set; } + public EntryLinkedObject LinkedObject { get; set; } + + public override void SerializeImpl(SerializerObject s) { + TypeOfLinkedObject = s.Serialize(TypeOfLinkedObject, name: nameof(TypeOfLinkedObject)); + s.SerializePadding(2, logIfNotNull: true); + LinkedObject = TypeOfLinkedObject switch { + Type.PhysicalObject => s.SerializeObject((PhysicalObject)LinkedObject, name: nameof(LinkedObject)), + Type.Event => s.SerializeObject((Event)LinkedObject, name: nameof(LinkedObject)), + _ => throw new BinarySerializableException(this, $"Invalid {nameof(TypeOfLinkedObject)} value: {TypeOfLinkedObject}") + }; + } + + public enum Type : ushort { + PhysicalObject = 0, + Event = 1 + } + + public abstract class EntryLinkedObject : BinarySerializable { } + + public class PhysicalObject : EntryLinkedObject { + public U64_GenericReference Entry { get; set; } + public U64_Index CustomZoom { get; set; } + //public ushort EntryType { get; set; } + public ushort Flag { get; set; } + + public override void SerializeImpl(SerializerObject s) { + Entry = s.SerializeObject(Entry, + onPreSerialize: gr => gr.ImmediateSerializeType = U64_GenericReference.ImmediateSerialize.Index, + name: nameof(Entry)); + CustomZoom = s.SerializeObject>(CustomZoom, name: nameof(CustomZoom))?.SetAction(GAM_Fix.GetGlobalVector3DIndex); + Entry.SerializeType(s); + Flag = s.Serialize(Flag, name: nameof(Flag)); + + Entry.Resolve(s); + } + } + + public class Event : EntryLinkedObject { + public int Target { get; set; } // For sound events: 16 top bits = bank, 16 bottom bits = event pos + public EventType Type { get; set; } + public byte FirstCall { get; set; } // 255 = never play + public byte Period { get; set; } + public byte Priority { get; set; } + + public override void SerializeImpl(SerializerObject s) { + Target = s.Serialize(Target, name: nameof(Target)); + Type = s.Serialize(Type, name: nameof(Type)); + FirstCall = s.Serialize(FirstCall, name: nameof(FirstCall)); + Period = s.Serialize(Period, name: nameof(Period)); + Priority = s.Serialize(Priority, name: nameof(Priority)); + } + public enum EventType : byte { + SoundEvent = 0, + MechanicEvent = 1, + GenerateEvent = 2, + GenericEvent = 3 + } + } + } +} diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/GAM/Family/GAM_ObjectsTableEntry.cs.meta b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/GAM/Family/GAM_ObjectsTableEntry.cs.meta new file mode 100644 index 00000000..38305b22 --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/GAM/Family/GAM_ObjectsTableEntry.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 3b05f6d0ccb5959479c402086817d23d +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/GAM/Family/GAM_State.cs b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/GAM/Family/GAM_State.cs new file mode 100644 index 00000000..920d505f --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/GAM/Family/GAM_State.cs @@ -0,0 +1,37 @@ +using System; + +namespace BinarySerializer.Ubisoft.CPA.U64 { + public class GAM_State : U64_Struct { + public U64_Reference AnimInfo { get; set; } + public U64_GenericReference MechanicsIdCard { get; set; } + public U64_ArrayReference TargetStateList { get; set; } + public U64_Reference NextState { get; set; } + public U64_Reference ProhibitedTargetState { get; set; } + public ushort TargetStatesCount { get; set; } + // public ushort MechanicsIdCardType { get; set; } + public ushort Repeat { get; set; } + public ushort Speed { get; set; } + public byte TransitionStatusFlag { get; set; } + public byte CustomBits { get; set; } + + public override void SerializeImpl(SerializerObject s) { + AnimInfo = s.SerializeObject>(AnimInfo, name: nameof(AnimInfo))?.Resolve(s); + MechanicsIdCard = s.SerializeObject(MechanicsIdCard, + onPreSerialize: gr => gr.ImmediateSerializeType = U64_GenericReference.ImmediateSerialize.Index, + name: nameof(MechanicsIdCard)); + TargetStateList = s.SerializeObject>(TargetStateList, name: nameof(TargetStateList)); + NextState = s.SerializeObject>(NextState, name: nameof(NextState))?.Resolve(s); + ProhibitedTargetState = s.SerializeObject>(ProhibitedTargetState, name: nameof(ProhibitedTargetState))?.Resolve(s); + + TargetStatesCount = s.Serialize(TargetStatesCount, name: nameof(TargetStatesCount)); + MechanicsIdCard.SerializeType(s); + Repeat = s.Serialize(Repeat, name: nameof(Repeat)); + Speed = s.Serialize(Speed, name: nameof(Speed)); + TransitionStatusFlag = s.Serialize(TransitionStatusFlag, name: nameof(TransitionStatusFlag)); + CustomBits = s.Serialize(CustomBits, name: nameof(CustomBits)); + + TargetStateList?.Resolve(s, TargetStatesCount); + MechanicsIdCard?.Resolve(s); + } + } +} diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/GAM/Family/GAM_State.cs.meta b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/GAM/Family/GAM_State.cs.meta new file mode 100644 index 00000000..40493054 --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/GAM/Family/GAM_State.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 5f1fb2d1189b7bb4890bc247cd802bbd +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/GAM/Family/GAM_StateRef.cs b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/GAM/Family/GAM_StateRef.cs new file mode 100644 index 00000000..43c27c97 --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/GAM/Family/GAM_StateRef.cs @@ -0,0 +1,11 @@ +using System; + +namespace BinarySerializer.Ubisoft.CPA.U64 { + public class GAM_StateRef : U64_Struct { + public LST_ReferenceList StateRefList { get; set; } + + public override void SerializeImpl(SerializerObject s) { + StateRefList = s.SerializeObject>(StateRefList, name: nameof(StateRefList))?.Resolve(s); + } + } +} diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/GAM/Family/GAM_StateRef.cs.meta b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/GAM/Family/GAM_StateRef.cs.meta new file mode 100644 index 00000000..996b52e9 --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/GAM/Family/GAM_StateRef.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: dc723d34acba48140a9c9ede5eb1f9ce +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/GAM/Family/GAM_StateTransition.cs b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/GAM/Family/GAM_StateTransition.cs new file mode 100644 index 00000000..d111ea81 --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/GAM/Family/GAM_StateTransition.cs @@ -0,0 +1,13 @@ +namespace BinarySerializer.Ubisoft.CPA.U64 { + public class GAM_StateTransition : U64_Struct { + public U64_Reference TargetState { get; set; } + public U64_Reference StateToGo { get; set; } + public ushort LinkingType { get; set; } + + public override void SerializeImpl(SerializerObject s) { + TargetState = s.SerializeObject>(TargetState, name: nameof(TargetState))?.Resolve(s); + StateToGo = s.SerializeObject>(StateToGo, name: nameof(StateToGo))?.Resolve(s); + LinkingType = s.Serialize(LinkingType, name: nameof(LinkingType)); + } + } +} diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/GAM/Family/GAM_StateTransition.cs.meta b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/GAM/Family/GAM_StateTransition.cs.meta new file mode 100644 index 00000000..3266ebfe --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/GAM/Family/GAM_StateTransition.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 4760023ffe8de3d42b10b6cad4171b96 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/GAM/Fix.meta b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/GAM/Fix.meta new file mode 100644 index 00000000..6982deff --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/GAM/Fix.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: f994006f3fb3d2343830a32eb60301dd +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/GAM/Fix/GAM_DscMiscInfo.cs b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/GAM/Fix/GAM_DscMiscInfo.cs new file mode 100644 index 00000000..fe0a0a70 --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/GAM/Fix/GAM_DscMiscInfo.cs @@ -0,0 +1,14 @@ +namespace BinarySerializer.Ubisoft.CPA.U64 { + public class GAM_DscMiscInfo : U64_Struct { + public string FirstLevelName { get; set; } + /*public string CreditsLevelName { get; set; } + public bool SkipMainMenu { get; set; }*/ + + public override void SerializeImpl(SerializerObject s) { + FirstLevelName = s.SerializeString(FirstLevelName, 32, name: nameof(FirstLevelName)); + /*CreditsLevelName = s.SerializeString(CreditsLevelName, 32, name: nameof(CreditsLevelName)); + SkipMainMenu = s.Serialize(SkipMainMenu, name: nameof(SkipMainMenu)); + s.SerializePadding(1, logIfNotNull: true);*/ + } + } +} diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/GAM/Fix/GAM_DscMiscInfo.cs.meta b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/GAM/Fix/GAM_DscMiscInfo.cs.meta new file mode 100644 index 00000000..3a922f7f --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/GAM/Fix/GAM_DscMiscInfo.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 3e11892a753561c41afd46eea9e833ab +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/GAM/Fix/GAM_Fix.cs b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/GAM/Fix/GAM_Fix.cs new file mode 100644 index 00000000..000ea5bc --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/GAM/Fix/GAM_Fix.cs @@ -0,0 +1,78 @@ +namespace BinarySerializer.Ubisoft.CPA.U64 { + public class GAM_Fix : U64_Struct { + public U64_ArrayReference LevelsNameList { get; set; } + public U64_Reference DscInput { get; set; } + public U64_Reference InputLink { get; set; } // = 3DOS_EntryActions + public U64_ArrayReference Vector3D { get; set; } + public U64_ArrayReference TripledIndex { get; set; } + public U64_Reference Memory { get; set; } + public U64_Reference ShadowTexture { get; set; } + public U64_Reference LightTexture { get; set; } + public U64_Reference VisualMaterialController { get; set; } // "No Controller" material + public U64_ArrayReference> NoCtrlList { get; set; } // "No Controller" textures + + public ushort Vector3DCount { get; set; } + public ushort TripledIndexCount { get; set; } + public ushort LevelsCount { get; set; } + + public U64_ArrayReference GlobalVector3D { get; set; } + public U64_ArrayReference GlobalTripledIndex { get; set; } + public ushort GlobalVector3DCount { get; set; } + public ushort GlobalTripledIndexCount { get; set; } + + public U64_Reference PakFont { get; set; } + + public override void SerializeImpl(SerializerObject s) { + // No resolving in this. Only load what's absolutely necessary, because this is loaded to create the level list. + + LevelsNameList = s.SerializeObject>(LevelsNameList, name: nameof(LevelsNameList)); + DscInput = s.SerializeObject>(DscInput, name: nameof(DscInput)); + InputLink = s.SerializeObject>(InputLink, name: nameof(InputLink)); + Vector3D = s.SerializeObject>(Vector3D, name: nameof(Vector3D)); + TripledIndex = s.SerializeObject>(TripledIndex, name: nameof(TripledIndex)); + Memory = s.SerializeObject>(Memory, name: nameof(Memory)); + ShadowTexture = s.SerializeObject>(ShadowTexture, name: nameof(ShadowTexture)); + LightTexture = s.SerializeObject>(LightTexture, name: nameof(LightTexture)); + VisualMaterialController = s.SerializeObject>(VisualMaterialController, name: nameof(VisualMaterialController)); + NoCtrlList = s.SerializeObject>>(NoCtrlList, name: nameof(NoCtrlList)); + + Vector3DCount = s.Serialize(Vector3DCount, name: nameof(Vector3DCount)); + TripledIndexCount = s.Serialize(TripledIndexCount, name: nameof(TripledIndexCount)); + LevelsCount = s.Serialize(LevelsCount, name: nameof(LevelsCount)); + + GlobalVector3D = s.SerializeObject>(GlobalVector3D, name: nameof(GlobalVector3D)); + GlobalTripledIndex = s.SerializeObject>(GlobalTripledIndex, name: nameof(GlobalTripledIndex)); + GlobalVector3DCount = s.Serialize(GlobalVector3DCount, name: nameof(GlobalVector3DCount)); + GlobalTripledIndexCount = s.Serialize(GlobalTripledIndexCount, name: nameof(GlobalTripledIndexCount)); + + PakFont = s.SerializeObject>(PakFont, name: nameof(PakFont)); + + // Resolve level list + LevelsNameList.Resolve(s, LevelsCount, isInFixFixFat: true); + } + + public GAM_Fix ResolveLevelReferences(SerializerObject s) { + // Global references + GlobalVector3D.Resolve(s, GlobalVector3DCount, isInFixFixFat: true); + GlobalTripledIndex.Resolve(s, GlobalTripledIndexCount, isInFixFixFat: true); + // Level specific references + Vector3D.Resolve(s, Vector3DCount); + TripledIndex.Resolve(s, TripledIndexCount); + + DscInput?.Resolve(s); + InputLink?.Resolve(s); + Memory?.Resolve(s); + ShadowTexture?.Resolve(s); + LightTexture?.Resolve(s); + VisualMaterialController?.Resolve(s); + NoCtrlList?.Resolve(s, 5); + PakFont?.Resolve(s); + + return this; + } + + // Index resolve actions + public static MTH3D_Vector GetVector3DIndex(U64_Index index) => index.Context.GetLoader().Fix?.Value?.Vector3D?.Value[index.Index]; + public static MTH3D_Vector GetGlobalVector3DIndex(U64_Index index) => index.Context.GetLoader().Fix?.Value?.GlobalVector3D?.Value[index.Index]; + } +} diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/GAM/Fix/GAM_Fix.cs.meta b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/GAM/Fix/GAM_Fix.cs.meta new file mode 100644 index 00000000..4693755f --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/GAM/Fix/GAM_Fix.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 2aa3b693e45b2a14d90db811c666ffc2 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/GAM/Fix/GAM_FixPreloadSection.cs b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/GAM/Fix/GAM_FixPreloadSection.cs new file mode 100644 index 00000000..d72a1931 --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/GAM/Fix/GAM_FixPreloadSection.cs @@ -0,0 +1,9 @@ +namespace BinarySerializer.Ubisoft.CPA.U64 { + public class GAM_FixPreloadSection : U64_Struct { + public LST_ReferenceList Sections { get; set; } + + public override void SerializeImpl(SerializerObject s) { + Sections = s.SerializeObject>(Sections, name: nameof(Sections))?.Resolve(s); + } + } +} diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/GAM/Fix/GAM_FixPreloadSection.cs.meta b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/GAM/Fix/GAM_FixPreloadSection.cs.meta new file mode 100644 index 00000000..6953b2e7 --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/GAM/Fix/GAM_FixPreloadSection.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 3486b01c0093a6a438a576d2b3bbd678 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/GAM/Fix/GAM_LevelsNameList.cs b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/GAM/Fix/GAM_LevelsNameList.cs new file mode 100644 index 00000000..aa96e8b0 --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/GAM/Fix/GAM_LevelsNameList.cs @@ -0,0 +1,11 @@ +namespace BinarySerializer.Ubisoft.CPA.U64 { + public class GAM_LevelsNameList : U64_Struct { + public U64_Reference Level { get; set; } + public string Name { get; set; } + + public override void SerializeImpl(SerializerObject s) { + Level = s.SerializeObject>(Level, name: nameof(Level)); + Name = s.SerializeString(Name, 62, name: nameof(Name)); + } + } +} diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/GAM/Fix/GAM_LevelsNameList.cs.meta b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/GAM/Fix/GAM_LevelsNameList.cs.meta new file mode 100644 index 00000000..0b94e70c --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/GAM/Fix/GAM_LevelsNameList.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 6aaf5cf1f39fa734e92b374483eda7c6 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/GAM/Level.meta b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/GAM/Level.meta new file mode 100644 index 00000000..efae85c6 --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/GAM/Level.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 83ee4f1769ca6c749a9b39290c6d2d48 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/GAM/Level/GAM_DscLevel.cs b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/GAM/Level/GAM_DscLevel.cs new file mode 100644 index 00000000..5d11677c --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/GAM/Level/GAM_DscLevel.cs @@ -0,0 +1,17 @@ +using System; + +namespace BinarySerializer.Ubisoft.CPA.U64 { + public class GAM_DscLevel : U64_Struct { + // public uint SoundThemeId { get; set; } + public U64_Index BeginMapSoundEvent { get; set; } + public ushort AlwaysCount { get; set; } // MaxNumberOfAlways + // public ushort NumberOfTurningSectors { get; set; } + // public ushort NumberOfMovingSurfaces { get; set; } + // public ushort ReserveString { get; set; } + + public override void SerializeImpl(SerializerObject s) { + BeginMapSoundEvent = s.SerializeObject>(BeginMapSoundEvent, name: nameof(BeginMapSoundEvent)); + AlwaysCount = s.Serialize(AlwaysCount, name: nameof(AlwaysCount)); + } + } +} diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/GAM/Level/GAM_DscLevel.cs.meta b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/GAM/Level/GAM_DscLevel.cs.meta new file mode 100644 index 00000000..dbed2921 --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/GAM/Level/GAM_DscLevel.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: d83dad2f0e550f24f875834f57945922 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/GAM/Level/GAM_Level.cs b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/GAM/Level/GAM_Level.cs new file mode 100644 index 00000000..e65e8403 --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/GAM/Level/GAM_Level.cs @@ -0,0 +1,108 @@ +using System; + +namespace BinarySerializer.Ubisoft.CPA.U64 { + public class GAM_Level : U64_Struct { + public U64_Reference EntireLevel { get; set; } + public U64_ArrayReference> SubLevelList { get; set; } + public U64_ArrayReference> AlwaysEntryList { get; set; } + public U64_Reference LevelDescription { get; set; } + public U64_Reference MemoryDescription { get; set; } + + //public U64_Reference SkyVisualMaterial { get; set; } + public ExtendedFarClippingFlags ExtendedFarClipping { get; set; } + public U64_ArrayReference> RRRDSUnknown { get; set; } // StructType: RRRDS_Unknown1List. Count is always 0 in RRR DS and Rayman 3D though + public ushort SubLevelListCount { get; set; } + public ushort AlwaysEntryListCount { get; set; } + public ushort RRRDSUnknownCount { get; set; } + + //public ushort LevelGameSaveLength { get; set; } + public ushort[] TextureCacheSize { get; set; } // Unused on DS + + public ushort MorphTasksCount { get; set; } + public ushort MorphElementsCount { get; set; } + public ushort MorphPointsCount { get; set; } + public ushort MorphQuality { get; set; } + + public ushort GraphicsSize { get; set; } + public ushort GraphicsTransSize { get; set; } + public ushort MatrixSize { get; set; } + public ushort LightSize { get; set; } + public ushort FifoSizeInKB { get; set; } + + public U64_ArrayReference Vector3D { get; set; } + public U64_ArrayReference TripledIndex { get; set; } + public ushort Vector3DCount { get; set; } + public ushort TripledIndexCount { get; set; } + + public ushort CoordinateScale { get; set; } + + // Donald Duck only + public U64_Reference Background_TopLeft { get; set; } + public U64_Reference Background_TopRight { get; set; } + public U64_Reference Background_BottomLeft { get; set; } + public U64_Reference Background_BottomRight { get; set; } + + public override void SerializeImpl(SerializerObject s) { + EntireLevel = s.SerializeObject>(EntireLevel, name: nameof(EntireLevel))?.Resolve(s); + SubLevelList = s.SerializeObject>>(SubLevelList, name: nameof(SubLevelList)); + AlwaysEntryList = s.SerializeObject>>(AlwaysEntryList, name: nameof(AlwaysEntryList)); + LevelDescription = s.SerializeObject>(LevelDescription, name: nameof(LevelDescription))?.Resolve(s); + MemoryDescription = s.SerializeObject>(MemoryDescription, name: nameof(MemoryDescription))?.Resolve(s); + + //SkyVisualMaterial = s.SerializeObject>(SkyVisualMaterial, name: nameof(SkyVisualMaterial))?.Resolve(s); + ExtendedFarClipping = s.Serialize(ExtendedFarClipping, name: nameof(ExtendedFarClipping)); + if (s.GetCPASettings().EngineVersionTree.HasParent(EngineVersion.RaymanRavingRabbids)) + RRRDSUnknown = s.SerializeObject>>(RRRDSUnknown, name: nameof(RRRDSUnknown)); + + SubLevelListCount = s.Serialize(SubLevelListCount, name: nameof(SubLevelListCount)); + AlwaysEntryListCount = s.Serialize(AlwaysEntryListCount, name: nameof(AlwaysEntryListCount)); + if (s.GetCPASettings().EngineVersionTree.HasParent(EngineVersion.RaymanRavingRabbids)) + RRRDSUnknownCount = s.Serialize(RRRDSUnknownCount, name: nameof(RRRDSUnknownCount)); + + SubLevelList?.Resolve(s, SubLevelListCount); + AlwaysEntryList?.Resolve(s, AlwaysEntryListCount); + if (s.GetCPASettings().EngineVersionTree.HasParent(EngineVersion.RaymanRavingRabbids)) + RRRDSUnknown?.Resolve(s, RRRDSUnknownCount); + + //LevelGameSaveLength = s.Serialize(LevelGameSaveLength, name: nameof(LevelGameSaveLength)); + TextureCacheSize = s.SerializeArray(TextureCacheSize, 6, name: nameof(TextureCacheSize)); + + MorphTasksCount = s.Serialize(MorphTasksCount, name: nameof(MorphTasksCount)); + MorphElementsCount = s.Serialize(MorphElementsCount, name: nameof(MorphElementsCount)); + MorphPointsCount = s.Serialize(MorphPointsCount, name: nameof(MorphPointsCount)); + MorphQuality = s.Serialize(MorphQuality, name: nameof(MorphQuality)); + + GraphicsSize = s.Serialize(GraphicsSize, name: nameof(GraphicsSize)); + GraphicsTransSize = s.Serialize(GraphicsTransSize, name: nameof(GraphicsTransSize)); + MatrixSize = s.Serialize(MatrixSize, name: nameof(MatrixSize)); + LightSize = s.Serialize(LightSize, name: nameof(LightSize)); + FifoSizeInKB = s.Serialize(FifoSizeInKB, name: nameof(FifoSizeInKB)); + + Vector3D = s.SerializeObject>(Vector3D, name: nameof(Vector3D)); + TripledIndex = s.SerializeObject>(TripledIndex, name: nameof(TripledIndex)); + Vector3DCount = s.Serialize(Vector3DCount, name: nameof(Vector3DCount)); + TripledIndexCount = s.Serialize(TripledIndexCount, name: nameof(TripledIndexCount)); + Vector3D?.Resolve(s, Vector3DCount); + TripledIndex?.Resolve(s, TripledIndexCount); + + CoordinateScale = s.Serialize(CoordinateScale, name: nameof(CoordinateScale)); + + if (s.GetCPASettings().EngineVersionTree.HasParent(EngineVersion.DonaldDuckQuackAttack)) { + Background_TopLeft = s.SerializeObject>(Background_TopLeft, name: nameof(Background_TopLeft))?.Resolve(s); + Background_TopRight = s.SerializeObject>(Background_TopRight, name: nameof(Background_TopRight))?.Resolve(s); + Background_BottomLeft = s.SerializeObject>(Background_BottomLeft, name: nameof(Background_BottomLeft))?.Resolve(s); + Background_BottomRight = s.SerializeObject>(Background_BottomRight, name: nameof(Background_BottomRight))?.Resolve(s); + } + } + + // Index resolve actions + public static MTH3D_Vector GetVector3DIndex(U64_Index index) => index.Context.GetLoader().Level?.Value?.Vector3D?.Value[index.Index]; + + [Flags] + public enum ExtendedFarClippingFlags : ushort { + NormalClipping = (0 << 0), // Camera Near = 1, Far = 256 + ExtendedClipping = (1 << 0), // Camera Near = 2, Far = 1024 + EraseBackground = (1 << 1) + } + } +} diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/GAM/Level/GAM_Level.cs.meta b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/GAM/Level/GAM_Level.cs.meta new file mode 100644 index 00000000..4ebf9f02 --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/GAM/Level/GAM_Level.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 9b57747b2033ce545ba61e71b6c9578d +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/GAM/Level/GAM_LevelDescription.cs b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/GAM/Level/GAM_LevelDescription.cs new file mode 100644 index 00000000..1de1d490 --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/GAM/Level/GAM_LevelDescription.cs @@ -0,0 +1,11 @@ +using System; + +namespace BinarySerializer.Ubisoft.CPA.U64 { + public class GAM_LevelDescription : U64_Struct { + public U64_Reference LevelDescription { get; set; } + + public override void SerializeImpl(SerializerObject s) { + LevelDescription = s.SerializeObject>(LevelDescription, name: nameof(LevelDescription))?.Resolve(s); + } + } +} diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/GAM/Level/GAM_LevelDescription.cs.meta b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/GAM/Level/GAM_LevelDescription.cs.meta new file mode 100644 index 00000000..1e955035 --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/GAM/Level/GAM_LevelDescription.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: c978a36a6bbc02549bfd8ec909bce2b2 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/GAM/Level/GAM_LevelEntry.cs b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/GAM/Level/GAM_LevelEntry.cs new file mode 100644 index 00000000..0dbe304f --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/GAM/Level/GAM_LevelEntry.cs @@ -0,0 +1,29 @@ +using System; + +namespace BinarySerializer.Ubisoft.CPA.U64 { + public class GAM_LevelEntry : U64_Struct { + public U64_Reference Character { get; set; } + public POS_CompletePosition Matrix { get; set; } + public LevelEntryFlags Flags { get; set; } + public byte Transparency { get; set; } + public HIE_SuperObjectFlags CharacterFlags { get; set; } + + public override void SerializeImpl(SerializerObject s) { + Character = s.SerializeObject>(Character, name: nameof(Character))?.Resolve(s); + Matrix = s.SerializeObject(Matrix, name: nameof(Matrix)); + Flags = s.Serialize(Flags, name: nameof(Flags)); + Transparency = s.Serialize(Transparency, name: nameof(Transparency)); + s.SerializePadding(1, logIfNotNull: true); + CharacterFlags = s.Serialize(CharacterFlags, name: nameof(CharacterFlags)); + } + + [Flags] + public enum LevelEntryFlags : ushort { + None = 0, + PrincipalCharacter = 1, + CharacterLaunchingSounds = 2, + CharacterAlwaysActive = 4, + StandardCamera = 32, + } + } +} diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/GAM/Level/GAM_LevelEntry.cs.meta b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/GAM/Level/GAM_LevelEntry.cs.meta new file mode 100644 index 00000000..927762a5 --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/GAM/Level/GAM_LevelEntry.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 831c55f492f8b92458273e8a3f1b11a6 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/GAM/Level/GAM_SubLevel.cs b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/GAM/Level/GAM_SubLevel.cs new file mode 100644 index 00000000..caf77364 --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/GAM/Level/GAM_SubLevel.cs @@ -0,0 +1,26 @@ +using System; + +namespace BinarySerializer.Ubisoft.CPA.U64 { + public class GAM_SubLevel : U64_Struct { + public U64_ArrayReference> LevelEntryList { get; set; } + public U64_Reference SuperObjectRoot { get; set; } + public U64_ArrayReference StartMatrixList { get; set; } + public ushort LevelEntryListCount { get; set; } + public ushort StartMatrixListCount { get; set; } + public U64_Index SubmapSoundEvent { get; set; } + + public override void SerializeImpl(SerializerObject s) { + LevelEntryList = s.SerializeObject>>(LevelEntryList, name: nameof(LevelEntryList)); + SuperObjectRoot = s.SerializeObject>(SuperObjectRoot, name: nameof(SuperObjectRoot))?.Resolve(s); + StartMatrixList = s.SerializeObject>(StartMatrixList, name: nameof(StartMatrixList)); + LevelEntryListCount = s.Serialize(LevelEntryListCount, name: nameof(LevelEntryListCount)); + StartMatrixListCount = s.Serialize(StartMatrixListCount, name: nameof(StartMatrixListCount)); + + SubmapSoundEvent = s.SerializeObject>(SubmapSoundEvent, name: nameof(SubmapSoundEvent)); + + LevelEntryList?.Resolve(s, LevelEntryListCount); + StartMatrixList?.Resolve(s, StartMatrixListCount); + } + + } +} diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/GAM/Level/GAM_SubLevel.cs.meta b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/GAM/Level/GAM_SubLevel.cs.meta new file mode 100644 index 00000000..c15e9a9b --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/GAM/Level/GAM_SubLevel.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 4db7aa93c64d389429f93f341544753a +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/GAM/Memory.meta b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/GAM/Memory.meta new file mode 100644 index 00000000..30ce4867 --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/GAM/Memory.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 63a3114ce71a9654fa35643f4ed92d58 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/GAM/Memory/GAM_FixMemory.cs b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/GAM/Memory/GAM_FixMemory.cs new file mode 100644 index 00000000..c222b964 --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/GAM/Memory/GAM_FixMemory.cs @@ -0,0 +1,12 @@ +namespace BinarySerializer.Ubisoft.CPA.U64 { + public class GAM_FixMemory : GAM_LevelMemory { + public uint FON { get; set; } + public uint IPT { get; set; } + + public override void SerializeImpl(SerializerObject s) { + base.SerializeImpl(s); + FON = s.Serialize(FON, name: nameof(FON)); + IPT = s.Serialize(IPT, name: nameof(IPT)); + } + } +} diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/GAM/Memory/GAM_FixMemory.cs.meta b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/GAM/Memory/GAM_FixMemory.cs.meta new file mode 100644 index 00000000..61af3b20 --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/GAM/Memory/GAM_FixMemory.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: f83342bc1d149b14aa0031ea9587a4db +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/GAM/Memory/GAM_GenericMemory.cs b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/GAM/Memory/GAM_GenericMemory.cs new file mode 100644 index 00000000..b4067ce6 --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/GAM/Memory/GAM_GenericMemory.cs @@ -0,0 +1,9 @@ +namespace BinarySerializer.Ubisoft.CPA.U64 { + public class GAM_GenericMemory : U64_Struct { + public U64_GenericReference Memory { get; set; } + + public override void SerializeImpl(SerializerObject s) { + Memory = s.SerializeObject(Memory, name: nameof(Memory))?.Resolve(s); + } + } +} diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/GAM/Memory/GAM_GenericMemory.cs.meta b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/GAM/Memory/GAM_GenericMemory.cs.meta new file mode 100644 index 00000000..c5523956 --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/GAM/Memory/GAM_GenericMemory.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: e9066fa54c0ad284b947cb347e98e9f1 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/GAM/Memory/GAM_LevelMemory.cs b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/GAM/Memory/GAM_LevelMemory.cs new file mode 100644 index 00000000..89f7cc56 --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/GAM/Memory/GAM_LevelMemory.cs @@ -0,0 +1,19 @@ +namespace BinarySerializer.Ubisoft.CPA.U64 { + public class GAM_LevelMemory : U64_Struct { + public uint AI { get; set; } + public uint ACP { get; set; } + public uint ACPU64 { get; set; } + public uint SAI { get; set; } + public uint TMP { get; set; } + public uint Game { get; set; } + + public override void SerializeImpl(SerializerObject s) { + AI = s.Serialize(AI, name: nameof(AI)); + ACP = s.Serialize(ACP, name: nameof(ACP)); + ACPU64 = s.Serialize(ACPU64, name: nameof(ACPU64)); + SAI = s.Serialize(SAI, name: nameof(SAI)); + TMP = s.Serialize(TMP, name: nameof(TMP)); + Game = s.Serialize(Game, name: nameof(Game)); + } + } +} diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/GAM/Memory/GAM_LevelMemory.cs.meta b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/GAM/Memory/GAM_LevelMemory.cs.meta new file mode 100644 index 00000000..28cf321b --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/GAM/Memory/GAM_LevelMemory.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: f921fdb97db909c4287abc5ae892c70b +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/GEO.meta b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/GEO.meta new file mode 100644 index 00000000..4dd3f17a --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/GEO.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 5358147eb1065f141bff95563aacbae1 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/GEO/Element.meta b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/GEO/Element.meta new file mode 100644 index 00000000..0008c350 --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/GEO/Element.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 1a6e62a9c9191f3428fad4cd14f64625 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/GEO/Element/Collision.meta b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/GEO/Element/Collision.meta new file mode 100644 index 00000000..3d99e8c1 --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/GEO/Element/Collision.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 90ac2c91f5f199a4283fc88bba92380f +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/GEO/Element/Collision/GEO_AlignedBox.cs b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/GEO/Element/Collision/GEO_AlignedBox.cs new file mode 100644 index 00000000..c7726388 --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/GEO/Element/Collision/GEO_AlignedBox.cs @@ -0,0 +1,15 @@ +using System; + +namespace BinarySerializer.Ubisoft.CPA.U64 { + public class GEO_AlignedBox : U64_Struct { + public U64_Reference Material { get; set; } + public ushort MinPointIndex { get; set; } + public ushort MaxPointIndex { get; set; } + + public override void SerializeImpl(SerializerObject s) { + Material = s.SerializeObject>(Material, name: nameof(Material))?.Resolve(s); + MinPointIndex = s.Serialize(MinPointIndex, name: nameof(MinPointIndex)); + MaxPointIndex = s.Serialize(MaxPointIndex, name: nameof(MaxPointIndex)); + } + } +} diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/GEO/Element/Collision/GEO_AlignedBox.cs.meta b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/GEO/Element/Collision/GEO_AlignedBox.cs.meta new file mode 100644 index 00000000..6d92e859 --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/GEO/Element/Collision/GEO_AlignedBox.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 9bb8e8f758c378747951d7367af735a8 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/GEO/Element/Collision/GEO_ElementAlignedBoxes.cs b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/GEO/Element/Collision/GEO_ElementAlignedBoxes.cs new file mode 100644 index 00000000..d6aa0ff6 --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/GEO/Element/Collision/GEO_ElementAlignedBoxes.cs @@ -0,0 +1,11 @@ +using System; + +namespace BinarySerializer.Ubisoft.CPA.U64 { + public class GEO_ElementAlignedBoxes : U64_Struct { + public LST_List Boxes { get; set; } + + public override void SerializeImpl(SerializerObject s) { + Boxes = s.SerializeObject>(Boxes, name: nameof(Boxes))?.Resolve(s); + } + } +} diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/GEO/Element/Collision/GEO_ElementAlignedBoxes.cs.meta b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/GEO/Element/Collision/GEO_ElementAlignedBoxes.cs.meta new file mode 100644 index 00000000..e3a1e401 --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/GEO/Element/Collision/GEO_ElementAlignedBoxes.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: df6ab4e759a9a474bb86f08116ca9e8f +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/GEO/Element/Collision/GEO_ElementCollisionIndexedTriangles.cs b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/GEO/Element/Collision/GEO_ElementCollisionIndexedTriangles.cs new file mode 100644 index 00000000..bacadfa6 --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/GEO/Element/Collision/GEO_ElementCollisionIndexedTriangles.cs @@ -0,0 +1,25 @@ +using System; + +namespace BinarySerializer.Ubisoft.CPA.U64 { + public class GEO_ElementCollisionIndexedTriangles : U64_Struct { + public U64_GenericReference Material { get; set; } + public U64_ArrayReference FacesTripledIndices { get; set; } + public U64_Reference PointedSector { get; set; } // SuperObject + public ushort FacesCount { get; set; } + public ushort UVsCount { get; set; } + + public override void SerializeImpl(SerializerObject s) { + Material = s.SerializeObject(Material, onPreSerialize: m => m.ImmediateSerializeType = U64_GenericReference.ImmediateSerialize.Index, name: nameof(Material)); + FacesTripledIndices = s.SerializeObject>(FacesTripledIndices, name: nameof(FacesTripledIndices)); + PointedSector = s.SerializeObject>(PointedSector, name: nameof(PointedSector))?.Resolve(s); + FacesCount = s.Serialize(FacesCount, name: nameof(FacesCount)); + UVsCount = s.Serialize(UVsCount, name: nameof(UVsCount)); + Material?.SerializeType(s); + + // Resolve + FacesTripledIndices?.Resolve(s, FacesCount); + Material?.Resolve(s); + } + } + +} diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/GEO/Element/Collision/GEO_ElementCollisionIndexedTriangles.cs.meta b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/GEO/Element/Collision/GEO_ElementCollisionIndexedTriangles.cs.meta new file mode 100644 index 00000000..2cc2a0cf --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/GEO/Element/Collision/GEO_ElementCollisionIndexedTriangles.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 1509c07e974936c40925f77dc39f41c5 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/GEO/Element/Collision/GEO_ElementSpheres.cs b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/GEO/Element/Collision/GEO_ElementSpheres.cs new file mode 100644 index 00000000..062266b7 --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/GEO/Element/Collision/GEO_ElementSpheres.cs @@ -0,0 +1,11 @@ +using System; + +namespace BinarySerializer.Ubisoft.CPA.U64 { + public class GEO_ElementSpheres : U64_Struct { + public LST_List Spheres { get; set; } + + public override void SerializeImpl(SerializerObject s) { + Spheres = s.SerializeObject>(Spheres, name: nameof(Spheres))?.Resolve(s); + } + } +} diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/GEO/Element/Collision/GEO_ElementSpheres.cs.meta b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/GEO/Element/Collision/GEO_ElementSpheres.cs.meta new file mode 100644 index 00000000..266bd2b6 --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/GEO/Element/Collision/GEO_ElementSpheres.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 200aa126bce384e4c8e97602577e1d13 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/GEO/Element/Collision/GEO_Sphere.cs b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/GEO/Element/Collision/GEO_Sphere.cs new file mode 100644 index 00000000..40af7209 --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/GEO/Element/Collision/GEO_Sphere.cs @@ -0,0 +1,15 @@ +using System; + +namespace BinarySerializer.Ubisoft.CPA.U64 { + public class GEO_Sphere : U64_Struct { + public float Radius { get; set; } + public U64_Reference Material { get; set; } + public ushort CenterPointIndex { get; set; } + + public override void SerializeImpl(SerializerObject s) { + Radius = s.Serialize(Radius, name: nameof(Radius)); + Material = s.SerializeObject>(Material, name: nameof(Material))?.Resolve(s); + CenterPointIndex = s.Serialize(CenterPointIndex, name: nameof(CenterPointIndex)); + } + } +} diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/GEO/Element/Collision/GEO_Sphere.cs.meta b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/GEO/Element/Collision/GEO_Sphere.cs.meta new file mode 100644 index 00000000..7075e96c --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/GEO/Element/Collision/GEO_Sphere.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: ff553d7c37fcc2144b7ea0b93e55ab4c +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/GEO/Element/Visual.meta b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/GEO/Element/Visual.meta new file mode 100644 index 00000000..35a95ce4 --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/GEO/Element/Visual.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 44e63c84fcb149c4d9217a8dd2dec375 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/GEO/Element/Visual/GEO_ElementSprites.cs b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/GEO/Element/Visual/GEO_ElementSprites.cs new file mode 100644 index 00000000..ba0aed59 --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/GEO/Element/Visual/GEO_ElementSprites.cs @@ -0,0 +1,26 @@ +using System; + +namespace BinarySerializer.Ubisoft.CPA.U64 { + public class GEO_ElementSprites : U64_Struct { + public CPA.MTH2D_Vector SizeOfSprite { get; set; } + public U64_Reference VisualMaterial { get; set; } + public ushort CenterPointIndex { get; set; } + public Type TypeOfSprite { get; set; } + + public override void SerializeImpl(SerializerObject s) { + SizeOfSprite = s.SerializeObject(SizeOfSprite, name: nameof(SizeOfSprite)); + VisualMaterial = s.SerializeObject>(VisualMaterial, name: nameof(VisualMaterial))?.Resolve(s); + CenterPointIndex = s.Serialize(CenterPointIndex, name: nameof(CenterPointIndex)); + TypeOfSprite = s.Serialize(TypeOfSprite, name: nameof(TypeOfSprite)); + } + + [Flags] + public enum Type : ushort { + None = 0, + Scaled2D = 1, + SemiLookAt = 2, + UseMatrix = 8 + } + } + +} diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/GEO/Element/Visual/GEO_ElementSprites.cs.meta b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/GEO/Element/Visual/GEO_ElementSprites.cs.meta new file mode 100644 index 00000000..886f3f47 --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/GEO/Element/Visual/GEO_ElementSprites.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 8953bcbf793dd534daea1ccae09b5277 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/GEO/Element/Visual/GEO_ElementVisualIndexedTriangles.cs b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/GEO/Element/Visual/GEO_ElementVisualIndexedTriangles.cs new file mode 100644 index 00000000..5f02a765 --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/GEO/Element/Visual/GEO_ElementVisualIndexedTriangles.cs @@ -0,0 +1,50 @@ +using System; + +namespace BinarySerializer.Ubisoft.CPA.U64 { + public class GEO_ElementVisualIndexedTriangles : U64_Struct { + public U64_Reference VisualMaterial { get; set; } + public U64_Reference VerticesList { get; set; } + public U64_Reference GraphicsList { get; set; } + public ushort GraphicsListSize { get; set; } + public ushort VerticesListSize { get; set; } + public ushort FacesCount { get; set; } + public ushort VerticesCount { get; set; } + public U64_Reference CompressedGraphicsList { get; set; } + public ushort CompressedGraphicsListSize { get; set; } + public U64_Reference GraphicsList3DS { get; set; } + + public override void SerializeImpl(SerializerObject s) { + VisualMaterial = s.SerializeObject>(VisualMaterial, name: nameof(VisualMaterial))?.Resolve(s); + if (s.GetCPASettings().Platform == Platform.N64) { + GraphicsList = s.SerializeObject>(GraphicsList, name: nameof(GraphicsList)); + VerticesList = s.SerializeObject>(VerticesList, name: nameof(VerticesList)); + GraphicsListSize = s.Serialize(GraphicsListSize, name: nameof(GraphicsListSize)); + VerticesListSize = s.Serialize(VerticesListSize, name: nameof(VerticesListSize)); + FacesCount = s.Serialize(FacesCount, name: nameof(FacesCount)); + } else if (s.GetCPASettings().Platform == Platform._3DS) { + GraphicsList3DS = s.SerializeObject>(GraphicsList3DS, name: nameof(GraphicsList3DS)); + FacesCount = s.Serialize(FacesCount, name: nameof(FacesCount)); + VerticesCount = s.Serialize(VerticesCount, name: nameof(VerticesCount)); + } else if (s.GetCPASettings().Platform == Platform.DS) { + GraphicsList = s.SerializeObject>(GraphicsList, name: nameof(GraphicsList)); + GraphicsListSize = s.Serialize(GraphicsListSize, name: nameof(GraphicsListSize)); + if (s.GetCPASettings().EngineVersionTree.HasParent(EngineVersion.Rayman4DS)) { + CompressedGraphicsList = s.SerializeObject>(CompressedGraphicsList, name: nameof(CompressedGraphicsList)); + CompressedGraphicsListSize = s.Serialize(CompressedGraphicsListSize, name: nameof(CompressedGraphicsListSize)); + } + } + + // Resolve + VisualMaterial?.Resolve(s); + VerticesList?.Resolve(s, onPreSerialize: (_, v) => v.Pre_Size = VerticesListSize); + GraphicsList3DS?.Resolve(s, onPreSerialize: (_, g) => { + g.Pre_VerticesCount = VerticesCount; + g.Pre_FacesCount = FacesCount; + }); + if (!s.GetCPASettings().EngineVersionTree.HasParent(EngineVersion.Rayman4DS)) + GraphicsList?.Resolve(s, onPreSerialize: (_, g) => g.Pre_Size = GraphicsListSize); + CompressedGraphicsList?.Resolve(s, onPreSerialize: (_, g) => g.Pre_CompressedSize = CompressedGraphicsListSize); + } + } + +} diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/GEO/Element/Visual/GEO_ElementVisualIndexedTriangles.cs.meta b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/GEO/Element/Visual/GEO_ElementVisualIndexedTriangles.cs.meta new file mode 100644 index 00000000..1a398aa5 --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/GEO/Element/Visual/GEO_ElementVisualIndexedTriangles.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 72ab5be7775b64543b44bc1a5a67d94e +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/GEO/GEO_CompressedGraphicsListDS.cs b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/GEO/GEO_CompressedGraphicsListDS.cs new file mode 100644 index 00000000..717e1d1b --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/GEO/GEO_CompressedGraphicsListDS.cs @@ -0,0 +1,15 @@ +using BinarySerializer.Nintendo.GBA; + +namespace BinarySerializer.Ubisoft.CPA.U64 { + public class GEO_CompressedGraphicsListDS : U64_Struct { + public int Pre_CompressedSize { get; set; } + + public GEO_GraphicsList GraphicsList { get; set; } + + public override void SerializeImpl(SerializerObject s) { + s.DoEncoded(new LZSSEncoder(), () => { + GraphicsList = s.SerializeObject(GraphicsList, g => g.Pre_Size = s.CurrentLength, name: nameof(GraphicsList)); + }); + } + } +} diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/GEO/GEO_CompressedGraphicsListDS.cs.meta b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/GEO/GEO_CompressedGraphicsListDS.cs.meta new file mode 100644 index 00000000..34de099e --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/GEO/GEO_CompressedGraphicsListDS.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 86bf2347381bbc542b9d13fffdf6dcbd +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/GEO/GEO_ElementListEntry.cs b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/GEO/GEO_ElementListEntry.cs new file mode 100644 index 00000000..5b3d192d --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/GEO/GEO_ElementListEntry.cs @@ -0,0 +1,18 @@ +using System; + +namespace BinarySerializer.Ubisoft.CPA.U64 { + public abstract class GEO_ElementListEntry : U64_Struct { + public U64_GenericReference Element { get; set; } + public ushort BoundingVolume { get; set; } + + public override void SerializeImpl(SerializerObject s) { + Element = s.SerializeObject(Element, name: nameof(Element))?.Resolve(s); + BoundingVolume = s.Serialize(BoundingVolume, name: nameof(BoundingVolume)); + s.SerializePadding(2, logIfNotNull: true); + } + } + + public class GEO_VisualElementListEntry : GEO_ElementListEntry { } + public class GEO_CollisionElementListEntry : GEO_ElementListEntry { } + +} diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/GEO/GEO_ElementListEntry.cs.meta b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/GEO/GEO_ElementListEntry.cs.meta new file mode 100644 index 00000000..c1684805 --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/GEO/GEO_ElementListEntry.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: a77423120713d024db814f46c32a311f +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/GEO/GEO_GeometricObject.cs b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/GEO/GEO_GeometricObject.cs new file mode 100644 index 00000000..2f518b45 --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/GEO/GEO_GeometricObject.cs @@ -0,0 +1,82 @@ +using System; + +namespace BinarySerializer.Ubisoft.CPA.U64 { + public class GEO_GeometricObject : U64_Struct { + public float Scale { get; set; } + public float Radius { get; set; } + public U64_ArrayReference CollisionPoints { get; set; } + public U64_ArrayReference VisualPoints { get; set; } + public U64_ArrayReference Normals { get; set; } + public U64_ArrayReference CollisionElements { get; set; } + public U64_ArrayReference VisualElements { get; set; } + public ushort CollisionPointsCount { get; set; } + public ushort VisualPointsCount { get; set; } + public ushort CollisionElementsCount { get; set; } + public ushort VisualElementsCount { get; set; } + public ushort EdgesCount { get; set; } + public Symmetry SymmetryType { get; set; } + public RLI RliFlag { get; set; } + public LookAt LookAtFlag { get; set; } + + public override void SerializeImpl(SerializerObject s) { + Scale = s.Serialize(Scale, name: nameof(Scale)); + Radius = s.Serialize(Radius, name: nameof(Radius)); + + CollisionPoints = s.SerializeObject>(CollisionPoints, name: nameof(CollisionPoints)); + if (s.GetCPASettings().EngineVersionTree.HasParent(EngineVersion.Rayman2_3D)) { + VisualPoints = s.SerializeObject>(VisualPoints, name: nameof(VisualPoints)); + Normals = s.SerializeObject>(Normals, name: nameof(Normals)); + } else { + VisualPoints = CollisionPoints; + } + CollisionElements = s.SerializeObject>(CollisionElements, name: nameof(CollisionElements)); + VisualElements = s.SerializeObject>(VisualElements, name: nameof(VisualElements)); + + CollisionPointsCount = s.Serialize(CollisionPointsCount, name: nameof(CollisionPointsCount)); + if (s.GetCPASettings().EngineVersionTree.HasParent(EngineVersion.Rayman2_3D)) { + VisualPointsCount = s.Serialize(VisualPointsCount, name: nameof(VisualPointsCount)); + } else { + VisualPointsCount = CollisionPointsCount; + } + CollisionElementsCount = s.Serialize(CollisionElementsCount, name: nameof(CollisionElementsCount)); + VisualElementsCount = s.Serialize(VisualElementsCount, name: nameof(VisualElementsCount)); + + EdgesCount = s.Serialize(EdgesCount, name: nameof(EdgesCount)); + SymmetryType = s.Serialize(SymmetryType, name: nameof(SymmetryType)); + RliFlag = s.Serialize(RliFlag, name: nameof(RliFlag)); + LookAtFlag = s.Serialize(LookAtFlag, name: nameof(LookAtFlag)); + + CollisionPoints?.Resolve(s, CollisionPointsCount); + if (s.GetCPASettings().EngineVersionTree.HasParent(EngineVersion.Rayman2_3D)) { + VisualPoints?.Resolve(s, VisualPointsCount); + Normals?.Resolve(s, VisualPointsCount); + } + + VisualElements?.Resolve(s, VisualElementsCount); + CollisionElements?.Resolve(s, CollisionElementsCount); + + } + + // TODO: Determine other flags + [Flags] + public enum RLI : ushort { + None = 0, + UseRLI = 0x1, + SemiLookAt = 0x0100, + TransparentObject = 0x4000, + } + + public enum Symmetry : ushort { + None = 0xFFFF, + X = 0, + Y = 1, + Z = 2 + } + + public enum LookAt : ushort { + Disabled = 0, // 3D + Enabled = 1, // LookAt + SemiLookAt = 2, + } + } +} diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/GEO/GEO_GeometricObject.cs.meta b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/GEO/GEO_GeometricObject.cs.meta new file mode 100644 index 00000000..acabe076 --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/GEO/GEO_GeometricObject.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 72f3be09d62fed845aea046de08d96c2 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/GEO/GEO_GraphicsList.cs b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/GEO/GEO_GraphicsList.cs new file mode 100644 index 00000000..788a6624 --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/GEO/GEO_GraphicsList.cs @@ -0,0 +1,26 @@ +using BinarySerializer.Nintendo.N64; +using BinarySerializer.Nintendo.NDS; + +namespace BinarySerializer.Ubisoft.CPA.U64 { + public class GEO_GraphicsList : U64_Struct { + public long Pre_Size { get; set; } + + public RSP_Command[] RSP_Commands { get; set; } + public DS3D_CommandBlock[] DS3D_Commands { get; set; } + public byte[] Bytes { get; set; } + + public override void SerializeImpl(SerializerObject s) { + if (s.GetCPASettings().Platform == Platform.N64) { + // For N64: http://www.shootersforever.com/forums_message_boards/viewtopic.php?t=6920 + // Or RSP commands sheet + // maybe this can help https://github.com/ricrpi/mupen64plus-video-gles2rice/blob/master/src/RSP_Parser.cpp + // 8 bytes per command, 1st byte is RSP byte + RSP_Commands = s.SerializeObjectArray(RSP_Commands, Pre_Size / RSP_Command.StructSize, name: nameof(RSP_Commands)); + } else { + // For DS: https://github.com/scurest/apicula + // http://problemkaputt.de/gbatek.htm#ds3dvideo check under Geometry Commands + DS3D_Commands = s.SerializeObjectArrayUntil(DS3D_Commands, _ => s.CurrentAbsoluteOffset >= Offset.AbsoluteOffset + Pre_Size, name: nameof(DS3D_Commands)); + } + } + } +} diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/GEO/GEO_GraphicsList.cs.meta b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/GEO/GEO_GraphicsList.cs.meta new file mode 100644 index 00000000..da8980b0 --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/GEO/GEO_GraphicsList.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: d5704871e1197a146bd30a2d52b4ad7c +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/GEO/GEO_GraphicsList3DS.cs b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/GEO/GEO_GraphicsList3DS.cs new file mode 100644 index 00000000..86a3f489 --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/GEO/GEO_GraphicsList3DS.cs @@ -0,0 +1,40 @@ +namespace BinarySerializer.Ubisoft.CPA.U64 { + public class GEO_GraphicsList3DS : U64_Struct { + public ushort Pre_VerticesCount { get; set; } + public ushort Pre_FacesCount { get; set; } + + public Triangle[] Triangles { get; set; } + public UV[] UVs { get; set; } + public MTH3D_ShortVector[] Vertices { get; set; } + public MTH3D_ShortVector[] Colors { get; set; } + + public override void SerializeImpl(SerializerObject s) { + Triangles = s.SerializeObjectArray(Triangles, Pre_FacesCount, name: nameof(Triangles)); + UVs = s.SerializeObjectArray(UVs, Pre_VerticesCount, name: nameof(UVs)); + Vertices = s.SerializeObjectArray(Vertices, Pre_VerticesCount, name: nameof(Vertices)); + Colors = s.SerializeObjectArray(Colors, Pre_VerticesCount, name: nameof(Colors)); + } + + public class Triangle : BinarySerializable { + public ushort Index0 { get; set; } + public ushort Index1 { get; set; } + public ushort Index2 { get; set; } + + public override void SerializeImpl(SerializerObject s) { + Index0 = s.Serialize(Index0, name: nameof(Index0)); + Index1 = s.Serialize(Index1, name: nameof(Index1)); + Index2 = s.Serialize(Index2, name: nameof(Index2)); + } + } + + public class UV : BinarySerializable { + public float U { get; set; } + public float V { get; set; } + + public override void SerializeImpl(SerializerObject s) { + U = s.Serialize(U, name: nameof(U)); + V = s.Serialize(V, name: nameof(V)); + } + } + } +} diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/GEO/GEO_GraphicsList3DS.cs.meta b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/GEO/GEO_GraphicsList3DS.cs.meta new file mode 100644 index 00000000..7ee1489e --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/GEO/GEO_GraphicsList3DS.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 9c9faad434df10d4a8a4bddbbdd7ee43 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/GEO/GEO_TripledIndex.cs b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/GEO/GEO_TripledIndex.cs new file mode 100644 index 00000000..0d0aeee4 --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/GEO/GEO_TripledIndex.cs @@ -0,0 +1,3 @@ +namespace BinarySerializer.Ubisoft.CPA.U64 { + public class GEO_TripledIndex : U64_TripledIndex { } +} diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/GEO/GEO_TripledIndex.cs.meta b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/GEO/GEO_TripledIndex.cs.meta new file mode 100644 index 00000000..1f2c97e6 --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/GEO/GEO_TripledIndex.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 3dc083732dc1cb54fbe812cbf707bb1b +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/GEO/GEO_VerticesList.cs b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/GEO/GEO_VerticesList.cs new file mode 100644 index 00000000..fb6c7f24 --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/GEO/GEO_VerticesList.cs @@ -0,0 +1,19 @@ +using BinarySerializer.Nintendo.N64; + +namespace BinarySerializer.Ubisoft.CPA.U64 { + public class GEO_VerticesList : U64_Struct { + public uint Pre_Size { get; set; } + + public RSP_Vertex[] Vertices { get; set; } + + public override void SerializeImpl(SerializerObject s) { + if (s.GetCPASettings().Platform == Platform.N64) { + Vertices = s.SerializeObjectArrayUntil(Vertices, + _ => s.CurrentAbsoluteOffset >= Offset.AbsoluteOffset + Pre_Size, + name: nameof(Vertices)); + } else { + throw new BinarySerializableException(this, $"Trying to serialize {GetType()} for unimplemented platform!"); + } + } + } +} diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/GEO/GEO_VerticesList.cs.meta b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/GEO/GEO_VerticesList.cs.meta new file mode 100644 index 00000000..910dc7e9 --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/GEO/GEO_VerticesList.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 38408bd03b77b0944b5dd69964b4a017 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/GLI.meta b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/GLI.meta new file mode 100644 index 00000000..67fa3e50 --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/GLI.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 7e7d810ac6bd3194b91039d87785ec15 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/GLI/Background.meta b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/GLI/Background.meta new file mode 100644 index 00000000..fac4cad9 --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/GLI/Background.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: eb476337189cfda4cac36580c2d1c629 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/GLI/Background/GLI_BackgroundCI8.cs b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/GLI/Background/GLI_BackgroundCI8.cs new file mode 100644 index 00000000..0d5dbe8b --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/GLI/Background/GLI_BackgroundCI8.cs @@ -0,0 +1,30 @@ +using System; + +namespace BinarySerializer.Ubisoft.CPA.U64 { + public class GLI_BackgroundCI8 : U64_Struct { + public byte[] Bitmap { get; set; } + + public uint Pre_Length { get; set; } + + public uint ScreenWidth => + Pre_Length switch { + 0x0C000 => 256, // DS base + 0x10680 => 300, // N64 base + 0x12C00 => 320, // N64 high-res + _ => throw new NotImplementedException($"{GetType()}: Unknown length {Context.GetCPASettings().Platform}") + }; + + public uint ScreenHeight => + Pre_Length switch { + 0x0C000 => 192, // DS base + 0x10680 => 224, // N64 base + 0x12C00 => 240, // N64 high-res + _ => throw new NotImplementedException($"{GetType()}: Unknown length {Context.GetCPASettings().Platform}") + }; + + public override void SerializeImpl(SerializerObject s) { + Bitmap = s.SerializeArray(Bitmap, Pre_Length, name: nameof(Bitmap)); + } + } + +} diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/GLI/Background/GLI_BackgroundCI8.cs.meta b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/GLI/Background/GLI_BackgroundCI8.cs.meta new file mode 100644 index 00000000..47840899 --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/GLI/Background/GLI_BackgroundCI8.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 9ddebf1af1851d74fa0e3d834a1c4637 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/GLI/Background/GLI_BackgroundInfo.cs b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/GLI/Background/GLI_BackgroundInfo.cs new file mode 100644 index 00000000..010ea25c --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/GLI/Background/GLI_BackgroundInfo.cs @@ -0,0 +1,19 @@ +namespace BinarySerializer.Ubisoft.CPA.U64 { + public class GLI_BackgroundInfo : U64_Struct { + public uint CompressedSize { get; set; } + public U64_Reference Background { get; set; } + public ushort PalettesCount { get; set; } + public U64_ArrayReference> Palettes { get; set; } + + public override void SerializeImpl(SerializerObject s) { + CompressedSize = s.Serialize(CompressedSize, name: nameof(CompressedSize)); + Background = s.SerializeObject>(Background, name: nameof(Background)) + ?.Resolve(s, onPreSerialize: (_,b) => b.Pre_Length = CompressedSize); + PalettesCount = s.Serialize(PalettesCount, name: nameof(PalettesCount)); + Palettes = s.SerializeObject>>(Palettes, name: nameof(Palettes)); + + Palettes?.Resolve(s, PalettesCount); + } + } + +} diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/GLI/Background/GLI_BackgroundInfo.cs.meta b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/GLI/Background/GLI_BackgroundInfo.cs.meta new file mode 100644 index 00000000..33ee791c --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/GLI/Background/GLI_BackgroundInfo.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: b5dd38930a980d34782d4ab6c09ceadd +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/GLI/Bitmap.meta b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/GLI/Bitmap.meta new file mode 100644 index 00000000..3b4cb106 --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/GLI/Bitmap.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 70509c5e5e214364cb982c1fd41dce83 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/GLI/Bitmap/GLI_Bitmap.cs b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/GLI/Bitmap/GLI_Bitmap.cs new file mode 100644 index 00000000..87074807 --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/GLI/Bitmap/GLI_Bitmap.cs @@ -0,0 +1,14 @@ +namespace BinarySerializer.Ubisoft.CPA.U64 { + public class GLI_Bitmap : U64_Struct { + public int Pre_WidthLog { get; set; } + public int Pre_HeightLog { get; set; } + public int Width => 1 << Pre_WidthLog; + public int Height => 1 << Pre_HeightLog; + public int Length => Width * Height; + + public override void SerializeImpl(SerializerObject s) { + throw new BinarySerializableException(this, $"Base {GetType()} SerializeImpl called!"); + } + } + +} diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/GLI/Bitmap/GLI_Bitmap.cs.meta b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/GLI/Bitmap/GLI_Bitmap.cs.meta new file mode 100644 index 00000000..6bd63a2c --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/GLI/Bitmap/GLI_Bitmap.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: fb4e44b8a10988b46ac2c491581275a2 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/GLI/Bitmap/GLI_BitmapCI4.cs b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/GLI/Bitmap/GLI_BitmapCI4.cs new file mode 100644 index 00000000..e6877147 --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/GLI/Bitmap/GLI_BitmapCI4.cs @@ -0,0 +1,10 @@ +namespace BinarySerializer.Ubisoft.CPA.U64 { + public class GLI_BitmapCI4 : GLI_Bitmap { + public byte[] Bitmap { get; set; } + + public override void SerializeImpl(SerializerObject s) { + Bitmap = s.SerializeArray(Bitmap, (Length / 2) + (Length % 2), name: nameof(Bitmap)); + } + } + +} diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/GLI/Bitmap/GLI_BitmapCI4.cs.meta b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/GLI/Bitmap/GLI_BitmapCI4.cs.meta new file mode 100644 index 00000000..0c65dcce --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/GLI/Bitmap/GLI_BitmapCI4.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 87fa983df9472984b815d39b00f601d8 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/GLI/Bitmap/GLI_BitmapCI8.cs b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/GLI/Bitmap/GLI_BitmapCI8.cs new file mode 100644 index 00000000..e3d8c144 --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/GLI/Bitmap/GLI_BitmapCI8.cs @@ -0,0 +1,10 @@ +namespace BinarySerializer.Ubisoft.CPA.U64 { + public class GLI_BitmapCI8 : GLI_Bitmap { + public byte[] Bitmap { get; set; } + + public override void SerializeImpl(SerializerObject s) { + Bitmap = s.SerializeArray(Bitmap, Length, name: nameof(Bitmap)); + } + } + +} diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/GLI/Bitmap/GLI_BitmapCI8.cs.meta b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/GLI/Bitmap/GLI_BitmapCI8.cs.meta new file mode 100644 index 00000000..6177f85f --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/GLI/Bitmap/GLI_BitmapCI8.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 7197bceec733d21459deaeaccf57b47f +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/GLI/Bitmap/GLI_BitmapRGBA16.cs b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/GLI/Bitmap/GLI_BitmapRGBA16.cs new file mode 100644 index 00000000..67139813 --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/GLI/Bitmap/GLI_BitmapRGBA16.cs @@ -0,0 +1,18 @@ +namespace BinarySerializer.Ubisoft.CPA.U64 { + public class GLI_BitmapRGBA16 : GLI_Bitmap { + + public BaseColor[] Bitmap { get; set; } + + public override void SerializeImpl(SerializerObject s) { + switch (s.GetCPASettings().GetEndian) { + case Endian.Little: + Bitmap = s.SerializeObjectArray((RGBA5551Color[])Bitmap, Length, name: nameof(Bitmap)); + break; + case Endian.Big: + Bitmap = s.SerializeObjectArray((ABGR1555Color[])Bitmap, Length, name: nameof(Bitmap)); + break; + } + } + } + +} diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/GLI/Bitmap/GLI_BitmapRGBA16.cs.meta b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/GLI/Bitmap/GLI_BitmapRGBA16.cs.meta new file mode 100644 index 00000000..65103a06 --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/GLI/Bitmap/GLI_BitmapRGBA16.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 11f7fa53a1b97f44687b8385336dfe17 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/GLI/GLI_BitmapInfo.cs b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/GLI/GLI_BitmapInfo.cs new file mode 100644 index 00000000..3477decc --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/GLI/GLI_BitmapInfo.cs @@ -0,0 +1,120 @@ +using System; + +namespace BinarySerializer.Ubisoft.CPA.U64 { + public class GLI_BitmapInfo : U64_Struct { + public U64_MainTableReference Texture { get; set; } + public U64_MainTableReference Palette { get; set; } + public U64_Reference PaletteN64 { get; set; } + public U64_MainTableReference Alpha { get; set; } + public byte WidthLog { get; set; } + public byte HeightLog { get; set; } + public BitmapFlags Flags { get; set; } + public BitmapType Type { get; set; } + public DrawFlags MiscFlags { get; set; } + public ushort AlphaChannel { get; set; } // Is this a color? + public ushort PaletteSize { get; set; } = 256; + + // 3DS + public ushort Flags3DS { get; set; } + public ushort ImageDataSize { get; set; } + public ushort BitsPerPixel { get; set; } + public string Name { get; set; } + public byte[] ImageData { get; set; } // TODO: Parse as ETC + + public override void SerializeImpl(SerializerObject s) { + if (s.GetCPASettings().Platform == Platform._3DS) { + WidthLog = s.Serialize(WidthLog, name: nameof(WidthLog)); + HeightLog = s.Serialize(HeightLog, name: nameof(HeightLog)); + s.DoBits(b => { + Flags = b.SerializeBits(Flags, 8, name: nameof(Flags)); + Type = b.SerializeBits(Type, 4, name: nameof(Type)); + MiscFlags = b.SerializeBits(MiscFlags, 4, name: nameof(MiscFlags)); + }); + Flags3DS = s.Serialize(Flags3DS, name: nameof(Flags3DS)); + ImageDataSize = s.Serialize(ImageDataSize, name: nameof(ImageDataSize)); + BitsPerPixel = s.Serialize(BitsPerPixel, name: nameof(BitsPerPixel)); + Name = s.SerializeString(Name, 200, name: nameof(Name)); + ImageData = s.SerializeArray(ImageData, ImageDataSize, name: nameof(ImageData)); + } else { + Texture = s.SerializeObject>(Texture, name: nameof(Texture)); + if (s.GetCPASettings().Platform == Platform.N64) { + PaletteN64 = s.SerializeObject>(PaletteN64, name: nameof(PaletteN64))?.Resolve(s); + } else { + Palette = s.SerializeObject>(Palette, name: nameof(Palette)); + } + Alpha = s.SerializeObject>(Alpha, name: nameof(Alpha)); + WidthLog = s.Serialize(WidthLog, name: nameof(WidthLog)); + HeightLog = s.Serialize(HeightLog, name: nameof(HeightLog)); + s.DoBits(b => { + Flags = b.SerializeBits(Flags, 8, name: nameof(Flags)); + Type = b.SerializeBits(Type, 4, name: nameof(Type)); + MiscFlags = b.SerializeBits(MiscFlags, 4, name: nameof(MiscFlags)); + }); + AlphaChannel = s.Serialize(AlphaChannel, name: nameof(AlphaChannel)); + if (s.GetCPASettings().Platform == Platform.DS) { + PaletteSize = s.Serialize(PaletteSize, name: nameof(PaletteSize)); + } + if (Flags.HasFlag(BitmapFlags.CI4)) { + Texture?.ResolveAs(s, onPreSerialize: (_, t) => { + t.Pre_HeightLog = HeightLog; + t.Pre_WidthLog = WidthLog; + }); + } else if (Flags.HasFlag(BitmapFlags.CI8)) { + Texture?.ResolveAs(s, onPreSerialize: (_, t) => { + t.Pre_HeightLog = HeightLog; + t.Pre_WidthLog = WidthLog; + }); + } else if (Flags.HasFlag(BitmapFlags.RGBA16)) { + Texture?.ResolveAs(s, onPreSerialize: (_, t) => { + t.Pre_HeightLog = HeightLog; + t.Pre_WidthLog = WidthLog; + }); + } + Palette?.Resolve(s, onPreSerialize: (_, p) => p.Length = PaletteSize); + Alpha?.Resolve(s, onPreSerialize: (_, a) => { + a.Pre_HeightLog = HeightLog; + a.Pre_WidthLog = WidthLog; + }); + } + } + + [Flags] + public enum BitmapFlags : byte { + None = 0, + CI4 = 1 << 0, // CI = Color Indexed (palette) + CI8 = 1 << 1, + RGBA16 = 1 << 2, // 5551 + RGBA32 = 1 << 3, // 8888 + + MirrorX = 1 << 4, + MirrorY = 1 << 5, + TileX = 1 << 6, + TileY = 1 << 7 + } + + public enum BitmapType : byte { + Standard = 0, + Alpha = 1, + Add = 2, + AlphaOnly = 3, + AddAlpha = 4, + AlphaNZ = 5, + MultiAlphaOnly = 6, + Multi_Opaque = 7, + Multi_Opaque_Detail = 8, + AlphaUZ = 9, + Alpha5i3 = 10, + Alpha3i5 = 11, + } + + [Flags] + public enum DrawFlags : byte { + None = 0, + Reflect = 1 << 0, + Chromaset = 1 << 1, + TransparentObject = 1 << 2, + AutoLum = 1 << 3, + } + } + +} diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/GLI/GLI_BitmapInfo.cs.meta b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/GLI/GLI_BitmapInfo.cs.meta new file mode 100644 index 00000000..74dbc8d8 --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/GLI/GLI_BitmapInfo.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 1a4196ec1bc28ff47b61af426f315f71 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/GLI/GLI_CPakFont.cs b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/GLI/GLI_CPakFont.cs new file mode 100644 index 00000000..17b67654 --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/GLI/GLI_CPakFont.cs @@ -0,0 +1,25 @@ +namespace BinarySerializer.Ubisoft.CPA.U64 { + // "ZeFonte" + public class GLI_CPakFont : U64_Struct { + public const int LettersCount = 117; + public Letter[] Letters { get; set; } + + public override void SerializeImpl(SerializerObject s) { + Letters = s.SerializeObjectArray(Letters, LettersCount, name: nameof(Letters)); + } + + public class Letter : BinarySerializable { + public const int BytesPerLineCount = 3; + public const int LinesCount = 18; + + public byte[] Bitmap { get; set; } + public byte BitmapSize { get; set; } + + public override void SerializeImpl(SerializerObject s) { + Bitmap = s.SerializeArray(Bitmap, LinesCount * BytesPerLineCount, name: nameof(Bitmap)); + BitmapSize = s.Serialize(BitmapSize, name: nameof(BitmapSize)); + } + } + } + +} diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/GLI/GLI_CPakFont.cs.meta b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/GLI/GLI_CPakFont.cs.meta new file mode 100644 index 00000000..938401b3 --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/GLI/GLI_CPakFont.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: db1877c68a48398429222a72118b8b65 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/GLI/GLI_Light.cs b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/GLI/GLI_Light.cs new file mode 100644 index 00000000..707f8cb4 --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/GLI/GLI_Light.cs @@ -0,0 +1,69 @@ +using System; + +namespace BinarySerializer.Ubisoft.CPA.U64 { + public class GLI_Light : U64_Struct { + public float Near { get; set; } + public float Far { get; set; } + public float IntensityMin { get; set; } + public float IntensityMax { get; set; } + public U64_Color BackgroundColor { get; set; } + public U64_Color Color { get; set; } + public ObjectLighted ObjectLightedFlags { get; set; } + public PaintOrAlpha PaintOrAlphaFlags { get; set; } + public MTH3D_Vector InterMinPos { get; set; } + public MTH3D_Vector InterMaxPos { get; set; } + public MTH3D_Vector ExterMinPos { get; set; } + public MTH3D_Vector ExterMaxPos { get; set; } + public POS_CompletePosition Matrix { get; set; } + // Flags ushort: + public LightType Type { get; set; } + public bool IsOn { get; set; } + + public override void SerializeImpl(SerializerObject s) { + Near = s.Serialize(Near, name: nameof(Near)); + Far = s.Serialize(Far, name: nameof(Far)); + IntensityMin = s.Serialize(IntensityMin, name: nameof(IntensityMin)); + IntensityMax = s.Serialize(IntensityMax, name: nameof(IntensityMax)); + BackgroundColor = s.SerializeObject(BackgroundColor, name: nameof(BackgroundColor)); + Color = s.SerializeObject(Color, name: nameof(Color)); + ObjectLightedFlags = s.Serialize(ObjectLightedFlags, name: nameof(ObjectLightedFlags)); + PaintOrAlphaFlags = s.Serialize(PaintOrAlphaFlags, name: nameof(PaintOrAlphaFlags)); + InterMinPos = s.SerializeObject(InterMinPos, name: nameof(InterMinPos)); + InterMaxPos = s.SerializeObject(InterMaxPos, name: nameof(InterMaxPos)); + ExterMinPos = s.SerializeObject(ExterMinPos, name: nameof(ExterMinPos)); + ExterMaxPos = s.SerializeObject(ExterMaxPos, name: nameof(ExterMaxPos)); + Matrix = s.SerializeObject(Matrix, name: nameof(Matrix)); + s.DoBits(b => { + Type = b.SerializeBits(Type, 4, name: nameof(Type)); + b.SerializePadding(11, logIfNotNull: true); + IsOn = b.SerializeBits(IsOn, 1, name: nameof(IsOn)); + }); + } + + public enum LightType : ushort { + Parallel = 1, + Spherical = 2, + HotSpot = 3, + Ambient = 4, + Box = 5, // Parallel light with limit + Fog = 6, + } + + [Flags] + public enum ObjectLighted : ushort { + None = 0, + Map = 1 << 0, + Perso = 1 << 1, + All = Map | Perso + } + + [Flags] + public enum PaintOrAlpha : ushort { + None = 0, + PaintOn = 1 << 0, + NoAlphaLight = 1 << 1, + AlphaOn = 1 << 15 + } + } + +} diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/GLI/GLI_Light.cs.meta b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/GLI/GLI_Light.cs.meta new file mode 100644 index 00000000..55561542 --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/GLI/GLI_Light.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 91c0e42c11f998c45b824ec1e36f555a +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/GLI/GLI_PaletteRGBA16.cs b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/GLI/GLI_PaletteRGBA16.cs new file mode 100644 index 00000000..be726631 --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/GLI/GLI_PaletteRGBA16.cs @@ -0,0 +1,19 @@ +namespace BinarySerializer.Ubisoft.CPA.U64 { + public class GLI_PaletteRGBA16 : U64_Struct { + public int Length { get; set; } = 256; + + public BaseColor[] Palette { get; set; } + + public override void SerializeImpl(SerializerObject s) { + switch (s.GetCPASettings().GetEndian) { + case Endian.Little: + Palette = s.SerializeObjectArray((RGBA5551Color[])Palette, Length, name: nameof(Palette)); + break; + case Endian.Big: + Palette = s.SerializeObjectArray((ABGR1555Color[])Palette, Length, name: nameof(Palette)); + break; + } + } + } + +} diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/GLI/GLI_PaletteRGBA16.cs.meta b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/GLI/GLI_PaletteRGBA16.cs.meta new file mode 100644 index 00000000..749209ee --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/GLI/GLI_PaletteRGBA16.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: d1da04958ae240c47ab4f3e424891d34 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/GLI/GLI_Texture.cs b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/GLI/GLI_Texture.cs new file mode 100644 index 00000000..8f12b119 --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/GLI/GLI_Texture.cs @@ -0,0 +1,10 @@ +namespace BinarySerializer.Ubisoft.CPA.U64 { + public class GLI_Texture : U64_Struct { + public U64_Reference BitmapInfo { get; set; } + + public override void SerializeImpl(SerializerObject s) { + BitmapInfo = s.SerializeObject>(BitmapInfo, name: nameof(BitmapInfo))?.Resolve(s); + } + } + +} diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/GLI/GLI_Texture.cs.meta b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/GLI/GLI_Texture.cs.meta new file mode 100644 index 00000000..602fd0d1 --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/GLI/GLI_Texture.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 6e2cf51c04c5a0e4a833827334e62333 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/GLI/GLI_TextureListEntry.cs b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/GLI/GLI_TextureListEntry.cs new file mode 100644 index 00000000..64cd1496 --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/GLI/GLI_TextureListEntry.cs @@ -0,0 +1,12 @@ +namespace BinarySerializer.Ubisoft.CPA.U64 { + public class GLI_TextureListEntry : U64_Struct { + public U64_Reference Texture { get; set; } + public ushort Time { get; set; } + + public override void SerializeImpl(SerializerObject s) { + Texture = s.SerializeObject>(Texture, name: nameof(Texture))?.Resolve(s); + Time = s.Serialize(Time, name: nameof(Time)); + } + } + +} diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/GLI/GLI_TextureListEntry.cs.meta b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/GLI/GLI_TextureListEntry.cs.meta new file mode 100644 index 00000000..4d03478b --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/GLI/GLI_TextureListEntry.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: b53b5eb39a1a4364cbc2abf37d4486bf +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/GLI/GLI_VignettesCount.cs b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/GLI/GLI_VignettesCount.cs new file mode 100644 index 00000000..40a2de93 --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/GLI/GLI_VignettesCount.cs @@ -0,0 +1,9 @@ +namespace BinarySerializer.Ubisoft.CPA.U64 { + public class GLI_VignettesCount : U64_Struct { + public ushort VignettesCount { get; set; } + + public override void SerializeImpl(SerializerObject s) { + VignettesCount = s.Serialize(VignettesCount, name: nameof(VignettesCount)); + } + } +} diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/GLI/GLI_VignettesCount.cs.meta b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/GLI/GLI_VignettesCount.cs.meta new file mode 100644 index 00000000..5c683a7e --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/GLI/GLI_VignettesCount.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 52e92d5cd26bb1d448cce521292f4909 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/GLI/GLI_VisualMaterial.cs b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/GLI/GLI_VisualMaterial.cs new file mode 100644 index 00000000..5533b814 --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/GLI/GLI_VisualMaterial.cs @@ -0,0 +1,50 @@ +using System; + +namespace BinarySerializer.Ubisoft.CPA.U64 { + public class GLI_VisualMaterial : U64_Struct { + public RGBA5551Color Color { get; set; } + public RGBA5551Color Ambient { get; set; } + public RGBA8888Color Color64 { get; set; } + public float AddU { get; set; } + public float AddV { get; set; } + public U64_ArrayReference TextureList { get; set; } + public ushort TextureListCount { get; set; } + public ushort TotalTime { get; set; } + public MaterialType Type { get; set; } + public MaterialFlags Flags { get; set; } + + public override void SerializeImpl(SerializerObject s) { + if (s.GetCPASettings().Platform == Platform.N64) { + Color64 = s.SerializeObject(Color64, name: nameof(Color64)); + } else { + Color = s.SerializeObject(Color, name: nameof(Color)); + Ambient = s.SerializeObject(Ambient, name: nameof(Ambient)); + } + AddU = s.Serialize(AddU, name: nameof(AddU)); + AddV = s.Serialize(AddV, name: nameof(AddV)); + TextureList = s.SerializeObject>(TextureList, name: nameof(TextureList)); + TextureListCount = s.Serialize(TextureListCount, name: nameof(TextureListCount)); + TotalTime = s.Serialize(TotalTime, name: nameof(TotalTime)); + s.DoBits(b => { + Type = b.SerializeBits(Type, 8, name: nameof(Type)); + Flags = b.SerializeBits(Flags, 8, name: nameof(Flags)); + }); + + TextureList?.Resolve(s, TextureListCount); + } + + public enum MaterialType : byte { + Unspecified = 0, + Gouraud = 1, + Flat = 2, + GouraudAlpha = 3 + } + + [Flags] + public enum MaterialFlags : byte { + None = 0, + BackFace = 1 << 0, + } + } + +} diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/GLI/GLI_VisualMaterial.cs.meta b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/GLI/GLI_VisualMaterial.cs.meta new file mode 100644 index 00000000..e4265c45 --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/GLI/GLI_VisualMaterial.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: a54178f7be78a264aaf77a36eb149ae4 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/GMT.meta b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/GMT.meta new file mode 100644 index 00000000..582d0c82 --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/GMT.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 80de64424da54ae4d93e9ff14f25abed +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/GMT/Enums.meta b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/GMT/Enums.meta new file mode 100644 index 00000000..007ba503 --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/GMT/Enums.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: e4d4ce2757fd80040ac75495678c73f5 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/GMT/Enums/GMT_ZoneType.cs b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/GMT/Enums/GMT_ZoneType.cs new file mode 100644 index 00000000..26bfd943 --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/GMT/Enums/GMT_ZoneType.cs @@ -0,0 +1,8 @@ +namespace BinarySerializer.Ubisoft.CPA.U64 { + public enum GMT_ZoneType : ushort { // As used in TypeOfZone in collision materials in R2 N64 + ZDD = 1, + ZDE = 2, + ZDM = 3, + ZDR = 4 + } +} \ No newline at end of file diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/GMT/Enums/GMT_ZoneType.cs.meta b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/GMT/Enums/GMT_ZoneType.cs.meta new file mode 100644 index 00000000..44ac1df5 --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/GMT/Enums/GMT_ZoneType.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 76d110da6a2279f4aa506524e23ebc31 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/GMT/GMT_CollideMaterial.cs b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/GMT/GMT_CollideMaterial.cs new file mode 100644 index 00000000..fbb369fa --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/GMT/GMT_CollideMaterial.cs @@ -0,0 +1,13 @@ +using System; + +namespace BinarySerializer.Ubisoft.CPA.U64 { + public class GMT_CollideMaterial : U64_Struct { + public ushort Identifier { get; set; } + public GMT_ZoneType ZoneType { get; set; } + + public override void SerializeImpl(SerializerObject s) { + Identifier = s.Serialize(Identifier, name: nameof(Identifier)); + ZoneType = s.Serialize(ZoneType, name: nameof(ZoneType)); + } + } +} diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/GMT/GMT_CollideMaterial.cs.meta b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/GMT/GMT_CollideMaterial.cs.meta new file mode 100644 index 00000000..1a6eccc6 --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/GMT/GMT_CollideMaterial.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 211dfb7af3f6a3d40aede845ac726833 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/GMT/GMT_GameMaterial.cs b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/GMT/GMT_GameMaterial.cs new file mode 100644 index 00000000..32aedd56 --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/GMT/GMT_GameMaterial.cs @@ -0,0 +1,19 @@ +using System; + +namespace BinarySerializer.Ubisoft.CPA.U64 { + public class GMT_GameMaterial : U64_Struct { + public U64_Reference VisualMaterial { get; set; } + public U64_Reference MechanicalMaterial { get; set; } + public U64_Reference CollideMaterial { get; set; } + public U64_Index SoundMaterial { get; set; } // See Rayman2.sif Material + + public override void SerializeImpl(SerializerObject s) { + VisualMaterial = s.SerializeObject>(VisualMaterial, name: nameof(VisualMaterial))?.Resolve(s); + MechanicalMaterial = s.SerializeObject>(MechanicalMaterial, name: nameof(MechanicalMaterial))?.Resolve(s); + CollideMaterial = s.SerializeObject>(CollideMaterial, name: nameof(CollideMaterial))?.Resolve(s); + SoundMaterial = s.SerializeObject>(SoundMaterial, name: nameof(SoundMaterial)); + } + + } + +} diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/GMT/GMT_GameMaterial.cs.meta b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/GMT/GMT_GameMaterial.cs.meta new file mode 100644 index 00000000..208bbf79 --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/GMT/GMT_GameMaterial.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: b22d14848cd67b64991eabe66b62735e +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/General.meta b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/General.meta new file mode 100644 index 00000000..cb0ab4f5 --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/General.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 83c882876ac0b1741b0355aeba60d134 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/General/Enums.meta b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/General/Enums.meta new file mode 100644 index 00000000..12b963c2 --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/General/Enums.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 0e3aae2b729b1a64a95c6df30d7c101f +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/General/Enums/U64_StructType.cs b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/General/Enums/U64_StructType.cs new file mode 100644 index 00000000..22d3b97f --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/General/Enums/U64_StructType.cs @@ -0,0 +1,183 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace BinarySerializer.Ubisoft.CPA.U64 { + public enum U64_StructType { + Unknown, + FixData, + LevelsNameList, // Size: 0x40 * num_levels (0x46 or 70 in Rayman 2) + Level, // Size: 0x38 + NbOfLanguages, + LanguageString, + TextStringList, + TextString, + StringChunk, + StringLength, + StringLengthList, + LanguageStringList, + OldVertexIndex, + AnimSpeedList, + DscMiscInfo, + DscLvl, + Mem, + LevelDescription, + MechanicalEnvironment, + VisualEnvironment, + BitmapInfo, + Texture, + BitmapCI4, + BitmapCI8, + BitmapRGBA16, + PaletteRGBA16, + TextureList, + Way, + LST_NodeIndex_and_NoCtrlTextureList, + VisualMaterial, + U64VertexList, + U64GraphicsList, + CompressedDSGraphicsList, + GraphicsList3DS, + GeometricElementU64IndexedTriangles, + GeometricElementSprites, + GeometricObject, + Vertex, + Edge, + AnimListTable, + GeometricElementCollideList, + GeometricElementU64List, + PhysicalObject, + PhysicalCollSet__Zoo, + AllVector3D, + AllTripledIndex, + ArrayOfStrings, + StringList, + SoundEventList, + ObjectsTableList, + ObjectsTable, + Family, + GeometricElementCollideTrianglesData__ColFacesPnt, + GeometricElementCollideIndexedTriangles, + GeometricElementSpheres, + LST_GeometricElementSpheres, + GeometricElementAlignedBoxes, + LST_GeometricElementAlignedBoxes, + LST_GeometricElementPoints, + LST_GeometricElementCones, + GeometricElementPoints, + GeometricElementCones, + Altimap, + AltimapSquare, + AltimapFace, + AltimapUV, + AltimapVertex, + CharacterDyn, + GameMaterial, + CollideMaterial, + IdCardBase, + IdCardCamera, + MechanicalMaterial, + SuperObject, + Sector, + SuperObjectChildList, + SubLevel, + SubLevelList_and_StartMatrixList, + LevelEntry, + LevelEntryList, + Character, + Character3dData, + State, + AnimInfo, + CharacterStandardGame, + CharacterStream, + CharacterWorld, + CharacterSound, + StateRef, + StateRefList, + BoundingVolume, + LipsSynchro, + StateList, + LST_SectorGraphic_and_LST_Character, // type is for LST_SectorGraphic, but Ubisoft reused it for LST_Character because they're both simply a ushort index + LST_SectorGraphicParam, + LST_SoundEvent, + LST_SectorActivity, + LST_SectorCollision, + LST_SectorSound, + LST_SectorSoundParam, + LST_SectorSoundEvent, + LST_SectorSoundEventParam, + LST_SectorStaticLights, + Light, + CharacterBrain, + AIModel, + Declaration, + Comport, + ListOfComport, + Rule, + Reflex, + ListOfRules, + Node, + Intelligence, + Node_String, + WayGraph, + WayGraphNode, + Waypoint, + LST_Valuation, + LST_WaypointIndex, + WayList, + LST_WayListIndex, + LST_Capacity, + CharacterCollSet, + ArrayOfZdx, + ArrayOfZoneSet, + LST_ZoneSet, + ActivationZone, + LST_ZdxIndex, + LST_GeometricObject, + Node_Vector3D, + Node_Long, + Node_Float, + InputAction, + InputList, + InputLinkList, + ItemStringList, + WayLink, + WayLinkVector, + LST_WayLinkIndex, + AnimVector3D, + AnimTripledIndex, + DscInput, + DscInputActionList, + InputLink, + DeclarationVariable, + ArrayEntry, + Declaration_Long, + Declaration_UnsignedLong, + Declaration_Float, + Declaration_Vector3D, + Initialization, + InitVariable, + InitVariableIdList, + TypeVariable, + TypeVariableIdList, + FixPreloadSection, + FixMem, + LevelMem, + CharacterCineInfo, + CharacterLight, + CharacterMicro, + BackgroundCI8, + BackgroundPaletteList, + BackgroundInfo, + NODFile, + VignetteCount, + CPakFont, + + RRRDS_Unknown1, + RRRDS_Unknown2, + RRRDS_Unknown1List, // Referenced from GAM_Level, references all other Unknowns + RRRDS_Unknown3, + } +} diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/General/Enums/U64_StructType.cs.meta b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/General/Enums/U64_StructType.cs.meta new file mode 100644 index 00000000..199d0e42 --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/General/Enums/U64_StructType.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 04ff5ada72e8d974bab1951831574b29 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/General/U64_ArrayReference.cs b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/General/U64_ArrayReference.cs new file mode 100644 index 00000000..114fb005 --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/General/U64_ArrayReference.cs @@ -0,0 +1,69 @@ +using System; + +namespace BinarySerializer.Ubisoft.CPA.U64 { + public class U64_ArrayReference : BinarySerializable where T : U64_Struct, new() { + public ushort Index { get; set; } + public T[] Value { get; set; } + + public bool IsNull => Index == 0xFFFF; + + public override void SerializeImpl(SerializerObject s) { + Index = s.Serialize(Index, name: nameof(Index)); + } + + public U64_ArrayReference() { + Index = 0xFFFF; + } + public U64_ArrayReference(Context c, ushort index) { + Context = c; + Index = index; + } + + public U64_ArrayReference Resolve(SerializerObject s, + long count, + bool isInFixFixFat = false, + Action onPreSerialize = null) { + + if(IsNull) return this; + if (typeof(T) == typeof(U64_Placeholder)) { + s.LogWarning("Trying to resolve Placeholder - skipping"); + return this; + } + + var loader = s.GetLoader(); + ushort index = Index; + if (isInFixFixFat) index = (ushort)BitHelpers.SetBits64(index, 1, 1, 15); + + var type = U64_StructType_Defines.GetType(typeof(T)); + var name = $"{type.Value}_{index:X4}"; + + if (count == 0) { + Value = s.SerializeObjectArray(Value, 0, name: name); + return this; + } + + loader.RequestFile(s, type.Value, index, null, (ser, configureAction) => { + Value = ser.SerializeObjectArray(Value, count, onPreSerialize: (t, ind_in_array) => { + configureAction(t, ind_in_array); onPreSerialize?.Invoke(ser, t); + }, name: name); + }, arrayCount: (uint)count, name: name); + + /*var ptr = loader.GetStructPointer(typeof(T), index, global: false); + + if (ptr != null) { + s.DoAt(ptr, () => { + Value = s.SerializeObjectArray(Value, count, onPreSerialize: (t, ind_in_array) => { + t.CPA_Index = index; + t.CPA_ArrayIndex = ind_in_array; + onPreSerialize?.Invoke(s,t); + }, name: nameof(Value)); + }); + }*/ + return this; + } + + + public override bool UseShortLog => true; + public override string ShortLog => $"{Index:X4}"; + } +} diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/General/U64_ArrayReference.cs.meta b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/General/U64_ArrayReference.cs.meta new file mode 100644 index 00000000..ee52cb5c --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/General/U64_ArrayReference.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: baf26a55b62992c42bbf7909776a3133 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/General/U64_GenericReference.cs b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/General/U64_GenericReference.cs new file mode 100644 index 00000000..eb3d2bc7 --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/General/U64_GenericReference.cs @@ -0,0 +1,113 @@ +using System; + +namespace BinarySerializer.Ubisoft.CPA.U64 { + public class U64_GenericReference : BinarySerializable { + public ushort Index { get; set; } + public ushort Type { get; set; } + + /// + /// Some GenericReferences aren't structured like (Index,Type) one of them has to be serialized differently. + /// Use these flags to control what is serialized first, then use the SerializeIndex/Type functions later. + /// + public ImmediateSerialize ImmediateSerializeType { get; set; } = ImmediateSerialize.All; + + public U64_Struct Value { get; set; } + + public bool IsNull => Index == 0xFFFF; + + public override void SerializeImpl(SerializerObject s) { + if (ImmediateSerializeType.HasFlag(ImmediateSerialize.Index)) SerializeIndex(s); + if (ImmediateSerializeType.HasFlag(ImmediateSerialize.Type)) SerializeType(s); + } + + public void SerializeIndex(SerializerObject s) { + Index = s.Serialize(Index, name: nameof(Index)); + } + public void SerializeType(SerializerObject s) { + Type = s.Serialize(Type, name: nameof(Type)); + } + + public U64_GenericReference() { + Index = 0xFFFF; + Type = 0xFFFF; + } + public U64_GenericReference(Context c, ushort index, ushort type) { + Context = c; + Index = index; + Type = type; + } + + [Flags] + public enum ImmediateSerialize { + None = 0, + Index = 1 << 0, + Type = 1 << 1, + All = Index | Type, + } + + public U64_GenericReference Resolve(SerializerObject s, bool isInFixFixFat = false, + Action onPreSerialize = null) { + //Action onPostSerialize = null) { + + if (IsNull) return this; + + var loader = s.GetLoader(); + ushort index = Index; + if (isInFixFixFat) index = (ushort)BitHelpers.SetBits64(index, 1, 1, 15); + var type = U64_StructType_Defines.GetType(s.Context, Type); + if(!type.HasValue) + throw new BinarySerializableException(this, $"Cannot resolve type index {Type}"); + var name = $"{type}_{index:X4}"; + + loader.RequestFile(s, type.Value, index, (ser, configureAction) => { + SerializeValue(ser, type.Value, onPreSerialize: t => { + configureAction(t); onPreSerialize?.Invoke(ser, t); + }, name: name); + }, null, name: name); + + /*var ptr = loader.GetStructPointer(typeof(T), index, global: false); + + if (ptr != null) { + var type = U64_StructType_Defines.TypeMapping[typeof(T)]; + s.DoAt(ptr, () => { + Value = s.SerializeObject(Value, onPreSerialize: t => { + t.CPA_Index = index; + onPreSerialize?.Invoke(s,t); + }, name: $"{type}_{index:X4}"); + //onPostSerialize?.Invoke(s, Value); + }); + }*/ + return this; + } + + private void SerializeValue(SerializerObject s, U64_StructType type, Action onPreSerialize = null, string name = null) { + U64_Struct Serialize() where T : U64_Struct, new() => s.SerializeObject((T)Value, onPreSerialize: onPreSerialize, name: name); + Value = type switch { + U64_StructType.PhysicalObject => Serialize(), + U64_StructType.Sector => Serialize(), + U64_StructType.GeometricElementU64IndexedTriangles => Serialize(), + U64_StructType.GeometricElementSprites => Serialize(), + U64_StructType.GeometricElementCollideIndexedTriangles => Serialize(), + U64_StructType.GeometricElementSpheres => Serialize(), + U64_StructType.GeometricElementAlignedBoxes => Serialize(), + U64_StructType.GameMaterial => Serialize(), + U64_StructType.IdCardBase => Serialize(), + U64_StructType.IdCardCamera => Serialize(), + U64_StructType.LevelMem => Serialize(), + U64_StructType.FixMem => Serialize(), + _ => throw new BinarySerializableException(this, $"Type {type} is not implemented in {GetType()}") + }; + } + + + public override bool UseShortLog => true; + public override string ShortLog { + get { + var type = U64_StructType_Defines.GetType(Context, Type); + if (!type.HasValue) + return $"Type_{Type}_{Index:X4}"; + return $"{type}_{Index:X4}"; + } + } + } +} diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/General/U64_GenericReference.cs.meta b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/General/U64_GenericReference.cs.meta new file mode 100644 index 00000000..d6dabbd5 --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/General/U64_GenericReference.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 4031f20d89c7362418a54fd1f6582752 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/General/U64_Index.cs b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/General/U64_Index.cs new file mode 100644 index 00000000..1cac0cb3 --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/General/U64_Index.cs @@ -0,0 +1,40 @@ +using System; + +namespace BinarySerializer.Ubisoft.CPA.U64 { + public class U64_Index : BinarySerializable { + public ushort Index { get; set; } + public T Value { + get { + if(IsNull) return default; + return GetValue.Invoke(this); + } + } + + private Func, T> GetValue { get; set; } + + public bool IsNull => IsNullable && (Index == 0xFFFF); + public bool IsNullable { get; set; } = true; + + public override void SerializeImpl(SerializerObject s) { + Index = s.Serialize(Index, name: nameof(Index)); + } + + public U64_Index() { + Index = 0xFFFF; + } + public U64_Index(Context c, ushort index) { + Context = c; + Index = index; + } + + public U64_Index SetAction(Func, T> action) { + GetValue = action; + return this; + } + + + + public override bool UseShortLog => true; + public override string ShortLog => $"{Index:X4}"; + } +} diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/General/U64_Index.cs.meta b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/General/U64_Index.cs.meta new file mode 100644 index 00000000..767a065f --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/General/U64_Index.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: bd2154f6b24549a4d933ae54417050d1 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/General/U64_MainTableReference.cs b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/General/U64_MainTableReference.cs new file mode 100644 index 00000000..82406dc1 --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/General/U64_MainTableReference.cs @@ -0,0 +1,80 @@ +using System; + +namespace BinarySerializer.Ubisoft.CPA.U64 { + public class U64_MainTableReference : BinarySerializable where T : U64_Struct, new() { + public ushort Index { get; set; } + public T Value { get; set; } + + public bool IsNull => Index == 0xFFFF; + + public override void SerializeImpl(SerializerObject s) { + Index = s.Serialize(Index, name: nameof(Index)); + } + + public U64_MainTableReference() { + Index = 0xFFFF; + } + public U64_MainTableReference(Context c, ushort index) { + Context = c; + Index = index; + } + + public U64_MainTableReference Resolve(SerializerObject s, bool isInFixFixFat = false, + Action onPreSerialize = null) { + //Action onPostSerialize = null) { + + if (IsNull) return this; + + var loader = s.GetLoader(); + ushort index = Index; + if (isInFixFixFat) index = (ushort)BitHelpers.SetBits64(index, 1, 1, 15); + var type = U64_StructType_Defines.GetType(typeof(T)); + var name = $"{type.Value}_{index:X4}"; + + var mainTable_index = BitHelpers.SetBits64(index, 0, 1, 15); + var ptr = loader.Data.MainTablesDictionary[type.Value].StructTable[mainTable_index]; + + if (ptr != null) { + s.DoAt(ptr, () => { + Value = s.SerializeObject(Value, onPreSerialize: t => { + t.CPA_Index = index; + onPreSerialize?.Invoke(s, t); + }, name: $"{type}_{index:X4}"); + //onPostSerialize?.Invoke(s, Value); + }); + } + return this; + } + + public U64_MainTableReference ResolveAs(SerializerObject s, bool isInFixFixFat = false, + Action onPreSerialize = null) where U : T, new() { + //Action onPostSerialize = null) { + + if (IsNull) return this; + + var loader = s.GetLoader(); + ushort index = Index; + if (isInFixFixFat) index = (ushort)BitHelpers.SetBits64(index, 1, 1, 15); + var type = U64_StructType_Defines.GetType(typeof(U)); + var name = $"{type.Value}_{index:X4}"; + + var mainTable_index = BitHelpers.SetBits64(index, 0, 1, 15); + var ptr = loader.Data.MainTablesDictionary[type.Value].StructTable[mainTable_index]; + + if (ptr != null) { + s.DoAt(ptr, () => { + Value = s.SerializeObject((U)Value, onPreSerialize: t => { + t.CPA_Index = index; + onPreSerialize?.Invoke(s, t); + }, name: $"{type}_{index:X4}"); + //onPostSerialize?.Invoke(s, Value); + }); + } + return this; + } + + + public override bool UseShortLog => true; + public override string ShortLog => $"{Index:X4}"; + } +} diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/General/U64_MainTableReference.cs.meta b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/General/U64_MainTableReference.cs.meta new file mode 100644 index 00000000..c7e710b0 --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/General/U64_MainTableReference.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: bfe153203b8a8594f804e3ecccffc790 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/General/U64_Placeholder.cs b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/General/U64_Placeholder.cs new file mode 100644 index 00000000..da00e0cb --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/General/U64_Placeholder.cs @@ -0,0 +1,7 @@ +namespace BinarySerializer.Ubisoft.CPA.U64 { + public class U64_Placeholder : U64_Struct { + public override void SerializeImpl(SerializerObject s) { + throw new System.NotImplementedException(); + } + } +} diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/General/U64_Placeholder.cs.meta b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/General/U64_Placeholder.cs.meta new file mode 100644 index 00000000..efa4c70e --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/General/U64_Placeholder.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: fe5cc680486dc7547bc650ce0ba52ad4 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/General/U64_Reference.cs b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/General/U64_Reference.cs new file mode 100644 index 00000000..1db3f3e1 --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/General/U64_Reference.cs @@ -0,0 +1,63 @@ +using System; + +namespace BinarySerializer.Ubisoft.CPA.U64 { + public class U64_Reference : BinarySerializable where T : U64_Struct, new() { + public ushort Index { get; set; } + public T Value { get; set; } + + public bool IsNull => Index == 0xFFFF; + + public override void SerializeImpl(SerializerObject s) { + Index = s.Serialize(Index, name: nameof(Index)); + } + + public U64_Reference() { + Index = 0xFFFF; + } + public U64_Reference(Context c, ushort index) { + Context = c; + Index = index; + } + + public U64_Reference Resolve(SerializerObject s, bool isInFixFixFat = false, + Action onPreSerialize = null) { + //Action onPostSerialize = null) { + + if (IsNull) return this; + if (typeof(T) == typeof(U64_Placeholder)) { + s.LogWarning("Trying to resolve Placeholder - skipping"); + return this; + } + + var loader = s.GetLoader(); + ushort index = Index; + if (isInFixFixFat) index = (ushort)BitHelpers.SetBits64(index, 1, 1, 15); + var type = U64_StructType_Defines.GetType(typeof(T)); + var name = $"{type.Value}_{index:X4}"; + + loader.RequestFile(s, type.Value, index, (ser, configureAction) => { + Value = ser.SerializeObject(Value, onPreSerialize: t => { + configureAction(t); onPreSerialize?.Invoke(ser, t); + }, name: name); + }, null, name: name); + + /*var ptr = loader.GetStructPointer(typeof(T), index, global: false); + + if (ptr != null) { + var type = U64_StructType_Defines.TypeMapping[typeof(T)]; + s.DoAt(ptr, () => { + Value = s.SerializeObject(Value, onPreSerialize: t => { + t.CPA_Index = index; + onPreSerialize?.Invoke(s,t); + }, name: $"{type}_{index:X4}"); + //onPostSerialize?.Invoke(s, Value); + }); + }*/ + return this; + } + + + public override bool UseShortLog => true; + public override string ShortLog => $"{Index:X4}"; + } +} diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/General/U64_Reference.cs.meta b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/General/U64_Reference.cs.meta new file mode 100644 index 00000000..0765074e --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/General/U64_Reference.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 715d506bc01c35949b0eb0865e8d29cc +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/General/U64_Struct.cs b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/General/U64_Struct.cs new file mode 100644 index 00000000..eeeda655 --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/General/U64_Struct.cs @@ -0,0 +1,9 @@ +namespace BinarySerializer.Ubisoft.CPA.U64 { + public abstract class U64_Struct : BinarySerializable { + public ushort CPA_Index { get; set; } + public string CPA_IndexString => $"{CPA_Index:X4}"; + public int CPA_ArrayIndex { get; set; } + public U64_StructType? CPA_Type => U64_StructType_Defines.GetType(GetType(), throwException: false); + public LDR_Loader CPA_Loader => Context.GetLoader(); + } +} diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/General/U64_Struct.cs.meta b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/General/U64_Struct.cs.meta new file mode 100644 index 00000000..b057f08c --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/General/U64_Struct.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: db9b7f946b9beff4fb23bba70c94b439 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/General/U64_StructType_Defines.cs b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/General/U64_StructType_Defines.cs new file mode 100644 index 00000000..c90ff0ca --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/General/U64_StructType_Defines.cs @@ -0,0 +1,418 @@ +using System; +using System.Collections.Generic; + +namespace BinarySerializer.Ubisoft.CPA.U64 { + public static class U64_StructType_Defines { + private static Dictionary InitTypesDictionary(Context c) { + var s = c.GetCPASettings(); + List Types = new List(); + Types.AddRange(new U64_StructType[] { + U64_StructType.FixData, + U64_StructType.Character, + U64_StructType.Comport, + U64_StructType.AIModel, + U64_StructType.Family, + U64_StructType.State, + U64_StructType.ObjectsTable, + U64_StructType.InputAction, + U64_StructType.AnimInfo, + U64_StructType.Character3dData, + U64_StructType.ArrayOfZoneSet, + U64_StructType.ActivationZone, + U64_StructType.Waypoint, + U64_StructType.WayGraph, + U64_StructType.WayGraphNode, + U64_StructType.ArrayOfZdx, + U64_StructType.Light, + U64_StructType.Texture, // size: 0x2 + }); + if(s.Platform != Platform._3DS) + Types.AddRange(new U64_StructType[] { + U64_StructType.BitmapCI4, + U64_StructType.BitmapCI8, + U64_StructType.BitmapRGBA16, + U64_StructType.PaletteRGBA16, + }); + Types.Add(U64_StructType.U64VertexList); + if (s.Platform == Platform._3DS) { + Types.Add(U64_StructType.GraphicsList3DS); + } else if (s.EngineVersionTree.HasParent(EngineVersion.Rayman4DS)) { + Types.Add(U64_StructType.CompressedDSGraphicsList); + } else { + Types.Add(U64_StructType.U64GraphicsList); + } + Types.AddRange(new U64_StructType[] { + U64_StructType.GeometricElementU64IndexedTriangles, + U64_StructType.GeometricElementSprites, + U64_StructType.GeometricElementSpheres, + U64_StructType.GeometricElementAlignedBoxes, + U64_StructType.GeometricElementPoints, + U64_StructType.GeometricElementCones, + U64_StructType.Altimap, + U64_StructType.GeometricObject, + U64_StructType.GameMaterial, + U64_StructType.CollideMaterial, + U64_StructType.VisualMaterial, + U64_StructType.IdCardBase, + U64_StructType.IdCardCamera, + U64_StructType.MechanicalMaterial, + U64_StructType.PhysicalCollSet__Zoo, + U64_StructType.PhysicalObject, + U64_StructType.Sector, + U64_StructType.SuperObject, + U64_StructType.GeometricElementCollideTrianglesData__ColFacesPnt, + U64_StructType.LevelsNameList, + U64_StructType.Level, + U64_StructType.SubLevel, + U64_StructType.SubLevelList_and_StartMatrixList, + U64_StructType.LevelEntry, + U64_StructType.LevelEntryList, + U64_StructType.SuperObjectChildList, + U64_StructType.Vertex, + U64_StructType.Edge, + U64_StructType.AnimListTable, + U64_StructType.LST_SectorGraphic_and_LST_Character, + U64_StructType.LST_SectorActivity, + U64_StructType.LST_SectorCollision, + U64_StructType.LST_SectorStaticLights, + U64_StructType.LST_SectorSound, + U64_StructType.LST_SectorSoundParam, + U64_StructType.LST_SectorSoundEvent, + U64_StructType.LST_SectorSoundEventParam, + U64_StructType.MechanicalEnvironment, + U64_StructType.VisualEnvironment, + U64_StructType.BitmapInfo, // size: 14 + U64_StructType.Declaration, + U64_StructType.StateList, + U64_StructType.CharacterBrain, + U64_StructType.CharacterCineInfo, + U64_StructType.CharacterCollSet, + U64_StructType.CharacterLight, + U64_StructType.CharacterMicro, + U64_StructType.CharacterStandardGame, + U64_StructType.CharacterStream, + U64_StructType.CharacterWorld, + U64_StructType.CharacterSound, + U64_StructType.ObjectsTableList, + U64_StructType.DeclarationVariable, + U64_StructType.Intelligence, + U64_StructType.ListOfComport, + U64_StructType.ListOfRules, + U64_StructType.Rule, + U64_StructType.Reflex, + U64_StructType.Node, + U64_StructType.LST_GeometricObject, + U64_StructType.LST_GeometricElementAlignedBoxes, + U64_StructType.LST_GeometricElementSpheres, + U64_StructType.LST_GeometricElementCones, + U64_StructType.LST_GeometricElementPoints, + U64_StructType.LST_ZoneSet, + U64_StructType.LST_ZdxIndex, + U64_StructType.Way, + U64_StructType.LST_NodeIndex_and_NoCtrlTextureList, + U64_StructType.LST_Capacity, + U64_StructType.LST_Valuation, + U64_StructType.LST_WaypointIndex, + U64_StructType.WayList, + U64_StructType.LST_WayListIndex, + U64_StructType.LST_SectorGraphicParam, + U64_StructType.LST_SoundEvent, + U64_StructType.Node_Long, + U64_StructType.Node_Float, + U64_StructType.Node_Vector3D, + U64_StructType.Node_String, + U64_StructType.Declaration_Long, + U64_StructType.Declaration_UnsignedLong, + U64_StructType.Declaration_Float, + U64_StructType.Declaration_Vector3D, + U64_StructType.StateRef, + U64_StructType.StateRefList, + U64_StructType.BoundingVolume, + U64_StructType.LipsSynchro, + U64_StructType.Initialization, + U64_StructType.InitVariable, + U64_StructType.InitVariableIdList, + U64_StructType.TypeVariable, + U64_StructType.TypeVariableIdList, + U64_StructType.DscInput, + U64_StructType.DscInputActionList, + U64_StructType.InputLink, + U64_StructType.InputLinkList, + U64_StructType.InputList, + U64_StructType.ItemStringList, + U64_StructType.WayLink, + U64_StructType.WayLinkVector, + U64_StructType.LST_WayLinkIndex, + U64_StructType.AnimVector3D, + U64_StructType.AnimTripledIndex, + U64_StructType.AllVector3D, + U64_StructType.AllTripledIndex, + U64_StructType.ArrayOfStrings, + U64_StructType.StringList, + U64_StructType.SoundEventList, + U64_StructType.NbOfLanguages, + U64_StructType.TextString, + U64_StructType.LanguageString, + U64_StructType.TextStringList, + U64_StructType.StringLength, + U64_StructType.StringLengthList, + U64_StructType.LanguageStringList, + U64_StructType.OldVertexIndex, + U64_StructType.AnimSpeedList, + U64_StructType.DscMiscInfo, + U64_StructType.DscLvl, + U64_StructType.Mem, + U64_StructType.LevelDescription, + U64_StructType.FixPreloadSection, + U64_StructType.FixMem, + U64_StructType.LevelMem, + U64_StructType.GeometricElementU64List, + U64_StructType.GeometricElementCollideIndexedTriangles, + U64_StructType.GeometricElementCollideList, + U64_StructType.AltimapSquare, + U64_StructType.AltimapFace, + U64_StructType.AltimapUV, + U64_StructType.AltimapVertex, + U64_StructType.CharacterDyn, + U64_StructType.TextureList, + U64_StructType.StringChunk, + U64_StructType.ArrayEntry, + }); + if (s.Platform != Platform._3DS) + Types.AddRange(new U64_StructType[] { + U64_StructType.BackgroundCI8, + U64_StructType.BackgroundPaletteList, + }); + Types.AddRange(new U64_StructType[] { + U64_StructType.BackgroundInfo, + U64_StructType.NODFile, + U64_StructType.VignetteCount, + U64_StructType.CPakFont, + }); + if (s.EngineVersionTree.HasParent(EngineVersion.RaymanRavingRabbids)) { + Types.AddRange(new U64_StructType[] { + U64_StructType.RRRDS_Unknown1, + U64_StructType.RRRDS_Unknown2, + U64_StructType.RRRDS_Unknown1List, + U64_StructType.RRRDS_Unknown3, + }); + } + // TOOD: Add other entries? DontSaveStructStart starts here + + Dictionary dict = new Dictionary(); + for(ushort i = 0; i < Types.Count; i++) { + dict[i] = Types[i]; + } + return c.StoreObject>(ContextKey, dict); + } + + private static readonly Dictionary TypeMapping = new Dictionary() { + // General + [typeof(MTH3D_Vector)] = U64_StructType.AllVector3D, + [typeof(MTH3D_ShortVector)] = U64_StructType.Vertex, + [typeof(U64_TripledIndex)] = U64_StructType.AllTripledIndex, + [typeof(U64_BoundingVolume)] = U64_StructType.BoundingVolume, + [typeof(U64_StringChunk)] = U64_StructType.StringChunk, + [typeof(POS_CompletePosition)] = U64_StructType.SubLevelList_and_StartMatrixList, // the devs decided they didn't need another type for this :( + + // GAM + [typeof(GAM_Fix)] = U64_StructType.FixData, + [typeof(GAM_Level)] = U64_StructType.Level, + [typeof(GAM_SubLevel)] = U64_StructType.SubLevel, + [typeof(GAM_LevelDescription)] = U64_StructType.LevelDescription, + [typeof(GAM_LevelEntry)] = U64_StructType.LevelEntry, + [typeof(GAM_DscLevel)] = U64_StructType.DscLvl, + [typeof(GAM_DscMiscInfo)] = U64_StructType.DscMiscInfo, + [typeof(GAM_GenericMemory)] = U64_StructType.Mem, + [typeof(GAM_FixMemory)] = U64_StructType.FixMem, + [typeof(GAM_LevelMemory)] = U64_StructType.LevelMem, + [typeof(GAM_LevelsNameList)] = U64_StructType.LevelsNameList, + [typeof(GAM_FixPreloadSection)] = U64_StructType.FixPreloadSection, + [typeof(GAM_Character)] = U64_StructType.Character, + [typeof(GAM_Character3dData)] = U64_StructType.Character3dData, + [typeof(GAM_CharacterStandardGame)] = U64_StructType.CharacterStandardGame, + [typeof(GAM_CharacterBrain)] = U64_StructType.CharacterBrain, + [typeof(GAM_CharacterCollSet)] = U64_StructType.CharacterCollSet, + [typeof(GAM_CharacterMicro)] = U64_StructType.CharacterMicro, + [typeof(GAM_CharacterDynamics)] = U64_StructType.CharacterDyn, + [typeof(GAM_CharacterCineInfo)] = U64_StructType.CharacterCineInfo, + [typeof(GAM_CharacterLight)] = U64_StructType.CharacterLight, + [typeof(GAM_CharacterSound)] = U64_StructType.CharacterSound, + [typeof(GAM_Family)] = U64_StructType.Family, + [typeof(GAM_State)] = U64_StructType.State, + [typeof(GAM_StateRef)] = U64_StructType.StateRef, + [typeof(GAM_AnimInfo)] = U64_StructType.AnimInfo, + [typeof(GAM_StateTransition)] = U64_StructType.StateList, + [typeof(GAM_ObjectsTable)] = U64_StructType.ObjectsTable, + [typeof(GAM_ObjectsTableEntry)] = U64_StructType.ObjectsTableList, + [typeof(GAM_ZdxArray)] = U64_StructType.ArrayOfZdx, + [typeof(GAM_ZdxIndex)] = U64_StructType.LST_ZdxIndex, + [typeof(GAM_ZoneSetArray)] = U64_StructType.ArrayOfZoneSet, + [typeof(GAM_ZoneSet)] = U64_StructType.LST_ZoneSet, + [typeof(GAM_ActivationZone)] = U64_StructType.ActivationZone, + + [typeof(LST_ReferenceElement)] = U64_StructType.SubLevelList_and_StartMatrixList, + [typeof(LST_ReferenceElement)] = U64_StructType.LevelEntryList, + [typeof(LST_ReferenceElement)] = U64_StructType.StateRefList, + [typeof(LST_ReferenceElement)] = U64_StructType.LST_SectorGraphic_and_LST_Character, + + // HIE + [typeof(HIE_SuperObject)] = U64_StructType.SuperObject, + [typeof(LST_ReferenceElement)] = U64_StructType.SuperObjectChildList, + + // PO + [typeof(PO_PhysicalObject)] = U64_StructType.PhysicalObject, + [typeof(PO_Zoo)] = U64_StructType.PhysicalCollSet__Zoo, + + // GEO + [typeof(GEO_GeometricObject)] = U64_StructType.GeometricObject, + [typeof(GEO_VisualElementListEntry)] = U64_StructType.GeometricElementU64List, + [typeof(GEO_ElementVisualIndexedTriangles)] = U64_StructType.GeometricElementU64IndexedTriangles, + [typeof(GEO_ElementSprites)] = U64_StructType.GeometricElementSprites, + [typeof(GEO_CollisionElementListEntry)] = U64_StructType.GeometricElementCollideList, + [typeof(GEO_ElementCollisionIndexedTriangles)] = U64_StructType.GeometricElementCollideIndexedTriangles, + [typeof(GEO_ElementSpheres)] = U64_StructType.GeometricElementSpheres, + [typeof(GEO_ElementAlignedBoxes)] = U64_StructType.GeometricElementAlignedBoxes, + [typeof(GEO_Sphere)] = U64_StructType.LST_GeometricElementSpheres, + [typeof(GEO_AlignedBox)] = U64_StructType.LST_GeometricElementAlignedBoxes, + [typeof(GEO_TripledIndex)] = U64_StructType.GeometricElementCollideTrianglesData__ColFacesPnt, + [typeof(GEO_VerticesList)] = U64_StructType.U64VertexList, + [typeof(GEO_GraphicsList3DS)] = U64_StructType.GraphicsList3DS, + [typeof(GEO_GraphicsList)] = U64_StructType.U64GraphicsList, + [typeof(GEO_CompressedGraphicsListDS)] = U64_StructType.CompressedDSGraphicsList, + [typeof(LST_ReferenceElement)] = U64_StructType.LST_GeometricObject, + + // GLI + [typeof(GLI_Light)] = U64_StructType.Light, + [typeof(GLI_VisualMaterial)] = U64_StructType.VisualMaterial, + [typeof(GLI_TextureListEntry)] = U64_StructType.TextureList, + [typeof(GLI_Texture)] = U64_StructType.Texture, + [typeof(GLI_BitmapInfo)] = U64_StructType.BitmapInfo, + [typeof(GLI_CPakFont)] = U64_StructType.CPakFont, + [typeof(GLI_BackgroundInfo)] = U64_StructType.BackgroundInfo, + [typeof(GLI_VignettesCount)] = U64_StructType.VignetteCount, + + [typeof(GLI_BitmapCI4)] = U64_StructType.BitmapCI4, + [typeof(GLI_BitmapCI8)] = U64_StructType.BitmapCI8, + [typeof(GLI_BackgroundCI8)] = U64_StructType.BackgroundCI8, + [typeof(GLI_BitmapRGBA16)] = U64_StructType.BitmapRGBA16, + [typeof(GLI_PaletteRGBA16)] = U64_StructType.PaletteRGBA16, + + [typeof(LST_ReferenceElement)] = U64_StructType.LST_NodeIndex_and_NoCtrlTextureList, + [typeof(LST_ReferenceElement)] = U64_StructType.LST_SectorStaticLights, + [typeof(LST_ReferenceElement)] = U64_StructType.BackgroundPaletteList, + + // GMT + [typeof(GMT_GameMaterial)] = U64_StructType.GameMaterial, + [typeof(GMT_CollideMaterial)] = U64_StructType.CollideMaterial, + + + // MEC + [typeof(MEC_MechanicalMaterial)] = U64_StructType.MechanicalMaterial, + [typeof(MEC_IdCardBase)] = U64_StructType.IdCardBase, + [typeof(MEC_IdCardCamera)] = U64_StructType.IdCardCamera, + + // AI + [typeof(AI_AIModel)] = U64_StructType.AIModel, + [typeof(AI_Intelligence)] = U64_StructType.Intelligence, + [typeof(AI_Comport)] = U64_StructType.Comport, + [typeof(AI_Rule)] = U64_StructType.Rule, + [typeof(AI_Node)] = U64_StructType.Node, + [typeof(AI_NodeInterpretFull)] = U64_StructType.NODFile, + [typeof(AI_Declaration)] = U64_StructType.Declaration, + [typeof(AI_DeclarationVariable)] = U64_StructType.DeclarationVariable, + [typeof(AI_Initialization)] = U64_StructType.Initialization, + [typeof(AI_InitializationVariable)] = U64_StructType.InitVariable, + [typeof(AI_TypeVariable)] = U64_StructType.TypeVariable, + + [typeof(AI_Node_Long)] = U64_StructType.Node_Long, + [typeof(AI_Node_Float)] = U64_StructType.Node_Float, + [typeof(AI_Node_Vector3D)] = U64_StructType.Node_Vector3D, + [typeof(AI_Node_String)] = U64_StructType.Node_String, + [typeof(AI_Declaration_Long)] = U64_StructType.Declaration_Long, + [typeof(AI_Declaration_UnsignedLong)] = U64_StructType.Declaration_UnsignedLong, + [typeof(AI_Declaration_Float)] = U64_StructType.Declaration_Float, + [typeof(AI_Declaration_Vector3D)] = U64_StructType.Declaration_Vector3D, + [typeof(AI_Declaration_ArrayEntry)] = U64_StructType.ArrayEntry, + + [typeof(LST_ReferenceElement)] = U64_StructType.ListOfComport, + [typeof(LST_ReferenceElement)] = U64_StructType.ListOfRules, + [typeof(LST_ReferenceElement)] = U64_StructType.TypeVariableIdList, + [typeof(LST_ReferenceElement)] = U64_StructType.InitVariableIdList, + + // WAY + [typeof(WAY_Graph)] = U64_StructType.WayGraph, + [typeof(WAY_GraphNode)] = U64_StructType.WayGraphNode, + [typeof(WAY_Capacity)] = U64_StructType.LST_Capacity, + [typeof(WAY_Valuation)] = U64_StructType.LST_Valuation, + [typeof(WAY_WayPoint)] = U64_StructType.Waypoint, + [typeof(LST_ReferenceElement)] = U64_StructType.LST_WaypointIndex, + [typeof(LST_ReferenceElement)] = U64_StructType.LST_NodeIndex_and_NoCtrlTextureList, + + // IPT + [typeof(IPT_DscInput)] = U64_StructType.DscInput, + [typeof(IPT_InputAction)] = U64_StructType.InputAction, + [typeof(IPT_InputElement)] = U64_StructType.InputList, + [typeof(IPT_InputLink)] = U64_StructType.InputLink, + + [typeof(IPT_InputLinkElement)] = U64_StructType.InputLinkList, + [typeof(IPT_DscInputAction)] = U64_StructType.DscInputActionList, + + // SCT + [typeof(SCT_Sector)] = U64_StructType.Sector, + + [typeof(SCT_SectorGraphic)] = U64_StructType.LST_SectorGraphic_and_LST_Character, + [typeof(SCT_SectorActivity)] = U64_StructType.LST_SectorActivity, + [typeof(SCT_SectorCollision)] = U64_StructType.LST_SectorCollision, + [typeof(SCT_SectorSound)] = U64_StructType.LST_SectorSound, + [typeof(SCT_SectorSoundEvent)] = U64_StructType.LST_SectorSoundEvent, + + [typeof(SCT_SectorGraphicParam)] = U64_StructType.LST_SectorGraphicParam, + [typeof(SCT_SectorSoundParam)] = U64_StructType.LST_SectorSoundParam, + [typeof(SCT_SectorSoundEventParam)] = U64_StructType.LST_SectorSoundEventParam, + + // FON + [typeof(FON_LanguagesCount)] = U64_StructType.NbOfLanguages, + [typeof(FON_LanguageString)] = U64_StructType.LanguageString, + [typeof(FON_TextString)] = U64_StructType.TextString, + [typeof(FON_StringLength)] = U64_StructType.StringLength, + + [typeof(LST_ReferenceElement)] = U64_StructType.TextStringList, + [typeof(LST_ReferenceElement)] = U64_StructType.StringLengthList, + + // Unknown + + + // TODO + }; + + public static Dictionary GetTypeDictionary(Context c) { + Dictionary dict = + c.GetStoredObject>(ContextKey) ?? InitTypesDictionary(c); + return dict; + } + + public static U64_StructType? GetType(Context c, ushort index) { + var dict = GetTypeDictionary(c); + + if (dict.ContainsKey(index)) { + return dict[index]; + } else { + return null; + } + } + + public static U64_StructType? GetType(Type type, bool throwException = true) { + var dict = TypeMapping; + if (dict.ContainsKey(type)) { + return dict[type]; + } else { + if(throwException) + throw new NotImplementedException($"Type {type} does not have a corresponding ROM StructType"); + return null; + } + } + + private const string ContextKey = "U64_StructTypes_Dictionary"; + } +} diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/General/U64_StructType_Defines.cs.meta b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/General/U64_StructType_Defines.cs.meta new file mode 100644 index 00000000..2fb3ee7b --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/General/U64_StructType_Defines.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 2cfdac1521140994a9e3eb901366b681 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/HIE.meta b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/HIE.meta new file mode 100644 index 00000000..0dc68632 --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/HIE.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: af71afaa02416b741884b621071f3fa0 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/HIE/HIE_SuperObject.cs b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/HIE/HIE_SuperObject.cs new file mode 100644 index 00000000..a99b6c77 --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/HIE/HIE_SuperObject.cs @@ -0,0 +1,30 @@ +using System; + +namespace BinarySerializer.Ubisoft.CPA.U64 { + public class HIE_SuperObject : U64_Struct { + public POS_CompletePosition Matrix { get; set; } + public U64_GenericReference LinkedObject { get; set; } + public U64_ArrayReference> Children { get; set; } + public U64_BoundingVolumeBox BoundingVolume { get; set; } + public ushort ChildCount { get; set; } + public ushort TransparencyLevel { get; set; } + public HIE_SuperObjectFlags Flags { get; set; } + + + public override void SerializeImpl(SerializerObject s) { + Matrix = s.SerializeObject(Matrix, name: nameof(Matrix)); + LinkedObject = s.SerializeObject(LinkedObject, onPreSerialize: o => o.ImmediateSerializeType = U64_GenericReference.ImmediateSerialize.Index, name: nameof(LinkedObject)); + Children = s.SerializeObject>>(Children, name: nameof(Children)); + BoundingVolume = s.SerializeObject(BoundingVolume, name: nameof(BoundingVolume)); + LinkedObject.SerializeType(s); + ChildCount = s.Serialize(ChildCount, name: nameof(ChildCount)); + TransparencyLevel = s.Serialize(TransparencyLevel, name: nameof(TransparencyLevel)); + s.SerializePadding(2, logIfNotNull: true); + Flags = s.Serialize(Flags, name: nameof(Flags)); + + LinkedObject?.Resolve(s); + Children?.Resolve(s, ChildCount); + } + } + +} diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/HIE/HIE_SuperObject.cs.meta b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/HIE/HIE_SuperObject.cs.meta new file mode 100644 index 00000000..bf20ab1a --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/HIE/HIE_SuperObject.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 8de8617b237c82444b24b05482f07c80 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/IPT.meta b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/IPT.meta new file mode 100644 index 00000000..d34a909a --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/IPT.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 0f3ab249749081142a1a0090f43a6e91 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/IPT/IPT_DscInput.cs b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/IPT/IPT_DscInput.cs new file mode 100644 index 00000000..c3e1b8e2 --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/IPT/IPT_DscInput.cs @@ -0,0 +1,11 @@ +namespace BinarySerializer.Ubisoft.CPA.U64 { + public class IPT_DscInput : U64_Struct { + public int HistoricSize { get; set; } + public LST_List InputActions { get; set; } // Not included in the ROM for some reason... + + public override void SerializeImpl(SerializerObject s) { + HistoricSize = s.Serialize(HistoricSize, name: nameof(HistoricSize)); + InputActions = s.SerializeObject>(InputActions, name: nameof(InputActions)); //?.Resolve(s); + } + } +} diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/IPT/IPT_DscInput.cs.meta b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/IPT/IPT_DscInput.cs.meta new file mode 100644 index 00000000..2f30e5e0 --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/IPT/IPT_DscInput.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: cc30c1e1e46adb443a536aa5ff38365a +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/IPT/IPT_DscInputAction.cs b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/IPT/IPT_DscInputAction.cs new file mode 100644 index 00000000..e977d731 --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/IPT/IPT_DscInputAction.cs @@ -0,0 +1,4 @@ +namespace BinarySerializer.Ubisoft.CPA.U64 { + // Created purely to avoid conflict between this and U64_StructType.InputLinkList which are both ReferenceElement + public class IPT_DscInputAction : LST_ReferenceElement { } +} diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/IPT/IPT_DscInputAction.cs.meta b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/IPT/IPT_DscInputAction.cs.meta new file mode 100644 index 00000000..74e6768c --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/IPT/IPT_DscInputAction.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 586d17199be50214190aa53837b4de0c +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/IPT/IPT_InputAction.cs b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/IPT/IPT_InputAction.cs new file mode 100644 index 00000000..cc2ced2a --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/IPT/IPT_InputAction.cs @@ -0,0 +1,13 @@ +namespace BinarySerializer.Ubisoft.CPA.U64 { + public class IPT_InputAction : U64_Struct { + public LST_List Elements { get; set; } + public ushort KeyWordElementsCount { get; set; } + + public override void SerializeImpl(SerializerObject s) { + Elements = s.SerializeObject>(Elements, name: nameof(Elements))?.Resolve(s); + KeyWordElementsCount = s.Serialize(KeyWordElementsCount, name: nameof(KeyWordElementsCount)); + + // TODO: Parse + } + } +} diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/IPT/IPT_InputAction.cs.meta b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/IPT/IPT_InputAction.cs.meta new file mode 100644 index 00000000..d395248c --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/IPT/IPT_InputAction.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 45dcb3322e7b29342b9f073e47e1fe29 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/IPT/IPT_InputElement.cs b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/IPT/IPT_InputElement.cs new file mode 100644 index 00000000..f2a90746 --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/IPT/IPT_InputElement.cs @@ -0,0 +1,9 @@ +namespace BinarySerializer.Ubisoft.CPA.U64 { + public class IPT_InputElement : U64_Struct { + public short IndexOrKeyCode { get; set; } + + public override void SerializeImpl(SerializerObject s) { + IndexOrKeyCode = s.Serialize(IndexOrKeyCode, name: nameof(IndexOrKeyCode)); + } + } +} diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/IPT/IPT_InputElement.cs.meta b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/IPT/IPT_InputElement.cs.meta new file mode 100644 index 00000000..923b916e --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/IPT/IPT_InputElement.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 427ed3820430b534db758fc1cd5c77bd +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/IPT/IPT_InputLink.cs b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/IPT/IPT_InputLink.cs new file mode 100644 index 00000000..c4aacc9a --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/IPT/IPT_InputLink.cs @@ -0,0 +1,9 @@ +namespace BinarySerializer.Ubisoft.CPA.U64 { + public class IPT_InputLink : U64_Struct { + public LST_List InputActions { get; set; } + + public override void SerializeImpl(SerializerObject s) { + InputActions = s.SerializeObject>(InputActions, name: nameof(InputActions))?.Resolve(s); + } + } +} diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/IPT/IPT_InputLink.cs.meta b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/IPT/IPT_InputLink.cs.meta new file mode 100644 index 00000000..b82818cb --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/IPT/IPT_InputLink.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 81a36d297711a014ea76a8c95630cee7 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/IPT/IPT_InputLinkElement.cs b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/IPT/IPT_InputLinkElement.cs new file mode 100644 index 00000000..4a1df8f1 --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/IPT/IPT_InputLinkElement.cs @@ -0,0 +1,4 @@ +namespace BinarySerializer.Ubisoft.CPA.U64 { + // Created purely to avoid conflict between this and U64_StructType.DscInputActionList which are both ReferenceElement + public class IPT_InputLinkElement : LST_ReferenceElement { } +} diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/IPT/IPT_InputLinkElement.cs.meta b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/IPT/IPT_InputLinkElement.cs.meta new file mode 100644 index 00000000..76a5964a --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/IPT/IPT_InputLinkElement.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 1fb4a2e6f8a216244944359b6a1b5248 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/LDR.meta b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/LDR.meta new file mode 100644 index 00000000..17d28ac8 --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/LDR.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: ada673b53e359964eb6f535c237ec121 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/LDR/BinFile.meta b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/LDR/BinFile.meta new file mode 100644 index 00000000..a5e3feff --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/LDR/BinFile.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: b6166d8d507abf04c9909f9c7590a8b2 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/LDR/BinFile/LDR_EntryRef.cs b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/LDR/BinFile/LDR_EntryRef.cs new file mode 100644 index 00000000..2b704a6b --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/LDR/BinFile/LDR_EntryRef.cs @@ -0,0 +1,24 @@ +using System; + +namespace BinarySerializer.Ubisoft.CPA.U64 +{ + public class LDR_EntryRef : BinarySerializable + { + public uint Address { get; set; } + public ushort Type { get; set; } + public ushort Index { get; set; } + + public override void SerializeImpl(SerializerObject s) + { + Address = s.Serialize(Address, name: nameof(Address)); + Type = s.Serialize(Type, name: nameof(Type)); + Index = s.Serialize(Index, name: nameof(Index)); + } + + public override bool UseShortLog => true; + public override string ShortLog => $"LDR_EntryRef({U64_StructType_Defines.GetType(Context, Type)?.ToString() ?? Type.ToString()}, {Index}, {Context.GetLoader().GetStructPointer(this)})"; + + + public static string DataKey => "data"; + } +} \ No newline at end of file diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/LDR/BinFile/LDR_EntryRef.cs.meta b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/LDR/BinFile/LDR_EntryRef.cs.meta new file mode 100644 index 00000000..2305d93f --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/LDR/BinFile/LDR_EntryRef.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 5c8e553ddb8a04740801f503694b543c +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/LDR/BinFile/LDR_Fat.cs b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/LDR/BinFile/LDR_Fat.cs new file mode 100644 index 00000000..ba70f304 --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/LDR/BinFile/LDR_Fat.cs @@ -0,0 +1,20 @@ +using System; + +namespace BinarySerializer.Ubisoft.CPA.U64 +{ + public class LDR_Fat : BinarySerializable + { + public Pointer Fat { get; set; } + public uint ObjectsCount { get; set; } + + public override void SerializeImpl(SerializerObject s) + { + Fat = s.SerializePointer(Fat, name: nameof(Fat)); + ObjectsCount = s.Serialize(ObjectsCount, name: nameof(ObjectsCount)); + } + + public void SerializeFat(SerializerObject s) { + Fat?.Resolve(s, onPreSerialize: f => f.Pre_ObjectsCount = ObjectsCount); + } + } +} \ No newline at end of file diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/LDR/BinFile/LDR_Fat.cs.meta b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/LDR/BinFile/LDR_Fat.cs.meta new file mode 100644 index 00000000..78d679a4 --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/LDR/BinFile/LDR_Fat.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 734b0e3b5dcc7934893380c8ca0f96a2 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/LDR/BinFile/LDR_FatFile.cs b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/LDR/BinFile/LDR_FatFile.cs new file mode 100644 index 00000000..77b0da75 --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/LDR/BinFile/LDR_FatFile.cs @@ -0,0 +1,19 @@ +namespace BinarySerializer.Ubisoft.CPA.U64 { + public class LDR_FatFile : BinarySerializable { + public uint LevelsCount { get; set; } + public LDR_Fat FixFix { get; set; } + public LDR_Fat FixLevels { get; set; } + public LDR_Fat[] Levels { get; set; } + + public override void SerializeImpl(SerializerObject s) { + LevelsCount = s.Serialize(LevelsCount, name: nameof(LevelsCount)); + FixFix = s.SerializeObject(FixFix, name: nameof(FixFix)); + FixLevels = s.SerializeObject(FixLevels, name: nameof(FixLevels)); + Levels = s.SerializeObjectArray(Levels, LevelsCount, name: nameof(Levels)); + + FixFix.SerializeFat(s); + FixLevels.SerializeFat(s); + // Level FAT is serialized later + } + } +} \ No newline at end of file diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/LDR/BinFile/LDR_FatFile.cs.meta b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/LDR/BinFile/LDR_FatFile.cs.meta new file mode 100644 index 00000000..ed6733e5 --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/LDR/BinFile/LDR_FatFile.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: dbb89ce25d4cfad4e80f5a910cfb1055 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/LDR/BinFile/LDR_FatTable.cs b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/LDR/BinFile/LDR_FatTable.cs new file mode 100644 index 00000000..6d4efafe --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/LDR/BinFile/LDR_FatTable.cs @@ -0,0 +1,42 @@ +using System; +using System.Collections.Generic; +using System.Linq; + +namespace BinarySerializer.Ubisoft.CPA.U64 +{ + public class LDR_FatTable : BinarySerializable + { + public uint Pre_ObjectsCount { get; set; } + + public LDR_EntryRef[] Entries { get; set; } + + // Parsed + public Dictionary> EntriesLookup { get; private set; } + + + public override void SerializeImpl(SerializerObject s) + { + Entries = s.SerializeObjectArray(Entries, Pre_ObjectsCount, name: nameof(Entries)); + Init(); + } + + public void Init() { + EntriesLookup = new Dictionary>(); + foreach (var e in Entries) { + var type = U64_StructType_Defines.GetType(Context, e.Type); + if(!type.HasValue) continue; + if(!EntriesLookup.ContainsKey(type.Value)) EntriesLookup[type.Value] = new Dictionary(); + EntriesLookup[type.Value][e.Index] = e; + } + } + + public LDR_EntryRef GetEntry(U64_StructType type, ushort index) { + if (!EntriesLookup.ContainsKey(type) || !EntriesLookup[type].ContainsKey(index)) return null; + return EntriesLookup[type][index]; + } + + public LDR_EntryRef GetEntry(ushort type, ushort index) { + return Entries.FirstOrDefault(e => e.Type == type && e.Index == index); + } + } +} \ No newline at end of file diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/LDR/BinFile/LDR_FatTable.cs.meta b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/LDR/BinFile/LDR_FatTable.cs.meta new file mode 100644 index 00000000..6fe9b3a6 --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/LDR/BinFile/LDR_FatTable.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 7286dbc115b416d4bb836bb44bc2cb81 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/LDR/LDR_Loader.cs b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/LDR/LDR_Loader.cs new file mode 100644 index 00000000..8442431b --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/LDR/LDR_Loader.cs @@ -0,0 +1,216 @@ + +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; + +namespace BinarySerializer.Ubisoft.CPA.U64 { + public class LDR_Loader { + public Context Context { get; set; } + public bool IsLoadingFix => !LevelIndex.HasValue; + public LinkedList LoadQueue = new LinkedList(); + public bool IsProcessingLoadQueue { get; set; } + + public int? LevelIndex { get; set; } + + private Pointer DataPointer => Data.Offset; + public LDR_FatFile Fat { get; set; } + public U64_DataFile Data { get; set; } + + //public Dictionary> Cache = new Dictionary>(); + + + // TODO: Move to globals? + public U64_Reference Fix { get; set; } + public U64_Reference FixPreloadSection { get; set; } + public U64_Reference Level => LevelIndex.HasValue ? Fix?.Value?.LevelsNameList?.Value[LevelIndex.Value]?.Level : null; + public U64_Reference DscMiscInfo { get; set; } + + // FON + public U64_Reference LanguagesCount { get; set; } + public U64_Reference[] Languages { get; set; } + + public LDR_Loader(Context c) { + Context = c; + c.StoreObject(ContextKey, this); + } + + + public void LoadLoop(SerializerObject s) { + if (IsProcessingLoadQueue) return; + IsProcessingLoadQueue = true; + while (LoadQueue.First?.Value != null) { + StructReference currentRef = LoadQueue.First?.Value; + LoadQueue.RemoveFirst(); + + var off_struct = GetStructPointer(currentRef.Type, currentRef.Index, global: currentRef.IsGlobal); + if (off_struct == null) { + if (!currentRef.IsGlobal) { + off_struct = GetStructPointer(currentRef.Type, currentRef.Index, global: true); + if (off_struct != null) { + s.LogWarning($"Couldn't resolve Struct Reference {currentRef.Name} normally, successfully resolved globally"); + } + } + if (off_struct == null) { + s.LogWarning($"Couldn't resolve Struct Reference {currentRef.Name}"); + continue; + } + } + Pointer off_current = s.CurrentPointer; + s.Goto(off_struct); + + //s.Log("LDR: Resolving struct: {0}", currentRef.Name); + if (currentRef.ArrayCount.HasValue) { + currentRef.ArrayLoadCallback(s, (f, arrayIndex) => { + f.CPA_Index = currentRef.Index; + f.CPA_ArrayIndex = arrayIndex; + }); + } else { + currentRef.LoadCallback(s, (f) => { + f.CPA_Index = currentRef.Index; + }); + } + + s.Goto(off_current); + } + IsProcessingLoadQueue = false; + } + public class StructReference { + public string Name { get; set; } + public ushort Index { get; set; } + public U64_StructType Type { get; set; } + public bool IsGlobal { get; set; } + + public ResolveAction LoadCallback { get; set; } + public ArrayResolveAction ArrayLoadCallback { get; set; } + + public uint? ArrayCount { get; set; } + } + public delegate void ResolveAction(SerializerObject s, Action configureAction); + public delegate void ArrayResolveAction(SerializerObject s, Action configureAction); + public delegate void ResolvedAction(U64_Struct f); + + public void RequestFile(SerializerObject s, U64_StructType type, ushort index, + ResolveAction loadCallback, ArrayResolveAction arrayLoadCallback, + bool isGlobal = false, + uint? arrayCount = null, + string name = "") { + var fileRef = new StructReference() { + Name = name, + Index = index, + Type = type, + ArrayCount = arrayCount, + LoadCallback = loadCallback, + ArrayLoadCallback = arrayLoadCallback, + IsGlobal = isGlobal, + }; + LoadQueue.AddLast(fileRef); + if (!IsProcessingLoadQueue) LoadLoop(s); + } + + #region Pointer calculation + public Pointer GetStructPointer(LDR_EntryRef fat) => DataPointer + fat.Address; + + public Pointer GetStructPointer(ushort type, ushort index, bool global = false) { + var entry = GetEntry(type, index, global: global); + if (entry != null) { + return GetStructPointer(entry); + } else { + return null; + } + } + + public Pointer GetStructPointer(U64_StructType type, ushort index, bool global = false) { + var entry = GetEntry(type, index, global: global); + if (entry != null) { + return GetStructPointer(entry); + } else { + return null; + } + } + + + + public Pointer GetStructPointer(System.Type type, ushort index, bool global = false) { + var mappedType = U64_StructType_Defines.GetType(type); + return GetStructPointer(mappedType.Value, index, global: global); + } + + public LDR_EntryRef GetEntry(ushort type, ushort index, bool global = false) { + type = (ushort)BitHelpers.ExtractBits(type, 15, 0); + index = (ushort)BitHelpers.ExtractBits(index, 15, 0); + + if (LevelIndex.HasValue) { + var levelEntry = Fat.Levels[LevelIndex.Value].Fat.Value.GetEntry(type, index); + if (levelEntry != null) return levelEntry; + } + + var fix2Entry = Fat.FixLevels.Fat.Value.GetEntry(type, index); + if (fix2Entry != null) return fix2Entry; + + var fixEntry = Fat.FixFix.Fat.Value.GetEntry(type, index); + if (fixEntry != null) return fixEntry; + + if (global) { + for (int i = 0; i < Fat.Levels.Length; i++) { + if (LevelIndex.HasValue && i == LevelIndex.Value) continue; + var entry = Fat.Levels[i].Fat.Value.GetEntry(type, index); + if (entry != null) return entry; + } + } + + return null; + } + + public LDR_EntryRef GetEntry(U64_StructType type, ushort index, bool global = false) { + bool isFix = BitHelpers.ExtractBits(index, 1, 15) == 1; + ushort ind = (ushort)BitHelpers.ExtractBits(index, 15, 0); + if (!global) { + if (!isFix) { + if (LevelIndex.HasValue) { + var levelEntry = Fat.Levels[LevelIndex.Value].Fat.Value.GetEntry(type, ind); + if (levelEntry != null) return levelEntry; + } + + var fix2Entry = Fat.FixLevels.Fat.Value.GetEntry(type, ind); + if (fix2Entry != null) return fix2Entry; + } else { + var fixEntry = Fat.FixFix.Fat.Value.GetEntry(type, ind); + if (fixEntry != null) return fixEntry; + } + } else { + if (LevelIndex.HasValue) { + var levelEntry = Fat.Levels[LevelIndex.Value].Fat.Value.GetEntry(type, ind); + if (levelEntry != null) return levelEntry; + } + + var fix2Entry = Fat.FixLevels.Fat.Value.GetEntry(type, ind); + if (fix2Entry != null) return fix2Entry; + + var fixEntry = Fat.FixFix.Fat.Value.GetEntry(type, ind); + if (fixEntry != null) return fixEntry; + + for (int i = 0; i < Fat.Levels.Length; i++) { + if (LevelIndex.HasValue && i == LevelIndex.Value) continue; + var entry = Fat.Levels[i].Fat?.Value?.GetEntry(type, ind); + if (entry != null) return entry; + } + } + + return null; + } + #endregion + + #region Animations + public A3D_AnimationsFile AnimationsFile { get; set; } + private HashSet AnimationsToLoad { get; set; } = new HashSet(); + + public void LoadInterpolatedAnimation(ushort animIndex) { + // Index in cutTable + AnimationsToLoad.Add(animIndex); + } + #endregion + + public static string ContextKey => nameof(LDR_Loader); + } +} diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/LDR/LDR_Loader.cs.meta b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/LDR/LDR_Loader.cs.meta new file mode 100644 index 00000000..13c85daa --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/LDR/LDR_Loader.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 90cdaa231322885429c53d9fd5daeff1 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/LST.meta b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/LST.meta new file mode 100644 index 00000000..dd689fba --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/LST.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 1e7137ca27882ce4f9efe003b0578a6e +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/LST/LST_List.cs b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/LST/LST_List.cs new file mode 100644 index 00000000..f69837c6 --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/LST/LST_List.cs @@ -0,0 +1,16 @@ +namespace BinarySerializer.Ubisoft.CPA.U64 { + public class LST_List : U64_Struct where T : U64_Struct, new() { + public U64_ArrayReference List { get; set; } + public ushort Count { get; set; } + + public override void SerializeImpl(SerializerObject s) { + List = s.SerializeObject>(List, name: nameof(List)); + Count = s.Serialize(Count, name: nameof(Count)); + } + + public LST_List Resolve(SerializerObject s) { + List?.Resolve(s, Count); + return this; + } + } +} diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/LST/LST_List.cs.meta b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/LST/LST_List.cs.meta new file mode 100644 index 00000000..d6283302 --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/LST/LST_List.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 10dc15b7a4b3cf7468aecea019e323d6 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/LST/LST_ReferenceElement.cs b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/LST/LST_ReferenceElement.cs new file mode 100644 index 00000000..3711f026 --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/LST/LST_ReferenceElement.cs @@ -0,0 +1,9 @@ +namespace BinarySerializer.Ubisoft.CPA.U64 { + public class LST_ReferenceElement : U64_Struct where T : U64_Struct, new() { + public U64_Reference Entry { get; set; } + + public override void SerializeImpl(SerializerObject s) { + Entry = s.SerializeObject>(Entry, name: nameof(Entry))?.Resolve(s); + } + } +} diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/LST/LST_ReferenceElement.cs.meta b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/LST/LST_ReferenceElement.cs.meta new file mode 100644 index 00000000..c06f7599 --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/LST/LST_ReferenceElement.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: cb654e7954393ab439688ce25b707531 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/LST/LST_ReferenceList.cs b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/LST/LST_ReferenceList.cs new file mode 100644 index 00000000..c4f89bb9 --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/LST/LST_ReferenceList.cs @@ -0,0 +1,16 @@ +namespace BinarySerializer.Ubisoft.CPA.U64 { + public class LST_ReferenceList : U64_Struct where T : U64_Struct, new() { + public U64_ArrayReference> List { get; set; } + public ushort Count { get; set; } + + public override void SerializeImpl(SerializerObject s) { + List = s.SerializeObject>>(List, name: nameof(List)); + Count = s.Serialize(Count, name: nameof(Count)); + } + + public LST_ReferenceList Resolve(SerializerObject s) { + List?.Resolve(s, Count); + return this; + } + } +} diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/LST/LST_ReferenceList.cs.meta b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/LST/LST_ReferenceList.cs.meta new file mode 100644 index 00000000..c3107e34 --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/LST/LST_ReferenceList.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: b4332bd43bcc9ca4795bdde60688c4b2 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/MEC.meta b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/MEC.meta new file mode 100644 index 00000000..0bde0e96 --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/MEC.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: c08f68a9dfd1f694aa9b9f62173b2a84 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/MEC/MEC_IdCardBase.cs b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/MEC/MEC_IdCardBase.cs new file mode 100644 index 00000000..2000846e --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/MEC/MEC_IdCardBase.cs @@ -0,0 +1,54 @@ +using System; + +namespace BinarySerializer.Ubisoft.CPA.U64 { + public class MEC_IdCardBase : U64_Struct { + public float Gravity { get; set; } + public float Rebound { get; set; } + public float Slide { get; set; } + public float SlopeLimit { get; set; } + public float TiltIntensity { get; set; } + public float TiltInertia { get; set; } + public float TiltOrigin { get; set; } + public U64_Index Inertia { get; set; } // Index in AllVector3D table + public U64_Index MaxSpeed { get; set; } // Index in AllVector3D table + public Flags MiscFlags { get; set; } + public ushort Swim { get; set; } // Just 1 flag that didn't fit in MiscFlags, it seems + + public override void SerializeImpl(SerializerObject s) { + Gravity = s.Serialize(Gravity, name: nameof(Gravity)); + Rebound = s.Serialize(Rebound, name: nameof(Rebound)); + Slide = s.Serialize(Slide, name: nameof(Slide)); + SlopeLimit = s.Serialize(SlopeLimit, name: nameof(SlopeLimit)); + TiltIntensity = s.Serialize(TiltIntensity, name: nameof(TiltIntensity)); + TiltInertia = s.Serialize(TiltInertia, name: nameof(TiltInertia)); + TiltOrigin = s.Serialize(TiltOrigin, name: nameof(TiltOrigin)); + + Inertia = s.SerializeObject>(Inertia, name: nameof(Inertia))?.SetAction(GAM_Fix.GetGlobalVector3DIndex); + MaxSpeed = s.SerializeObject>(MaxSpeed, name: nameof(MaxSpeed))?.SetAction(GAM_Fix.GetGlobalVector3DIndex); + + MiscFlags = s.Serialize(MiscFlags, name: nameof(MiscFlags)); + Swim = s.Serialize(Swim, name: nameof(Swim)); + } + + [Flags] + public enum Flags : ushort { + None = 0, + Animation = 0x0001, + Collide = 0x0002, + Gravity = 0x0004, + Tilt = 0x0008, + Gi = 0x0010, + Climb = 0x0020, + OnGround = 0x0040, + CollisionControl = 0x0080, + KeepSpeedZ = 0x0100, + SpeedLimit = 0x0200, + Inertia = 0x0400, + Stream = 0x0800, + StickOnPlatform = 0x1000, + Spider = 0x2000, + Shoot = 0x4000, + Scale = 0x8000 + } + } +} diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/MEC/MEC_IdCardBase.cs.meta b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/MEC/MEC_IdCardBase.cs.meta new file mode 100644 index 00000000..a3c851e7 --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/MEC/MEC_IdCardBase.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 36732085d88001e43835919bd19dce68 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/MEC/MEC_IdCardCamera.cs b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/MEC/MEC_IdCardCamera.cs new file mode 100644 index 00000000..91c8fa1e --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/MEC/MEC_IdCardCamera.cs @@ -0,0 +1,15 @@ +using System; + +namespace BinarySerializer.Ubisoft.CPA.U64 { + public class MEC_IdCardCamera : U64_Struct { + public float AngularSpeed { get; set; } + public float LinearSpeed { get; set; } + public float SpeedingUp { get; set; } + + public override void SerializeImpl(SerializerObject s) { + AngularSpeed = s.Serialize(AngularSpeed, name: nameof(AngularSpeed)); + LinearSpeed = s.Serialize(LinearSpeed, name: nameof(LinearSpeed)); + SpeedingUp = s.Serialize(SpeedingUp, name: nameof(SpeedingUp)); + } + } +} diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/MEC/MEC_IdCardCamera.cs.meta b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/MEC/MEC_IdCardCamera.cs.meta new file mode 100644 index 00000000..11b0c25c --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/MEC/MEC_IdCardCamera.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 43a8ce8db4973b042870b8ad0530031a +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/MEC/MEC_MechanicalMaterial.cs b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/MEC/MEC_MechanicalMaterial.cs new file mode 100644 index 00000000..8463e607 --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/MEC/MEC_MechanicalMaterial.cs @@ -0,0 +1,29 @@ +using System; + +namespace BinarySerializer.Ubisoft.CPA.U64 { + public class MEC_MechanicalMaterial : U64_Struct { + /*public float Adhesion { get; set; } + public float Absorption { get; set; } + public float Friction { get; set; } + public float Slide { get; set; } + public float Progression { get; set; } + public float PenetrationSpeed { get; set; } + public float PenetrationMax { get; set; }*/ + + public float BaseSlide { get; set; } + public float BaseRebound { get; set; } + + public override void SerializeImpl(SerializerObject s) { + /*Adhesion = s.Serialize(Adhesion, name: nameof(Adhesion)); + Absorption = s.Serialize(Absorption, name: nameof(Absorption)); + Friction = s.Serialize(Friction, name: nameof(Friction)); + Slide = s.Serialize(Slide, name: nameof(Slide)); + Progression = s.Serialize(Progression, name: nameof(Progression)); + PenetrationSpeed = s.Serialize(PenetrationSpeed, name: nameof(PenetrationSpeed)); + PenetrationMax = s.Serialize(PenetrationMax, name: nameof(PenetrationMax));*/ + + BaseSlide = s.Serialize(BaseSlide, name: nameof(BaseSlide)); + BaseRebound = s.Serialize(BaseRebound, name: nameof(BaseRebound)); + } + } +} diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/MEC/MEC_MechanicalMaterial.cs.meta b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/MEC/MEC_MechanicalMaterial.cs.meta new file mode 100644 index 00000000..2e4bd19d --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/MEC/MEC_MechanicalMaterial.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 65dfb6f12a43df344a28c488205c2644 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/MTH.meta b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/MTH.meta new file mode 100644 index 00000000..7a99ee88 --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/MTH.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 626f917598ff3294f8c5f83cb4c3a5c9 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/MTH/MTH2D.meta b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/MTH/MTH2D.meta new file mode 100644 index 00000000..0b05aa29 --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/MTH/MTH2D.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: f0bda4f604fd44640bac22cf72e88668 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/MTH/MTH2D/MTH2D_Vector.cs b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/MTH/MTH2D/MTH2D_Vector.cs new file mode 100644 index 00000000..56a4c08a --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/MTH/MTH2D/MTH2D_Vector.cs @@ -0,0 +1,11 @@ +namespace BinarySerializer.Ubisoft.CPA.U64 { + public class MTH2D_Vector : U64_Struct { + public CPA.MTH2D_Vector Vector { get; set; } + + public override void SerializeImpl(SerializerObject s) { + Vector = s.SerializeObject(Vector, name: nameof(Vector)); + } + public override string ShortLog => Vector.ShortLog; + public override bool UseShortLog => true; + } +} diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/MTH/MTH2D/MTH2D_Vector.cs.meta b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/MTH/MTH2D/MTH2D_Vector.cs.meta new file mode 100644 index 00000000..2f7fb289 --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/MTH/MTH2D/MTH2D_Vector.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 9b45db0c8481d2b40af917cc6398c040 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/MTH/MTH3D.meta b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/MTH/MTH3D.meta new file mode 100644 index 00000000..584ef043 --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/MTH/MTH3D.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 697142cce97061148b0e298b861c2356 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/MTH/MTH3D/MTH3D_Matrix.cs b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/MTH/MTH3D/MTH3D_Matrix.cs new file mode 100644 index 00000000..268e76b3 --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/MTH/MTH3D/MTH3D_Matrix.cs @@ -0,0 +1,113 @@ +using System; + +namespace BinarySerializer.Ubisoft.CPA.U64 { + public class MTH3D_Matrix : U64_Struct { + public U64_Index Index { get; set; } + + public override void SerializeImpl(SerializerObject s) { + Index = s.SerializeObject>(Index, name: nameof(Index)); // TODO: Set action + } + + public override bool UseShortLog => true; + public override string ShortLog => Index.ShortLog; + + #region Properties + public MTH3D_Vector Column0 { + get { + var val = Index.Value; + if (val == null) return null; + U64_Index mat = new U64_Index(Context, val.Index0); // TODO: set action + return mat.Value; + } + set => throw new NotImplementedException(); + } + public MTH3D_Vector Column1 { + get { + var val = Index.Value; + if (val == null) return null; + U64_Index mat = new U64_Index(Context, val.Index1); // TODO: set action + return mat.Value; + } + set => throw new NotImplementedException(); + } + public MTH3D_Vector Column2 { + get { + var val = Index.Value; + if (val == null) return null; + U64_Index mat = new U64_Index(Context, val.Index2); // TODO: set action + return mat.Value; + } + set => throw new NotImplementedException(); + } + #endregion + + #region Matrix implementation + public CPA.MTH4D_Vector GetRotation(CPA.MTH3D_Vector scaleVector = null) { + float m00, m01, m02; // Row 0 + float m10, m11, m12; // Row 1 + float m20, m21, m22; // Row 2 + + var Column0 = this.Column0.Vector; + var Column1 = this.Column1.Vector; + var Column2 = this.Column2.Vector; + + m00 = Column0.X; + m01 = Column1.X; + m02 = Column2.X; + m10 = Column0.Y; + m11 = Column1.Y; + m12 = Column2.Y; + m20 = Column0.Z; + m21 = Column1.Z; + m22 = Column2.Z; + + if (scaleVector != null && scaleVector.X != 0 && scaleVector.Y != 0 && scaleVector.Z != 0) { + m00 /= scaleVector.X; + m01 /= scaleVector.Y; + m02 /= scaleVector.Z; + m10 /= scaleVector.X; + m11 /= scaleVector.Y; + m12 /= scaleVector.Z; + m20 /= scaleVector.X; + m21 /= scaleVector.Y; + m22 /= scaleVector.Z; + } + + //float tr = m00 + m11 + m22; + MTH4D_Vector quaternion; // = new MTH4D_Vector(); + float t; + + if (m22 < 0) { + if (m00 > m11) { + t = 1 + m00 - m11 - m22; + quaternion = new MTH4D_Vector(t, m01 + m10, m20 + m02, m12 - m21); + } else { + t = 1 - m00 + m11 - m22; + quaternion = new MTH4D_Vector(m01 + m10, t, m12 + m21, m20 - m02); + } + } else { + if (m00 < -m11) { + t = 1 - m00 - m11 + m22; + quaternion = new MTH4D_Vector(m20 + m02, m12 + m21, t, m01 - m10); + } else { + t = 1 + m00 + m11 + m22; + quaternion = new MTH4D_Vector(m12 - m21, m20 - m02, m01 - m10, t); + } + } + float factor = (0.5f / (float)Math.Sqrt(t)); + quaternion.X = quaternion.X * factor; + quaternion.Y = quaternion.Y * factor; + quaternion.Z = quaternion.Z * factor; + quaternion.W = quaternion.W * -factor; + + return quaternion; + } + public CPA.MTH3D_Vector GetScale() { + var Column0 = this.Column0.Vector; + var Column1 = this.Column1.Vector; + var Column2 = this.Column2.Vector; + return new CPA.MTH3D_Vector((float)Column0.Magnitude, (float)Column1.Magnitude, (float)Column2.Magnitude); + } + #endregion + } +} diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/MTH/MTH3D/MTH3D_Matrix.cs.meta b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/MTH/MTH3D/MTH3D_Matrix.cs.meta new file mode 100644 index 00000000..b07a361e --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/MTH/MTH3D/MTH3D_Matrix.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: cce59e201da768e4b85106f1f95efb4d +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/MTH/MTH3D/MTH3D_ShortVector.cs b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/MTH/MTH3D/MTH3D_ShortVector.cs new file mode 100644 index 00000000..bc1286e8 --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/MTH/MTH3D/MTH3D_ShortVector.cs @@ -0,0 +1,17 @@ +namespace BinarySerializer.Ubisoft.CPA.U64 { + public class MTH3D_ShortVector : U64_Struct + { + public short X { get; set; } // Divide by a custom scale to get float + public short Y { get; set; } + public short Z { get; set; } + + public override void SerializeImpl(SerializerObject s) + { + X = s.Serialize(X, name: nameof(X)); + Y = s.Serialize(Y, name: nameof(Y)); + Z = s.Serialize(Z, name: nameof(Z)); + } + public override bool UseShortLog => true; + public override string ToString() => $"ShortVector3D({X}, {Y}, {Z})"; + } +} \ No newline at end of file diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/MTH/MTH3D/MTH3D_ShortVector.cs.meta b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/MTH/MTH3D/MTH3D_ShortVector.cs.meta new file mode 100644 index 00000000..aa3b036c --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/MTH/MTH3D/MTH3D_ShortVector.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: ccde08869efcef8448362c38c6fa0925 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/MTH/MTH3D/MTH3D_Vector.cs b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/MTH/MTH3D/MTH3D_Vector.cs new file mode 100644 index 00000000..5183f939 --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/MTH/MTH3D/MTH3D_Vector.cs @@ -0,0 +1,11 @@ +namespace BinarySerializer.Ubisoft.CPA.U64 { + public class MTH3D_Vector : U64_Struct { + public CPA.MTH3D_Vector Vector { get; set; } + + public override void SerializeImpl(SerializerObject s) { + Vector = s.SerializeObject(Vector, name: nameof(Vector)); + } + public override string ShortLog => Vector.ShortLog; + public override bool UseShortLog => true; + } +} diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/MTH/MTH3D/MTH3D_Vector.cs.meta b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/MTH/MTH3D/MTH3D_Vector.cs.meta new file mode 100644 index 00000000..e3cfa7db --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/MTH/MTH3D/MTH3D_Vector.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 0806aab771b0d4c43b85df70e9f88e0a +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/MTH/MTH4D.meta b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/MTH/MTH4D.meta new file mode 100644 index 00000000..77a771fd --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/MTH/MTH4D.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: cda4bbcc01bb7454cbd1446cb3eaa3d8 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/MTH/MTH4D/MTH4D_ShortQuaternion.cs b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/MTH/MTH4D/MTH4D_ShortQuaternion.cs new file mode 100644 index 00000000..40e5a7fc --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/MTH/MTH4D/MTH4D_ShortQuaternion.cs @@ -0,0 +1,22 @@ +using System; + +namespace BinarySerializer.Ubisoft.CPA.U64 +{ + public class MTH4D_ShortQuaternion : BinarySerializable + { + public short X { get; set; } // Divide by Int16.Max to get float + public short Y { get; set; } + public short Z { get; set; } + public short W { get; set; } + + public override void SerializeImpl(SerializerObject s) + { + X = s.Serialize(X, name: nameof(X)); + Y = s.Serialize(Y, name: nameof(Y)); + Z = s.Serialize(Z, name: nameof(Z)); + W = s.Serialize(W, name: nameof(W)); + } + public override bool UseShortLog => true; + public override string ToString() => $"ShortQuaternion({X}, {Y}, {Z}, {W})"; + } +} \ No newline at end of file diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/MTH/MTH4D/MTH4D_ShortQuaternion.cs.meta b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/MTH/MTH4D/MTH4D_ShortQuaternion.cs.meta new file mode 100644 index 00000000..9f2d00c6 --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/MTH/MTH4D/MTH4D_ShortQuaternion.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 575cf95a46245b8489dfcf44de8e2c27 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/PO.meta b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/PO.meta new file mode 100644 index 00000000..005fcf7b --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/PO.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 766086c1b47533c4c881d48ebeeae1c3 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/PO/PO_LevelOfDetail.cs b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/PO/PO_LevelOfDetail.cs new file mode 100644 index 00000000..889807e0 --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/PO/PO_LevelOfDetail.cs @@ -0,0 +1,15 @@ +using System; + +namespace BinarySerializer.Ubisoft.CPA.U64 { + // VisualSets aren't used in R2 N64 + public class PO_LevelOfDetail : U64_Struct { + public float Threshold { get; set; } + public U64_Reference GeometricObject { get; set; } + + public override void SerializeImpl(SerializerObject s) { + Threshold = s.Serialize(Threshold, name: nameof(Threshold)); + GeometricObject = s.SerializeObject>(GeometricObject, name: nameof(GeometricObject))?.Resolve(s); + s.SerializePadding(2, logIfNotNull: true); + } + } +} diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/PO/PO_LevelOfDetail.cs.meta b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/PO/PO_LevelOfDetail.cs.meta new file mode 100644 index 00000000..035363d3 --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/PO/PO_LevelOfDetail.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: ded2963a8c199b947ab1061439bdff95 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/PO/PO_PhysicalObject.cs b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/PO/PO_PhysicalObject.cs new file mode 100644 index 00000000..c3729989 --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/PO/PO_PhysicalObject.cs @@ -0,0 +1,13 @@ +using System; + +namespace BinarySerializer.Ubisoft.CPA.U64 { + public class PO_PhysicalObject : U64_Struct { + public U64_Reference GeometricObject { get; set; } + public U64_Reference CollisionSet { get; set; } + + public override void SerializeImpl(SerializerObject s) { + GeometricObject = s.SerializeObject>(GeometricObject, name: nameof(GeometricObject))?.Resolve(s); + CollisionSet = s.SerializeObject>(CollisionSet, name: nameof(CollisionSet))?.Resolve(s); + } + } +} diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/PO/PO_PhysicalObject.cs.meta b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/PO/PO_PhysicalObject.cs.meta new file mode 100644 index 00000000..aa7c2ca6 --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/PO/PO_PhysicalObject.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 7a70848b58d33824e9d9c23ff68608f2 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/PO/PO_VisualSet.cs b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/PO/PO_VisualSet.cs new file mode 100644 index 00000000..997d9c5c --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/PO/PO_VisualSet.cs @@ -0,0 +1,14 @@ +using System; + +namespace BinarySerializer.Ubisoft.CPA.U64 { + // VisualSets aren't used in R2 N64 + public class PO_VisualSet : U64_Struct { + public LST_List LODList { get; set; } + public U64_Reference RLI { get; set; } + + public override void SerializeImpl(SerializerObject s) { + LODList = s.SerializeObject>(LODList, name: nameof(LODList))?.Resolve(s); + RLI = s.SerializeObject>(RLI, name: nameof(RLI))?.Resolve(s); + } + } +} diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/PO/PO_VisualSet.cs.meta b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/PO/PO_VisualSet.cs.meta new file mode 100644 index 00000000..5f3d0dbe --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/PO/PO_VisualSet.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: ce5c42cf3b081984e8f69d8fd1e6a52f +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/PO/PO_Zoo.cs b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/PO/PO_Zoo.cs new file mode 100644 index 00000000..33702110 --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/PO/PO_Zoo.cs @@ -0,0 +1,21 @@ +using System; + +namespace BinarySerializer.Ubisoft.CPA.U64 { + public class PO_Zoo : U64_Struct { // Converts to PO_PhysicalCollSet + public U64_Reference GeometricObject { get; set; } + public Type ZoneType { get; set; } + + public override void SerializeImpl(SerializerObject s) { + GeometricObject = s.SerializeObject>(GeometricObject, name: nameof(GeometricObject))?.Resolve(s); + ZoneType = s.Serialize(ZoneType, name: nameof(ZoneType)); + } + + public enum Type : ushort { + None = 0, + ZDR = 1, + ZDE = 2, + ZDD = 3, + ZDM = 4 + } + } +} diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/PO/PO_Zoo.cs.meta b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/PO/PO_Zoo.cs.meta new file mode 100644 index 00000000..3c8802c1 --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/PO/PO_Zoo.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: f12b4eedce1923b4d9d3d1adb887e878 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/POS.meta b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/POS.meta new file mode 100644 index 00000000..4e91d645 --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/POS.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 1df31ff781784f44dad498cc3427543e +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/POS/POS_CompletePosition.cs b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/POS/POS_CompletePosition.cs new file mode 100644 index 00000000..c5cba1cd --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/POS/POS_CompletePosition.cs @@ -0,0 +1,56 @@ +using System; + +namespace BinarySerializer.Ubisoft.CPA.U64 { + public class POS_CompletePosition : U64_Struct, MAT_ITransform { + public U64_Index Index { get; set; } + + public override void SerializeImpl(SerializerObject s) { + Index = s.SerializeObject>(Index, name: nameof(Index)); // TODO: Set action + } + + #region Properties + public MTH3D_Matrix RotationMatrix { + get { + var val = Index.Value; + if(val == null) return null; + U64_Index mat = new U64_Index(Context, val.Index0); // TODO: set action + return mat.Value; + } + set => throw new NotImplementedException(); + } + public MTH3D_Matrix ScaleMatrix { + get { + var val = Index.Value; + if (val == null) return null; + U64_Index mat = new U64_Index(Context, val.Index1); // TODO: set action + return mat.Value; + } + set => throw new NotImplementedException(); + } + public MTH3D_Vector TranslationVector { + get { + var val = Index.Value; + if (val == null) return null; + U64_Index mat = new U64_Index(Context, val.Index2); // TODO: set action + return mat.Value; + } + set => throw new NotImplementedException(); + } + #endregion + + #region MAT_ITransform implementation + public CPA.MTH3D_Vector Position { + get => throw new NotImplementedException(); + set => throw new NotImplementedException(); + } + public MTH4D_Vector Rotation { + get => throw new NotImplementedException(); + set => throw new NotImplementedException(); + } + public CPA.MTH3D_Vector Scale { + get => throw new NotImplementedException(); + set => throw new NotImplementedException(); + } + #endregion + } +} diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/POS/POS_CompletePosition.cs.meta b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/POS/POS_CompletePosition.cs.meta new file mode 100644 index 00000000..04e1bdf3 --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/POS/POS_CompletePosition.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 51b9c5bd12875694c91ce4bab9f4c7da +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/Rom64.meta b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/Rom64.meta new file mode 100644 index 00000000..ae48fa93 --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/Rom64.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 77ffb179fa986d04e8b8e067f0231d7f +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/Rom64/BinFile.meta b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/Rom64/BinFile.meta new file mode 100644 index 00000000..7256f1af --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/Rom64/BinFile.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 9328d02afb767a94ea06d55fcda868f7 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/Rom64/BinFile/U64_BinInfo.cs b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/Rom64/BinFile/U64_BinInfo.cs new file mode 100644 index 00000000..82321039 --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/Rom64/BinFile/U64_BinInfo.cs @@ -0,0 +1,17 @@ +namespace BinarySerializer.Ubisoft.CPA.U64 { + public class U64_BinInfo : BinarySerializable { + public float CoordinateScale { get; set; } + public ushort StructsCount { get; set; } + public ushort Version { get; set; } + public ushort LevelsCount { get; set; } + public ushort VertexSegment { get; set; } + + public override void SerializeImpl(SerializerObject s) { + CoordinateScale = s.Serialize(CoordinateScale, name: nameof(CoordinateScale)); + StructsCount = s.Serialize(StructsCount, name: nameof(StructsCount)); + Version = s.Serialize(Version, name: nameof(Version)); + LevelsCount = s.Serialize(LevelsCount, name: nameof(LevelsCount)); + VertexSegment = s.Serialize(VertexSegment, name: nameof(VertexSegment)); + } + } +} \ No newline at end of file diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/Rom64/BinFile/U64_BinInfo.cs.meta b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/Rom64/BinFile/U64_BinInfo.cs.meta new file mode 100644 index 00000000..7d6b4214 --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/Rom64/BinFile/U64_BinInfo.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 7730d77d70a5b5046b6f825b24ba55db +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/Rom64/BinFile/U64_DataFile.cs b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/Rom64/BinFile/U64_DataFile.cs new file mode 100644 index 00000000..316d5f36 --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/Rom64/BinFile/U64_DataFile.cs @@ -0,0 +1,41 @@ +using System.Collections.Generic; + +namespace BinarySerializer.Ubisoft.CPA.U64 { + public class U64_DataFile : BinarySerializable { + public U64_BinInfo BinInfo { get; set; } + public U64_MainTable[] MainTables { get; set; } + + public Dictionary MainTablesDictionary { get; private set; } + + public override void SerializeImpl(SerializerObject s) { + BinInfo = s.SerializeObject(BinInfo, name: nameof(BinInfo)); + s.DoWithDefaults(new SerializerDefaults() { + PointerAnchor = Offset + }, () => { + MainTables = s.SerializeObjectArray(MainTables, BinInfo.StructsCount, name: nameof(MainTables)); + }); + + // Initialize MainTables dictionary + CreateMainTablesDictionary(s.Context); + + if (s.GetCPASettings().Platform != Platform._3DS) { + // For whatever reason these are stored using this struct table system instead of the main one + MainTablesDictionary[U64_StructType.BitmapCI4].SerializeStructTable(s); + MainTablesDictionary[U64_StructType.BitmapCI8].SerializeStructTable(s); + MainTablesDictionary[U64_StructType.BitmapRGBA16].SerializeStructTable(s); + if (s.GetCPASettings().Platform != Platform.N64) { + MainTablesDictionary[U64_StructType.PaletteRGBA16].SerializeStructTable(s); + } + } + } + + void CreateMainTablesDictionary(Context context) { + MainTablesDictionary = new Dictionary(); + var dict = U64_StructType_Defines.GetTypeDictionary(context); + foreach (var entry in dict) { + if (entry.Key < MainTables.Length) + MainTablesDictionary[entry.Value] = MainTables[entry.Key]; + } + } + } +} \ No newline at end of file diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/Rom64/BinFile/U64_DataFile.cs.meta b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/Rom64/BinFile/U64_DataFile.cs.meta new file mode 100644 index 00000000..cbd579b7 --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/Rom64/BinFile/U64_DataFile.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: b7d568bfd78e7f841bfa35fd951a5945 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/Rom64/BinFile/U64_MainTable.cs b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/Rom64/BinFile/U64_MainTable.cs new file mode 100644 index 00000000..a5489cc2 --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/Rom64/BinFile/U64_MainTable.cs @@ -0,0 +1,19 @@ +namespace BinarySerializer.Ubisoft.CPA.U64 { + public class U64_MainTable : BinarySerializable { + public Pointer DataOffset { get; set; } + public uint DataLength { get; set; } + + public Pointer[] StructTable { get; set; } + + public override void SerializeImpl(SerializerObject s) { + DataOffset = s.SerializePointer(DataOffset, name: nameof(DataOffset)); + DataLength = s.Serialize(DataLength, name: nameof(DataLength)); + } + + public void SerializeStructTable(SerializerObject s) { + s.DoAt(DataOffset, () => { + StructTable = s.SerializePointerArray(StructTable, DataLength / 4, name: nameof(StructTable)); + }); + } + } +} \ No newline at end of file diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/Rom64/BinFile/U64_MainTable.cs.meta b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/Rom64/BinFile/U64_MainTable.cs.meta new file mode 100644 index 00000000..9fd13a7b --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/Rom64/BinFile/U64_MainTable.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 8bf119f9e36358044a53c2177f88c32d +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/Rom64/U64_BoundingVolume.cs b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/Rom64/U64_BoundingVolume.cs new file mode 100644 index 00000000..ca28db73 --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/Rom64/U64_BoundingVolume.cs @@ -0,0 +1,11 @@ +namespace BinarySerializer.Ubisoft.CPA.U64 { + public class U64_BoundingVolume : U64_Struct { + public CPA.MTH3D_Vector SphereCenter { get; set; } + public float SphereRadius { get; set; } + + public override void SerializeImpl(SerializerObject s) { + SphereCenter = s.SerializeObject(SphereCenter, name: nameof(SphereCenter)); + SphereRadius = s.Serialize(SphereRadius, name: nameof(SphereRadius)); + } + } +} diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/Rom64/U64_BoundingVolume.cs.meta b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/Rom64/U64_BoundingVolume.cs.meta new file mode 100644 index 00000000..9ea1ddb7 --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/Rom64/U64_BoundingVolume.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 410c2b1cee4027f49849d2be89ad34ca +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/Rom64/U64_BoundingVolumeBox.cs b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/Rom64/U64_BoundingVolumeBox.cs new file mode 100644 index 00000000..ba11f2cf --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/Rom64/U64_BoundingVolumeBox.cs @@ -0,0 +1,9 @@ +namespace BinarySerializer.Ubisoft.CPA.U64 { + public class U64_BoundingVolumeBox : U64_Struct { + public U64_ArrayReference Values { get; set; } // Min and Max + + public override void SerializeImpl(SerializerObject s) { + Values = s.SerializeObject>(Values, name: nameof(Values))?.Resolve(s, 2); + } + } +} diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/Rom64/U64_BoundingVolumeBox.cs.meta b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/Rom64/U64_BoundingVolumeBox.cs.meta new file mode 100644 index 00000000..e546d6f1 --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/Rom64/U64_BoundingVolumeBox.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: b209dee8a8e2d8849afd3124cd65d30a +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/Rom64/U64_Color.cs b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/Rom64/U64_Color.cs new file mode 100644 index 00000000..1ef3c123 --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/Rom64/U64_Color.cs @@ -0,0 +1,4 @@ +namespace BinarySerializer.Ubisoft.CPA.U64 { + public class U64_Color : GLI_FloatColor { + } +} diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/Rom64/U64_Color.cs.meta b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/Rom64/U64_Color.cs.meta new file mode 100644 index 00000000..8c7dd691 --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/Rom64/U64_Color.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 8ff0db275420b424ea521aae1516ec00 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/Rom64/U64_String.cs b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/Rom64/U64_String.cs new file mode 100644 index 00000000..7034526f --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/Rom64/U64_String.cs @@ -0,0 +1,18 @@ +namespace BinarySerializer.Ubisoft.CPA.U64 { + public class U64_String : BinarySerializable { + public bool Pre_IsBinary { get; set; } = false; + + public ushort Length { get; set; } + public U64_Reference Value { get; set; } + + public override void SerializeImpl(SerializerObject s) { + Length = s.Serialize(Length, name: nameof(Length)); + Value = s.SerializeObject>(Value, name: nameof(Value)); + + Value?.Resolve(s, onPreSerialize: (_,v) => { + v.Pre_Length = Length; + v.Pre_IsBinary = Pre_IsBinary; + }); + } + } +} diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/Rom64/U64_String.cs.meta b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/Rom64/U64_String.cs.meta new file mode 100644 index 00000000..b787c191 --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/Rom64/U64_String.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 06b05545123f2b845b7f36743846f29b +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/Rom64/U64_StringChunk.cs b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/Rom64/U64_StringChunk.cs new file mode 100644 index 00000000..f887c1dc --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/Rom64/U64_StringChunk.cs @@ -0,0 +1,18 @@ +namespace BinarySerializer.Ubisoft.CPA.U64 { + public class U64_StringChunk : U64_Struct { + public ushort Pre_Length { get; set; } + public bool Pre_IsBinary { get; set; } + public string StringValue { get; set; } + public byte[] BinaryValue { get; set; } + + public override void SerializeImpl(SerializerObject s) { + // A StringChunk is actually only 2 characters. They're serialized as ArrayReference. + // We just serialize the full string instead. + if (Pre_IsBinary) { + BinaryValue = s.SerializeArray(BinaryValue, Pre_Length + (Pre_Length % 2), name: nameof(BinaryValue)); + } else { + StringValue = s.SerializeString(StringValue, length: Pre_Length + (Pre_Length % 2), name: nameof(StringValue)); + } + } + } +} diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/Rom64/U64_StringChunk.cs.meta b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/Rom64/U64_StringChunk.cs.meta new file mode 100644 index 00000000..e0ce54f5 --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/Rom64/U64_StringChunk.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: bb316bd4d0717e04bad861dd3a3b4c12 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/Rom64/U64_TripledIndex.cs b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/Rom64/U64_TripledIndex.cs new file mode 100644 index 00000000..a2b6b65c --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/Rom64/U64_TripledIndex.cs @@ -0,0 +1,15 @@ +namespace BinarySerializer.Ubisoft.CPA.U64 { + public class U64_TripledIndex : U64_Struct { + public ushort Index0 { get; set; } + public ushort Index1 { get; set; } + public ushort Index2 { get; set; } + + public override void SerializeImpl(SerializerObject s) { + Index0 = s.Serialize(Index0, name: nameof(Index0)); + Index1 = s.Serialize(Index1, name: nameof(Index1)); + Index2 = s.Serialize(Index2, name: nameof(Index2)); + } + public override string ShortLog => $"TripledIndex({Index0:X4}, {Index1:X4}, {Index2:X4})"; + public override bool UseShortLog => true; + } +} diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/Rom64/U64_TripledIndex.cs.meta b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/Rom64/U64_TripledIndex.cs.meta new file mode 100644 index 00000000..ea49036f --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/Rom64/U64_TripledIndex.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: a7253fcd5b82f434c95983d01b35be49 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/SCT.meta b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/SCT.meta new file mode 100644 index 00000000..d06e1540 --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/SCT.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: b950c3946a4b75b4b9a3b7b7ace3e725 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/SCT/NeighborParameters.meta b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/SCT/NeighborParameters.meta new file mode 100644 index 00000000..4428bdb6 --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/SCT/NeighborParameters.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 18693cba522b66f48bf188805917e822 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/SCT/NeighborParameters/SCT_SectorGraphicParam.cs b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/SCT/NeighborParameters/SCT_SectorGraphicParam.cs new file mode 100644 index 00000000..f5e7f101 --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/SCT/NeighborParameters/SCT_SectorGraphicParam.cs @@ -0,0 +1,13 @@ +using System; + +namespace BinarySerializer.Ubisoft.CPA.U64 { + public class SCT_SectorGraphicParam : U64_Struct { + public short LevelOfDetail { get; set; } + public short DisplayMode { get; set; } // Maybe not included in TT? + + public override void SerializeImpl(SerializerObject s) { + LevelOfDetail = s.Serialize(LevelOfDetail, name: nameof(LevelOfDetail)); + DisplayMode = s.Serialize(DisplayMode, name: nameof(DisplayMode)); + } + } +} diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/SCT/NeighborParameters/SCT_SectorGraphicParam.cs.meta b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/SCT/NeighborParameters/SCT_SectorGraphicParam.cs.meta new file mode 100644 index 00000000..3807b6af --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/SCT/NeighborParameters/SCT_SectorGraphicParam.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 0d2b04f6bd8b03d468c0d8840d7c33aa +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/SCT/NeighborParameters/SCT_SectorSoundEventParam.cs b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/SCT/NeighborParameters/SCT_SectorSoundEventParam.cs new file mode 100644 index 00000000..51ef13b6 --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/SCT/NeighborParameters/SCT_SectorSoundEventParam.cs @@ -0,0 +1,11 @@ +using System; + +namespace BinarySerializer.Ubisoft.CPA.U64 { + public class SCT_SectorSoundEventParam : U64_Struct { + public uint SoundEvent { get; set; } // Sound Event ID + + public override void SerializeImpl(SerializerObject s) { + SoundEvent = s.Serialize(SoundEvent, name: nameof(SoundEvent)); + } + } +} diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/SCT/NeighborParameters/SCT_SectorSoundEventParam.cs.meta b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/SCT/NeighborParameters/SCT_SectorSoundEventParam.cs.meta new file mode 100644 index 00000000..ebcaa251 --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/SCT/NeighborParameters/SCT_SectorSoundEventParam.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: cc0efe19cb48cf34d9b3e75effc370c0 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/SCT/NeighborParameters/SCT_SectorSoundParam.cs b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/SCT/NeighborParameters/SCT_SectorSoundParam.cs new file mode 100644 index 00000000..06f81558 --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/SCT/NeighborParameters/SCT_SectorSoundParam.cs @@ -0,0 +1,11 @@ +using System; + +namespace BinarySerializer.Ubisoft.CPA.U64 { + public class SCT_SectorSoundParam : U64_Struct { + public int Volume { get; set; } + + public override void SerializeImpl(SerializerObject s) { + Volume = s.Serialize(Volume, name: nameof(Volume)); + } + } +} diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/SCT/NeighborParameters/SCT_SectorSoundParam.cs.meta b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/SCT/NeighborParameters/SCT_SectorSoundParam.cs.meta new file mode 100644 index 00000000..108f74ef --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/SCT/NeighborParameters/SCT_SectorSoundParam.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: bf52bec1addb99e42b4d9b09a6c0a59c +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/SCT/Neighbors.meta b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/SCT/Neighbors.meta new file mode 100644 index 00000000..85254892 --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/SCT/Neighbors.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 136a17a602bd6e547881b14b406fb29f +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/SCT/Neighbors/SCT_SectorActivity.cs b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/SCT/Neighbors/SCT_SectorActivity.cs new file mode 100644 index 00000000..dd8aacf3 --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/SCT/Neighbors/SCT_SectorActivity.cs @@ -0,0 +1,5 @@ +using System; + +namespace BinarySerializer.Ubisoft.CPA.U64 { + public class SCT_SectorActivity : LST_ReferenceElement { } +} diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/SCT/Neighbors/SCT_SectorActivity.cs.meta b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/SCT/Neighbors/SCT_SectorActivity.cs.meta new file mode 100644 index 00000000..4ad0a345 --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/SCT/Neighbors/SCT_SectorActivity.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 497225f096c5759469a1f45627e8f61b +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/SCT/Neighbors/SCT_SectorCollision.cs b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/SCT/Neighbors/SCT_SectorCollision.cs new file mode 100644 index 00000000..ca8385ed --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/SCT/Neighbors/SCT_SectorCollision.cs @@ -0,0 +1,5 @@ +using System; + +namespace BinarySerializer.Ubisoft.CPA.U64 { + public class SCT_SectorCollision : LST_ReferenceElement { } +} diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/SCT/Neighbors/SCT_SectorCollision.cs.meta b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/SCT/Neighbors/SCT_SectorCollision.cs.meta new file mode 100644 index 00000000..2375e71b --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/SCT/Neighbors/SCT_SectorCollision.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: d28f961d6f0ec744a893b37bcf4db845 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/SCT/Neighbors/SCT_SectorGraphic.cs b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/SCT/Neighbors/SCT_SectorGraphic.cs new file mode 100644 index 00000000..9a93d720 --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/SCT/Neighbors/SCT_SectorGraphic.cs @@ -0,0 +1,5 @@ +using System; + +namespace BinarySerializer.Ubisoft.CPA.U64 { + public class SCT_SectorGraphic : LST_ReferenceElement { } +} diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/SCT/Neighbors/SCT_SectorGraphic.cs.meta b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/SCT/Neighbors/SCT_SectorGraphic.cs.meta new file mode 100644 index 00000000..b8571f9b --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/SCT/Neighbors/SCT_SectorGraphic.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 40769786e582727459c9d8f8fba0e573 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/SCT/Neighbors/SCT_SectorSound.cs b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/SCT/Neighbors/SCT_SectorSound.cs new file mode 100644 index 00000000..f44dfcb1 --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/SCT/Neighbors/SCT_SectorSound.cs @@ -0,0 +1,5 @@ +using System; + +namespace BinarySerializer.Ubisoft.CPA.U64 { + public class SCT_SectorSound : LST_ReferenceElement { } +} diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/SCT/Neighbors/SCT_SectorSound.cs.meta b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/SCT/Neighbors/SCT_SectorSound.cs.meta new file mode 100644 index 00000000..efb61971 --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/SCT/Neighbors/SCT_SectorSound.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: bafc330cd33911b4894b872f5c5f4ef8 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/SCT/Neighbors/SCT_SectorSoundEvent.cs b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/SCT/Neighbors/SCT_SectorSoundEvent.cs new file mode 100644 index 00000000..155efdb9 --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/SCT/Neighbors/SCT_SectorSoundEvent.cs @@ -0,0 +1,5 @@ +using System; + +namespace BinarySerializer.Ubisoft.CPA.U64 { + public class SCT_SectorSoundEvent : LST_ReferenceElement { } +} diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/SCT/Neighbors/SCT_SectorSoundEvent.cs.meta b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/SCT/Neighbors/SCT_SectorSoundEvent.cs.meta new file mode 100644 index 00000000..0ea8f6af --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/SCT/Neighbors/SCT_SectorSoundEvent.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: a196b8db709f4004999ea2c3187856ad +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/SCT/SCT_Sector.cs b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/SCT/SCT_Sector.cs new file mode 100644 index 00000000..817339cd --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/SCT/SCT_Sector.cs @@ -0,0 +1,77 @@ +using System; + +namespace BinarySerializer.Ubisoft.CPA.U64 { + public class SCT_Sector : U64_Struct { + // Neighbors + public U64_ArrayReference Graphic { get; set; } + public U64_ArrayReference GraphicParam { get; set; } + public U64_ArrayReference Activity { get; set; } + public U64_ArrayReference Collision { get; set; } + public U64_ArrayReference> StaticLights { get; set; } + public U64_ArrayReference Sound { get; set; } + public U64_ArrayReference SoundParam { get; set; } + public U64_ArrayReference SoundEvent { get; set; } + public U64_ArrayReference SoundEventParam { get; set; } + + public U64_BoundingVolumeBox BorderBox { get; set; } + public SCT_Sky Sky { get; set; } + + public ushort GraphicCount { get; set; } + public ushort ActivityCount { get; set; } + public ushort CollisionCount { get; set; } + public ushort StaticLightsCount { get; set; } + public ushort SoundCount { get; set; } + public ushort SoundEventCount { get; set; } + + public bool Virtual { get; set; } + public byte CameraType { get; set; } + public short ZFar { get; set; } // * MapScale + public byte Priority { get; set; } + + public byte Pad1 { get; set; } // Padding, but filled with garbage data + public short Pad2 { get; set; } + + + public override void SerializeImpl(SerializerObject s) { + Graphic = s.SerializeObject>(Graphic, name: nameof(Graphic)); + GraphicParam = s.SerializeObject>(GraphicParam, name: nameof(GraphicParam)); + Activity = s.SerializeObject>(Activity, name: nameof(Activity)); + Collision = s.SerializeObject>(Collision, name: nameof(Collision)); + StaticLights = s.SerializeObject>>(StaticLights, name: nameof(StaticLights)); + Sound = s.SerializeObject>(Sound, name: nameof(Sound)); + SoundParam = s.SerializeObject>(SoundParam, name: nameof(SoundParam)); + SoundEvent = s.SerializeObject>(SoundEvent, name: nameof(SoundEvent)); + SoundEventParam = s.SerializeObject>(SoundEventParam, name: nameof(SoundEventParam)); + + BorderBox = s.SerializeObject(BorderBox, name: nameof(BorderBox)); + Sky = s.SerializeObject(Sky, name: nameof(Sky)); + + GraphicCount = s.Serialize(GraphicCount, name: nameof(GraphicCount)); + ActivityCount = s.Serialize(ActivityCount, name: nameof(ActivityCount)); + CollisionCount = s.Serialize(CollisionCount, name: nameof(CollisionCount)); + StaticLightsCount = s.Serialize(StaticLightsCount, name: nameof(StaticLightsCount)); + SoundCount = s.Serialize(SoundCount, name: nameof(SoundCount)); + SoundEventCount = s.Serialize(SoundEventCount, name: nameof(SoundEventCount)); + + Virtual = s.Serialize(Virtual, name: nameof(Virtual)); + CameraType = s.Serialize(CameraType, name: nameof(CameraType)); + ZFar = s.Serialize(ZFar, name: nameof(ZFar)); + Priority = s.Serialize(Priority, name: nameof(Priority)); + + Pad1 = s.Serialize(Pad1, name: nameof(Pad1)); + Pad2 = s.Serialize(Pad2, name: nameof(Pad2)); + + // Resolve + Graphic?.Resolve(s, GraphicCount); + GraphicParam?.Resolve(s, GraphicCount); + Activity?.Resolve(s, ActivityCount); + Collision?.Resolve(s, CollisionCount); + StaticLights?.Resolve(s, StaticLightsCount); + Sound?.Resolve(s, SoundCount); + SoundParam?.Resolve(s, SoundCount); + SoundEvent?.Resolve(s, SoundEventCount); + SoundEventParam?.Resolve(s,SoundEventCount); + } + + } +} diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/SCT/SCT_Sector.cs.meta b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/SCT/SCT_Sector.cs.meta new file mode 100644 index 00000000..5701e1a1 --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/SCT/SCT_Sector.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 69c2793d3074d46469d34be4a8deb6fb +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/SCT/SCT_Sky.cs b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/SCT/SCT_Sky.cs new file mode 100644 index 00000000..07ee3532 --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/SCT/SCT_Sky.cs @@ -0,0 +1,25 @@ +using System; + +namespace BinarySerializer.Ubisoft.CPA.U64 { + public class SCT_Sky : BinarySerializable { + public float AddU { get; set; } + public float AddV { get; set; } + public U64_Reference SkyVisualMaterial { get; set; } + public byte FogIntensity { get; set; } + public SkyType UseSky { get; set; } + + public override void SerializeImpl(SerializerObject s) { + AddU = s.Serialize(AddU, name: nameof(AddU)); + AddV = s.Serialize(AddV, name: nameof(AddV)); + SkyVisualMaterial = s.SerializeObject>(SkyVisualMaterial, name: nameof(SkyVisualMaterial))?.Resolve(s); + FogIntensity = s.Serialize(FogIntensity, name: nameof(FogIntensity)); + UseSky = s.Serialize(UseSky, name: nameof(UseSky)); + } + + public enum SkyType : byte { + NoSky = 0, + Sky = 1, + WaterSky = 2 + } + } +} diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/SCT/SCT_Sky.cs.meta b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/SCT/SCT_Sky.cs.meta new file mode 100644 index 00000000..6f2760b3 --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/SCT/SCT_Sky.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: f96bd20edfa4fdf4f8021636f5c9f96f +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/WAY.meta b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/WAY.meta new file mode 100644 index 00000000..965df3b7 --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/WAY.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 9ea666999d5c2d84eb53e728b3c28384 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/WAY/WAY_Capacity.cs b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/WAY/WAY_Capacity.cs new file mode 100644 index 00000000..8d1692fe --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/WAY/WAY_Capacity.cs @@ -0,0 +1,9 @@ +namespace BinarySerializer.Ubisoft.CPA.U64 { + public class WAY_Capacity : U64_Struct { + public uint Capacity { get; set; } + + public override void SerializeImpl(SerializerObject s) { + Capacity = s.Serialize(Capacity, name: nameof(Capacity)); + } + } +} diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/WAY/WAY_Capacity.cs.meta b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/WAY/WAY_Capacity.cs.meta new file mode 100644 index 00000000..db6d76b8 --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/WAY/WAY_Capacity.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: c6d1adb82d9502a46989604d6fa261fd +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/WAY/WAY_Graph.cs b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/WAY/WAY_Graph.cs new file mode 100644 index 00000000..477541cf --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/WAY/WAY_Graph.cs @@ -0,0 +1,9 @@ +namespace BinarySerializer.Ubisoft.CPA.U64 { + public class WAY_Graph : U64_Struct { + public LST_ReferenceList Nodes { get; set; } + + public override void SerializeImpl(SerializerObject s) { + Nodes = s.SerializeObject>(Nodes, name: nameof(Nodes))?.Resolve(s); + } + } +} diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/WAY/WAY_Graph.cs.meta b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/WAY/WAY_Graph.cs.meta new file mode 100644 index 00000000..743f9375 --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/WAY/WAY_Graph.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: c1829a893c574fd48bf3045215d9d113 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/WAY/WAY_GraphNode.cs b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/WAY/WAY_GraphNode.cs new file mode 100644 index 00000000..291139c8 --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/WAY/WAY_GraphNode.cs @@ -0,0 +1,23 @@ +namespace BinarySerializer.Ubisoft.CPA.U64 { + public class WAY_GraphNode : U64_Struct { + public U64_Reference WayPoint { get; set; } + public U64_ArrayReference> Nodes { get; set; } + public U64_ArrayReference Capacities { get; set; } + public U64_ArrayReference Valuations { get; set; } + public ushort NodesCount { get; set; } + public U64_Reference TypeOfWP { get; set; } // Capacity + + public override void SerializeImpl(SerializerObject s) { + WayPoint = s.SerializeObject>(WayPoint, name: nameof(WayPoint))?.Resolve(s); + Nodes = s.SerializeObject>>(Nodes, name: nameof(Nodes)); + Capacities = s.SerializeObject>(Capacities, name: nameof(Capacities)); + Valuations = s.SerializeObject>(Valuations, name: nameof(Valuations)); + NodesCount = s.Serialize(NodesCount, name: nameof(NodesCount)); + TypeOfWP = s.SerializeObject>(TypeOfWP, name: nameof(TypeOfWP))?.Resolve(s); + + Nodes?.Resolve(s, NodesCount); + Capacities?.Resolve(s, NodesCount); + Valuations?.Resolve(s, NodesCount); + } + } +} diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/WAY/WAY_GraphNode.cs.meta b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/WAY/WAY_GraphNode.cs.meta new file mode 100644 index 00000000..c5332dca --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/WAY/WAY_GraphNode.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 6269db1097266664ba3bdfd623025920 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/WAY/WAY_Valuation.cs b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/WAY/WAY_Valuation.cs new file mode 100644 index 00000000..0ec69702 --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/WAY/WAY_Valuation.cs @@ -0,0 +1,9 @@ +namespace BinarySerializer.Ubisoft.CPA.U64 { + public class WAY_Valuation : U64_Struct { + public short Valuation { get; set; } + + public override void SerializeImpl(SerializerObject s) { + Valuation = s.Serialize(Valuation, name: nameof(Valuation)); + } + } +} diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/WAY/WAY_Valuation.cs.meta b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/WAY/WAY_Valuation.cs.meta new file mode 100644 index 00000000..02b54eab --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/WAY/WAY_Valuation.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 55a2b0c4d57895c4687dd7a15a09357c +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/WAY/WAY_WayPoint.cs b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/WAY/WAY_WayPoint.cs new file mode 100644 index 00000000..0f035f72 --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/WAY/WAY_WayPoint.cs @@ -0,0 +1,13 @@ +namespace BinarySerializer.Ubisoft.CPA.U64 { + public class WAY_WayPoint : U64_Struct { + public short Radius { get; set; } + public MTH3D_ShortVector Vertex { get; set; } + public U64_Reference Father { get; set; } + + public override void SerializeImpl(SerializerObject s) { + Radius = s.Serialize(Radius, name: nameof(Radius)); + Vertex = s.SerializeObject(Vertex, name: nameof(Vertex)); + Father = s.SerializeObject>(Father, name: nameof(Father))?.Resolve(s); + } + } +} diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/WAY/WAY_WayPoint.cs.meta b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/WAY/WAY_WayPoint.cs.meta new file mode 100644 index 00000000..44042c1b --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/DataTypes/U64/WAY/WAY_WayPoint.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 0bd0e58bc899a39479ae3d4686bde8c4 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/Encoders.meta b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/Encoders.meta new file mode 100644 index 00000000..c57c8e07 --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/Encoders.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: f20868cc6b15fd845880b8dd044388bb +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/Encoders/LZOEncoder.cs b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/Encoders/LZOEncoder.cs new file mode 100644 index 00000000..709ede81 --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/Encoders/LZOEncoder.cs @@ -0,0 +1,44 @@ +using System; +using System.IO; +using System.IO.Compression; +using lzo.net; + +namespace BinarySerializer.Ubisoft.CPA +{ + public class LZOEncoder : IStreamEncoder + { + public LZOEncoder(long decompressedSize, long compressedSize) + { + DecompressedSize = decompressedSize; + CompressedSize = compressedSize; + } + + public long DecompressedSize { get; } + public long CompressedSize { get; } + + public string Name => "LZO"; + + public void DecodeStream(Stream input, Stream output) + { + // The LzoStream wraps the input stream into a buffered stream meaning it might read more data than needed. Because of + // this we need to copy the compressed data into a memory stream to ensure the input stream position remains correct. + + byte[] compressedBuffer = new byte[CompressedSize]; + int read = input.Read(compressedBuffer, 0, compressedBuffer.Length); + + if (read != compressedBuffer.Length) + throw new EndOfStreamException(); + + using MemoryStream compressedStream = new MemoryStream(compressedBuffer); + + using LzoStream lzo = new LzoStream(compressedStream, CompressionMode.Decompress, leaveOpen: true); + lzo.SetLength(DecompressedSize); + lzo.CopyTo(output); + } + + public void EncodeStream(Stream input, Stream output) + { + throw new NotImplementedException(); + } + } +} \ No newline at end of file diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/Encoders/LZOEncoder.cs.meta b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/Encoders/LZOEncoder.cs.meta new file mode 100644 index 00000000..bc56bf0f --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/Encoders/LZOEncoder.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 0bf40ab60fe76704e829156c4cbf6c39 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/Encoders/PTC_BigFileEncoder.cs b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/Encoders/PTC_BigFileEncoder.cs new file mode 100644 index 00000000..bf80b715 --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/Encoders/PTC_BigFileEncoder.cs @@ -0,0 +1,69 @@ +using System; +using System.IO; + +namespace BinarySerializer.Ubisoft.CPA { + /// + /// The encoder for Rayman 2's LEVELS0.DAT + /// + public class PTC_BigFileEncoder : IStreamEncoder + { + public PTC_BigFileEncoder(uint length) { + Length = length; + } + + public string Name => "PTC_BigFileEncoding"; + public uint Length { get; protected set; } + public static uint KeysSize => 16; + + public void DecodeStream(Stream input, Stream output) { + using Reader reader = new Reader(input, isLittleEndian: true, leaveOpen: true); + using Writer writer = new Writer(output, isLittleEndian: true, leaveOpen: true); + + // Read keys + long[] keys = new long[4]; + keys[0] = reader.ReadUInt32(); + keys[1] = reader.ReadUInt32(); + keys[2] = reader.ReadUInt32(); + keys[3] = reader.ReadUInt32(); + + + // Round length up to multiple of 4 + uint rest = Length % 4; + if (rest > 0) { + Length += (4 - rest); + } + for (int i = 0; i < Length / 4; i++) { + long value = reader.ReadUInt32(); + + // Make sure value wraps around + value = (value - keys[0]) ^ keys[1]; + while(value < 0) value += 0x100000000; + + keys[0] = (keys[0] + keys[2]) % 0x100000000; + keys[1] = (keys[1] + keys[3]) % 0x100000000; + + writer.Write((uint)value); + } + } + + public void EncodeStream(Stream input, Stream output) { + using Reader reader = new Reader(input, isLittleEndian: true, leaveOpen: true); + using Writer writer = new Writer(output, isLittleEndian: true, leaveOpen: true); + + writer.Write((uint)0); // Write 0 as keys + writer.Write((uint)0); + writer.Write((uint)0); + writer.Write((uint)0); + + writer.Write(reader.ReadBytes((int)Length)); // no need to XOR now + + uint rest = Length % 4; + if (rest > 0) { + // Pad out length to multiple of 4 + for (int i = 0; i < (4 - rest); i++) { + writer.Write((byte)0); + } + } + } + } +} \ No newline at end of file diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/Encoders/PTC_BigFileEncoder.cs.meta b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/Encoders/PTC_BigFileEncoder.cs.meta new file mode 100644 index 00000000..947696c5 --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/Encoders/PTC_BigFileEncoder.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 1ed400614267bed40999a53b3f4dc426 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/Encoders/SNA_LZOEncoder.cs b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/Encoders/SNA_LZOEncoder.cs new file mode 100644 index 00000000..dc2baa0b --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/Encoders/SNA_LZOEncoder.cs @@ -0,0 +1,68 @@ +using System; +using System.IO; +using System.IO.Compression; +using lzo.net; + +namespace BinarySerializer.Ubisoft.CPA +{ + public class SNA_LZOEncoder : IStreamEncoder + { + public uint IsCompressed { get; private set; } + public uint CompressedSize { get; set; } + public uint CompressedChecksum { get; set; } + public uint DecompressedSize { get; set; } + public uint DecompressedChecksum { get; set; } + + public string Name => "SNA_LZOEncoding"; + + public void DecodeStream(Stream input, Stream output) + { + using Reader reader = new Reader(input, isLittleEndian: true, leaveOpen: true); + + IsCompressed = reader.ReadUInt32(); + CompressedSize = reader.ReadUInt32(); + CompressedChecksum = reader.ReadUInt32(); + DecompressedSize = reader.ReadUInt32(); + DecompressedChecksum = reader.ReadUInt32(); + + byte[] compressedData = reader.ReadBytes((int)CompressedSize); + + if (IsCompressed != 0) { + using MemoryStream compressedStream = new MemoryStream(compressedData); + using LzoStream lzo = new LzoStream(compressedStream, CompressionMode.Decompress, leaveOpen: true); + lzo.SetLength(DecompressedSize); + lzo.CopyTo(output); + } else { + output.Write(compressedData, 0, compressedData.Length); + } + } + + public void EncodeStream(Stream input, Stream output) + { + // No compression :) + + IsCompressed = 0; + CompressedSize = DecompressedSize = (uint)(input.Length - input.Position); + CompressedChecksum = DecompressedChecksum = 0; // TODO + + using Writer writer = new Writer(output, isLittleEndian: true, leaveOpen: true); + using Reader reader = new Reader(input, isLittleEndian: true, leaveOpen: true); + + writer.Write(IsCompressed); + writer.Write(CompressedSize); + writer.Write(CompressedChecksum); + writer.Write(DecompressedSize); + writer.Write(DecompressedChecksum); + + writer.Write(reader.ReadBytes((int)CompressedSize)); + } + + public static SNA_LZOEncoder GetIfRequired(CPA_Settings s, uint sizeOrCount) { + if (sizeOrCount != 0 && s.EngineVersionTree.HasParent(EngineVersion.PlaymobilHype)) { + return new SNA_LZOEncoder(); + } else { + return null; + } + } + } +} \ No newline at end of file diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/Encoders/SNA_LZOEncoder.cs.meta b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/Encoders/SNA_LZOEncoder.cs.meta new file mode 100644 index 00000000..c2e1b17b --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/Encoders/SNA_LZOEncoder.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 793a34b2dda82e54d81f32c5c4cf8b8b +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/Encoders/SNA_TTWindowEncoder.cs b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/Encoders/SNA_TTWindowEncoder.cs new file mode 100644 index 00000000..497274e9 --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/Encoders/SNA_TTWindowEncoder.cs @@ -0,0 +1,48 @@ +using System.IO; +using System.Linq; + +namespace BinarySerializer.Ubisoft.CPA { + /// + /// The encoder for Tonic Trouble .sna data files + /// + public class SNA_TTWindowEncoder : IStreamEncoder + { + public string Name => "SNA_TTWindowEncoding"; + + private static void Process(Stream inputStream, Stream outputStream, bool isDecoding) + { + byte[] originalMaskBytes = { 0x41, 0x59, 0xBE, 0xC7, 0x0D, 0x99, 0x1C, 0xA3, 0x75, 0x3F }; + byte[] maskBytes = originalMaskBytes.ToArray(); + uint currentMaskByte = 0; + + // Get the length + long length = inputStream.Length - inputStream.Position; + + // Enumerate every byte + for (long i = 0; i < length; i++) + { + // Read the byte + byte b = (byte)inputStream.ReadByte(); + + // Decode the byte + byte decodedByte = (byte)(b ^ (maskBytes[currentMaskByte])); + maskBytes[currentMaskByte] = (byte)(originalMaskBytes[currentMaskByte] + (isDecoding ? b : decodedByte)); + currentMaskByte = (uint)((currentMaskByte + 1) % maskBytes.Length); + b = decodedByte; + + // Write the byte + outputStream.WriteByte(b); + } + } + + public void DecodeStream(Stream input, Stream output) + { + Process(input, output, true); + } + + public void EncodeStream(Stream input, Stream output) + { + Process(input, output, false); + } + } +} \ No newline at end of file diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/Encoders/SNA_TTWindowEncoder.cs.meta b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/Encoders/SNA_TTWindowEncoder.cs.meta new file mode 100644 index 00000000..2f4806df --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/Encoders/SNA_TTWindowEncoder.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 6503f243d03b56740b0bdecb728d686f +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/Globals.meta b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/Globals.meta new file mode 100644 index 00000000..4c00a53b --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/Globals.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: a23853b9ab9f1b644be596e40b19e4b8 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/Globals/CPA_Globals.cs b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/Globals/CPA_Globals.cs new file mode 100644 index 00000000..818cda6c --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/Globals/CPA_Globals.cs @@ -0,0 +1,21 @@ +using System; +using System.Collections.Generic; + +namespace BinarySerializer.Ubisoft.CPA { + public abstract class CPA_Globals { + public Context Context { get; set; } + public string Map { get; set; } + public abstract string GameDataDirectory { get; } + public abstract string LevelsDirectory { get; } + + public CPA_Globals(Context c, string map) { + Context = c; + Map = map; + c.StoreObject(ContextKey, this); + } + + public static string ContextKey => nameof(CPA_Globals); + + public abstract Dictionary Paths { get; } + } +} diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/Globals/CPA_Globals.cs.meta b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/Globals/CPA_Globals.cs.meta new file mode 100644 index 00000000..4ac8be04 --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/Globals/CPA_Globals.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 55e49f074b6bddf41ab6bd7e3dd1e9cc +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/Globals/CPA_Globals_Montreal.cs b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/Globals/CPA_Globals_Montreal.cs new file mode 100644 index 00000000..e9440b25 --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/Globals/CPA_Globals_Montreal.cs @@ -0,0 +1,17 @@ +using System; +using System.Linq; + +namespace BinarySerializer.Ubisoft.CPA { + public class CPA_Globals_Montreal : CPA_Globals_SNA { + + public CPA_Globals_Montreal(Context c, string map) : base(c, map) { } + + public SNA_File GameDSB_Montreal { get; set; } + public override SNA_IDescription DirectoryDescription => GameDSB_Montreal?.Value; + + public override string LevelsDirectory => + Context.GetCPASettings().ApplyPathCapitalization( + DirectoryDescription?.GetDirectory(SNA_DescriptionType.DirectoryOfLevels), + PathCapitalizationType.All); + } +} diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/Globals/CPA_Globals_Montreal.cs.meta b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/Globals/CPA_Globals_Montreal.cs.meta new file mode 100644 index 00000000..a08b485d --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/Globals/CPA_Globals_Montreal.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 646b0c65ee068b3419fc9806f4edcd2b +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/Globals/CPA_Globals_SNA.cs b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/Globals/CPA_Globals_SNA.cs new file mode 100644 index 00000000..223cdecf --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/Globals/CPA_Globals_SNA.cs @@ -0,0 +1,120 @@ +using System; +using System.Collections.Generic; +using System.IO; +using System.Linq; + +namespace BinarySerializer.Ubisoft.CPA { + public class CPA_Globals_SNA : CPA_Globals { + + public CPA_Globals_SNA(Context c, string map) : base(c, map) { } + + public SNA_File GameDSB { get; set; } + public SNA_RelocationBigFile RelocationBigFile { get; set; } + + public override string GameDataDirectory => + Context.GetCPASettings().ApplyPathCapitalization(DirectoryDescription?.GetDirectory(SNA_DescriptionType.DirectoryOfGameData) ?? "GameData", PathCapitalizationType.All); + + public string LangDataDirectory => + Context.GetCPASettings().ApplyPathCapitalization("LangData/English/", PathCapitalizationType.All); // TODO + + public string LangDataLevelsDirectory => LangDataDirectory + + Context.GetCPASettings().ApplyPathCapitalization(DirectoryDescription?.GetDirectory(SNA_DescriptionType.DirectoryOfLevels).Substring("GameData/".Length), PathCapitalizationType.All); + + public virtual SNA_IDescription DirectoryDescription => GameDSB?.Value; + + public override string LevelsDirectory => GameDataDirectory + + Context.GetCPASettings().ApplyPathCapitalization(DirectoryDescription?.GetDirectory(SNA_DescriptionType.DirectoryOfLevels), PathCapitalizationType.All); + + public string RelocationBigFilePath => Context.NormalizePath(LevelsDirectory, true) + "LEVELS0.DAT"; + + public int? MapIndex => GameDSB?.Value?.GetMapIndex(Map); + + public override Dictionary Paths { + get { + var cpaSettings = Context.GetCPASettings(); + string ConvertCase(string path, PathCapitalizationType type) => cpaSettings.ApplyPathCapitalization(path, type); + var gamedataDirectory = Context.NormalizePath(GameDataDirectory, true); + var paths = new Dictionary(); + if (cpaSettings.EngineVersionTree.HasParent(EngineVersion.CPA_Montreal)) { + paths[CPA_Path.GameDSC] = $"{gamedataDirectory}{ConvertCase("gamedsc.bin", PathCapitalizationType.DSB)}"; + } else if (cpaSettings.EngineVersion == EngineVersion.TonicTroubleSE) { + paths[CPA_Path.GameDSC] = $"{gamedataDirectory}{ConvertCase("GAME.DSC", PathCapitalizationType.DSB)}"; + } else { + paths[CPA_Path.GameDSC] = $"{gamedataDirectory}{ConvertCase("Game.dsb", PathCapitalizationType.DSB)}"; + } + if(DirectoryDescription == null) return paths; + + var levelsFolder = Context.NormalizePath(LevelsDirectory, true); + + // Prepare folder names + string lvlName = Map; + string lvlFolder = ConvertCase($"{lvlName}/", PathCapitalizationType.LevelFolder); + string langLvlFolder = ConvertCase($"{lvlName}/", PathCapitalizationType.LangLevelFolder); + string langDataPath = Context.NormalizePath(LangDataLevelsDirectory, true); + + paths[CPA_Path.RelocationBigFile] = levelsFolder + "LEVELS0.DAT"; + + // Prepare paths + paths[CPA_Path.FixSNA] = levelsFolder + ConvertCase("Fix.sna", PathCapitalizationType.Fix); + paths[CPA_Path.FixRTB] = levelsFolder + ConvertCase("Fix.rtb", PathCapitalizationType.FixRelocation); + paths[CPA_Path.FixGPT] = levelsFolder + ConvertCase("Fix.gpt", PathCapitalizationType.Fix); + paths[CPA_Path.FixRTP] = levelsFolder + ConvertCase("Fix.rtp", PathCapitalizationType.FixRelocation); + paths[CPA_Path.FixPTX] = levelsFolder + ConvertCase("Fix.ptx", PathCapitalizationType.Fix); + paths[CPA_Path.FixRTT] = levelsFolder + ConvertCase("Fix.rtt", PathCapitalizationType.FixRelocation); + if (cpaSettings.EngineVersionTree.HasParent(EngineVersion.CPA_2)) { + paths[CPA_Path.FixLevelRTB] = null; + } else { + paths[CPA_Path.FixLevelRTB] = levelsFolder + lvlFolder + ConvertCase("FixLvl.rtb", PathCapitalizationType.FixLvl); + } + if (cpaSettings.EngineVersionTree.HasParent(EngineVersion.CPA_Montreal)) { + paths[CPA_Path.FixSDA] = levelsFolder + ConvertCase("Fix.sda", PathCapitalizationType.Fix); + paths[CPA_Path.FixLNG] = langDataPath + ConvertCase("Fix.lng", PathCapitalizationType.LangFix); + paths[CPA_Path.FixRTG] = langDataPath + ConvertCase("Fix.rtg", PathCapitalizationType.FixRelocation); + paths[CPA_Path.FixDLG] = langDataPath + ConvertCase("Fix.dlg", PathCapitalizationType.LangFix); + paths[CPA_Path.FixRTD] = langDataPath + ConvertCase("Fix.rtd", PathCapitalizationType.FixRelocation); + paths[CPA_Path.FixLevelRTG] = langDataPath + langLvlFolder + ConvertCase("FixLvl.rtg", PathCapitalizationType.FixLvl); + } else { + paths[CPA_Path.FixSDA] = null; + paths[CPA_Path.FixLNG] = null; + paths[CPA_Path.FixRTG] = null; + paths[CPA_Path.FixDLG] = null; + paths[CPA_Path.FixRTD] = null; + paths[CPA_Path.FixLevelRTG] = null; + } + + paths[CPA_Path.LevelSNA] = levelsFolder + lvlFolder + ConvertCase(lvlName + ".sna", PathCapitalizationType.LevelFile); + paths[CPA_Path.LevelGPT] = levelsFolder + lvlFolder + ConvertCase(lvlName + ".gpt", PathCapitalizationType.LevelFile); + paths[CPA_Path.LevelPTX] = levelsFolder + lvlFolder + ConvertCase(lvlName + ".ptx", PathCapitalizationType.LevelFile); + if (RelocationBigFile == null) { + paths[CPA_Path.LevelRTB] = levelsFolder + lvlFolder + ConvertCase(lvlName + ".rtb", PathCapitalizationType.LevelRelocation); + paths[CPA_Path.LevelRTP] = levelsFolder + lvlFolder + ConvertCase(lvlName + ".rtp", PathCapitalizationType.LevelRelocation); + paths[CPA_Path.LevelRTT] = levelsFolder + lvlFolder + ConvertCase(lvlName + ".rtt", PathCapitalizationType.LevelRelocation); + } else { + paths[CPA_Path.LevelRTB] = null; + paths[CPA_Path.LevelRTP] = null; + paths[CPA_Path.LevelRTT] = null; + } + if (cpaSettings.EngineVersionTree.HasParent(EngineVersion.CPA_Montreal)) { + paths[CPA_Path.LevelSDA] = levelsFolder + lvlFolder + ConvertCase(lvlName + ".sda", PathCapitalizationType.LevelFile); + paths[CPA_Path.LevelLNG] = langDataPath + langLvlFolder + ConvertCase(lvlName + ".lng", PathCapitalizationType.LangLevelFile); + paths[CPA_Path.LevelRTG] = langDataPath + langLvlFolder + ConvertCase(lvlName + ".rtg", PathCapitalizationType.LangLevelFile); + paths[CPA_Path.LevelDLG] = langDataPath + langLvlFolder + ConvertCase(lvlName + ".dlg", PathCapitalizationType.LangLevelFile); + paths[CPA_Path.LevelRTD] = langDataPath + langLvlFolder + ConvertCase(lvlName + ".rtd", PathCapitalizationType.LangLevelRelocation); + } else { + paths[CPA_Path.LevelSDA] = null; + paths[CPA_Path.LevelLNG] = null; + paths[CPA_Path.LevelRTG] = null; + paths[CPA_Path.LevelDLG] = null; + paths[CPA_Path.LevelRTD] = null; + } + if (cpaSettings.EngineVersionTree.HasParent(EngineVersion.CPA_2)) { + paths[CPA_Path.LevelDSC] = levelsFolder + lvlFolder + ConvertCase(lvlName + ".dsb", PathCapitalizationType.DSB); + } else { + paths[CPA_Path.LevelDSC] = levelsFolder + lvlFolder + ConvertCase(lvlName + ".dsc", PathCapitalizationType.DSB); + } + + return paths; + } + } + } +} diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/Globals/CPA_Globals_SNA.cs.meta b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/Globals/CPA_Globals_SNA.cs.meta new file mode 100644 index 00000000..723a5148 --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/Globals/CPA_Globals_SNA.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 509285c14b376e647ad854828b148647 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/Globals/CPA_Globals_TTPC.cs b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/Globals/CPA_Globals_TTPC.cs new file mode 100644 index 00000000..25445ffa --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/Globals/CPA_Globals_TTPC.cs @@ -0,0 +1,17 @@ +using System; +using System.Linq; + +namespace BinarySerializer.Ubisoft.CPA { + public class CPA_Globals_TTPC : CPA_Globals_SNA { + + public CPA_Globals_TTPC(Context c, string map) : base(c, map) { } + + public SNA_File GameDSB_TTPC { get; set; } + public override SNA_IDescription DirectoryDescription => GameDSB_TTPC?.Value; + + public override string LevelsDirectory => + Context.GetCPASettings().ApplyPathCapitalization( + DirectoryDescription?.GetDirectory(SNA_DescriptionType.DirectoryOfLevels), + PathCapitalizationType.All); + } +} diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/Globals/CPA_Globals_TTPC.cs.meta b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/Globals/CPA_Globals_TTPC.cs.meta new file mode 100644 index 00000000..b168af95 --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/Globals/CPA_Globals_TTPC.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: fa6dab152539efd47b5ad621ff8529c8 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/Globals/Enums.meta b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/Globals/Enums.meta new file mode 100644 index 00000000..d12681ea --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/Globals/Enums.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: e042c7b766903104c8e4baf886462213 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/Globals/Enums/CPA_Path.cs b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/Globals/Enums/CPA_Path.cs new file mode 100644 index 00000000..e4bb2b0c --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/Globals/Enums/CPA_Path.cs @@ -0,0 +1,55 @@ +namespace BinarySerializer.Ubisoft.CPA { + public enum CPA_Path { + // Main + Executable, + + // Rayman 2 + GameDSC, + LevelDSC, + RelocationBigFile, + + FixSNA, + FixRTB, + + FixGPT, + FixRTP, + + FixPTX, + FixRTT, + + FixSDA, + FixLNG, + FixRTG, + FixDLG, + FixRTD, + + LevelSNA, + LevelRTB, + + LevelGPT, + LevelRTP, + + LevelPTX, + LevelRTT, + + LevelSDA, + LevelLNG, + LevelRTG, + LevelDLG, + LevelRTD, + + FixLevelRTB, + FixLevelRTG, + + // Rayman 3 + FixLVL, + FixPTR, + + LevelLVL, + LevelPTR, + + TransitLVL, + TransitPTR, + + } +} diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/Globals/Enums/CPA_Path.cs.meta b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/Globals/Enums/CPA_Path.cs.meta new file mode 100644 index 00000000..6d495cda --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/Globals/Enums/CPA_Path.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 1282ee8f677b8d3418370faeb6e3aefc +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/Helpers.meta b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/Helpers.meta new file mode 100644 index 00000000..8245f1cc --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/Helpers.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 61f5b34c4b721964abe07a356808538d +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/Helpers/ContextExtensions.cs b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/Helpers/ContextExtensions.cs new file mode 100644 index 00000000..4168230f --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/Helpers/ContextExtensions.cs @@ -0,0 +1,10 @@ +namespace BinarySerializer.Ubisoft.CPA { + public static class ContextExtensions { + public static CPA_Settings GetCPASettings(this SerializerObject s) => s.Context.GetCPASettings(); + public static CPA_Settings GetCPASettings(this Context c) => c.GetSettings(); + + public static CPA_Globals GetCPAGlobals(this SerializerObject s) => s.Context.GetCPAGlobals(); + public static CPA_Globals GetCPAGlobals(this Context c, bool throwIfNotFound = true) => + c.GetStoredObject(CPA_Globals.ContextKey, throwIfNotFound); + } +} diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/Helpers/ContextExtensions.cs.meta b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/Helpers/ContextExtensions.cs.meta new file mode 100644 index 00000000..03a005cd --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/Helpers/ContextExtensions.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: b14ec9134c8d00841b36b5f455491e4e +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/Helpers/LevelTranslation.cs b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/Helpers/LevelTranslation.cs new file mode 100644 index 00000000..faf36366 --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/Helpers/LevelTranslation.cs @@ -0,0 +1,278 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace BinarySerializer.Ubisoft.CPA { + public class LevelTranslation { + + public struct LevelTranslationItem { + string FolderName; + string LevelName; + + public LevelTranslationItem(string FolderName, string LevelName) + { + this.FolderName = FolderName; + this.LevelName = LevelName; + } + } + + public LevelTranslation(List<(string, string)> items) + { + this.items = items; + } + + public List<(string, string)> items; + + public List<(string, string)> SortAndTranslate(List levels) + { + List sortedLevels = new List(levels); + sortedLevels = sortedLevels.OrderBy((l) => + { + return items.IndexOf(items.Find(m => { return m.Item1.ToLower() == l.ToLower(); })); + }).ToList(); + + List<(string, string)> translatedResult = new List<(string, string)>(); + + sortedLevels.ForEach((l) => + { + (string, string)? item = items.Find(m => { return m.Item1.ToLower() == l.ToLower(); }); + if (item.HasValue) { + translatedResult.Add((l,item.Value.Item2)); + } else { + translatedResult.Add((l, l)); + } + }); + + return translatedResult; + } + public string Translate(string level) { + int itemIndex = items.FindIndex(m => { return m.Item1.ToLower() == level.ToLower(); }); + if(itemIndex != -1) { + return items[itemIndex].Item2 + " <" + level + ">"; + } else { + return level; + } + } + + public static LevelTranslation levelTranslation_r2 => new LevelTranslation(new List<(string, string)>() { + ("MENU", "Main Menu"), + ("JAIL_10", "Prologue (Stormy Seas)"), + ("JAIL_20", "Prologue (Jail)"), + ("LEARN_10", "The Woods of Light"), + ("MAPMONDE", "The Hall of Doors"), + ("MAPMONDE2", "The Isle of Doors"), + ("LEARN_30", "The Fairy Glade 1"), + ("LEARN_31", "The Fairy Glade 2"), + ("BAST_20", "The Fairy Glade 3"), + ("BAST_22", "The Fairy Glade 4"), + ("LEARN_60", "The Fairy Glade 5"), + ("SKI_10", "The Marshes of Awakening 1"), + ("SKI_60", "The Marshes of Awakening 2"), + ("BATAM_10", "Meanwhile, on the Prison Ship"), + ("CHASE_10", "The Bayou 1"), + ("CHASE_22", "The Bayou 2"), + ("LY_10", "The Walk of Life"), + ("NEGO_10", "The Chamber of the Teensies"), + ("WATER_10", "The Sanctuary of Water and Ice 1"), + ("WATER_20", "The Sanctuary of Water and Ice 2"), + ("POLOC_10", "Polokus - First Mask"), + ("RODEO_10", "The Menhir Hills 1"), + ("RODEO_40", "The Menhir Hills 2"), + ("RODEO_60", "The Menhir Hills 3"), + ("VULCA_10", "The Cave of Bad Dreams 1"), + ("VULCA_20", "The Cave of Bad Dreams 2"), + ("GLOB_30", "The Canopy 1"), + ("GLOB_10", "The Canopy 2"), + ("GLOB_20", "The Canopy 3"), + ("WHALE_00", "Whale Bay 1"), + ("WHALE_05", "Whale Bay 2"), + ("WHALE_10", "Whale Bay 3"), + ("PLUM_00", "The Sanctuary of Stone and Fire 1"), + ("PLUM_20", "The Sanctuary of Stone and Fire 2"), + ("PLUM_10", "The Sanctuary of Stone and Fire 3"), + ("POLOC_20", "Polokus - Second Mask"), + ("BAST_09", "The Echoing Caves (Intro)"), + ("BAST_10", "The Echoing Caves 1"), + ("CASK_10", "The Echoing Caves 2"), + ("CASK_30", "The Echoing Caves 3"), + ("NAVE_10", "The Precipice 1"), + ("NAVE_15", "The Precipice 2"), + ("NAVE_20", "The Precipice 3"), + ("SEAT_10", "The Top of the World 1"), + ("SEAT_11", "The Top of the World 2"), + ("EARTH_10", "The Sanctuary of Rock and Lava 1"), + ("EARTH_20", "The Sanctuary of Rock and Lava 2"), + ("EARTH_30", "The Sanctuary of Rock and Lava 3"), + ("LY_20", "The Walk of Power"), + ("HELIC_10", "Beneath the Sanctuary of Rock and Lava 1"), + ("HELIC_20", "Beneath the Sanctuary of Rock and Lava 2"), + ("HELIC_30", "Beneath the Sanctuary of Rock and Lava 3"), + ("POLOC_30", "Polokus - Third Mask"), + ("MORB_00", "Tomb of the Ancients 1"), + ("MORB_10", "Tomb of the Ancients 2"), + ("MORB_20", "Tomb of the Ancients 3"), + ("LEARN_40", "The Iron Mountains 1"), + ("BALL", "The Iron Mountains (Balloon Flight)"), + ("ILE_10", "The Iron Mountains 2 (The Gloomy Island)"), + ("MINE_10", "The Iron Mountains 3 (The Pirate Mines)"), + ("POLOC_40", "Polokus - Fourth Mask"), + ("BATAM_20", "Meanwhile, on the Prison Ship (The Grolgoth)"), + ("BOAT01", "The Prison Ship 1"), + ("BOAT02", "The Prison Ship 2"), + ("ASTRO_00", "The Prison Ship 3"), + ("ASTRO_10", "The Prison Ship 4"), + ("LIBER_10", "Freeing the Slaves"), + ("RHOP_10", "The Crow's Nest"), + ("END_10", "Ending"), + ("STAFF_10", "Staff Roll"), + ("BONUX", "Bonus Level"), + ("GLOBVILL", "Globox Village"), + ("B_PYRAM", "Minigame - Pyralums"), + ("B_TOILE", "Minigame - Weblums"), + ("GLODISC_CINE", "Minigame - Globox Disc (Intro)"), + ("B_DISC", "Minigame - Globox Disc"), + ("B_LIFT", "Minigame - Lift"), + ("B_INVADE", "Minigame - Invade"), + ("RAYCAP", "Score Recap"), + }); + + public static LevelTranslation levelTranslation_rarena_pc => new LevelTranslation(new List<(string, string)>() { + ("menu", "Main Menu"), + ("1Shadow", "(L1 Battle) Shadow Plain"), + ("1Shrine", "(L1 Battle) Rise and Shrine"), + ("1Sunset", "(L1 Battle) Sunset Coast"), + ("2Haunted", "(L2 Battle) Haunted Yard"), + ("2Palm", "(L2 Battle) Palm Beach"), + ("2Timber", "(L2 Battle) Timber Wood"), + ("3Coconut", "(L3 Battle) Coconut Island"), + ("3Ly", "(L3 Battle) Ly's Palace"), + ("3Spell", "(L3 Battle) Spellbound Forest"), + ("4Forgot", "(L4 Battle) Forgotten Dungeon"), + ("4Gem", "(L4 Battle) Gemstone Temple"), + ("4Ghastly", "(L4 Battle) Ghastly Trees"), + ("BSpooky", "(Bonus Battle) Spooky Towers"), + ("crypt1", "(L1 Race) First Ruins"), + ("crypt2", "(L1 Race) Nebulous Tower"), + ("crypt3", "(L1 Race) Dark Sewer"), + ("lagoon1", "(L2 Race) Dawn Sand"), + ("lagoon2", "(L2 Race) Water Canyon"), + ("lagoon3", "(L2 Race) Thousand Waterfalls"), + ("pirate1", "(L3 Race) Forest Jump"), + ("pirate2", "(L3 Race) Zenith Harbour"), + ("pirate3", "(L3 Race) Treasure Ship"), + ("factory1", "(L4 Race) Pipe Maze"), + ("factory2", "(L4 Race) Lava Factory"), + ("factory3", "(L4 Race) Electric Final"), + ("bonus01", "(Bonus Race) Big Bang"), + ("bonus", "(Bonus Race) Future"), + ("scrol", "(Bonus Race) Born To Slide"), + ("bonus2", "(Bonus Race) Speed Stress") + }); + + public static LevelTranslation levelTranslation_rarena_xboxgc => new LevelTranslation(new List<(string, string)>() { + ("podium", "The Podium"), + ("1Shadow", "(L1 Battle) Shadow Plain"), + ("1Shrine", "(L1 Battle) Rise and Shrine"), + ("1Sunset", "(L1 Battle) Sunset Coast"), + ("2Haunted", "(L2 Battle) Haunted Yard"), + ("2Palm", "(L2 Battle) Palm Beach"), + ("2Timber", "(L2 Battle) Timber Wood"), + ("3Coconut", "(L3 Battle) Coconut Island"), + ("3Ly", "(L3 Battle) Ly's Palace"), + ("3Spell", "(L3 Battle) Spellbound Forest"), + ("4Forgot", "(L4 Battle) Forgotten Dungeon"), + ("4Gem", "(L4 Battle) Gemstone Temple"), + ("4Ghastly", "(L4 Battle) Ghastly Trees"), + ("crypt1", "(L1 Race) First Ruins"), + ("crypt2", "(L1 Race) Nebulous Tower"), + ("crypt3", "(L1 Race) Dark Sewer"), + ("lagoon1", "(L2 Race) Dawn Sand"), + ("lagoon2", "(L2 Race) Water Canyon"), + ("lagoon3", "(L2 Race) Thousand Waterfalls"), + ("pirate1", "(L3 Race) Forest Jump"), + ("pirate2", "(L3 Race) Zenith Harbour"), + ("pirate3", "(L3 Race) Treasure Ship"), + ("factory1", "(L4 Race) Pipe Maze"), + ("factory2", "(L4 Race) Lava Factory"), + ("factory3", "(L4 Race) Electric Final"), + ("Pacbonus", "(Bonus Battle) Pac Arena"), + ("BGravity01", "(Bonus Battle) Low-Gravity Arena"), + ("BSpooky", "(Bonus Battle) Spooky Towers"), + ("BDamien", "(Bonus Battle) Kuraï"), + ("scrol", "(Bonus Race) Speed Stress"), + ("bonus2", "(Bonus Race) Run, Run"), + ("mcstnx45", "(Bonus Race) Extreme Slide"), + ("bonus", "(Bonus Race) Future"), + }); + + public static LevelTranslation levelTranslation_r3 => new LevelTranslation(new List<(string, string)>() { + ( "menumap", "Main Menu" ), + ( "intro_10", "The Fairy Council 1 (Murfy)" ), + ( "intro_15", "The Fairy Council 2 (Finding Globox)" ), + ( "Intro_17", "The Fairy Council 3 (Inside)" ), + ( "intro_20", "The Fairy Council 4" ), + ( "menu_00", "The Fairy Council 5 (Heart of the World)" ), + ( "sk8_00", "The Fairy Council 6 (Teensie Highway)" ), + ( "wood_11", "Clearleaf Forest 1" ), + ( "Wood_10", "Clearleaf Forest 2" ), + ( "Wood_19", "Clearleaf Forest 3" ), + ( "Wood_50", "Clearleaf Forest 4 (Master Kaag)" ), + ( "menu_10", "Clearleaf Forest 5 (Doctor's Office)" ), + ( "Sk8_10", "Clearleaf Forest 6 (Teensie Highway)" ), + ( "Swamp_60", "The Bog of Murk 1 (Bégoniax)" ), + ( "Swamp_82", "The Bog of Murk 2" ), + ( "Swamp_81", "The Bog of Murk 3" ), + ( "swamp_83", "The Bog of Murk 4" ), + ( "Swamp_50", "The Bog of Murk 5 (Razoff's Mansion)" ), + ( "Swamp_51", "The Bog of Murk 6 (Razoff's Basement)" ), + ( "Moor_00", "The Land of the Livid Dead 1" ), + ( "Moor_30", "The Land of the Livid Dead 2" ), + ( "moor_60", "The Land of the Livid Dead 3 (Tower)" ), + ( "moor_19", "The Land of the Livid Dead 4 (Céloche)" ), + ( "menu_20", "The Land of the Livid Dead 5 (Doctor's Office)" ), + ( "Sk8_20", "The Land of the Livid Dead 6 (Teensie Highway)" ), + ( "Knaar_10", "The Desert of the Knaaren 1" ), + ( "Knaar_20", "The Desert of the Knaaren 2 (The Great Hall)" ), + ( "Knaar_30", "The Desert of the Knaaren 3 (Tower)" ), + ( "Knaar_45", "The Desert of the Knaaren 4" ), + ( "Knaar_60", "The Desert of the Knaaren 5 (Arena)" ), + ( "Knaar_69", "The Desert of the Knaaren 6 (Grimace Room)" ), + ( "Knaar_70", "The Desert of the Knaaren 7" ), + ( "menu_30", "The Desert of the Knaaren 8 (Doctor's Office)" ), + ( "Flash_20", "The Longest Shortcut 1" ), + ( "Flash_30", "The Longest Shortcut 2" ), + ( "flash_10", "The Longest Shortcut 3" ), + ( "Sea_10", "The Summit Beyond the Clouds 1 (The Looming Sea)" ), + ( "mount_50", "The Summit Beyond the Clouds 2" ), + ( "mount_4x", "The Summit Beyond the Clouds 3 (Snowboard)" ), + ( "Fact_40", "Hoodlum Headquarters 1" ), + ( "Fact_50", "Hoodlum Headquarters 2 (Firing Range)" ), + ( "Fact_55", "Hoodlum Headquarters 3" ), + ( "fact_34", "Hoodlum Headquarters 4 (Horrible Machine)" ), + ( "Fact_22", "Hoodlum Headquarters 5 (Rising Lava)" ), + ( "Tower_10", "The Tower of the Leptys 1" ), + ( "Tower_20", "The Tower of the Leptys 2" ), + ( "Tower_30", "The Tower of the Leptys 3" ), + ( "Tower_40", "The Tower of the Leptys 4" ), + ( "lept_15", "The Tower of the Leptys 5 (Final Battle)" ), + ( "staff", "Staff Roll" ), + ( "toudi_00", "Arcade - 2D Madness" ), + ( "Ten_map", "Arcade - Racket Jump" ), + ( "crush", "Arcade - Crush" ), + ( "raz_map", "Arcade - Razoff Circus" ), + ( "sentinel", "Arcade - Sentinel" ), + ( "snipe_00", "Arcade - Missile Command" ), + ( "ballmap", "Arcade - Balloons" ), + ( "Ship_map", "Arcade - Special Invaders" ), + ( "Commando", "Arcade - Commando" ), + ( "roadrun", "Arcade - Mad Trax" ), + ( "roadrun_4", "Arcade - Wheelis" ), + ( "toudi_10", "Arcade - 2D Nightmare" ), + ( "BonusTXT", "Bonus (Empty)" ), + ( "endgame", "Endgame (Empty)" ) + }); + + } +} diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/Helpers/LevelTranslation.cs.meta b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/Helpers/LevelTranslation.cs.meta new file mode 100644 index 00000000..3e74c564 --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/Helpers/LevelTranslation.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: b943054d38998b04895cce6ba6a4bb76 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/Helpers/PS1.meta b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/Helpers/PS1.meta new file mode 100644 index 00000000..8eaec196 --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/Helpers/PS1.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 2622a35a6a7e98d48a390b1f90da4d83 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/Helpers/PS1/ContextExtensions.cs b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/Helpers/PS1/ContextExtensions.cs new file mode 100644 index 00000000..679fc444 --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/Helpers/PS1/ContextExtensions.cs @@ -0,0 +1,7 @@ +namespace BinarySerializer.Ubisoft.CPA.PS1 { + public static class ContextExtensions { + public static GAM_Level_PS1 GetLevel(this SerializerObject s) => s.Context.GetLevel(); + public static GAM_Level_PS1 GetLevel(this Context c, bool throwIfNotFound = true) => + c.GetStoredObject(GAM_Level_PS1.ContextKey, throwIfNotFound); + } +} diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/Helpers/PS1/ContextExtensions.cs.meta b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/Helpers/PS1/ContextExtensions.cs.meta new file mode 100644 index 00000000..9957fabe --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/Helpers/PS1/ContextExtensions.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: d0b0279b6162b9549879716f768dafc1 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/Helpers/U64.meta b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/Helpers/U64.meta new file mode 100644 index 00000000..fe21e726 --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/Helpers/U64.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: dec59dfad6e260748895e7020ff71209 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/Helpers/U64/ContextExtensions.cs b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/Helpers/U64/ContextExtensions.cs new file mode 100644 index 00000000..426bb28a --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/Helpers/U64/ContextExtensions.cs @@ -0,0 +1,7 @@ +namespace BinarySerializer.Ubisoft.CPA.U64 { + public static class ContextExtensions { + public static LDR_Loader GetLoader(this SerializerObject s) => s.Context.GetLoader(); + public static LDR_Loader GetLoader(this Context c, bool throwIfNotFound = true) => + c.GetStoredObject(LDR_Loader.ContextKey, throwIfNotFound); + } +} diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/Helpers/U64/ContextExtensions.cs.meta b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/Helpers/U64/ContextExtensions.cs.meta new file mode 100644 index 00000000..8b6ad33d --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/Helpers/U64/ContextExtensions.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 1714b28667d232043aa0d59c8d485b6b +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/Settings.meta b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/Settings.meta new file mode 100644 index 00000000..1bd7be9a --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/Settings.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: d74203658d787394abdf45037c805621 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/Settings/CPA_Settings.cs b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/Settings/CPA_Settings.cs new file mode 100644 index 00000000..7bd81605 --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/Settings/CPA_Settings.cs @@ -0,0 +1,91 @@ +using System; +using System.Collections.Generic; +using LinkedListType = BinarySerializer.Ubisoft.CPA.LST2_ListType; + +namespace BinarySerializer.Ubisoft.CPA { + /// + /// Settings for serializing OpenSpace game formats + /// + public class CPA_Settings + { + public CPA_Settings(EngineVersion engineVersion, Platform platform) + { + EngineVersion = engineVersion; + Platform = platform; + EngineVersionTree = EngineVersionTree.Create(this); + } + + public void Init() { + AITypes?.Init(); + COLTypes?.Init(); + SNATypes?.Init(); + } + + public EngineVersion EngineVersion { get; } + public Platform Platform { get; } + + public Endian GetEndian => Platform switch + { + Platform.GC => Endian.Big, + Platform.N64 => Endian.Big, + Platform.MacOS => Endian.Big, + Platform.Xbox360 => Endian.Big, + Platform.PS3 => Endian.Big, + _ => Endian.Little + }; + + /// + /// Engine version tree. CPA has a complex history and evolved with many branches + /// + public EngineVersionTree EngineVersionTree { get; } + + // Legacy. TODO: Remove those that become useless + public CPA_GameMode Mode { get; set; } = CPA_GameMode.Rayman3PC; + public LST2_ListType StaticListType { get; set; } = LST2_ListType.DoubleLinked; + public bool HasObjectTypes { get; set; } = true; + public bool HasNames { get; set; } = false; + public bool HasDeformations { get; set; } = false; + public int EntryActionsCount { get; set; } = 0; + public bool HasExtraInputData { get; set; } = false; + public bool HasMemorySupport { get; set; } = false; + public Dictionary MemoryAddresses { get; set; } = null; + public bool LoadFromMemory { get; set; } = false; + public Encryption Encryption { get; set; } = Encryption.None; + public bool EncryptPointerFiles { get; set; } = false; + public bool HasLinkedListHeaderPointers { get; set; } = false; + public bool SNA_Compression { get; set; } = false; + public AI_Types AITypes { get; set; } + public COL_Types COLTypes { get; set; } + public SNA_Types SNATypes { get; set; } + public float TextureAnimationSpeedModifier { get; set; } = 1f; + public float Luminosity { get; set; } = 0.5f; + public bool Saturate { get; set; } = true; + public Dictionary PathCapitalization { get; set; } = new Dictionary(); + public LevelTranslation LevelTranslation { get; set; } = null; + public bool LinkUncategorizedObjectsToScriptFamily { get; set; } = false; + + public string ApplyPathCapitalization(string path, PathCapitalizationType capsType) { + PathCapitalization caps = CPA.PathCapitalization.Normal; + if (PathCapitalization != null) { + if (PathCapitalization.ContainsKey(capsType)) { + caps = PathCapitalization[capsType]; + } else if (PathCapitalization.ContainsKey(PathCapitalizationType.All)) { + caps = PathCapitalization[PathCapitalizationType.All]; + } + } + switch (caps) { + case CPA.PathCapitalization.All: + return path.ToUpper(); + case CPA.PathCapitalization.None: + return path.ToLower(); + case CPA.PathCapitalization.AllExceptExtension: + if (path.LastIndexOf('.') > 0) { + string pathWithoutExtension = path.Substring(0, path.LastIndexOf('.')).ToUpper(); + return pathWithoutExtension + path.Substring(path.LastIndexOf('.')); + } else return path.ToUpper(); + default: + return path; + } + } + } +} \ No newline at end of file diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/Settings/CPA_Settings.cs.meta b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/Settings/CPA_Settings.cs.meta new file mode 100644 index 00000000..15606ead --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/Settings/CPA_Settings.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 342a777c9a4723e4c9552d49537e8c88 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/Settings/CPA_Settings_Defines.cs b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/Settings/CPA_Settings_Defines.cs new file mode 100644 index 00000000..f8fa776a --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/Settings/CPA_Settings_Defines.cs @@ -0,0 +1,975 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; + +namespace BinarySerializer.Ubisoft.CPA { + public class CPA_Settings_Defines { + #region Rayman 3 + public static CPA_Settings R3PC => new CPA_Settings(EngineVersion.Rayman3, Platform.PC) { + StaticListType = LST2_ListType.DoubleLinked, + HasDeformations = true, + AITypes = new AI_Types_R3_PS2(), + COLTypes = new COL_Types_R2(), + HasMemorySupport = true, + TextureAnimationSpeedModifier = 10f, + Luminosity = 0.1f, + Saturate = false, + LevelTranslation = LevelTranslation.levelTranslation_r3, + MemoryAddresses = new Dictionary { + { "actualWorld", 0x007D9A4C }, + { "dynamicWorld", 0x007D9934 }, + { "inactiveDynamicWorld", 0x007D9924 }, + { "fatherSector", 0x007D9920 }, + { "firstSubmapPosition", 0x007A837C }, + { "always", 0x005D29F8 }, + { "anim_stacks", 0x007D0980 }, + { "anim_framesKF", 0x007CFAE0 }, + { "anim_a3d", 0x007D07E0 }, + { "anim_channels", 0x007CFE20 }, + { "anim_framesNumOfNTTO", 0x007CFC80 }, + { "anim_hierarchies", 0x007D0300 }, + { "anim_morphData", 0x007CF600 }, + { "anim_keyframes", 0x007CF940 }, + { "anim_onlyFrames", 0x007CFFC0 }, + { "anim_vectors", 0x007D0640 }, + { "anim_events", 0x007CF7A0 }, + { "anim_NTTO", 0x007D0160 }, + { "anim_quaternions", 0x007D04A0 }, + { "anim_deformations", 0x007CF460 }, + { "families", 0x007D83AC }, + { "objectTypes", 0x007D9A60 }, + { "textures", 0x007E4AA0 }, + { "textureMemoryChannels", 0x007E3AA0 }, + { "inputStructure", 0x0083F7E0 }, + { "localizationStructure", 0x007A84E0 }, + { "num_visualMaterials", 0x005F5E80 }, + { "visualMaterials", 0x005BFAD4 }, + { "brightness", 0x005F5E20 }, + }, + PathCapitalization = new Dictionary() { + { PathCapitalizationType.LevelFile, PathCapitalization.None }, + { PathCapitalizationType.Fix, PathCapitalization.None }, + { PathCapitalizationType.TextureFile, PathCapitalization.Normal }, + }, + }; + + public static CPA_Settings R3PCDemo20021001 => new CPA_Settings(EngineVersion.Rayman3, Platform.PC) { + StaticListType = LST2_ListType.DoubleLinked, + HasDeformations = true, + AITypes = new AI_Types_R3_PS2(), + COLTypes = new COL_Types_R2(), + HasMemorySupport = false, + TextureAnimationSpeedModifier = 10f, + Luminosity = 0.1f, + Saturate = false, + LevelTranslation = LevelTranslation.levelTranslation_r3, + PathCapitalization = new Dictionary() { + { PathCapitalizationType.LevelFile, PathCapitalization.None }, + { PathCapitalizationType.Fix, PathCapitalization.None }, + { PathCapitalizationType.TextureFile, PathCapitalization.Normal }, + }, + }; + public static CPA_Settings R3PCDemo20021021 => new CPA_Settings(EngineVersion.Rayman3, Platform.PC) { + StaticListType = LST2_ListType.DoubleLinked, + HasDeformations = true, + AITypes = new AI_Types_R3_PS2(), + COLTypes = new COL_Types_R2(), + HasMemorySupport = false, + TextureAnimationSpeedModifier = 10f, + Luminosity = 0.1f, + Saturate = false, + LevelTranslation = LevelTranslation.levelTranslation_r3, + PathCapitalization = new Dictionary() { + { PathCapitalizationType.LevelFile, PathCapitalization.None }, + { PathCapitalizationType.Fix, PathCapitalization.None }, + { PathCapitalizationType.TextureFile, PathCapitalization.Normal }, + }, + }; + public static CPA_Settings R3PCDemo20021209 => new CPA_Settings(EngineVersion.Rayman3, Platform.PC) { + StaticListType = LST2_ListType.DoubleLinked, + HasDeformations = true, + AITypes = new AI_Types_R3_PS2(), + COLTypes = new COL_Types_R2(), + HasMemorySupport = false, + TextureAnimationSpeedModifier = 10f, + Luminosity = 0.1f, + Saturate = false, + LevelTranslation = LevelTranslation.levelTranslation_r3, + PathCapitalization = new Dictionary() { + { PathCapitalizationType.LevelFile, PathCapitalization.None }, + { PathCapitalizationType.Fix, PathCapitalization.None }, + { PathCapitalizationType.TextureFile, PathCapitalization.Normal }, + }, + }; + public static CPA_Settings R3PCDemo20030106 => new CPA_Settings(EngineVersion.Rayman3, Platform.PC) { + StaticListType = LST2_ListType.DoubleLinked, + HasDeformations = true, + AITypes = new AI_Types_R3_PS2(), + COLTypes = new COL_Types_R2(), + HasMemorySupport = false, + TextureAnimationSpeedModifier = 10f, + Luminosity = 0.1f, + Saturate = false, + LevelTranslation = LevelTranslation.levelTranslation_r3, + PathCapitalization = new Dictionary() { + { PathCapitalizationType.LevelFile, PathCapitalization.None }, + { PathCapitalizationType.Fix, PathCapitalization.None }, + { PathCapitalizationType.TextureFile, PathCapitalization.Normal }, + }, + }; + public static CPA_Settings R3MacOS => new CPA_Settings(EngineVersion.Rayman3, Platform.MacOS) { + StaticListType = LST2_ListType.DoubleLinked, + HasDeformations = true, + AITypes = new AI_Types_R3_PS2(), + COLTypes = new COL_Types_R2(), + HasMemorySupport = false, + TextureAnimationSpeedModifier = 10f, + Luminosity = 0.1f, + Saturate = false, + LevelTranslation = LevelTranslation.levelTranslation_r3, + PathCapitalization = new Dictionary() { + { PathCapitalizationType.LevelFile, PathCapitalization.None }, + { PathCapitalizationType.Fix, PathCapitalization.None }, + { PathCapitalizationType.TextureFile, PathCapitalization.Normal }, + }, + }; + + public static CPA_Settings R3GC => new CPA_Settings(EngineVersion.Rayman3, Platform.GC) { + StaticListType = LST2_ListType.DoubleLinked, + HasNames = true, + HasDeformations = true, + AITypes = new AI_Types_R3_GC(), + COLTypes = new COL_Types_R2(), + HasExtraInputData = true, + HasLinkedListHeaderPointers = true, + TextureAnimationSpeedModifier = -10f, + Luminosity = 0.1f, + Saturate = false, + LevelTranslation = LevelTranslation.levelTranslation_r3, + PathCapitalization = new Dictionary() { + { PathCapitalizationType.LevelFile, PathCapitalization.None }, + { PathCapitalizationType.Fix, PathCapitalization.None }, + { PathCapitalizationType.TextureFile, PathCapitalization.Normal }, + }, + }; + public static CPA_Settings R3PS2 => new CPA_Settings(EngineVersion.Rayman3, Platform.PS2) { + //StaticListType = LST2_ListType.Optimized, + HasDeformations = true, + AITypes = new AI_Types_R3_PS2(), + COLTypes = new COL_Types_R2(), + HasMemorySupport = false, + TextureAnimationSpeedModifier = 10f, + Luminosity = 0.5f, + Saturate = false, + LevelTranslation = LevelTranslation.levelTranslation_r3, + PathCapitalization = new Dictionary() { + { PathCapitalizationType.All, PathCapitalization.All } + }, + }; + public static CPA_Settings R3PS2Demo_20020517 => new CPA_Settings(EngineVersion.Rayman3, Platform.PS2) { + StaticListType = LST2_ListType.Optimized, + HasDeformations = true, + AITypes = new AI_Types_R3_PS2(), + COLTypes = new COL_Types_R2(), + HasMemorySupport = false, + TextureAnimationSpeedModifier = 10f, + Luminosity = 0.5f, + Saturate = false, + LevelTranslation = LevelTranslation.levelTranslation_r3, + PathCapitalization = new Dictionary() { + { PathCapitalizationType.All, PathCapitalization.All } + }, + HasNames = true + }; + public static CPA_Settings R3PS2Demo_20020807 => new CPA_Settings(EngineVersion.Rayman3, Platform.PS2) { + StaticListType = LST2_ListType.Optimized, + HasDeformations = true, + AITypes = new AI_Types_R3_PS2(), + COLTypes = new COL_Types_R2(), + HasMemorySupport = false, + TextureAnimationSpeedModifier = 10f, + Luminosity = 0.5f, + Saturate = false, + LevelTranslation = LevelTranslation.levelTranslation_r3, + PathCapitalization = new Dictionary() { + { PathCapitalizationType.All, PathCapitalization.All } + }, + }; + public static CPA_Settings R3PS2DevBuild => new CPA_Settings(EngineVersion.Rayman3, Platform.PS2) { + StaticListType = LST2_ListType.Optimized, + HasDeformations = true, + AITypes = new AI_Types_R3_PS2(), + COLTypes = new COL_Types_R2(), + HasMemorySupport = false, + TextureAnimationSpeedModifier = 10f, + Luminosity = 0.5f, + Saturate = false, + LevelTranslation = LevelTranslation.levelTranslation_r3, + PathCapitalization = new Dictionary() { + { PathCapitalizationType.All, PathCapitalization.All } + }, + }; + public static CPA_Settings R3PS2Demo_20021029 => new CPA_Settings(EngineVersion.Rayman3, Platform.PS2) { + StaticListType = LST2_ListType.Optimized, + HasDeformations = true, + AITypes = new AI_Types_R3_PS2(), + COLTypes = new COL_Types_R2(), + HasMemorySupport = false, + TextureAnimationSpeedModifier = 10f, + Luminosity = 0.5f, + Saturate = false, + LevelTranslation = LevelTranslation.levelTranslation_r3, + PathCapitalization = new Dictionary() { + { PathCapitalizationType.All, PathCapitalization.All } + }, + }; + public static CPA_Settings R3PS2Demo_20021218 => new CPA_Settings(EngineVersion.Rayman3, Platform.PS2) { + StaticListType = LST2_ListType.Optimized, + HasDeformations = true, + AITypes = new AI_Types_R3_PS2(), + COLTypes = new COL_Types_R2(), + HasMemorySupport = false, + TextureAnimationSpeedModifier = 10f, + Luminosity = 0.5f, + Saturate = false, + LevelTranslation = LevelTranslation.levelTranslation_r3, + HasNames = true, + PathCapitalization = new Dictionary() { + { PathCapitalizationType.All, PathCapitalization.All } + }, + }; + public static CPA_Settings R3Xbox => new CPA_Settings(EngineVersion.Rayman3, Platform.Xbox) { + StaticListType = LST2_ListType.DoubleLinked, + HasDeformations = true, + AITypes = new AI_Types_R3_PS2(), + COLTypes = new COL_Types_R2(), + HasMemorySupport = true, + TextureAnimationSpeedModifier = 10f, + Luminosity = 0.1f, + Saturate = false, + LevelTranslation = LevelTranslation.levelTranslation_r3, + PathCapitalization = new Dictionary() { + { PathCapitalizationType.LevelFile, PathCapitalization.None }, + { PathCapitalizationType.Fix, PathCapitalization.None }, + { PathCapitalizationType.TextureFile, PathCapitalization.Normal }, + }, + }; + public static CPA_Settings R3Xbox360 => new CPA_Settings(EngineVersion.Rayman3, Platform.Xbox360) { + StaticListType = LST2_ListType.DoubleLinked, + HasDeformations = true, + AITypes = new AI_Types_R3_PS2(), + COLTypes = new COL_Types_R2(), + HasMemorySupport = true, + TextureAnimationSpeedModifier = 10f, + Luminosity = 0.1f, + Saturate = false, + LevelTranslation = LevelTranslation.levelTranslation_r3, + PathCapitalization = new Dictionary() { + { PathCapitalizationType.All, PathCapitalization.None } + }, + HasNames = true, + }; + public static CPA_Settings R3PS3 => new CPA_Settings(EngineVersion.Rayman3, Platform.PS3) { + StaticListType = LST2_ListType.DoubleLinked, + HasDeformations = true, + AITypes = new AI_Types_R3_PS2(), + COLTypes = new COL_Types_R2(), + HasMemorySupport = true, + TextureAnimationSpeedModifier = 10f, + Luminosity = 0.1f, + Saturate = false, + LevelTranslation = LevelTranslation.levelTranslation_r3, + PathCapitalization = new Dictionary() { + { PathCapitalizationType.All, PathCapitalization.None } + }, + HasNames = true, + }; + #endregion + + #region Rayman M + public static CPA_Settings RMPC => new CPA_Settings(EngineVersion.RaymanM, Platform.PC) { + StaticListType = LST2_ListType.DoubleLinked, + AITypes = new AI_Types_R3_PS2(), + COLTypes = new COL_Types_R2(), + HasDeformations = true, + TextureAnimationSpeedModifier = 10f, + Luminosity = 0.3f, + Saturate = false, + LevelTranslation = LevelTranslation.levelTranslation_rarena_pc, + PathCapitalization = new Dictionary() { + { PathCapitalizationType.LevelFile, PathCapitalization.None }, + { PathCapitalizationType.Fix, PathCapitalization.None }, + { PathCapitalizationType.TextureFile, PathCapitalization.Normal }, + }, + }; + public static CPA_Settings RMPS2 => new CPA_Settings(EngineVersion.RaymanM, Platform.PS2) { + StaticListType = LST2_ListType.Optimized, + HasDeformations = true, + AITypes = new AI_Types_R3_PS2(), + COLTypes = new COL_Types_R2(), + TextureAnimationSpeedModifier = 10f, + Luminosity = 0.5f, + Saturate = false, + LevelTranslation = LevelTranslation.levelTranslation_rarena_pc, + HasNames = true, + PathCapitalization = new Dictionary() { + { PathCapitalizationType.All, PathCapitalization.All } + }, + }; + public static CPA_Settings RMPS2Demo => new CPA_Settings(EngineVersion.RaymanM, Platform.PS2) { + StaticListType = LST2_ListType.Optimized, + HasDeformations = true, + AITypes = new AI_Types_R3_PS2(), + COLTypes = new COL_Types_R2(), + TextureAnimationSpeedModifier = 10f, + Luminosity = 0.5f, + Saturate = false, + LevelTranslation = LevelTranslation.levelTranslation_rarena_pc, + HasNames = true, + PathCapitalization = new Dictionary() { + { PathCapitalizationType.All, PathCapitalization.All } + }, + }; + public static CPA_Settings RAPC => new CPA_Settings(EngineVersion.RaymanM, Platform.PC) { + StaticListType = LST2_ListType.DoubleLinked, + AITypes = new AI_Types_R3_PS2(), + COLTypes = new COL_Types_R2(), + HasDeformations = true, + TextureAnimationSpeedModifier = 10f, + Luminosity = 0.3f, + Saturate = false, + LevelTranslation = LevelTranslation.levelTranslation_rarena_pc, + HasMemorySupport = true, + MemoryAddresses = new Dictionary { // Based on non-safedisc version (exe md5 checksum 2e2f94698692bda5c0900440e8a54151) + { "actualWorld", 0x8B97E8 }, + { "dynamicWorld", 0x8B96D8 }, + { "inactiveDynamicWorld", 0x8B96D4 }, + { "fatherSector", 0x8B96D0 }, + { "firstSubmapPosition", 0x890078 }, + { "always", 0x64689C }, + { "anim_stacks", 0x8918A0 }, + { "anim_framesKF", 0x890A00 }, + { "anim_a3d", 0x891700 }, + { "anim_channels", 0x890D40 }, + { "anim_framesNumOfNTTO", 0x890BA0 }, + { "anim_hierarchies", 0x891220 }, + { "anim_morphData", 0x890520 }, + { "anim_keyframes", 0x890860 }, + { "anim_onlyFrames", 0x890ee0 }, + { "anim_vectors", 0x891560 }, + { "anim_events", 0x8906c0 }, + { "anim_NTTO", 0x891080 }, + { "anim_quaternions", 0x8913c0 }, + { "anim_deformations", 0x890380 }, + { "families", 0x8B898C }, + { "objectTypes", 0x8B9800 }, + { "textures", 0x881B80 }, + { "textureMemoryChannels", 0x880B80 }, + { "inputStructure", 0x831100 }, + { "localizationStructure", 0x897E40 }, + { "num_visualMaterials", 0x6464E0 }, + { "visualMaterials", 0x5DB05C }, + { "brightness", 0x60050C }, + }, + PathCapitalization = new Dictionary() { + { PathCapitalizationType.LevelFile, PathCapitalization.None }, + { PathCapitalizationType.Fix, PathCapitalization.None }, + { PathCapitalizationType.TextureFile, PathCapitalization.Normal }, + }, + }; + public static CPA_Settings RAPS2 => new CPA_Settings(EngineVersion.RaymanM, Platform.PS2) { + StaticListType = LST2_ListType.Optimized, + HasDeformations = true, + AITypes = new AI_Types_R3_PS2(), + COLTypes = new COL_Types_R2(), + TextureAnimationSpeedModifier = 10f, + Luminosity = 0.5f, + Saturate = false, + LevelTranslation = LevelTranslation.levelTranslation_rarena_pc, + HasNames = true, + PathCapitalization = new Dictionary() { + { PathCapitalizationType.All, PathCapitalization.All } + }, + }; + public static CPA_Settings RAGC => new CPA_Settings(EngineVersion.RaymanArena, Platform.GC) { + StaticListType = LST2_ListType.Optimized, + AITypes = new AI_Types_R3_PS2(), + COLTypes = new COL_Types_R2(), + HasDeformations = true, + TextureAnimationSpeedModifier = -10f, + Luminosity = 0.1f, + Saturate = false, + LevelTranslation = LevelTranslation.levelTranslation_rarena_xboxgc, + PathCapitalization = new Dictionary() { + { PathCapitalizationType.LevelFile, PathCapitalization.None }, + { PathCapitalizationType.Fix, PathCapitalization.None }, + { PathCapitalizationType.TextureFile, PathCapitalization.Normal }, + }, + }; + public static CPA_Settings RAGCDemo => new CPA_Settings(EngineVersion.RaymanArena, Platform.GC) { + StaticListType = LST2_ListType.Optimized, + AITypes = new AI_Types_R3_PS2(), + COLTypes = new COL_Types_R2(), + HasDeformations = true, + TextureAnimationSpeedModifier = -10f, + Luminosity = 0.1f, + Saturate = false, + LevelTranslation = LevelTranslation.levelTranslation_rarena_xboxgc, + PathCapitalization = new Dictionary() { + { PathCapitalizationType.LevelFile, PathCapitalization.None }, + { PathCapitalizationType.Fix, PathCapitalization.None }, + { PathCapitalizationType.TextureFile, PathCapitalization.Normal }, + }, + }; + public static CPA_Settings RAXbox => new CPA_Settings(EngineVersion.RaymanArena, Platform.Xbox) { + StaticListType = LST2_ListType.DoubleLinked, + AITypes = new AI_Types_R3_PS2(), + COLTypes = new COL_Types_R2(), + HasDeformations = true, + TextureAnimationSpeedModifier = 10f, + Luminosity = 0.1f, + Saturate = false, + LevelTranslation = LevelTranslation.levelTranslation_rarena_xboxgc, + PathCapitalization = new Dictionary() { + { PathCapitalizationType.LevelFile, PathCapitalization.None }, + { PathCapitalizationType.Fix, PathCapitalization.None }, + { PathCapitalizationType.TextureFile, PathCapitalization.Normal }, + }, + }; + + public static CPA_Settings RRushPS1 => new CPA_Settings(EngineVersion.RaymanRush_PS1, Platform.PS1) { + StaticListType = LST2_ListType.Optimized, + Encryption = Encryption.ReadInit, + Luminosity = 0.5f, + Saturate = true, + AITypes = new AI_Types_R2_PC(), + COLTypes = new COL_Types_R2(), + EntryActionsCount = 1 + }; + #endregion + + #region Rayman 2 + public static CPA_Settings R2PC => new CPA_Settings(EngineVersion.Rayman2, Platform.PC) { + EntryActionsCount = 43, + StaticListType = LST2_ListType.DoubleLinked, + AITypes = new AI_Types_R2_PC(), + COLTypes = new COL_Types_R2(), + SNATypes = new SNA_Types_R2(), + Encryption = Encryption.ReadInit, + Luminosity = 0.5f, + Saturate = true, + HasMemorySupport = true, + LevelTranslation = LevelTranslation.levelTranslation_r2, + LinkUncategorizedObjectsToScriptFamily = true, + MemoryAddresses = new Dictionary { + { "actualWorld", 0x005013C8 }, + { "dynamicWorld", 0x00500FD0 }, + { "inactiveDynamicWorld", 0x00500FC4 }, + { "fatherSector", 0x00500FC0 }, + { "firstSubmapPosition", 0x004FF760 }, + { "always", 0x004A6B18 }, + { "anim_stacks", 0x004A6B38 }, + { "anim_framesKF", 0x00500274 }, + { "anim_a3d", 0x00500278 }, + { "anim_channels", 0x0050027C }, + { "anim_framesNumOfNTTO", 0x00500280 }, + { "anim_hierarchies", 0x00500284 }, + { "anim_morphData", 0x00500288 }, + { "anim_keyframes", 0x0050028C }, + { "anim_onlyFrames", 0x00500290 }, + { "anim_vectors", 0x00500294 }, + { "anim_events", 0x00500298 }, + { "anim_NTTO", 0x0050029C }, + { "anim_quaternions", 0x005002A0 }, + { "engineStructure", 0x00500380 }, + { "families", 0x00500560 }, + { "objectTypes", 0x005013E0 }, + { "textures", 0x00502680 }, + { "textureMemoryChannels", 0x00501660 }, + { "inputStructure", 0x00509E60 }, + { "localizationStructure", 0x00500260 } + } + }; + public static CPA_Settings R2PCDemo1 => new CPA_Settings(EngineVersion.Rayman2Demo, Platform.PC) { + StaticListType = LST2_ListType.DoubleLinked, + Encryption = Encryption.ReadInit, + Luminosity = 0.5f, + Saturate = true, + AITypes = new AI_Types_R2_PC_Demo1(), + COLTypes = new COL_Types_R2(), + SNATypes = new SNA_Types_R2_Demo(), + EntryActionsCount = 1, + PathCapitalization = new Dictionary() { + { PathCapitalizationType.FixRelocation, PathCapitalization.AllExceptExtension }, + { PathCapitalizationType.LevelRelocation, PathCapitalization.AllExceptExtension }, + } + }; + public static CPA_Settings R2PCDemo2 => new CPA_Settings(EngineVersion.Rayman2Demo, Platform.PC) { + EntryActionsCount = 7, + StaticListType = LST2_ListType.DoubleLinked, + AITypes = new AI_Types_R2_PC(), + COLTypes = new COL_Types_R2(), + SNATypes = new SNA_Types_R2_Demo(), + Encryption = Encryption.ReadInit, + Luminosity = 0.5f, + Saturate = true, + PathCapitalization = new Dictionary() { + { PathCapitalizationType.FixRelocation, PathCapitalization.AllExceptExtension }, + { PathCapitalizationType.LevelRelocation, PathCapitalization.AllExceptExtension }, + } + }; + public static CPA_Settings R2DC => new CPA_Settings(EngineVersion.Rayman2, Platform.DC) { + EntryActionsCount = 43, + StaticListType = LST2_ListType.Optimized, + Encryption = Encryption.None, + Luminosity = 0.5f, + Saturate = true, + AITypes = new AI_Types_R2_PC(), + COLTypes = new COL_Types_R2(), + HasExtraInputData = false, + LevelTranslation = LevelTranslation.levelTranslation_r2, + PathCapitalization = new Dictionary() { + { PathCapitalizationType.All, PathCapitalization.All } + } + }; + public static CPA_Settings R2PS2 => new CPA_Settings(EngineVersion.Rayman2Revolution, Platform.PS2) { + EntryActionsCount = 42, + StaticListType = LST2_ListType.Optimized, + Encryption = Encryption.None, + Luminosity = 0.5f, + Saturate = false, + AITypes = new AI_Types_R2_PS2(), + COLTypes = new COL_Types_R2(), + //textureAnimationSpeedModifier = 2f, + HasExtraInputData = false, + HasObjectTypes = false, + PathCapitalization = new Dictionary() { + { PathCapitalizationType.All, PathCapitalization.None } + } + }; + public static CPA_Settings R2IOS => new CPA_Settings(EngineVersion.Rayman2, Platform.iOS) { + EntryActionsCount = 43, + StaticListType = LST2_ListType.DoubleLinked, + Encryption = Encryption.ReadInit, + AITypes = new AI_Types_R2_PC(), + COLTypes = new COL_Types_R2(), + SNATypes = new SNA_Types_R2(), + HasExtraInputData = true, + LevelTranslation = LevelTranslation.levelTranslation_r2, + Luminosity = 0.5f, + Saturate = true, + PathCapitalization = new Dictionary() { + { PathCapitalizationType.All, PathCapitalization.All } + } + }; + public static CPA_Settings R2PS1 => new CPA_Settings(EngineVersion.Rayman2_PS1, Platform.PS1) { + StaticListType = LST2_ListType.Optimized, + Encryption = Encryption.ReadInit, + Luminosity = 0.5f, + Saturate = true, + AITypes = new AI_Types_R2_PC(), + COLTypes = new COL_Types_R2(), + EntryActionsCount = 1, + }; + + public static CPA_Settings R2DS => new CPA_Settings(EngineVersion.Rayman2, Platform.DS) { + StaticListType = LST2_ListType.DoubleLinked, + Encryption = Encryption.ReadInit, + Luminosity = 0.5f, + Saturate = true, + AITypes = new AI_Types_R2_DS_EU(), + COLTypes = new COL_Types_R2(), + EntryActionsCount = 1, + TextureAnimationSpeedModifier = -1f, + }; + public static CPA_Settings R23DS => new CPA_Settings(EngineVersion.Rayman2_3D, Platform._3DS) { + StaticListType = LST2_ListType.DoubleLinked, + Encryption = Encryption.ReadInit, + Luminosity = 0.5f, + Saturate = true, + AITypes = new AI_Types_R2_DS_EU(), + COLTypes = new COL_Types_R2(), + EntryActionsCount = 1, + TextureAnimationSpeedModifier = -1f, + }; + public static CPA_Settings R2N64 => new CPA_Settings(EngineVersion.Rayman2, Platform.N64) { + StaticListType = LST2_ListType.DoubleLinked, + Encryption = Encryption.ReadInit, + Luminosity = 0.5f, + Saturate = true, + AITypes = new AI_Types_R2_DS_EU(), + COLTypes = new COL_Types_R2(), + LevelTranslation = LevelTranslation.levelTranslation_r2, + EntryActionsCount = 1 + }; + #endregion + + #region Rayman Raving Rabbids DS + public static CPA_Settings RRRDS_20060525 => new CPA_Settings(EngineVersion.Rayman4DS_20060525, Platform.DS) { + StaticListType = LST2_ListType.DoubleLinked, + Encryption = Encryption.ReadInit, + Luminosity = 0.5f, + Saturate = true, + AITypes = new AI_Types_R2_DS_EU(), + COLTypes = new COL_Types_R2(), + EntryActionsCount = 1, + TextureAnimationSpeedModifier = -1f, + }; + public static CPA_Settings RRRDS => new CPA_Settings(EngineVersion.RaymanRavingRabbids, Platform.DS) { + StaticListType = LST2_ListType.DoubleLinked, + Encryption = Encryption.ReadInit, + Luminosity = 0.5f, + Saturate = true, + AITypes = new AI_Types_R2_DS_EU(), + COLTypes = new COL_Types_R2(), + EntryActionsCount = 1, + TextureAnimationSpeedModifier = -1f, + }; + #endregion + + #region Tonic Trouble + public static CPA_Settings TTPC => new CPA_Settings(EngineVersion.TonicTrouble, Platform.PC) { + StaticListType = LST2_ListType.DoubleLinked, + EntryActionsCount = 1, + AITypes = new AI_Types_TTSE(), + COLTypes = new COL_Types_R2(), + SNATypes = new SNA_Types_TT(), + Encryption = Encryption.Window, + EncryptPointerFiles = true, + HasLinkedListHeaderPointers = true, + Luminosity = 1f, + Saturate = true, + PathCapitalization = new Dictionary() { + { PathCapitalizationType.Fix, PathCapitalization.None }, + { PathCapitalizationType.FixRelocation, PathCapitalization.None }, + { PathCapitalizationType.DSB, PathCapitalization.None } + } + }; + public static CPA_Settings TTN64 = new CPA_Settings(EngineVersion.TonicTrouble, Platform.N64) { + StaticListType = LST2_ListType.DoubleLinked, + Encryption = Encryption.ReadInit, + Luminosity = 0.5f, + Saturate = true, + AITypes = new AI_Types_R2_DS_EU(), + COLTypes = new COL_Types_R2(), + EntryActionsCount = 1 + }; + public static CPA_Settings TTSEPC => new CPA_Settings(EngineVersion.TonicTroubleSE, Platform.PC) { + StaticListType = LST2_ListType.DoubleLinked, + EntryActionsCount = 1, + AITypes = new AI_Types_TTSE(), + COLTypes = new COL_Types_R2(), + HasLinkedListHeaderPointers = true, + Luminosity = 0.5f, + Saturate = true, + PathCapitalization = new Dictionary() { + { PathCapitalizationType.All, PathCapitalization.All } + } + }; + #endregion + + #region Montreal: Playmobil + public static CPA_Settings PlaymobilHypePC => new CPA_Settings(EngineVersion.PlaymobilHype, Platform.PC) { + StaticListType = LST2_ListType.DoubleLinked, + EntryActionsCount = 1, + AITypes = new AI_Types_Hype_PS2(), + COLTypes = new COL_Types_R2(), + SNATypes = new SNA_Types_Montreal(), + HasLinkedListHeaderPointers = true, + SNA_Compression = true, + Luminosity = 0.5f, + Saturate = true, + PathCapitalization = new Dictionary() { + { PathCapitalizationType.FixLvl, PathCapitalization.None } + } + }; + public static CPA_Settings PlaymobilAlexPC => new CPA_Settings(EngineVersion.PlaymobilAlex, Platform.PC) { + StaticListType = LST2_ListType.DoubleLinked, + EntryActionsCount = 1, + AITypes = new AI_Types_Hype_PS2(), + COLTypes = new COL_Types_R2(), + SNATypes = new SNA_Types_Montreal(), + HasLinkedListHeaderPointers = true, + SNA_Compression = true, + Luminosity = 0.5f, + Saturate = true, + PathCapitalization = new Dictionary() { + { PathCapitalizationType.LevelFile, PathCapitalization.None }, + { PathCapitalizationType.LevelRelocation, PathCapitalization.None }, + { PathCapitalizationType.FixRelocation, PathCapitalization.None }, + { PathCapitalizationType.LangFix, PathCapitalization.None }, + { PathCapitalizationType.LangLevelFile, PathCapitalization.None }, + { PathCapitalizationType.LangLevelRelocation, PathCapitalization.None }, + { PathCapitalizationType.LangLevelFolder, PathCapitalization.None } + } + }; + public static CPA_Settings PlaymobilLauraPC => new CPA_Settings(EngineVersion.PlaymobilLaura, Platform.PC) { + StaticListType = LST2_ListType.DoubleLinked, + EntryActionsCount = 1, + AITypes = new AI_Types_Hype_PS2(), + COLTypes = new COL_Types_R2(), + SNATypes = new SNA_Types_Montreal(), + HasLinkedListHeaderPointers = true, + SNA_Compression = false, + Luminosity = 0.5f, + Saturate = true, + PathCapitalization = new Dictionary() { + { PathCapitalizationType.LevelFile, PathCapitalization.None }, + { PathCapitalizationType.LevelRelocation, PathCapitalization.None }, + { PathCapitalizationType.FixRelocation, PathCapitalization.None }, + { PathCapitalizationType.LangFix, PathCapitalization.None }, + { PathCapitalizationType.LangLevelFile, PathCapitalization.None }, + { PathCapitalizationType.LangLevelRelocation, PathCapitalization.None }, + { PathCapitalizationType.LangLevelFolder, PathCapitalization.None } + } + }; + #endregion + + #region Donald Duck Quack Attack + public static CPA_Settings DDPC => new CPA_Settings(EngineVersion.DonaldDuckQuackAttack, Platform.PC) { + EntryActionsCount = 44, // 43 for demo + StaticListType = LST2_ListType.DoubleLinked, + AITypes = new AI_Types_R2_PC(), + COLTypes = new COL_Types_R2(), + SNATypes = new SNA_Types_R2(), + Encryption = Encryption.ReadInit, + Luminosity = 0.5f, + Saturate = true, + PathCapitalization = new Dictionary() { + { PathCapitalizationType.FixRelocation, PathCapitalization.AllExceptExtension } + }, + HasMemorySupport = true, + MemoryAddresses = new Dictionary { + { "actualWorld", 0x5AF2E8 }, + { "dynamicWorld", 0x5AEEF0 }, + { "inactiveDynamicWorld", 0x5AEEE4 }, + { "fatherSector", 0x5AEEE0 }, + { "firstSubmapPosition", 0x5ACE40 }, + { "always", 0x4A8EC8 }, + { "anim_stacks", 0x4A8EF0 }, + { "anim_framesKF", 0x5AD954 }, + { "anim_a3d", 0x5AD958 }, + { "anim_channels", 0x5AD95C }, + { "anim_framesNumOfNTTO", 0x5AD960 }, + { "anim_hierarchies", 0x5AD964 }, + { "anim_morphData", 0x5AD968 }, + { "anim_keyframes", 0x5AD96c }, + { "anim_onlyFrames", 0x5AD970 }, + { "anim_vectors", 0x5AD974 }, + { "anim_events", 0x5AD978 }, + { "anim_NTTO", 0x5AD97C }, + { "anim_quaternions", 0x5AD980 }, + { "engineStructure", 0x5AE2A0 }, + { "families", 0x5AE480 }, + { "objectTypes", 0x5AF300 }, + { "textures", 0x5B05A0 }, + { "textureMemoryChannels", 0x5AF580 }, + { "inputStructure", 0x5B7DA0 }, + { "localizationStructure", 0x5AD940 } + } + }; + + public static CPA_Settings DDPCDemo = new CPA_Settings(EngineVersion.DonaldDuckQuackAttack, Platform.PC) { + EntryActionsCount = 43, + StaticListType = LST2_ListType.DoubleLinked, + AITypes = new AI_Types_R2_PC(), + COLTypes = new COL_Types_R2(), + SNATypes = new SNA_Types_R2(), + Encryption = Encryption.ReadInit, + Luminosity = 0.5f, + Saturate = true, + PathCapitalization = new Dictionary() { + { PathCapitalizationType.FixRelocation, PathCapitalization.AllExceptExtension } + }, + }; + + public static CPA_Settings DDDC => new CPA_Settings(EngineVersion.DonaldDuckQuackAttack, Platform.DC) { + EntryActionsCount = 43, + StaticListType = LST2_ListType.Optimized, + Encryption = Encryption.None, + Luminosity = 0.5f, + Saturate = true, + AITypes = new AI_Types_R2_PC(), + COLTypes = new COL_Types_R2(), + HasExtraInputData = false, + PathCapitalization = new Dictionary() { + { PathCapitalizationType.All, PathCapitalization.All } + } + }; + public static CPA_Settings DDN64 => new CPA_Settings(EngineVersion.DonaldDuckQuackAttack, Platform.N64) { + StaticListType = LST2_ListType.DoubleLinked, + Encryption = Encryption.ReadInit, + Luminosity = 0.5f, + Saturate = true, + AITypes = new AI_Types_R2_DS_EU(), + COLTypes = new COL_Types_R2(), + EntryActionsCount = 1 + }; + public static CPA_Settings DDPS1 => new CPA_Settings(EngineVersion.DonaldDuckQuackAttack_PS1, Platform.PS1) { + StaticListType = LST2_ListType.Optimized, + Encryption = Encryption.ReadInit, + Luminosity = 0.5f, + Saturate = true, + AITypes = new AI_Types_R2_PC(), + COLTypes = new COL_Types_R2(), + EntryActionsCount = 1 + }; + #endregion + + #region Other Disney + public static CPA_Settings DDPKGC => new CPA_Settings(EngineVersion.DonaldDuckPK, Platform.GC) { + StaticListType = LST2_ListType.Optimized, + HasDeformations = true, + AITypes = new AI_Types_R3_PS2(), + COLTypes = new COL_Types_R2(), + TextureAnimationSpeedModifier = -10f, + Luminosity = 0.1f, + Saturate = false, + PathCapitalization = new Dictionary() { + { PathCapitalizationType.LevelFile, PathCapitalization.None }, + { PathCapitalizationType.Fix, PathCapitalization.None }, + { PathCapitalizationType.TextureFile, PathCapitalization.Normal }, + }, + }; + + public static CPA_Settings DinosaurPC => new CPA_Settings(EngineVersion.Dinosaur, Platform.PC) { + StaticListType = LST2_ListType.DoubleLinked, + AITypes = new AI_Types_R3_PS2(), + COLTypes = new COL_Types_R2(), + HasDeformations = true, + TextureAnimationSpeedModifier = 1f, + Luminosity = 0.3f, + Saturate = false, + PathCapitalization = new Dictionary() { + { PathCapitalizationType.All, PathCapitalization.All } + }, + }; + public static CPA_Settings JungleBookPS1 => new CPA_Settings(EngineVersion.JungleBook_PS1, Platform.PS1) { + StaticListType = LST2_ListType.Optimized, + Encryption = Encryption.ReadInit, + Luminosity = 0.5f, + Saturate = true, + AITypes = new AI_Types_R2_PC(), + COLTypes = new COL_Types_R2(), + HasDeformations = true, + EntryActionsCount = 1 + }; + #endregion + + #region Other licensed + public static CPA_Settings LargoWinchPC => new CPA_Settings(EngineVersion.LargoWinch, Platform.PC) { + StaticListType = LST2_ListType.DoubleLinked, + AITypes = new AI_Types_LargoWinch_PC(), + COLTypes = new COL_Types_R2(), + TextureAnimationSpeedModifier = 1f, + Luminosity = 0.5f, + Saturate = false, + HasExtraInputData = true, + HasObjectTypes = false, + PathCapitalization = new Dictionary() { + { PathCapitalizationType.LevelFolder, PathCapitalization.Normal }, + { PathCapitalizationType.LMFile, PathCapitalization.Normal }, + { PathCapitalizationType.LevelFile, PathCapitalization.None }, + }, + HasDeformations = true + }; + public static CPA_Settings VIPPS1 => new CPA_Settings(EngineVersion.VIP_PS1, Platform.PS1) { + StaticListType = LST2_ListType.Optimized, + Encryption = Encryption.ReadInit, + Luminosity = 0.5f, + Saturate = true, + AITypes = new AI_Types_R2_PC(), + COLTypes = new COL_Types_R2(), + HasDeformations = true, + EntryActionsCount = 1 + }; + #endregion + + #region Other + public static CPA_Settings RedPlanetPC => new CPA_Settings(EngineVersion.RedPlanet, Platform.PC) { + EntryActionsCount = 31, + StaticListType = LST2_ListType.DoubleLinked, + AITypes = new AI_Types_R2_PC(), + SNATypes = new SNA_Types_R2_Demo(), + Encryption = Encryption.RedPlanet, + Luminosity = 0.5f, + Saturate = true, + HasMemorySupport = false, + HasExtraInputData = true, + LinkUncategorizedObjectsToScriptFamily = true, + PathCapitalization = new Dictionary() { + { PathCapitalizationType.FixRelocation, PathCapitalization.AllExceptExtension }, + { PathCapitalizationType.LevelRelocation, PathCapitalization.AllExceptExtension }, + } + }; + #endregion + + public static CPA_Settings GetSettings(CPA_GameMode mode) { + CPA_Settings settings = mode switch { + CPA_GameMode.Rayman2PC => R2PC, + CPA_GameMode.Rayman2PCDemo_1999_08_18 => R2PCDemo1, + CPA_GameMode.Rayman2PCDemo_1999_09_04 => R2PCDemo2, + CPA_GameMode.Rayman2DC => R2DC, + CPA_GameMode.Rayman2IOS => R2IOS, + CPA_GameMode.Rayman2IOSDemo => R2IOS, + CPA_GameMode.Rayman2PS1 => R2PS1, + CPA_GameMode.Rayman2PS1Demo => R2PS1, + CPA_GameMode.Rayman2PS1Demo_SLUS_90095 => R2PS1, + CPA_GameMode.Rayman2PS2 => R2PS2, + CPA_GameMode.Rayman2N64 => R2N64, + CPA_GameMode.TonicTroubleN64 => TTN64, + CPA_GameMode.Rayman2DS => R2DS, + CPA_GameMode.Rayman23DS => R23DS, + CPA_GameMode.RaymanMPC => RMPC, + CPA_GameMode.RaymanMPS2 => RMPS2, + CPA_GameMode.RaymanMPS2Demo_2001_07_25 => RMPS2Demo, + CPA_GameMode.RaymanArenaPC => RAPC, + CPA_GameMode.RaymanArenaPS2 => RAPS2, + CPA_GameMode.RaymanArenaGC => RAGC, + CPA_GameMode.RaymanArenaGCDemo_2002_03_07 => RAGCDemo, + CPA_GameMode.RaymanArenaXbox => RAXbox, + CPA_GameMode.RaymanRushPS1 => RRushPS1, + CPA_GameMode.Rayman3PC => R3PC, + CPA_GameMode.Rayman3PCDemo_2002_10_01 => R3PCDemo20021001, + CPA_GameMode.Rayman3PCDemo_2002_10_21 => R3PCDemo20021021, + CPA_GameMode.Rayman3PCDemo_2002_12_09 => R3PCDemo20021209, + CPA_GameMode.Rayman3PCDemo_2003_01_06 => R3PCDemo20030106, + CPA_GameMode.Rayman3MacOS => R3MacOS, + CPA_GameMode.Rayman3GC => R3GC, + CPA_GameMode.Rayman3PS2 => R3PS2, + CPA_GameMode.Rayman3PS2Demo_2002_05_17 => R3PS2Demo_20020517, + CPA_GameMode.Rayman3PS2Demo_2002_08_07 => R3PS2Demo_20020807, + CPA_GameMode.Rayman3PS2DevBuild_2002_09_06 => R3PS2DevBuild, + CPA_GameMode.Rayman3PS2Demo_2002_10_29 => R3PS2Demo_20021029, + CPA_GameMode.Rayman3PS2Demo_2002_12_18 => R3PS2Demo_20021218, + CPA_GameMode.Rayman3Xbox => R3Xbox, + CPA_GameMode.Rayman3Xbox360 => R3Xbox360, + CPA_GameMode.Rayman3PS3 => R3PS3, + CPA_GameMode.RaymanRavingRabbidsDS => RRRDS, + CPA_GameMode.RaymanRavingRabbidsDSDevBuild_2006_05_25 => RRRDS_20060525, + CPA_GameMode.TonicTroublePC => TTPC, + CPA_GameMode.TonicTroubleSEPC => TTSEPC, + CPA_GameMode.DonaldDuckPC => DDPC, + CPA_GameMode.DonaldDuckPCDemo => DDPCDemo, + CPA_GameMode.DonaldDuckDC => DDDC, + CPA_GameMode.DonaldDuckN64 => DDN64, + CPA_GameMode.DonaldDuckPS1 => DDPS1, + CPA_GameMode.DonaldDuckPKGC => DDPKGC, + CPA_GameMode.PlaymobilHypePC => PlaymobilHypePC, + CPA_GameMode.PlaymobilLauraPC => PlaymobilLauraPC, + CPA_GameMode.PlaymobilAlexPC => PlaymobilAlexPC, + CPA_GameMode.DinosaurPC => DinosaurPC, + CPA_GameMode.LargoWinchPC => LargoWinchPC, + CPA_GameMode.VIPPS1 => VIPPS1, + CPA_GameMode.JungleBookPS1 => JungleBookPS1, + CPA_GameMode.RedPlanetPC => RedPlanetPC, + + _ => throw new Exception($"CPA_GameMode value {mode} is not a valid CPA mode") + }; + settings.Mode = mode; + settings.Init(); + return settings; + } + } +} diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/Settings/CPA_Settings_Defines.cs.meta b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/Settings/CPA_Settings_Defines.cs.meta new file mode 100644 index 00000000..84bf70da --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/Settings/CPA_Settings_Defines.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: f40ba24b4b4d34540a85383b5d4a58bd +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/Settings/Caps.meta b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/Settings/Caps.meta new file mode 100644 index 00000000..7e9c0fd7 --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/Settings/Caps.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: da713daad8fc45442b0210bac450c8b4 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/Settings/EngineVersionTree.cs b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/Settings/EngineVersionTree.cs new file mode 100644 index 00000000..f9ecb676 --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/Settings/EngineVersionTree.cs @@ -0,0 +1,64 @@ +using BinarySerializer; + +namespace BinarySerializer.Ubisoft.CPA { + public class EngineVersionTree : VersionTree { + public static EngineVersionTree Create(CPA_Settings settings) { + EngineVersionTree tree = new EngineVersionTree() { + Root = new Node(EngineVersion.CPA).SetChildren( + new Node(EngineVersion.CPA_1).SetChildren( + new Node(EngineVersion.TonicTroubleSE).SetChildren( + new Node(EngineVersion.TonicTrouble).SetChildren( + new Node(EngineVersion.CPA_2).SetChildren( + new Node(EngineVersion.Rayman2Demo).SetChildren( + new Node(EngineVersion.RedPlanet), + new Node(EngineVersion.Rayman2).SetChildren( + new Node(EngineVersion.Rayman2Revolution), + new Node(EngineVersion.DonaldDuckQuackAttack), + new Node(EngineVersion.Rayman4DS).SetChildren( + new Node(EngineVersion.Rayman4DS_20060525).SetChildren( + new Node(EngineVersion.RaymanRavingRabbids).SetChildren( + new Node(EngineVersion.Rayman2_3D) + ) + ) + ), + new Node(EngineVersion.CPA_3).SetChildren( + new Node(EngineVersion.Dinosaur).SetChildren( + new Node(EngineVersion.RaymanM).SetChildren( + new Node(EngineVersion.RaymanArena), + new Node(EngineVersion.Rayman3).SetChildren( + new Node(EngineVersion.DonaldDuckPK) + ) + ), + new Node(EngineVersion.LargoWinch) + ) + ) + ) + ) + ), + new Node(EngineVersion.CPA_PS1).SetChildren( + new Node(EngineVersion.Rayman2_PS1).SetChildren( + new Node(EngineVersion.VIP_PS1), + new Node(EngineVersion.RaymanRush_PS1), + new Node(EngineVersion.DonaldDuckQuackAttack_PS1), + new Node(EngineVersion.JungleBook_PS1) + ) + ) + ) + ) + ), + new Node(EngineVersion.CPA_Montreal).SetChildren( + new Node(EngineVersion.PlaymobilLaura).SetChildren( + new Node(EngineVersion.PlaymobilHype).SetChildren( + new Node(EngineVersion.PlaymobilAlex) + ) + ) + ) + ) + }; + tree.Init(); + tree.Current = tree.FindVersion(settings.EngineVersion); + + return tree; + } + } +} \ No newline at end of file diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/Settings/EngineVersionTree.cs.meta b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/Settings/EngineVersionTree.cs.meta new file mode 100644 index 00000000..b793ea53 --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/Settings/EngineVersionTree.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: fe8173d832e02ad4590e58a86c1aad14 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/Settings/Enums.meta b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/Settings/Enums.meta new file mode 100644 index 00000000..ad77e79b --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/Settings/Enums.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: c89984775267d104c9114391455e54d8 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/Settings/Enums/Encryption.meta b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/Settings/Enums/Encryption.meta new file mode 100644 index 00000000..c90d6346 --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/Settings/Enums/Encryption.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 2862de25d1790504d85429a6ac9e3d4f +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/Settings/Enums/Encryption/Encryption.cs b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/Settings/Enums/Encryption/Encryption.cs new file mode 100644 index 00000000..61fe8c37 --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/Settings/Enums/Encryption/Encryption.cs @@ -0,0 +1,10 @@ +namespace BinarySerializer.Ubisoft.CPA { + public enum Encryption { + None, + ReadInit, + FixedInit, + CalculateInit, + Window, + RedPlanet + }; +} diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/Settings/Enums/Encryption/Encryption.cs.meta b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/Settings/Enums/Encryption/Encryption.cs.meta new file mode 100644 index 00000000..38e9d512 --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/Settings/Enums/Encryption/Encryption.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 697360d0dce339149bdffb1c58b97ca5 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/Settings/Enums/Main.meta b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/Settings/Enums/Main.meta new file mode 100644 index 00000000..10922854 --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/Settings/Enums/Main.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: ed570bc3edb81f644b1e959ac7713f1b +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/Settings/Enums/Main/CPA_GameMode.cs b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/Settings/Enums/Main/CPA_GameMode.cs new file mode 100644 index 00000000..0e62d2d4 --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/Settings/Enums/Main/CPA_GameMode.cs @@ -0,0 +1,68 @@ +namespace BinarySerializer.Ubisoft.CPA { + public enum CPA_GameMode { + Rayman2PC, + Rayman2PCDemo_1999_08_18, + Rayman2PCDemo_1999_09_04, + Rayman2DC, + Rayman2IOS, + Rayman2IOSDemo, + Rayman2PS1, + Rayman2PS1Demo, + Rayman2PS1Demo_SLUS_90095, + Rayman2PS2, + Rayman2N64, + Rayman2DS, + Rayman23DS, + + RaymanMPC, + RaymanMPS2, + RaymanMPS2Demo_2001_07_25, + RaymanArenaPC, + RaymanArenaPS2, + RaymanArenaGC, + RaymanArenaGCDemo_2002_03_07, + RaymanArenaXbox, + RaymanRushPS1, + + Rayman3PC, + Rayman3PCDemo_2002_10_01, + Rayman3PCDemo_2002_10_21, + Rayman3PCDemo_2002_12_09, + Rayman3PCDemo_2003_01_06, + Rayman3MacOS, + Rayman3GC, + Rayman3PS2, + Rayman3PS2Demo_2002_05_17, + Rayman3PS2Demo_2002_08_07, + Rayman3PS2DevBuild_2002_09_06, + Rayman3PS2Demo_2002_10_29, + Rayman3PS2Demo_2002_12_18, + Rayman3Xbox, + Rayman3Xbox360, + Rayman3PS3, + + RaymanRavingRabbidsDS, + RaymanRavingRabbidsDSDevBuild_2006_05_25, + + TonicTroublePC, + TonicTroubleSEPC, + TonicTroubleN64, + + DonaldDuckPC, + DonaldDuckPCDemo, + DonaldDuckDC, + DonaldDuckN64, + DonaldDuckPS1, + DonaldDuckPKGC, + DinosaurPC, + LargoWinchPC, + JungleBookPS1, + + PlaymobilHypePC, + PlaymobilLauraPC, + PlaymobilAlexPC, + + VIPPS1, + RedPlanetPC, + }; +} diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/Settings/Enums/Main/CPA_GameMode.cs.meta b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/Settings/Enums/Main/CPA_GameMode.cs.meta new file mode 100644 index 00000000..4f2b496c --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/Settings/Enums/Main/CPA_GameMode.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: ebb5f6559d14da74280dce866f1614e2 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/Settings/Enums/Main/EngineFlags.cs b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/Settings/Enums/Main/EngineFlags.cs new file mode 100644 index 00000000..0d8af028 --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/Settings/Enums/Main/EngineFlags.cs @@ -0,0 +1,9 @@ +using System; + +namespace BinarySerializer.Ubisoft.CPA { + [Flags] + public enum EngineFlags { + None = 0, + U64 = 1 << 0, + } +} \ No newline at end of file diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/Settings/Enums/Main/EngineFlags.cs.meta b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/Settings/Enums/Main/EngineFlags.cs.meta new file mode 100644 index 00000000..7d1dd7af --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/Settings/Enums/Main/EngineFlags.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: e7e3a600aaa3be746aa4572327e7a63e +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/Settings/Enums/Main/EngineVersion.cs b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/Settings/Enums/Main/EngineVersion.cs new file mode 100644 index 00000000..d0a33d27 --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/Settings/Enums/Main/EngineVersion.cs @@ -0,0 +1,44 @@ +namespace BinarySerializer.Ubisoft.CPA { + public enum EngineVersion + { + CPA, + + CPA_1, + TonicTrouble, + TonicTroubleSE, + + CPA_2, + Rayman2, + Rayman2Demo, + Rayman2Revolution, + Rayman4DS, + Rayman4DS_20060525, + RaymanRavingRabbids, + Rayman2_3D, + DonaldDuckQuackAttack, + RedPlanet, + + CPA_PS1, + Rayman2_PS1, + DonaldDuckQuackAttack_PS1, + RaymanRush_PS1, + VIP_PS1, + JungleBook_PS1, + + + + + CPA_3, + RaymanM, + RaymanArena, + Rayman3, + DonaldDuckPK, + Dinosaur, + LargoWinch, + + CPA_Montreal, + PlaymobilHype, + PlaymobilAlex, + PlaymobilLaura, + } +} \ No newline at end of file diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/Settings/Enums/Main/EngineVersion.cs.meta b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/Settings/Enums/Main/EngineVersion.cs.meta new file mode 100644 index 00000000..f39d20c1 --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/Settings/Enums/Main/EngineVersion.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: ced9867de9b9fba49bc6db1b8fe36dd3 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/Settings/Enums/Main/Platform.cs b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/Settings/Enums/Main/Platform.cs new file mode 100644 index 00000000..491308cd --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/Settings/Enums/Main/Platform.cs @@ -0,0 +1,28 @@ +namespace BinarySerializer.Ubisoft.CPA { + public enum Platform { + // PC-like + PC, + MacOS, + iOS, + + // Gen 1 consoles + DC, + + // Gen 2 consoles + PS2, + GC, + Xbox, + + // HD consoles + Xbox360, + PS3, + + // PS1 + PS1, + + // ROM + N64, + DS, + _3DS, + } +} \ No newline at end of file diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/Settings/Enums/Main/Platform.cs.meta b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/Settings/Enums/Main/Platform.cs.meta new file mode 100644 index 00000000..f51d3f14 --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/Settings/Enums/Main/Platform.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 667fd4f8932687d409ce628a11a48301 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/Settings/Enums/PathCapitalization.meta b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/Settings/Enums/PathCapitalization.meta new file mode 100644 index 00000000..4c9bec4d --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/Settings/Enums/PathCapitalization.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 7f70738c1432fe540a44b8b2cc7b3a6a +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/Settings/Enums/PathCapitalization/PathCapitalization.cs b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/Settings/Enums/PathCapitalization/PathCapitalization.cs new file mode 100644 index 00000000..9a4ec69e --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/Settings/Enums/PathCapitalization/PathCapitalization.cs @@ -0,0 +1,8 @@ +namespace BinarySerializer.Ubisoft.CPA { + public enum PathCapitalization { + All, + AllExceptExtension, + Normal, + None + }; +} diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/Settings/Enums/PathCapitalization/PathCapitalization.cs.meta b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/Settings/Enums/PathCapitalization/PathCapitalization.cs.meta new file mode 100644 index 00000000..8994f215 --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/Settings/Enums/PathCapitalization/PathCapitalization.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 2e9d120668491fb4097b0724cc8253d3 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/Settings/Enums/PathCapitalization/PathCapitalizationType.cs b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/Settings/Enums/PathCapitalization/PathCapitalizationType.cs new file mode 100644 index 00000000..cd8acb73 --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/Settings/Enums/PathCapitalization/PathCapitalizationType.cs @@ -0,0 +1,15 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace BinarySerializer.Ubisoft.CPA { + public enum PathCapitalizationType { + All, + LevelFolder, LevelFile, LevelRelocation, + Fix, FixLvl, FixRelocation, + LangFix, LangLevelFolder, LangLevelFile, LangLevelRelocation, + DSB, LMFile, TextureFile + }; +} diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/Settings/Enums/PathCapitalization/PathCapitalizationType.cs.meta b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/Settings/Enums/PathCapitalization/PathCapitalizationType.cs.meta new file mode 100644 index 00000000..954d37d5 --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/Settings/Enums/PathCapitalization/PathCapitalizationType.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 19024772a87feef41853c855c6c01c82 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/Settings/Main.meta b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/Settings/Main.meta new file mode 100644 index 00000000..b9903072 --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/Settings/Main.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 856e30da21d808b489a48a2150aeedb2 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/XOR.meta b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/XOR.meta new file mode 100644 index 00000000..51b8b599 --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/XOR.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 61005c8ef99ba0148a2ff90c6ce1f41b +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/XOR/SNA_MontrealXORCalculator.cs b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/XOR/SNA_MontrealXORCalculator.cs new file mode 100644 index 00000000..67eec651 --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/XOR/SNA_MontrealXORCalculator.cs @@ -0,0 +1,22 @@ +namespace BinarySerializer.Ubisoft.CPA +{ + public class SNA_MontrealXORCalculator : IXORCalculator + { + public SNA_MontrealXORCalculator(int multiply, int add) { + Multiply = multiply; + Add = add; + } + + public int Multiply { get; set; } + public int Add { get; set; } + + public int CurrentIndex { get; set; } = 0; + + public byte XORByte(byte b) + { + b = (byte)(BitHelpers.ExtractBits64(b + Multiply * CurrentIndex + Add, 8, 0)); + CurrentIndex++; + return b; + } + } +} \ No newline at end of file diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/XOR/SNA_MontrealXORCalculator.cs.meta b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/XOR/SNA_MontrealXORCalculator.cs.meta new file mode 100644 index 00000000..27ec8151 --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/XOR/SNA_MontrealXORCalculator.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 1abfea2784da3e1468a4162a5544e2c6 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/XOR/SNA_XORCalculator.cs b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/XOR/SNA_XORCalculator.cs new file mode 100644 index 00000000..f83d8acc --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/XOR/SNA_XORCalculator.cs @@ -0,0 +1,74 @@ +namespace BinarySerializer.Ubisoft.CPA +{ + /// + /// Class for XOR operations with a multi-byte key + /// + public class SNA_XORCalculator : IXORCalculator + { + public SNA_XORCalculator(uint key = DefaultCryptKey, DecodeMode mode = DecodeMode.Rayman2) + { + CryptKey = key; + Mode = mode; + } + + public const uint DefaultCryptKey = 0x6AB5CC79; + public uint CryptKey { get; protected set; } + public byte GetKeyByte(int i) => (byte)BitHelpers.ExtractBits64(CryptKey, 8, i*8); + public void SetKeyByte(int i, byte b) { + CryptKey = (uint)BitHelpers.SetBits64(CryptKey, b, 8, i * 8); + } + + public byte XORByte(byte b) + { + b = DecodeByte(b); + UpdateCryptKey(); + return b; + } + + public enum DecodeMode { + RedPlanet, // Pre-Rayman2 + Rayman2, + } + + public DecodeMode Mode { get; protected set; } = DecodeMode.Rayman2; + + private byte DecodeByte(byte toDecode) { + if (Mode == DecodeMode.RedPlanet) { + return (byte)((GetKeyByte(1) ^ ((toDecode + 0x100) - GetKeyByte(0))) & 0xFF); + } else { + return (byte)(toDecode ^ GetKeyByte(1)); + } + } + + private void UpdateCryptKey() { + if (Mode == DecodeMode.RedPlanet) { + SetKeyByte(0, (byte)((GetKeyByte(0) + GetKeyByte(2)) & 0xFF)); + SetKeyByte(1, (byte)((GetKeyByte(1) + GetKeyByte(3)) & 0xFF)); + } else { + CryptKey = GetCryptKey(CryptKey); + } + } + + public static uint GetCryptKey(long value) => GetPseudoRandomKey(value, 16807); // = 7*7*7*7*7 + public static uint GetProtectionKey(long value) => GetPseudoRandomKey(value, 48271); // prime + + /// + /// Pseudo-random generator based on Minimal Standard by Lewis, Goodman, and Miller in 1969. + /// Algorithm presented in "Random Number Generators: Good Ones Are Hard To Find". + /// + /// Starting value + /// Multiplier + /// + private static uint GetPseudoRandomKey(long seed, long a) { + const long seedXOR = 123459876; + long q = int.MaxValue / a; // For CryptKey: 127773 + long r = int.MaxValue % a; // For CryptKey: 2836 + + seed ^= seedXOR; + long hi = seed / q; + long lo = seed % q; + seed = a * lo - r * hi; + return (uint)BitHelpers.ExtractBits64(seed, 32, 0); + } + } +} \ No newline at end of file diff --git a/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/XOR/SNA_XORCalculator.cs.meta b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/XOR/SNA_XORCalculator.cs.meta new file mode 100644 index 00000000..85ba7beb --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Ubisoft.CPA/src/XOR/SNA_XORCalculator.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 3ff0879f094e3674d9e8189e25147edf +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Libraries/BinarySerializer.Helpers.meta b/Assets/Scripts/Libraries/BinarySerializer.Unity.meta similarity index 100% rename from Assets/Scripts/Libraries/BinarySerializer.Helpers.meta rename to Assets/Scripts/Libraries/BinarySerializer.Unity.meta diff --git a/Assets/Scripts/Libraries/BinarySerializer.Unity/.editorconfig b/Assets/Scripts/Libraries/BinarySerializer.Unity/.editorconfig new file mode 100644 index 00000000..71fa229f --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Unity/.editorconfig @@ -0,0 +1,3 @@ +# C# files +[*.cs] +indent_style = tab \ No newline at end of file diff --git a/Assets/Scripts/Libraries/BinarySerializer.Unity/Controller.meta b/Assets/Scripts/Libraries/BinarySerializer.Unity/Controller.meta new file mode 100644 index 00000000..7ec83a99 --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Unity/Controller.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 49fe9b38efb39c74aa2add14412e85e8 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Libraries/BinarySerializer.Unity/Controller/GlobalLoadState.cs b/Assets/Scripts/Libraries/BinarySerializer.Unity/Controller/GlobalLoadState.cs new file mode 100644 index 00000000..85e678c8 --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Unity/Controller/GlobalLoadState.cs @@ -0,0 +1,17 @@ +using Cysharp.Threading.Tasks; +using System.Diagnostics; + +namespace BinarySerializer.Unity { + public class GlobalLoadState { + public enum State { + None, + LoadingFiles, + Loading, + Initializing, + Error, + Finished + } + public static State LoadState { get; set; } + public static string DetailedState { get; set; } = "Starting"; + } +} diff --git a/Assets/Scripts/Libraries/BinarySerializer.Unity/Controller/GlobalLoadState.cs.meta b/Assets/Scripts/Libraries/BinarySerializer.Unity/Controller/GlobalLoadState.cs.meta new file mode 100644 index 00000000..9c09b72a --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Unity/Controller/GlobalLoadState.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 448ee5a42dd284c4590af8330e88457c +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Libraries/BinarySerializer.Unity/Controller/TimeController.cs b/Assets/Scripts/Libraries/BinarySerializer.Unity/Controller/TimeController.cs new file mode 100644 index 00000000..f6421e6f --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Unity/Controller/TimeController.cs @@ -0,0 +1,30 @@ +using Cysharp.Threading.Tasks; +using System.Diagnostics; + +namespace BinarySerializer.Unity { + public class TimeController { + + private static readonly Stopwatch stopwatch = new Stopwatch(); + + public static async UniTask WaitFrame() { + //await UniTask.NextFrame(); + await UniTask.Yield(); + //await UniTask.WaitForEndOfFrame(); + + if (stopwatch.IsRunning) stopwatch.Restart(); + } + + public static void StartStopwatch() { + stopwatch.Start(); + } + public static void StopStopwatch() { + if (stopwatch.IsRunning) stopwatch.Stop(); + } + + public static async UniTask WaitIfNecessary() { + if (!stopwatch.IsRunning) stopwatch.Start(); + if (stopwatch.ElapsedMilliseconds > 16) + await WaitFrame(); + } + } +} diff --git a/Assets/Scripts/Libraries/BinarySerializer.Unity/Controller/TimeController.cs.meta b/Assets/Scripts/Libraries/BinarySerializer.Unity/Controller/TimeController.cs.meta new file mode 100644 index 00000000..3600a5d6 --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Unity/Controller/TimeController.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 604ed3f99f0f87749b0321d17d5dfa38 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Libraries/BinarySerializer.Unity/EditorGUI.meta b/Assets/Scripts/Libraries/BinarySerializer.Unity/EditorGUI.meta new file mode 100644 index 00000000..8aec0270 --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Unity/EditorGUI.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 397683bdf3c1e204abd168d9db673225 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Libraries/BinarySerializer.Unity/EditorGUI/BinarySerializableDataComponent.cs b/Assets/Scripts/Libraries/BinarySerializer.Unity/EditorGUI/BinarySerializableDataComponent.cs new file mode 100644 index 00000000..e715cf1f --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Unity/EditorGUI/BinarySerializableDataComponent.cs @@ -0,0 +1,12 @@ +using UnityEngine; + +namespace BinarySerializer.Unity +{ + /// + /// A component for allowing data to be viewed and edited + /// + public class BinarySerializableDataComponent : MonoBehaviour + { + public BinarySerializable Data { get; set; } + } +} \ No newline at end of file diff --git a/Assets/Scripts/Libraries/BinarySerializer.Unity/EditorGUI/BinarySerializableDataComponent.cs.meta b/Assets/Scripts/Libraries/BinarySerializer.Unity/EditorGUI/BinarySerializableDataComponent.cs.meta new file mode 100644 index 00000000..2a5d4cc1 --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Unity/EditorGUI/BinarySerializableDataComponent.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 621b384299c6d68448e1cd0193c01ccd +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Libraries/BinarySerializer.Unity/EditorGUI/Editor.meta b/Assets/Scripts/Libraries/BinarySerializer.Unity/EditorGUI/Editor.meta new file mode 100644 index 00000000..9f79edd3 --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Unity/EditorGUI/Editor.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 2356a5a408ee4a14d93bf6cd3d259f3b +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Libraries/BinarySerializer.Unity/EditorGUI/Editor/BinarySerializableDataEditor.cs b/Assets/Scripts/Libraries/BinarySerializer.Unity/EditorGUI/Editor/BinarySerializableDataEditor.cs new file mode 100644 index 00000000..aba64335 --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Unity/EditorGUI/Editor/BinarySerializableDataEditor.cs @@ -0,0 +1,28 @@ +using UnityEditor; + +namespace BinarySerializer.Unity +{ + [CustomEditor(typeof(BinarySerializableDataComponent))] + [CanEditMultipleObjects] + public class BinarySerializableDataEditor : Editor + { + private EditorGUISerializer _serializer; + private bool _dataFoldout = true; + + public override void OnInspectorGUI() + { + BinarySerializableDataComponent comp = (BinarySerializableDataComponent)serializedObject.targetObject; + + _dataFoldout = EditorGUILayout.BeginFoldoutHeaderGroup(_dataFoldout, comp.Data.GetType().Name); + + EditorGUI.indentLevel++; + + if (_dataFoldout) + comp.Data.Serialize(_serializer ??= new EditorGUISerializer(comp.Data.Context)); + + EditorGUI.indentLevel--; + + EditorGUILayout.EndFoldoutHeaderGroup(); + } + } +} \ No newline at end of file diff --git a/Assets/Scripts/Libraries/BinarySerializer.Unity/EditorGUI/Editor/BinarySerializableDataEditor.cs.meta b/Assets/Scripts/Libraries/BinarySerializer.Unity/EditorGUI/Editor/BinarySerializableDataEditor.cs.meta new file mode 100644 index 00000000..8f7e8ab5 --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Unity/EditorGUI/Editor/BinarySerializableDataEditor.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 653f51b13f6716f41a431e8c289821d3 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Libraries/BinarySerializer.Unity/EditorGUI/Serializer.meta b/Assets/Scripts/Libraries/BinarySerializer.Unity/EditorGUI/Serializer.meta new file mode 100644 index 00000000..e4fd035e --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Unity/EditorGUI/Serializer.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 861e1c822edfe734d8daf66618d24efb +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Libraries/BinarySerializer.Unity/EditorGUI/Serializer/EditorGUIBitSerializer.cs b/Assets/Scripts/Libraries/BinarySerializer.Unity/EditorGUI/Serializer/EditorGUIBitSerializer.cs new file mode 100644 index 00000000..de4aec47 --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Unity/EditorGUI/Serializer/EditorGUIBitSerializer.cs @@ -0,0 +1,15 @@ +namespace BinarySerializer.Unity +{ + public class EditorGUIBitSerializer : BitSerializerObject + { + public EditorGUIBitSerializer(SerializerObject serializerObject, Pointer valueOffset) + : base(serializerObject, valueOffset, null, 0) { } + + public override T SerializeBits(T value, int length, SignedNumberRepresentation sign = SignedNumberRepresentation.Unsigned, string name = null) + { + T t = SerializerObject.Serialize(value, name); + Position += length; + return t; + } + } +} \ No newline at end of file diff --git a/Assets/Scripts/Libraries/BinarySerializer.Unity/EditorGUI/Serializer/EditorGUIBitSerializer.cs.meta b/Assets/Scripts/Libraries/BinarySerializer.Unity/EditorGUI/Serializer/EditorGUIBitSerializer.cs.meta new file mode 100644 index 00000000..55b13287 --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Unity/EditorGUI/Serializer/EditorGUIBitSerializer.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: f51458e63e171144abf8e1b1e1787a6d +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Libraries/BinarySerializer.Unity/EditorGUI/Serializer/EditorGUISerializer.cs b/Assets/Scripts/Libraries/BinarySerializer.Unity/EditorGUI/Serializer/EditorGUISerializer.cs new file mode 100644 index 00000000..f23468ad --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Unity/EditorGUI/Serializer/EditorGUISerializer.cs @@ -0,0 +1,422 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using UnityEditor; +using UnityEngine; + +namespace BinarySerializer.Unity +{ + // TODO: Rather than using the name to keep track of the value states we could use an index. That way resolved generic pointers will work. + public class EditorGUISerializer : SerializerObject + { + #region Constructor + + public EditorGUISerializer(Context context) : base(context) + { + Foldouts = new Dictionary(); + CurrentName = new Stack(); + } + + #endregion + + #region Private Properties + + private Dictionary Foldouts { get; } + private Stack CurrentName { get; } + private string GetFullName(string name) => String.Join(".", CurrentName.Append(name)); + + #endregion + + #region Public Properties + + public override bool FullSerialize => false; + public override long CurrentLength => 0; + public override BinaryFile CurrentBinaryFile => null; + public override long CurrentFileOffset => 0; + public override long CurrentAbsoluteOffset => 0; + + #endregion + + #region Private Editor Helpers + + private void DoFoldout(string name, Action action) + { + CurrentName.Push(name); + + string fullName = GetFullName(name); + + if (!Foldouts.ContainsKey(fullName)) + Foldouts[fullName] = false; + + Foldouts[fullName] = EditorGUILayout.Foldout(Foldouts[fullName], name ?? DefaultName, true); + + if (Foldouts[fullName]) + { + Depth++; + EditorGUI.indentLevel++; + + action(); + + Depth--; + EditorGUI.indentLevel--; + } + + CurrentName.Pop(); + } + + #endregion + + #region Logging + + public override void Log(string logString, params object[] args) + { + //EditorGUILayout.LabelField(logString); + } + + #endregion + + #region Encoding + + public override void DoEncoded(IStreamEncoder encoder, Action action, Endian? endianness = null, bool allowLocalPointers = false, string filename = null) + { + action(); + } + + public override Pointer BeginEncoded(IStreamEncoder encoder, Endian? endianness = null, bool allowLocalPointers = false, string filename = null) + { + return null; + } + + public override void EndEncoded(Pointer endPointer) { } + + #endregion + + #region Positioning + + public override void Goto(Pointer offset) { } + + public override void DoAt(Pointer offset, Action action) + { + if (offset == null) + return; + + DoFoldout(offset.ToString(), action); + } + + #endregion + + #region Checksum + + public override T SerializeChecksum(T calculatedChecksum, string name = null) => default; + + #endregion + + #region Serialization + + public override T Serialize(T obj, string name = null) + { + name ??= DefaultName; + + // Get the type + Type type = typeof(T); + TypeCode typeCode = Type.GetTypeCode(type); + + if (type.IsEnum) + { + if (type.GetCustomAttributes(false).OfType().Any()) + return (T)(object)EditorGUILayout.EnumFlagsField(name, (Enum)(object)obj); + else + return (T)(object)EditorGUILayout.EnumPopup(name, (Enum)(object)obj); + } + + switch (typeCode) + { + case TypeCode.Boolean: + return (T)(object)EditorGUILayout.Toggle(name, (bool)(object)obj); + + case TypeCode.SByte: + return (T)(object)(sbyte)EditorGUILayout.IntField(name, (sbyte)(object)obj); + + case TypeCode.Byte: + return (T)(object)(byte)EditorGUILayout.IntField(name, (byte)(object)obj); + + case TypeCode.Int16: + return (T)(object)(short)EditorGUILayout.IntField(name, (short)(object)obj); + + case TypeCode.UInt16: + return (T)(object)(ushort)EditorGUILayout.IntField(name, (ushort)(object)obj); + + case TypeCode.Int32: + return (T)(object)EditorGUILayout.IntField(name, (int)(object)obj); + + case TypeCode.UInt32: + return (T)(object)(uint)EditorGUILayout.LongField(name, (uint)(object)obj); + + case TypeCode.Int64: + return (T)(object)EditorGUILayout.LongField(name, (long)(object)obj); + + case TypeCode.UInt64: + return (T)(object)(ulong)EditorGUILayout.LongField(name, (long)(ulong)(object)obj); + + case TypeCode.Single: + return (T)(object)EditorGUILayout.FloatField(name, (float)(object)obj); + + case TypeCode.Double: + return (T)(object)EditorGUILayout.DoubleField(name, (double)(object)obj); + + case TypeCode.String: + return (T)(object)EditorGUILayout.TextField(name, (string)(object)obj); + + case TypeCode.Decimal: + case TypeCode.Char: + case TypeCode.DateTime: + case TypeCode.Empty: + case TypeCode.DBNull: + + case TypeCode.Object: + if (type == typeof(UInt24)) + { + return (T)(object)(UInt24)(uint)EditorGUILayout.LongField(name ?? DefaultName, (uint)(UInt24)(object)obj); + } + else if (type == typeof(byte?)) + { + var b = (byte?)(object)obj; + byte byteValue; + bool hasValue = b.HasValue; + + hasValue = EditorGUILayout.Toggle(name, hasValue); + + if (hasValue) + byteValue = (byte)EditorGUILayout.IntField(name, b ?? 0); + else + byteValue = 0; + + if (hasValue) + return (T)(object)(byte?)byteValue; + + return (T)(object)null; + } + else + { + throw new NotSupportedException($"The generic type for ('{name}') is not supported"); + } + default: + throw new NotSupportedException($"The generic type for ('{name}') is not supported"); + } + + } + + public override T SerializeObject(T obj, Action onPreSerialize = null, string name = null) + { + if (obj == null) + return null; + + name ??= DefaultName; + + // BaseColor is defined in the BinarySerializer base library, so we can add a custom check for that + if (obj is BaseColor color) + { + EditorGUI.BeginChangeCheck(); + Color unityColor = EditorGUILayout.ColorField(name, color.GetColor()); + + if (EditorGUI.EndChangeCheck()) + { + color.Alpha = unityColor.a; + color.Red = unityColor.r; + color.Green = unityColor.g; + color.Blue = unityColor.b; + } + } + else + { + EditorGUISerializerConfig config = Context.GetEditorGUISerializerConfig(); + EditorGUISerializerConfig.SerializableObjectHandler handler = config?.GetHandler(); + + if (handler != null) + handler(obj, name); + else + DoFoldout(name, () => obj.Serialize(this)); + } + + return obj; + } + + public override Pointer SerializePointer(Pointer obj, PointerSize size = PointerSize.Pointer32, Pointer anchor = null, bool allowInvalid = false, long? nullValue = null, string name = null) + { + name ??= DefaultName; + + EditorGUI.BeginDisabledGroup(true); + EditorGUILayout.TextField(name, $"{obj}"); + EditorGUI.EndDisabledGroup(); + + return obj; + } + + public override Pointer SerializePointer(Pointer obj, PointerSize size = PointerSize.Pointer32, Pointer anchor = null, bool resolve = false, Action onPreSerialize = null, + bool allowInvalid = false, long? nullValue = null, string name = null) + { + name ??= DefaultName; + + EditorGUI.BeginDisabledGroup(true); + EditorGUILayout.TextField(name, $"{obj}"); + EditorGUI.EndDisabledGroup(); + + if (resolve) + DoAt(obj, () => obj.Value = SerializeObject(obj.Value, onPreSerialize: onPreSerialize, name: $"{name}.Value")); + + return obj; + } + + public override string SerializeString(string obj, long? length = null, Encoding encoding = null, string name = null) + { + name ??= DefaultName; + return EditorGUILayout.TextField(name, obj); + } + + #endregion + + #region Array Serialization + + public override T[] SerializeArraySize(T[] obj, string name = null) + { + name ??= DefaultName; + + U size = Serialize(default, name: $"{name}.Length"); + + // Convert size to int, slow + int intSize = (int)Convert.ChangeType(size, typeof(int)); + + if (obj == null) + obj = new T[intSize]; + else if (obj.Length != intSize) + Array.Resize(ref obj, intSize); + + return obj; + } + + public override T[] SerializeArray(T[] obj, long count, string name = null) + { + name ??= DefaultName; + + if (obj == null) + obj = new T[count]; + + else if (count != obj.Length) + Array.Resize(ref obj, (int)count); + + DoFoldout($"{name}[{obj.Length}]", () => + { + for (int i = 0; i < obj.Length; i++) + Serialize(obj[i], name: $"{name}[{i}]"); + }); + + return obj; + } + + public override T[] SerializeObjectArray(T[] obj, long count, Action onPreSerialize = null, string name = null) + { + name ??= DefaultName; + + if (obj == null) + obj = new T[count]; + else if (count != obj.Length) + Array.Resize(ref obj, (int)count); + + DoFoldout($"{name}[{obj.Length}]", () => + { + for (int i = 0; i < obj.Length; i++) + SerializeObject(obj[i], name: $"{name}[{i}]"); + }); + + return obj; + } + + public override T[] SerializeArrayUntil(T[] obj, Func conditionCheckFunc, Func getLastObjFunc = null, string name = null) + { + return SerializeArray(obj, obj.Length, name: name); + } + + public override T[] SerializeObjectArrayUntil(T[] obj, Func conditionCheckFunc, Func getLastObjFunc = null, Action onPreSerialize = null, string name = null) + { + return SerializeObjectArray(obj, obj.Length, onPreSerialize: onPreSerialize, name: name); + } + + public override Pointer[] SerializePointerArray(Pointer[] obj, long count, PointerSize size = PointerSize.Pointer32, Pointer anchor = null, bool allowInvalid = false, long? nullValue = null, + string name = null) + { + name ??= DefaultName; + + if (obj == null) + obj = new Pointer[count]; + else if (count != obj.Length) + Array.Resize(ref obj, (int)count); + + DoFoldout($"{name}[{obj.Length}]", () => + { + for (int i = 0; i < obj.Length; i++) + SerializePointer(obj[i], size: size, anchor: anchor, allowInvalid: allowInvalid, nullValue: nullValue, name: $"{name}[{i}]"); + }); + + return obj; + } + + public override Pointer[] SerializePointerArray(Pointer[] obj, long count, PointerSize size = PointerSize.Pointer32, Pointer anchor = null, bool resolve = false, + Action onPreSerialize = null, bool allowInvalid = false, long? nullValue = null, string name = null) + { + name ??= DefaultName; + + if (obj == null) + obj = new Pointer[count]; + else if (count != obj.Length) + Array.Resize(ref obj, (int)count); + + DoFoldout($"{name}[{obj.Length}]", () => + { + for (int i = 0; i < obj.Length; i++) + SerializePointer(obj[i], size: size, anchor: anchor, resolve: resolve, onPreSerialize: onPreSerialize == null ? null : x => onPreSerialize(x, i), allowInvalid: allowInvalid, nullValue: nullValue, name: $"{name}[{i}]"); + }); + + return obj; + } + + public override string[] SerializeStringArray(string[] obj, long count, int length, Encoding encoding = null, string name = null) + { + name ??= DefaultName; + + if (obj == null) + obj = new string[count]; + else if (count != obj.Length) + Array.Resize(ref obj, (int)count); + + DoFoldout($"{name}[{obj.Length}]", () => + { + for (int i = 0; i < obj.Length; i++) + SerializeString(obj[i], name: $"{name}[{i}]"); + }); + + return obj; + } + + #endregion + + #region Other Serialization + + public override void DoEndian(Endian endianness, Action action) + { + action(); + } + + public override void SerializeBitValues(Action serializeFunc) + { + serializeFunc((value, length, name) => Serialize(value, name: name)); + } + + public override void DoBits(Action serializeFunc) + { + serializeFunc(new EditorGUIBitSerializer(this, CurrentPointer)); + } + + #endregion + } +} \ No newline at end of file diff --git a/Assets/Scripts/Libraries/BinarySerializer.Unity/EditorGUI/Serializer/EditorGUISerializer.cs.meta b/Assets/Scripts/Libraries/BinarySerializer.Unity/EditorGUI/Serializer/EditorGUISerializer.cs.meta new file mode 100644 index 00000000..0e1dddee --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Unity/EditorGUI/Serializer/EditorGUISerializer.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 4f874bed3b8f5f74697f293ce5baf0c5 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Libraries/BinarySerializer.Unity/EditorGUI/Serializer/EditorGUISerializerConfig.cs b/Assets/Scripts/Libraries/BinarySerializer.Unity/EditorGUI/Serializer/EditorGUISerializerConfig.cs new file mode 100644 index 00000000..a2b9a80e --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Unity/EditorGUI/Serializer/EditorGUISerializerConfig.cs @@ -0,0 +1,36 @@ +using System; +using System.Collections.Generic; +using UnityEditor; + +namespace BinarySerializer.Unity +{ + public class EditorGUISerializerConfig + { + internal const string ConfigKey = nameof(EditorGUISerializerConfig); + + private readonly Dictionary _handlers = new Dictionary(); + + public void AddObjectHandler(SerializableObjectHandler handler) + { + _handlers[typeof(T)] = (obj, name) => handler((T)obj, name); + } + + public void AddObjectHandler(Func guiHandler, Action applyAction) + { + _handlers[typeof(T)] = (obj, name) => + { + EditorGUI.BeginChangeCheck(); + U value = guiHandler((T)obj, name); + + if (EditorGUI.EndChangeCheck()) + applyAction((T)obj, value); + }; + } + + public SerializableObjectHandler GetHandler() => + _handlers.TryGetValue(typeof(T), out SerializableObjectHandler handler) ? handler : null; + + public delegate void SerializableObjectHandler(object obj, string name); + public delegate void SerializableObjectHandler(T obj, string name); + } +} \ No newline at end of file diff --git a/Assets/Scripts/Libraries/BinarySerializer.Unity/EditorGUI/Serializer/EditorGUISerializerConfig.cs.meta b/Assets/Scripts/Libraries/BinarySerializer.Unity/EditorGUI/Serializer/EditorGUISerializerConfig.cs.meta new file mode 100644 index 00000000..bc99e63f --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Unity/EditorGUI/Serializer/EditorGUISerializerConfig.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 5853a8b7e7c0b08409e238c6e1b379f8 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Libraries/BinarySerializer.Helpers/Extensions.meta b/Assets/Scripts/Libraries/BinarySerializer.Unity/Extensions.meta similarity index 100% rename from Assets/Scripts/Libraries/BinarySerializer.Helpers/Extensions.meta rename to Assets/Scripts/Libraries/BinarySerializer.Unity/Extensions.meta diff --git a/Assets/Scripts/Libraries/BinarySerializer.Unity/Helpers.meta b/Assets/Scripts/Libraries/BinarySerializer.Unity/Helpers.meta new file mode 100644 index 00000000..d51f6d4b --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Unity/Helpers.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 85021530b43f9374481c2adf2d66ad88 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Libraries/BinarySerializer.Helpers/EnumHelpers.cs b/Assets/Scripts/Libraries/BinarySerializer.Unity/Helpers/EnumHelpers.cs similarity index 95% rename from Assets/Scripts/Libraries/BinarySerializer.Helpers/EnumHelpers.cs rename to Assets/Scripts/Libraries/BinarySerializer.Unity/Helpers/EnumHelpers.cs index a9753876..4f949f43 100644 --- a/Assets/Scripts/Libraries/BinarySerializer.Helpers/EnumHelpers.cs +++ b/Assets/Scripts/Libraries/BinarySerializer.Unity/Helpers/EnumHelpers.cs @@ -1,6 +1,6 @@ using System; -namespace BinarySerializer { +namespace BinarySerializer.Unity { /// /// Helper methods for an /// diff --git a/Assets/Scripts/Libraries/BinarySerializer.Helpers/EnumHelpers.cs.meta b/Assets/Scripts/Libraries/BinarySerializer.Unity/Helpers/EnumHelpers.cs.meta similarity index 83% rename from Assets/Scripts/Libraries/BinarySerializer.Helpers/EnumHelpers.cs.meta rename to Assets/Scripts/Libraries/BinarySerializer.Unity/Helpers/EnumHelpers.cs.meta index 38edf503..0c45f012 100644 --- a/Assets/Scripts/Libraries/BinarySerializer.Helpers/EnumHelpers.cs.meta +++ b/Assets/Scripts/Libraries/BinarySerializer.Unity/Helpers/EnumHelpers.cs.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: 457e8f53cda2cf84aa19e4a91cedf077 +guid: 2754393221a44fd4c81d56870c337681 MonoImporter: externalObjects: {} serializedVersion: 2 diff --git a/Assets/Scripts/Libraries/BinarySerializer.Unity/Helpers/Extensions.meta b/Assets/Scripts/Libraries/BinarySerializer.Unity/Helpers/Extensions.meta new file mode 100644 index 00000000..80a8a37b --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Unity/Helpers/Extensions.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 7d8ca9f5d92762845b1db1431d4a1932 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Libraries/BinarySerializer.Unity/Helpers/Extensions/ColorExtensions.cs b/Assets/Scripts/Libraries/BinarySerializer.Unity/Helpers/Extensions/ColorExtensions.cs new file mode 100644 index 00000000..411f147f --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Unity/Helpers/Extensions/ColorExtensions.cs @@ -0,0 +1,21 @@ +using System; +using BinarySerializer; +using System.Collections.Generic; +using UnityEngine; +using System.Linq; + +namespace BinarySerializer.Unity { + public static class ColorExtensions { + public static Color GetColor(this BaseColor c) { + return new Color(c.Red, c.Green, c.Blue, c.Alpha); + } + + public static Color[] GetColors(this BaseColor[] ca) { + return ca.Select(c => c.GetColor()).ToArray(); + } + + public static CustomColor GetColor(this Color c) { + return new CustomColor(c.r, c.g, c.b, c.a); + } + } +} \ No newline at end of file diff --git a/Assets/Scripts/Libraries/BinarySerializer.Unity/Helpers/Extensions/ColorExtensions.cs.meta b/Assets/Scripts/Libraries/BinarySerializer.Unity/Helpers/Extensions/ColorExtensions.cs.meta new file mode 100644 index 00000000..bbb48d00 --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Unity/Helpers/Extensions/ColorExtensions.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: ff307c37887cebf48aeac895382d909d +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Libraries/BinarySerializer.Unity/Helpers/Extensions/ContextExtensions.cs b/Assets/Scripts/Libraries/BinarySerializer.Unity/Helpers/Extensions/ContextExtensions.cs new file mode 100644 index 00000000..7039893e --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Unity/Helpers/Extensions/ContextExtensions.cs @@ -0,0 +1,69 @@ +using Cysharp.Threading.Tasks; +using System.IO; + +namespace BinarySerializer.Unity { + public static class ContextExtensions { + public static async UniTask AddLinearFileAsync(this Context context, string filePath, Endian endianness = Endian.Little, bool recreateOnWrite = true, int? bigFileCacheLength = null) { + var absolutePath = context.GetAbsoluteFilePath(filePath); + + if (bigFileCacheLength.HasValue) { + await FileSystem.PrepareBigFile(absolutePath, bigFileCacheLength.Value); + } else { + await FileSystem.PrepareFile(absolutePath); + } + + if (!FileSystem.FileExists(absolutePath)) + return null; + + var file = new LinearFile(context, filePath, endianness) { + RecreateOnWrite = recreateOnWrite + }; + + context.AddFile(file); + + return file; + } + public static async UniTask AddMemoryMappedFile(this Context context, string filePath, uint baseAddress, Endian endianness = Endian.Little, bool recreateOnWrite = true, long memoryMappedPriority = -1) { + var absolutePath = context.GetAbsoluteFilePath(filePath); + + await FileSystem.PrepareFile(absolutePath); + + if (!FileSystem.FileExists(absolutePath)) + return null; + + var file = new MemoryMappedFile(context, filePath, baseAddress, endianness, memoryMappedPriority: memoryMappedPriority) { + RecreateOnWrite = recreateOnWrite + }; + + context.AddFile(file); + + return file; + } + public static StreamFile AddStreamFile(this Context context, string name, Stream stream, Endian endianness = Endian.Little, bool allowLocalPointers = false) { + var file = new StreamFile(context, name, stream, endianness, allowLocalPointers); + + context.AddFile(file); + + return file; + } + public static StreamFile AddStreamFile(this Context context, string name, byte[] bytes, Endian endianness = Endian.Little, bool allowLocalPointers = false) { + var file = new StreamFile(context, name, new MemoryStream(bytes), endianness, allowLocalPointers); + + context.AddFile(file); + + return file; + } + public static MemoryMappedStreamFile AddMemoryMappedStreamFile(this Context context, string name, byte[] bytes, uint baseAddress, Endian endianness = Endian.Little) { + var file = new MemoryMappedStreamFile(context, name, baseAddress, bytes, endianness); + + context.AddFile(file); + + return file; + } + + public static EditorGUISerializerConfig AddEditorGUISerializerConfig(this Context context, EditorGUISerializerConfig config) => + context.StoreObject(EditorGUISerializerConfig.ConfigKey, config); + public static EditorGUISerializerConfig GetEditorGUISerializerConfig(this Context context) => + context.GetStoredObject(EditorGUISerializerConfig.ConfigKey); + } +} \ No newline at end of file diff --git a/Assets/Scripts/Libraries/BinarySerializer.Unity/Helpers/Extensions/ContextExtensions.cs.meta b/Assets/Scripts/Libraries/BinarySerializer.Unity/Helpers/Extensions/ContextExtensions.cs.meta new file mode 100644 index 00000000..8367069a --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Unity/Helpers/Extensions/ContextExtensions.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 66d5f06003016a640b76c9ce21c0e096 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Libraries/BinarySerializer.Helpers/Extensions/DictionaryExtensions.cs b/Assets/Scripts/Libraries/BinarySerializer.Unity/Helpers/Extensions/DictionaryExtensions.cs similarity index 96% rename from Assets/Scripts/Libraries/BinarySerializer.Helpers/Extensions/DictionaryExtensions.cs rename to Assets/Scripts/Libraries/BinarySerializer.Unity/Helpers/Extensions/DictionaryExtensions.cs index 18de52de..3a55d915 100644 --- a/Assets/Scripts/Libraries/BinarySerializer.Helpers/Extensions/DictionaryExtensions.cs +++ b/Assets/Scripts/Libraries/BinarySerializer.Unity/Helpers/Extensions/DictionaryExtensions.cs @@ -1,6 +1,6 @@ using System.Collections.Generic; -namespace BinarySerializer { +namespace BinarySerializer.Unity { /// /// Extension methods for /// diff --git a/Assets/Scripts/Libraries/BinarySerializer.Helpers/Extensions/DictionaryExtensions.cs.meta b/Assets/Scripts/Libraries/BinarySerializer.Unity/Helpers/Extensions/DictionaryExtensions.cs.meta similarity index 100% rename from Assets/Scripts/Libraries/BinarySerializer.Helpers/Extensions/DictionaryExtensions.cs.meta rename to Assets/Scripts/Libraries/BinarySerializer.Unity/Helpers/Extensions/DictionaryExtensions.cs.meta diff --git a/Assets/Scripts/Libraries/BinarySerializer.Helpers/Extensions/EnumExtensions.cs b/Assets/Scripts/Libraries/BinarySerializer.Unity/Helpers/Extensions/EnumExtensions.cs similarity index 97% rename from Assets/Scripts/Libraries/BinarySerializer.Helpers/Extensions/EnumExtensions.cs rename to Assets/Scripts/Libraries/BinarySerializer.Unity/Helpers/Extensions/EnumExtensions.cs index 33fa88a7..e2f667c0 100644 --- a/Assets/Scripts/Libraries/BinarySerializer.Helpers/Extensions/EnumExtensions.cs +++ b/Assets/Scripts/Libraries/BinarySerializer.Unity/Helpers/Extensions/EnumExtensions.cs @@ -3,7 +3,7 @@ using System.Linq; using System.Reflection; -namespace BinarySerializer { +namespace BinarySerializer.Unity { /// /// Extension methods for /// diff --git a/Assets/Scripts/Libraries/BinarySerializer.Helpers/Extensions/EnumExtensions.cs.meta b/Assets/Scripts/Libraries/BinarySerializer.Unity/Helpers/Extensions/EnumExtensions.cs.meta similarity index 100% rename from Assets/Scripts/Libraries/BinarySerializer.Helpers/Extensions/EnumExtensions.cs.meta rename to Assets/Scripts/Libraries/BinarySerializer.Unity/Helpers/Extensions/EnumExtensions.cs.meta diff --git a/Assets/Scripts/Libraries/BinarySerializer.Helpers/Extensions/EnumerableExtensions.cs b/Assets/Scripts/Libraries/BinarySerializer.Unity/Helpers/Extensions/EnumerableExtensions.cs similarity index 98% rename from Assets/Scripts/Libraries/BinarySerializer.Helpers/Extensions/EnumerableExtensions.cs rename to Assets/Scripts/Libraries/BinarySerializer.Unity/Helpers/Extensions/EnumerableExtensions.cs index bf6af1eb..3c59e698 100644 --- a/Assets/Scripts/Libraries/BinarySerializer.Helpers/Extensions/EnumerableExtensions.cs +++ b/Assets/Scripts/Libraries/BinarySerializer.Unity/Helpers/Extensions/EnumerableExtensions.cs @@ -1,7 +1,7 @@ using System; using System.Collections.Generic; -namespace BinarySerializer { +namespace BinarySerializer.Unity { /// /// Extension method for /// diff --git a/Assets/Scripts/Libraries/BinarySerializer.Helpers/Extensions/EnumerableExtensions.cs.meta b/Assets/Scripts/Libraries/BinarySerializer.Unity/Helpers/Extensions/EnumerableExtensions.cs.meta similarity index 100% rename from Assets/Scripts/Libraries/BinarySerializer.Helpers/Extensions/EnumerableExtensions.cs.meta rename to Assets/Scripts/Libraries/BinarySerializer.Unity/Helpers/Extensions/EnumerableExtensions.cs.meta diff --git a/Assets/Scripts/Libraries/BinarySerializer.Unity/Helpers/Extensions/GameObjectExtensions.cs b/Assets/Scripts/Libraries/BinarySerializer.Unity/Helpers/Extensions/GameObjectExtensions.cs new file mode 100644 index 00000000..c87fed98 --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Unity/Helpers/Extensions/GameObjectExtensions.cs @@ -0,0 +1,21 @@ +using System; +using UnityEngine; + +namespace BinarySerializer.Unity +{ + public static class GameObjectExtensions + { + public static T AddComponent(this GameObject obj, Action configureAction) + where T : Component + { + T comp = obj.AddComponent(); + configureAction(comp); + return comp; + } + + public static void AddBinarySerializableData(this GameObject obj, BinarySerializable data) + { + obj.AddComponent(x => x.Data = data); + } + } +} \ No newline at end of file diff --git a/Assets/Scripts/Libraries/BinarySerializer.Unity/Helpers/Extensions/GameObjectExtensions.cs.meta b/Assets/Scripts/Libraries/BinarySerializer.Unity/Helpers/Extensions/GameObjectExtensions.cs.meta new file mode 100644 index 00000000..de28386d --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Unity/Helpers/Extensions/GameObjectExtensions.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: c09dbab4408e26846ae40b2803996bd7 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Libraries/BinarySerializer.Unity/Helpers/Extensions/StringExtensions.cs b/Assets/Scripts/Libraries/BinarySerializer.Unity/Helpers/Extensions/StringExtensions.cs new file mode 100644 index 00000000..253b94fe --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Unity/Helpers/Extensions/StringExtensions.cs @@ -0,0 +1,28 @@ +using System; +using UnityEngine; + +namespace BinarySerializer.Unity +{ + public static class StringExtensions + { + public static string ReplaceFirst(this string text, string search, string replace) + { + int pos = text.IndexOf(search, StringComparison.Ordinal); + + if (pos < 0) + return text; + + return text[..pos] + replace + text[(pos + search.Length)..]; + } + + public static void CopyToClipboard(this string str) + { + TextEditor te = new() + { + text = str + }; + te.SelectAll(); + te.Copy(); + } + } +} \ No newline at end of file diff --git a/Assets/Scripts/Libraries/BinarySerializer.Unity/Helpers/Extensions/StringExtensions.cs.meta b/Assets/Scripts/Libraries/BinarySerializer.Unity/Helpers/Extensions/StringExtensions.cs.meta new file mode 100644 index 00000000..205e7b0c --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Unity/Helpers/Extensions/StringExtensions.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 64d285a6d7a60ab449e9a5e45aa51ad4 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Libraries/BinarySerializer.Unity/Helpers/PaletteHelpers.cs b/Assets/Scripts/Libraries/BinarySerializer.Unity/Helpers/PaletteHelpers.cs new file mode 100644 index 00000000..6034583e --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Unity/Helpers/PaletteHelpers.cs @@ -0,0 +1,107 @@ +using System.Collections.Generic; +using System.IO; +using UnityEngine; + +namespace BinarySerializer.Unity +{ + /// + /// Helper methods for palettes + /// + public static class PaletteHelpers + { + /// + /// Exports the specified palette to the gimp palette format + /// + /// The path to export to + /// The palette name + /// The palette + public static void ExportToGimp(string outputPath, string name, BaseColor[] palette) + { + // Create the file + using FileStream fileStream = File.Create(outputPath); + + // Use a writer + using var writer = new StreamWriter(fileStream); + + // Write header + writer.WriteLine("GIMP Palette"); + writer.WriteLine("Name: " + name); + writer.WriteLine("#"); + + // Write colors + foreach (var color in palette) + writer.WriteLine($"{color.Red,-3} {color.Green,-3} {color.Blue,-3}"); + } + + /// + /// Exports a palette to a .png file + /// + /// The path to export to + /// The palette + /// The palette scale on the resulting texture + /// The color index to start from + /// The length of the palette to use or null to use the length of the color array + /// Optional color wrapping on the resulting texture or null to not wrap + /// Indicates if the y-axis should be reversed + public static void ExportToPNG( + string outputPath, + IList palette, int scale = 16, + int start = 0, int? length = null, + int? wrap = null, bool reverseY = false) + { + int palLength = length ?? palette.Count; + int palWrap = wrap ?? palLength; + Texture2D tex = TextureHelpers.CreateTexture2D( + Mathf.Min(palLength, palWrap) * scale, + Mathf.CeilToInt(palLength / (float)palWrap) * scale, + clear: true); + + for (int i = 0; i < palLength; i++) + { + int mainY = (tex.height / scale) - 1 - (i / palWrap); + int mainX = i % palWrap; + + Color col = palette[start + i].GetColor(); + + // Remove transparency + col = new Color(col.r, col.g, col.b); + + for (int y = 0; y < scale; y++) + { + for (int x = 0; x < scale; x++) + { + var xx = mainX * scale + x; + var yy = mainY * scale + y; + + if (reverseY) + yy = tex.height - yy - 1; + + tex.SetPixel(xx, yy, col); + } + } + } + + tex.Apply(); + + Util.ByteArrayToFile(outputPath, tex.EncodeToPNG()); + } + + public static BaseColor[] CreateDummyPalette(int length, bool firstTransparent = true, int? wrap = null) + { + BaseColor[] pal = new BaseColor[length]; + + wrap ??= length; + + if (firstTransparent) + pal[0] = BaseColor.Clear; + + for (int i = firstTransparent ? 1 : 0; i < length; i++) + { + float val = (float)(i % wrap.Value) / (wrap.Value - 1); + pal[i] = new CustomColor(val, val, val); + } + + return pal; + } + } +} \ No newline at end of file diff --git a/Assets/Scripts/Libraries/BinarySerializer.Unity/Helpers/PaletteHelpers.cs.meta b/Assets/Scripts/Libraries/BinarySerializer.Unity/Helpers/PaletteHelpers.cs.meta new file mode 100644 index 00000000..9f60245e --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Unity/Helpers/PaletteHelpers.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 3a9711f1e4963824c962e86dbc7ed942 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Libraries/BinarySerializer.Unity/Helpers/TextureHelpers.cs b/Assets/Scripts/Libraries/BinarySerializer.Unity/Helpers/TextureHelpers.cs new file mode 100644 index 00000000..b12c2409 --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Unity/Helpers/TextureHelpers.cs @@ -0,0 +1,170 @@ +using ImageMagick; +using UnityEngine; + +namespace BinarySerializer.Unity +{ + public static class TextureHelpers + { + /// + /// Creates a new + /// + /// The texture width + /// The texture height + /// Indicates if the image should start as fully transparent + /// Indicates if the clear transparent pixels should be applied + /// The texture + public static Texture2D CreateTexture2D(int width, int height, bool clear = false, bool applyClear = false) { + var tex = new Texture2D(width, height, TextureFormat.RGBA32, false) { + filterMode = FilterMode.Point, + wrapMode = TextureWrapMode.Clamp + }; + + if (clear) { + tex.SetPixels(new Color[width * height]); + + if (applyClear) + tex.Apply(); + } + + return tex; + } + + public static MagickImage ToMagickImage(this Texture2D tex) { + var pixels = tex.GetPixels(); + var bytes = new byte[pixels.Length * 4]; + + for (int i = 0; i < pixels.Length; i++) { + bytes[i * 4 + 0] = (byte)(pixels[i].a * 255); + bytes[i * 4 + 1] = (byte)(pixels[i].b * 255); + bytes[i * 4 + 2] = (byte)(pixels[i].g * 255); + bytes[i * 4 + 3] = (byte)(pixels[i].r * 255); + } + + var img = new MagickImage(bytes, new PixelReadSettings(tex.width, tex.height, StorageType.Char, PixelMapping.ABGR)); + img.Flip(); + return img; + } + + public static MagickImage ToMagickImage(this Sprite sprite) { + var pixels = sprite.texture.GetPixels((int)sprite.rect.x, (int)sprite.rect.y, (int)sprite.rect.width, (int)sprite.rect.height); + var bytes = new byte[pixels.Length * 4]; + + for (int i = 0; i < pixels.Length; i++) { + bytes[i * 4 + 0] = (byte)(pixels[i].a * 255); + bytes[i * 4 + 1] = (byte)(pixels[i].b * 255); + bytes[i * 4 + 2] = (byte)(pixels[i].g * 255); + bytes[i * 4 + 3] = (byte)(pixels[i].r * 255); + } + + var img = new MagickImage(bytes, new PixelReadSettings((int)sprite.rect.width, (int)sprite.rect.height, StorageType.Char, PixelMapping.ABGR)); + img.Flip(); + return img; + } + + public static Texture2D Crop(this Texture2D tex, RectInt rect, bool destroyTex, bool flipY = true) { + var newTex = CreateTexture2D(rect.width, rect.height); + + if (flipY) + rect.y = tex.height - rect.height - rect.y; + + newTex.SetPixels(tex.GetPixels(rect.x, rect.y, rect.width, rect.height)); + + newTex.Apply(); + + if (destroyTex) + Object.DestroyImmediate(tex); + + return newTex; + } + + public static void ResizeImageData(this Texture2D texture2D, int targetX, int targetY, bool mipmap = true, FilterMode filter = FilterMode.Bilinear) { + //create a temporary RenderTexture with the target size + RenderTexture rt = RenderTexture.GetTemporary(targetX, targetY, 0, RenderTextureFormat.ARGB32, RenderTextureReadWrite.Default); + + //set the active RenderTexture to the temporary texture so we can read from it + RenderTexture.active = rt; + + //Copy the texture data on the GPU - this is where the magic happens [(;] + Graphics.Blit(texture2D, rt); + //resize the texture to the target values (this sets the pixel data as undefined) + texture2D.Reinitialize(targetX, targetY, texture2D.format, mipmap); + texture2D.filterMode = filter; + + try { + //reads the pixel values from the temporary RenderTexture onto the resized texture + texture2D.ReadPixels(new Rect(0.0f, 0.0f, targetX, targetY), 0, 0); + //actually upload the changed pixels to the graphics card + texture2D.Apply(); + } catch { + Debug.LogError("Read/Write is not enabled on texture " + texture2D.name); + } + + + RenderTexture.ReleaseTemporary(rt); + } + + public static void Export(this Texture2D texture2D, string filePath, bool includesExt = false) + { + if (!includesExt) + filePath = $"{filePath}.png"; + + Util.ByteArrayToFile(filePath, texture2D.EncodeToPNG()); + } + + public static bool IsTransparent(this Texture2D texture2D) { + Color[] cols = texture2D.GetPixels(); + foreach (Color col in cols) { + if (col.a != 1f) { + return true; + } + } + return false; + } + + public static Texture2D CreateDummyTexture() { + Texture2D texture = new Texture2D(1, 1); + texture.SetPixel(0, 0, UnityEngine.Random.ColorHSV(0f, 1f, 1f, 1f, 0.5f, 1f, 1f, 1f)); + texture.Apply(); + return texture; + } + + public static Texture2D WhiteTexture() { + Texture2D tex = new Texture2D(1, 1); + tex.SetPixel(0, 0, Color.white); + tex.Apply(); + return tex; + } + public static Texture2D GrayTexture() { + Texture2D tex = new Texture2D(1, 1); + tex.SetPixel(0, 0, Color.gray); + tex.Apply(); + return tex; + } + + public static Texture2D CreateDummyCheckerTexture() { + Texture2D texture = new Texture2D(2, 2); + Color col1 = Color.white; + Color col2 = new Color(0.9f, 0.9f, 0.9f, 1f); // very light grey + texture.SetPixel(0, 0, col1); + texture.SetPixel(1, 1, col1); + texture.SetPixel(0, 1, col2); + texture.SetPixel(1, 0, col2); + texture.filterMode = FilterMode.Point; + texture.Apply(); + return texture; + } + + public static Texture2D CreateDummyLineTexture() { + Texture2D texture = new Texture2D(2, 2); + Color col1 = Color.white; + Color col2 = new Color(0.9f, 0.9f, 0.9f, 1f); // very light grey + texture.SetPixel(0, 0, col1); + texture.SetPixel(1, 1, col2); + texture.SetPixel(0, 1, col1); + texture.SetPixel(1, 0, col2); + texture.filterMode = FilterMode.Point; + texture.Apply(); + return texture; + } + } +} \ No newline at end of file diff --git a/Assets/Scripts/Libraries/BinarySerializer.Unity/Helpers/TextureHelpers.cs.meta b/Assets/Scripts/Libraries/BinarySerializer.Unity/Helpers/TextureHelpers.cs.meta new file mode 100644 index 00000000..7ea0cb48 --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Unity/Helpers/TextureHelpers.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 5bfaad72685acd44893aec7072c42180 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Libraries/BinarySerializer.Unity/Helpers/Util.cs b/Assets/Scripts/Libraries/BinarySerializer.Unity/Helpers/Util.cs new file mode 100644 index 00000000..eaa6e8b7 --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Unity/Helpers/Util.cs @@ -0,0 +1,487 @@ +using BinarySerializer; +using Cysharp.Threading.Tasks; +using ImageMagick; +using System; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System.Text; +using UnityEngine; + +namespace BinarySerializer.Unity { + public static class Util { + public static bool ByteArrayToFile(string fileName, byte[] byteArray) { + if (byteArray == null) + return false; + + if (FileSystem.mode == FileSystem.Mode.Web) + return false; + + try { + Directory.CreateDirectory(Path.GetDirectoryName(fileName)); + + using var fs = new FileStream(fileName, FileMode.Create, FileAccess.Write); + fs.Write(byteArray, 0, byteArray.Length); + return true; + } catch (Exception ex) { + Console.WriteLine("Exception caught in process: {0}", ex); + return false; + } + } + + private static readonly string[] SizeSuffixes = { "bytes", "KB", "MB", "GB", "TB", "PB", "EB", "ZB", "YB" }; + + public static string SizeSuffix(long value, int decimalPlaces = 1) { + if (value < 0) + return "-" + SizeSuffix(-value); + + int i = 0; + decimal dValue = value; + while (Math.Round(dValue, decimalPlaces) >= 1000) { + dValue /= 1024; + i++; + } + + return string.Format("{0:n" + decimalPlaces + "} {1}", dValue, SizeSuffixes[i]); + } + + public static uint NextPowerOfTwo(uint v) { + v--; + v |= v >> 1; + v |= v >> 2; + v |= v >> 4; + v |= v >> 8; + v |= v >> 16; + v++; + return v; + } + + public static string NormalizePath(string path, bool isFolder) { + string newPath = path.Replace("\\", "/"); + + if (isFolder && !newPath.EndsWith("/")) + newPath += "/"; + + return newPath; + } + + // For debugging + public static void ExportPointerArray(SerializerObject s, string path, IEnumerable pointers) { + var p1 = pointers.Where(x => x != null).Distinct().OrderBy(x => x.AbsoluteOffset).ToArray(); + var output = new List(); + + for (int i = 0; i < p1.Length - 1; i++) { + var length = p1[i + 1] - p1[i]; + + s.DoAt(p1[i], () => output.Add($"{p1[i]}: byte[{length:000}] {String.Join(" ", s.SerializeArray(null, length).Select(x => x.ToString("X2")))}")); + } + + File.WriteAllLines(path, output); + } + + public static void CopyDir(string inputDir, string outputDir) { + foreach (string dirPath in Directory.GetDirectories(inputDir, "*", SearchOption.AllDirectories)) + Directory.CreateDirectory(dirPath.Replace(inputDir, outputDir)); + + foreach (string newPath in Directory.GetFiles(inputDir, "*.*", SearchOption.AllDirectories)) + File.Copy(newPath, newPath.Replace(inputDir, outputDir), true); + } + + public static void RenameFilesToUpper(string inputDir) { + foreach (var file in Directory.GetFiles(inputDir, "*", SearchOption.AllDirectories)) { + var dir = Path.GetDirectoryName(file); + var fileName = Path.GetFileName(file); + + // Move to temp name + var tempPath = Path.Combine(dir, $"TEMP_{fileName}"); + File.Move(file, tempPath); + + // Move to upper-case name + File.Move(tempPath, Path.Combine(dir, fileName.ToUpper())); + } + } + + public static void FindMatchingEncoding(params KeyValuePair[] input) { + if (input.Length < 2) + throw new Exception("Too few strings to check!"); + + // Get all possible encodings + var encodings = Encoding.GetEncodings().Select(x => Encoding.GetEncoding(x.CodePage)).ToArray(); + + // Keep a list of all matching ones + var matches = new List(); + + // Helper method for getting all matching encodings + IEnumerable GetMatches(KeyValuePair str) { + var m = encodings.Where(enc => enc.GetString(str.Value).Equals(str.Key, StringComparison.InvariantCultureIgnoreCase)).ToArray(); + Debug.Log($"Matching encodings for {str.Key}: {String.Join(", ", m.Select(x => $"{x.EncodingName} ({x.CodePage})"))}"); + return m; + } + + // Add matches for the first one + matches.AddRange(GetMatches(input.First())); + + // Check remaining ones, removing any which don't match + foreach (var str in input.Skip(1)) { + var ma = GetMatches(str); + matches.RemoveAll(x => !ma.Contains(x)); + } + + // Log the result + Debug.Log($"Matching encodings for all: {String.Join(", ", matches.Select(x => $"{x.EncodingName} ({x.CodePage})"))}"); + } + + public static Texture2D ToTileSetTexture(byte[] imgData, Color[] pal, TileEncoding encoding, int tileWidth, bool flipY, int wrap = 32, Func getPalFunc = null, bool flipTileX = false, bool flipTileY = false, bool flipX = false) { + int bpp; + + switch (encoding) { + case TileEncoding.Planar_2bpp: + bpp = 2; break; + case TileEncoding.Planar_4bpp: + case TileEncoding.Linear_4bpp: + case TileEncoding.Linear_4bpp_ReverseOrder: + bpp = 4; break; + case TileEncoding.Linear_8bpp: + case TileEncoding.Linear_8bpp_A3i5: + case TileEncoding.Linear_8bpp_A5i3: + bpp = 8; break; + default: + throw new ArgumentOutOfRangeException(nameof(encoding), encoding, null); + } + + int tileSize = tileWidth * tileWidth * bpp / 8; + int tilesetLength = imgData.Length / tileSize; + + int tilesX = Math.Min(tilesetLength, wrap); + int tilesY = Mathf.CeilToInt(tilesetLength / (float)wrap); + + var tex = TextureHelpers.CreateTexture2D(tilesX * tileWidth, tilesY * tileWidth); + + for (int i = 0; i < tilesetLength; i++) { + int tileY = ((i / wrap)) * tileWidth; + int tileX = (i % wrap) * tileWidth; + + tex.FillInTile( + imgData: imgData, + imgDataOffset: i * tileSize, + pal: getPalFunc?.Invoke(i) ?? pal, + encoding: encoding, + tileWidth: tileWidth, + flipTextureY: flipY, + flipTextureX: flipX, + tileX: tileX, + tileY: tileY, + flipTileX: flipTileX, + flipTileY: flipTileY); + } + + tex.Apply(); + + return tex; + } + + public static void FillInTile(this Texture2D tex, byte[] imgData, int imgDataOffset, Color[] pal, TileEncoding encoding, int tileWidth, bool flipTextureY, int tileX, int tileY, bool flipTileX = false, bool flipTileY = false, bool ignoreTransparent = false, bool flipTextureX = false) { + FillRegion(tex, imgData, imgDataOffset, pal, encoding, + tileX, tileY, tileWidth, tileWidth, + flipTextureX: flipTextureX, flipTextureY: flipTextureY, + flipRegionX: flipTileX, flipRegionY: flipTileY, + ignoreTransparent: ignoreTransparent); + } + + public static void FillRegion(this Texture2D tex, byte[] imgData, int imgDataOffset, + Color[] pal, TileEncoding encoding, + int regionX, int regionY, + int regionWidth, int regionHeight, + bool flipTextureX = false, bool flipTextureY = false, + bool flipRegionX = false, bool flipRegionY = false, + bool ignoreTransparent = false, Func paletteFunction = null) { + bool reverseOrder = (encoding == TileEncoding.Linear_4bpp_ReverseOrder); + + // Fill in tile pixels + for (int y = 0; y < regionHeight; y++) { + + var yy = regionY + y; + + if (flipTextureY) + yy = tex.height - yy - 1; + if (yy < 0 || yy >= tex.height) continue; + + for (int x = 0; x < regionWidth; x++) { + var xx = regionX + x; + + if (flipTextureX) + xx = tex.width - xx - 1; + + if (xx < 0 || xx >= tex.width) continue; + Color? c = null; + + if (encoding == TileEncoding.Linear_8bpp) { + int index = imgDataOffset + (((flipRegionY ? (regionHeight - y - 1) : y) * regionWidth + (flipRegionX ? (regionWidth - x - 1) : x))); + + var b = imgData[index]; + + c = paletteFunction != null ? paletteFunction.Invoke(b, xx, yy) : pal[b]; + } else if(encoding == TileEncoding.Linear_8bpp_A3i5 || encoding == TileEncoding.Linear_8bpp_A5i3) { + int index = imgDataOffset + (((flipRegionY ? (regionHeight - y - 1) : y) * regionWidth + (flipRegionX ? (regionWidth - x - 1) : x))); + var b = imgData[index]; + int al, ci, alMax; + + switch (encoding) { + case TileEncoding.Linear_8bpp_A3i5: + ci = BitHelpers.ExtractBits(b, 5, 0); + al = BitHelpers.ExtractBits(b, 3, 5); + alMax = 8; + break; + case TileEncoding.Linear_8bpp_A5i3: + ci = BitHelpers.ExtractBits(b, 3, 0); + al = BitHelpers.ExtractBits(b, 5, 3); + alMax = 32; + break; + default: + throw new NotImplementedException("Invalid tile encoding"); + } + c = paletteFunction != null ? paletteFunction.Invoke(ci, xx, yy) : pal[ci]; + c = new Color(c.Value.r, c.Value.g, c.Value.b, (float)al / (alMax - 1)); + } else if (encoding == TileEncoding.Linear_4bpp || encoding == TileEncoding.Linear_4bpp_ReverseOrder) { + int index = imgDataOffset + (((flipRegionY ? (regionHeight - y - 1) : y) * regionWidth + (flipRegionX ? (regionWidth - x - 1) : x)) / 2); + + var b = imgData[index]; + var v = (flipRegionX ^ reverseOrder) ? + BitHelpers.ExtractBits(b, 4, x % 2 == 1 ? 0 : 4) : + BitHelpers.ExtractBits(b, 4, x % 2 == 0 ? 0 : 4); + + c = paletteFunction != null ? paletteFunction.Invoke(v, xx, yy) : pal[v]; + } else if (encoding == TileEncoding.Planar_4bpp) { + int off = (flipRegionY ? (regionHeight - y - 1) : y) * regionWidth + (flipRegionX ? (regionWidth - x - 1) : x); + + var offset1 = imgDataOffset; + var offset2 = imgDataOffset + 16; + + var bit0 = BitHelpers.ExtractBits(imgData[offset1 + ((off / 8) * 2)], 1, off % 8); + var bit1 = BitHelpers.ExtractBits(imgData[offset1 + ((off / 8) * 2 + 1)], 1, off % 8); + var bit2 = BitHelpers.ExtractBits(imgData[offset2 + ((off / 8) * 2)], 1, off % 8); + var bit3 = BitHelpers.ExtractBits(imgData[offset2 + ((off / 8) * 2 + 1)], 1, off % 8); + + int b = 0; + + b = BitHelpers.SetBits(b, bit0, 1, 0); + b = BitHelpers.SetBits(b, bit1, 1, 1); + b = BitHelpers.SetBits(b, bit2, 1, 2); + b = BitHelpers.SetBits(b, bit3, 1, 3); + + c = paletteFunction != null ? paletteFunction.Invoke(b, xx, yy) : pal[b]; + } else if (encoding == TileEncoding.Planar_2bpp) { + int index = imgDataOffset + (((flipRegionY ? (regionHeight - y - 1) : y) * regionWidth + (flipRegionX ? (regionWidth - x - 1) : x)) / 8) * 2; + var b0 = imgData[index]; + var b1 = imgData[index + 1]; + int actualX = flipRegionX ? x : 7 - x; + var v = (BitHelpers.ExtractBits(b1, 1, actualX) << 1) | BitHelpers.ExtractBits(b0, 1, actualX); + + c = paletteFunction != null ? paletteFunction.Invoke(v, xx, yy) : pal[v]; + } else if (encoding == TileEncoding.Linear_32bpp_RGBA) { + int index = imgDataOffset + (((flipRegionY ? (regionHeight - y - 1) : y) * regionWidth + (flipRegionX ? (regionWidth - x - 1) : x))) * 4; + var r = imgData[index + 0]; + var g = imgData[index + 1]; + var b = imgData[index + 2]; + var a = imgData[index + 3]; + c = new Color(r / 255f, g / 255f, b / 255f, a / 255f); + } else if (encoding == TileEncoding.Linear_32bpp_BGRA) { + int index = imgDataOffset + (((flipRegionY ? (regionHeight - y - 1) : y) * regionWidth + (flipRegionX ? (regionWidth - x - 1) : x))) * 4; + var b = imgData[index + 0]; + var g = imgData[index + 1]; + var r = imgData[index + 2]; + var a = imgData[index + 3]; + c = new Color(r / 255f, g / 255f, b / 255f, a / 255f); + } else if (encoding == TileEncoding.Linear_16bpp_4444_ABGR) { + int index = imgDataOffset + (((flipRegionY ? (regionHeight - y - 1) : y) * regionWidth + (flipRegionX ? (regionWidth - x - 1) : x))) * 2; + var a = BitHelpers.ExtractBits(imgData[index + 0], 4, 0); + var b = BitHelpers.ExtractBits(imgData[index + 0], 4, 4); + var g = BitHelpers.ExtractBits(imgData[index + 1], 4, 0); + var r = BitHelpers.ExtractBits(imgData[index + 1], 4, 4); + c = new Color(r / 15f, g / 15f, b / 15f, a / 15f); + } else { + c = Color.clear; + } + + if (c.HasValue) { + if (!ignoreTransparent || c.Value.a > 0) { + tex.SetPixel(xx, yy, c.Value); + } + } + } + } + } + + public static Texture2D ToTileSetTexture(BaseColor[] imgData, int tileWidth, bool flipY, int wrap = 32) { + int tileSize = tileWidth * tileWidth; + int tilesetLength = imgData.Length / tileSize; + + int tilesX = Math.Min(tilesetLength, wrap); + int tilesY = Mathf.CeilToInt(tilesetLength / (float)wrap); + + var tex = TextureHelpers.CreateTexture2D(tilesX * tileWidth, tilesY * tileWidth); + + for (int i = 0; i < tilesetLength; i++) { + int tileY = ((i / wrap)) * tileWidth; + int tileX = (i % wrap) * tileWidth; + + tex.FillRegion(imgData, i * tileSize, tileX, tileY, tileWidth, tileWidth, flipTextureY: flipY); + } + + tex.Apply(); + + return tex; + } + + public static void FillRegion(this Texture2D tex, + BaseColor[] imgData, int imgDataOffset, + int regionX, int regionY, + int regionWidth, int regionHeight, + bool flipTextureX = false, bool flipTextureY = false, + bool flipRegionX = false, bool flipRegionY = false, + bool ignoreTransparent = false) { + // Fill in tile pixels + for (int y = 0; y < regionHeight; y++) { + + var yy = regionY + y; + + if (flipTextureY) + yy = tex.height - yy - 1; + if (yy < 0 || yy >= tex.height) continue; + + for (int x = 0; x < regionWidth; x++) { + var xx = regionX + x; + + if (flipTextureX) + xx = tex.width - xx - 1; + if (xx < 0 || xx >= tex.width) continue; + Color c; + + int index = imgDataOffset + + (((flipRegionY ? (regionHeight - y - 1) : y) * regionWidth + + (flipRegionX ? (regionWidth - x - 1) : x))); + c = imgData[index].GetColor(); + + if (!ignoreTransparent || c.a > 0) { + tex.SetPixel(xx, yy, c); + } + } + } + } + + public static Texture2D GetGridTex(int cellSize) { + var tex = TextureHelpers.CreateTexture2D(cellSize, cellSize); + + for (int y = 0; y < cellSize; y++) { + for (int x = 0; x < cellSize; x++) { + if (y == cellSize - 1 || x == cellSize - 1) + tex.SetPixel(x, y, new Color(1, 1, 1, 0.25f)); + else + tex.SetPixel(x, y, Color.clear); + } + } + + tex.Apply(); + + return tex; + } + + public static int GCF(int[] values) { + return values.Aggregate(GCF); + } + + public static int GCF(int a, int b) { + while (b != 0) { + int temp = b; + b = a % b; + a = temp; + } + return a; + } + + public static int LCM(int a, int b) { + return (a / GCF(a, b)) * b; + } + + public static int LCM(IList numbers, int i = 0) { + if (i + 2 == numbers.Count) + return LCM(numbers[i], numbers[i + 1]); + else + return LCM(numbers[i], LCM(numbers, i + 1)); + } + + public static IEnumerable Split(this T[] array, int length, int size) => Enumerable.Range(0, length).Select(x => array.Skip(size * x).Take(size).ToArray()); + + public enum TileEncoding { + Planar_2bpp, + Planar_4bpp, + Linear_4bpp, + Linear_4bpp_ReverseOrder, + Linear_8bpp, + Linear_8bpp_A3i5, + Linear_8bpp_A5i3, + Linear_32bpp_RGBA, + Linear_32bpp_BGRA, + Linear_16bpp_4444_ABGR, + } + + public static void ExportAnim(IList frames, int speed, bool center, bool saveAsGif, string outputDir, string primaryName, string secondaryName = null, Vector2Int[] frameOffsets = null, bool trim = true) { + if (saveAsGif) { + ExportAnimAsGif(frames, speed, center, trim, Path.Combine(outputDir, secondaryName != null + ? $"{primaryName} - {secondaryName}.gif" + : $"{primaryName}.gif"), + frameOffsets: frameOffsets); + } else { + var frameIndex = 0; + + foreach (var tex in frames) { + string path = secondaryName != null + ? Path.Combine(outputDir, $"{primaryName}", $"{secondaryName}", $"{frameIndex}.png") + : Path.Combine(outputDir, $"{primaryName}", $"{frameIndex}.png"); + + ByteArrayToFile(path, tex.EncodeToPNG()); + frameIndex++; + } + } + } + public static void ExportAnimAsGif(IList frames, int[] speeds, bool center, bool trim, string filePath, int frameRate = 60, Vector2Int[] frameOffsets = null, bool uniformSize = false, Gravity uniformGravity = Gravity.Northwest) { + if (frames.All(x => x == null)) + return; + + using var collection = new MagickImageCollection(); + + int index = 0; + + var maxWidth = frameOffsets == null ? frames.Max(x => x.width) : frames.Select((x, i) => x.width + frameOffsets[i].x).Max(); + var maxHeight = frameOffsets == null ? frames.Max(x => x.height) : frames.Select((x, i) => x.height + frameOffsets[i].y).Max(); + + foreach (var frameTex in frames) { + var img = frameTex.ToMagickImage(); + collection.Add(img); + collection[index].AnimationDelay = speeds[index]; + collection[index].AnimationTicksPerSecond = frameRate; + + if (frameOffsets != null) + collection[index].Extent(frameTex.width + frameOffsets[index].x, frameTex.height + frameOffsets[index].y, Gravity.Southeast, new MagickColor()); + + if (uniformSize) + collection[index].Extent(maxWidth, maxHeight, uniformGravity, new MagickColor()); + + if (center) + collection[index].Extent(maxWidth, maxHeight, Gravity.Center, new MagickColor()); + + if (trim) + collection[index].Trim(); + + collection[index].GifDisposeMethod = GifDisposeMethod.Background; + index++; + } + + // Save gif + Directory.CreateDirectory(Path.GetDirectoryName(filePath)); + collection.Write(filePath); + } + public static void ExportAnimAsGif(IList frames, int speed, bool center, bool trim, string filePath, int frameRate = 60, Vector2Int[] frameOffsets = null) => + ExportAnimAsGif(frames, Enumerable.Repeat(speed, frames.Count).ToArray(), center, trim, filePath, frameRate, frameOffsets); + } +} \ No newline at end of file diff --git a/Assets/Scripts/Libraries/BinarySerializer.Unity/Helpers/Util.cs.meta b/Assets/Scripts/Libraries/BinarySerializer.Unity/Helpers/Util.cs.meta new file mode 100644 index 00000000..70dfd3c7 --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Unity/Helpers/Util.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 8d657e0a471cb404db078ffa15e33a6c +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Libraries/BinarySerializer.Unity/IO.meta b/Assets/Scripts/Libraries/BinarySerializer.Unity/IO.meta new file mode 100644 index 00000000..e237d249 --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Unity/IO.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: eed6ee60fc482244b85d51a9aa07e138 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/OpenSpace/IO/FileSystem.cs b/Assets/Scripts/Libraries/BinarySerializer.Unity/IO/FileSystem.cs similarity index 55% rename from Assets/Scripts/OpenSpace/IO/FileSystem.cs rename to Assets/Scripts/Libraries/BinarySerializer.Unity/IO/FileSystem.cs index 6c0a3ea3..a8dd138c 100644 --- a/Assets/Scripts/OpenSpace/IO/FileSystem.cs +++ b/Assets/Scripts/Libraries/BinarySerializer.Unity/IO/FileSystem.cs @@ -6,12 +6,11 @@ using System.Linq; using System.Net; using System.Text; -using System.Threading.Tasks; using UnityEngine; using UnityEngine.Networking; -namespace OpenSpace { - public static class FileSystem { +namespace BinarySerializer.Unity { + public static class FileSystem { public enum Mode { Normal, Web } @@ -28,32 +27,32 @@ public BigFileEntry(int cacheLength, long fileLength) { private static Dictionary virtualFiles = new Dictionary(); private static Dictionary virtualBigFiles = new Dictionary(); private static Dictionary existingDirectories = new Dictionary(); - public static string serverAddress = "https://raym.app/data/raymap/"; + public static string serverAddress = "https://raym.app/data/raymap/"; - public static bool DirectoryExists(string path) { + public static bool DirectoryExists(string path) { if (path == null || path.Trim() == "") return false; if (FileSystem.mode == FileSystem.Mode.Web) { // || (Application.isEditor && UnityEditor.EditorUserBuildSettings.activeBuildTarget == UnityEditor.BuildTarget.WebGL)) { if (existingDirectories.ContainsKey(path) && existingDirectories[path] == true) return true; return false; } else { - return Directory.Exists(path); - } - } + return Directory.Exists(path); + } + } - public static bool FileExists(string path) { + public static bool FileExists(string path) { if (path == null || path.Trim() == "") return false; - if (FileSystem.mode == FileSystem.Mode.Web) { // || (Application.isEditor && UnityEditor.EditorUserBuildSettings.activeBuildTarget == UnityEditor.BuildTarget.WebGL)) { - return ((virtualFiles.ContainsKey(path) && virtualFiles[path] != null) || (virtualBigFiles.ContainsKey(path))); - } else { - if ((virtualFiles.ContainsKey(path) && virtualFiles[path] != null)) return true; + if (FileSystem.mode == FileSystem.Mode.Web) { // || (Application.isEditor && UnityEditor.EditorUserBuildSettings.activeBuildTarget == UnityEditor.BuildTarget.WebGL)) { + return ((virtualFiles.ContainsKey(path) && virtualFiles[path] != null) || (virtualBigFiles.ContainsKey(path))); + } else { + if (virtualFiles.ContainsKey(path) && virtualFiles[path] != null) return true; return File.Exists(path); - } - } + } + } - public static void AddVirtualFile(string path, byte[] data) { - virtualFiles[path] = data; - } - private static void AddVirtualBigFile(string path, long size, int cacheLength) { + public static void AddVirtualFile(string path, byte[] data) { + virtualFiles[path] = data; + } + public static void AddVirtualBigFile(string path, long size, int cacheLength) { virtualBigFiles[path] = new BigFileEntry(cacheLength, size); } @@ -61,27 +60,37 @@ public static Stream GetFileReadStream(string path) { if (path == null || path.Trim() == "") return null; if (FileSystem.mode == FileSystem.Mode.Web) { // || (Application.isEditor && UnityEditor.EditorUserBuildSettings.activeBuildTarget == UnityEditor.BuildTarget.WebGL)) { if (virtualFiles.ContainsKey(path)) { + if (virtualFiles[path] == null) throw new Exception("File does not exist: " + path); return new MemoryStream(virtualFiles[path]); } else if (virtualBigFiles.ContainsKey(path)) { return new PartialHttpStream(serverAddress + path, cacheLen: virtualBigFiles[path].cacheLength, length: virtualBigFiles[path].fileLength); - } else return null; - } else { - if (virtualFiles.ContainsKey(path)) { - return new MemoryStream(virtualFiles[path]); } else { - return File.OpenRead(path); + throw new Exception("File wasn't prepared: " + path); + //return null; } - } - } + } else { + return File.OpenRead(path); + } + } + + public static Stream GetFileWriteStream(string path, bool recreateOnWrite = true) { + if (path == null || path.Trim() == "") return null; + if (FileSystem.mode == FileSystem.Mode.Web) { // || (Application.isEditor && UnityEditor.EditorUserBuildSettings.activeBuildTarget == UnityEditor.BuildTarget.WebGL)) { + return null; // Can't write in web mode + } else { + return recreateOnWrite ? File.Create(path) : File.OpenWrite(path); + } + } - public static async UniTask DownloadFile(string path) { + public static async UniTask DownloadFile(string path) { if (virtualFiles.ContainsKey(path) && virtualFiles[path] != null) return; Debug.Log("Downloading " + path); - await MapLoader.WaitIfNecessary(); + await TimeController.WaitIfNecessary(); UnityWebRequest www = UnityWebRequest.Get(serverAddress + path); + try { await www.SendWebRequest(); - } catch(UnityWebRequestException) { + } catch (UnityWebRequestException) { } finally { if (www.result != UnityWebRequest.Result.Success) { Debug.Log(www.error); @@ -91,17 +100,17 @@ public static async UniTask DownloadFile(string path) { AddVirtualFile(path, www.downloadHandler.data); } } - } + } public static async UniTask CheckDirectory(string path) { if (existingDirectories.ContainsKey(path)) return; - await MapLoader.WaitIfNecessary(); + await TimeController.WaitIfNecessary(); if (FileSystem.mode == FileSystem.Mode.Web) { UnityWebRequest www = UnityWebRequest.Head(serverAddress + path + "/"); try { await www.SendWebRequest(); while (!www.isDone) { - await UniTask.WaitForEndOfFrame(); + await TimeController.WaitFrame(); } } catch (UnityWebRequestException) { } finally { @@ -122,11 +131,11 @@ public static async UniTask CheckDirectory(string path) { public static async UniTask InitBigFile(string path, int cacheLength) { UnityWebRequest www = UnityWebRequest.Head(serverAddress + path); - await MapLoader.WaitIfNecessary(); + await TimeController.WaitIfNecessary(); try { await www.SendWebRequest(); while (!www.isDone) { - await UniTask.WaitForEndOfFrame(); + await TimeController.WaitFrame(); } } catch (UnityWebRequestException) { } finally { @@ -139,25 +148,52 @@ public static async UniTask InitBigFile(string path, int cacheLength) { } } - public static long GetFileLength(string path) { - if (FileExists(path)) { - if (FileSystem.mode == FileSystem.Mode.Web) { + public static long GetFileLength(string path) { + if (FileExists(path)) { + if (FileSystem.mode == FileSystem.Mode.Web) { if (virtualFiles.ContainsKey(path)) { return virtualFiles[path].Length; } else if (virtualBigFiles.ContainsKey(path)) { return virtualBigFiles[path].fileLength; } else return 0; - } else { + } else { if (virtualFiles.ContainsKey(path)) { return virtualFiles[path].Length; } else { return new FileInfo(path).Length; } - } - } else { - return 0; - } - } + } + } else { + return 0; + } + } + + public static async UniTask PrepareFile(string path) { + if (FileSystem.mode == FileSystem.Mode.Web && !string.IsNullOrEmpty(path)) { + string state = GlobalLoadState.DetailedState; + GlobalLoadState.DetailedState = state + "\nDownloading file: " + path; + await FileSystem.DownloadFile(path); + GlobalLoadState.DetailedState = state; + await TimeController.WaitIfNecessary(); + } + } + public static async UniTask PrepareBigFile(string path, int cacheLength) { + if (FileSystem.mode == FileSystem.Mode.Web) { + string state = GlobalLoadState.DetailedState; + GlobalLoadState.DetailedState = state + "\nInitializing bigfile: " + path + " (Cache size: " + Util.SizeSuffix(cacheLength, 0) + ")"; + await FileSystem.InitBigFile(path, cacheLength); + GlobalLoadState.DetailedState = state; + await TimeController.WaitIfNecessary(); + } + } + + public static string GetFileNameWithoutExtensions(string path) { + return Path.GetFileName(path)?.Split('.').FirstOrDefault(); + } + + public static string ChangeFilePathExtension(string path, string newExtension) { + return path?.Split('.').FirstOrDefault() + newExtension; + } } } diff --git a/Assets/Scripts/OpenSpace/IO/FileSystem.cs.meta b/Assets/Scripts/Libraries/BinarySerializer.Unity/IO/FileSystem.cs.meta similarity index 83% rename from Assets/Scripts/OpenSpace/IO/FileSystem.cs.meta rename to Assets/Scripts/Libraries/BinarySerializer.Unity/IO/FileSystem.cs.meta index 48e2056e..b05e4a6c 100644 --- a/Assets/Scripts/OpenSpace/IO/FileSystem.cs.meta +++ b/Assets/Scripts/Libraries/BinarySerializer.Unity/IO/FileSystem.cs.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: f0fe66ace0760a241910e0faf44f2cec +guid: 5dc9bffe727d53a4fbee9843c188cf60 MonoImporter: externalObjects: {} serializedVersion: 2 diff --git a/Assets/Scripts/Libraries/BinarySerializer.Unity/IO/NonClosingStreamWrapper.cs b/Assets/Scripts/Libraries/BinarySerializer.Unity/IO/NonClosingStreamWrapper.cs new file mode 100644 index 00000000..e28a902e --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Unity/IO/NonClosingStreamWrapper.cs @@ -0,0 +1,338 @@ +#if ((UNITY_EDITOR_WIN || UNITY_STANDALONE_WIN) && !UNITY_WEBGL) +#define ISWINDOWS +#endif + +#if ((UNITY_EDITOR_LINUX || UNITY_STANDALONE_LINUX) && !UNITY_WEBGL) +#define ISLINUX +#endif + +using System; +using System.IO; +#if (ISWINDOWS || ISLINUX) +using System.Runtime.Remoting; +#endif +namespace BinarySerializer.Unity { + /// + /// Wraps a stream for all operations except Close and Dispose, which + /// merely flush the stream and prevent further operations from being + /// carried out using this wrapper. + /// + public sealed class NonClosingStreamWrapper : Stream { +#if (ISWINDOWS || ISLINUX) + #region Members specific to this wrapper class + /// + /// Creates a new instance of the class, wrapping the specified stream. + /// + /// The stream to wrap. Must not be null. + /// stream is null + public NonClosingStreamWrapper(Stream stream) { + if (stream == null) { + throw new ArgumentNullException("stream"); + } + this.stream = stream; + } + + Stream stream; + /// + /// Stream wrapped by this wrapper + /// + public Stream BaseStream { + get { return stream; } + } + + /// + /// Whether this stream has been closed or not + /// + bool closed = false; + + /// + /// Throws an InvalidOperationException if the wrapper is closed. + /// + void CheckClosed() { + if (closed) { + throw new InvalidOperationException("Wrapper has been closed or disposed"); + } + } + #endregion + + #region Overrides of Stream methods and properties + /// + /// Begins an asynchronous read operation. + /// + /// The buffer to read the data into. + /// + /// The byte offset in buffer at which to begin writing data read from the stream. + /// + /// The maximum number of bytes to read. + /// + /// An optional asynchronous callback, to be called when the read is complete. + /// + /// + /// A user-provided object that distinguishes this particular + /// asynchronous read request from other requests. + /// + /// + /// An IAsyncResult that represents the asynchronous read, + /// which could still be pending. + /// + public override IAsyncResult BeginRead(byte[] buffer, int offset, int count, + AsyncCallback callback, object state) { + CheckClosed(); + return stream.BeginRead(buffer, offset, count, callback, state); + } + + /// + /// Begins an asynchronous write operation. + /// + /// The buffer to write data from. + /// The byte offset in buffer from which to begin writing. + /// The maximum number of bytes to write. + /// + /// An optional asynchronous callback, to be called when the write is complete. + /// + /// + /// A user-provided object that distinguishes this particular asynchronous + /// write request from other requests. + /// + /// + /// An IAsyncResult that represents the asynchronous write, + /// which could still be pending. + /// + public override IAsyncResult BeginWrite(byte[] buffer, int offset, int count, + AsyncCallback callback, object state) { + CheckClosed(); + return stream.BeginWrite(buffer, offset, count, callback, state); + } + + /// + /// Indicates whether or not the underlying stream can be read from. + /// + public override bool CanRead { + get { return closed ? false : stream.CanRead; } + } + + /// + /// Indicates whether or not the underlying stream supports seeking. + /// + public override bool CanSeek { + get { return closed ? false : stream.CanSeek; } + } + + /// + /// Indicates whether or not the underlying stream can be written to. + /// + public override bool CanWrite { + get { return closed ? false : stream.CanWrite; } + } + + /// + /// This method is not proxied to the underlying stream; instead, the wrapper + /// is marked as unusable for other (non-close/Dispose) operations. The underlying + /// stream is flushed if the wrapper wasn't closed before this call. + /// + public override void Close() { + if (!closed) { + stream.Flush(); + } + closed = true; + } + + /// + /// Throws a NotSupportedException. + /// + /// The Type of the object that the new ObjRef will reference. + /// n/a + public override ObjRef CreateObjRef(Type requestedType) { + throw new NotSupportedException(); + } + + /// + /// Waits for the pending asynchronous read to complete. + /// + /// + /// The reference to the pending asynchronous request to finish. + /// + /// + /// The number of bytes read from the stream, between zero (0) + /// and the number of bytes you requested. Streams only return + /// zero (0) at the end of the stream, otherwise, they should + /// block until at least one byte is available. + /// + public override int EndRead(IAsyncResult asyncResult) { + CheckClosed(); + return stream.EndRead(asyncResult); + } + + /// + /// Ends an asynchronous write operation. + /// + /// A reference to the outstanding asynchronous I/O request. + public override void EndWrite(IAsyncResult asyncResult) { + CheckClosed(); + stream.EndWrite(asyncResult); + } + + /// + /// Flushes the underlying stream. + /// + public override void Flush() { + CheckClosed(); + stream.Flush(); + } + + /// + /// Throws a NotSupportedException. + /// + /// n/a + public override object InitializeLifetimeService() { + throw new NotSupportedException(); + } + + /// + /// Returns the length of the underlying stream. + /// + public override long Length { + get { + CheckClosed(); + return stream.Length; + } + } + + /// + /// Gets or sets the current position in the underlying stream. + /// + public override long Position { + get { + CheckClosed(); + return stream.Position; + } + set { + CheckClosed(); + stream.Position = value; + } + } + + /// + /// Reads a sequence of bytes from the underlying stream and advances the + /// position within the stream by the number of bytes read. + /// + /// + /// An array of bytes. When this method returns, the buffer contains + /// the specified byte array with the values between offset and + /// (offset + count- 1) replaced by the bytes read from the underlying source. + /// + /// + /// The zero-based byte offset in buffer at which to begin storing the data + /// read from the underlying stream. + /// + /// + /// The maximum number of bytes to be read from the + /// underlying stream. + /// + /// The total number of bytes read into the buffer. + /// This can be less than the number of bytes requested if that many + /// bytes are not currently available, or zero (0) if the end of the + /// stream has been reached. + /// + public override int Read(byte[] buffer, int offset, int count) { + CheckClosed(); + return stream.Read(buffer, offset, count); + } + + /// + /// Reads a byte from the stream and advances the position within the + /// stream by one byte, or returns -1 if at the end of the stream. + /// + /// The unsigned byte cast to an Int32, or -1 if at the end of the stream. + public override int ReadByte() { + CheckClosed(); + return stream.ReadByte(); + } + + /// + /// Sets the position within the current stream. + /// + /// A byte offset relative to the origin parameter. + /// + /// A value of type SeekOrigin indicating the reference + /// point used to obtain the new position. + /// + /// The new position within the underlying stream. + public override long Seek(long offset, SeekOrigin origin) { + CheckClosed(); + return stream.Seek(offset, origin); + } + + /// + /// Sets the length of the underlying stream. + /// + /// The desired length of the underlying stream in bytes. + public override void SetLength(long value) { + CheckClosed(); + stream.SetLength(value); + } + + /// + /// Writes a sequence of bytes to the underlying stream and advances + /// the current position within the stream by the number of bytes written. + /// + /// + /// An array of bytes. This method copies count bytes + /// from buffer to the underlying stream. + /// + /// + /// The zero-based byte offset in buffer at + /// which to begin copying bytes to the underlying stream. + /// + /// The number of bytes to be written to the underlying stream. + public override void Write(byte[] buffer, int offset, int count) { + CheckClosed(); + stream.Write(buffer, offset, count); + } + + /// + /// Writes a byte to the current position in the stream and + /// advances the position within the stream by one byte. + /// + /// The byte to write to the stream. + public override void WriteByte(byte value) { + CheckClosed(); + stream.WriteByte(value); + } + #endregion +#else + public NonClosingStreamWrapper(Stream stream) { + } + + public override bool CanRead => throw new NotImplementedException(); + + public override bool CanSeek => throw new NotImplementedException(); + + public override bool CanWrite => throw new NotImplementedException(); + + public override long Length => throw new NotImplementedException(); + + public override long Position { get => throw new NotImplementedException(); set => throw new NotImplementedException(); } + + public override void Flush() { + throw new NotImplementedException(); + } + + public override int Read(byte[] buffer, int offset, int count) { + throw new NotImplementedException(); + } + + public override long Seek(long offset, SeekOrigin origin) { + throw new NotImplementedException(); + } + + public override void SetLength(long value) { + throw new NotImplementedException(); + } + + public override void Write(byte[] buffer, int offset, int count) { + throw new NotImplementedException(); + } +#endif + } +} diff --git a/Assets/Scripts/Libraries/BinarySerializer.Unity/IO/NonClosingStreamWrapper.cs.meta b/Assets/Scripts/Libraries/BinarySerializer.Unity/IO/NonClosingStreamWrapper.cs.meta new file mode 100644 index 00000000..0b33b11d --- /dev/null +++ b/Assets/Scripts/Libraries/BinarySerializer.Unity/IO/NonClosingStreamWrapper.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 15a90dd67025a974ca655a6077d2d41c +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/OpenSpace/IO/PartialHttpStream.cs b/Assets/Scripts/Libraries/BinarySerializer.Unity/IO/PartialHttpStream.cs similarity index 98% rename from Assets/Scripts/OpenSpace/IO/PartialHttpStream.cs rename to Assets/Scripts/Libraries/BinarySerializer.Unity/IO/PartialHttpStream.cs index f3f3e819..936cc58f 100644 --- a/Assets/Scripts/OpenSpace/IO/PartialHttpStream.cs +++ b/Assets/Scripts/Libraries/BinarySerializer.Unity/IO/PartialHttpStream.cs @@ -8,7 +8,7 @@ using UnityEngine; using UnityEngine.Networking; -namespace OpenSpace { +namespace BinarySerializer.Unity { public class PartialHttpStream : Stream, IDisposable { private SortedList caches; private const int CacheLen = 8192; @@ -262,7 +262,7 @@ private void AddCache(long position, byte[] cache) { public async UniTask FillCacheForRead(long count) { if (count <= 0) return; - await MapLoader.WaitIfNecessary(); + await TimeController.WaitIfNecessary(); // Try to read parts from cache long lastPosition = Position; @@ -368,15 +368,15 @@ public async UniTask FillCacheForRead(long count) { private async UniTask HttpRead(byte[] buffer, int offset, int count, long startPosition) { HttpRequestsCount++; UnityWebRequest www = UnityWebRequest.Get(Url); - string state = MapLoader.Loader.loadingState; + string state = GlobalLoadState.DetailedState; int totalSize = caches.Sum(c => c.Value.Length); - MapLoader.Loader.loadingState = state + "\nDownloading part of bigfile: " + Url.Replace(FileSystem.serverAddress, "") + " (New size: " + Util.SizeSuffix(totalSize + count, 0) + "/" + Util.SizeSuffix(Length, 0) + ")"; + GlobalLoadState.DetailedState = state + "\nDownloading part of bigfile: " + Url.Replace(FileSystem.serverAddress, "") + " (New size: " + Util.SizeSuffix(totalSize + count, 0) + "/" + Util.SizeSuffix(Length, 0) + ")"; UnityEngine.Debug.Log("Requesting range: " + string.Format("bytes={0}-{1}", startPosition, startPosition + count - 1) + " - " + Url); www.SetRequestHeader("Range", string.Format("bytes={0}-{1}", startPosition, startPosition + count - 1)); try { await www.SendWebRequest(); while (!www.isDone) { - await UniTask.WaitForEndOfFrame(); + await TimeController.WaitFrame(); } } catch (UnityWebRequestException) { } finally { @@ -390,7 +390,7 @@ private async UniTask HttpRead(byte[] buffer, int offset, int count, long startP } } - MapLoader.Loader.loadingState = state; + GlobalLoadState.DetailedState = state; /*using (BinaryReader sr = new BinaryReader(httpResponse.GetResponseStream(), Encoding.GetEncoding(httpResponse.CharacterSet))) { sr.ReadBlock(buffer, offset, count); }*/ diff --git a/Assets/Scripts/OpenSpace/IO/PartialHttpStream.cs.meta b/Assets/Scripts/Libraries/BinarySerializer.Unity/IO/PartialHttpStream.cs.meta similarity index 83% rename from Assets/Scripts/OpenSpace/IO/PartialHttpStream.cs.meta rename to Assets/Scripts/Libraries/BinarySerializer.Unity/IO/PartialHttpStream.cs.meta index e5246ca9..9dfa90a1 100644 --- a/Assets/Scripts/OpenSpace/IO/PartialHttpStream.cs.meta +++ b/Assets/Scripts/Libraries/BinarySerializer.Unity/IO/PartialHttpStream.cs.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: 95cdcc320f28e17458f3377db2bededa +guid: 7d6bb5a5f65aee34d89fd9d0e0cf2658 MonoImporter: externalObjects: {} serializedVersion: 2 diff --git a/Assets/Scripts/Libraries/CPAScriptSerializer.meta b/Assets/Scripts/Libraries/CPAScriptSerializer.meta new file mode 100644 index 00000000..5aee76bb --- /dev/null +++ b/Assets/Scripts/Libraries/CPAScriptSerializer.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: c5f952b9926de79478b4e0d89b257028 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Libraries/CPAScriptSerializer/CPAScript.cs b/Assets/Scripts/Libraries/CPAScriptSerializer/CPAScript.cs new file mode 100644 index 00000000..8e31d278 --- /dev/null +++ b/Assets/Scripts/Libraries/CPAScriptSerializer/CPAScript.cs @@ -0,0 +1,131 @@ +using System; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace CPAScriptSerializer { + /* + #define SCR_CC_c_Cfg_NameSeparator '^' + #define SCR_CC_sz_Cfg_NameSeparator "^" + #define SCR_CC_c_Cfg_SectionBegMark '{' + #define SCR_CC_c_Cfg_SectionEndMark '}' + #define SCR_CC_c_Cfg_SectionIdMark ':' + #define SCR_CC_sz_Cfg_SectionIdMark ":" + #define SCR_CC_c_Cfg_DirectiveMark '$' + #define SCR_CC_c_Cfg_CommentMark ';' + #define SCR_CC_c_Cfg_CommentMark1 '#' + #define SCR_CC_c_Cfg_ParamSeparator ',' + #define SCR_CC_c_Cfg_FormatBegMark '[' + #define SCR_CC_c_Cfg_PostFormatBegMark ';' + #define SCR_CC_c_Cfg_PostFormatEndMark ';' + #define SCR_CC_c_Cfg_FormatEndMark ']' + #define SCR_CC_c_Cfg_ParamBegMark '(' + #define SCR_CC_c_Cfg_ParamEndMark ')' + #define SCR_CC_c_Cfg_StringMark '"' + #define SCR_CC_c_Cfg_VarMark '@' + #define SCR_CC_C_Cfg_NoChar '\0' + #define SCR_CC_C_Cfg_EOL '\n' + #define SCR_CC_C_Cfg_EmptyParameter 0x01 + + * Format specifiers/ + * 'F' for Format. + #define SCR_CF_c_Cfg_ScanfSeparator ',' + #define SCR_CF_c_Cfg_FormatArray 'a' + #define SCR_CF_c_Cfg_FormatArrayByte 'c' + #define SCR_CF_c_Cfg_FormatArrayShort 'w' + #define SCR_CF_c_Cfg_FormatArrayLong 'l' + #define SCR_CF_c_Cfg_FormatArrayInt 'i' + #define SCR_CF_c_Cfg_FormatArrayFloat 'f' + #define SCR_CF_c_Cfg_FormatArrayDouble 'd' + #define SCR_CF_c_Cfg_FormatArrayBoolean 'b' + #define SCR_CF_c_Cfg_FormatArrayDisEna 'e' + #define SCR_CF_c_Cfg_FormatArrayReferences 'r' + #define SCR_CF_c_Cfg_FormatScanf '%' + */ + + /// + /// The SCR module in CPA allows for parsing and writing of scripts using a system of callbacks + /// Each module can register callbacks + /// Each line is read in SCR_Pars.c, fn_i_Pars_Line + /// + + public abstract class CPAScript + { + + public const char MarkSectionBegin = '{'; + public const char MarkSectionEnd = '}'; + public const char MarkSectionId = ':'; + public const char MarkDirective = '$'; + public const char MarkComment = ';'; + + public List Items; + + public abstract CPAScriptSection GenerateSection(string sectionType, string sectionId); + + public void Read(Stream s) + { + using StreamReader reader = new StreamReader(s); + while (!reader.EndOfStream) { + ParseLine(reader.ReadLine(), reader); + } + } + + public void Write(Stream s) + { + using StreamWriter writer = new StreamWriter(s); + + foreach (var item in Items) { + item.Write(writer); + } + + writer.Flush(); + writer.Close(); + } + + private void ParseLine(string line, StreamReader reader) + { + if (string.IsNullOrWhiteSpace(line)) { + return; + } + switch (line[0]) { + case MarkSectionBegin: + + // A section has a type and an ID, e.g. {InputAction:ReinitTheMap + int sectionIdChar = line.IndexOf(MarkSectionId); + + string sectionType = (sectionIdChar > 0) ? line[1 .. sectionIdChar] : line[1..]; + string sectionId = (sectionIdChar > 0) ? line[(sectionIdChar+1) ..] : string.Empty; + + // Read all the lines for this section in advance + List sectionLines = new List(); + + string sectionLine = reader.ReadLine(); + while (sectionLine != null && sectionLine[0] != MarkSectionEnd) { + sectionLines.Add(sectionLine); + } + + var section = GenerateSection(sectionType, sectionId); + section.Parse(sectionLines.ToArray()); + + break; + + case MarkDirective: + var directive = new CPAScriptDirective(); + directive.Read(line); + Items.Add(directive); + + break; + case MarkComment: + + var comment = new CPAScriptComment(); + comment.Read(line); + Items.Add(comment); + + break; + default: break; + } + } + } +} diff --git a/Assets/Scripts/Libraries/CPAScriptSerializer/CPAScript.cs.meta b/Assets/Scripts/Libraries/CPAScriptSerializer/CPAScript.cs.meta new file mode 100644 index 00000000..b5622e34 --- /dev/null +++ b/Assets/Scripts/Libraries/CPAScriptSerializer/CPAScript.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: f0856e90edfa6fd49aaf0cc608be7f8a +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Libraries/CPAScriptSerializer/CPAScriptComment.cs b/Assets/Scripts/Libraries/CPAScriptSerializer/CPAScriptComment.cs new file mode 100644 index 00000000..52dba0b4 --- /dev/null +++ b/Assets/Scripts/Libraries/CPAScriptSerializer/CPAScriptComment.cs @@ -0,0 +1,22 @@ +using System; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace CPAScriptSerializer { + public class CPAScriptComment : CPAScriptItem + { + public string Comment; + public void Read(string line) + { + Comment = line; + } + + public override void Write(StreamWriter writer) + { + writer.Write(Comment); + } + } +} diff --git a/Assets/Scripts/Libraries/CPAScriptSerializer/CPAScriptComment.cs.meta b/Assets/Scripts/Libraries/CPAScriptSerializer/CPAScriptComment.cs.meta new file mode 100644 index 00000000..d4df4b31 --- /dev/null +++ b/Assets/Scripts/Libraries/CPAScriptSerializer/CPAScriptComment.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 2b033d528364dac4dbe4b67769408051 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Libraries/CPAScriptSerializer/CPAScriptDirective.cs b/Assets/Scripts/Libraries/CPAScriptSerializer/CPAScriptDirective.cs new file mode 100644 index 00000000..0a059bd3 --- /dev/null +++ b/Assets/Scripts/Libraries/CPAScriptSerializer/CPAScriptDirective.cs @@ -0,0 +1,22 @@ +using System; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace CPAScriptSerializer { + public class CPAScriptDirective : CPAScriptItem + { + public string Directive; + public void Read(string line) + { + Directive = line; + } + + public override void Write(StreamWriter writer) + { + writer.Write(Directive); + } + } +} diff --git a/Assets/Scripts/Libraries/CPAScriptSerializer/CPAScriptDirective.cs.meta b/Assets/Scripts/Libraries/CPAScriptSerializer/CPAScriptDirective.cs.meta new file mode 100644 index 00000000..589d6ce0 --- /dev/null +++ b/Assets/Scripts/Libraries/CPAScriptSerializer/CPAScriptDirective.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: cca24ea94570d584da27d24ee63d6299 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Libraries/CPAScriptSerializer/CPAScriptItem.cs b/Assets/Scripts/Libraries/CPAScriptSerializer/CPAScriptItem.cs new file mode 100644 index 00000000..53502722 --- /dev/null +++ b/Assets/Scripts/Libraries/CPAScriptSerializer/CPAScriptItem.cs @@ -0,0 +1,13 @@ +using System; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace CPAScriptSerializer { + public abstract class CPAScriptItem + { + public abstract void Write(StreamWriter writer); + } +} diff --git a/Assets/Scripts/Libraries/CPAScriptSerializer/CPAScriptItem.cs.meta b/Assets/Scripts/Libraries/CPAScriptSerializer/CPAScriptItem.cs.meta new file mode 100644 index 00000000..e2dcabdf --- /dev/null +++ b/Assets/Scripts/Libraries/CPAScriptSerializer/CPAScriptItem.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 05bd127359b00b647ae32efd82c399df +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Libraries/CPAScriptSerializer/CPAScriptSection.cs b/Assets/Scripts/Libraries/CPAScriptSerializer/CPAScriptSection.cs new file mode 100644 index 00000000..c0c750ff --- /dev/null +++ b/Assets/Scripts/Libraries/CPAScriptSerializer/CPAScriptSection.cs @@ -0,0 +1,33 @@ +using System; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace CPAScriptSerializer { + public abstract class CPAScriptSection : CPAScriptItem + { + public abstract string SectionType { get; } + public readonly string SectionId; + + public CPAScriptSection(string sectionId) + { + SectionId = sectionId; + } + + public void Parse(string[] lines) + { + + } + + public override void Write(StreamWriter writer) + { + writer.WriteLine($"{CPAScript.MarkSectionBegin}{SectionType}:{SectionId}"); + WriteContent(writer); + writer.WriteLine(CPAScript.MarkSectionEnd); + } + + public abstract void WriteContent(StreamWriter writer); + } +} diff --git a/Assets/Scripts/Libraries/CPAScriptSerializer/CPAScriptSection.cs.meta b/Assets/Scripts/Libraries/CPAScriptSerializer/CPAScriptSection.cs.meta new file mode 100644 index 00000000..0506dbd6 --- /dev/null +++ b/Assets/Scripts/Libraries/CPAScriptSerializer/CPAScriptSection.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 848ae3f100275fa44a9849ba3ddc0a87 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Libraries/CPAScriptSerializer/IPT.meta b/Assets/Scripts/Libraries/CPAScriptSerializer/IPT.meta new file mode 100644 index 00000000..6b9e69fd --- /dev/null +++ b/Assets/Scripts/Libraries/CPAScriptSerializer/IPT.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 3c8525d306081124eb1391e4088c8bc4 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Libraries/CPAScriptSerializer/IPT/CPAScriptSection_InputAction.cs b/Assets/Scripts/Libraries/CPAScriptSerializer/IPT/CPAScriptSection_InputAction.cs new file mode 100644 index 00000000..98f5b33d --- /dev/null +++ b/Assets/Scripts/Libraries/CPAScriptSerializer/IPT/CPAScriptSection_InputAction.cs @@ -0,0 +1,13 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace CPAScriptSerializer.IPT { + public class CPAScriptSection_InputAction : CPAScriptSection { + + public CPAScriptSection_InputAction(string sectionId) : base(sectionId) { } + public override string SectionType => "InputAction"; + } +} diff --git a/Assets/Scripts/Libraries/CPAScriptSerializer/IPT/CPAScriptSection_InputAction.cs.meta b/Assets/Scripts/Libraries/CPAScriptSerializer/IPT/CPAScriptSection_InputAction.cs.meta new file mode 100644 index 00000000..0a487483 --- /dev/null +++ b/Assets/Scripts/Libraries/CPAScriptSerializer/IPT/CPAScriptSection_InputAction.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: da7f3d5eceb1b864d8e3d8cc5f42128c +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Libraries/CPAScriptSerializer/IPT/CPAScript_IPT.cs b/Assets/Scripts/Libraries/CPAScriptSerializer/IPT/CPAScript_IPT.cs new file mode 100644 index 00000000..00ff19ed --- /dev/null +++ b/Assets/Scripts/Libraries/CPAScriptSerializer/IPT/CPAScript_IPT.cs @@ -0,0 +1,21 @@ +using System; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace CPAScriptSerializer.IPT { + + public class CPAScript_IPT : CPAScript { + + public override CPAScriptSection GenerateSection(string sectionType, string sectionId) + { + switch (sectionType) { + case "InputAction": return new CPAScriptSection_InputAction(sectionType, sectionId); break; + } + + throw new ArgumentException($"Unknown section type {sectionType}"); + } + } +} diff --git a/Assets/Scripts/Libraries/CPAScriptSerializer/IPT/CPAScript_IPT.cs.meta b/Assets/Scripts/Libraries/CPAScriptSerializer/IPT/CPAScript_IPT.cs.meta new file mode 100644 index 00000000..42b50408 --- /dev/null +++ b/Assets/Scripts/Libraries/CPAScriptSerializer/IPT/CPAScript_IPT.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 6bd1b12319278d44fbcae109472b9e71 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Libraries/CPAScriptSerializer/SND.meta b/Assets/Scripts/Libraries/CPAScriptSerializer/SND.meta new file mode 100644 index 00000000..4a923edb --- /dev/null +++ b/Assets/Scripts/Libraries/CPAScriptSerializer/SND.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 299269d6e86caa047baba93b77cf6e3b +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Libraries/CPAScriptSerializer/SND/CPAScript_LCB.cs b/Assets/Scripts/Libraries/CPAScriptSerializer/SND/CPAScript_LCB.cs new file mode 100644 index 00000000..1eefffd8 --- /dev/null +++ b/Assets/Scripts/Libraries/CPAScriptSerializer/SND/CPAScript_LCB.cs @@ -0,0 +1,10 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace CPAScriptSerializer.SND { + public class CPAScript_LCB : CPAScript{ + } +} diff --git a/Assets/Scripts/Libraries/CPAScriptSerializer/SND/CPAScript_LCB.cs.meta b/Assets/Scripts/Libraries/CPAScriptSerializer/SND/CPAScript_LCB.cs.meta new file mode 100644 index 00000000..9cf62419 --- /dev/null +++ b/Assets/Scripts/Libraries/CPAScriptSerializer/SND/CPAScript_LCB.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 5fa48355c172d8040a69a91f04aaeda5 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Libraries/CPAScriptSerializer/Section.cs b/Assets/Scripts/Libraries/CPAScriptSerializer/Section.cs new file mode 100644 index 00000000..7ce483a3 --- /dev/null +++ b/Assets/Scripts/Libraries/CPAScriptSerializer/Section.cs @@ -0,0 +1,11 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace CPAScriptSerializer { + public abstract class Section { + + } +} diff --git a/Assets/Scripts/Libraries/CPAScriptSerializer/Section.cs.meta b/Assets/Scripts/Libraries/CPAScriptSerializer/Section.cs.meta new file mode 100644 index 00000000..f800c6ab --- /dev/null +++ b/Assets/Scripts/Libraries/CPAScriptSerializer/Section.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 90679d1fe8063e844b2999287d9c3052 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Libraries/Libraries.asmdef b/Assets/Scripts/Libraries/Libraries.asmdef index 52b66b9d..f5cc4bd9 100644 --- a/Assets/Scripts/Libraries/Libraries.asmdef +++ b/Assets/Scripts/Libraries/Libraries.asmdef @@ -1,9 +1,9 @@ { "name": "Libraries", + "rootNamespace": "", "references": [ - "GUID:4f52b4f57e145e14b9565734592d9832" + "GUID:f51ebe6a0ceec4240a699833d6309b23" ], - "optionalUnityReferences": [], "includePlatforms": [], "excludePlatforms": [], "allowUnsafeCode": false, @@ -11,5 +11,6 @@ "precompiledReferences": [], "autoReferenced": true, "defineConstraints": [], - "versionDefines": [] + "versionDefines": [], + "noEngineReferences": false } \ No newline at end of file diff --git a/Assets/Scripts/Libraries/UnityConverters/Helpers/NullableAttributes.cs b/Assets/Scripts/Libraries/UnityConverters/Helpers/NullableAttributes.cs deleted file mode 100644 index 4ee3f599..00000000 --- a/Assets/Scripts/Libraries/UnityConverters/Helpers/NullableAttributes.cs +++ /dev/null @@ -1,152 +0,0 @@ -#pragma warning disable MA0048 // File name must match type name -#define INTERNAL_NULLABLE_ATTRIBUTES -#if NET_STANDARD_2_0 || NET_4_6 || NET_2_0 || NET_2_0_SUBSET || NET_LEGACY - -// https://github.com/dotnet/corefx/blob/48363ac826ccf66fbe31a5dcb1dc2aab9a7dd768/src/Common/src/CoreLib/System/Diagnostics/CodeAnalysis/NullableAttributes.cs - -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -namespace System.Diagnostics.CodeAnalysis -{ - /// Specifies that null is allowed as an input even if the corresponding type disallows it. - [AttributeUsage(AttributeTargets.Field | AttributeTargets.Parameter | AttributeTargets.Property, Inherited = false)] -#if INTERNAL_NULLABLE_ATTRIBUTES - internal -#else - public -#endif - sealed class AllowNullAttribute : Attribute - { } - - /// Specifies that null is disallowed as an input even if the corresponding type allows it. - [AttributeUsage(AttributeTargets.Field | AttributeTargets.Parameter | AttributeTargets.Property, Inherited = false)] -#if INTERNAL_NULLABLE_ATTRIBUTES - internal -#else - public -#endif - sealed class DisallowNullAttribute : Attribute - { } - - /// Specifies that an output may be null even if the corresponding type disallows it. - [AttributeUsage(AttributeTargets.Field | AttributeTargets.Parameter | AttributeTargets.Property | AttributeTargets.ReturnValue, Inherited = false)] -#if INTERNAL_NULLABLE_ATTRIBUTES - internal -#else - public -#endif - sealed class MaybeNullAttribute : Attribute - { } - - /// Specifies that an output will not be null even if the corresponding type allows it. - [AttributeUsage(AttributeTargets.Field | AttributeTargets.Parameter | AttributeTargets.Property | AttributeTargets.ReturnValue, Inherited = false)] -#if INTERNAL_NULLABLE_ATTRIBUTES - internal -#else - public -#endif - sealed class NotNullAttribute : Attribute - { } - - /// Specifies that when a method returns , the parameter may be null even if the corresponding type disallows it. - [AttributeUsage(AttributeTargets.Parameter, Inherited = false)] -#if INTERNAL_NULLABLE_ATTRIBUTES - internal -#else - public -#endif - sealed class MaybeNullWhenAttribute : Attribute - { - /// Initializes the attribute with the specified return value condition. - /// - /// The return value condition. If the method returns this value, the associated parameter may be null. - /// - public MaybeNullWhenAttribute(bool returnValue) - { - ReturnValue = returnValue; - } - - /// Gets the return value condition. - public bool ReturnValue { get; } - } - - /// Specifies that when a method returns , the parameter will not be null even if the corresponding type allows it. - [AttributeUsage(AttributeTargets.Parameter, Inherited = false)] -#if INTERNAL_NULLABLE_ATTRIBUTES - internal -#else - public -#endif - sealed class NotNullWhenAttribute : Attribute - { - /// Initializes the attribute with the specified return value condition. - /// - /// The return value condition. If the method returns this value, the associated parameter will not be null. - /// - public NotNullWhenAttribute(bool returnValue) - { - ReturnValue = returnValue; - } - - /// Gets the return value condition. - public bool ReturnValue { get; } - } - - /// Specifies that the output will be non-null if the named parameter is non-null. - [AttributeUsage(AttributeTargets.Parameter | AttributeTargets.Property | AttributeTargets.ReturnValue, AllowMultiple = true, Inherited = false)] -#if INTERNAL_NULLABLE_ATTRIBUTES - internal -#else - public -#endif - sealed class NotNullIfNotNullAttribute : Attribute - { - /// Initializes the attribute with the associated parameter name. - /// - /// The associated parameter name. The output will be non-null if the argument to the parameter specified is non-null. - /// - public NotNullIfNotNullAttribute(string parameterName) - { - ParameterName = parameterName; - } - - /// Gets the associated parameter name. - public string ParameterName { get; } - } - - /// Applied to a method that will never return under any circumstance. - [AttributeUsage(AttributeTargets.Method, Inherited = false)] -#if INTERNAL_NULLABLE_ATTRIBUTES - internal -#else - public -#endif - sealed class DoesNotReturnAttribute : Attribute - { } - - /// Specifies that the method will not return if the associated Boolean parameter is passed the specified value. - [AttributeUsage(AttributeTargets.Parameter, Inherited = false)] -#if INTERNAL_NULLABLE_ATTRIBUTES - internal -#else - public -#endif - sealed class DoesNotReturnIfAttribute : Attribute - { - /// Initializes the attribute with the specified parameter value. - /// - /// The condition parameter value. Code after the method will be considered unreachable by diagnostics if the argument to - /// the associated parameter matches this value. - /// - public DoesNotReturnIfAttribute(bool parameterValue) - { - ParameterValue = parameterValue; - } - - /// Gets the condition parameter value. - public bool ParameterValue { get; } - } -} -#endif diff --git a/Assets/Scripts/OpenSpace/AI/AIModel.cs b/Assets/Scripts/OpenSpace/AI/AIModel.cs index ca0ab821..8457749c 100644 --- a/Assets/Scripts/OpenSpace/AI/AIModel.cs +++ b/Assets/Scripts/OpenSpace/AI/AIModel.cs @@ -6,10 +6,10 @@ namespace OpenSpace.AI { public class AIModel : OpenSpaceStruct { - public Pointer off_behaviors_normal; - public Pointer off_behaviors_reflex; - public Pointer off_dsgVar; - public Pointer off_macros; + public LegacyPointer off_behaviors_normal; + public LegacyPointer off_behaviors_reflex; + public LegacyPointer off_dsgVar; + public LegacyPointer off_macros; public uint flags; public Behavior[] behaviors_normal = null; @@ -23,22 +23,22 @@ protected override void ReadInternal(Reader reader) { MapLoader l = MapLoader.Loader; l.aiModels.Add(this); //l.print("AIModel @ " + Offset); - off_behaviors_normal = Pointer.Read(reader); - off_behaviors_reflex = Pointer.Read(reader); - off_dsgVar = Pointer.Read(reader); - if (Settings.s.engineVersion >= Settings.EngineVersion.R2) { - off_macros = Pointer.Read(reader); + off_behaviors_normal = LegacyPointer.Read(reader); + off_behaviors_reflex = LegacyPointer.Read(reader); + off_dsgVar = LegacyPointer.Read(reader); + if (Legacy_Settings.s.engineVersion >= Legacy_Settings.EngineVersion.R2) { + off_macros = LegacyPointer.Read(reader); flags = reader.ReadUInt32(); } - Pointer.DoAt(ref reader, off_behaviors_normal, () => { - Pointer off_entries = Pointer.Read(reader); + LegacyPointer.DoAt(ref reader, off_behaviors_normal, () => { + LegacyPointer off_entries = LegacyPointer.Read(reader); uint num_entries = reader.ReadUInt32(); behaviors_normal = new Behavior[num_entries]; if (num_entries > 0) { - Pointer.DoAt(ref reader, off_entries, () => { + LegacyPointer.DoAt(ref reader, off_entries, () => { for (int i = 0; i < num_entries; i++) { - behaviors_normal[i] = l.FromOffsetOrRead(reader, Pointer.Current(reader), inline: true); + behaviors_normal[i] = l.FromOffsetOrRead(reader, LegacyPointer.Current(reader), inline: true); behaviors_normal[i].type = Behavior.BehaviorType.Intelligence; behaviors_normal[i].aiModel = this; behaviors_normal[i].index = i; @@ -46,14 +46,14 @@ protected override void ReadInternal(Reader reader) { }); } }); - Pointer.DoAt(ref reader, off_behaviors_reflex, () => { - Pointer off_entries = Pointer.Read(reader); + LegacyPointer.DoAt(ref reader, off_behaviors_reflex, () => { + LegacyPointer off_entries = LegacyPointer.Read(reader); uint num_entries = reader.ReadUInt32(); behaviors_reflex = new Behavior[num_entries]; if (num_entries > 0) { - Pointer.DoAt(ref reader, off_entries, () => { + LegacyPointer.DoAt(ref reader, off_entries, () => { for (int i = 0; i < num_entries; i++) { - behaviors_reflex[i] = l.FromOffsetOrRead(reader, Pointer.Current(reader), inline: true); + behaviors_reflex[i] = l.FromOffsetOrRead(reader, LegacyPointer.Current(reader), inline: true); behaviors_reflex[i].type = Behavior.BehaviorType.Reflex; behaviors_reflex[i].aiModel = this; behaviors_reflex[i].index = i; @@ -64,17 +64,17 @@ protected override void ReadInternal(Reader reader) { dsgVar = l.FromOffsetOrRead(reader, off_dsgVar); - Pointer.DoAt(ref reader, off_macros, () => { - Pointer off_entries = Pointer.Read(reader); + LegacyPointer.DoAt(ref reader, off_macros, () => { + LegacyPointer off_entries = LegacyPointer.Read(reader); byte num_entries = reader.ReadByte(); reader.ReadByte(); reader.ReadByte(); reader.ReadByte(); macros = new Macro[num_entries]; if (num_entries > 0) { - Pointer.DoAt(ref reader, off_entries, () => { + LegacyPointer.DoAt(ref reader, off_entries, () => { for (int i = 0; i < num_entries; i++) { - macros[i] = l.FromOffsetOrRead(reader, Pointer.Current(reader), inline: true); + macros[i] = l.FromOffsetOrRead(reader, LegacyPointer.Current(reader), inline: true); macros[i].aiModel = this; macros[i].index = i; } diff --git a/Assets/Scripts/OpenSpace/AI/AITypes/AITypes_Hype.cs b/Assets/Scripts/OpenSpace/AI/AITypes/AITypes_Hype.cs index d4bb231d..4fc0e5af 100644 --- a/Assets/Scripts/OpenSpace/AI/AITypes/AITypes_Hype.cs +++ b/Assets/Scripts/OpenSpace/AI/AITypes/AITypes_Hype.cs @@ -7,7 +7,7 @@ namespace OpenSpace.AI { public partial class AITypes { - public static AITypes Hype = new AITypes() + public static AITypes Hype => new AITypes() { #region Node types nodeTypes = new ScriptNode.NodeType[] { diff --git a/Assets/Scripts/OpenSpace/AI/AITypes/AITypes_Largo.cs b/Assets/Scripts/OpenSpace/AI/AITypes/AITypes_Largo.cs index 040d0691..fd14db50 100644 --- a/Assets/Scripts/OpenSpace/AI/AITypes/AITypes_Largo.cs +++ b/Assets/Scripts/OpenSpace/AI/AITypes/AITypes_Largo.cs @@ -7,7 +7,7 @@ namespace OpenSpace.AI { public partial class AITypes { - public static AITypes Largo = new AITypes() + public static AITypes Largo => new AITypes() { #region Keywords keywordTable = new string[] { diff --git a/Assets/Scripts/OpenSpace/AI/AITypes/AITypes_R2.cs b/Assets/Scripts/OpenSpace/AI/AITypes/AITypes_R2.cs index 8e7ea1cb..5ebe2aaf 100644 --- a/Assets/Scripts/OpenSpace/AI/AITypes/AITypes_R2.cs +++ b/Assets/Scripts/OpenSpace/AI/AITypes/AITypes_R2.cs @@ -7,7 +7,7 @@ namespace OpenSpace.AI { public partial class AITypes { - public static AITypes R2 = new AITypes() + public static AITypes R2 => new AITypes() { #region Keywords keywordTable = new string[] { diff --git a/Assets/Scripts/OpenSpace/AI/AITypes/AITypes_R2Demo.cs b/Assets/Scripts/OpenSpace/AI/AITypes/AITypes_R2Demo.cs index 8e4ac6b9..d2dc25d5 100644 --- a/Assets/Scripts/OpenSpace/AI/AITypes/AITypes_R2Demo.cs +++ b/Assets/Scripts/OpenSpace/AI/AITypes/AITypes_R2Demo.cs @@ -7,7 +7,7 @@ namespace OpenSpace.AI { public partial class AITypes { - public static AITypes R2Demo = new AITypes() + public static AITypes R2Demo => new AITypes() { #region Keywords keywordTable = new string[] { diff --git a/Assets/Scripts/OpenSpace/AI/AITypes/AITypes_R2ROM.cs b/Assets/Scripts/OpenSpace/AI/AITypes/AITypes_R2ROM.cs index 053f6812..bac3db58 100644 --- a/Assets/Scripts/OpenSpace/AI/AITypes/AITypes_R2ROM.cs +++ b/Assets/Scripts/OpenSpace/AI/AITypes/AITypes_R2ROM.cs @@ -7,7 +7,7 @@ namespace OpenSpace.AI { public partial class AITypes { - public static AITypes R2ROM = new AITypes() + public static AITypes R2ROM => new AITypes() { #region Keywords keywordTable = new string[] { diff --git a/Assets/Scripts/OpenSpace/AI/AITypes/AITypes_R3.cs b/Assets/Scripts/OpenSpace/AI/AITypes/AITypes_R3.cs index f9575427..06e0374b 100644 --- a/Assets/Scripts/OpenSpace/AI/AITypes/AITypes_R3.cs +++ b/Assets/Scripts/OpenSpace/AI/AITypes/AITypes_R3.cs @@ -7,7 +7,7 @@ namespace OpenSpace.AI { public partial class AITypes { - public static AITypes R3 = new AITypes() + public static AITypes R3 => new AITypes() { #region Keywords keywordTable = new string[] { diff --git a/Assets/Scripts/OpenSpace/AI/AITypes/AITypes_Revolution.cs b/Assets/Scripts/OpenSpace/AI/AITypes/AITypes_Revolution.cs index 80aa9566..d0091ea9 100644 --- a/Assets/Scripts/OpenSpace/AI/AITypes/AITypes_Revolution.cs +++ b/Assets/Scripts/OpenSpace/AI/AITypes/AITypes_Revolution.cs @@ -7,7 +7,7 @@ namespace OpenSpace.AI { public partial class AITypes { - public static AITypes Revolution = new AITypes() + public static AITypes Revolution => new AITypes() { #region Keywords keywordTable = new string[] { diff --git a/Assets/Scripts/OpenSpace/AI/AITypes/AITypes_TTSE.cs b/Assets/Scripts/OpenSpace/AI/AITypes/AITypes_TTSE.cs index a8858acb..c1834d91 100644 --- a/Assets/Scripts/OpenSpace/AI/AITypes/AITypes_TTSE.cs +++ b/Assets/Scripts/OpenSpace/AI/AITypes/AITypes_TTSE.cs @@ -7,7 +7,7 @@ namespace OpenSpace.AI { public partial class AITypes { - public static AITypes TTSE = new AITypes() + public static AITypes TTSE => new AITypes() { #region Node types nodeTypes = new ScriptNode.NodeType[] { diff --git a/Assets/Scripts/OpenSpace/AI/Behavior.cs b/Assets/Scripts/OpenSpace/AI/Behavior.cs index 8d5574b8..3e991779 100644 --- a/Assets/Scripts/OpenSpace/AI/Behavior.cs +++ b/Assets/Scripts/OpenSpace/AI/Behavior.cs @@ -13,14 +13,14 @@ public enum BehaviorType { } public string name = null; - public Pointer off_scripts; - private Pointer off_scheduleScript; + public LegacyPointer off_scripts; + private LegacyPointer off_scheduleScript; public byte num_scripts; public Script[] scripts; public Script scheduleScript; // Custom - public List copies; + public List copies; public BehaviorType type; public int index; @@ -79,7 +79,7 @@ public string NameSubstring { } public Behavior() : base() { - copies = new List(); + copies = new List(); } public bool ContentEquals(Behavior b) { @@ -99,7 +99,7 @@ protected override void ReadInternal(Reader reader) { MapLoader l = MapLoader.Loader; l.behaviors.Add(this); //l.print("Behavior " + Offset); - if (Settings.s.hasNames && Settings.s.platform != Settings.Platform.PS2) { + if (Legacy_Settings.s.hasNames && Legacy_Settings.s.platform != Legacy_Settings.Platform.PS2) { name = new string(reader.ReadChars(0x100)).TrimEnd('\0'); // Some versions have extra information in the name, e.g. @@ -109,11 +109,11 @@ protected override void ReadInternal(Reader reader) { name = name.Substring(indexOf + "CreateComport:".Length); } } - off_scripts = Pointer.Read(reader); - off_scheduleScript = Pointer.Read(reader); - if (Settings.s.platform == Settings.Platform.DC || - Settings.s.game == Settings.Game.RedPlanet - || Settings.s.game == Settings.Game.R2Demo) { + off_scripts = LegacyPointer.Read(reader); + off_scheduleScript = LegacyPointer.Read(reader); + if (Legacy_Settings.s.platform == Legacy_Settings.Platform.DC || + Legacy_Settings.s.game == Legacy_Settings.Game.RedPlanet + || Legacy_Settings.s.game == Legacy_Settings.Game.R2Demo) { reader.ReadUInt32(); } num_scripts = reader.ReadByte(); @@ -122,13 +122,13 @@ protected override void ReadInternal(Reader reader) { reader.ReadByte(); //if (entry.name != null) l.print(entry.name); scripts = new Script[num_scripts]; - Pointer.DoAt(ref reader, off_scripts, () => { + LegacyPointer.DoAt(ref reader, off_scripts, () => { for (int i = 0; i < num_scripts; i++) { - scripts[i] = Script.Read(reader, Pointer.Current(reader), this); + scripts[i] = Script.Read(reader, LegacyPointer.Current(reader), this); } }); - Pointer.DoAt(ref reader, off_scheduleScript, () => { - scheduleScript = Script.Read(reader, Pointer.Current(reader), this, single: true); + LegacyPointer.DoAt(ref reader, off_scheduleScript, () => { + scheduleScript = Script.Read(reader, LegacyPointer.Current(reader), this, single: true); }); } diff --git a/Assets/Scripts/OpenSpace/AI/Brain.cs b/Assets/Scripts/OpenSpace/AI/Brain.cs index 23f81b85..b87c02a0 100644 --- a/Assets/Scripts/OpenSpace/AI/Brain.cs +++ b/Assets/Scripts/OpenSpace/AI/Brain.cs @@ -7,24 +7,24 @@ namespace OpenSpace.AI { public class Brain { - public Pointer offset; + public LegacyPointer offset; - public Pointer off_mind; + public LegacyPointer off_mind; public uint unknown1; public uint unknown2; public Mind mind; - public Brain(Pointer offset) { + public Brain(LegacyPointer offset) { this.offset = offset; } - public static Brain Read(Reader reader, Pointer offset) { + public static Brain Read(Reader reader, LegacyPointer offset) { Brain b = new Brain(offset); //MapLoader.Loader.print("Brain " + offset); - b.off_mind = Pointer.Read(reader); - if (Settings.s.game != Settings.Game.R2Revolution) b.unknown1 = reader.ReadUInt32(); // init at 0xCDCDCDCD - if (Settings.s.game == Settings.Game.LargoWinch) { + b.off_mind = LegacyPointer.Read(reader); + if (Legacy_Settings.s.game != Legacy_Settings.Game.R2Revolution) b.unknown1 = reader.ReadUInt32(); // init at 0xCDCDCDCD + if (Legacy_Settings.s.game == Legacy_Settings.Game.LargoWinch) { b.unknown2 = reader.ReadByte(); // 0 } else { b.unknown2 = reader.ReadUInt32(); // 0 diff --git a/Assets/Scripts/OpenSpace/AI/DsgMem.cs b/Assets/Scripts/OpenSpace/AI/DsgMem.cs index 47a93c7a..258d86ac 100644 --- a/Assets/Scripts/OpenSpace/AI/DsgMem.cs +++ b/Assets/Scripts/OpenSpace/AI/DsgMem.cs @@ -6,9 +6,9 @@ namespace OpenSpace.AI { public class DsgMem : OpenSpaceStruct { - public Pointer off_dsgVar; - public Pointer memBufferInitial; // initial state - public Pointer memBuffer; // current state + public LegacyPointer off_dsgVar; + public LegacyPointer memBufferInitial; // initial state + public LegacyPointer memBuffer; // current state public DsgVar dsgVar; public DsgVarValue[] values; @@ -17,17 +17,17 @@ public class DsgMem : OpenSpaceStruct { protected override void ReadInternal(Reader reader) { //MapLoader.Loader.print("DsgMem " + Offset); - Pointer dsgVarPointer = Pointer.Read(reader); - Pointer.DoAt(ref reader, dsgVarPointer, () => { - off_dsgVar = Pointer.Read(reader); + LegacyPointer dsgVarPointer = LegacyPointer.Read(reader); + LegacyPointer.DoAt(ref reader, dsgVarPointer, () => { + off_dsgVar = LegacyPointer.Read(reader); }); - memBufferInitial = Pointer.Read(reader); - memBuffer = Pointer.Read(reader); + memBufferInitial = LegacyPointer.Read(reader); + memBuffer = LegacyPointer.Read(reader); dsgVar = MapLoader.Loader.FromOffsetOrRead(reader, off_dsgVar); if (dsgVar != null && dsgVar.amountOfInfos > 0) { - if (memBuffer != null && Settings.s.platform != Settings.Platform.DC) { + if (memBuffer != null && Legacy_Settings.s.platform != Legacy_Settings.Platform.DC) { // Current MemBuffer is cleared in DC files values = new DsgVarValue[dsgVar.amountOfInfos]; for (int i = 0; i < dsgVar.amountOfInfos; i++) { diff --git a/Assets/Scripts/OpenSpace/AI/DsgVar.cs b/Assets/Scripts/OpenSpace/AI/DsgVar.cs index 6314f599..e0d52f47 100644 --- a/Assets/Scripts/OpenSpace/AI/DsgVar.cs +++ b/Assets/Scripts/OpenSpace/AI/DsgVar.cs @@ -8,8 +8,8 @@ namespace OpenSpace.AI { public class DsgVar : OpenSpaceStruct { - public Pointer off_dsgMemBuffer; - public Pointer off_dsgVarInfo; // points to DsgVarInfo, which is an array of dsgVarInfoEntries + public LegacyPointer off_dsgMemBuffer; + public LegacyPointer off_dsgVarInfo; // points to DsgVarInfo, which is an array of dsgVarInfoEntries public uint amountOfInfos; public uint dsgMemBufferLength; @@ -17,9 +17,9 @@ public class DsgVar : OpenSpaceStruct { public DsgVarValue[] defaultValues; protected override void ReadInternal(Reader reader) { - off_dsgMemBuffer = Pointer.Read(reader); - off_dsgVarInfo = Pointer.Read(reader); - if (Settings.s.game == Settings.Game.R2Revolution) { + off_dsgMemBuffer = LegacyPointer.Read(reader); + off_dsgVarInfo = LegacyPointer.Read(reader); + if (Legacy_Settings.s.game == Legacy_Settings.Game.R2Revolution) { dsgMemBufferLength = reader.ReadUInt16(); amountOfInfos = reader.ReadUInt16(); } else { @@ -30,10 +30,10 @@ protected override void ReadInternal(Reader reader) { dsgVarInfos = new DsgVarInfoEntry[amountOfInfos]; defaultValues = new DsgVarValue[amountOfInfos]; if (amountOfInfos > 0) { - Pointer.DoAt(ref reader, off_dsgVarInfo, () => { + LegacyPointer.DoAt(ref reader, off_dsgVarInfo, () => { //l.print(dsgVar.amountOfInfos); for (uint i = 0; i < amountOfInfos; i++) { - dsgVarInfos[i] = DsgVarInfoEntry.Read(reader, Pointer.Current(reader), i); + dsgVarInfos[i] = DsgVarInfoEntry.Read(reader, LegacyPointer.Current(reader), i); defaultValues[i] = new DsgVarValue(dsgVarInfos[i].type, null); defaultValues[i].ReadFromDsgVarBuffer(reader, dsgVarInfos[i], this); diff --git a/Assets/Scripts/OpenSpace/AI/DsgVarInfoEntry.cs b/Assets/Scripts/OpenSpace/AI/DsgVarInfoEntry.cs index 8e93d156..bb145f3b 100644 --- a/Assets/Scripts/OpenSpace/AI/DsgVarInfoEntry.cs +++ b/Assets/Scripts/OpenSpace/AI/DsgVarInfoEntry.cs @@ -6,7 +6,7 @@ namespace OpenSpace.AI { public partial class DsgVarInfoEntry { - public Pointer offset; + public LegacyPointer offset; public uint offsetInBuffer; // offset in DsgMemBuffer public uint typeNumber; @@ -23,22 +23,22 @@ public string NiceVariableName { } } - public DsgVarInfoEntry(Pointer offset) { + public DsgVarInfoEntry(LegacyPointer offset) { this.offset = offset; } - public static DsgVarInfoEntry Read(Reader reader, Pointer offset, uint number) { + public static DsgVarInfoEntry Read(Reader reader, LegacyPointer offset, uint number) { MapLoader l = MapLoader.Loader; DsgVarInfoEntry d = new DsgVarInfoEntry(offset); //l.print(offset); - if (Settings.s.game == Settings.Game.LargoWinch) { + if (Legacy_Settings.s.game == Legacy_Settings.Game.LargoWinch) { d.offsetInBuffer = reader.ReadUInt32(); d.typeNumber = reader.ReadUInt32(); d.saveType = reader.ReadByte(); d.initType = reader.ReadByte(); reader.ReadByte(); reader.ReadByte(); - } else if (Settings.s.game == Settings.Game.R2Revolution) { + } else if (Legacy_Settings.s.game == Legacy_Settings.Game.R2Revolution) { d.offsetInBuffer = reader.ReadUInt16(); reader.ReadUInt16(); d.typeNumber = reader.ReadByte(); @@ -53,7 +53,7 @@ public static DsgVarInfoEntry Read(Reader reader, Pointer offset, uint number) { d.number = number; - d.type = Settings.s.aiTypes.GetDsgVarType(d.typeNumber); + d.type = Legacy_Settings.s.aiTypes.GetDsgVarType(d.typeNumber); return d; } diff --git a/Assets/Scripts/OpenSpace/AI/DsgVarValue.cs b/Assets/Scripts/OpenSpace/AI/DsgVarValue.cs index facfd64d..7b6f7c6e 100644 --- a/Assets/Scripts/OpenSpace/AI/DsgVarValue.cs +++ b/Assets/Scripts/OpenSpace/AI/DsgVarValue.cs @@ -12,7 +12,7 @@ namespace OpenSpace.AI { public class DsgVarValue { public DsgVarType type; - public Pointer offset; + public LegacyPointer offset; public DsgMem dsgMem; // Array data @@ -22,7 +22,7 @@ public class DsgVarValue { public DsgVarValue[] valueArray; // Possible values - public Pointer valuePointer; + public LegacyPointer valuePointer; public bool valueBool; public sbyte valueByte; @@ -58,7 +58,7 @@ public DsgVarValue(DsgVarType type, DsgMem dsgMem) { } public void Read(Reader reader) { - offset = Pointer.Current(reader); + offset = LegacyPointer.Current(reader); switch (type) { case DsgVarType.Boolean: valueBool = reader.ReadBoolean(); break; @@ -85,23 +85,23 @@ public void Read(Reader reader) { case DsgVarType.Text: valueText = reader.ReadInt32(); break; case DsgVarType.Graph: - valuePointer = Pointer.Read(reader); + valuePointer = LegacyPointer.Read(reader); valueGraph = Graph.FromOffsetOrRead(valuePointer, reader); break; case DsgVarType.WayPoint: - valuePointer = Pointer.Read(reader); + valuePointer = LegacyPointer.Read(reader); valueWayPoint = WayPoint.FromOffsetOrRead(valuePointer, reader); break; case DsgVarType.GameMaterial: - valuePointer = Pointer.Read(reader); + valuePointer = LegacyPointer.Read(reader); valueGameMaterial = GameMaterial.FromOffsetOrRead(valuePointer, reader); break; case DsgVarType.VisualMaterial: - valuePointer = Pointer.Read(reader); + valuePointer = LegacyPointer.Read(reader); valueVisualMaterial = VisualMaterial.FromOffsetOrRead(valuePointer, reader); break; case DsgVarType.ObjectList: - valuePointer = Pointer.Read(reader); + valuePointer = LegacyPointer.Read(reader); valueObjectList = ObjectList.FromOffsetOrRead(valuePointer, reader); break; case DsgVarType.List: @@ -109,32 +109,32 @@ public void Read(Reader reader) { valueList.Read(reader); break; case DsgVarType.Light: - valuePointer = Pointer.Read(reader); + valuePointer = LegacyPointer.Read(reader); valueLight = MapLoader.Loader.FromOffsetOrRead(reader, valuePointer); break; case DsgVarType.Comport: - valuePointer = Pointer.Read(reader); + valuePointer = LegacyPointer.Read(reader); // 2021-05-25 Changed type from Behavior to Macro since it always seems to be a Macro (from R3, seemingly unused in R2) - RTS valueComport = MapLoader.Loader.FromOffsetOrRead(reader, valuePointer); break; case DsgVarType.Input: - valuePointer = Pointer.Read(reader); + valuePointer = LegacyPointer.Read(reader); valueInput = EntryAction.FromOffsetOrRead(valuePointer, reader); break; // Fill these in after loading case DsgVarType.Perso: - valuePointer = Pointer.Read(reader); + valuePointer = LegacyPointer.Read(reader); // Don't fill in perso yet MapLoader.Loader.onPostLoad.Add(InitPostLoad); break; case DsgVarType.Action: - valuePointer = Pointer.Read(reader); + valuePointer = LegacyPointer.Read(reader); // Don't fill in state yet MapLoader.Loader.onPostLoad.Add(InitPostLoad); break; case DsgVarType.SuperObject: - valuePointer = Pointer.Read(reader); + valuePointer = LegacyPointer.Read(reader); // Don't fill in SO yet MapLoader.Loader.onPostLoad.Add(InitPostLoad); break; @@ -264,7 +264,7 @@ public override string ToString() { } public void Write(Writer writer) { - Pointer.Goto(ref writer, offset); + LegacyPointer.Goto(ref writer, offset); switch (type) { case DsgVarType.Boolean: writer.Write(valueBool); break; @@ -290,29 +290,29 @@ public void Write(Writer writer) { case DsgVarType.Text: writer.Write(valueText); break; case DsgVarType.Graph: - Pointer.Write(writer, valuePointer); break; + LegacyPointer.Write(writer, valuePointer); break; case DsgVarType.WayPoint: - Pointer.Write(writer, valuePointer); break; + LegacyPointer.Write(writer, valuePointer); break; case DsgVarType.GameMaterial: - Pointer.Write(writer, valuePointer); break; + LegacyPointer.Write(writer, valuePointer); break; case DsgVarType.VisualMaterial: - Pointer.Write(writer, valuePointer); break; + LegacyPointer.Write(writer, valuePointer); break; case DsgVarType.ObjectList: - Pointer.Write(writer, valuePointer); break; + LegacyPointer.Write(writer, valuePointer); break; case DsgVarType.List: valueList?.Write(writer); break; case DsgVarType.Light: - Pointer.Write(writer, valuePointer); break; + LegacyPointer.Write(writer, valuePointer); break; case DsgVarType.Comport: - Pointer.Write(writer, valuePointer); break; + LegacyPointer.Write(writer, valuePointer); break; case DsgVarType.Input: - Pointer.Write(writer, valuePointer); break; + LegacyPointer.Write(writer, valuePointer); break; case DsgVarType.Perso: - Pointer.Write(writer, valuePointer); break; + LegacyPointer.Write(writer, valuePointer); break; case DsgVarType.Action: - Pointer.Write(writer, valuePointer); break; + LegacyPointer.Write(writer, valuePointer); break; case DsgVarType.SuperObject: - Pointer.Write(writer, valuePointer); break; + LegacyPointer.Write(writer, valuePointer); break; // TODO: Figure these out case DsgVarType.Caps: @@ -342,7 +342,7 @@ public void Write(Writer writer) { } } public void ReadArray(Reader reader) { - if (Settings.s.game == Settings.Game.R2Revolution) { + if (Legacy_Settings.s.game == Legacy_Settings.Game.R2Revolution) { reader.ReadUInt32(); arrayTypeNumber = reader.ReadByte(); arrayLength = reader.ReadByte(); @@ -352,9 +352,9 @@ public void ReadArray(Reader reader) { arrayLength = reader.ReadByte(); reader.ReadBytes(3); // padding } - arrayType = Settings.s.aiTypes.GetDsgVarType(arrayTypeNumber); + arrayType = Legacy_Settings.s.aiTypes.GetDsgVarType(arrayTypeNumber); if (DsgVarInfoEntry.GetDsgVarTypeFromArrayType(type) != arrayType) { - Debug.LogWarning(currentbuf + " - " + type + " - " + arrayTypeNumber + " - " + arrayType + " - " + arrayLength + " - " + Pointer.Current(reader)); + Debug.LogWarning(currentbuf + " - " + type + " - " + arrayTypeNumber + " - " + arrayType + " - " + arrayLength + " - " + LegacyPointer.Current(reader)); } if (valueArray == null || arrayLength != valueArray.Length) { valueArray = new DsgVarValue[arrayLength]; @@ -393,8 +393,8 @@ public List GetSearchableString(Perso perso, int dsgVarNum) } public void WriteArray(Writer writer) { - if (Settings.s.game == Settings.Game.R2Revolution) { - Pointer.Goto(ref writer, Pointer.Current(writer) + 4); + if (Legacy_Settings.s.game == Legacy_Settings.Game.R2Revolution) { + LegacyPointer.Goto(ref writer, LegacyPointer.Current(writer) + 4); writer.Write((byte)arrayTypeNumber); writer.Write(arrayLength); writer.Write((byte)0); @@ -406,9 +406,9 @@ public void WriteArray(Writer writer) { writer.Write((byte)0); writer.Write((byte)0); } - arrayType = Settings.s.aiTypes.GetDsgVarType(arrayTypeNumber); + arrayType = Legacy_Settings.s.aiTypes.GetDsgVarType(arrayTypeNumber); if (DsgVarInfoEntry.GetDsgVarTypeFromArrayType(type) != arrayType) { - Debug.LogWarning(currentbuf + " - " + arrayTypeNumber + " - " + arrayType + " - " + arrayLength + " - " + Pointer.Current(writer)); + Debug.LogWarning(currentbuf + " - " + arrayTypeNumber + " - " + arrayType + " - " + arrayLength + " - " + LegacyPointer.Current(writer)); } if (valueArray != null && arrayLength == valueArray.Length) { for (uint i = 0; i < arrayLength; i++) { @@ -417,12 +417,12 @@ public void WriteArray(Writer writer) { } } - public void ReadFromBuffer(Reader reader, DsgVarInfoEntry infoEntry, Pointer buffer) { + public void ReadFromBuffer(Reader reader, DsgVarInfoEntry infoEntry, LegacyPointer buffer) { ReadFromBuffer(reader, infoEntry.offsetInBuffer, buffer); } - public void ReadFromBuffer(Reader reader, uint offsetInBuffer, Pointer buffer) { - Pointer.DoAt(ref reader, buffer + offsetInBuffer, () => { + public void ReadFromBuffer(Reader reader, uint offsetInBuffer, LegacyPointer buffer) { + LegacyPointer.DoAt(ref reader, buffer + offsetInBuffer, () => { Read(reader); }); } @@ -621,7 +621,7 @@ public class List { public struct Entry { public uint value; - public Pointer ptr; + public LegacyPointer ptr; } public void Read(Reader reader) { @@ -631,7 +631,7 @@ public void Read(Reader reader) { list = new Entry[maxLength]; for (int i = 0; i < maxLength; i++) { list[i] = new Entry(); - list[i].ptr = Pointer.GetPointerAtOffset(Pointer.Current(reader)); + list[i].ptr = LegacyPointer.GetPointerAtOffset(LegacyPointer.Current(reader)); list[i].value = reader.ReadUInt32(); } } diff --git a/Assets/Scripts/OpenSpace/AI/Intelligence.cs b/Assets/Scripts/OpenSpace/AI/Intelligence.cs index f7f91032..543f1864 100644 --- a/Assets/Scripts/OpenSpace/AI/Intelligence.cs +++ b/Assets/Scripts/OpenSpace/AI/Intelligence.cs @@ -6,12 +6,12 @@ namespace OpenSpace.AI { public class Intelligence : OpenSpaceStruct { - public Pointer off_aiModel; - public Pointer off_actionTree; - public Pointer off_comport; - public Pointer off_lastComport; - public Pointer off_actionTable; - public Pointer off_defaultComport; + public LegacyPointer off_aiModel; + public LegacyPointer off_actionTree; + public LegacyPointer off_comport; + public LegacyPointer off_lastComport; + public LegacyPointer off_actionTable; + public LegacyPointer off_defaultComport; // Processed data public AIModel aiModel; @@ -20,13 +20,13 @@ public class Intelligence : OpenSpaceStruct { public Behavior defaultComport; protected override void ReadInternal(Reader reader) { - off_aiModel = Pointer.Read(reader); // 0x0 - off_actionTree = Pointer.Read(reader); //0x4 - off_comport = Pointer.Read(reader); //0x8 - if (Settings.s.game != Settings.Game.R2Demo) { - off_lastComport = Pointer.Read(reader); - off_actionTable = Pointer.Read(reader); - off_defaultComport = Pointer.Read(reader); + off_aiModel = LegacyPointer.Read(reader); // 0x0 + off_actionTree = LegacyPointer.Read(reader); //0x4 + off_comport = LegacyPointer.Read(reader); //0x8 + if (Legacy_Settings.s.game != Legacy_Settings.Game.R2Demo) { + off_lastComport = LegacyPointer.Read(reader); + off_actionTable = LegacyPointer.Read(reader); + off_defaultComport = LegacyPointer.Read(reader); } aiModel = Load.FromOffset(off_aiModel); @@ -38,11 +38,11 @@ protected override void ReadInternal(Reader reader) { } public void Write(Writer writer) { - Pointer.Goto(ref writer, Offset + 8); - Pointer.Write(writer, off_comport); + LegacyPointer.Goto(ref writer, Offset + 8); + LegacyPointer.Write(writer, off_comport); - Pointer.Goto(ref writer, Offset + 20); - Pointer.Write(writer, off_defaultComport); + LegacyPointer.Goto(ref writer, Offset + 20); + LegacyPointer.Write(writer, off_defaultComport); } } } \ No newline at end of file diff --git a/Assets/Scripts/OpenSpace/AI/Macro.cs b/Assets/Scripts/OpenSpace/AI/Macro.cs index 7115dfe0..e2cce2c2 100644 --- a/Assets/Scripts/OpenSpace/AI/Macro.cs +++ b/Assets/Scripts/OpenSpace/AI/Macro.cs @@ -7,8 +7,8 @@ namespace OpenSpace.AI { public class Macro : BehaviorOrMacro { public string name = null; - public Pointer off_script; - public Pointer off_script2; + public LegacyPointer off_script; + public LegacyPointer off_script2; public Script script; // Custom @@ -49,10 +49,10 @@ public string NameSubstring { protected override void ReadInternal(Reader reader) { MapLoader.Loader.macros.Add(this); - if (Settings.s.hasNames - && Settings.s.platform != Settings.Platform.Xbox360 - && Settings.s.platform != Settings.Platform.PS3 - && Settings.s.platform != Settings.Platform.PS2) { + if (Legacy_Settings.s.hasNames + && Legacy_Settings.s.platform != Legacy_Settings.Platform.Xbox360 + && Legacy_Settings.s.platform != Legacy_Settings.Platform.PS3 + && Legacy_Settings.s.platform != Legacy_Settings.Platform.PS2) { name = reader.ReadString(0x100); // Some versions have extra information in the name, e.g. @@ -64,11 +64,11 @@ protected override void ReadInternal(Reader reader) { } - off_script = Pointer.Read(reader); - off_script2 = Pointer.Read(reader); + off_script = LegacyPointer.Read(reader); + off_script2 = LegacyPointer.Read(reader); - Pointer.DoAt(ref reader, off_script, () => { - script = Script.Read(reader, Pointer.Current(reader), this, single: true); + LegacyPointer.DoAt(ref reader, off_script, () => { + script = Script.Read(reader, LegacyPointer.Current(reader), this, single: true); }); } } diff --git a/Assets/Scripts/OpenSpace/AI/Mind.cs b/Assets/Scripts/OpenSpace/AI/Mind.cs index 5e05233d..abb8a4e8 100644 --- a/Assets/Scripts/OpenSpace/AI/Mind.cs +++ b/Assets/Scripts/OpenSpace/AI/Mind.cs @@ -6,11 +6,11 @@ namespace OpenSpace.AI { public class Mind : OpenSpaceStruct { - public Pointer off_AI_model; - public Pointer off_intelligence_normal; - public Pointer off_intelligence_reflex; - public Pointer off_dsgMem; - public Pointer off_name; + public LegacyPointer off_AI_model; + public LegacyPointer off_intelligence_normal; + public LegacyPointer off_intelligence_reflex; + public LegacyPointer off_dsgMem; + public LegacyPointer off_name; public byte byte0; public byte byte1; public byte byte2; @@ -24,10 +24,10 @@ public class Mind : OpenSpaceStruct { public void UpdateCurrentBehaviors(Reader reader) { - off_AI_model = Pointer.Read(reader); - off_intelligence_normal = Pointer.Read(reader); - off_intelligence_reflex = Pointer.Read(reader); - off_dsgMem = Pointer.Read(reader); + off_AI_model = LegacyPointer.Read(reader); + off_intelligence_normal = LegacyPointer.Read(reader); + off_intelligence_reflex = LegacyPointer.Read(reader); + off_dsgMem = LegacyPointer.Read(reader); MapLoader l = MapLoader.Loader; if (dsgMem == null) { @@ -47,24 +47,24 @@ public void UpdateCurrentBehaviors(Reader reader) } protected override void ReadInternal(Reader reader) { - off_AI_model = Pointer.Read(reader); - off_intelligence_normal = Pointer.Read(reader); - if (Settings.s.game == Settings.Game.R2Demo) { - off_dsgMem = Pointer.Read(reader); - off_intelligence_reflex = Pointer.Read(reader); + off_AI_model = LegacyPointer.Read(reader); + off_intelligence_normal = LegacyPointer.Read(reader); + if (Legacy_Settings.s.game == Legacy_Settings.Game.R2Demo) { + off_dsgMem = LegacyPointer.Read(reader); + off_intelligence_reflex = LegacyPointer.Read(reader); } else { - off_intelligence_reflex = Pointer.Read(reader); - off_dsgMem = Pointer.Read(reader); + off_intelligence_reflex = LegacyPointer.Read(reader); + off_dsgMem = LegacyPointer.Read(reader); } - if (Settings.s.hasNames) { - off_name = Pointer.Read(reader); + if (Legacy_Settings.s.hasNames) { + off_name = LegacyPointer.Read(reader); } byte0 = reader.ReadByte(); byte1 = reader.ReadByte(); byte2 = reader.ReadByte(); byte3 = reader.ReadByte(); - if (Settings.s.game == Settings.Game.R2Demo) { + if (Legacy_Settings.s.game == Legacy_Settings.Game.R2Demo) { // null reader.ReadUInt32(); reader.ReadUInt32(); diff --git a/Assets/Scripts/OpenSpace/AI/Script.cs b/Assets/Scripts/OpenSpace/AI/Script.cs index 48a53ffb..149dace5 100644 --- a/Assets/Scripts/OpenSpace/AI/Script.cs +++ b/Assets/Scripts/OpenSpace/AI/Script.cs @@ -7,39 +7,39 @@ namespace OpenSpace.AI { public class Script { - public Pointer offset; // offset of the pointer to the script + public LegacyPointer offset; // offset of the pointer to the script public BehaviorOrMacro behaviorOrMacro; - public Pointer off_script; // offset where the script starts + public LegacyPointer off_script; // offset where the script starts public List scriptNodes = new List(); - public Script(Pointer offset) { + public Script(LegacyPointer offset) { this.offset = offset; } - public static Script Read(Reader reader, Pointer offset, BehaviorOrMacro behaviorOrMacro, bool single = false) { + public static Script Read(Reader reader, LegacyPointer offset, BehaviorOrMacro behaviorOrMacro, bool single = false) { MapLoader l = MapLoader.Loader; Script s = new Script(offset); s.behaviorOrMacro = behaviorOrMacro; - if (Settings.s.game == Settings.Game.R2Revolution && single) { - s.off_script = Pointer.Current(reader); + if (Legacy_Settings.s.game == Legacy_Settings.Game.R2Revolution && single) { + s.off_script = LegacyPointer.Current(reader); bool endReached = false; while (!endReached) { - ScriptNode sn = ScriptNode.Read(reader, Pointer.Current(reader), s); + ScriptNode sn = ScriptNode.Read(reader, LegacyPointer.Current(reader), s); s.scriptNodes.Add(sn); if (sn.indent == 0) endReached = true; } } else { - s.off_script = Pointer.Read(reader); + s.off_script = LegacyPointer.Read(reader); //l.print(s.off_script); - Pointer.DoAt(ref reader, s.off_script, () => { + LegacyPointer.DoAt(ref reader, s.off_script, () => { bool endReached = false; while (!endReached) { - ScriptNode sn = ScriptNode.Read(reader, Pointer.Current(reader), s); + ScriptNode sn = ScriptNode.Read(reader, LegacyPointer.Current(reader), s); s.scriptNodes.Add(sn); if (sn.indent == 0) endReached = true; diff --git a/Assets/Scripts/OpenSpace/AI/ScriptNode.cs b/Assets/Scripts/OpenSpace/AI/ScriptNode.cs index 7556aaca..009b0dea 100644 --- a/Assets/Scripts/OpenSpace/AI/ScriptNode.cs +++ b/Assets/Scripts/OpenSpace/AI/ScriptNode.cs @@ -14,31 +14,31 @@ namespace OpenSpace.AI { public class ScriptNode { - public Pointer offset; + public LegacyPointer offset; public uint param; public byte type; public byte indent; // derived fields - public Pointer param_ptr; + public LegacyPointer param_ptr; public NodeType nodeType; public Script script; - public ScriptNode(Pointer offset) { + public ScriptNode(LegacyPointer offset) { this.offset = offset; } - public static ScriptNode Read(Reader reader, Pointer offset, Script script) { + public static ScriptNode Read(Reader reader, LegacyPointer offset, Script script) { MapLoader l = MapLoader.Loader; ScriptNode sn = new ScriptNode(offset); sn.script = script; sn.param = reader.ReadUInt32(); - sn.param_ptr = Pointer.GetPointerAtOffset(offset); // if parameter is pointer - if (Settings.s.platform == Settings.Platform.DC) reader.ReadUInt32(); + sn.param_ptr = LegacyPointer.GetPointerAtOffset(offset); // if parameter is pointer + if (Legacy_Settings.s.platform == Legacy_Settings.Platform.DC) reader.ReadUInt32(); - if (Settings.s.mode == Settings.Mode.Rayman3GC) { + if (Legacy_Settings.s.mode == Legacy_Settings.Mode.Rayman3GC) { reader.ReadByte(); reader.ReadByte(); reader.ReadByte(); @@ -55,7 +55,7 @@ public static ScriptNode Read(Reader reader, Pointer offset, Script script) { sn.type = reader.ReadByte(); } sn.nodeType = NodeType.Unknown; - if (Settings.s.aiTypes != null) sn.nodeType = Settings.s.aiTypes.GetNodeType(sn.type); + if (Legacy_Settings.s.aiTypes != null) sn.nodeType = Legacy_Settings.s.aiTypes.GetNodeType(sn.type); if (sn.param_ptr != null && sn.nodeType != NodeType.Unknown) { //l.print("ScriptNode " + offset + " - " + sn.nodeType + " (" + sn.type + ") - " + sn.param_ptr); @@ -63,7 +63,7 @@ public static ScriptNode Read(Reader reader, Pointer offset, Script script) { WayPoint waypoint = WayPoint.FromOffsetOrRead(sn.param_ptr, reader); waypoint.References.referencedByNodes.Add(sn); } else if (sn.nodeType == NodeType.String) { - Pointer.DoAt(ref reader, sn.param_ptr, () => { + LegacyPointer.DoAt(ref reader, sn.param_ptr, () => { string str = reader.ReadNullDelimitedString(); l.strings[sn.param_ptr] = str; }); @@ -138,7 +138,7 @@ public string ToString(Perso perso, TranslatedScript.TranslationSettings ts, boo MapLoader l = MapLoader.Loader; short mask = 0; - AITypes aiTypes = Settings.s.aiTypes; + AITypes aiTypes = Legacy_Settings.s.aiTypes; Vector3 vector3 = new Vector3 { x = 0, y = 0, z = 0 }; switch (nodeType) { diff --git a/Assets/Scripts/OpenSpace/AI/TranslatedScript.cs b/Assets/Scripts/OpenSpace/AI/TranslatedScript.cs index 4ac494b1..6f4c1e0b 100644 --- a/Assets/Scripts/OpenSpace/AI/TranslatedScript.cs +++ b/Assets/Scripts/OpenSpace/AI/TranslatedScript.cs @@ -49,7 +49,7 @@ public string ToString(Perso perso) { string secondChildNode = (this.children.Count > 1 && this.children[1] != null) ? this.children[1].ToString() : "null"; string prefix = (ts.printAddresses ? "{" + scriptNode.offset.ToString() + "}" : ""); - AITypes aiTypes = Settings.s.aiTypes; + AITypes aiTypes = Legacy_Settings.s.aiTypes; uint param = scriptNode.param; switch (scriptNode.nodeType) { @@ -170,7 +170,7 @@ public string ToString(Perso perso) { case ScriptNode.NodeType.Operator: string op = param < aiTypes.operatorTable.Length ? aiTypes.operatorTable[param] : ""; - Pointer persoPtr = null; + LegacyPointer persoPtr = null; switch (op) { // scalar: diff --git a/Assets/Scripts/OpenSpace/Animation/AnimationBank.cs b/Assets/Scripts/OpenSpace/Animation/AnimationBank.cs index 9024248f..6aaf3458 100644 --- a/Assets/Scripts/OpenSpace/Animation/AnimationBank.cs +++ b/Assets/Scripts/OpenSpace/Animation/AnimationBank.cs @@ -8,8 +8,8 @@ namespace OpenSpace.Animation { public class AnimationBank : IEquatable { - public Pointer off_header; - public Pointer off_data; + public LegacyPointer off_header; + public LegacyPointer off_data; public AnimationStack a3d_general; public AnimationStack vectors; public AnimationStack quaternions; @@ -39,7 +39,7 @@ public class AnimationBank : IEquatable { public AnimMorphData[] global_morphData; public AnimDeformation[] global_deformations; - public AnimationBank(Pointer off_header) { + public AnimationBank(LegacyPointer off_header) { this.off_header = off_header; } public override bool Equals(System.Object obj) { @@ -63,13 +63,13 @@ public bool Equals(AnimationBank other) { return !(x == y); } - public static AnimationBank[] Read(Reader reader, Pointer offset, uint index, uint num_banks, FileFormat.FileWithPointers kfFile, bool append = false) { + public static AnimationBank[] Read(Reader reader, LegacyPointer offset, uint index, uint num_banks, FileFormat.FileWithPointers kfFile, bool append = false) { MapLoader l = MapLoader.Loader; AnimationBank[] banks = new AnimationBank[num_banks]; for (int i = 0; i < num_banks; i++) { // In R3, each animation bank is of size 0x104 = 13 times a stack description of 5 uint32s. - banks[i] = new AnimationBank(Pointer.Current(reader)); + banks[i] = new AnimationBank(LegacyPointer.Current(reader)); banks[i].a3d_general = AnimationStack.Read(reader); banks[i].vectors = AnimationStack.Read(reader); banks[i].quaternions = AnimationStack.Read(reader); @@ -82,81 +82,81 @@ public static AnimationBank[] Read(Reader reader, Pointer offset, uint index, ui banks[i].keyframes = AnimationStack.Read(reader); banks[i].events = AnimationStack.Read(reader); banks[i].morphData = AnimationStack.Read(reader); - if (Settings.s.hasDeformations) { + if (Legacy_Settings.s.hasDeformations) { banks[i].deformations = AnimationStack.Read(reader); } else { banks[i].deformations = null; } banks[i].animations = new AnimA3DGeneral[banks[i].a3d_general.count]; } - if (Settings.s.mode != Settings.Mode.Rayman3GC && !append) { - if (!Settings.s.loadFromMemory) { + if (Legacy_Settings.s.mode != Legacy_Settings.Mode.Rayman3GC && !append) { + if (!Legacy_Settings.s.loadFromMemory) { for (int i = 0; i < num_banks; i++) { - if (banks[i].a3d_general.reservedMemory > 0) banks[i].a3d_general.off_data = Pointer.Read(reader); - if (banks[i].vectors.reservedMemory > 0) banks[i].vectors.off_data = Pointer.Read(reader); - if (banks[i].quaternions.reservedMemory > 0) banks[i].quaternions.off_data = Pointer.Read(reader); - if (banks[i].hierarchies.reservedMemory > 0) banks[i].hierarchies.off_data = Pointer.Read(reader); - if (banks[i].NTTO.reservedMemory > 0) banks[i].NTTO.off_data = Pointer.Read(reader); - if (banks[i].onlyFrames.reservedMemory > 0) banks[i].onlyFrames.off_data = Pointer.Read(reader); - if (banks[i].channels.reservedMemory > 0) banks[i].channels.off_data = Pointer.Read(reader); - if (banks[i].framesNumOfNTTO.reservedMemory > 0) banks[i].framesNumOfNTTO.off_data = Pointer.Read(reader); - if (banks[i].framesKFIndex.reservedMemory > 0) banks[i].framesKFIndex.off_data = Pointer.Read(reader); + if (banks[i].a3d_general.reservedMemory > 0) banks[i].a3d_general.off_data = LegacyPointer.Read(reader); + if (banks[i].vectors.reservedMemory > 0) banks[i].vectors.off_data = LegacyPointer.Read(reader); + if (banks[i].quaternions.reservedMemory > 0) banks[i].quaternions.off_data = LegacyPointer.Read(reader); + if (banks[i].hierarchies.reservedMemory > 0) banks[i].hierarchies.off_data = LegacyPointer.Read(reader); + if (banks[i].NTTO.reservedMemory > 0) banks[i].NTTO.off_data = LegacyPointer.Read(reader); + if (banks[i].onlyFrames.reservedMemory > 0) banks[i].onlyFrames.off_data = LegacyPointer.Read(reader); + if (banks[i].channels.reservedMemory > 0) banks[i].channels.off_data = LegacyPointer.Read(reader); + if (banks[i].framesNumOfNTTO.reservedMemory > 0) banks[i].framesNumOfNTTO.off_data = LegacyPointer.Read(reader); + if (banks[i].framesKFIndex.reservedMemory > 0) banks[i].framesKFIndex.off_data = LegacyPointer.Read(reader); if (kfFile == null) { - if (banks[i].keyframes.reservedMemory > 0) banks[i].keyframes.off_data = Pointer.Read(reader); + if (banks[i].keyframes.reservedMemory > 0) banks[i].keyframes.off_data = LegacyPointer.Read(reader); } else { - banks[i].keyframes.off_data = new Pointer(0, kfFile); + banks[i].keyframes.off_data = new LegacyPointer(0, kfFile); } - if (banks[i].events.reservedMemory > 0) banks[i].events.off_data = Pointer.Read(reader); - if (banks[i].morphData.reservedMemory > 0) banks[i].morphData.off_data = Pointer.Read(reader); - if (Settings.s.hasDeformations && banks[i].deformations.reservedMemory > 0) banks[i].deformations.off_data = Pointer.Read(reader); + if (banks[i].events.reservedMemory > 0) banks[i].events.off_data = LegacyPointer.Read(reader); + if (banks[i].morphData.reservedMemory > 0) banks[i].morphData.off_data = LegacyPointer.Read(reader); + if (Legacy_Settings.s.hasDeformations && banks[i].deformations.reservedMemory > 0) banks[i].deformations.off_data = LegacyPointer.Read(reader); } } else { - Pointer.Goto(ref reader, new Pointer(Settings.s.memoryAddresses["anim_a3d"], offset.file)); - for(int i = 0; i < num_banks; i++) banks[i].a3d_general.off_data = Pointer.Read(reader); - Pointer.Goto(ref reader, new Pointer(Settings.s.memoryAddresses["anim_vectors"], offset.file)); - for (int i = 0; i < num_banks; i++) banks[i].vectors.off_data = Pointer.Read(reader); - Pointer.Goto(ref reader, new Pointer(Settings.s.memoryAddresses["anim_quaternions"], offset.file)); - for (int i = 0; i < num_banks; i++) banks[i].quaternions.off_data = Pointer.Read(reader); - Pointer.Goto(ref reader, new Pointer(Settings.s.memoryAddresses["anim_hierarchies"], offset.file)); - for (int i = 0; i < num_banks; i++) banks[i].hierarchies.off_data = Pointer.Read(reader); - Pointer.Goto(ref reader, new Pointer(Settings.s.memoryAddresses["anim_NTTO"], offset.file)); - for (int i = 0; i < num_banks; i++) banks[i].NTTO.off_data = Pointer.Read(reader); - Pointer.Goto(ref reader, new Pointer(Settings.s.memoryAddresses["anim_onlyFrames"], offset.file)); - for (int i = 0; i < num_banks; i++) banks[i].onlyFrames.off_data = Pointer.Read(reader); - Pointer.Goto(ref reader, new Pointer(Settings.s.memoryAddresses["anim_channels"], offset.file)); - for (int i = 0; i < num_banks; i++) banks[i].channels.off_data = Pointer.Read(reader); - Pointer.Goto(ref reader, new Pointer(Settings.s.memoryAddresses["anim_framesNumOfNTTO"], offset.file)); - for (int i = 0; i < num_banks; i++) banks[i].framesNumOfNTTO.off_data = Pointer.Read(reader); - Pointer.Goto(ref reader, new Pointer(Settings.s.memoryAddresses["anim_framesKF"], offset.file)); - for (int i = 0; i < num_banks; i++) banks[i].framesKFIndex.off_data = Pointer.Read(reader); - Pointer.Goto(ref reader, new Pointer(Settings.s.memoryAddresses["anim_keyframes"], offset.file)); - for (int i = 0; i < num_banks; i++) banks[i].keyframes.off_data = Pointer.Read(reader); - Pointer.Goto(ref reader, new Pointer(Settings.s.memoryAddresses["anim_events"], offset.file)); - for (int i = 0; i < num_banks; i++) banks[i].events.off_data = Pointer.Read(reader); - Pointer.Goto(ref reader, new Pointer(Settings.s.memoryAddresses["anim_morphData"], offset.file)); - for (int i = 0; i < num_banks; i++) banks[i].morphData.off_data = Pointer.Read(reader); - if (Settings.s.hasDeformations) { - Pointer.Goto(ref reader, new Pointer(Settings.s.memoryAddresses["anim_deformations"], offset.file)); - for (int i = 0; i < num_banks; i++) banks[i].deformations.off_data = Pointer.Read(reader); + LegacyPointer.Goto(ref reader, new LegacyPointer(Legacy_Settings.s.memoryAddresses["anim_a3d"], offset.file)); + for(int i = 0; i < num_banks; i++) banks[i].a3d_general.off_data = LegacyPointer.Read(reader); + LegacyPointer.Goto(ref reader, new LegacyPointer(Legacy_Settings.s.memoryAddresses["anim_vectors"], offset.file)); + for (int i = 0; i < num_banks; i++) banks[i].vectors.off_data = LegacyPointer.Read(reader); + LegacyPointer.Goto(ref reader, new LegacyPointer(Legacy_Settings.s.memoryAddresses["anim_quaternions"], offset.file)); + for (int i = 0; i < num_banks; i++) banks[i].quaternions.off_data = LegacyPointer.Read(reader); + LegacyPointer.Goto(ref reader, new LegacyPointer(Legacy_Settings.s.memoryAddresses["anim_hierarchies"], offset.file)); + for (int i = 0; i < num_banks; i++) banks[i].hierarchies.off_data = LegacyPointer.Read(reader); + LegacyPointer.Goto(ref reader, new LegacyPointer(Legacy_Settings.s.memoryAddresses["anim_NTTO"], offset.file)); + for (int i = 0; i < num_banks; i++) banks[i].NTTO.off_data = LegacyPointer.Read(reader); + LegacyPointer.Goto(ref reader, new LegacyPointer(Legacy_Settings.s.memoryAddresses["anim_onlyFrames"], offset.file)); + for (int i = 0; i < num_banks; i++) banks[i].onlyFrames.off_data = LegacyPointer.Read(reader); + LegacyPointer.Goto(ref reader, new LegacyPointer(Legacy_Settings.s.memoryAddresses["anim_channels"], offset.file)); + for (int i = 0; i < num_banks; i++) banks[i].channels.off_data = LegacyPointer.Read(reader); + LegacyPointer.Goto(ref reader, new LegacyPointer(Legacy_Settings.s.memoryAddresses["anim_framesNumOfNTTO"], offset.file)); + for (int i = 0; i < num_banks; i++) banks[i].framesNumOfNTTO.off_data = LegacyPointer.Read(reader); + LegacyPointer.Goto(ref reader, new LegacyPointer(Legacy_Settings.s.memoryAddresses["anim_framesKF"], offset.file)); + for (int i = 0; i < num_banks; i++) banks[i].framesKFIndex.off_data = LegacyPointer.Read(reader); + LegacyPointer.Goto(ref reader, new LegacyPointer(Legacy_Settings.s.memoryAddresses["anim_keyframes"], offset.file)); + for (int i = 0; i < num_banks; i++) banks[i].keyframes.off_data = LegacyPointer.Read(reader); + LegacyPointer.Goto(ref reader, new LegacyPointer(Legacy_Settings.s.memoryAddresses["anim_events"], offset.file)); + for (int i = 0; i < num_banks; i++) banks[i].events.off_data = LegacyPointer.Read(reader); + LegacyPointer.Goto(ref reader, new LegacyPointer(Legacy_Settings.s.memoryAddresses["anim_morphData"], offset.file)); + for (int i = 0; i < num_banks; i++) banks[i].morphData.off_data = LegacyPointer.Read(reader); + if (Legacy_Settings.s.hasDeformations) { + LegacyPointer.Goto(ref reader, new LegacyPointer(Legacy_Settings.s.memoryAddresses["anim_deformations"], offset.file)); + for (int i = 0; i < num_banks; i++) banks[i].deformations.off_data = LegacyPointer.Read(reader); } } } - Pointer off_current = Pointer.Current(reader); - Pointer off_a3d = null; + LegacyPointer off_current = LegacyPointer.Current(reader); + LegacyPointer off_a3d = null; uint num_a3d = (uint)banks.Sum(b => b.a3d_general.count); - if (kfFile != null && Settings.s.mode == Settings.Mode.Rayman3GC) { + if (kfFile != null && Legacy_Settings.s.mode == Legacy_Settings.Mode.Rayman3GC) { kfFile.GotoHeader(); reader = kfFile.reader; uint[] a3d_sizes = new uint[num_a3d]; for (uint i = 0; i < num_a3d; i++) { a3d_sizes[i] = reader.ReadUInt32(); } - off_a3d = Pointer.Current(reader); + off_a3d = LegacyPointer.Current(reader); uint current_anim = 0; for (uint i = 0; i < banks.Length; i++) { uint num_a3d_in_bank = banks[i].a3d_general.count; for (uint j = 0; j < num_a3d_in_bank; j++) { - Pointer.Goto(ref reader, off_a3d); + LegacyPointer.Goto(ref reader, off_a3d); // Read animation data here banks[i].animations[j] = l.FromOffsetOrRead(reader, off_a3d, onPreRead: (a3d) => { a3d.readFull = true; @@ -164,7 +164,7 @@ public static AnimationBank[] Read(Reader reader, Pointer offset, uint index, ui off_a3d += a3d_sizes[current_anim]; // Check if read correctly - Pointer off_postAnim = Pointer.Current(reader); + LegacyPointer off_postAnim = LegacyPointer.Current(reader); if (off_postAnim != off_a3d) l.print("Animation block size does not match data size: " + "Current offset: " + off_postAnim + " - Expected offset: " + off_a3d + " - Block start: " + (off_a3d + -(int)(a3d_sizes[current_anim]))); @@ -172,47 +172,47 @@ public static AnimationBank[] Read(Reader reader, Pointer offset, uint index, ui current_anim++; } } - } else if (Settings.s.mode != Settings.Mode.Rayman3GC) { + } else if (Legacy_Settings.s.mode != Legacy_Settings.Mode.Rayman3GC) { for (uint i = 0; i < banks.Length; i++) { - if (Settings.s.engineVersion < Settings.EngineVersion.R3) reader.AutoAligning = true; + if (Legacy_Settings.s.engineVersion < Legacy_Settings.EngineVersion.R3) reader.AutoAligning = true; - if (banks[i].a3d_general.off_data != null) Pointer.Goto(ref reader, banks[i].a3d_general.off_data); + if (banks[i].a3d_general.off_data != null) LegacyPointer.Goto(ref reader, banks[i].a3d_general.off_data); banks[i].animations = l.ReadArray(banks[i].a3d_general.Count(append), reader); if (reader.AutoAligning) reader.AutoAlign(4); - if (banks[i].vectors.off_data != null) Pointer.Goto(ref reader, banks[i].vectors.off_data); + if (banks[i].vectors.off_data != null) LegacyPointer.Goto(ref reader, banks[i].vectors.off_data); banks[i].global_vectors = l.ReadArray(banks[i].vectors.Count(append), reader); if (reader.AutoAligning) reader.AutoAlign(4); - if (banks[i].quaternions.off_data != null) Pointer.Goto(ref reader, banks[i].quaternions.off_data); + if (banks[i].quaternions.off_data != null) LegacyPointer.Goto(ref reader, banks[i].quaternions.off_data); banks[i].global_quaternions = l.ReadArray(banks[i].quaternions.Count(append), reader); if (reader.AutoAligning) reader.AutoAlign(4); - if (banks[i].hierarchies.off_data != null) Pointer.Goto(ref reader, banks[i].hierarchies.off_data); + if (banks[i].hierarchies.off_data != null) LegacyPointer.Goto(ref reader, banks[i].hierarchies.off_data); banks[i].global_hierarchies = l.ReadArray(banks[i].hierarchies.Count(append), reader); if (reader.AutoAligning) reader.AutoAlign(4); - if (banks[i].NTTO.off_data != null) Pointer.Goto(ref reader, banks[i].NTTO.off_data); + if (banks[i].NTTO.off_data != null) LegacyPointer.Goto(ref reader, banks[i].NTTO.off_data); banks[i].global_NTTO = l.ReadArray(banks[i].NTTO.Count(append), reader); if (reader.AutoAligning) reader.AutoAlign(4); - if (banks[i].onlyFrames.off_data != null) Pointer.Goto(ref reader, banks[i].onlyFrames.off_data); + if (banks[i].onlyFrames.off_data != null) LegacyPointer.Goto(ref reader, banks[i].onlyFrames.off_data); banks[i].global_onlyFrames = l.ReadArray(banks[i].onlyFrames.Count(append), reader); if (reader.AutoAligning) reader.AutoAlign(4); - if (banks[i].channels.off_data != null) Pointer.Goto(ref reader, banks[i].channels.off_data); + if (banks[i].channels.off_data != null) LegacyPointer.Goto(ref reader, banks[i].channels.off_data); banks[i].global_channels = l.ReadArray(banks[i].channels.Count(append), reader); if (reader.AutoAligning) reader.AutoAlign(4); - if (banks[i].framesNumOfNTTO.off_data != null) Pointer.Goto(ref reader, banks[i].framesNumOfNTTO.off_data); + if (banks[i].framesNumOfNTTO.off_data != null) LegacyPointer.Goto(ref reader, banks[i].framesNumOfNTTO.off_data); banks[i].global_numOfNTTO = l.ReadArray(banks[i].framesNumOfNTTO.Count(append), reader); if (reader.AutoAligning) reader.AutoAlign(4); - if (banks[i].framesKFIndex.off_data != null) Pointer.Goto(ref reader, banks[i].framesKFIndex.off_data); + if (banks[i].framesKFIndex.off_data != null) LegacyPointer.Goto(ref reader, banks[i].framesKFIndex.off_data); banks[i].global_framesKFIndex = l.ReadArray(banks[i].framesKFIndex.Count(append), reader); if (reader.AutoAligning) reader.AutoAlign(4); - if (banks[i].keyframes.off_data != null) Pointer.Goto(ref reader, banks[i].keyframes.off_data); + if (banks[i].keyframes.off_data != null) LegacyPointer.Goto(ref reader, banks[i].keyframes.off_data); if (banks[i].keyframes.Count(append) > 0 && kfFile != null) { int alignBytes = reader.ReadInt32(); if(alignBytes > 0) reader.Align(4, alignBytes); @@ -220,16 +220,16 @@ public static AnimationBank[] Read(Reader reader, Pointer offset, uint index, ui banks[i].global_keyframes = l.ReadArray(banks[i].keyframes.Count(append), reader); if (reader.AutoAligning) reader.AutoAlign(4); - if (banks[i].events.off_data != null) Pointer.Goto(ref reader, banks[i].events.off_data); + if (banks[i].events.off_data != null) LegacyPointer.Goto(ref reader, banks[i].events.off_data); banks[i].global_events = l.ReadArray(banks[i].events.Count(append), reader); if (reader.AutoAligning) reader.AutoAlign(4); - if (banks[i].morphData.off_data != null) Pointer.Goto(ref reader, banks[i].morphData.off_data); + if (banks[i].morphData.off_data != null) LegacyPointer.Goto(ref reader, banks[i].morphData.off_data); banks[i].global_morphData = l.ReadArray(banks[i].morphData.Count(append), reader); - if (Settings.s.hasDeformations) { + if (Legacy_Settings.s.hasDeformations) { if (reader.AutoAligning) reader.AutoAlign(4); - if (banks[i].deformations.off_data != null) Pointer.Goto(ref reader, banks[i].deformations.off_data); + if (banks[i].deformations.off_data != null) LegacyPointer.Goto(ref reader, banks[i].deformations.off_data); banks[i].global_deformations = l.ReadArray(banks[i].deformations.Count(append), reader); } reader.AutoAligning = false; @@ -308,29 +308,29 @@ public static AnimationBank[] Read(Reader reader, Pointer offset, uint index, ui if(append) Util.AppendArrayAndMergeReferences(ref l.animationBanks[index + i].animations, ref banks[i].animations, (int)banks[i].a3d_general.countInFix); } } - Pointer.Goto(ref reader, off_current); + LegacyPointer.Goto(ref reader, off_current); //Debug.LogError("Bank here: " + offset); return banks; } // A completely separate Read function for the Dreamcast version, since it's so different - public static AnimationBank ReadDreamcast(Reader reader, Pointer offset, Pointer off_events_fix, uint num_events_fix) { + public static AnimationBank ReadDreamcast(Reader reader, LegacyPointer offset, LegacyPointer off_events_fix, uint num_events_fix) { MapLoader l = MapLoader.Loader; AnimationBank bank = new AnimationBank(offset); - bank.a3d_general = new AnimationStack() { off_data = Pointer.Read(reader) }; - bank.vectors = new AnimationStack() { off_data = Pointer.Read(reader) }; - bank.quaternions = new AnimationStack() { off_data = Pointer.Read(reader) }; - bank.hierarchies = new AnimationStack() { off_data = Pointer.Read(reader) }; - bank.NTTO = new AnimationStack() { off_data = Pointer.Read(reader) }; - bank.onlyFrames = new AnimationStack() { off_data = Pointer.Read(reader) }; - bank.channels = new AnimationStack() { off_data = Pointer.Read(reader) }; - bank.framesNumOfNTTO = new AnimationStack() { off_data = Pointer.Read(reader) }; - bank.framesKFIndex = new AnimationStack() { off_data = Pointer.Read(reader) }; - bank.keyframes = new AnimationStack() { off_data = Pointer.Read(reader) }; - bank.events = new AnimationStack() { off_data = Pointer.Read(reader), countInFix = num_events_fix }; + bank.a3d_general = new AnimationStack() { off_data = LegacyPointer.Read(reader) }; + bank.vectors = new AnimationStack() { off_data = LegacyPointer.Read(reader) }; + bank.quaternions = new AnimationStack() { off_data = LegacyPointer.Read(reader) }; + bank.hierarchies = new AnimationStack() { off_data = LegacyPointer.Read(reader) }; + bank.NTTO = new AnimationStack() { off_data = LegacyPointer.Read(reader) }; + bank.onlyFrames = new AnimationStack() { off_data = LegacyPointer.Read(reader) }; + bank.channels = new AnimationStack() { off_data = LegacyPointer.Read(reader) }; + bank.framesNumOfNTTO = new AnimationStack() { off_data = LegacyPointer.Read(reader) }; + bank.framesKFIndex = new AnimationStack() { off_data = LegacyPointer.Read(reader) }; + bank.keyframes = new AnimationStack() { off_data = LegacyPointer.Read(reader) }; + bank.events = new AnimationStack() { off_data = LegacyPointer.Read(reader), countInFix = num_events_fix }; bank.events.count = bank.events.countInFix + reader.ReadUInt32(); - bank.morphData = new AnimationStack() { off_data = Pointer.Read(reader) }; - Pointer off_current = Pointer.Current(reader); + bank.morphData = new AnimationStack() { off_data = LegacyPointer.Read(reader) }; + LegacyPointer off_current = LegacyPointer.Current(reader); uint max_a3d_ind = 0, num_vectors = 0, num_quaternions = 0, num_hierarchies = 0, num_NTTO = 0, num_numNTTO = 0, num_channels = 0, num_onlyFrames = 0, num_framesKF = 0, num_keyframes = 0, num_morphData = 0; @@ -402,7 +402,7 @@ public static AnimationBank ReadDreamcast(Reader reader, Pointer offset, Pointer bank.keyframes.count = num_keyframes; bank.global_keyframes = l.ReadArray(bank.keyframes.Count(false), reader, bank.keyframes.off_data); - Pointer.Goto(ref reader, off_current); + LegacyPointer.Goto(ref reader, off_current); for (uint j = 0; j < bank.animations.Length; j++) { bank.animations[j].vectors = bank.global_vectors; bank.animations[j].quaternions = bank.global_quaternions; diff --git a/Assets/Scripts/OpenSpace/Animation/AnimationMontreal.cs b/Assets/Scripts/OpenSpace/Animation/AnimationMontreal.cs index 615303f2..c84303b2 100644 --- a/Assets/Scripts/OpenSpace/Animation/AnimationMontreal.cs +++ b/Assets/Scripts/OpenSpace/Animation/AnimationMontreal.cs @@ -8,25 +8,25 @@ namespace OpenSpace.Animation { public class AnimationMontreal : OpenSpaceStruct { - public Pointer off_frames = null; + public LegacyPointer off_frames = null; public byte num_frames; public byte speed; public byte num_channels; public byte unkbyte; - public Pointer off_unk; + public LegacyPointer off_unk; public Matrix speedMatrix; public AnimFrameMontreal[] frames; protected override void ReadInternal(Reader reader) { - off_frames = Pointer.Read(reader); + off_frames = LegacyPointer.Read(reader); num_frames = reader.ReadByte(); speed = reader.ReadByte(); num_channels = reader.ReadByte(); unkbyte = reader.ReadByte(); - off_unk = Pointer.Read(reader); + off_unk = LegacyPointer.Read(reader); reader.ReadUInt32(); reader.ReadUInt32(); - speedMatrix = Matrix.Read(reader, Pointer.Current(reader)); + speedMatrix = Matrix.Read(reader, LegacyPointer.Current(reader)); reader.ReadUInt32(); reader.ReadUInt32(); diff --git a/Assets/Scripts/OpenSpace/Animation/AnimationReference.cs b/Assets/Scripts/OpenSpace/Animation/AnimationReference.cs index ecc29338..1c78ffa0 100644 --- a/Assets/Scripts/OpenSpace/Animation/AnimationReference.cs +++ b/Assets/Scripts/OpenSpace/Animation/AnimationReference.cs @@ -13,25 +13,25 @@ public class AnimationReference : OpenSpaceStruct { // Also known as Anim3d public ushort num_onlyFrames; public byte speed; public byte num_channels; - public Pointer off_events; + public LegacyPointer off_events; public float x; public float y; public float z; - public Pointer off_morphData; + public LegacyPointer off_morphData; public ushort anim_index; // Index of animation within bank public byte num_events; public byte transition; public AnimMorphData[,] morphDataArray; // [channel][frame] - public Pointer off_a3d = null; + public LegacyPointer off_a3d = null; public AnimA3DGeneral a3d = null; public AnimA3DLargo a3dLargo = null; protected override void ReadInternal(Reader reader) { - if (Settings.s.game == Settings.Game.R2Revolution) { - off_a3d = Pointer.Read(reader); + if (Legacy_Settings.s.game == Legacy_Settings.Game.R2Revolution) { + off_a3d = LegacyPointer.Read(reader); reader.ReadUInt32(); - off_events = Pointer.Read(reader); + off_events = LegacyPointer.Read(reader); reader.ReadUInt32(); reader.ReadUInt32(); reader.ReadUInt32(); @@ -42,24 +42,24 @@ protected override void ReadInternal(Reader reader) { num_events = reader.ReadByte(); transition = reader.ReadByte(); } else { - if (Settings.s.hasNames) name = new string(reader.ReadChars(0x50)); - if (Settings.s.engineVersion <= Settings.EngineVersion.TT) reader.ReadUInt32(); - if (Settings.s.game == Settings.Game.LargoWinch) off_a3d = Pointer.Read(reader); + if (Legacy_Settings.s.hasNames) name = new string(reader.ReadChars(0x50)); + if (Legacy_Settings.s.engineVersion <= Legacy_Settings.EngineVersion.TT) reader.ReadUInt32(); + if (Legacy_Settings.s.game == Legacy_Settings.Game.LargoWinch) off_a3d = LegacyPointer.Read(reader); num_onlyFrames = reader.ReadUInt16(); speed = reader.ReadByte(); num_channels = reader.ReadByte(); - off_events = Pointer.Read(reader); - if (Settings.s.engineVersion < Settings.EngineVersion.R3) { + off_events = LegacyPointer.Read(reader); + if (Legacy_Settings.s.engineVersion < Legacy_Settings.EngineVersion.R3) { x = reader.ReadSingle(); y = reader.ReadSingle(); z = reader.ReadSingle(); } - off_morphData = Pointer.Read(reader); // Runtime only? - if (Settings.s.engineVersion <= Settings.EngineVersion.TT) { + off_morphData = LegacyPointer.Read(reader); // Runtime only? + if (Legacy_Settings.s.engineVersion <= Legacy_Settings.EngineVersion.TT) { reader.ReadUInt32(); reader.ReadUInt32(); } - if (Settings.s.game != Settings.Game.LargoWinch) { + if (Legacy_Settings.s.game != Legacy_Settings.Game.LargoWinch) { anim_index = reader.ReadUInt16(); num_events = reader.ReadByte(); transition = reader.ReadByte(); @@ -69,19 +69,19 @@ protected override void ReadInternal(Reader reader) { anim_index = reader.ReadUInt16(); } - if (Settings.s.engineVersion == Settings.EngineVersion.R2) reader.ReadUInt32(); // no idea what this is sadly - if (Settings.s.engineVersion <= Settings.EngineVersion.TT) { - off_a3d = Pointer.Read(reader); + if (Legacy_Settings.s.engineVersion == Legacy_Settings.EngineVersion.R2) reader.ReadUInt32(); // no idea what this is sadly + if (Legacy_Settings.s.engineVersion <= Legacy_Settings.EngineVersion.TT) { + off_a3d = LegacyPointer.Read(reader); } } MapLoader l = MapLoader.Loader; - if (Settings.s.game == Settings.Game.LargoWinch) { + if (Legacy_Settings.s.game == Legacy_Settings.Game.LargoWinch) { a3dLargo = l.FromOffsetOrRead(reader, off_a3d, (a) => { a.num_onlyFrames = num_onlyFrames; a.num_channels = num_channels; }); } else { - Pointer.DoAt(ref reader, off_a3d, () => { + LegacyPointer.DoAt(ref reader, off_a3d, () => { a3d = l.FromOffsetOrRead(reader, off_a3d, onPreRead: a3d => a3d.readFull = true); }); } diff --git a/Assets/Scripts/OpenSpace/Animation/AnimationStack.cs b/Assets/Scripts/OpenSpace/Animation/AnimationStack.cs index 98a3e329..b08dfece 100644 --- a/Assets/Scripts/OpenSpace/Animation/AnimationStack.cs +++ b/Assets/Scripts/OpenSpace/Animation/AnimationStack.cs @@ -6,7 +6,7 @@ namespace OpenSpace.Animation { public class AnimationStack { - public Pointer off_data = null; + public LegacyPointer off_data = null; public uint count; public uint reservedMemory; public uint countInFix; @@ -18,8 +18,8 @@ public static AnimationStack Read(Reader reader) { reader.ReadUInt32(); stack.count = reader.ReadUInt32(); stack.reservedMemory = reader.ReadUInt32(); - if (Settings.s.engineVersion == Settings.EngineVersion.R3 - && Settings.s.game != Settings.Game.Dinosaur) reader.ReadUInt32(); + if (Legacy_Settings.s.engineVersion == Legacy_Settings.EngineVersion.R3 + && Legacy_Settings.s.game != Legacy_Settings.Game.Dinosaur) reader.ReadUInt32(); stack.countInFix = reader.ReadUInt32(); return stack; } diff --git a/Assets/Scripts/OpenSpace/Animation/Component/AnimA3DGeneral.cs b/Assets/Scripts/OpenSpace/Animation/Component/AnimA3DGeneral.cs index 01aa1a11..5dd37fe0 100644 --- a/Assets/Scripts/OpenSpace/Animation/Component/AnimA3DGeneral.cs +++ b/Assets/Scripts/OpenSpace/Animation/Component/AnimA3DGeneral.cs @@ -54,12 +54,12 @@ public class AnimA3DGeneral : OpenSpaceStruct { public AnimDeformation[] deformations; protected override void ReadInternal(Reader reader) { - if (readFull && Settings.s.game != Settings.Game.R2Revolution) { + if (readFull && Legacy_Settings.s.game != Legacy_Settings.Game.R2Revolution) { reader.AutoAligning = true; } - if (Settings.s.game == Settings.Game.R2Revolution) { + if (Legacy_Settings.s.game == Legacy_Settings.Game.R2Revolution) { ReadRevolution(reader); - } else if (Settings.s.engineVersion < Settings.EngineVersion.R3) { + } else if (Legacy_Settings.s.engineVersion < Legacy_Settings.EngineVersion.R3) { /* Each a3d is 0x38 long in R2. 0x34 in TT */ speed = reader.ReadUInt16(); num_vectors = reader.ReadUInt16(); @@ -70,9 +70,9 @@ protected override void ReadInternal(Reader reader) { num_channels = reader.ReadUInt16(); num_onlyFrames = reader.ReadUInt16(); num_keyframes = reader.ReadUInt16(); - if (Settings.s.engineVersion >= Settings.EngineVersion.R2 - && Settings.s.game != Settings.Game.R2Demo - && Settings.s.game != Settings.Game.RedPlanet) { + if (Legacy_Settings.s.engineVersion >= Legacy_Settings.EngineVersion.R2 + && Legacy_Settings.s.game != Legacy_Settings.Game.R2Demo + && Legacy_Settings.s.game != Legacy_Settings.Game.RedPlanet) { unk_14 = reader.ReadUInt16(); } num_events = reader.ReadUInt16(); @@ -92,12 +92,12 @@ protected override void ReadInternal(Reader reader) { start_channels = reader.ReadUInt16(); start_events = reader.ReadUInt16(); start_morphData = reader.ReadUInt16(); - if (Settings.s.engineVersion >= Settings.EngineVersion.R2 - && Settings.s.game != Settings.Game.R2Demo - && Settings.s.game != Settings.Game.RedPlanet) { + if (Legacy_Settings.s.engineVersion >= Legacy_Settings.EngineVersion.R2 + && Legacy_Settings.s.game != Legacy_Settings.Game.R2Demo + && Legacy_Settings.s.game != Legacy_Settings.Game.RedPlanet) { reader.ReadUInt16(); // padding? } - if (Settings.s.engineVersion == Settings.EngineVersion.TT) { + if (Legacy_Settings.s.engineVersion == Legacy_Settings.EngineVersion.TT) { start_vectors2 = 0; start_quaternions2 = 0; start_vectors = 0; @@ -142,7 +142,7 @@ protected override void ReadInternal(Reader reader) { start_events = reader.ReadUInt16(); start_morphData = reader.ReadUInt16(); } - if (readFull && Settings.s.game != Settings.Game.R2Revolution) { + if (readFull && Legacy_Settings.s.game != Legacy_Settings.Game.R2Revolution) { ReadFull(reader); reader.AutoAligning = false; } @@ -151,17 +151,17 @@ protected override void ReadInternal(Reader reader) { private void ReadRevolution(Reader reader) { MapLoader l = MapLoader.Loader; - Pointer off_vectors = Pointer.Read(reader); - Pointer off_quaternions = Pointer.Read(reader); - Pointer off_hierarchies = Pointer.Read(reader); - Pointer off_ntto = Pointer.Read(reader); - Pointer off_onlyFrames = Pointer.Read(reader); - Pointer off_channels = Pointer.Read(reader); - Pointer off_numNTTO = Pointer.Read(reader); - Pointer off_kfIndex = Pointer.Read(reader); - Pointer off_keyframes = Pointer.Read(reader); - Pointer off_events = Pointer.Read(reader); - Pointer off_morphData = Pointer.Read(reader); + LegacyPointer off_vectors = LegacyPointer.Read(reader); + LegacyPointer off_quaternions = LegacyPointer.Read(reader); + LegacyPointer off_hierarchies = LegacyPointer.Read(reader); + LegacyPointer off_ntto = LegacyPointer.Read(reader); + LegacyPointer off_onlyFrames = LegacyPointer.Read(reader); + LegacyPointer off_channels = LegacyPointer.Read(reader); + LegacyPointer off_numNTTO = LegacyPointer.Read(reader); + LegacyPointer off_kfIndex = LegacyPointer.Read(reader); + LegacyPointer off_keyframes = LegacyPointer.Read(reader); + LegacyPointer off_events = LegacyPointer.Read(reader); + LegacyPointer off_morphData = LegacyPointer.Read(reader); speed = reader.ReadUInt16(); num_vectors = reader.ReadUInt16(); num_quaternions = reader.ReadUInt16(); @@ -213,7 +213,7 @@ private void ReadFull(Reader reader) { framesKFIndex = l.ReadArray(num_onlyFrames * num_channels, reader); if (AnimKeyframe.Aligned) reader.AutoAlign(4); keyframes = l.ReadArray(num_keyframes, reader); - if (Settings.s.engineVersion > Settings.EngineVersion.TT) { + if (Legacy_Settings.s.engineVersion > Legacy_Settings.EngineVersion.TT) { if (AnimEvent.Aligned) reader.AutoAlign(4); events = l.ReadArray(num_events, reader); if (AnimMorphData.Aligned) reader.AutoAlign(4); @@ -228,7 +228,7 @@ private void ReadFull(Reader reader) { + " - KFI: " + a3d.num_onlyFrames * a3d.num_channels + " - V:" + a3d.num_vectors + " - Q:" + a3d.num_quaternions);*/ - if (Settings.s.hasDeformations) { + if (Legacy_Settings.s.hasDeformations) { if (AnimDeformation.Aligned) reader.AutoAlign(4); deformations = l.ReadArray(num_deformations, reader); //reader.Align(AnimDeformation.Size * a3d.deformations.Length, 4); diff --git a/Assets/Scripts/OpenSpace/Animation/Component/AnimChannel.cs b/Assets/Scripts/OpenSpace/Animation/Component/AnimChannel.cs index aa461c61..00617cf9 100644 --- a/Assets/Scripts/OpenSpace/Animation/Component/AnimChannel.cs +++ b/Assets/Scripts/OpenSpace/Animation/Component/AnimChannel.cs @@ -18,8 +18,8 @@ protected override void ReadInternal(Reader reader) { id = reader.ReadInt16(); vector = reader.ReadUInt16(); numOfNTTO = reader.ReadUInt16(); - if (Settings.s.engineVersion > Settings.EngineVersion.TT - && Settings.s.game != Settings.Game.R2Revolution) { + if (Legacy_Settings.s.engineVersion > Legacy_Settings.EngineVersion.TT + && Legacy_Settings.s.game != Legacy_Settings.Game.R2Revolution) { framesKF = reader.ReadUInt32(); keyframe = reader.ReadUInt32(); } else { @@ -44,7 +44,7 @@ protected override void ReadInternal(Reader reader) { public static bool Aligned { get { - if (Settings.s.engineVersion > Settings.EngineVersion.TT) { + if (Legacy_Settings.s.engineVersion > Legacy_Settings.EngineVersion.TT) { return true; } else { return false; diff --git a/Assets/Scripts/OpenSpace/Animation/Component/AnimDeformation.cs b/Assets/Scripts/OpenSpace/Animation/Component/AnimDeformation.cs index dd4d10f6..7206e148 100644 --- a/Assets/Scripts/OpenSpace/Animation/Component/AnimDeformation.cs +++ b/Assets/Scripts/OpenSpace/Animation/Component/AnimDeformation.cs @@ -12,7 +12,7 @@ public class AnimDeformation : OpenSpaceStruct { public ushort linkBone; // controlled/controlling bone protected override void ReadInternal(Reader reader) { - if (Settings.s.game == Settings.Game.LargoWinch) { + if (Legacy_Settings.s.game == Legacy_Settings.Game.LargoWinch) { channel = reader.ReadByte(); bone = reader.ReadByte(); linkChannel = reader.ReadByte(); diff --git a/Assets/Scripts/OpenSpace/Animation/Component/AnimEvent.cs b/Assets/Scripts/OpenSpace/Animation/Component/AnimEvent.cs index 724489dc..6b1505e0 100644 --- a/Assets/Scripts/OpenSpace/Animation/Component/AnimEvent.cs +++ b/Assets/Scripts/OpenSpace/Animation/Component/AnimEvent.cs @@ -13,7 +13,7 @@ public class AnimEvent : OpenSpaceStruct { public ushort unkA; protected override void ReadInternal(Reader reader) { - if (Settings.s.engineVersion <= Settings.EngineVersion.TT) { + if (Legacy_Settings.s.engineVersion <= Legacy_Settings.EngineVersion.TT) { unk0 = reader.ReadUInt32(); reader.ReadByte(); reader.ReadByte(); @@ -23,8 +23,8 @@ protected override void ReadInternal(Reader reader) { reader.ReadUInt32(); reader.ReadUInt32(); } else { - if (Settings.s.platform != Settings.Platform.DC && Settings.s.game != Settings.Game.RedPlanet) { - if (Settings.s.platform != Settings.Platform.iOS) { + if (Legacy_Settings.s.platform != Legacy_Settings.Platform.DC && Legacy_Settings.s.game != Legacy_Settings.Game.RedPlanet) { + if (Legacy_Settings.s.platform != Legacy_Settings.Platform.iOS) { unk0 = reader.ReadUInt32(); } unk4 = reader.ReadUInt16(); diff --git a/Assets/Scripts/OpenSpace/Animation/Component/AnimFramesKFIndex.cs b/Assets/Scripts/OpenSpace/Animation/Component/AnimFramesKFIndex.cs index da20ed9e..78354037 100644 --- a/Assets/Scripts/OpenSpace/Animation/Component/AnimFramesKFIndex.cs +++ b/Assets/Scripts/OpenSpace/Animation/Component/AnimFramesKFIndex.cs @@ -9,10 +9,10 @@ public class AnimFramesKFIndex : OpenSpaceStruct { public uint kf; protected override void ReadInternal(Reader reader) { - if (Settings.s.engineVersion == Settings.EngineVersion.TT || - Settings.s.game == Settings.Game.R2Demo || - Settings.s.game == Settings.Game.RedPlanet || - Settings.s.game == Settings.Game.R2Revolution) { + if (Legacy_Settings.s.engineVersion == Legacy_Settings.EngineVersion.TT || + Legacy_Settings.s.game == Legacy_Settings.Game.R2Demo || + Legacy_Settings.s.game == Legacy_Settings.Game.RedPlanet || + Legacy_Settings.s.game == Legacy_Settings.Game.R2Revolution) { kf = reader.ReadUInt16(); } else { kf = reader.ReadUInt32(); @@ -32,10 +32,10 @@ protected override void ReadInternal(Reader reader) { public static bool Aligned { get { - if (Settings.s.engineVersion == Settings.EngineVersion.TT || - Settings.s.game == Settings.Game.R2Demo || - Settings.s.game == Settings.Game.RedPlanet || - Settings.s.game == Settings.Game.R2Revolution) { + if (Legacy_Settings.s.engineVersion == Legacy_Settings.EngineVersion.TT || + Legacy_Settings.s.game == Legacy_Settings.Game.R2Demo || + Legacy_Settings.s.game == Legacy_Settings.Game.RedPlanet || + Legacy_Settings.s.game == Legacy_Settings.Game.R2Revolution) { return false; } else { return true; diff --git a/Assets/Scripts/OpenSpace/Animation/Component/AnimHierarchy.cs b/Assets/Scripts/OpenSpace/Animation/Component/AnimHierarchy.cs index ff596fea..e1ac29a3 100644 --- a/Assets/Scripts/OpenSpace/Animation/Component/AnimHierarchy.cs +++ b/Assets/Scripts/OpenSpace/Animation/Component/AnimHierarchy.cs @@ -10,7 +10,7 @@ public class AnimHierarchy : OpenSpaceStruct { public short parentChannelID; protected override void ReadInternal(Reader reader) { - if (Settings.s.game == Settings.Game.LargoWinch) { + if (Legacy_Settings.s.game == Legacy_Settings.Game.LargoWinch) { childChannelID = reader.ReadByte(); parentChannelID = reader.ReadByte(); } else { diff --git a/Assets/Scripts/OpenSpace/Animation/Component/AnimKeyframe.cs b/Assets/Scripts/OpenSpace/Animation/Component/AnimKeyframe.cs index 6af40f8e..2df37156 100644 --- a/Assets/Scripts/OpenSpace/Animation/Component/AnimKeyframe.cs +++ b/Assets/Scripts/OpenSpace/Animation/Component/AnimKeyframe.cs @@ -21,10 +21,10 @@ public class AnimKeyframe : OpenSpaceStruct { public static ushort flag_endKF = (1 << 7); protected override void ReadInternal(Reader reader) { - if (Settings.s.engineVersion < Settings.EngineVersion.R3 - || Settings.s.game == Settings.Game.RM - || Settings.s.game == Settings.Game.Dinosaur - || (Settings.s.game == Settings.Game.RA && Settings.s.platform == Settings.Platform.PS2)) { + if (Legacy_Settings.s.engineVersion < Legacy_Settings.EngineVersion.R3 + || Legacy_Settings.s.game == Legacy_Settings.Game.RM + || Legacy_Settings.s.game == Legacy_Settings.Game.Dinosaur + || (Legacy_Settings.s.game == Legacy_Settings.Game.RA && Legacy_Settings.s.platform == Legacy_Settings.Platform.PS2)) { x = reader.ReadSingle(); y = reader.ReadSingle(); z = reader.ReadSingle(); @@ -37,10 +37,10 @@ protected override void ReadInternal(Reader reader) { scaleVector = reader.ReadUInt16(); positionVector = reader.ReadUInt16(); - if (Settings.s.engineVersion < Settings.EngineVersion.R3 - || Settings.s.game == Settings.Game.RM - || Settings.s.game == Settings.Game.Dinosaur - || (Settings.s.game == Settings.Game.RA && Settings.s.platform == Settings.Platform.PS2)) { + if (Legacy_Settings.s.engineVersion < Legacy_Settings.EngineVersion.R3 + || Legacy_Settings.s.game == Legacy_Settings.Game.RM + || Legacy_Settings.s.game == Legacy_Settings.Game.Dinosaur + || (Legacy_Settings.s.game == Legacy_Settings.Game.RA && Legacy_Settings.s.platform == Legacy_Settings.Platform.PS2)) { reader.ReadUInt16(); reader.ReadUInt16(); reader.ReadUInt16(); @@ -71,7 +71,7 @@ public bool IsEndKeyframe { public static bool Aligned { get { - if (Settings.s.engineVersion < Settings.EngineVersion.R3) { + if (Legacy_Settings.s.engineVersion < Legacy_Settings.EngineVersion.R3) { return true; } else { return false; diff --git a/Assets/Scripts/OpenSpace/Animation/Component/AnimMorphData.cs b/Assets/Scripts/OpenSpace/Animation/Component/AnimMorphData.cs index 2bdce31e..75e388cc 100644 --- a/Assets/Scripts/OpenSpace/Animation/Component/AnimMorphData.cs +++ b/Assets/Scripts/OpenSpace/Animation/Component/AnimMorphData.cs @@ -18,7 +18,7 @@ public float morphProgressFloat { } } public float GetMorphProgressFloat(int i) { - if (Settings.s.engineVersion >= Settings.EngineVersion.R3 && i < morphProgressArray.Length) { + if (Legacy_Settings.s.engineVersion >= Legacy_Settings.EngineVersion.R3 && i < morphProgressArray.Length) { return ((float)morphProgressArray[i]) / 100.0f; } else { return morphProgressFloat; @@ -31,7 +31,7 @@ public float GetMorphProgressFloat(int i) { public ushort[] objectIndexToArray; protected override void ReadInternal(Reader reader) { - if (Settings.s.engineVersion < Settings.EngineVersion.R3) { + if (Legacy_Settings.s.engineVersion < Legacy_Settings.EngineVersion.R3) { objectIndexTo = reader.ReadByte(); // object index to morph to morphProgress = reader.ReadByte(); // 0-100, at 100 the morph is over. channel = reader.ReadInt16(); // the channel for which this morph data is relevant diff --git a/Assets/Scripts/OpenSpace/Animation/Component/AnimNTTO.cs b/Assets/Scripts/OpenSpace/Animation/Component/AnimNTTO.cs index 72e66f16..6048df53 100644 --- a/Assets/Scripts/OpenSpace/Animation/Component/AnimNTTO.cs +++ b/Assets/Scripts/OpenSpace/Animation/Component/AnimNTTO.cs @@ -15,7 +15,7 @@ public class AnimNTTO : OpenSpaceStruct { public static ushort flag_isInvisible = 0x2; protected override void ReadInternal(Reader reader) { - if (Settings.s.engineVersion <= Settings.EngineVersion.TT) { + if (Legacy_Settings.s.engineVersion <= Legacy_Settings.EngineVersion.TT) { object_index = reader.ReadUInt16(); flags = reader.ReadUInt16(); } else { @@ -28,7 +28,7 @@ protected override void ReadInternal(Reader reader) { public bool IsInvisibleNTTO { get { - if (Settings.s.engineVersion == Settings.EngineVersion.R3) { + if (Legacy_Settings.s.engineVersion == Legacy_Settings.EngineVersion.R3) { return (flags & flag_isBoneNTTO) != 0; } else { return (flags & flag_isInvisible) == flag_isInvisible; diff --git a/Assets/Scripts/OpenSpace/Animation/Component/AnimOnlyFrame.cs b/Assets/Scripts/OpenSpace/Animation/Component/AnimOnlyFrame.cs index 3c607837..445c3ac5 100644 --- a/Assets/Scripts/OpenSpace/Animation/Component/AnimOnlyFrame.cs +++ b/Assets/Scripts/OpenSpace/Animation/Component/AnimOnlyFrame.cs @@ -19,14 +19,14 @@ protected override void ReadInternal(Reader reader) { vector = reader.ReadUInt16(); num_hierarchies_for_frame = reader.ReadUInt16(); start_hierarchies_for_frame = reader.ReadUInt16(); - if (Settings.s.hasDeformations) { - if (Settings.s.game != Settings.Game.LargoWinch) { + if (Legacy_Settings.s.hasDeformations) { + if (Legacy_Settings.s.game != Legacy_Settings.Game.LargoWinch) { unk8 = reader.ReadUInt16(); } deformation = reader.ReadUInt16(); } numOfNTTO = reader.ReadUInt16(); - if (Settings.s.engineVersion == Settings.EngineVersion.TT) { + if (Legacy_Settings.s.engineVersion == Legacy_Settings.EngineVersion.TT) { unk8 = reader.ReadUInt16(); } } diff --git a/Assets/Scripts/OpenSpace/Animation/ComponentLargo/AnimA3DLargo.cs b/Assets/Scripts/OpenSpace/Animation/ComponentLargo/AnimA3DLargo.cs index 481291ad..cc0a7864 100644 --- a/Assets/Scripts/OpenSpace/Animation/ComponentLargo/AnimA3DLargo.cs +++ b/Assets/Scripts/OpenSpace/Animation/ComponentLargo/AnimA3DLargo.cs @@ -8,17 +8,17 @@ namespace OpenSpace.Animation.ComponentLargo { public class AnimA3DLargo : OpenSpaceStruct { - public Pointer off_vectors; - public Pointer off_quaternions; - public Pointer off_hierarchies; - public Pointer off_ntto; - public Pointer off_onlyFrames; - public Pointer off_channels; - public Pointer off_numNTTO; - public Pointer off_frameVector; - public Pointer off_frameQuaternion; - public Pointer off_unknowns; - public Pointer off_deformations; + public LegacyPointer off_vectors; + public LegacyPointer off_quaternions; + public LegacyPointer off_hierarchies; + public LegacyPointer off_ntto; + public LegacyPointer off_onlyFrames; + public LegacyPointer off_channels; + public LegacyPointer off_numNTTO; + public LegacyPointer off_frameVector; + public LegacyPointer off_frameQuaternion; + public LegacyPointer off_unknowns; + public LegacyPointer off_deformations; public ushort num_onlyFrames; public byte num_channels; @@ -47,17 +47,17 @@ public class AnimA3DLargo : OpenSpaceStruct { protected override void ReadInternal(Reader reader) { MapLoader l = MapLoader.Loader; - off_vectors = Pointer.Read(reader); - off_quaternions = Pointer.Read(reader); - off_hierarchies = Pointer.Read(reader); - off_ntto = Pointer.Read(reader); - off_onlyFrames = Pointer.Read(reader); - off_channels = Pointer.Read(reader); - off_numNTTO = Pointer.Read(reader); - off_frameVector = Pointer.Read(reader); - off_frameQuaternion = Pointer.Read(reader); - off_unknowns = Pointer.Read(reader); - off_deformations = Pointer.Read(reader); + off_vectors = LegacyPointer.Read(reader); + off_quaternions = LegacyPointer.Read(reader); + off_hierarchies = LegacyPointer.Read(reader); + off_ntto = LegacyPointer.Read(reader); + off_onlyFrames = LegacyPointer.Read(reader); + off_channels = LegacyPointer.Read(reader); + off_numNTTO = LegacyPointer.Read(reader); + off_frameVector = LegacyPointer.Read(reader); + off_frameQuaternion = LegacyPointer.Read(reader); + off_unknowns = LegacyPointer.Read(reader); + off_deformations = LegacyPointer.Read(reader); onlyFrames = l.ReadArray(num_onlyFrames, reader, off_onlyFrames); channels = l.ReadArray(num_channels, reader, off_channels); diff --git a/Assets/Scripts/OpenSpace/Animation/ComponentMontreal/AnimChannelMontreal.cs b/Assets/Scripts/OpenSpace/Animation/ComponentMontreal/AnimChannelMontreal.cs index e6063022..0de6185e 100644 --- a/Assets/Scripts/OpenSpace/Animation/ComponentMontreal/AnimChannelMontreal.cs +++ b/Assets/Scripts/OpenSpace/Animation/ComponentMontreal/AnimChannelMontreal.cs @@ -8,7 +8,7 @@ namespace OpenSpace.Animation.ComponentMontreal { public class AnimChannelMontreal : OpenSpaceStruct { - public Pointer off_matrix; + public LegacyPointer off_matrix; public uint isIdentity = 0; public byte objectIndex; public byte unk1; @@ -20,7 +20,7 @@ public class AnimChannelMontreal : OpenSpaceStruct { public Matrix matrix = null; protected override void ReadInternal(Reader reader) { - off_matrix = Pointer.GetPointerAtOffset(Offset); + off_matrix = LegacyPointer.GetPointerAtOffset(Offset); isIdentity = reader.ReadUInt32(); // if this is 1, don't check the pointer objectIndex = reader.ReadByte(); unk1 = reader.ReadByte(); @@ -32,7 +32,7 @@ protected override void ReadInternal(Reader reader) { // Read compressed matrix if (isIdentity != 1 && isIdentity != 0) { - Pointer.DoAt(ref reader, off_matrix, () => { + LegacyPointer.DoAt(ref reader, off_matrix, () => { matrix = Matrix.ReadCompressed(reader, off_matrix); }); } diff --git a/Assets/Scripts/OpenSpace/Animation/ComponentMontreal/AnimFrameMontreal.cs b/Assets/Scripts/OpenSpace/Animation/ComponentMontreal/AnimFrameMontreal.cs index b5c7c1f7..bf26e4ed 100644 --- a/Assets/Scripts/OpenSpace/Animation/ComponentMontreal/AnimFrameMontreal.cs +++ b/Assets/Scripts/OpenSpace/Animation/ComponentMontreal/AnimFrameMontreal.cs @@ -9,10 +9,10 @@ namespace OpenSpace.Animation.ComponentMontreal { public class AnimFrameMontreal : OpenSpaceStruct { public AnimationMontreal anim; - public Pointer off_channels; - public Pointer off_mat; - public Pointer off_vec; - public Pointer off_hierarchies; + public LegacyPointer off_channels; + public LegacyPointer off_mat; + public LegacyPointer off_vec; + public LegacyPointer off_hierarchies; public AnimChannelMontreal[] channels = null; public AnimHierarchy[] hierarchies = null; @@ -20,24 +20,24 @@ public class AnimFrameMontreal : OpenSpaceStruct { protected override void ReadInternal(Reader reader) { MapLoader l = MapLoader.Loader; - off_channels = Pointer.Read(reader); - off_mat = Pointer.Read(reader); - off_vec = Pointer.Read(reader); - off_hierarchies = Pointer.Read(reader); + off_channels = LegacyPointer.Read(reader); + off_mat = LegacyPointer.Read(reader); + off_vec = LegacyPointer.Read(reader); + off_hierarchies = LegacyPointer.Read(reader); // Read channels - Pointer.DoAt(ref reader, off_channels, () => { + LegacyPointer.DoAt(ref reader, off_channels, () => { channels = new AnimChannelMontreal[anim.num_channels]; for (uint i = 0; i < channels.Length; i++) { - Pointer off_channel = Pointer.Read(reader); + LegacyPointer off_channel = LegacyPointer.Read(reader); channels[i] = l.FromOffsetOrRead(reader, off_channel); } }); // Read hierarchies - Pointer.DoAt(ref reader, off_hierarchies, () => { + LegacyPointer.DoAt(ref reader, off_hierarchies, () => { uint num_hierarchies = reader.ReadUInt32(); - Pointer off_hierarchies2 = Pointer.Read(reader); + LegacyPointer off_hierarchies2 = LegacyPointer.Read(reader); hierarchies = l.ReadArray((int)num_hierarchies, reader, off_hierarchies2); }); } diff --git a/Assets/Scripts/OpenSpace/Cinematics/Cinematic.cs b/Assets/Scripts/OpenSpace/Cinematics/Cinematic.cs index 5b831bce..47b5bf3f 100644 --- a/Assets/Scripts/OpenSpace/Cinematics/Cinematic.cs +++ b/Assets/Scripts/OpenSpace/Cinematics/Cinematic.cs @@ -10,35 +10,35 @@ namespace OpenSpace.Cinematics { /// Called "Cine" in the code /// public class Cinematic : ILinkedListEntry { - public Pointer offset; + public LegacyPointer offset; public LinkedList actors; - public Pointer off_next; - public Pointer off_previous; - public Pointer off_header; + public LegacyPointer off_next; + public LegacyPointer off_previous; + public LegacyPointer off_header; public uint unk; public string name = null; - public Cinematic(Pointer offset) { + public Cinematic(LegacyPointer offset) { this.offset = offset; } - public Pointer NextEntry { + public LegacyPointer NextEntry { get { return off_next; } } - public Pointer PreviousEntry { + public LegacyPointer PreviousEntry { get { return off_previous; } } - public static Cinematic Read(Reader reader, Pointer offset) { + public static Cinematic Read(Reader reader, LegacyPointer offset) { MapLoader l = MapLoader.Loader; Cinematic c = new Cinematic(offset); - c.actors = LinkedList.Read(ref reader, Pointer.Current(reader), (off_actor) => { + c.actors = LinkedList.Read(ref reader, LegacyPointer.Current(reader), (off_actor) => { return CinematicActor.Read(reader, off_actor); }, type: LinkedList.Type.Double); - c.off_next = Pointer.Read(reader); - c.off_previous = Pointer.Read(reader); - c.off_header = Pointer.Read(reader); + c.off_next = LegacyPointer.Read(reader); + c.off_previous = LegacyPointer.Read(reader); + c.off_header = LegacyPointer.Read(reader); reader.ReadUInt32(); reader.ReadUInt32(); c.name = reader.ReadString(0x100); diff --git a/Assets/Scripts/OpenSpace/Cinematics/CinematicActor.cs b/Assets/Scripts/OpenSpace/Cinematics/CinematicActor.cs index 0c2dd4ac..1be57f86 100644 --- a/Assets/Scripts/OpenSpace/Cinematics/CinematicActor.cs +++ b/Assets/Scripts/OpenSpace/Cinematics/CinematicActor.cs @@ -13,60 +13,60 @@ namespace OpenSpace.Cinematics { /// Called "Cine" in the code /// public class CinematicActor : ILinkedListEntry { - public Pointer offset; - public Pointer off_a3d; + public LegacyPointer offset; + public LegacyPointer off_a3d; public AnimationReference anim_ref; public string name = null; - public Pointer off_perso; - public Pointer off_waitState; - public Pointer off_cineState; + public LegacyPointer off_perso; + public LegacyPointer off_waitState; + public LegacyPointer off_cineState; public Perso perso; public State waitState; public State cineState; public byte setCustomBitFlag1, setCustomBitFlag2; public byte cineStateRepeatAnimation; public byte cineStateSpeed; - public Pointer off_IPO; + public LegacyPointer off_IPO; public byte hasChangeComport1, hasChangeComport2; - public Pointer off_comport1, off_comport2; + public LegacyPointer off_comport1, off_comport2; public byte[] hasSnd; public uint[] snd = new uint[4]; // CEventResData - public Pointer off_cinematic; + public LegacyPointer off_cinematic; - public Pointer off_next; - public Pointer off_previous; - public Pointer off_header; + public LegacyPointer off_next; + public LegacyPointer off_previous; + public LegacyPointer off_header; - public CinematicActor(Pointer offset) { + public CinematicActor(LegacyPointer offset) { this.offset = offset; } - public Pointer NextEntry { + public LegacyPointer NextEntry { get { return off_next; } } - public Pointer PreviousEntry { + public LegacyPointer PreviousEntry { get { return off_previous; } } - public static CinematicActor Read(Reader reader, Pointer offset) { + public static CinematicActor Read(Reader reader, LegacyPointer offset) { MapLoader l = MapLoader.Loader; CinematicActor ca = new CinematicActor(offset); - if (Settings.s.game == Settings.Game.R3 || Settings.s.game == Settings.Game.Dinosaur) { - if (Settings.s.platform != Settings.Platform.PS2) { - if (Settings.s.platform == Settings.Platform.GC) { + if (Legacy_Settings.s.game == Legacy_Settings.Game.R3 || Legacy_Settings.s.game == Legacy_Settings.Game.Dinosaur) { + if (Legacy_Settings.s.platform != Legacy_Settings.Platform.PS2) { + if (Legacy_Settings.s.platform == Legacy_Settings.Platform.GC) { reader.ReadUInt32(); reader.ReadUInt32(); } reader.ReadUInt32(); } } - ca.off_a3d = Pointer.Read(reader); + ca.off_a3d = LegacyPointer.Read(reader); reader.ReadUInt32(); ca.name = reader.ReadString(0x100); - ca.off_perso = Pointer.Read(reader); - ca.off_waitState = Pointer.Read(reader); - ca.off_cineState = Pointer.Read(reader); + ca.off_perso = LegacyPointer.Read(reader); + ca.off_waitState = LegacyPointer.Read(reader); + ca.off_cineState = LegacyPointer.Read(reader); reader.ReadUInt32(); ca.setCustomBitFlag1 = reader.ReadByte(); ca.setCustomBitFlag2 = reader.ReadByte(); @@ -76,7 +76,7 @@ public static CinematicActor Read(Reader reader, Pointer offset) { ca.cineStateSpeed = reader.ReadByte(); reader.ReadByte(); reader.ReadByte(); - ca.off_IPO = Pointer.Read(reader); + ca.off_IPO = LegacyPointer.Read(reader); reader.ReadByte(); reader.ReadByte(); reader.ReadByte(); @@ -85,12 +85,12 @@ public static CinematicActor Read(Reader reader, Pointer offset) { reader.ReadByte(); ca.hasChangeComport1 = reader.ReadByte(); reader.ReadByte(); - ca.off_comport1 = Pointer.Read(reader); + ca.off_comport1 = LegacyPointer.Read(reader); ca.hasChangeComport2 = reader.ReadByte(); reader.ReadByte(); reader.ReadByte(); reader.ReadByte(); - ca.off_comport2 = Pointer.Read(reader); + ca.off_comport2 = LegacyPointer.Read(reader); reader.ReadUInt32(); reader.ReadUInt32(); reader.ReadUInt32(); @@ -104,13 +104,13 @@ public static CinematicActor Read(Reader reader, Pointer offset) { reader.ReadUInt32(); reader.ReadUInt32(); reader.ReadUInt32(); - ca.off_cinematic = Pointer.Read(reader); + ca.off_cinematic = LegacyPointer.Read(reader); reader.ReadUInt32(); reader.ReadUInt32(); reader.ReadUInt32(); - ca.off_next = Pointer.Read(reader); - ca.off_previous = Pointer.Read(reader); - ca.off_header = Pointer.Read(reader); + ca.off_next = LegacyPointer.Read(reader); + ca.off_previous = LegacyPointer.Read(reader); + ca.off_header = LegacyPointer.Read(reader); //MapLoader.Loader.print(ca.name); ca.anim_ref = l.FromOffsetOrRead(reader, ca.off_a3d); diff --git a/Assets/Scripts/OpenSpace/Cinematics/CinematicsManager.cs b/Assets/Scripts/OpenSpace/Cinematics/CinematicsManager.cs index 97de132c..55f1a31d 100644 --- a/Assets/Scripts/OpenSpace/Cinematics/CinematicsManager.cs +++ b/Assets/Scripts/OpenSpace/Cinematics/CinematicsManager.cs @@ -7,22 +7,22 @@ namespace OpenSpace.Cinematics { public class CinematicsManager { - public Pointer offset; + public LegacyPointer offset; public LinkedList cinematics; public Matrix matrix; public uint unk; - public CinematicsManager(Pointer offset) { + public CinematicsManager(LegacyPointer offset) { this.offset = offset; } - public static CinematicsManager Read(Reader reader, Pointer offset) { + public static CinematicsManager Read(Reader reader, LegacyPointer offset) { MapLoader l = MapLoader.Loader; CinematicsManager cm = new CinematicsManager(offset); - cm.cinematics = LinkedList.Read(ref reader, Pointer.Current(reader), (off_cine) => { + cm.cinematics = LinkedList.Read(ref reader, LegacyPointer.Current(reader), (off_cine) => { return Cinematic.Read(reader, off_cine); }, type: LinkedList.Type.Double); - cm.matrix = Matrix.Read(reader, Pointer.Current(reader)); + cm.matrix = Matrix.Read(reader, LegacyPointer.Current(reader)); cm.unk = reader.ReadUInt32(); return cm; } diff --git a/Assets/Scripts/OpenSpace/Collide/BoundingVolume.cs b/Assets/Scripts/OpenSpace/Collide/BoundingVolume.cs index fae41591..dcb309ff 100644 --- a/Assets/Scripts/OpenSpace/Collide/BoundingVolume.cs +++ b/Assets/Scripts/OpenSpace/Collide/BoundingVolume.cs @@ -4,7 +4,7 @@ namespace OpenSpace.Collide { public class BoundingVolume { - public Pointer offset; + public LegacyPointer offset; public enum Type { Sphere, Box @@ -49,7 +49,7 @@ public Vector3 Size { } } - public BoundingVolume(Pointer offset) { + public BoundingVolume(LegacyPointer offset) { this.offset = offset; } @@ -67,7 +67,7 @@ public bool ContainsPoint(Vector3 pos) { } // SuperObject BoundingVolume - public static BoundingVolume Read(Reader reader, Pointer offset, Type type) { + public static BoundingVolume Read(Reader reader, LegacyPointer offset, Type type) { BoundingVolume volume = new BoundingVolume(offset); volume.type = type; diff --git a/Assets/Scripts/OpenSpace/Collide/CollideMaterial.cs b/Assets/Scripts/OpenSpace/Collide/CollideMaterial.cs index da95a50e..836285a6 100644 --- a/Assets/Scripts/OpenSpace/Collide/CollideMaterial.cs +++ b/Assets/Scripts/OpenSpace/Collide/CollideMaterial.cs @@ -10,7 +10,7 @@ namespace OpenSpace.Collide { public class CollideMaterial { - public Pointer offset; + public LegacyPointer offset; [Flags] public enum CollisionFlags_R2 : ushort { @@ -83,22 +83,22 @@ public void SetFlag(CollisionFlags_R2 flags, bool on) { identifier = (ushort)(identifier_R2); } - public CollideMaterial(Pointer offset) { + public CollideMaterial(LegacyPointer offset) { this.offset = offset; } - public static CollideMaterial Read(Reader reader, Pointer offset) { + public static CollideMaterial Read(Reader reader, LegacyPointer offset) { MapLoader l = MapLoader.Loader; CollideMaterial cm = new CollideMaterial(offset); //l.print(offset); - if (Settings.s.game == Settings.Game.R2Revolution) { + if (Legacy_Settings.s.game == Legacy_Settings.Game.R2Revolution) { cm.type = reader.ReadUInt16(); cm.identifier = reader.ReadUInt16(); } else { cm.type = reader.ReadUInt16(); cm.identifier = reader.ReadUInt16(); - if (Settings.s.engineVersion == Settings.EngineVersion.R3) { + if (Legacy_Settings.s.engineVersion == Legacy_Settings.EngineVersion.R3) { cm.direction = new Vector3(reader.ReadSingle(), reader.ReadSingle(), reader.ReadSingle()); cm.coef = reader.ReadSingle(); } @@ -110,18 +110,18 @@ public static CollideMaterial Read(Reader reader, Pointer offset) { return cm; } - public static CollideMaterial FromOffsetOrRead(Pointer offset, Reader reader) { + public static CollideMaterial FromOffsetOrRead(LegacyPointer offset, Reader reader) { CollideMaterial cm = FromOffset(offset); if (cm == null) { - Pointer off_current = Pointer.Goto(ref reader, offset); + LegacyPointer off_current = LegacyPointer.Goto(ref reader, offset); cm = CollideMaterial.Read(reader, offset); - Pointer.Goto(ref reader, off_current); + LegacyPointer.Goto(ref reader, off_current); MapLoader.Loader.collideMaterials.Add(cm); } return cm; } - public static CollideMaterial FromOffset(Pointer offset) { + public static CollideMaterial FromOffset(LegacyPointer offset) { MapLoader l = MapLoader.Loader; for (int i = 0; i < l.collideMaterials.Count; i++) { if (offset == l.collideMaterials[i].offset) return l.collideMaterials[i]; diff --git a/Assets/Scripts/OpenSpace/Collide/GeometricObjectCollide.cs b/Assets/Scripts/OpenSpace/Collide/GeometricObjectCollide.cs index 413fdac7..07ee9fb7 100644 --- a/Assets/Scripts/OpenSpace/Collide/GeometricObjectCollide.cs +++ b/Assets/Scripts/OpenSpace/Collide/GeometricObjectCollide.cs @@ -12,17 +12,17 @@ namespace OpenSpace.Collide { /// public class GeometricObjectCollide { public PhysicalObject po; - public Pointer offset; + public LegacyPointer offset; public CollideType type; - public Pointer off_modelstart; + public LegacyPointer off_modelstart; public ushort num_vertices; public ushort num_elements; - public Pointer off_vertices; - public Pointer off_normals = null; - public Pointer off_element_types; - public Pointer off_elements; - public Pointer off_parallelBoxes; + public LegacyPointer off_vertices; + public LegacyPointer off_normals = null; + public LegacyPointer off_element_types; + public LegacyPointer off_elements; + public LegacyPointer off_parallelBoxes; public ushort num_parallelBoxes; public Vector3 sphereCenter = Vector3.zero; public float sphereRadius = 0; @@ -76,7 +76,7 @@ private void InitGameObject() { //m.gao.SetActive(false); // Invisible by default } - public GeometricObjectCollide(Pointer offset, CollideType type = CollideType.None) { + public GeometricObjectCollide(LegacyPointer offset, CollideType type = CollideType.None) { this.offset = offset; this.type = type; } @@ -166,32 +166,32 @@ void CheckVertex(Vector3 v) { } } - public static GeometricObjectCollide Read(Reader reader, Pointer offset, CollideType type = CollideType.None, bool isBoundingVolume = false) { + public static GeometricObjectCollide Read(Reader reader, LegacyPointer offset, CollideType type = CollideType.None, bool isBoundingVolume = false) { MapLoader l = MapLoader.Loader; //l.print("CollideMesh " + offset); GeometricObjectCollide m = new GeometricObjectCollide(offset, type); m.isBoundingVolume = isBoundingVolume; - if (Settings.s.engineVersion == Settings.EngineVersion.R3 || Settings.s.game == Settings.Game.R2Revolution) { + if (Legacy_Settings.s.engineVersion == Legacy_Settings.EngineVersion.R3 || Legacy_Settings.s.game == Legacy_Settings.Game.R2Revolution) { m.num_vertices = reader.ReadUInt16(); m.num_elements = reader.ReadUInt16(); - if (Settings.s.engineVersion == Settings.EngineVersion.R3 && Settings.s.game != Settings.Game.LargoWinch) { + if (Legacy_Settings.s.engineVersion == Legacy_Settings.EngineVersion.R3 && Legacy_Settings.s.game != Legacy_Settings.Game.LargoWinch) { reader.ReadUInt32(); } } - if (Settings.s.engineVersion <= Settings.EngineVersion.Montreal) m.num_vertices = (ushort)reader.ReadUInt32(); - m.off_vertices = Pointer.Read(reader); - if (Settings.s.engineVersion < Settings.EngineVersion.R3 && Settings.s.game != Settings.Game.R2Revolution) { - m.off_normals = Pointer.Read(reader); - Pointer.Read(reader); + if (Legacy_Settings.s.engineVersion <= Legacy_Settings.EngineVersion.Montreal) m.num_vertices = (ushort)reader.ReadUInt32(); + m.off_vertices = LegacyPointer.Read(reader); + if (Legacy_Settings.s.engineVersion < Legacy_Settings.EngineVersion.R3 && Legacy_Settings.s.game != Legacy_Settings.Game.R2Revolution) { + m.off_normals = LegacyPointer.Read(reader); + LegacyPointer.Read(reader); reader.ReadInt32(); } - if (Settings.s.engineVersion <= Settings.EngineVersion.Montreal) m.num_elements = (ushort)reader.ReadUInt32(); - m.off_element_types = Pointer.Read(reader); - m.off_elements = Pointer.Read(reader); - if (Settings.s.game != Settings.Game.R2Revolution && Settings.s.game != Settings.Game.LargoWinch) { - Pointer.Read(reader); - if (Settings.s.engineVersion < Settings.EngineVersion.R3) { - if (Settings.s.engineVersion == Settings.EngineVersion.R2) { + if (Legacy_Settings.s.engineVersion <= Legacy_Settings.EngineVersion.Montreal) m.num_elements = (ushort)reader.ReadUInt32(); + m.off_element_types = LegacyPointer.Read(reader); + m.off_elements = LegacyPointer.Read(reader); + if (Legacy_Settings.s.game != Legacy_Settings.Game.R2Revolution && Legacy_Settings.s.game != Legacy_Settings.Game.LargoWinch) { + LegacyPointer.Read(reader); + if (Legacy_Settings.s.engineVersion < Legacy_Settings.EngineVersion.R3) { + if (Legacy_Settings.s.engineVersion == Legacy_Settings.EngineVersion.R2) { reader.ReadInt32(); reader.ReadInt32(); reader.ReadInt32(); @@ -199,7 +199,7 @@ public static GeometricObjectCollide Read(Reader reader, Pointer offset, Collide m.num_vertices = reader.ReadUInt16(); m.num_elements = reader.ReadUInt16(); } - if (Settings.s.engineVersion <= Settings.EngineVersion.Montreal) { + if (Legacy_Settings.s.engineVersion <= Legacy_Settings.EngineVersion.Montreal) { reader.ReadInt32(); reader.ReadInt32(); } @@ -207,23 +207,23 @@ public static GeometricObjectCollide Read(Reader reader, Pointer offset, Collide m.num_parallelBoxes = reader.ReadUInt16(); } else { //l.print((Pointer.Current(reader).FileOffset - offset.FileOffset)); - m.off_parallelBoxes = Pointer.Read(reader); + m.off_parallelBoxes = LegacyPointer.Read(reader); } } else { reader.ReadUInt32(); } - if (Settings.s.engineVersion != Settings.EngineVersion.Montreal) { + if (Legacy_Settings.s.engineVersion != Legacy_Settings.EngineVersion.Montreal) { m.sphereRadius = reader.ReadSingle(); // bounding volume radius float sphereX = reader.ReadSingle(); // x float sphereZ = reader.ReadSingle(); // z float sphereY = reader.ReadSingle(); // y m.sphereCenter = new Vector3(sphereX, sphereY, sphereZ); - if (Settings.s.engineVersion == Settings.EngineVersion.R2) reader.ReadUInt32(); + if (Legacy_Settings.s.engineVersion == Legacy_Settings.EngineVersion.R2) reader.ReadUInt32(); } // Vertices - Pointer off_current = Pointer.Goto(ref reader, m.off_vertices); + LegacyPointer off_current = LegacyPointer.Goto(ref reader, m.off_vertices); m.vertices = new Vector3[m.num_vertices]; for (int i = 0; i < m.num_vertices; i++) { float x = reader.ReadSingle(); @@ -234,7 +234,7 @@ public static GeometricObjectCollide Read(Reader reader, Pointer offset, Collide // Normals if (m.off_normals != null) { - off_current = Pointer.Goto(ref reader, m.off_normals); + off_current = LegacyPointer.Goto(ref reader, m.off_normals); m.normals = new Vector3[m.num_vertices]; for (int i = 0; i < m.num_vertices; i++) { float x = reader.ReadSingle(); @@ -244,7 +244,7 @@ public static GeometricObjectCollide Read(Reader reader, Pointer offset, Collide } } // Read subblock types & initialize arrays - Pointer.Goto(ref reader, m.off_element_types); + LegacyPointer.Goto(ref reader, m.off_element_types); m.element_types = new ushort[m.num_elements]; m.elements = new IGeometricObjectElementCollide[m.num_elements]; for (uint i = 0; i < m.num_elements; i++) { @@ -252,9 +252,9 @@ public static GeometricObjectCollide Read(Reader reader, Pointer offset, Collide } for (uint i = 0; i < m.num_elements; i++) { - Pointer.Goto(ref reader, m.off_elements + (i * 4)); - Pointer block_offset = Pointer.Read(reader); - Pointer.Goto(ref reader, block_offset); + LegacyPointer.Goto(ref reader, m.off_elements + (i * 4)); + LegacyPointer block_offset = LegacyPointer.Read(reader); + LegacyPointer.Goto(ref reader, block_offset); switch (m.element_types[i]) { /*1 = indexedtriangles 2 = facemap diff --git a/Assets/Scripts/OpenSpace/Collide/GeometricObjectElementCollideAlignedBoxes.cs b/Assets/Scripts/OpenSpace/Collide/GeometricObjectElementCollideAlignedBoxes.cs index 631fa6ee..7e2299aa 100644 --- a/Assets/Scripts/OpenSpace/Collide/GeometricObjectElementCollideAlignedBoxes.cs +++ b/Assets/Scripts/OpenSpace/Collide/GeometricObjectElementCollideAlignedBoxes.cs @@ -10,15 +10,15 @@ public class GeometricObjectElementCollideAlignedBoxes : IGeometricObjectElement public class IndexedAlignedBox { public ushort minPoint; public ushort maxPoint; - public Pointer off_material; + public LegacyPointer off_material; public GameMaterial gameMaterial; } [JsonIgnore] public GeometricObjectCollide geo; - public Pointer offset; + public LegacyPointer offset; - public Pointer off_boxes; // called IndexedSprites in the game code + public LegacyPointer off_boxes; // called IndexedSprites in the game code public ushort num_boxes; public short ind_parallelBox; public IndexedAlignedBox[] boxes; @@ -35,7 +35,7 @@ public GameObject Gao { } } - public GeometricObjectElementCollideAlignedBoxes(Pointer offset, GeometricObjectCollide geo) { + public GeometricObjectElementCollideAlignedBoxes(LegacyPointer offset, GeometricObjectCollide geo) { this.geo = geo; this.offset = offset; } @@ -79,31 +79,31 @@ private void CreateUnityMesh() { } } - public static GeometricObjectElementCollideAlignedBoxes Read(Reader reader, Pointer offset, GeometricObjectCollide geo) { + public static GeometricObjectElementCollideAlignedBoxes Read(Reader reader, LegacyPointer offset, GeometricObjectCollide geo) { MapLoader l = MapLoader.Loader; GeometricObjectElementCollideAlignedBoxes s = new GeometricObjectElementCollideAlignedBoxes(offset, geo); - if (Settings.s.engineVersion > Settings.EngineVersion.Montreal) { - s.off_boxes = Pointer.Read(reader); + if (Legacy_Settings.s.engineVersion > Legacy_Settings.EngineVersion.Montreal) { + s.off_boxes = LegacyPointer.Read(reader); s.num_boxes = reader.ReadUInt16(); s.ind_parallelBox = reader.ReadInt16(); // -1 } else { s.num_boxes = (ushort)reader.ReadUInt32(); - s.off_boxes = Pointer.Read(reader); + s.off_boxes = LegacyPointer.Read(reader); } if (s.off_boxes != null) { - Pointer off_current = Pointer.Goto(ref reader, s.off_boxes); + LegacyPointer off_current = LegacyPointer.Goto(ref reader, s.off_boxes); s.boxes = new IndexedAlignedBox[s.num_boxes]; for (uint i = 0; i < s.num_boxes; i++) { s.boxes[i] = new IndexedAlignedBox(); s.boxes[i].minPoint = reader.ReadUInt16(); s.boxes[i].maxPoint = reader.ReadUInt16(); - s.boxes[i].off_material = Pointer.Read(reader); + s.boxes[i].off_material = LegacyPointer.Read(reader); if (!geo.isBoundingVolume) { s.boxes[i].gameMaterial = GameMaterial.FromOffsetOrRead(s.boxes[i].off_material, reader); } } - Pointer.Goto(ref reader, off_current); + LegacyPointer.Goto(ref reader, off_current); } return s; } diff --git a/Assets/Scripts/OpenSpace/Collide/GeometricObjectElementCollideSpheres.cs b/Assets/Scripts/OpenSpace/Collide/GeometricObjectElementCollideSpheres.cs index 65a32e25..f01d32c7 100644 --- a/Assets/Scripts/OpenSpace/Collide/GeometricObjectElementCollideSpheres.cs +++ b/Assets/Scripts/OpenSpace/Collide/GeometricObjectElementCollideSpheres.cs @@ -9,17 +9,17 @@ namespace OpenSpace.Collide { public class GeometricObjectElementCollideSpheres : IGeometricObjectElementCollide { public class IndexedSphere { public float radius; - public Pointer off_material; + public LegacyPointer off_material; public ushort centerPoint; public GameMaterial gameMaterial; - public Pointer debug_radiusAddress; + public LegacyPointer debug_radiusAddress; } [JsonIgnore] public GeometricObjectCollide geo; - public Pointer offset; + public LegacyPointer offset; - public Pointer off_spheres; // called IndexedSprites in the game code + public LegacyPointer off_spheres; // called IndexedSprites in the game code public ushort num_spheres; public short ind_parallelBox; public IndexedSphere[] spheres; @@ -36,7 +36,7 @@ public GameObject Gao { } } - public GeometricObjectElementCollideSpheres(Pointer offset, GeometricObjectCollide geo) { + public GeometricObjectElementCollideSpheres(LegacyPointer offset, GeometricObjectCollide geo) { this.geo = geo; this.offset = offset; } @@ -82,41 +82,41 @@ private void CreateUnityMesh() { } } - public static GeometricObjectElementCollideSpheres Read(Reader reader, Pointer offset, GeometricObjectCollide geo) { + public static GeometricObjectElementCollideSpheres Read(Reader reader, LegacyPointer offset, GeometricObjectCollide geo) { MapLoader l = MapLoader.Loader; GeometricObjectElementCollideSpheres s = new GeometricObjectElementCollideSpheres(offset, geo); - if (Settings.s.engineVersion > Settings.EngineVersion.Montreal) { - s.off_spheres = Pointer.Read(reader); + if (Legacy_Settings.s.engineVersion > Legacy_Settings.EngineVersion.Montreal) { + s.off_spheres = LegacyPointer.Read(reader); s.num_spheres = reader.ReadUInt16(); s.ind_parallelBox = reader.ReadInt16(); // -1 } else { s.num_spheres = (ushort)reader.ReadUInt32(); - s.off_spheres = Pointer.Read(reader); + s.off_spheres = LegacyPointer.Read(reader); } if (s.off_spheres != null) { - Pointer off_current = Pointer.Goto(ref reader, s.off_spheres); + LegacyPointer off_current = LegacyPointer.Goto(ref reader, s.off_spheres); s.spheres = new IndexedSphere[s.num_spheres]; for (uint i = 0; i < s.num_spheres; i++) { s.spheres[i] = new IndexedSphere(); - if (Settings.s.engineVersion > Settings.EngineVersion.Montreal) { - s.spheres[i].debug_radiusAddress = Pointer.Current(reader); + if (Legacy_Settings.s.engineVersion > Legacy_Settings.EngineVersion.Montreal) { + s.spheres[i].debug_radiusAddress = LegacyPointer.Current(reader); s.spheres[i].radius = reader.ReadSingle(); - s.spheres[i].off_material = Pointer.Read(reader); + s.spheres[i].off_material = LegacyPointer.Read(reader); s.spheres[i].centerPoint = reader.ReadUInt16(); reader.ReadUInt16(); } else { s.spheres[i].centerPoint = reader.ReadUInt16(); reader.ReadUInt16(); - s.spheres[i].debug_radiusAddress = Pointer.Current(reader); + s.spheres[i].debug_radiusAddress = LegacyPointer.Current(reader); s.spheres[i].radius = reader.ReadSingle(); - s.spheres[i].off_material = Pointer.Read(reader); + s.spheres[i].off_material = LegacyPointer.Read(reader); } if (!geo.isBoundingVolume) { s.spheres[i].gameMaterial = GameMaterial.FromOffsetOrRead(s.spheres[i].off_material, reader); } } - Pointer.Goto(ref reader, off_current); + LegacyPointer.Goto(ref reader, off_current); } return s; } diff --git a/Assets/Scripts/OpenSpace/Collide/GeometricObjectElementCollideTriangles.cs b/Assets/Scripts/OpenSpace/Collide/GeometricObjectElementCollideTriangles.cs index 5e525a79..672c62a0 100644 --- a/Assets/Scripts/OpenSpace/Collide/GeometricObjectElementCollideTriangles.cs +++ b/Assets/Scripts/OpenSpace/Collide/GeometricObjectElementCollideTriangles.cs @@ -8,17 +8,17 @@ namespace OpenSpace.Collide { public class GeometricObjectElementCollideTriangles : IGeometricObjectElementCollide { [JsonIgnore] public GeometricObjectCollide geo; - public Pointer offset; + public LegacyPointer offset; - public Pointer off_material; - public Pointer off_triangles; // num_triangles * 3 * 0x2 - public Pointer off_mapping; // num_triangles * 3 * 0x2. Max: num_uvs-1 - public Pointer off_normals; // num_triangles * 3 * 0x4. 1 normal per face, kinda logical for collision I guess - public Pointer off_uvs; + public LegacyPointer off_material; + public LegacyPointer off_triangles; // num_triangles * 3 * 0x2 + public LegacyPointer off_mapping; // num_triangles * 3 * 0x2. Max: num_uvs-1 + public LegacyPointer off_normals; // num_triangles * 3 * 0x4. 1 normal per face, kinda logical for collision I guess + public LegacyPointer off_uvs; public ushort num_triangles; public ushort num_mapping; - public Pointer off_unk; - public Pointer off_unk2; + public LegacyPointer off_unk; + public LegacyPointer off_unk2; public ushort num_mapping_entries; public short ind_parallelBox; @@ -40,7 +40,7 @@ public GameObject Gao { } } - public GeometricObjectElementCollideTriangles(Pointer offset, GeometricObjectCollide geo) { + public GeometricObjectElementCollideTriangles(LegacyPointer offset, GeometricObjectCollide geo) { this.geo = geo; this.offset = offset; } @@ -138,44 +138,44 @@ private void CreateUnityMesh() { } } - public static GeometricObjectElementCollideTriangles Read(Reader reader, Pointer offset, GeometricObjectCollide geo) { + public static GeometricObjectElementCollideTriangles Read(Reader reader, LegacyPointer offset, GeometricObjectCollide geo) { MapLoader l = MapLoader.Loader; GeometricObjectElementCollideTriangles sm = new GeometricObjectElementCollideTriangles(offset, geo); - sm.off_material = Pointer.Read(reader); - if (Settings.s.game == Settings.Game.R2Revolution || Settings.s.game == Settings.Game.LargoWinch) { + sm.off_material = LegacyPointer.Read(reader); + if (Legacy_Settings.s.game == Legacy_Settings.Game.R2Revolution || Legacy_Settings.s.game == Legacy_Settings.Game.LargoWinch) { sm.num_triangles = reader.ReadUInt16(); reader.ReadUInt16(); - sm.off_triangles = Pointer.Read(reader); - if (Settings.s.game == Settings.Game.LargoWinch) { - sm.off_normals = Pointer.Read(reader); - sm.off_unk = Pointer.Read(reader); + sm.off_triangles = LegacyPointer.Read(reader); + if (Legacy_Settings.s.game == Legacy_Settings.Game.LargoWinch) { + sm.off_normals = LegacyPointer.Read(reader); + sm.off_unk = LegacyPointer.Read(reader); } } else { - if (Settings.s.engineVersion < Settings.EngineVersion.R3) { + if (Legacy_Settings.s.engineVersion < Legacy_Settings.EngineVersion.R3) { sm.num_triangles = reader.ReadUInt16(); sm.num_mapping = reader.ReadUInt16(); - sm.off_triangles = Pointer.Read(reader); - sm.off_mapping = Pointer.Read(reader); - sm.off_normals = Pointer.Read(reader); - sm.off_uvs = Pointer.Read(reader); - if (Settings.s.engineVersion == Settings.EngineVersion.Montreal) { + sm.off_triangles = LegacyPointer.Read(reader); + sm.off_mapping = LegacyPointer.Read(reader); + sm.off_normals = LegacyPointer.Read(reader); + sm.off_uvs = LegacyPointer.Read(reader); + if (Legacy_Settings.s.engineVersion == Legacy_Settings.EngineVersion.Montreal) { reader.ReadUInt32(); } - if (Settings.s.game != Settings.Game.TTSE) { - Pointer.Read(reader); // table of num_unk vertex indices (vertices, because max = num_vertices - 1) + if (Legacy_Settings.s.game != Legacy_Settings.Game.TTSE) { + LegacyPointer.Read(reader); // table of num_unk vertex indices (vertices, because max = num_vertices - 1) reader.ReadUInt16(); // num_unk sm.ind_parallelBox = reader.ReadInt16(); } } else { - sm.off_triangles = Pointer.Read(reader); - sm.off_normals = Pointer.Read(reader); + sm.off_triangles = LegacyPointer.Read(reader); + sm.off_normals = LegacyPointer.Read(reader); sm.num_triangles = reader.ReadUInt16(); sm.ind_parallelBox = reader.ReadInt16(); reader.ReadUInt32(); - if (Settings.s.game != Settings.Game.Dinosaur) { - sm.off_mapping = Pointer.Read(reader); - sm.off_unk = Pointer.Read(reader); // num_mapping_entries * 3 floats - sm.off_unk2 = Pointer.Read(reader); // num_mapping_entries * 1 float + if (Legacy_Settings.s.game != Legacy_Settings.Game.Dinosaur) { + sm.off_mapping = LegacyPointer.Read(reader); + sm.off_unk = LegacyPointer.Read(reader); // num_mapping_entries * 3 floats + sm.off_unk2 = LegacyPointer.Read(reader); // num_mapping_entries * 1 float sm.num_mapping = reader.ReadUInt16(); reader.ReadUInt16(); } @@ -186,14 +186,14 @@ public static GeometricObjectElementCollideTriangles Read(Reader reader, Pointer } else { // Sector superobject } - Pointer.Goto(ref reader, sm.off_triangles); + LegacyPointer.Goto(ref reader, sm.off_triangles); sm.triangles = new int[sm.num_triangles * 3]; for (int j = 0; j < sm.num_triangles; j++) { sm.triangles[(j * 3) + 0] = reader.ReadInt16(); sm.triangles[(j * 3) + 1] = reader.ReadInt16(); sm.triangles[(j * 3) + 2] = reader.ReadInt16(); } - Pointer.DoAt(ref reader, sm.off_normals, () => { + LegacyPointer.DoAt(ref reader, sm.off_normals, () => { sm.normals = new Vector3[sm.num_triangles]; for (int j = 0; j < sm.num_triangles; j++) { float x = reader.ReadSingle(); @@ -204,7 +204,7 @@ public static GeometricObjectElementCollideTriangles Read(Reader reader, Pointer }); if (sm.num_mapping > 0 && sm.off_mapping != null) { - Pointer.Goto(ref reader, sm.off_mapping); + LegacyPointer.Goto(ref reader, sm.off_mapping); sm.mapping = new int[sm.num_triangles * 3]; for (int i = 0; i < sm.num_triangles; i++) { sm.mapping[(i * 3) + 0] = reader.ReadInt16(); @@ -212,7 +212,7 @@ public static GeometricObjectElementCollideTriangles Read(Reader reader, Pointer sm.mapping[(i * 3) + 2] = reader.ReadInt16(); } if (sm.off_uvs != null) { - Pointer.Goto(ref reader, sm.off_uvs); + LegacyPointer.Goto(ref reader, sm.off_uvs); sm.uvs = new Vector2[sm.num_mapping]; for (int i = 0; i < sm.num_mapping; i++) { sm.uvs[i] = new Vector2(reader.ReadSingle(), reader.ReadSingle()); diff --git a/Assets/Scripts/OpenSpace/Collide/PersoCollision/CollSet.cs b/Assets/Scripts/OpenSpace/Collide/PersoCollision/CollSet.cs index 0048a35b..adf6db4d 100644 --- a/Assets/Scripts/OpenSpace/Collide/PersoCollision/CollSet.cs +++ b/Assets/Scripts/OpenSpace/Collide/PersoCollision/CollSet.cs @@ -4,14 +4,14 @@ namespace OpenSpace.Collide { public class CollSet { - public Pointer offset; + public LegacyPointer offset; public Perso perso; // Struct - public Dictionary off_zdxList = new Dictionary(); - public Dictionary off_activationList = new Dictionary(); - public Dictionary off_zones = new Dictionary(); - public Dictionary off_currentZone = new Dictionary(); + public Dictionary off_zdxList = new Dictionary(); + public Dictionary off_activationList = new Dictionary(); + public Dictionary off_zones = new Dictionary(); + public Dictionary off_currentZone = new Dictionary(); // consists of 16 bit pairs that describe the state of a zone, 00 = neutral, 01 = force active, 10 = force inactive // access these using GetPrivilegedActionZoneStatus @@ -24,7 +24,7 @@ public class CollSet { public byte colliderType; - public CollSet(Perso perso, Pointer offset) { + public CollSet(Perso perso, LegacyPointer offset) { this.perso = perso; this.offset = offset; } @@ -46,36 +46,36 @@ public PrivilegedActivationStatus GetPrivilegedActionZoneStatus(CollideType type return (PrivilegedActivationStatus)value; } - public static CollSet Read(Reader reader, Perso perso, Pointer offset) { + public static CollSet Read(Reader reader, Perso perso, LegacyPointer offset) { MapLoader l = MapLoader.Loader; //if (Settings.s.platform == Settings.Platform.DC) return null; //l.print("CollSet @ " + offset); CollSet c = new CollSet(perso, offset); - c.off_zdxList[CollideType.ZDD] = Pointer.Read(reader); - c.off_zdxList[CollideType.ZDE] = Pointer.Read(reader); - c.off_zdxList[CollideType.ZDM] = Pointer.Read(reader); - c.off_zdxList[CollideType.ZDR] = Pointer.Read(reader); + c.off_zdxList[CollideType.ZDD] = LegacyPointer.Read(reader); + c.off_zdxList[CollideType.ZDE] = LegacyPointer.Read(reader); + c.off_zdxList[CollideType.ZDM] = LegacyPointer.Read(reader); + c.off_zdxList[CollideType.ZDR] = LegacyPointer.Read(reader); - c.off_activationList[CollideType.ZDD] = Pointer.Read(reader); - c.off_activationList[CollideType.ZDE] = Pointer.Read(reader); - c.off_activationList[CollideType.ZDM] = Pointer.Read(reader); - c.off_activationList[CollideType.ZDR] = Pointer.Read(reader); + c.off_activationList[CollideType.ZDD] = LegacyPointer.Read(reader); + c.off_activationList[CollideType.ZDE] = LegacyPointer.Read(reader); + c.off_activationList[CollideType.ZDM] = LegacyPointer.Read(reader); + c.off_activationList[CollideType.ZDR] = LegacyPointer.Read(reader); - c.off_zones[CollideType.ZDD] = Pointer.Read(reader); - c.off_zones[CollideType.ZDE] = Pointer.Read(reader); - c.off_zones[CollideType.ZDM] = Pointer.Read(reader); - c.off_zones[CollideType.ZDR] = Pointer.Read(reader); + c.off_zones[CollideType.ZDD] = LegacyPointer.Read(reader); + c.off_zones[CollideType.ZDE] = LegacyPointer.Read(reader); + c.off_zones[CollideType.ZDM] = LegacyPointer.Read(reader); + c.off_zones[CollideType.ZDR] = LegacyPointer.Read(reader); - if (Settings.s.engineVersion > Settings.EngineVersion.Montreal) { + if (Legacy_Settings.s.engineVersion > Legacy_Settings.EngineVersion.Montreal) { c.privilegedActivations[CollideType.ZDD] = reader.ReadInt32(); c.privilegedActivations[CollideType.ZDE] = reader.ReadInt32(); c.privilegedActivations[CollideType.ZDM] = reader.ReadInt32(); c.privilegedActivations[CollideType.ZDR] = reader.ReadInt32(); } - foreach (KeyValuePair entry in c.off_zdxList) { - Pointer.DoAt(ref reader, entry.Value, () => { + foreach (KeyValuePair entry in c.off_zdxList) { + LegacyPointer.DoAt(ref reader, entry.Value, () => { //zdxList = LinkedList.ReadHeader(r1, o1); c.zdxList[entry.Key] = LinkedList.Read(ref reader, entry.Value, (off_element) => { @@ -84,35 +84,35 @@ public static CollSet Read(Reader reader, Perso perso, Pointer offset) { return col; }, flags: LinkedList.Flags.ReadAtPointer - | (Settings.s.hasLinkedListHeaderPointers ? + | (Legacy_Settings.s.hasLinkedListHeaderPointers ? LinkedList.Flags.HasHeaderPointers : LinkedList.Flags.NoPreviousPointersForDouble), type: LinkedList.Type.Minimize ); }); } - foreach (KeyValuePair entry in c.off_zones) { - Pointer.DoAt(ref reader, entry.Value, () => { + foreach (KeyValuePair entry in c.off_zones) { + LegacyPointer.DoAt(ref reader, entry.Value, () => { //zdxList = LinkedList.ReadHeader(r1, o1); c.zones[entry.Key] = LinkedList.Read(ref reader, entry.Value, (off_element) => { return CollideActivationZone.Read(reader, off_element); }, - flags: (Settings.s.hasLinkedListHeaderPointers ? + flags: (Legacy_Settings.s.hasLinkedListHeaderPointers ? LinkedList.Flags.HasHeaderPointers : LinkedList.Flags.NoPreviousPointersForDouble), type: LinkedList.Type.Minimize ); }); } - foreach (KeyValuePair entry in c.off_activationList) { - Pointer.DoAt(ref reader, entry.Value, () => { + foreach (KeyValuePair entry in c.off_activationList) { + LegacyPointer.DoAt(ref reader, entry.Value, () => { //zdxList = LinkedList.ReadHeader(r1, o1); c.activationList[entry.Key] = LinkedList.Read(ref reader, entry.Value, (off_element) => { return CollideActivation.Read(reader, off_element, c, entry.Key); }, - flags: (Settings.s.hasLinkedListHeaderPointers ? + flags: (Legacy_Settings.s.hasLinkedListHeaderPointers ? LinkedList.Flags.HasHeaderPointers : LinkedList.Flags.NoPreviousPointersForDouble), type: LinkedList.Type.Minimize @@ -120,7 +120,7 @@ public static CollSet Read(Reader reader, Perso perso, Pointer offset) { }); } - Pointer.Goto(ref reader, offset + 0x64); + LegacyPointer.Goto(ref reader, offset + 0x64); c.colliderType = reader.ReadByte(); return c; diff --git a/Assets/Scripts/OpenSpace/Collide/PersoCollision/CollideActivation.cs b/Assets/Scripts/OpenSpace/Collide/PersoCollision/CollideActivation.cs index 4139a74f..f582ac99 100644 --- a/Assets/Scripts/OpenSpace/Collide/PersoCollision/CollideActivation.cs +++ b/Assets/Scripts/OpenSpace/Collide/PersoCollision/CollideActivation.cs @@ -4,43 +4,43 @@ namespace OpenSpace.Collide { public class CollideActivation : ILinkedListEntry { - public Pointer offset; - public Pointer off_next; - public Pointer off_prev; - public Pointer off_header; - public Pointer off_activationZone; + public LegacyPointer offset; + public LegacyPointer off_next; + public LegacyPointer off_prev; + public LegacyPointer off_header; + public LegacyPointer off_activationZone; public LinkedList activationZone; public ushort index; - public Pointer NextEntry { + public LegacyPointer NextEntry { get { return off_next; } } - public Pointer PreviousEntry { + public LegacyPointer PreviousEntry { get { return off_prev; } } - public CollideActivation(Pointer offset) { + public CollideActivation(LegacyPointer offset) { this.offset = offset; } - public static CollideActivation Read(Reader reader, Pointer offset, CollSet collset, CollideType type) { + public static CollideActivation Read(Reader reader, LegacyPointer offset, CollSet collset, CollideType type) { CollideActivation a = new CollideActivation(offset); - if (Settings.s.linkedListType != LinkedList.Type.Minimize) { - a.off_next = Pointer.Read(reader); - if (Settings.s.hasLinkedListHeaderPointers) { - a.off_prev = Pointer.Read(reader); - a.off_header = Pointer.Read(reader); + if (Legacy_Settings.s.linkedListType != LinkedList.Type.Minimize) { + a.off_next = LegacyPointer.Read(reader); + if (Legacy_Settings.s.hasLinkedListHeaderPointers) { + a.off_prev = LegacyPointer.Read(reader); + a.off_header = LegacyPointer.Read(reader); } } - a.off_activationZone = Pointer.Read(reader); - Pointer.DoAt(ref reader, a.off_activationZone, () => { + a.off_activationZone = LegacyPointer.Read(reader); + LegacyPointer.DoAt(ref reader, a.off_activationZone, () => { a.activationZone = LinkedList.Read(ref reader, offset, (off_element) => { return CollideActivationZone.Read(reader, off_element); }, - flags: (Settings.s.hasLinkedListHeaderPointers ? + flags: (Legacy_Settings.s.hasLinkedListHeaderPointers ? LinkedList.Flags.HasHeaderPointers : LinkedList.Flags.NoPreviousPointersForDouble), type: LinkedList.Type.Minimize @@ -48,8 +48,8 @@ public static CollideActivation Read(Reader reader, Pointer offset, CollSet coll }); a.index = reader.ReadUInt16(); reader.ReadUInt16(); - if (Settings.s.linkedListType == LinkedList.Type.Minimize) { - a.off_next = Pointer.Current(reader); + if (Legacy_Settings.s.linkedListType == LinkedList.Type.Minimize) { + a.off_next = LegacyPointer.Current(reader); } return a; } diff --git a/Assets/Scripts/OpenSpace/Collide/PersoCollision/CollideActivationZone.cs b/Assets/Scripts/OpenSpace/Collide/PersoCollision/CollideActivationZone.cs index 4cdffc14..b471f054 100644 --- a/Assets/Scripts/OpenSpace/Collide/PersoCollision/CollideActivationZone.cs +++ b/Assets/Scripts/OpenSpace/Collide/PersoCollision/CollideActivationZone.cs @@ -4,36 +4,36 @@ namespace OpenSpace.Collide { public class CollideActivationZone : ILinkedListEntry { - public Pointer offset; - public Pointer off_next; - public Pointer off_prev; - public Pointer off_header; + public LegacyPointer offset; + public LegacyPointer off_next; + public LegacyPointer off_prev; + public LegacyPointer off_header; public ushort zdxIndex; - public Pointer NextEntry { + public LegacyPointer NextEntry { get { return off_next; } } - public Pointer PreviousEntry { + public LegacyPointer PreviousEntry { get { return off_prev; } } - public CollideActivationZone(Pointer offset) { + public CollideActivationZone(LegacyPointer offset) { this.offset = offset; } - public static CollideActivationZone Read(Reader reader, Pointer offset) { + public static CollideActivationZone Read(Reader reader, LegacyPointer offset) { CollideActivationZone z = new CollideActivationZone(offset); - if (Settings.s.linkedListType != LinkedList.Type.Minimize) { - z.off_next = Pointer.Read(reader); - if (Settings.s.hasLinkedListHeaderPointers) { - z.off_prev = Pointer.Read(reader); - z.off_header = Pointer.Read(reader); + if (Legacy_Settings.s.linkedListType != LinkedList.Type.Minimize) { + z.off_next = LegacyPointer.Read(reader); + if (Legacy_Settings.s.hasLinkedListHeaderPointers) { + z.off_prev = LegacyPointer.Read(reader); + z.off_header = LegacyPointer.Read(reader); } } z.zdxIndex = reader.ReadUInt16(); - if (Settings.s.linkedListType == LinkedList.Type.Minimize) { - z.off_next = Pointer.Current(reader); + if (Legacy_Settings.s.linkedListType == LinkedList.Type.Minimize) { + z.off_next = LegacyPointer.Current(reader); } return z; } diff --git a/Assets/Scripts/OpenSpace/DynamicsMechanics/Dynam.cs b/Assets/Scripts/OpenSpace/DynamicsMechanics/Dynam.cs index 3d9555ab..3b1d58b2 100644 --- a/Assets/Scripts/OpenSpace/DynamicsMechanics/Dynam.cs +++ b/Assets/Scripts/OpenSpace/DynamicsMechanics/Dynam.cs @@ -7,26 +7,26 @@ public class Dynam // sizeof is 0xC { // Raw data - public Pointer offset; - public Pointer off_dynamics; + public LegacyPointer offset; + public LegacyPointer off_dynamics; // Processed data public Dynamics dynamics; - public Dynam(Pointer offset) + public Dynam(LegacyPointer offset) { this.offset = offset; } - public static Dynam Read(Reader reader, Pointer offset) { + public static Dynam Read(Reader reader, LegacyPointer offset) { Dynam dynam = new Dynam(offset); //MapLoader.Loader.print("Dynam " + offset); - dynam.off_dynamics = Pointer.Read(reader); + dynam.off_dynamics = LegacyPointer.Read(reader); if (dynam.off_dynamics != null) { - Pointer.Goto(ref reader, dynam.off_dynamics); + LegacyPointer.Goto(ref reader, dynam.off_dynamics); dynam.dynamics = Dynamics.Read(reader, dynam.off_dynamics); } diff --git a/Assets/Scripts/OpenSpace/DynamicsMechanics/Dynamics.cs b/Assets/Scripts/OpenSpace/DynamicsMechanics/Dynamics.cs index 0df777ca..200b6534 100644 --- a/Assets/Scripts/OpenSpace/DynamicsMechanics/Dynamics.cs +++ b/Assets/Scripts/OpenSpace/DynamicsMechanics/Dynamics.cs @@ -11,14 +11,14 @@ public enum DynamicsType } // Raw data - public Pointer offset; + public LegacyPointer offset; public uint field_0; public uint field_4; public uint field_8; public uint field_C; - public Pointer off_speedVector; + public LegacyPointer off_speedVector; // Processed data public Matrix matrixA; @@ -32,12 +32,12 @@ public enum DynamicsType public DynamicsType type; - public Dynamics(Pointer offset) + public Dynamics(LegacyPointer offset) { this.offset = offset; } - public static Dynamics Read(Reader reader, Pointer offset) + public static Dynamics Read(Reader reader, LegacyPointer offset) { Dynamics dynamics = new Dynamics(offset); @@ -62,13 +62,13 @@ public static Dynamics Read(Reader reader, Pointer offset) // Process data (common) - Pointer.Goto(ref reader, offset + 0x54); - dynamics.off_speedVector = Pointer.Read(reader); + LegacyPointer.Goto(ref reader, offset + 0x54); + dynamics.off_speedVector = LegacyPointer.Read(reader); - Pointer.Goto(ref reader, offset + 0x78); + LegacyPointer.Goto(ref reader, offset + 0x78); dynamics.matrixA = Matrix.Read(reader, offset + 0x78); - Pointer.Goto(ref reader, offset + 0xD0); + LegacyPointer.Goto(ref reader, offset + 0xD0); dynamics.matrixB = Matrix.Read(reader, offset + 0xD0); // Process data (type specific) @@ -79,7 +79,7 @@ public static Dynamics Read(Reader reader, Pointer offset) } else if (dynamics.type == DynamicsType.Type2_BIG) { - Pointer.Goto(ref reader, dynamics.off_speedVector); + LegacyPointer.Goto(ref reader, dynamics.off_speedVector); dynamics.speedVector = new Vector3(reader.ReadSingle(), reader.ReadSingle(), reader.ReadSingle()); } diff --git a/Assets/Scripts/OpenSpace/DynamicsMechanics/MechanicsIDCard.cs b/Assets/Scripts/OpenSpace/DynamicsMechanics/MechanicsIDCard.cs index 6eb532ba..e6212093 100644 --- a/Assets/Scripts/OpenSpace/DynamicsMechanics/MechanicsIDCard.cs +++ b/Assets/Scripts/OpenSpace/DynamicsMechanics/MechanicsIDCard.cs @@ -10,7 +10,7 @@ namespace OpenSpace { public class MechanicsIDCard { - public Pointer offset; + public LegacyPointer offset; public uint type; public uint flags; public float gravity; @@ -22,11 +22,11 @@ public class MechanicsIDCard { public float tiltOrigin; public Vector3 maxInertia; - public MechanicsIDCard(Pointer offset) { + public MechanicsIDCard(LegacyPointer offset) { this.offset = offset; } - public static MechanicsIDCard Read(Reader reader, Pointer offset) { + public static MechanicsIDCard Read(Reader reader, LegacyPointer offset) { MapLoader l = MapLoader.Loader; MechanicsIDCard c = new MechanicsIDCard(offset); @@ -59,19 +59,19 @@ public void Write(Writer writer) }); } - public static MechanicsIDCard FromOffsetOrRead(Pointer offset, Reader reader) { + public static MechanicsIDCard FromOffsetOrRead(LegacyPointer offset, Reader reader) { if (offset == null) return null; MechanicsIDCard c = FromOffset(offset); if (c == null) { - Pointer off_current = Pointer.Goto(ref reader, offset); + LegacyPointer off_current = LegacyPointer.Goto(ref reader, offset); c = MechanicsIDCard.Read(reader, offset); - Pointer.Goto(ref reader, off_current); + LegacyPointer.Goto(ref reader, off_current); MapLoader.Loader.mechanicsIDCards.Add(c); } return c; } - public static MechanicsIDCard FromOffset(Pointer offset) { + public static MechanicsIDCard FromOffset(LegacyPointer offset) { MapLoader l = MapLoader.Loader; for (int i = 0; i < l.mechanicsIDCards.Count; i++) { if (offset == l.mechanicsIDCards[i].offset) return l.mechanicsIDCards[i]; diff --git a/Assets/Scripts/OpenSpace/Exporter/MapExporter.cs b/Assets/Scripts/OpenSpace/Exporter/MapExporter.cs index b4133a48..ca9dcf8d 100644 --- a/Assets/Scripts/OpenSpace/Exporter/MapExporter.cs +++ b/Assets/Scripts/OpenSpace/Exporter/MapExporter.cs @@ -61,7 +61,7 @@ public MapExporter(MapLoader loader, string exportPath, ExportFlags flags) { this.loader = loader; this.exportPath = exportPath; - this.gameName = Settings.s.mode.ToString(); + this.gameName = Legacy_Settings.s.mode.ToString(); this.flags = flags; } @@ -84,7 +84,7 @@ public class NameInfo { public static void ExportText() { MapLoader l = MapLoader.Loader; - string filePath = l.gameDataBinFolder + "/localization_" + Settings.s.CmdModeName + ".json"; + string filePath = l.gameDataBinFolder + "/localization_" + Legacy_Settings.s.mode.ToString() + ".json"; if (l is Loader.R2ROMLoader) { Loader.R2ROMLoader rl = l as Loader.R2ROMLoader; ROM.Localization rloc = rl.localizationROM; diff --git a/Assets/Scripts/OpenSpace/Exporter/TransitionExport.cs b/Assets/Scripts/OpenSpace/Exporter/TransitionExport.cs index 70d0f4b1..454c7af7 100644 --- a/Assets/Scripts/OpenSpace/Exporter/TransitionExport.cs +++ b/Assets/Scripts/OpenSpace/Exporter/TransitionExport.cs @@ -109,11 +109,11 @@ public List GetTransitionToIndicesNormalBehavior(Script script) } if (node.nodeType == ScriptNode.NodeType.Procedure) { - if (node.param>=Settings.s.aiTypes.procedureTable.Length) { + if (node.param>=Legacy_Settings.s.aiTypes.procedureTable.Length) { //Debug.LogError("node.param is out of range of procedure table: "+node.param); continue; } - string procedureType = Settings.s.aiTypes.procedureTable[node.param]; + string procedureType = Legacy_Settings.s.aiTypes.procedureTable[node.param]; if (procedureType == "Proc_ChangeMyComport" || procedureType == "Proc_ChangeMyComportAndMyReflex" || procedureType == "_fn_p_stChangeMyComportIntelligenceProcedure" || procedureType == "_fn_p_stChangeMyComportIntelligenceAndReflexProcedure" || procedureType == "ChangeMyComportIntelligenceProcedure" || procedureType == "ChangeMyComportIntelligenceAndReflexProcedure" ) { @@ -158,11 +158,11 @@ public List GetTransitionToIndicesReflexBehavior(Script script) } if (node.nodeType == ScriptNode.NodeType.Procedure) { - if (node.param >= Settings.s.aiTypes.procedureTable.Length) { + if (node.param >= Legacy_Settings.s.aiTypes.procedureTable.Length) { //Debug.LogError("node.param is out of range of procedure table: "+node.param); continue; } - string procedureType = Settings.s.aiTypes.procedureTable[node.param]; + string procedureType = Legacy_Settings.s.aiTypes.procedureTable[node.param]; if (procedureType == "Proc_ChangeMyComportReflex" || procedureType == "_fn_p_stChangeMyComportReflexProcedure" || procedureType == "ChangeMyComportReflexProcedure") { Behavior transitionBehavior = MapLoader.Loader.FromOffset(nextNode.param_ptr); if (transitionBehavior!=null && !transitionToIndices.Contains(transitionBehavior.index)) { diff --git a/Assets/Scripts/OpenSpace/FileFormat/DAT.cs b/Assets/Scripts/OpenSpace/FileFormat/DAT.cs index 6e8af6d2..fad6a669 100644 --- a/Assets/Scripts/OpenSpace/FileFormat/DAT.cs +++ b/Assets/Scripts/OpenSpace/FileFormat/DAT.cs @@ -1,4 +1,5 @@ -using Cysharp.Threading.Tasks; +using BinarySerializer.Unity; +using Cysharp.Threading.Tasks; using System; using System.Collections; using System.Collections.Generic; @@ -26,7 +27,7 @@ public DAT(string name, DSB gameDsb, Stream stream) { baseOffset = 0; headerOffset = 0; this.name = name; - reader = new Reader(stream, Settings.s.IsLittleEndian); + reader = new Reader(stream, Legacy_Settings.s.IsLittleEndian); } public async UniTask GetOffset(RelocationTableReference rtref) { @@ -45,40 +46,46 @@ public async UniTask GetOffset(RelocationTableReference rtref) { number = reader.ReadInt32(); header.field_0 += header.field_8; header.field_4 += header.field_C; + number = reader.ReadInt32(); - uint levels0DatValue_0 = (uint)(header.field_4 ^ (number - header.field_0)); + uint _TotalSector = (uint)(header.field_4 ^ (number - header.field_0)); header.field_0 += header.field_8; header.field_4 += header.field_C; + number = reader.ReadInt32(); - uint levels0DatValue_1 = (uint)((header.field_4 ^ (uint)(number - header.field_0)) >> 2); + uint MapsCount = (uint)((header.field_4 ^ (uint)(number - header.field_0)) >> 2); header.field_0 += header.field_8; header.field_4 += header.field_C; + number = reader.ReadInt32(); header.field_0 += header.field_8; header.field_4 += header.field_C; + number = reader.ReadInt32(); int v4 = header.field_4 ^ (number - header.field_0); header.field_0 += header.field_8; header.field_4 += header.field_C; - uint levels0DatValue_2 = (uint)v4; + uint _NumberOfOccur = (uint)v4; + number = reader.ReadInt32(); - int v5 = header.field_4 ^ (number - header.field_0); + int SectorSize = header.field_4 ^ (number - header.field_0); header.field_0 += header.field_8; - uint levels0DatValue_3 = (uint)v5; header.field_4 += header.field_C; + number = reader.ReadInt32(); int v6 = header.field_4 ^ (number - header.field_0); header.field_0 += header.field_8; header.field_4 += header.field_C; - uint levels0DatValue_4 = (uint)v6; + uint _FirstHeaderSize = (uint)v6; + number = reader.ReadInt32(); - int levels0DatValue_5 = header.field_4 ^ (number - header.field_0); + int _HeaderSize = header.field_4 ^ (number - header.field_0); header.field_0 += header.field_8; header.field_4 += header.field_C; // Get offset with sinus header - SNA_fn_hGetOffSetInBigFileWithSinusHeader - rtref.levelId = (byte)(rtref.levelId % levels0DatValue_1); + rtref.levelId = (byte)(rtref.levelId % MapsCount); rtref.relocationType &= 3; // can only be 0, 1, 2 or 3. No RTL? or another relocation type? v6 = 4 * rtref.levelId; @@ -103,7 +110,7 @@ public async UniTask GetOffset(RelocationTableReference rtref) { break; } - uint v8 = rtref.byte2 % levels0DatValue_2; + uint v8 = rtref.byte2 % _NumberOfOccur; float v9 = 1.06913f; float v30 = 1.06913f; rtref.byte2 = (byte)v8; @@ -128,10 +135,10 @@ public async UniTask GetOffset(RelocationTableReference rtref) { double v12 = v30 % 1f; double v13 = Math.Floor(v12 * 1000000.0) / 1000000.0; //R3Loader.Loader.print("Double v13: " + v13); - ulong v24 = levels0DatValue_0; - long v14 = (long)Math.Floor(levels0DatValue_0 * v13); + ulong v24 = _TotalSector; + long v14 = (long)Math.Floor(_TotalSector * v13); - reader.BaseStream.Seek(levels0DatValue_4 + levels0DatValue_5 * v14, SeekOrigin.Begin); + reader.BaseStream.Seek(_FirstHeaderSize + _HeaderSize * v14, SeekOrigin.Begin); if (httpStream != null) await httpStream.FillCacheForRead(4 * 4); header.field_0 = reader.ReadInt32(); @@ -165,9 +172,9 @@ public async UniTask GetOffset(RelocationTableReference rtref) { public uint GetMask(RelocationTableReference rtref) { rtref.byte3 = (byte)~rtref.byte2; byte[] rtRefBytes = new byte[] { rtref.levelId, rtref.relocationType, rtref.byte2, rtref.byte3 }; - if (Settings.s.IsLittleEndian != BitConverter.IsLittleEndian) Array.Reverse(rtRefBytes); + if (Legacy_Settings.s.IsLittleEndian != BitConverter.IsLittleEndian) Array.Reverse(rtRefBytes); uint currentMask = BitConverter.ToUInt32(rtRefBytes, 0); - if (Settings.s.platform == Settings.Platform.iOS) { + if (Legacy_Settings.s.platform == Legacy_Settings.Platform.iOS) { return (uint)(16807 * ((currentMask ^ 0x75BD924) % 0x1F31D) - 2836 * ((currentMask ^ 0x75BD924) / 0x1F31D)); } else { return (uint)(16807 * (currentMask ^ 0x75BD924) - 0x7FFFFFFF * ((currentMask ^ 0x75BD924) / 0x1F31D)); @@ -178,7 +185,7 @@ public override void CreateWriter() { return; // Don't need to write to this file } - public override void WritePointer(Pointer pointer) { + public override void WritePointer(LegacyPointer pointer) { return; } } diff --git a/Assets/Scripts/OpenSpace/FileFormat/DCDAT.cs b/Assets/Scripts/OpenSpace/FileFormat/DCDAT.cs index 5d7e5193..544670fe 100644 --- a/Assets/Scripts/OpenSpace/FileFormat/DCDAT.cs +++ b/Assets/Scripts/OpenSpace/FileFormat/DCDAT.cs @@ -1,4 +1,5 @@ -using System; +using BinarySerializer.Unity; +using System; using System.Collections.Generic; using System.IO; using System.Linq; @@ -19,10 +20,10 @@ public DCDAT(string name, Stream stream, int fileID) { this.name = name; this.fileID = fileID; length = stream.Length; - using (Reader fileReader = new Reader(stream, Settings.s.IsLittleEndian)) { + using (Reader fileReader = new Reader(stream, Legacy_Settings.s.IsLittleEndian)) { data = fileReader.ReadBytes((int)stream.Length); } - reader = new Reader(new MemoryStream(data), Settings.s.IsLittleEndian); + reader = new Reader(new MemoryStream(data), Legacy_Settings.s.IsLittleEndian); //reader = new Reader(stream, Settings.s.IsLittleEndian); switch (fileID) { case 0: @@ -47,7 +48,7 @@ public override void CreateWriter() { return; // No writing support for DC DAT files yet } - public override void WritePointer(Pointer pointer) { + public override void WritePointer(LegacyPointer pointer) { if (writer != null) { if (pointer == null) { writer.Write((uint)0); @@ -57,15 +58,15 @@ public override void WritePointer(Pointer pointer) { } } - public override Pointer GetUnsafePointer(uint value) { + public override LegacyPointer GetUnsafePointer(uint value) { if (value >= headerOffset && value < headerOffset + length) { - return new Pointer(value, this); + return new LegacyPointer(value, this); } else { MapLoader l = MapLoader.Loader; foreach (FileWithPointers f in l.files_array) { DCDAT dcFile = f as DCDAT; if (dcFile != null && value >= dcFile.headerOffset && value < dcFile.headerOffset + dcFile.length) { - return new Pointer(value, dcFile); + return new LegacyPointer(value, dcFile); } } // Do a second loop over the files. If end and start overlap we want the start (returned by previous loop), @@ -73,7 +74,7 @@ public override Pointer GetUnsafePointer(uint value) { foreach (FileWithPointers f in l.files_array) { DCDAT dcFile = f as DCDAT; if (dcFile != null && value == dcFile.headerOffset + dcFile.length) { - return new Pointer(value, dcFile); + return new LegacyPointer(value, dcFile); } } } diff --git a/Assets/Scripts/OpenSpace/FileFormat/DSB.cs b/Assets/Scripts/OpenSpace/FileFormat/DSB.cs index 6d020697..f74cd897 100644 --- a/Assets/Scripts/OpenSpace/FileFormat/DSB.cs +++ b/Assets/Scripts/OpenSpace/FileFormat/DSB.cs @@ -1,4 +1,5 @@ -using System; +using BinarySerializer.Unity; +using System; using System.Collections.Generic; using System.IO; using System.Linq; @@ -63,11 +64,11 @@ public DSB(string name, Stream stream) { baseOffset = 0; headerOffset = 0; this.name = name; - using (Reader encodedReader = new Reader(stream, Settings.s.IsLittleEndian)) { + using (Reader encodedReader = new Reader(stream, Legacy_Settings.s.IsLittleEndian)) { int maskBytes = encodedReader.InitMask(); data = encodedReader.ReadBytes((int)stream.Length - maskBytes); } - reader = new Reader(new MemoryStream(data), Settings.s.IsLittleEndian); + reader = new Reader(new MemoryStream(data), Legacy_Settings.s.IsLittleEndian); } public override void CreateWriter() { @@ -80,8 +81,8 @@ public void Save(string path) { public void ReadAllSections() { reader.BaseStream.Seek(0, SeekOrigin.Begin); - if (Settings.s.engineVersion == Settings.EngineVersion.TT) { - if (Settings.s.game == Settings.Game.TTSE) { + if (Legacy_Settings.s.engineVersion == Legacy_Settings.EngineVersion.TT) { + if (Legacy_Settings.s.game == Legacy_Settings.Game.TTSE) { ReadAllAsText(); } else { ReadMemoryDesc(); @@ -96,7 +97,7 @@ public void ReadAllSections() { ReadString(); // "3" ReadString(); // "Totalski" = first level } - } else if (Settings.s.engineVersion == Settings.EngineVersion.Montreal) { + } else if (Legacy_Settings.s.engineVersion == Legacy_Settings.EngineVersion.Montreal) { dllDataPath = ReadString(); gameDataPath = ReadString(); worldDataPath = ReadString(); @@ -135,7 +136,7 @@ public void ReadAllAsText() { Match stringValueMatch = Regex.Match(value, @"""(?.+?)""", RegexOptions.IgnoreCase); if (stringValueMatch.Success) { value = stringValueMatch.Groups["value"].Value; - if (Settings.s.engineVersion <= Settings.EngineVersion.Montreal) value = value.Replace("GameData\\", ""); + if (Legacy_Settings.s.engineVersion <= Legacy_Settings.EngineVersion.Montreal) value = value.Replace("GameData\\", ""); switch (method) { case "DirectoryOfEngineDLL": dllDataPath = value; break; case "DirectoryOfTexture": textureDataPath = value; break; @@ -201,7 +202,7 @@ private void ReadMemoryDesc() { uint id = reader.ReadUInt32(); uint memSize; while (id != 0xFFFF) { - if (Settings.s.mode == Settings.Mode.TonicTroublePC) { + if (Legacy_Settings.s.mode == Legacy_Settings.Mode.TonicTroublePC) { switch (id) { // Memory descriptions case 10: reader.ReadUInt32(); break; @@ -262,7 +263,7 @@ private void ReadLevelName() { } private void ReadDirectoriesDesc() { - if (Settings.s.mode == Settings.Mode.TonicTroublePC) { + if (Legacy_Settings.s.mode == Legacy_Settings.Mode.TonicTroublePC) { dllDataPath = ReadString(); ReadString(); // gamedata/menus ReadString(); // gamedata/menus/anims @@ -296,7 +297,7 @@ private void ReadDirectoriesDesc() { } else { uint id = reader.ReadUInt32(); while (id != 0xFFFF) { - if (Settings.s.game == Settings.Game.R2Demo || Settings.s.game == Settings.Game.RedPlanet) { + if (Legacy_Settings.s.game == Legacy_Settings.Game.R2Demo || Legacy_Settings.s.game == Legacy_Settings.Game.RedPlanet) { switch (id) { case 41: dllDataPath = ReadString(); break; case 58: textureDataPath = ReadString(); break; @@ -378,7 +379,7 @@ private void ReadVignetteDesc() { private void ReadBigFileDesc() { uint id = reader.ReadUInt32(); while (id != 0xFFFF) { - if (Settings.s.mode == Settings.Mode.TonicTroublePC) { + if (Legacy_Settings.s.mode == Legacy_Settings.Mode.TonicTroublePC) { switch (id) { case 19: bigfileVignettes = ReadString(); break; case 20: bigfileTextures = ReadString(); break; @@ -496,9 +497,9 @@ private void ReadConfig() { // TT only uint id = reader.ReadUInt32(); while (id != 0xFFFF) { switch (id) { - case 24: ReadString(); break; // Default.cfg + case 22: ReadString(); break; // outro + case 24: ReadString(); break; // Default.cfg case 25: ReadString(); break; // Current.cfg - case 22: ReadString(); break; // outro } id = reader.ReadUInt32(); } @@ -506,17 +507,17 @@ private void ReadConfig() { // TT only private string ReadString() { ushort strSize; - if (Settings.s.engineVersion == Settings.EngineVersion.Montreal) { + if (Legacy_Settings.s.engineVersion == Legacy_Settings.EngineVersion.Montreal) { strSize = reader.ReadByte(); } else { strSize = reader.ReadUInt16(); } string result = reader.ReadString(strSize); - if (Settings.s.engineVersion <= Settings.EngineVersion.Montreal) result = result.Replace("GameData\\", ""); + if (Legacy_Settings.s.engineVersion <= Legacy_Settings.EngineVersion.Montreal) result = result.Replace("GameData\\", ""); return result; } - public override void WritePointer(Pointer pointer) { + public override void WritePointer(LegacyPointer pointer) { return; // No pointers in this file } } diff --git a/Assets/Scripts/OpenSpace/FileFormat/FileWithPointers.cs b/Assets/Scripts/OpenSpace/FileFormat/FileWithPointers.cs index 32d197f2..eb8fb3b3 100644 --- a/Assets/Scripts/OpenSpace/FileFormat/FileWithPointers.cs +++ b/Assets/Scripts/OpenSpace/FileFormat/FileWithPointers.cs @@ -10,7 +10,7 @@ public abstract class FileWithPointers : IDisposable { public int fileID = 0; public Reader reader; public Writer writer; - public Dictionary pointers = new Dictionary(); + public Dictionary pointers = new Dictionary(); public Dictionary extraData = new Dictionary(); public long baseOffset; // Base offset within file public long headerOffset = 0; @@ -21,7 +21,7 @@ public void Dispose() { if (writer != null) writer.Close(); } - public void AddPointer(uint offset, Pointer pointer) { + public void AddPointer(uint offset, LegacyPointer pointer) { pointers[offset] = pointer; } @@ -31,11 +31,11 @@ public void GotoHeader() { } } - public virtual Pointer GetUnsafePointer(uint value) { - return new Pointer(value, this); + public virtual LegacyPointer GetUnsafePointer(uint value) { + return new LegacyPointer(value, this); } - public abstract void WritePointer(Pointer pointer); + public abstract void WritePointer(LegacyPointer pointer); public abstract void CreateWriter(); public virtual void EndWrite() { diff --git a/Assets/Scripts/OpenSpace/FileFormat/LVL.cs b/Assets/Scripts/OpenSpace/FileFormat/LVL.cs index c0085a03..5caf7f5c 100644 --- a/Assets/Scripts/OpenSpace/FileFormat/LVL.cs +++ b/Assets/Scripts/OpenSpace/FileFormat/LVL.cs @@ -1,4 +1,5 @@ -using System; +using BinarySerializer.Unity; +using System; using System.Collections.Generic; using System.IO; using System.Linq; @@ -18,16 +19,16 @@ public LVL(string name, Stream stream, int fileID) { headerOffset = 0; this.name = name; this.fileID = fileID; - reader = new Reader(stream, Settings.s.IsLittleEndian); + reader = new Reader(stream, Legacy_Settings.s.IsLittleEndian); } public void ReadPTR(string path) { if (!FileSystem.FileExists(path)) return; Stream ptrStream = FileSystem.GetFileReadStream(path); long totalSize = ptrStream.Length; - using (Reader ptrReader = new Reader(ptrStream, Settings.s.IsLittleEndian)) { + using (Reader ptrReader = new Reader(ptrStream, Legacy_Settings.s.IsLittleEndian)) { uint num_ptrs; - if (Settings.s.game == Settings.Game.LargoWinch) { + if (Legacy_Settings.s.game == Legacy_Settings.Game.LargoWinch) { num_ptrs = (uint)totalSize / 8; } else { num_ptrs = ptrReader.ReadUInt32(); @@ -37,9 +38,9 @@ public void ReadPTR(string path) { uint ptr_ptr = ptrReader.ReadUInt32(); reader.BaseStream.Seek(ptr_ptr + baseOffset, SeekOrigin.Begin); uint ptr = reader.ReadUInt32(); - pointers[ptr_ptr] = new Pointer(ptr, GetFileWithID(file)); + pointers[ptr_ptr] = new LegacyPointer(ptr, GetFileWithID(file)); } - if (Settings.s.engineVersion < Settings.EngineVersion.R3) { + if (Legacy_Settings.s.engineVersion < Legacy_Settings.EngineVersion.R3) { // Revolution ushort num_specialBlocks = ptrReader.ReadUInt16(); for (uint j = 0; j < num_specialBlocks; j++) { @@ -81,7 +82,7 @@ public void ReadPTR(string path) { int src_file = ptrReader.ReadInt32(); // the file the pointer should be located in uint ptr = ptrReader.ReadUInt32(); int target_file = ptrReader.ReadInt32(); - GetFileWithID(src_file).pointers[ptr_ptr] = new Pointer(ptr, GetFileWithID(target_file)); // can overwrite if necessary + GetFileWithID(src_file).pointers[ptr_ptr] = new LegacyPointer(ptr, GetFileWithID(target_file)); // can overwrite if necessary } } } @@ -96,11 +97,11 @@ public FileWithPointers GetFileWithID(int id) { public override void CreateWriter() { if (path != null) { FileStream stream = new FileStream(path, FileMode.Open); - writer = new Writer(stream, Settings.s.IsLittleEndian); + writer = new Writer(stream, Legacy_Settings.s.IsLittleEndian); } } - public override void WritePointer(Pointer pointer) { + public override void WritePointer(LegacyPointer pointer) { UnityEngine.Debug.LogWarning("Pointer writing not supported!"); writer.BaseStream.Position += 4; } @@ -108,7 +109,7 @@ public void OverrideData(byte[] data) { baseOffset = 0; overrideData = data; reader.Close(); - reader = new Reader(new MemoryStream(overrideData), Settings.s.IsLittleEndian); + reader = new Reader(new MemoryStream(overrideData), Legacy_Settings.s.IsLittleEndian); } } } diff --git a/Assets/Scripts/OpenSpace/FileFormat/LinearFile.cs b/Assets/Scripts/OpenSpace/FileFormat/LinearFile.cs index fcdc3358..e2280cc6 100644 --- a/Assets/Scripts/OpenSpace/FileFormat/LinearFile.cs +++ b/Assets/Scripts/OpenSpace/FileFormat/LinearFile.cs @@ -1,4 +1,5 @@ -using System; +using BinarySerializer.Unity; +using System; using System.Collections.Generic; using System.IO; using System.Linq; @@ -21,14 +22,14 @@ public LinearFile(string name, Stream stream, int fileID, uint baseAddress = 0) length = stream.Length; headerOffset = baseAddress; baseOffset = -headerOffset; - reader = new Reader(stream, Settings.s.IsLittleEndian); + reader = new Reader(stream, Legacy_Settings.s.IsLittleEndian); } public override void CreateWriter() { return; // No writing support for PS1Data files yet } - public override void WritePointer(Pointer pointer) { + public override void WritePointer(LegacyPointer pointer) { if (writer != null) { if (pointer == null) { writer.Write((uint)0); @@ -38,9 +39,9 @@ public override void WritePointer(Pointer pointer) { } } - public override Pointer GetUnsafePointer(uint value) { + public override LegacyPointer GetUnsafePointer(uint value) { if (headerOffset != 0 && value >= headerOffset && value < headerOffset + length) { - return new Pointer(value, this); + return new LegacyPointer(value, this); } return null; } diff --git a/Assets/Scripts/OpenSpace/FileFormat/MemoryFile.cs b/Assets/Scripts/OpenSpace/FileFormat/MemoryFile.cs index f5f0adfe..f98d8877 100644 --- a/Assets/Scripts/OpenSpace/FileFormat/MemoryFile.cs +++ b/Assets/Scripts/OpenSpace/FileFormat/MemoryFile.cs @@ -15,15 +15,15 @@ public MemoryFile(string name) { MapLoader.Loader.print("Base addr: " + stream.BaseAddress); baseOffset = 0; stream.Seek(stream.BaseAddress, SeekOrigin.Begin); - reader = new Reader(stream, Settings.s.IsLittleEndian); + reader = new Reader(stream, Legacy_Settings.s.IsLittleEndian); } public override void CreateWriter() { ProcessMemoryStream stream = new ProcessMemoryStream(name, ProcessMemoryStream.Mode.AllAccess); - writer = new Writer(stream, Settings.s.IsLittleEndian); + writer = new Writer(stream, Legacy_Settings.s.IsLittleEndian); } - public override void WritePointer(Pointer pointer) { + public override void WritePointer(LegacyPointer pointer) { if (writer != null) { if (pointer == null) { writer.Write((uint)0); diff --git a/Assets/Scripts/OpenSpace/FileFormat/PS1Data.cs b/Assets/Scripts/OpenSpace/FileFormat/PS1Data.cs index 0e9b7d69..2f85449b 100644 --- a/Assets/Scripts/OpenSpace/FileFormat/PS1Data.cs +++ b/Assets/Scripts/OpenSpace/FileFormat/PS1Data.cs @@ -1,4 +1,5 @@ -using System; +using BinarySerializer.Unity; +using System; using System.Collections.Generic; using System.IO; using System.Linq; @@ -26,14 +27,14 @@ public PS1Data(string name, Stream stream, int fileID, uint baseAddress) { ms.Position = 0; data = ms.ToArray(); } - reader = new Reader(new MemoryStream(data), Settings.s.IsLittleEndian); + reader = new Reader(new MemoryStream(data), Legacy_Settings.s.IsLittleEndian); } public override void CreateWriter() { return; // No writing support for PS1Data files yet } - public override void WritePointer(Pointer pointer) { + public override void WritePointer(LegacyPointer pointer) { if (writer != null) { if (pointer == null) { writer.Write((uint)0); @@ -43,12 +44,12 @@ public override void WritePointer(Pointer pointer) { } } - public override Pointer GetUnsafePointer(uint value) { + public override LegacyPointer GetUnsafePointer(uint value) { MapLoader l = MapLoader.Loader; for (int i = l.files_array.Length - 1; i >= 0; i--) { PS1Data ps1File = l.files_array[i] as PS1Data; if (ps1File != null && ps1File.headerOffset != 0 && value >= ps1File.headerOffset && value < ps1File.headerOffset + ps1File.length) { - return new Pointer(value, ps1File); + return new LegacyPointer(value, ps1File); } } // Do a second loop over the files. If end and start overlap we want the start (returned by previous loop), @@ -56,7 +57,7 @@ public override Pointer GetUnsafePointer(uint value) { for (int i = l.files_array.Length - 1; i >= 0; i--) { PS1Data ps1File = l.files_array[i] as PS1Data; if (ps1File != null && ps1File.headerOffset != 0 && value == ps1File.headerOffset + ps1File.length) { - return new Pointer(value, ps1File); + return new LegacyPointer(value, ps1File); } } /*if (headerOffset != 0 && value >= headerOffset && value < headerOffset + length) { diff --git a/Assets/Scripts/OpenSpace/FileFormat/ROMBIN.cs b/Assets/Scripts/OpenSpace/FileFormat/ROMBIN.cs index 4cc3f662..518d9312 100644 --- a/Assets/Scripts/OpenSpace/FileFormat/ROMBIN.cs +++ b/Assets/Scripts/OpenSpace/FileFormat/ROMBIN.cs @@ -1,4 +1,5 @@ -using System; +using BinarySerializer.Unity; +using System; using System.Collections.Generic; using System.IO; using System.Linq; @@ -20,10 +21,10 @@ public ROMBIN(string name, Stream stream, int fileID) { this.name = name; this.fileID = fileID; length = stream.Length; - using (Reader fileReader = new Reader(stream, Settings.s.IsLittleEndian)) { + using (Reader fileReader = new Reader(stream, Legacy_Settings.s.IsLittleEndian)) { data = fileReader.ReadBytes((int)stream.Length); } - reader = new Reader(new MemoryStream(data), Settings.s.IsLittleEndian); + reader = new Reader(new MemoryStream(data), Legacy_Settings.s.IsLittleEndian); headerOffset = 0; baseOffset = -headerOffset; reader.BaseStream.Seek(0, SeekOrigin.Begin); @@ -38,7 +39,7 @@ public override void CreateWriter() { return; // No writing support for DC DAT files yet } - public override void WritePointer(Pointer pointer) { + public override void WritePointer(LegacyPointer pointer) { if (writer != null) { if (pointer == null) { writer.Write((uint)0); @@ -54,9 +55,9 @@ public void WithPointerFile(FileWithPointers f, Action action) { pointerFile = null; } - public override Pointer GetUnsafePointer(uint value) { + public override LegacyPointer GetUnsafePointer(uint value) { if (value >= headerOffset && value < headerOffset + length) { - return new Pointer(value, pointerFile != null ? pointerFile : this); + return new LegacyPointer(value, pointerFile != null ? pointerFile : this); } return null; } diff --git a/Assets/Scripts/OpenSpace/FileFormat/RelocationTable.cs b/Assets/Scripts/OpenSpace/FileFormat/RelocationTable.cs index 4fef612a..83aae469 100644 --- a/Assets/Scripts/OpenSpace/FileFormat/RelocationTable.cs +++ b/Assets/Scripts/OpenSpace/FileFormat/RelocationTable.cs @@ -1,4 +1,5 @@ -using Cysharp.Threading.Tasks; +using BinarySerializer.Unity; +using Cysharp.Threading.Tasks; using lzo.net; using System; using System.Collections; @@ -96,7 +97,7 @@ public async UniTask Init() { private async UniTask Load(Stream stream, bool masking) { using (Reader reader = new Reader(stream, isLittleEndian)) { - if (Settings.s.encryptPointerFiles) { + if (Legacy_Settings.s.encryptPointerFiles) { reader.InitMask(); //reader.InitWindowMask(); /*byte [] data = reader.ReadBytes((int)stream.Length); @@ -167,8 +168,8 @@ async UniTask Read(Reader reader) { if (httpStream != null) await httpStream.FillCacheForRead(5); byte count = reader.ReadByte(); - if (Settings.s.game != Settings.Game.R2Demo && Settings.s.game != Settings.Game.RedPlanet - && Settings.s.engineVersion > Settings.EngineVersion.Montreal) { + if (Legacy_Settings.s.game != Legacy_Settings.Game.R2Demo && Legacy_Settings.s.game != Legacy_Settings.Game.RedPlanet + && Legacy_Settings.s.engineVersion > Legacy_Settings.EngineVersion.Montreal) { reader.ReadUInt32(); } pointerBlocks = new RelocationPointerList[count]; @@ -187,7 +188,7 @@ async UniTask Read(Reader reader) { pointerBlocks[i].count = reader.ReadUInt32(); pointerBlocks[i].pointers = new RelocationPointerInfo[pointerBlocks[i].count]; if (pointerBlocks[i].count > 0) { - if (Settings.s.snaCompression) { + if (Legacy_Settings.s.snaCompression) { if (httpStream != null) await httpStream.FillCacheForRead(5*4); uint isCompressed = reader.ReadUInt32(); uint compressedSize = reader.ReadUInt32(); @@ -199,12 +200,12 @@ async UniTask Read(Reader reader) { if (isCompressed != 0) { using (var compressedStream = new MemoryStream(compressedData)) using (var lzo = new LzoStream(compressedStream, CompressionMode.Decompress)) - using (Reader lzoReader = new Reader(lzo, Settings.s.IsLittleEndian)) { + using (Reader lzoReader = new Reader(lzo, Legacy_Settings.s.IsLittleEndian)) { ReadPointerBlock(lzoReader, pointerBlocks[i]); } } else { using (var uncompressedStream = new MemoryStream(compressedData)) - using (Reader unCompressedReader = new Reader(uncompressedStream, Settings.s.IsLittleEndian)) { + using (Reader unCompressedReader = new Reader(uncompressedStream, Legacy_Settings.s.IsLittleEndian)) { ReadPointerBlock(unCompressedReader, pointerBlocks[i]); } } @@ -225,7 +226,7 @@ private void ReadPointerBlock(Reader reader, RelocationPointerList pointerBlock) pointerBlock.pointers[j].offsetInMemory = reader.ReadUInt32(); pointerBlock.pointers[j].module = reader.ReadByte(); pointerBlock.pointers[j].id = reader.ReadByte(); - if (Settings.s.engineVersion > Settings.EngineVersion.TT && Settings.s.game != Settings.Game.PlaymobilLaura) { + if (Legacy_Settings.s.engineVersion > Legacy_Settings.EngineVersion.TT && Legacy_Settings.s.game != Legacy_Settings.Game.PlaymobilLaura) { pointerBlock.pointers[j].byte6 = reader.ReadByte(); pointerBlock.pointers[j].byte7 = reader.ReadByte(); } diff --git a/Assets/Scripts/OpenSpace/FileFormat/RenderWare/MeshFile.cs b/Assets/Scripts/OpenSpace/FileFormat/RenderWare/MeshFile.cs index d0145d83..95b13605 100644 --- a/Assets/Scripts/OpenSpace/FileFormat/RenderWare/MeshFile.cs +++ b/Assets/Scripts/OpenSpace/FileFormat/RenderWare/MeshFile.cs @@ -1,4 +1,5 @@ -using OpenSpace.Visual; +using BinarySerializer.Unity; +using OpenSpace.Visual; using System; using System.Collections.Generic; using System.IO; @@ -19,7 +20,7 @@ public class MeshFile { public MeshFile(string path) { Stream fs = FileSystem.GetFileReadStream(path); - using (Reader reader = new Reader(fs, Settings.s.IsLittleEndian)) { + using (Reader reader = new Reader(fs, Legacy_Settings.s.IsLittleEndian)) { root = Section.Read(reader); } if (root != null && root.type == Section.Type.Clump) { diff --git a/Assets/Scripts/OpenSpace/FileFormat/RenderWare/TextureDictionary.cs b/Assets/Scripts/OpenSpace/FileFormat/RenderWare/TextureDictionary.cs index 113a8389..44460fd6 100644 --- a/Assets/Scripts/OpenSpace/FileFormat/RenderWare/TextureDictionary.cs +++ b/Assets/Scripts/OpenSpace/FileFormat/RenderWare/TextureDictionary.cs @@ -1,4 +1,5 @@ -using System; +using BinarySerializer.Unity; +using System; using System.Collections.Generic; using System.IO; using System.Linq; @@ -17,7 +18,7 @@ public class TextureDictionary { public Texture2D[] textures = null; public TextureDictionary(string path) { Stream fs = FileSystem.GetFileReadStream(path); - using (Reader reader = new Reader(fs, Settings.s.IsLittleEndian)) { + using (Reader reader = new Reader(fs, Legacy_Settings.s.IsLittleEndian)) { root = Section.Read(reader); } if (root != null && root.type == Section.Type.TextureDictionary) { @@ -98,7 +99,7 @@ private Texture2D ParseTexture(byte[] data, uint width, uint height, uint bpp, u } else if(rasterFormat.HasFlag(RasterFormat.FORMAT_1555)) { // Just RGBA 5551 for (int i = 0; i < data.Length / 2; i++) { - ushort pixel = Util.ToUInt16(new byte[] { data[i * 2], data[i * 2 + 1] }, 0, Settings.s.IsLittleEndian); + ushort pixel = Util.ToUInt16(new byte[] { data[i * 2], data[i * 2 + 1] }, 0, Legacy_Settings.s.IsLittleEndian); uint alpha = extractBits(pixel, 1, 15); uint blue = extractBits(pixel, 5, 10); uint green = extractBits(pixel, 5, 5); diff --git a/Assets/Scripts/OpenSpace/FileFormat/SNA.cs b/Assets/Scripts/OpenSpace/FileFormat/SNA.cs index c2d93fdb..10592f07 100644 --- a/Assets/Scripts/OpenSpace/FileFormat/SNA.cs +++ b/Assets/Scripts/OpenSpace/FileFormat/SNA.cs @@ -1,4 +1,5 @@ -using lzo.net; +using BinarySerializer.Unity; +using lzo.net; using System; using System.Collections.Generic; using System.IO; @@ -50,11 +51,11 @@ public SNA(string name, Stream stream, RelocationTable rtb) { headerOffset = 0; this.name = name; this.rtb = rtb; - using (Reader encodedReader = new Reader(stream, Settings.s.IsLittleEndian)) { + using (Reader encodedReader = new Reader(stream, Legacy_Settings.s.IsLittleEndian)) { int maskBytes = encodedReader.InitMask(); data = encodedReader.ReadBytes((int)stream.Length - maskBytes); } - reader = new Reader(new MemoryStream(data), Settings.s.IsLittleEndian); + reader = new Reader(new MemoryStream(data), Legacy_Settings.s.IsLittleEndian); ReadSNA(); } @@ -77,8 +78,8 @@ public override void EndWrite() { public void WriteSNA() { using (FileStream stream = new FileStream(path, FileMode.Open)) { - Writer writer = new Writer(stream, Settings.s.IsLittleEndian); - if (Settings.s.game == Settings.Game.TT) { + Writer writer = new Writer(stream, Legacy_Settings.s.IsLittleEndian); + if (Legacy_Settings.s.game == Legacy_Settings.Game.TT) { throw new NotImplementedException(); //byte headerLength = reader.ReadByte(); //reader.ReadBytes(headerLength); @@ -86,7 +87,7 @@ public void WriteSNA() { foreach (SNAMemoryBlock block in blocks) { writer.Write(block.module); writer.Write(block.id); - if (Settings.s.engineVersion > Settings.EngineVersion.Montreal) writer.Write(block.unk1); + if (Legacy_Settings.s.engineVersion > Legacy_Settings.EngineVersion.Montreal) writer.Write(block.unk1); writer.Write(block.baseInMemory); if (block.baseInMemory != -1) { @@ -94,7 +95,7 @@ public void WriteSNA() { writer.Write(block.unk3); writer.Write(block.maxPosMinus9); writer.Write(block.size); - if (Settings.s.game == Settings.Game.TT) writer.Write(block.unk1); + if (Legacy_Settings.s.game == Legacy_Settings.Game.TT) writer.Write(block.unk1); WriteSNABlock(writer, block); } @@ -105,7 +106,7 @@ public void WriteSNA() { void ReadSNA() { MapLoader l = MapLoader.Loader; uint szCounter = 0; - if (Settings.s.game == Settings.Game.TT) { + if (Legacy_Settings.s.game == Legacy_Settings.Game.TT) { byte headerLength = reader.ReadByte(); reader.ReadBytes(headerLength); } @@ -115,7 +116,7 @@ void ReadSNA() { block.position = (uint)reader.BaseStream.Position; block.module = reader.ReadByte(); block.id = reader.ReadByte(); - if (Settings.s.engineVersion > Settings.EngineVersion.Montreal) block.unk1 = reader.ReadByte(); + if (Legacy_Settings.s.engineVersion > Legacy_Settings.EngineVersion.Montreal) block.unk1 = reader.ReadByte(); block.baseInMemory = reader.ReadInt32(); if (blocks.Count == 0) { l.print("Initial block: " + block.module + "|" + block.id + " - base: " + block.baseInMemory); @@ -132,7 +133,7 @@ void ReadSNA() { block.maxPosMinus9 = reader.ReadUInt32(); block.size = reader.ReadUInt32(); szCounter += block.size; - if (Settings.s.game == Settings.Game.TT) block.unk1 = reader.ReadByte(); + if (Legacy_Settings.s.game == Legacy_Settings.Game.TT) block.unk1 = reader.ReadByte(); block.dataPosition = (uint)reader.BaseStream.Position; //l.print("(" + block.module + "," + block.id + ") Base: " + block.baseInMemory + " - Size: " + block.size + " - 2:" + block.unk2 + " - 3:" + block.unk3 + " - 4:" + block.maxPosMinus9); @@ -200,7 +201,7 @@ private void AppendData(byte[] other) { Array.Copy(other, 0, data, oldLength, other.Length); if (reading) { reader.Close(); - reader = new Reader(new MemoryStream(data), Settings.s.IsLittleEndian); + reader = new Reader(new MemoryStream(data), Legacy_Settings.s.IsLittleEndian); reader.BaseStream.Seek(readerOffset, SeekOrigin.Begin); } } @@ -208,7 +209,7 @@ private void AppendData(byte[] other) { void ReadSNABlock(SNAMemoryBlock block) { MapLoader l = MapLoader.Loader; if (block.size > 0) { - if (Settings.s.snaCompression) { + if (Legacy_Settings.s.snaCompression) { uint isCompressed = reader.ReadUInt32(); uint compressedSize = reader.ReadUInt32(); uint compressedChecksum = reader.ReadUInt32(); @@ -230,14 +231,14 @@ void ReadSNABlock(SNAMemoryBlock block) { }*/ using (var compressedStream = new MemoryStream(compressedData)) using (var lzo = new LzoStream(compressedStream, CompressionMode.Decompress)) - using (Reader lzoReader = new Reader(lzo, Settings.s.IsLittleEndian)) { + using (Reader lzoReader = new Reader(lzo, Legacy_Settings.s.IsLittleEndian)) { lzo.SetLength(decompressedSize); uncompressedData = lzoReader.ReadBytes((int)block.size); } } else { diff = 0; using (var uncompressedStream = new MemoryStream(compressedData)) - using (Reader unCompressedReader = new Reader(uncompressedStream, Settings.s.IsLittleEndian)) { + using (Reader unCompressedReader = new Reader(uncompressedStream, Legacy_Settings.s.IsLittleEndian)) { uncompressedData = unCompressedReader.ReadBytes((int)block.size); } } @@ -251,7 +252,7 @@ void ReadSNABlock(SNAMemoryBlock block) { data.Length - block.dataPosition - 20 - compressedSize); data = newData; reader.Close(); - reader = new Reader(new MemoryStream(data), Settings.s.IsLittleEndian); + reader = new Reader(new MemoryStream(data), Legacy_Settings.s.IsLittleEndian); reader.BaseStream.Seek(block.dataPosition + compressedSize + diff, SeekOrigin.Begin); } } else { @@ -353,14 +354,14 @@ public void ReadGPT(string path, RelocationTable rtp) { Stream gptStream = FileSystem.GetFileReadStream(path); uint gptOffset = (uint)data.Length; byte[] gptData = null; - using (Reader gptReader = new Reader(gptStream, Settings.s.IsLittleEndian)) { - int maskBytes = Settings.s.encryptPointerFiles ? gptReader.InitMask() : 0; + using (Reader gptReader = new Reader(gptStream, Legacy_Settings.s.IsLittleEndian)) { + int maskBytes = Legacy_Settings.s.encryptPointerFiles ? gptReader.InitMask() : 0; gptData = gptReader.ReadBytes((int)gptStream.Length - maskBytes); } //Util.ByteArrayToFile(path + ".dmp", gptData); AppendData(gptData); SNAMemoryBlock block; - if (Settings.s.engineVersion > Settings.EngineVersion.Montreal) { + if (Legacy_Settings.s.engineVersion > Legacy_Settings.EngineVersion.Montreal) { ushort ptrRelocationKey = GetRelocationKey(rtp.pointerBlocks[0]); block = relocation_local[ptrRelocationKey]; } else { @@ -381,14 +382,14 @@ public void ReadDLG(string path, RelocationTable rtd) { Stream dlgStream = FileSystem.GetFileReadStream(path); uint dlgOffset = (uint)data.Length; byte[] dlgData = null; - using (Reader dlgReader = new Reader(dlgStream, Settings.s.IsLittleEndian)) { - int maskBytes = Settings.s.encryptPointerFiles ? dlgReader.InitMask() : 0; + using (Reader dlgReader = new Reader(dlgStream, Legacy_Settings.s.IsLittleEndian)) { + int maskBytes = Legacy_Settings.s.encryptPointerFiles ? dlgReader.InitMask() : 0; dlgData = dlgReader.ReadBytes((int)dlgStream.Length - maskBytes); } //Util.ByteArrayToFile(path + ".dmp", gptData); AppendData(dlgData); SNAMemoryBlock block; - if (Settings.s.engineVersion > Settings.EngineVersion.Montreal) { + if (Legacy_Settings.s.engineVersion > Legacy_Settings.EngineVersion.Montreal) { ushort ptrRelocationKey = GetRelocationKey(rtd.pointerBlocks[0]); block = relocation_local[ptrRelocationKey]; } else { @@ -406,7 +407,7 @@ public void ReadSDA(string path) { Stream sdaStream = FileSystem.GetFileReadStream(path); uint sdaOffset = (uint)data.Length; byte[] sdaData = null; - using (Reader sdaReader = new Reader(sdaStream, Settings.s.IsLittleEndian)) { + using (Reader sdaReader = new Reader(sdaStream, Legacy_Settings.s.IsLittleEndian)) { sdaData = sdaReader.ReadBytes((int)sdaStream.Length); } AppendData(sdaData); @@ -422,14 +423,14 @@ public void ReadPTX(string path, RelocationTable rtt) { Stream ptxStream = FileSystem.GetFileReadStream(path); uint ptxOffset = (uint)data.Length; byte[] ptxData = null; - using (Reader ptxReader = new Reader(ptxStream, Settings.s.IsLittleEndian)) { - int maskBytes = Settings.s.encryptPointerFiles ? ptxReader.InitMask() : 0; + using (Reader ptxReader = new Reader(ptxStream, Legacy_Settings.s.IsLittleEndian)) { + int maskBytes = Legacy_Settings.s.encryptPointerFiles ? ptxReader.InitMask() : 0; ptxData = ptxReader.ReadBytes((int)ptxStream.Length - maskBytes); } //Util.ByteArrayToFile(path + ".dmp", ptxData); AppendData(ptxData); ptx = new SNAMemoryBlock(); - if (Settings.s.engineVersion > Settings.EngineVersion.Montreal) { + if (Legacy_Settings.s.engineVersion > Legacy_Settings.EngineVersion.Montreal) { // It doesn't exist in Tonic Trouble ushort ptrRelocationKey = GetRelocationKey(rtt.pointerBlocks[0]); SNAMemoryBlock block = relocation_local[ptrRelocationKey]; @@ -464,7 +465,7 @@ public void CreatePointers() { ushort ptrRelocationKey = GetRelocationKey(info); if (!l.relocation_global.ContainsKey(ptrRelocationKey)) { - if (Settings.s.engineVersion > Settings.EngineVersion.Montreal || !(info.module == 0xFF && info.id == 0xFF)) { + if (Legacy_Settings.s.engineVersion > Legacy_Settings.EngineVersion.Montreal || !(info.module == 0xFF && info.id == 0xFF)) { l.print("Could not find SNA block (" + info.module + "," + info.id + ")"); } } else { @@ -514,7 +515,7 @@ public void CreatePointers() { l.print("Fillin pointer points to block (" + ptr_block_global.module + "," + ptr_block_global.id + ") with base " + ptr_block_global.baseInMemory); l.print("Its value prior to relocation is " + ptrValuePrior + " - minus base: " + (ptrValuePrior - ptr_block_local.baseInMemory)); }*/ - Pointer pointer = new Pointer(ptrValue, ptr_block_global.sna); + LegacyPointer pointer = new LegacyPointer(ptrValue, ptr_block_global.sna); block_global.sna.pointers[block_global.dataPosition + relativeAddress] = pointer; } else { l.print("Pointer error: SNA part (" + info.module + "," + info.id + ") not found."); @@ -541,7 +542,7 @@ private void RelocatePointerFile(SNAMemoryBlock pf, RelocationTable rt) { for (uint i = 0; i < pf.size / 4; i++) { uint ptrValue = reader.ReadUInt32(); RelocationPointerInfo info = null; - if (Settings.s.engineVersion == Settings.EngineVersion.Montreal ||Settings.s.game == Settings.Game.RedPlanet) { + if (Legacy_Settings.s.engineVersion == Legacy_Settings.EngineVersion.Montreal ||Legacy_Settings.s.game == Legacy_Settings.Game.RedPlanet) { foreach (RelocationPointerInfo info_new in ptrList.pointers) { if (info_new.offsetInMemory == ptrValue) { info = info_new; @@ -560,12 +561,12 @@ private void RelocatePointerFile(SNAMemoryBlock pf, RelocationTable rt) { if (ptr_block_global != null && ptr_block_local != null && ptr_block_local.baseInMemory != -1) { ptrValue -= (uint)ptr_block_local.baseInMemory; if (info.module != tmpModule) ptrValue += ptr_block_global.dataPosition; - Pointer pointer = new Pointer(ptrValue, ptr_block_global.sna); + LegacyPointer pointer = new LegacyPointer(ptrValue, ptr_block_global.sna); pointers[pf.dataPosition + (i * 4)] = pointer; } else { l.print("Pointer error: SNA part (" + info.module + "," + info.id + ") not found."); } - if (Settings.s.engineVersion != Settings.EngineVersion.Montreal && Settings.s.game != Settings.Game.RedPlanet) { + if (Legacy_Settings.s.engineVersion != Legacy_Settings.EngineVersion.Montreal && Legacy_Settings.s.game != Legacy_Settings.Game.RedPlanet) { listIndex++; if (listIndex >= ptrList.pointers.Length) break; } @@ -580,7 +581,7 @@ private void RelocatePointerFile(SNAMemoryBlock pf, RelocationTable rt) { if (ptrValue > block.baseInMemory && ptrValue < block.baseInMemory + block.size) { ptrValue -= (uint)block.baseInMemory; ptrValue += block.dataPosition; - Pointer pointer = new Pointer(ptrValue, block.sna); + LegacyPointer pointer = new LegacyPointer(ptrValue, block.sna); pointers[pf.dataPosition + (i * 4)] = pointer; } } @@ -605,7 +606,7 @@ public void CreateMemoryDump(string path, bool replacePointers) { if (replacePointers) { byte[] replacedData = new byte[data.Length]; Array.Copy(data, replacedData, data.Length); - foreach (KeyValuePair ptrKeyVal in pointers) { + foreach (KeyValuePair ptrKeyVal in pointers) { if (ptrKeyVal.Value == null) continue; uint offset = ptrKeyVal.Key; if (offset < replacedData.Length) { @@ -626,26 +627,26 @@ public void OverwriteData(uint position, uint data) { OverwriteData(position, BitConverter.GetBytes(data)); } - public Pointer PTX { + public LegacyPointer PTX { get { if (ptx != null) { - return new Pointer(ptx.dataPosition, this); + return new LegacyPointer(ptx.dataPosition, this); } else return null; } } - public Pointer SDA { + public LegacyPointer SDA { get { if (sda != null) { - return new Pointer(sda.dataPosition, this); + return new LegacyPointer(sda.dataPosition, this); } else return null; } } - public Pointer DLG { + public LegacyPointer DLG { get { if (dlg != null) { - return new Pointer(dlg.dataPosition, this); + return new LegacyPointer(dlg.dataPosition, this); } else return null; } } @@ -654,11 +655,11 @@ public override void CreateWriter() { if (path != null) { MemoryStream stream = new MemoryStream(data, true); //FileStream stream = new FileStream(path, FileMode.Open); - writer = new Writer(stream, Settings.s.IsLittleEndian); + writer = new Writer(stream, Legacy_Settings.s.IsLittleEndian); } } - public override void WritePointer(Pointer pointer) { + public override void WritePointer(LegacyPointer pointer) { UnityEngine.Debug.LogWarning("Pointer writing not supported!"); writer.BaseStream.Position += 4; //throw new NotImplementedException(); diff --git a/Assets/Scripts/OpenSpace/FileFormat/Texture/BTF.cs b/Assets/Scripts/OpenSpace/FileFormat/Texture/BTF.cs index 1992098c..e3f6b240 100644 --- a/Assets/Scripts/OpenSpace/FileFormat/Texture/BTF.cs +++ b/Assets/Scripts/OpenSpace/FileFormat/Texture/BTF.cs @@ -1,4 +1,5 @@ -using DDSImageParser; +using BinarySerializer.Unity; +using DDSImageParser; using LibGC.Texture; using System; using System.IO; @@ -24,10 +25,10 @@ public BTF(string btfPath, string bhfPath) { path = btfPath; Stream btf = FileSystem.GetFileReadStream(btfPath); Stream bhf = FileSystem.GetFileReadStream(bhfPath); - using (Reader reader = new Reader(bhf, Settings.s.IsLittleEndian)) { + using (Reader reader = new Reader(bhf, Legacy_Settings.s.IsLittleEndian)) { Count = reader.ReadUInt32(); textures = new Texture2D[Count]; - if (Settings.s.platform == Settings.Platform.Xbox) { + if (Legacy_Settings.s.platform == Legacy_Settings.Platform.Xbox) { headers = new BTFHeader[Count]; for (uint i = 0; i < Count; i++) { headers[i] = new BTFHeader(); @@ -38,7 +39,7 @@ public BTF(string btfPath, string bhfPath) { headers[i].flags = reader.ReadUInt32(); headers[i].dword_10 = reader.ReadUInt32(); } - } else if (Settings.s.platform == Settings.Platform.Xbox360) { + } else if (Legacy_Settings.s.platform == Legacy_Settings.Platform.Xbox360) { headers360 = new BTFHeader360[Count]; for (uint i = 0; i < Count; i++) { headers360[i] = new BTFHeader360(); @@ -57,8 +58,8 @@ public BTF(string btfPath, string bhfPath) { } } } - using (Reader reader = new Reader(btf, Settings.s.IsLittleEndian)) { - if (Settings.s.platform == Settings.Platform.Xbox) { + using (Reader reader = new Reader(btf, Legacy_Settings.s.IsLittleEndian)) { + if (Legacy_Settings.s.platform == Legacy_Settings.Platform.Xbox) { for (uint i = 0; i < Count; i++) { btf.Seek(headers[i].offset, SeekOrigin.Begin); uint width = (uint)(1 << (int)headers[i].WidthExponent); @@ -71,7 +72,7 @@ public BTF(string btfPath, string bhfPath) { textures[i] = dds.BitmapImage; } } - } else if (Settings.s.platform == Settings.Platform.Xbox360) { + } else if (Legacy_Settings.s.platform == Legacy_Settings.Platform.Xbox360) { for (uint i = 0; i < Count; i++) { //Debug.Log("parsing " + i); btf.Seek(headers360[i].offset1, SeekOrigin.Begin); @@ -85,9 +86,9 @@ public BTF(string btfPath, string bhfPath) { } public Texture2D GetTexture(int i, uint width, uint height) { - if (Settings.s.platform == Settings.Platform.Xbox) { + if (Legacy_Settings.s.platform == Legacy_Settings.Platform.Xbox) { return textures[i]; - } else if (Settings.s.platform == Settings.Platform.Xbox360) { + } else if (Legacy_Settings.s.platform == Legacy_Settings.Platform.Xbox360) { //i = headers360.FirstOrDefault(t => t.name.Substring(0, t.name.LastIndexOf('.')) == name).index; if (textures[i] == null) { /*while (width * height < headers360[i].data1.Length) { diff --git a/Assets/Scripts/OpenSpace/FileFormat/Texture/CNT.cs b/Assets/Scripts/OpenSpace/FileFormat/Texture/CNT.cs index 6b351b0c..e860dde0 100644 --- a/Assets/Scripts/OpenSpace/FileFormat/Texture/CNT.cs +++ b/Assets/Scripts/OpenSpace/FileFormat/Texture/CNT.cs @@ -1,6 +1,7 @@ // Adapted from Rayman2Lib by szymski // https://github.com/szymski/Rayman2Lib/blob/master/csharp_tools/Rayman2Lib/CNTFile.cs +using BinarySerializer.Unity; using Cysharp.Threading.Tasks; using System; using System.Collections; diff --git a/Assets/Scripts/OpenSpace/FileFormat/Texture/DS/GFX.cs b/Assets/Scripts/OpenSpace/FileFormat/Texture/DS/GFX.cs index 84a112cc..52a16e02 100644 --- a/Assets/Scripts/OpenSpace/FileFormat/Texture/DS/GFX.cs +++ b/Assets/Scripts/OpenSpace/FileFormat/Texture/DS/GFX.cs @@ -1,4 +1,5 @@ -using LibGC.Texture; +using BinarySerializer.Unity; +using LibGC.Texture; using System; using System.Collections.Generic; using System.IO; @@ -20,7 +21,7 @@ public GFX(string gfxPath, string mapPath, string palPath, int width, int height this.mapPath = mapPath; this.palPath = palPath; Stream palFS = FileSystem.GetFileReadStream(palPath); - using (Reader reader = new Reader(palFS, Settings.s.IsLittleEndian)) { + using (Reader reader = new Reader(palFS, Legacy_Settings.s.IsLittleEndian)) { palettes = new Color[reader.BaseStream.Length / 32][]; for (int i = 0; i < palettes.Length; i++) { palettes[i] = new Color[16]; @@ -31,7 +32,7 @@ public GFX(string gfxPath, string mapPath, string palPath, int width, int height } } Stream mapFS = FileSystem.GetFileReadStream(mapPath); - using (Reader reader = new Reader(mapFS, Settings.s.IsLittleEndian)) { + using (Reader reader = new Reader(mapFS, Legacy_Settings.s.IsLittleEndian)) { map = new MapEntry[reader.BaseStream.Length / 2]; for (int i = 0; i < map.Length; i++) { map[i] = new MapEntry(reader.ReadUInt16()); @@ -39,7 +40,7 @@ public GFX(string gfxPath, string mapPath, string palPath, int width, int height } int tile_size = 8; Stream fs = FileSystem.GetFileReadStream(gfxPath); - using (Reader reader = new Reader(fs, Settings.s.IsLittleEndian)) { + using (Reader reader = new Reader(fs, Legacy_Settings.s.IsLittleEndian)) { texture = new Texture2D(width * tile_size, height * tile_size); Color[] pixels = new Color[texture.width * texture.height]; byte[][] tiles = new byte[reader.BaseStream.Length / 0x20][]; @@ -168,7 +169,7 @@ private byte[] ReadTile(Reader reader) { static Color ParseColorRGBA5551(ushort shortCol) { uint alpha, blue, green, red; - if (Settings.s.platform == Settings.Platform.DS) { + if (Legacy_Settings.s.platform == Legacy_Settings.Platform.DS) { alpha = ExtractBits(shortCol, 1, 15); blue = ExtractBits(shortCol, 5, 10); green = ExtractBits(shortCol, 5, 5); diff --git a/Assets/Scripts/OpenSpace/FileFormat/Texture/DS/NBFC.cs b/Assets/Scripts/OpenSpace/FileFormat/Texture/DS/NBFC.cs index 8ccf5cc6..2d5dbcf2 100644 --- a/Assets/Scripts/OpenSpace/FileFormat/Texture/DS/NBFC.cs +++ b/Assets/Scripts/OpenSpace/FileFormat/Texture/DS/NBFC.cs @@ -1,4 +1,5 @@ -using LibGC.Texture; +using BinarySerializer.Unity; +using LibGC.Texture; using System; using System.IO; using UnityEngine; @@ -14,7 +15,7 @@ public NBFC(string path, int width, int height, Color[] palette, bool i4) { this.path = path; this.i4 = i4; Stream fs = FileSystem.GetFileReadStream(path); - using (Reader reader = new Reader(fs, Settings.s.IsLittleEndian)) { + using (Reader reader = new Reader(fs, Legacy_Settings.s.IsLittleEndian)) { texture = new Texture2D(width * 8, height * 8); Color[] pixels = new Color[texture.width * texture.height]; int tile_size = 8; @@ -43,7 +44,7 @@ private Color[] ReadTile(Reader reader, Color[] palette) { if (i4) { bool shift = index % 2 != 0; byte texByte = texBytes[index / 2]; - if (Settings.s.IsLittleEndian) { + if (Legacy_Settings.s.IsLittleEndian) { if (shift) { texByte = (byte)(texByte >> 4); } else { diff --git a/Assets/Scripts/OpenSpace/FileFormat/Texture/DS/PAL.cs b/Assets/Scripts/OpenSpace/FileFormat/Texture/DS/PAL.cs index 0e21ec71..5102ae01 100644 --- a/Assets/Scripts/OpenSpace/FileFormat/Texture/DS/PAL.cs +++ b/Assets/Scripts/OpenSpace/FileFormat/Texture/DS/PAL.cs @@ -1,4 +1,5 @@ -using LibGC.Texture; +using BinarySerializer.Unity; +using LibGC.Texture; using System; using System.IO; using UnityEngine; @@ -12,7 +13,7 @@ public class PAL { public PAL(string path) { this.path = path; Stream fs = FileSystem.GetFileReadStream(path); - using (Reader reader = new Reader(fs, Settings.s.IsLittleEndian)) { + using (Reader reader = new Reader(fs, Legacy_Settings.s.IsLittleEndian)) { palette = new Color[reader.BaseStream.Length/2]; for (int i = 0; i < palette.Length; i++) { ushort shortCol = reader.ReadUInt16(); @@ -24,7 +25,7 @@ public PAL(string path) { static Color ParseColorRGBA5551(ushort shortCol) { uint alpha, blue, green, red; - if (Settings.s.platform == Settings.Platform.DS) { + if (Legacy_Settings.s.platform == Legacy_Settings.Platform.DS) { alpha = ExtractBits(shortCol, 1, 15); blue = ExtractBits(shortCol, 5, 10); green = ExtractBits(shortCol, 5, 5); diff --git a/Assets/Scripts/OpenSpace/FileFormat/Texture/ETC.cs b/Assets/Scripts/OpenSpace/FileFormat/Texture/ETC.cs index f6f25cc2..509e148a 100644 --- a/Assets/Scripts/OpenSpace/FileFormat/Texture/ETC.cs +++ b/Assets/Scripts/OpenSpace/FileFormat/Texture/ETC.cs @@ -1,4 +1,5 @@ -using System; +using BinarySerializer.Unity; +using System; using System.IO; using UnityEngine; diff --git a/Assets/Scripts/OpenSpace/FileFormat/Texture/GF.cs b/Assets/Scripts/OpenSpace/FileFormat/Texture/GF.cs index 5e27d226..be0bd950 100644 --- a/Assets/Scripts/OpenSpace/FileFormat/Texture/GF.cs +++ b/Assets/Scripts/OpenSpace/FileFormat/Texture/GF.cs @@ -1,6 +1,7 @@ // Adapted from Rayman2Lib by szymski // https://github.com/szymski/Rayman2Lib/blob/master/d_tools/rayman2lib/source/formats/gf.d +using BinarySerializer.Unity; using System; using System.IO; using UnityEngine; @@ -61,17 +62,17 @@ public GF(string filePath) : this(FileSystem.GetFileReadStream(filePath)) { } public GF(Stream stream) { MapLoader l = MapLoader.Loader; - bool isR3PS2Proto = Settings.s.mode == Settings.Mode.Rayman3PS2Demo_2002_05_17; + bool isR3PS2Proto = Legacy_Settings.s.mode == Legacy_Settings.Mode.Rayman3PS2Demo_2002_05_17; Reader reader = new Reader(stream, isLittleEndian); /*var pos = reader.BaseStream.Position; reader.ReadBytes(*/ if (isR3PS2Proto) { - } else if (Settings.s.engineVersion == Settings.EngineVersion.Montreal) { + } else if (Legacy_Settings.s.engineVersion == Legacy_Settings.EngineVersion.Montreal) { byte version = reader.ReadByte(); format = 1555; } else { format = 8888; - if (Settings.s.platform != Settings.Platform.iOS && Settings.s.game != Settings.Game.TTSE) format = reader.ReadUInt32(); + if (Legacy_Settings.s.platform != Legacy_Settings.Platform.iOS && Legacy_Settings.s.game != Legacy_Settings.Game.TTSE) format = reader.ReadUInt32(); } width = reader.ReadUInt32(); @@ -82,7 +83,7 @@ public GF(Stream stream) { if (!isR3PS2Proto) { channels = reader.ReadByte(); byte enlargeByte = 0; - if (Settings.s.engineVersion == Settings.EngineVersion.R3 && Settings.s.game != Settings.Game.Dinosaur && Settings.s.game != Settings.Game.LargoWinch) enlargeByte = reader.ReadByte(); + if (Legacy_Settings.s.engineVersion == Legacy_Settings.EngineVersion.R3 && Legacy_Settings.s.game != Legacy_Settings.Game.Dinosaur && Legacy_Settings.s.game != Legacy_Settings.Game.LargoWinch) enlargeByte = reader.ReadByte(); if (enlargeByte > 1) { uint w = width, h = height, e = enlargeByte; if (w != 1) w >>= 1; @@ -98,7 +99,7 @@ public GF(Stream stream) { reader.ReadUInt32(); } if(!isR3PS2Proto) repeatByte = reader.ReadByte(); - if (Settings.s.engineVersion == Settings.EngineVersion.Montreal || isR3PS2Proto) { + if (Legacy_Settings.s.engineVersion == Legacy_Settings.EngineVersion.Montreal || isR3PS2Proto) { paletteNumColors = reader.ReadUInt16(); paletteBytesPerColor = reader.ReadByte(); if (isR3PS2Proto) { @@ -128,7 +129,7 @@ public GF(Stream stream) { pixels = new Color[width * height]; if (!isR3PS2Proto) { - if (Settings.s.engineVersion == Settings.EngineVersion.R3 && channels == 1) { + if (Legacy_Settings.s.engineVersion == Legacy_Settings.EngineVersion.R3 && channels == 1) { paletteBytesPerColor = 4; paletteNumColors = 256; palette = reader.ReadBytes(paletteBytesPerColor * paletteNumColors); diff --git a/Assets/Scripts/OpenSpace/FileFormat/Texture/GF64.cs b/Assets/Scripts/OpenSpace/FileFormat/Texture/GF64.cs index 6944cf4b..74d0edc2 100644 --- a/Assets/Scripts/OpenSpace/FileFormat/Texture/GF64.cs +++ b/Assets/Scripts/OpenSpace/FileFormat/Texture/GF64.cs @@ -1,4 +1,5 @@ -using System; +using BinarySerializer.Unity; +using System; using System.IO; using UnityEngine; @@ -10,7 +11,7 @@ public class GF64 { public Format format; public int palette_num_colors; - public GF64(Reader reader, Pointer off_texture, int width, int height, Format format, Pointer off_palette, int palette_num_colors) { + public GF64(Reader reader, LegacyPointer off_texture, int width, int height, Format format, LegacyPointer off_palette, int palette_num_colors) { this.width = width; this.height = height; this.format = format; @@ -28,9 +29,9 @@ public GF64(Stream stream, int width, int height, Format format, Stream palette, this.height = height; this.format = format; this.palette_num_colors = palette_num_colors; - using (Reader r = new Reader(stream, Settings.s.IsLittleEndian)) { + using (Reader r = new Reader(stream, Legacy_Settings.s.IsLittleEndian)) { if (palette != null) { - using (Reader p = new Reader(palette, Settings.s.IsLittleEndian)) { + using (Reader p = new Reader(palette, Legacy_Settings.s.IsLittleEndian)) { Parse(r, p, null, null); } } else { @@ -50,13 +51,13 @@ public void LoadAlphaTexture(GF64 gf) { texture.Apply(); } - private void Parse(Reader reader, Reader paletteReader, Pointer off_texture, Pointer off_palette) { + private void Parse(Reader reader, Reader paletteReader, LegacyPointer off_texture, LegacyPointer off_palette) { // If both texture_index and texture_index2: texture_index2 is the real one, texture_index is palette_index. Color[] palette = null; if (off_palette != null) { - Pointer.DoAt(ref reader, off_palette, () => { + LegacyPointer.DoAt(ref reader, off_palette, () => { palette = ReadPalette(reader); }); } else if (paletteReader != null) { @@ -65,15 +66,15 @@ private void Parse(Reader reader, Reader paletteReader, Pointer off_texture, Poi texture = new Texture2D(width, height, TextureFormat.RGBA32, false); Color[] pixels = new Color[width * height]; if (format == Format.I4 || format == Format.I4Alpha) { - Pointer off_current = null; - if (off_texture != null) off_current = Pointer.Goto(ref reader, off_texture); + LegacyPointer off_current = null; + if (off_texture != null) off_current = LegacyPointer.Goto(ref reader, off_texture); byte[] texBytes = reader.ReadBytes((width * height) / 2); for (int x = 0; x < width; x++) { for (int y = 0; y < height; y++) { int index = (x * height) + y; bool shift = index % 2 != 0; byte texByte = texBytes[((x * height) + y) / 2]; - if (Settings.s.IsLittleEndian) { + if (Legacy_Settings.s.IsLittleEndian) { if (shift) { texByte = (byte)(texByte >> 4); } else { @@ -101,10 +102,10 @@ private void Parse(Reader reader, Reader paletteReader, Pointer off_texture, Poi } } } - if (off_current != null) Pointer.Goto(ref reader, off_current); + if (off_current != null) LegacyPointer.Goto(ref reader, off_current); } else if (format == Format.I8) { - Pointer off_current = null; - if (off_texture != null) off_current = Pointer.Goto(ref reader, off_texture); + LegacyPointer off_current = null; + if (off_texture != null) off_current = LegacyPointer.Goto(ref reader, off_texture); byte[] texBytes = reader.ReadBytes(width * height); for (int x = 0; x < width; x++) { for (int y = 0; y < height; y++) { @@ -126,10 +127,10 @@ private void Parse(Reader reader, Reader paletteReader, Pointer off_texture, Poi } } } - if (off_current != null) Pointer.Goto(ref reader, off_current); + if (off_current != null) LegacyPointer.Goto(ref reader, off_current); } else if (format == Format.RGBA) { - Pointer off_current = null; - if (off_texture != null) off_current = Pointer.Goto(ref reader, off_texture); + LegacyPointer off_current = null; + if (off_texture != null) off_current = LegacyPointer.Goto(ref reader, off_texture); for (int x = 0; x < width; x++) { for (int y = 0; y < height; y++) { int index = (x * height) + y; @@ -137,7 +138,7 @@ private void Parse(Reader reader, Reader paletteReader, Pointer off_texture, Poi pixels[index] = ParseColorRGBA5551(shortCol); } } - if (off_current != null) Pointer.Goto(ref reader, off_current); + if (off_current != null) LegacyPointer.Goto(ref reader, off_current); } texture.SetPixels(pixels); texture.Apply(); @@ -166,7 +167,7 @@ static uint ReverseBits(uint number, int count) { static Color ParseColorRGBA5551(ushort shortCol) { uint alpha, blue, green, red; - if (Settings.s.platform == Settings.Platform.DS) { + if (Legacy_Settings.s.platform == Legacy_Settings.Platform.DS) { alpha = ExtractBits(shortCol, 1, 15); blue = ExtractBits(shortCol, 5, 10); green = ExtractBits(shortCol, 5, 5); diff --git a/Assets/Scripts/OpenSpace/FileFormat/Texture/LMS.cs b/Assets/Scripts/OpenSpace/FileFormat/Texture/LMS.cs index 1c7e6702..8f562017 100644 --- a/Assets/Scripts/OpenSpace/FileFormat/Texture/LMS.cs +++ b/Assets/Scripts/OpenSpace/FileFormat/Texture/LMS.cs @@ -20,7 +20,7 @@ public uint Count { public Texture2D[] textures = null; public LMS(Stream fs) { - using (Reader reader = new Reader(fs, Settings.s.IsLittleEndian)) { + using (Reader reader = new Reader(fs, Legacy_Settings.s.IsLittleEndian)) { count = reader.ReadUInt32(); int[] sizes = new int[count]; for (int i = 0; i < count; i++) { diff --git a/Assets/Scripts/OpenSpace/FileFormat/Texture/PBT.cs b/Assets/Scripts/OpenSpace/FileFormat/Texture/PBT.cs index 4cff0c40..c4db7ced 100644 --- a/Assets/Scripts/OpenSpace/FileFormat/Texture/PBT.cs +++ b/Assets/Scripts/OpenSpace/FileFormat/Texture/PBT.cs @@ -20,7 +20,7 @@ public uint Count { public Texture2D[] textures = null; public PBT(Stream fs) { - using (Reader reader = new Reader(fs, Settings.s.IsLittleEndian)) { + using (Reader reader = new Reader(fs, Legacy_Settings.s.IsLittleEndian)) { baseOffset = reader.ReadUInt32(); unk = reader.ReadUInt32(); diff --git a/Assets/Scripts/OpenSpace/FileFormat/Texture/PS1VRAM.cs b/Assets/Scripts/OpenSpace/FileFormat/Texture/PS1VRAM.cs index 10852d9e..27679498 100644 --- a/Assets/Scripts/OpenSpace/FileFormat/Texture/PS1VRAM.cs +++ b/Assets/Scripts/OpenSpace/FileFormat/Texture/PS1VRAM.cs @@ -330,7 +330,7 @@ public Texture2D GetTexture(ushort width, ushort height, ushort texturePageInfo, // Get the color from the palette if (!palette[paletteIndex].HasValue) { palette[paletteIndex] = GetColor1555(0, 0, paletteX + paletteIndex, paletteY); - if (Settings.s.game == Settings.Game.DD || Settings.s.game == Settings.Game.JungleBook) { + if (Legacy_Settings.s.game == Legacy_Settings.Game.DD || Legacy_Settings.s.game == Legacy_Settings.Game.JungleBook) { Color c = palette[paletteIndex].Value; if (c.r == 0 && c.g == 0 && c.b == 0 && c.a == 0) { palette[paletteIndex] = new Color(c.r, c.g, c.b, 0f); @@ -363,7 +363,7 @@ public Texture2D GetTexture(ushort width, ushort height, ushort texturePageInfo, if (!palette[paletteIndex].HasValue) { palette[paletteIndex] = GetColor1555(0, 0, paletteX + paletteIndex, paletteY); - if (Settings.s.game == Settings.Game.DD || Settings.s.game == Settings.Game.JungleBook) { + if (Legacy_Settings.s.game == Legacy_Settings.Game.DD || Legacy_Settings.s.game == Legacy_Settings.Game.JungleBook) { Color c = palette[paletteIndex].Value; if (c.r == 0 && c.g == 0 && c.b == 0 && c.a == 0) { palette[paletteIndex] = new Color(c.r, c.g, c.b, 0f); diff --git a/Assets/Scripts/OpenSpace/FileFormat/Texture/TBF.cs b/Assets/Scripts/OpenSpace/FileFormat/Texture/TBF.cs index 4b0afd57..214d5ee8 100644 --- a/Assets/Scripts/OpenSpace/FileFormat/Texture/TBF.cs +++ b/Assets/Scripts/OpenSpace/FileFormat/Texture/TBF.cs @@ -1,4 +1,5 @@ -using DDSImageParser; +using BinarySerializer.Unity; +using DDSImageParser; using LibGC.Texture; using System; using System.Collections.Generic; @@ -19,7 +20,7 @@ public class TBF { public TBF(string path, bool hasNames = false) { this.path = path; Stream tbf = FileSystem.GetFileReadStream(path); - using (Reader reader = new Reader(tbf, Settings.s.IsLittleEndian)) { + using (Reader reader = new Reader(tbf, Legacy_Settings.s.IsLittleEndian)) { if (hasNames) { // for example, TXC file in Rayman M/Arena Count = reader.ReadUInt32(); headers = new TBFHeader[Count]; @@ -66,7 +67,7 @@ private TBFHeader ReadTexture(Reader reader, TBFHeader h = null) { case 0x1: { Color[] palette = ReadPalette(reader, 16, h.HasAlpha); byte[] texData = reader.ReadBytes((int)(h.height * h.width / 2)); - if (Settings.s.game == Settings.Game.R3 && Settings.s.mode != Settings.Mode.Rayman3PS2Demo_2002_05_17) { + if (Legacy_Settings.s.game == Legacy_Settings.Game.R3 && Legacy_Settings.s.mode != Legacy_Settings.Mode.Rayman3PS2Demo_2002_05_17) { ezSwizzle.writeTexPSMCT32(0, (int)h.width / 128, 0, 0, (int)h.width / 2, (int)h.height / 4, texData); Array.Resize(ref texData, (int)(h.height * h.width)); ezSwizzle.readTexPSMT4_mod(0, (int)h.width / 64, 0, 0, (int)h.width, (int)h.height, ref texData); @@ -80,7 +81,7 @@ private TBFHeader ReadTexture(Reader reader, TBFHeader h = null) { case 0x2: { Color[] palette = ReadPalette(reader, 256, h.HasAlpha); byte[] texData = reader.ReadBytes((int)(h.height * h.width)); - if (Settings.s.game == Settings.Game.R3 && Settings.s.mode != Settings.Mode.Rayman3PS2Demo_2002_05_17) { + if (Legacy_Settings.s.game == Legacy_Settings.Game.R3 && Legacy_Settings.s.mode != Legacy_Settings.Mode.Rayman3PS2Demo_2002_05_17) { ezSwizzle.writeTexPSMCT32(0, (int)h.width / 128, 0, 0, (int)h.width / 2, (int)h.height / 2, texData); //texData = new byte[h.height * h.width]; ezSwizzle.readTexPSMT8(0, (int)h.width / 64, 0, 0, (int)h.width, (int)h.height, ref texData); @@ -114,7 +115,7 @@ private Color[] ReadPalette(Reader reader, int length, bool hasAlpha = true) { palette[i] = new Color(r / 255f, g / 255f, b / 255f, hasAlpha ? (a / 128f) : 1f); } Color[] pal = palette; - if (length == 256 && (Settings.s.game == Settings.Game.R3 && Settings.s.mode != Settings.Mode.Rayman3PS2Demo_2002_05_17)) { + if (length == 256 && (Legacy_Settings.s.game == Legacy_Settings.Game.R3 && Legacy_Settings.s.mode != Legacy_Settings.Mode.Rayman3PS2Demo_2002_05_17)) { // Tile pal = new Color[palette.Length]; for (int i = 0; i < length; i++) { diff --git a/Assets/Scripts/OpenSpace/FileFormat/Texture/TEX.cs b/Assets/Scripts/OpenSpace/FileFormat/Texture/TEX.cs index 3655f4b7..cf0f353c 100644 --- a/Assets/Scripts/OpenSpace/FileFormat/Texture/TEX.cs +++ b/Assets/Scripts/OpenSpace/FileFormat/Texture/TEX.cs @@ -1,4 +1,5 @@ -using System; +using BinarySerializer.Unity; +using System; using System.Collections.Generic; using System.IO; using UnityEngine; @@ -17,7 +18,7 @@ public uint Count { public TEX(string path, bool compressed = true) { Stream fs = FileSystem.GetFileReadStream(path); - using (Reader reader = new Reader(fs, Settings.s.IsLittleEndian)) { + using (Reader reader = new Reader(fs, Legacy_Settings.s.IsLittleEndian)) { if (compressed) { reader.ReadUInt32(); // "LZSS" List texturesList = new List(); @@ -42,7 +43,7 @@ public TEX(string path, bool compressed = true) { private byte[] DecompressLZSS(byte[] compressed) { byte[] decompressed = new byte[compressed.Length * 128]; uint decompressedPos = 0; - using (Reader reader = new Reader(new MemoryStream(compressed), Settings.s.IsLittleEndian)) { + using (Reader reader = new Reader(new MemoryStream(compressed), Legacy_Settings.s.IsLittleEndian)) { while (reader.BaseStream.Position < reader.BaseStream.Length) { byte controlByte = reader.ReadByte(); if (controlByte == 0) { diff --git a/Assets/Scripts/OpenSpace/FileFormat/Texture/TPL.cs b/Assets/Scripts/OpenSpace/FileFormat/Texture/TPL.cs index 12374a62..e44b0010 100644 --- a/Assets/Scripts/OpenSpace/FileFormat/Texture/TPL.cs +++ b/Assets/Scripts/OpenSpace/FileFormat/Texture/TPL.cs @@ -1,4 +1,5 @@ -using LibGC.Texture; +using BinarySerializer.Unity; +using LibGC.Texture; using System; using System.IO; using UnityEngine; diff --git a/Assets/Scripts/OpenSpace/General/GameMaterial.cs b/Assets/Scripts/OpenSpace/General/GameMaterial.cs index adfca2f4..f9427940 100644 --- a/Assets/Scripts/OpenSpace/General/GameMaterial.cs +++ b/Assets/Scripts/OpenSpace/General/GameMaterial.cs @@ -12,35 +12,35 @@ namespace OpenSpace { public class GameMaterial { - public Pointer offset; + public LegacyPointer offset; - public Pointer off_visualMaterial; - public Pointer off_mechanicsMaterial; + public LegacyPointer off_visualMaterial; + public LegacyPointer off_mechanicsMaterial; public uint soundMaterial; - public Pointer off_collideMaterial; + public LegacyPointer off_collideMaterial; public VisualMaterial visualMaterial; public CollideMaterial collideMaterial; - public GameMaterial(Pointer offset) { + public GameMaterial(LegacyPointer offset) { this.offset = offset; } - public static GameMaterial Read(Reader reader, Pointer offset) { + public static GameMaterial Read(Reader reader, LegacyPointer offset) { MapLoader l = MapLoader.Loader; GameMaterial gm = new GameMaterial(offset); - if (Settings.s.game == Settings.Game.R2Revolution) { + if (Legacy_Settings.s.game == Legacy_Settings.Game.R2Revolution) { gm.soundMaterial = reader.ReadUInt32(); - gm.collideMaterial = CollideMaterial.Read(reader, Pointer.Current(reader)); + gm.collideMaterial = CollideMaterial.Read(reader, LegacyPointer.Current(reader)); // Maybe the first uint16 of collidematerial in Revolution is actually sound material, but eh } else { - if (Settings.s.engineVersion < Settings.EngineVersion.R3) { - gm.off_visualMaterial = Pointer.Read(reader); - gm.off_mechanicsMaterial = Pointer.Read(reader); + if (Legacy_Settings.s.engineVersion < Legacy_Settings.EngineVersion.R3) { + gm.off_visualMaterial = LegacyPointer.Read(reader); + gm.off_mechanicsMaterial = LegacyPointer.Read(reader); } gm.soundMaterial = reader.ReadUInt32(); - gm.off_collideMaterial = Pointer.Read(reader, allowMinusOne: true); + gm.off_collideMaterial = LegacyPointer.Read(reader, allowMinusOne: true); if (gm.off_visualMaterial != null) { gm.visualMaterial = VisualMaterial.FromOffsetOrRead(gm.off_visualMaterial, reader); @@ -52,11 +52,11 @@ public static GameMaterial Read(Reader reader, Pointer offset) { return gm; } - public static GameMaterial FromOffsetOrRead(Pointer offset, Reader reader) { + public static GameMaterial FromOffsetOrRead(LegacyPointer offset, Reader reader) { if (offset == null) return null; GameMaterial gm = FromOffset(offset); if (gm == null) { - Pointer.DoAt(ref reader, offset, () => { + LegacyPointer.DoAt(ref reader, offset, () => { gm = GameMaterial.Read(reader, offset); MapLoader.Loader.gameMaterials.Add(gm); }); @@ -64,7 +64,7 @@ public static GameMaterial FromOffsetOrRead(Pointer offset, Reader reader) { return gm; } - public static GameMaterial FromOffset(Pointer offset) { + public static GameMaterial FromOffset(LegacyPointer offset) { MapLoader l = MapLoader.Loader; for (int i = 0; i < l.gameMaterials.Count; i++) { if (offset == l.gameMaterials[i].offset) return l.gameMaterials[i]; diff --git a/Assets/Scripts/OpenSpace/General/Globals.cs b/Assets/Scripts/OpenSpace/General/Globals.cs index 36505d07..9ec21348 100644 --- a/Assets/Scripts/OpenSpace/General/Globals.cs +++ b/Assets/Scripts/OpenSpace/General/Globals.cs @@ -7,24 +7,24 @@ namespace OpenSpace { // Only contains data read in the header of the level file public class Globals { - public Pointer off_transitDynamicWorld = null; - public Pointer off_actualWorld = null; - public Pointer off_dynamicWorld = null; - public Pointer off_inactiveDynamicWorld = null; - public Pointer off_fatherSector = null; - public Pointer off_firstSubMapPosition = null; + public LegacyPointer off_transitDynamicWorld = null; + public LegacyPointer off_actualWorld = null; + public LegacyPointer off_dynamicWorld = null; + public LegacyPointer off_inactiveDynamicWorld = null; + public LegacyPointer off_fatherSector = null; + public LegacyPointer off_firstSubMapPosition = null; /* The following 7 values are the "Always" structure. The spawnable perso data is dynamically copied to these superobjects. There can be at most (num_always) objects of this type active in a level, and they get reused by other objects when they despawn. */ public uint num_always; public LinkedList spawnablePersos; - public Pointer off_always_reusableSO; // There are (num_always) empty SuperObjects starting with this one. - public Pointer off_always_reusableUnknown1; // (num_always) * 0x2c blocks - public Pointer off_always_reusableUnknown2; // (num_always) * 0x4 blocks + public LegacyPointer off_always_reusableSO; // There are (num_always) empty SuperObjects starting with this one. + public LegacyPointer off_always_reusableUnknown1; // (num_always) * 0x2c blocks + public LegacyPointer off_always_reusableUnknown2; // (num_always) * 0x4 blocks - public Pointer off_backgroundGameMaterial = null; // Donald Duck only + public LegacyPointer off_backgroundGameMaterial = null; // Donald Duck only public GameMaterial backgroundGameMaterial = null; - public Pointer off_camera = null; // We use this to determine the camera object in Revolution, without names + public LegacyPointer off_camera = null; // We use this to determine the camera object in Revolution, without names } } \ No newline at end of file diff --git a/Assets/Scripts/OpenSpace/General/ILinkedListEntry.cs b/Assets/Scripts/OpenSpace/General/ILinkedListEntry.cs index fa33286c..773f80c3 100644 --- a/Assets/Scripts/OpenSpace/General/ILinkedListEntry.cs +++ b/Assets/Scripts/OpenSpace/General/ILinkedListEntry.cs @@ -5,7 +5,7 @@ namespace OpenSpace { interface ILinkedListEntry { - Pointer NextEntry { get; } - Pointer PreviousEntry { get; } + LegacyPointer NextEntry { get; } + LegacyPointer PreviousEntry { get; } } } diff --git a/Assets/Scripts/OpenSpace/General/Pointer.cs b/Assets/Scripts/OpenSpace/General/LegacyPointer.cs similarity index 74% rename from Assets/Scripts/OpenSpace/General/Pointer.cs rename to Assets/Scripts/OpenSpace/General/LegacyPointer.cs index 98db3cd7..8df71fb8 100644 --- a/Assets/Scripts/OpenSpace/General/Pointer.cs +++ b/Assets/Scripts/OpenSpace/General/LegacyPointer.cs @@ -9,10 +9,10 @@ namespace OpenSpace { [JsonConverter(typeof(PointerJsonConverter))] - public class Pointer : IEquatable { + public class LegacyPointer : IEquatable { public uint offset; public FileWithPointers file; - public Pointer(uint offset, FileWithPointers file) { + public LegacyPointer(uint offset, FileWithPointers file) { this.offset = offset; this.file = file; } @@ -32,30 +32,30 @@ public uint AbsoluteOffset { } public override bool Equals(System.Object obj) { - return obj is Pointer && this == (Pointer)obj; + return obj is LegacyPointer && this == (LegacyPointer)obj; } public override int GetHashCode() { return offset.GetHashCode() ^ file.GetHashCode(); } - public bool Equals(Pointer other) { - return this == (Pointer)other; + public bool Equals(LegacyPointer other) { + return this == (LegacyPointer)other; } - public static bool operator ==(Pointer x, Pointer y) { + public static bool operator ==(LegacyPointer x, LegacyPointer y) { if (ReferenceEquals(x, y)) return true; if (ReferenceEquals(x, null)) return false; if (ReferenceEquals(y, null)) return false; return x.offset == y.offset && x.file == y.file; } - public static bool operator !=(Pointer x, Pointer y) { + public static bool operator !=(LegacyPointer x, LegacyPointer y) { return !(x == y); } - public static Pointer operator +(Pointer x, long y) { - return new Pointer((uint)((long)x.offset + y), x.file); + public static LegacyPointer operator +(LegacyPointer x, long y) { + return new LegacyPointer((uint)((long)x.offset + y), x.file); } - public static Pointer operator -(Pointer x, long y) { - return new Pointer((uint)((long)x.offset - y), x.file); + public static LegacyPointer operator -(LegacyPointer x, long y) { + return new LegacyPointer((uint)((long)x.offset - y), x.file); } public override string ToString() { if (file != null && file.baseOffset != 0) { @@ -77,16 +77,16 @@ public string StringAbsoluteOffset { } } - public static Pointer GetPointerAtOffset(Pointer pointer) { + public static LegacyPointer GetPointerAtOffset(LegacyPointer pointer) { MapLoader l = MapLoader.Loader; - Pointer ptr = null; + LegacyPointer ptr = null; if (pointer.file.pointers.ContainsKey(pointer.offset)) { ptr = pointer.file.pointers[pointer.offset]; if (ptr.offset == 0) return null; return ptr; } else if (pointer.file.allowUnsafePointers) { Reader reader = pointer.file.reader; - Pointer.DoAt(ref reader, pointer, () => { + LegacyPointer.DoAt(ref reader, pointer, () => { uint current_off = (uint)(reader.BaseStream.Position); uint value = reader.ReadUInt32(); FileWithPointers file = pointer.file; @@ -107,10 +107,10 @@ public static Pointer GetPointerAtOffset(Pointer pointer) { return null; } - public static Pointer Read(Reader reader, bool allowMinusOne = false) { + public static LegacyPointer Read(Reader reader, bool allowMinusOne = false) { MapLoader l = MapLoader.Loader; uint current_off = (uint)(reader.BaseStream.Position); - Pointer readFrom = Pointer.Current(reader); + LegacyPointer readFrom = LegacyPointer.Current(reader); uint value = reader.ReadUInt32(); FileWithPointers file = l.GetFileByReader(reader); if (file == null) throw new PointerException("Reader wasn't recognized.", "Pointer.Read"); @@ -118,12 +118,12 @@ public static Pointer Read(Reader reader, bool allowMinusOne = false) { if (!file.pointers.ContainsKey(fileOff)) { if (value == 0 || (allowMinusOne && value == 0xFFFFFFFF)) return null; if (!l.allowDeadPointers && !file.allowUnsafePointers) { - throw new PointerException("Not a valid pointer at " + (Pointer.Current(reader) - 4) + ": " + value, "Pointer.Read"); + throw new PointerException("Not a valid pointer at " + (LegacyPointer.Current(reader) - 4) + ": " + value, "Pointer.Read"); } if (file.allowUnsafePointers) { - Pointer ptr = file.GetUnsafePointer(value); + LegacyPointer ptr = file.GetUnsafePointer(value); if (ptr == null) { - throw new PointerException("Not a valid pointer at " + (Pointer.Current(reader) - 4) + ": " + value, "Pointer.Read"); + throw new PointerException("Not a valid pointer at " + (LegacyPointer.Current(reader) - 4) + ": " + value, "Pointer.Read"); } return LogPointer(ptr, readFrom, l); } @@ -134,7 +134,7 @@ public static Pointer Read(Reader reader, bool allowMinusOne = false) { return LogPointer(file.pointers[fileOff], readFrom, l); } - public static Pointer LogPointer(Pointer pointer, Pointer readFrom, MapLoader loader) + public static LegacyPointer LogPointer(LegacyPointer pointer, LegacyPointer readFrom, MapLoader loader) { if (UnitySettings.TracePointers && pointer!=null) { @@ -155,7 +155,7 @@ public static Pointer LogPointer(Pointer pointer, Pointer readFrom, MapLoader lo return pointer; } - public static void Write(Writer writer, Pointer pointer) { + public static void Write(Writer writer, LegacyPointer pointer) { MapLoader l = MapLoader.Loader; uint current_off = (uint)(writer.BaseStream.Position); FileWithPointers file = l.GetFileByWriter(writer); @@ -164,67 +164,67 @@ public static void Write(Writer writer, Pointer pointer) { } public void Write(Writer writer) { - Pointer.Write(writer, this); + LegacyPointer.Write(writer, this); } // For readers - public Pointer Goto(ref Reader reader) { - Pointer oldPos = Current(reader); + public LegacyPointer Goto(ref Reader reader) { + LegacyPointer oldPos = Current(reader); reader = file.reader; reader.BaseStream.Seek(offset + file.baseOffset, SeekOrigin.Begin); return oldPos; } - public static Pointer Goto(ref Reader reader, Pointer newPos) { + public static LegacyPointer Goto(ref Reader reader, LegacyPointer newPos) { if (newPos != null) return newPos.Goto(ref reader); return null; } - public static Pointer Current(Reader reader) { + public static LegacyPointer Current(Reader reader) { MapLoader l = MapLoader.Loader; uint curPos = (uint)reader.BaseStream.Position; FileWithPointers curFile = l.GetFileByReader(reader); - return new Pointer((uint)(curPos - curFile.baseOffset), curFile); + return new LegacyPointer((uint)(curPos - curFile.baseOffset), curFile); } public void DoAt(ref Reader reader, Action action) { - Pointer off_current = Goto(ref reader, this); + LegacyPointer off_current = Goto(ref reader, this); action(); Goto(ref reader, off_current); } - public static void DoAt(ref Reader reader, Pointer newPos, Action action) { + public static void DoAt(ref Reader reader, LegacyPointer newPos, Action action) { if (newPos != null) newPos.DoAt(ref reader, action); } // For writers - public Pointer Goto(ref Writer writer) { - Pointer oldPos = Current(writer); + public LegacyPointer Goto(ref Writer writer) { + LegacyPointer oldPos = Current(writer); writer = file.writer; writer.BaseStream.Seek(offset + file.baseOffset, SeekOrigin.Begin); return oldPos; } - public static Pointer Goto(ref Writer writer, Pointer newPos) { + public static LegacyPointer Goto(ref Writer writer, LegacyPointer newPos) { if (newPos != null) return newPos.Goto(ref writer); return null; } - public static Pointer Current(Writer writer) { + public static LegacyPointer Current(Writer writer) { MapLoader l = MapLoader.Loader; uint curPos = (uint)writer.BaseStream.Position; FileWithPointers curFile = l.GetFileByWriter(writer); - return new Pointer((uint)(curPos - curFile.baseOffset), curFile); + return new LegacyPointer((uint)(curPos - curFile.baseOffset), curFile); } public void DoAt(ref Writer writer, Action action) { - Pointer off_current = Goto(ref writer, this); + LegacyPointer off_current = Goto(ref writer, this); action(); Goto(ref writer, off_current); } - public static void DoAt(ref Writer writer, Pointer newPos, Action action) + public static void DoAt(ref Writer writer, LegacyPointer newPos, Action action) { if (newPos != null) newPos.DoAt(ref writer, action); } @@ -236,7 +236,7 @@ public struct PointerTrace public int column; public int lineNumber; public string code; - public Pointer readFrom; + public LegacyPointer readFrom; public override string ToString() { @@ -246,24 +246,24 @@ public override string ToString() } public class Pointer where T : OpenSpaceStruct, new() { - public Pointer pointer; + public LegacyPointer pointer; public T Value { get; set; } public Pointer(Reader reader, bool resolve = false, Action onPreRead = null) { - pointer = Pointer.Read(reader); + pointer = LegacyPointer.Read(reader); if (resolve) { Resolve(reader, onPreRead: onPreRead); } } - public Pointer(Pointer pointer, Reader reader = null, bool resolve = false, Action onPreRead = null) { + public Pointer(LegacyPointer pointer, Reader reader = null, bool resolve = false, Action onPreRead = null) { this.pointer = pointer; if (resolve) { Resolve(reader, onPreRead: onPreRead); } } - public Pointer(Pointer pointer, T value) { + public Pointer(LegacyPointer pointer, T value) { this.pointer = pointer; this.Value = value; } diff --git a/Assets/Scripts/OpenSpace/General/Pointer.cs.meta b/Assets/Scripts/OpenSpace/General/LegacyPointer.cs.meta similarity index 100% rename from Assets/Scripts/OpenSpace/General/Pointer.cs.meta rename to Assets/Scripts/OpenSpace/General/LegacyPointer.cs.meta diff --git a/Assets/Scripts/OpenSpace/General/Settings.cs b/Assets/Scripts/OpenSpace/General/Legacy_Settings.cs similarity index 79% rename from Assets/Scripts/OpenSpace/General/Settings.cs rename to Assets/Scripts/OpenSpace/General/Legacy_Settings.cs index a28790e0..6eede996 100644 --- a/Assets/Scripts/OpenSpace/General/Settings.cs +++ b/Assets/Scripts/OpenSpace/General/Legacy_Settings.cs @@ -9,9 +9,9 @@ using LinkedListType = OpenSpace.LinkedList.Type; namespace OpenSpace { - public class Settings { + public class Legacy_Settings { - public Settings(Settings s = null) + public Legacy_Settings(Legacy_Settings s = null) { if (s != null) { this.mode = s.mode; @@ -42,120 +42,66 @@ public Settings(Settings s = null) } } - public static Dictionary cmdModeNameDict = new Dictionary() { - { "r3_gc", Mode.Rayman3GC }, - { "r3_pc", Mode.Rayman3PC }, - { "r3_pc_demo_20021001", Mode.Rayman3PCDemo_2002_10_01 }, - { "r3_pc_demo_20021021", Mode.Rayman3PCDemo_2002_10_21 }, - { "r3_pc_demo_20021209", Mode.Rayman3PCDemo_2002_12_09 }, - { "r3_pc_demo_20030106", Mode.Rayman3PCDemo_2003_01_06 }, - { "r3_macos", Mode.Rayman3MacOS }, - { "r3_ps2", Mode.Rayman3PS2 }, - { "r3_ps2_demo_20020517", Mode.Rayman3PS2Demo_2002_05_17 }, - { "r3_ps2_demo_20020807", Mode.Rayman3PS2Demo_2002_08_07 }, - { "r3_ps2_devbuild_20020906", Mode.Rayman3PS2DevBuild_2002_09_06 }, - { "r3_ps2_demo_20021029", Mode.Rayman3PS2Demo_2002_10_29 }, - { "r3_ps2_demo_20021218", Mode.Rayman3PS2Demo_2002_12_18 }, - { "r3_xbox", Mode.Rayman3Xbox }, - { "r3_x360", Mode.Rayman3Xbox360 }, - { "r3_ps3", Mode.Rayman3PS3 }, - { "ra_gc", Mode.RaymanArenaGC }, - { "ra_gc_demo_20020307", Mode.RaymanArenaGCDemo_2002_03_07 }, - { "ra_xbox", Mode.RaymanArenaXbox }, - { "ra_ps2", Mode.RaymanArenaPS2 }, - { "ra_pc", Mode.RaymanArenaPC }, - { "rm_ps2", Mode.RaymanMPS2 }, - { "rm_ps2_demo_20010725", Mode.RaymanMPS2Demo_2001_07_25 }, - { "rm_pc", Mode.RaymanMPC }, - { "rr_ps1", Mode.RaymanRushPS1 }, - { "r2_pc", Mode.Rayman2PC }, - { "r2_pc_demo_19990818", Mode.Rayman2PCDemo_1999_08_18 }, - { "r2_pc_demo_19990904", Mode.Rayman2PCDemo_1999_09_04 }, - { "r2_dc", Mode.Rayman2DC }, - { "r2_ios", Mode.Rayman2IOS }, - { "r2_ios_demo", Mode.Rayman2IOSDemo }, - { "r2_ps1", Mode.Rayman2PS1 }, - { "r2_ps2", Mode.Rayman2PS2 }, - { "r2_ds", Mode.Rayman2DS }, - { "rrr_ds", Mode.RaymanRavingRabbidsDS }, - { "rrr_ds_devbuild_20060525", Mode.RaymanRavingRabbidsDSDevBuild_2006_05_25 }, - { "r2_3ds", Mode.Rayman23DS }, - { "r2_n64", Mode.Rayman2N64 }, - { "dd_pc", Mode.DonaldDuckPC }, - { "dd_dc", Mode.DonaldDuckDC }, - { "dd_n64", Mode.DonaldDuckN64 }, - { "dd_ps1", Mode.DonaldDuckPS1 }, - { "ddpk_gc", Mode.DonaldDuckPKGC }, - { "tt_pc", Mode.TonicTroublePC }, - { "ttse_pc", Mode.TonicTroubleSEPC }, - { "playmobil_hype_pc", Mode.PlaymobilHypePC }, - { "playmobil_alex_pc", Mode.PlaymobilAlexPC }, - { "playmobil_laura_pc", Mode.PlaymobilLauraPC }, - { "dinosaur_pc", Mode.DinosaurPC }, - { "largowinch_pc", Mode.LargoWinchPC }, - { "jb_ps1", Mode.JungleBookPS1 }, - { "vip_ps1", Mode.VIPPS1 }, - { "redplanet_pc", Mode.RedPlanetPC }, - }; - #region Enums public enum Mode { - [Description("Rayman 2 (PC)")] Rayman2PC, - [Description("R2 (PC) Demo (1999/08/19)")] Rayman2PCDemo_1999_08_18, - [Description("R2 (PC) Demo (1999/09/11)")] Rayman2PCDemo_1999_09_04, - [Description("Rayman 2 (DC)")] Rayman2DC, - [Description("Rayman 2 (iOS)")] Rayman2IOS, - [Description("Rayman 2 (iOS) Demo")] Rayman2IOSDemo, - [Description("Rayman 2 (PS1)")] Rayman2PS1, - [Description("Rayman 2 (PS2)")] Rayman2PS2, - [Description("Rayman 2 (N64)")] Rayman2N64, - [Description("Rayman 2 (DS)")] Rayman2DS, - [Description("Rayman 2 (3DS)")] Rayman23DS, - [Description("Rayman M (PC)")] RaymanMPC, - [Description("Rayman M (PS2)")] RaymanMPS2, - [Description("RM (PS2) Demo (2001/07/25)")] RaymanMPS2Demo_2001_07_25, - [Description("Rayman Arena (PC)")] RaymanArenaPC, - [Description("Rayman Arena (PS2)")] RaymanArenaPS2, - [Description("Rayman Arena (GC)")] RaymanArenaGC, - [Description("RA (GC) Demo (2002/03/07)")] RaymanArenaGCDemo_2002_03_07, - [Description("Rayman Arena (Xbox)")] RaymanArenaXbox, - [Description("Rayman Rush (PS1)")] RaymanRushPS1, - [Description("Rayman 3 (PC)")] Rayman3PC, - [Description("R3 (PC) Demo (2002/10/01)")] Rayman3PCDemo_2002_10_01, - [Description("R3 (PC) Demo (2002/10/21)")] Rayman3PCDemo_2002_10_21, - [Description("R3 (PC) Demo (2002/12/09)")] Rayman3PCDemo_2002_12_09, - [Description("R3 (PC) Demo (2003/01/06)")] Rayman3PCDemo_2003_01_06, - [Description("Rayman 3 (MacOS)")] Rayman3MacOS, - [Description("Rayman 3 (GC)")] Rayman3GC, - [Description("Rayman 3 (PS2)")] Rayman3PS2, - [Description("R3 (PS2) Demo (2002/05/17)")] Rayman3PS2Demo_2002_05_17, - [Description("R3 (PS2) Demo (2002/08/07)")] Rayman3PS2Demo_2002_08_07, - [Description("R3 (PS2) Dev Build (2002/09/06)")] Rayman3PS2DevBuild_2002_09_06, - [Description("R3 (PS2) Demo (2002/10/29)")] Rayman3PS2Demo_2002_10_29, - [Description("R3 (PS2) Demo (2002/12/18)")] Rayman3PS2Demo_2002_12_18, - [Description("Rayman 3 (Xbox)")] Rayman3Xbox, - [Description("Rayman 3 (Xbox 360)")] Rayman3Xbox360, - [Description("Rayman 3 (PS3)")] Rayman3PS3, - [Description("Rayman Raving Rabbids (DS)")] RaymanRavingRabbidsDS, - [Description("Rayman Raving Rabbids (DS) Dev Build (2006/05/25)")] RaymanRavingRabbidsDSDevBuild_2006_05_25, - [Description("Tonic Trouble (PC)")] TonicTroublePC, - [Description("Tonic Trouble: SE (PC)")] TonicTroubleSEPC, - [Description("Tonic Trouble (N64 NTSC)")] TonicTroubleN64, - [Description("Donald Duck: Quack Attack (PC)")] DonaldDuckPC, - [Description("Donald Duck: Quack Attack (PC) Demo")] DonaldDuckPCDemo, - [Description("Donald Duck: Quack Attack (DC)")] DonaldDuckDC, - [Description("Donald Duck: Quack Attack (N64)")] DonaldDuckN64, - [Description("Donald Duck: Quack Attack (PS1)")] DonaldDuckPS1, - [Description("Donald Duck: PK (GC)")] DonaldDuckPKGC, - [Description("Playmobil: Hype (PC)")] PlaymobilHypePC, - [Description("Playmobil: Laura (PC)")] PlaymobilLauraPC, - [Description("Playmobil: Alex (PC)")] PlaymobilAlexPC, - [Description("Disney's Dinosaur (PC)")] DinosaurPC, - [Description("Largo Winch (PC)")] LargoWinchPC, - [Description("Jungle Book: Groove Party (PS1)")] JungleBookPS1, - [Description("VIP (PS1)")] VIPPS1, - [Description("Red Planet (PC)")] RedPlanetPC, - }; + Rayman2PC, + Rayman2PCDemo_1999_08_18, + Rayman2PCDemo_1999_09_04, + Rayman2DC, + Rayman2IOS, + Rayman2IOSDemo, + Rayman2PS1, + Rayman2PS1Demo, + Rayman2PS1Demo_SLUS_90095, + Rayman2PS2, + Rayman2N64, + Rayman2DS, + Rayman23DS, + RaymanMPC, + RaymanMPS2, + RaymanMPS2Demo_2001_07_25, + RaymanArenaPC, + RaymanArenaPS2, + RaymanArenaGC, + RaymanArenaGCDemo_2002_03_07, + RaymanArenaXbox, + RaymanRushPS1, + Rayman3PC, + Rayman3PCDemo_2002_10_01, + Rayman3PCDemo_2002_10_21, + Rayman3PCDemo_2002_12_09, + Rayman3PCDemo_2003_01_06, + Rayman3MacOS, + Rayman3GC, + Rayman3PS2, + Rayman3PS2Demo_2002_05_17, + Rayman3PS2Demo_2002_08_07, + Rayman3PS2DevBuild_2002_09_06, + Rayman3PS2Demo_2002_10_29, + Rayman3PS2Demo_2002_12_18, + Rayman3Xbox, + Rayman3Xbox360, + Rayman3PS3, + RaymanRavingRabbidsDS, + RaymanRavingRabbidsDSDevBuild_2006_05_25, + TonicTroublePC, + TonicTroubleSEPC, + TonicTroubleN64, + DonaldDuckPC, + DonaldDuckPCDemo, + DonaldDuckDC, + DonaldDuckN64, + DonaldDuckPS1, + DonaldDuckPKGC, + PlaymobilHypePC, + PlaymobilLauraPC, + PlaymobilAlexPC, + DinosaurPC, + LargoWinchPC, + JungleBookPS1, + VIPPS1, + RedPlanetPC, + }; public enum EngineVersion { TT = 0, Montreal = 1, @@ -207,12 +153,12 @@ public bool IsLittleEndian { #endregion - public static void Init(Mode mode) { - s = GetSettings(mode); + public static void Init(Legacy_Settings newSettings) { + s = newSettings; } - public static Settings GetSettings(Mode mode) { - Settings s = null; + public static Legacy_Settings GetSettings(Mode mode) { + Legacy_Settings s = null; if (settingsDict.ContainsKey(mode)) { s = settingsDict[mode]; } @@ -220,33 +166,12 @@ public static Settings GetSettings(Mode mode) { return s; } - public string CmdModeName { - get { - if(!cmdModeNameDict.Any(c => c.Value == mode)) return null; - return cmdModeNameDict.FirstOrDefault(c => c.Value == mode).Key; - } - } - - public string DisplayName { - get { - Type genericEnumType = mode.GetType(); - MemberInfo[] memberInfo = genericEnumType.GetMember(mode.ToString()); - if ((memberInfo != null && memberInfo.Length > 0)) { - var _Attribs = memberInfo[0].GetCustomAttributes(typeof(System.ComponentModel.DescriptionAttribute), false); - if ((_Attribs != null && _Attribs.Count() > 0)) { - return ((System.ComponentModel.DescriptionAttribute)_Attribs.ElementAt(0)).Description; - } - } - return mode.ToString(); - } - } - - public static Settings s = null; + public static Legacy_Settings s = null; #region Settings - public static Settings R3PC => new Settings() { + public static Legacy_Settings R3PC => new Legacy_Settings() { engineVersion = EngineVersion.R3, game = Game.R3, platform = Platform.PC, @@ -297,7 +222,7 @@ public string DisplayName { }, }; - public static Settings R3PCDemo20021001 => new Settings() { + public static Legacy_Settings R3PCDemo20021001 => new Legacy_Settings() { engineVersion = EngineVersion.R3, game = Game.R3, platform = Platform.PC, @@ -316,7 +241,7 @@ public string DisplayName { { CapsType.TextureFile, Caps.Normal }, }, }; - public static Settings R3PCDemo20021021 => new Settings() { + public static Legacy_Settings R3PCDemo20021021 => new Legacy_Settings() { engineVersion = EngineVersion.R3, game = Game.R3, platform = Platform.PC, @@ -335,7 +260,7 @@ public string DisplayName { { CapsType.TextureFile, Caps.Normal }, }, }; - public static Settings R3PCDemo20021209 => new Settings() { + public static Legacy_Settings R3PCDemo20021209 => new Legacy_Settings() { engineVersion = EngineVersion.R3, game = Game.R3, platform = Platform.PC, @@ -354,7 +279,7 @@ public string DisplayName { { CapsType.TextureFile, Caps.Normal }, }, }; - public static Settings R3PCDemo20030106 => new Settings() { + public static Legacy_Settings R3PCDemo20030106 => new Legacy_Settings() { engineVersion = EngineVersion.R3, game = Game.R3, platform = Platform.PC, @@ -373,7 +298,7 @@ public string DisplayName { { CapsType.TextureFile, Caps.Normal }, }, }; - public static Settings R3MacOS => new Settings() { + public static Legacy_Settings R3MacOS => new Legacy_Settings() { engineVersion = EngineVersion.R3, game = Game.R3, platform = Platform.MacOS, @@ -393,7 +318,7 @@ public string DisplayName { }, }; - public static Settings R3GC => new Settings() { + public static Legacy_Settings R3GC => new Legacy_Settings() { engineVersion = EngineVersion.R3, game = Game.R3, platform = Platform.GC, @@ -414,7 +339,7 @@ public string DisplayName { { CapsType.TextureFile, Caps.Normal }, }, }; - public static Settings R3PS2 => new Settings() { + public static Legacy_Settings R3PS2 => new Legacy_Settings() { engineVersion = EngineVersion.R3, game = Game.R3, platform = Platform.PS2, @@ -431,7 +356,7 @@ public string DisplayName { { CapsType.All, Caps.All } }, }; - public static Settings R3PS2Demo_20020517 => new Settings() { + public static Legacy_Settings R3PS2Demo_20020517 => new Legacy_Settings() { engineVersion = EngineVersion.R3, game = Game.R3, platform = Platform.PS2, @@ -449,7 +374,7 @@ public string DisplayName { }, hasNames = true }; - public static Settings R3PS2Demo_20020807 => new Settings() { + public static Legacy_Settings R3PS2Demo_20020807 => new Legacy_Settings() { engineVersion = EngineVersion.R3, game = Game.R3, platform = Platform.PS2, @@ -466,7 +391,7 @@ public string DisplayName { { CapsType.All, Caps.All } }, }; - public static Settings R3PS2DevBuild => new Settings() { + public static Legacy_Settings R3PS2DevBuild => new Legacy_Settings() { engineVersion = EngineVersion.R3, game = Game.R3, platform = Platform.PS2, @@ -483,7 +408,7 @@ public string DisplayName { { CapsType.All, Caps.All } }, }; - public static Settings R3PS2Demo_20021029 => new Settings() { + public static Legacy_Settings R3PS2Demo_20021029 => new Legacy_Settings() { engineVersion = EngineVersion.R3, game = Game.R3, platform = Platform.PS2, @@ -500,7 +425,7 @@ public string DisplayName { { CapsType.All, Caps.All } }, }; - public static Settings R3PS2Demo_20021218 => new Settings() { + public static Legacy_Settings R3PS2Demo_20021218 => new Legacy_Settings() { engineVersion = EngineVersion.R3, game = Game.R3, platform = Platform.PS2, @@ -518,7 +443,7 @@ public string DisplayName { { CapsType.All, Caps.All } }, }; - public static Settings R3Xbox => new Settings() { + public static Legacy_Settings R3Xbox => new Legacy_Settings() { engineVersion = EngineVersion.R3, game = Game.R3, platform = Platform.Xbox, @@ -537,7 +462,7 @@ public string DisplayName { { CapsType.TextureFile, Caps.Normal }, }, }; - public static Settings R3Xbox360 => new Settings() { + public static Legacy_Settings R3Xbox360 => new Legacy_Settings() { engineVersion = EngineVersion.R3, game = Game.R3, platform = Platform.Xbox360, @@ -555,7 +480,7 @@ public string DisplayName { }, hasNames = true, }; - public static Settings R3PS3 => new Settings() { + public static Legacy_Settings R3PS3 => new Legacy_Settings() { engineVersion = EngineVersion.R3, game = Game.R3, platform = Platform.PS3, @@ -574,7 +499,7 @@ public string DisplayName { hasNames = true, }; - public static Settings RMPC => new Settings() { + public static Legacy_Settings RMPC => new Legacy_Settings() { engineVersion = EngineVersion.R3, game = Game.RM, platform = Platform.PC, @@ -592,7 +517,7 @@ public string DisplayName { { CapsType.TextureFile, Caps.Normal }, }, }; - public static Settings RMPS2 => new Settings() { + public static Legacy_Settings RMPS2 => new Legacy_Settings() { engineVersion = EngineVersion.R3, game = Game.RM, platform = Platform.PS2, @@ -609,7 +534,7 @@ public string DisplayName { { CapsType.All, Caps.All } }, }; - public static Settings RMPS2Demo => new Settings() { + public static Legacy_Settings RMPS2Demo => new Legacy_Settings() { engineVersion = EngineVersion.R3, game = Game.RM, platform = Platform.PS2, @@ -626,7 +551,7 @@ public string DisplayName { { CapsType.All, Caps.All } }, }; - public static Settings RAPC => new Settings() { + public static Legacy_Settings RAPC => new Legacy_Settings() { engineVersion = EngineVersion.R3, game = Game.RA, platform = Platform.PC, @@ -676,7 +601,7 @@ public string DisplayName { { CapsType.TextureFile, Caps.Normal }, }, }; - public static Settings RAPS2 => new Settings() { + public static Legacy_Settings RAPS2 => new Legacy_Settings() { engineVersion = EngineVersion.R3, game = Game.RA, platform = Platform.PS2, @@ -693,7 +618,7 @@ public string DisplayName { { CapsType.All, Caps.All } }, }; - public static Settings RAGC => new Settings() { + public static Legacy_Settings RAGC => new Legacy_Settings() { engineVersion = EngineVersion.R3, game = Game.RA, platform = Platform.GC, @@ -711,7 +636,7 @@ public string DisplayName { { CapsType.TextureFile, Caps.Normal }, }, }; - public static Settings RAGCDemo => new Settings() { + public static Legacy_Settings RAGCDemo => new Legacy_Settings() { engineVersion = EngineVersion.R3, game = Game.RA, platform = Platform.GC, @@ -729,7 +654,7 @@ public string DisplayName { { CapsType.TextureFile, Caps.Normal }, }, }; - public static Settings RAXbox => new Settings() { + public static Legacy_Settings RAXbox => new Legacy_Settings() { engineVersion = EngineVersion.R3, game = Game.RA, platform = Platform.Xbox, @@ -748,7 +673,7 @@ public string DisplayName { }, }; - public static Settings R2PC => new Settings() { + public static Legacy_Settings R2PC => new Legacy_Settings() { engineVersion = EngineVersion.R2, game = Game.R2, platform = Platform.PC, @@ -791,7 +716,7 @@ public string DisplayName { { "localizationStructure", 0x00500260 } } }; - public static Settings R2PCDemo1 => new Settings() { + public static Legacy_Settings R2PCDemo1 => new Legacy_Settings() { engineVersion = EngineVersion.R2, game = Game.R2Demo, platform = Platform.PC, @@ -807,7 +732,7 @@ public string DisplayName { { CapsType.LevelRelocation, Caps.AllExceptExtension }, } }; - public static Settings R2PCDemo2 => new Settings() { + public static Legacy_Settings R2PCDemo2 => new Legacy_Settings() { engineVersion = EngineVersion.R2, game = Game.R2Demo, platform = Platform.PC, @@ -823,7 +748,7 @@ public string DisplayName { { CapsType.LevelRelocation, Caps.AllExceptExtension }, } }; - public static Settings R2DC => new Settings() { + public static Legacy_Settings R2DC => new Legacy_Settings() { engineVersion = EngineVersion.R2, game = Game.R2, platform = Platform.DC, @@ -840,7 +765,7 @@ public string DisplayName { { CapsType.All, Caps.All } } }; - public static Settings R2PS2 => new Settings() { + public static Legacy_Settings R2PS2 => new Legacy_Settings() { engineVersion = EngineVersion.R2, game = Game.R2Revolution, platform = Platform.PS2, @@ -858,7 +783,7 @@ public string DisplayName { { CapsType.All, Caps.None } } }; - public static Settings R2IOS => new Settings() { + public static Legacy_Settings R2IOS => new Legacy_Settings() { engineVersion = EngineVersion.R2, game = Game.R2, platform = Platform.iOS, @@ -875,7 +800,7 @@ public string DisplayName { { CapsType.All, Caps.All } } }; - public static Settings R2PS1 => new Settings() { + public static Legacy_Settings R2PS1 => new Legacy_Settings() { engineVersion = EngineVersion.R2, game = Game.R2, platform = Platform.PS1, @@ -888,7 +813,7 @@ public string DisplayName { numEntryActions = 1, }; - public static Settings RRushPS1 => new Settings() { + public static Legacy_Settings RRushPS1 => new Legacy_Settings() { engineVersion = EngineVersion.R2, game = Game.RRush, platform = Platform.PS1, @@ -901,7 +826,7 @@ public string DisplayName { numEntryActions = 1 }; - public static Settings R2DS => new Settings() { + public static Legacy_Settings R2DS => new Legacy_Settings() { engineVersion = EngineVersion.R2, game = Game.R2, platform = Platform.DS, @@ -914,7 +839,7 @@ public string DisplayName { numEntryActions = 1, textureAnimationSpeedModifier = -1f, }; - public static Settings RRRDS_20060525 => new Settings() { + public static Legacy_Settings RRRDS_20060525 => new Legacy_Settings() { engineVersion = EngineVersion.R2, game = Game.RRR, platform = Platform.DS, @@ -927,7 +852,7 @@ public string DisplayName { numEntryActions = 1, textureAnimationSpeedModifier = -1f, }; - public static Settings RRRDS => new Settings() { + public static Legacy_Settings RRRDS => new Legacy_Settings() { engineVersion = EngineVersion.R2, game = Game.RRR, platform = Platform.DS, @@ -940,7 +865,7 @@ public string DisplayName { numEntryActions = 1, textureAnimationSpeedModifier = -1f, }; - public static Settings R23DS => new Settings() { + public static Legacy_Settings R23DS => new Legacy_Settings() { engineVersion = EngineVersion.R2, game = Game.R2, platform = Platform._3DS, @@ -953,7 +878,7 @@ public string DisplayName { numEntryActions = 1, textureAnimationSpeedModifier = -1f, }; - public static Settings R2N64 => new Settings() { + public static Legacy_Settings R2N64 => new Legacy_Settings() { engineVersion = EngineVersion.R2, game = Game.R2, platform = Platform.N64, @@ -966,7 +891,7 @@ public string DisplayName { levelTranslation = LevelTranslation.levelTranslation_r2, numEntryActions = 1 }; - public static Settings DDN64 => new Settings() { + public static Legacy_Settings DDN64 => new Legacy_Settings() { engineVersion = EngineVersion.R2, game = Game.DD, platform = Platform.N64, @@ -979,7 +904,7 @@ public string DisplayName { numEntryActions = 1 }; - public static Settings TTN64 = new Settings() + public static Legacy_Settings TTN64 = new Legacy_Settings() { engineVersion = EngineVersion.TT, game = Game.TT, @@ -993,7 +918,7 @@ public string DisplayName { numEntryActions = 1 }; - public static Settings DDPC => new Settings() { + public static Legacy_Settings DDPC => new Legacy_Settings() { engineVersion = EngineVersion.R2, game = Game.DD, platform = Platform.PC, @@ -1038,12 +963,12 @@ public string DisplayName { } }; - public static Settings DDPCDemo = new Settings(Settings.DDPC) + public static Legacy_Settings DDPCDemo = new Legacy_Settings(Legacy_Settings.DDPC) { numEntryActions = 43 }; - public static Settings DDDC => new Settings() { + public static Legacy_Settings DDDC => new Legacy_Settings() { engineVersion = EngineVersion.R2, game = Game.DD, platform = Platform.DC, @@ -1059,7 +984,7 @@ public string DisplayName { { CapsType.All, Caps.All } } }; - public static Settings DDPS1 => new Settings() { + public static Legacy_Settings DDPS1 => new Legacy_Settings() { engineVersion = EngineVersion.R2, game = Game.DD, platform = Platform.PS1, @@ -1072,7 +997,7 @@ public string DisplayName { numEntryActions = 1 }; - public static Settings RedPlanetPC => new Settings() { + public static Legacy_Settings RedPlanetPC => new Legacy_Settings() { engineVersion = EngineVersion.R2, game = Game.RedPlanet, platform = Platform.PC, @@ -1092,7 +1017,7 @@ public string DisplayName { } }; - public static Settings TTPC => new Settings() { + public static Legacy_Settings TTPC => new Legacy_Settings() { engineVersion = EngineVersion.TT, game = Game.TT, platform = Platform.PC, @@ -1111,7 +1036,7 @@ public string DisplayName { { CapsType.DSB, Caps.None } } }; - public static Settings TTSEPC => new Settings() { + public static Legacy_Settings TTSEPC => new Legacy_Settings() { engineVersion = EngineVersion.TT, game = Game.TTSE, platform = Platform.PC, @@ -1127,7 +1052,7 @@ public string DisplayName { } }; - public static Settings PlaymobilHypePC => new Settings() { + public static Legacy_Settings PlaymobilHypePC => new Legacy_Settings() { engineVersion = EngineVersion.Montreal, game = Game.PlaymobilHype, platform = Platform.PC, @@ -1143,7 +1068,7 @@ public string DisplayName { { CapsType.FixLvl, Caps.None } } }; - public static Settings PlaymobilAlexPC => new Settings() { + public static Legacy_Settings PlaymobilAlexPC => new Legacy_Settings() { engineVersion = EngineVersion.Montreal, game = Game.PlaymobilAlex, platform = Platform.PC, @@ -1165,7 +1090,7 @@ public string DisplayName { { CapsType.LangLevelFolder, Caps.None } } }; - public static Settings PlaymobilLauraPC => new Settings() { + public static Legacy_Settings PlaymobilLauraPC => new Legacy_Settings() { engineVersion = EngineVersion.Montreal, game = Game.PlaymobilLaura, platform = Platform.PC, @@ -1188,7 +1113,7 @@ public string DisplayName { } }; - public static Settings DDPKGC => new Settings() { + public static Legacy_Settings DDPKGC => new Legacy_Settings() { engineVersion = EngineVersion.R3, game = Game.DDPK, platform = Platform.GC, @@ -1206,7 +1131,7 @@ public string DisplayName { }, }; - public static Settings DinosaurPC => new Settings() { + public static Legacy_Settings DinosaurPC => new Legacy_Settings() { engineVersion = EngineVersion.R3, game = Game.Dinosaur, platform = Platform.PC, @@ -1221,7 +1146,7 @@ public string DisplayName { { CapsType.All, Caps.All } }, }; - public static Settings LargoWinchPC => new Settings() { + public static Legacy_Settings LargoWinchPC => new Legacy_Settings() { engineVersion = EngineVersion.R3, game = Game.LargoWinch, platform = Platform.PC, @@ -1240,7 +1165,7 @@ public string DisplayName { }, hasDeformations = true }; - public static Settings VIPPS1 => new Settings() { + public static Legacy_Settings VIPPS1 => new Legacy_Settings() { engineVersion = EngineVersion.R2, game = Game.VIP, platform = Platform.PS1, @@ -1253,7 +1178,7 @@ public string DisplayName { hasDeformations = true, numEntryActions = 1 }; - public static Settings JungleBookPS1 => new Settings() { + public static Legacy_Settings JungleBookPS1 => new Legacy_Settings() { engineVersion = EngineVersion.R2, game = Game.JungleBook, platform = Platform.PS1, @@ -1270,7 +1195,7 @@ public string DisplayName { #endregion - public static Dictionary settingsDict = new Dictionary() { + public static Dictionary settingsDict = new Dictionary() { { Mode.Rayman2PC, R2PC }, { Mode.Rayman2PCDemo_1999_08_18, R2PCDemo1 }, { Mode.Rayman2PCDemo_1999_09_04, R2PCDemo2 }, @@ -1278,6 +1203,8 @@ public string DisplayName { { Mode.Rayman2IOS, R2IOS }, { Mode.Rayman2IOSDemo, R2IOS }, { Mode.Rayman2PS1, R2PS1 }, + { Mode.Rayman2PS1Demo, R2PS1 }, + { Mode.Rayman2PS1Demo_SLUS_90095, R2PS1 }, { Mode.Rayman2PS2, R2PS2 }, { Mode.Rayman2N64, R2N64 }, { Mode.TonicTroubleN64, TTN64 }, diff --git a/Assets/Scripts/OpenSpace/General/Legacy_Settings.cs.meta b/Assets/Scripts/OpenSpace/General/Legacy_Settings.cs.meta new file mode 100644 index 00000000..53d65d37 --- /dev/null +++ b/Assets/Scripts/OpenSpace/General/Legacy_Settings.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 1364b8516264a4b4d85b01d664bdf03c +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/OpenSpace/General/LevelTranslation.cs b/Assets/Scripts/OpenSpace/General/LevelTranslation.cs index 91a8c939..db23e141 100644 --- a/Assets/Scripts/OpenSpace/General/LevelTranslation.cs +++ b/Assets/Scripts/OpenSpace/General/LevelTranslation.cs @@ -25,46 +25,28 @@ public LevelTranslation(List<(string, string)> items) public List<(string, string)> items; - public List SortAndTranslate(List levels) + public List<(string, string)> SortAndTranslate(List levels) { - List result = new List(levels); - result = result.OrderBy((l) => + List sortedLevels = new List(levels); + sortedLevels = sortedLevels.OrderBy((l) => { return items.IndexOf(items.Find(m => { return m.Item1.ToLower() == l.ToLower(); })); }).ToList(); - List translatedResult = new List(); + List<(string, string)> translatedResult = new List<(string, string)>(); - result.ForEach((l) => + sortedLevels.ForEach((l) => { (string, string)? item = items.Find(m => { return m.Item1.ToLower() == l.ToLower(); }); - if (item != null) { - translatedResult.Add(item.Value.Item2 + " <" + l + ">"); + if (item.HasValue) { + translatedResult.Add((l,item.Value.Item2)); } else { - translatedResult.Add(l); + translatedResult.Add((l, l)); } }); return translatedResult; } - public List Sort(List levels) { - List result = new List(levels); - result = result.OrderBy((l) => { - return items.IndexOf(items.Find(m => { return m.Item1.ToLower() == l.ToLower(); })); - }).ToList(); - - return result; - } - public List Translate(List levels) { - List result = new List(levels); - List translatedResult = new List(); - - result.ForEach((l) => { - translatedResult.Add(Translate(l)); - }); - - return translatedResult; - } public string Translate(string level) { int itemIndex = items.FindIndex(m => { return m.Item1.ToLower() == level.ToLower(); }); if(itemIndex != -1) { diff --git a/Assets/Scripts/OpenSpace/General/LinkedList.cs b/Assets/Scripts/OpenSpace/General/LinkedList.cs index 72c27249..5c60418b 100644 --- a/Assets/Scripts/OpenSpace/General/LinkedList.cs +++ b/Assets/Scripts/OpenSpace/General/LinkedList.cs @@ -20,14 +20,14 @@ public enum Flags { } public class LinkedList : IList { - public delegate T ReadElement(Pointer offset); + public delegate T ReadElement(LegacyPointer offset); - public Pointer offset; + public LegacyPointer offset; public Type type; - public Pointer off_head; - public Pointer off_tail; + public LegacyPointer off_head; + public LegacyPointer off_tail; private uint num_elements; - public Pointer off_header; + public LegacyPointer off_header; private bool customEntries = false; private T[] list = null; @@ -51,19 +51,19 @@ public T this[int index] { set { list[index] = value; } } - public LinkedList(Pointer offset) { + public LinkedList(LegacyPointer offset) { this.offset = offset; if (typeof(ILinkedListEntry).IsAssignableFrom(typeof(T))) customEntries = true; } - public LinkedList(Pointer offset, Pointer off_head, Pointer off_tail, uint num_elements, Type type = Type.Default) : this(offset) { + public LinkedList(LegacyPointer offset, LegacyPointer off_head, LegacyPointer off_tail, uint num_elements, Type type = Type.Default) : this(offset) { this.off_head = off_head; this.off_tail = off_tail; this.num_elements = num_elements; list = new T[num_elements]; if (type == Type.Default) { - type = Settings.s.linkedListType; + type = Legacy_Settings.s.linkedListType; if (type == Type.Minimize) { type = Type.Single; } @@ -73,7 +73,7 @@ public LinkedList(Pointer offset, Pointer off_head, Pointer off_tail, uint num_e If the list itself does not specify the minimize type, it is read as a default one, but if the default type is Minimize then it becomes a Single list (i.e. not an array, but no previous pointers). */ - type = Settings.s.linkedListType; + type = Legacy_Settings.s.linkedListType; if (type == Type.Minimize) { type = Type.SingleNoElementPointers; } @@ -82,15 +82,15 @@ public LinkedList(Pointer offset, Pointer off_head, Pointer off_tail, uint num_e } - public LinkedList(Pointer offset, Pointer off_head, uint num_elements, Type type = Type.Default) : this(offset, off_head, null, num_elements, type) {} + public LinkedList(LegacyPointer offset, LegacyPointer off_head, uint num_elements, Type type = Type.Default) : this(offset, off_head, null, num_elements, type) {} - public static LinkedList ReadHeader(Reader reader, Pointer offset, Type type = Type.Default) { + public static LinkedList ReadHeader(Reader reader, LegacyPointer offset, Type type = Type.Default) { MapLoader l = MapLoader.Loader; LinkedList li = new LinkedList(offset); li.type = type; if (li.type == Type.Default) { - li.type = Settings.s.linkedListType; + li.type = Legacy_Settings.s.linkedListType; if (li.type == Type.Minimize) { li.type = Type.Single; } @@ -100,40 +100,40 @@ public static LinkedList ReadHeader(Reader reader, Pointer offset, Type type If the list itself does not specify the minimize type, it is read as a default one, but if the default type is Minimize then it becomes a Single list (i.e. not an array, but no previous pointers). */ - li.type = Settings.s.linkedListType; + li.type = Legacy_Settings.s.linkedListType; if (li.type == Type.Minimize) { li.type = Type.SingleNoElementPointers; } } - li.off_head = Pointer.Read(reader); - if (li.type == Type.Double || li.type == Type.DoubleNoElementPointers) li.off_tail = Pointer.Read(reader); + li.off_head = LegacyPointer.Read(reader); + if (li.type == Type.Double || li.type == Type.DoubleNoElementPointers) li.off_tail = LegacyPointer.Read(reader); li.num_elements = reader.ReadUInt32(); li.list = new T[li.num_elements]; return li; } public void ReadEntries(ref Reader reader, ReadElement readElement, LinkedList.Flags flags = LinkedList.Flags.None) { - Pointer off_next = off_head; + LegacyPointer off_next = off_head; bool elementPointerFirst = ((flags & LinkedList.Flags.ElementPointerFirst) != 0); bool hasHeaderPointers = ((flags & LinkedList.Flags.HasHeaderPointers) != 0); bool readAtPointer = ((flags & LinkedList.Flags.ReadAtPointer) != 0); bool noPreviousPointers = ((flags & LinkedList.Flags.NoPreviousPointersForDouble) != 0); if (off_head != null) { - Pointer off_current = Pointer.Goto(ref reader, off_head); + LegacyPointer off_current = LegacyPointer.Goto(ref reader, off_head); for (int i = 0; i < num_elements; i++) { - Pointer off_element = off_next; - if (elementPointerFirst) off_element = Pointer.Read(reader); + LegacyPointer off_element = off_next; + if (elementPointerFirst) off_element = LegacyPointer.Read(reader); if (type != Type.SingleNoElementPointers && type != Type.DoubleNoElementPointers && !customEntries) { - off_next = Pointer.Read(reader); - if (type == Type.Double && !noPreviousPointers) Pointer.Read(reader); // previous element pointer - if (hasHeaderPointers) Pointer.Read(reader); // header struct pointer + off_next = LegacyPointer.Read(reader); + if (type == Type.Double && !noPreviousPointers) LegacyPointer.Read(reader); // previous element pointer + if (hasHeaderPointers) LegacyPointer.Read(reader); // header struct pointer } - if (readAtPointer && !elementPointerFirst) off_element = Pointer.Read(reader); + if (readAtPointer && !elementPointerFirst) off_element = LegacyPointer.Read(reader); // Read element if (!readAtPointer) { list[i] = readElement(off_element); } else { - Pointer.DoAt(ref reader, off_element, () => { + LegacyPointer.DoAt(ref reader, off_element, () => { list[i] = readElement(off_element); }); } @@ -147,37 +147,37 @@ public void ReadEntries(ref Reader reader, ReadElement readElement, LinkedList.F num_elements = (uint)i + 1; break; } - Pointer.Goto(ref reader, off_next); + LegacyPointer.Goto(ref reader, off_next); } else { - off_next = Pointer.Current(reader); + off_next = LegacyPointer.Current(reader); } } - Pointer.Goto(ref reader, off_current); + LegacyPointer.Goto(ref reader, off_current); } } public void ReadEntriesBackwards(ref Reader reader, ReadElement readElement, LinkedList.Flags flags = LinkedList.Flags.None) { - Pointer off_next = off_tail; + LegacyPointer off_next = off_tail; bool elementPointerFirst = ((flags & LinkedList.Flags.ElementPointerFirst) != 0); bool hasHeaderPointers = ((flags & LinkedList.Flags.HasHeaderPointers) != 0); bool readAtPointer = ((flags & LinkedList.Flags.ReadAtPointer) != 0); bool noPreviousPointers = ((flags & LinkedList.Flags.NoPreviousPointersForDouble) != 0); if (off_tail != null) { - Pointer off_current = Pointer.Goto(ref reader, off_tail); + LegacyPointer off_current = LegacyPointer.Goto(ref reader, off_tail); for (int i = 0; i < num_elements; i++) { - Pointer off_element = off_next; - if (elementPointerFirst) off_element = Pointer.Read(reader); + LegacyPointer off_element = off_next; + if (elementPointerFirst) off_element = LegacyPointer.Read(reader); if (type != Type.SingleNoElementPointers && type != Type.DoubleNoElementPointers && !customEntries) { - off_next = Pointer.Read(reader); - if (type == Type.Double && !noPreviousPointers) off_next = Pointer.Read(reader); // previous element pointer - if (hasHeaderPointers) Pointer.Read(reader); // header struct pointer + off_next = LegacyPointer.Read(reader); + if (type == Type.Double && !noPreviousPointers) off_next = LegacyPointer.Read(reader); // previous element pointer + if (hasHeaderPointers) LegacyPointer.Read(reader); // header struct pointer } - if (readAtPointer && !elementPointerFirst) off_element = Pointer.Read(reader); + if (readAtPointer && !elementPointerFirst) off_element = LegacyPointer.Read(reader); // Read element if (!readAtPointer) { list[i] = readElement(off_element); } else { - Pointer.DoAt(ref reader, off_element, () => { + LegacyPointer.DoAt(ref reader, off_element, () => { list[i] = readElement(off_element); }); } @@ -191,16 +191,16 @@ public void ReadEntriesBackwards(ref Reader reader, ReadElement readElement, Lin num_elements = (uint)i + 1; break; } - Pointer.Goto(ref reader, off_next); + LegacyPointer.Goto(ref reader, off_next); } else { - off_next = Pointer.Current(reader); + off_next = LegacyPointer.Current(reader); } } - Pointer.Goto(ref reader, off_current); + LegacyPointer.Goto(ref reader, off_current); } } - public static LinkedList Read(ref Reader reader, Pointer offset, ReadElement readElement, + public static LinkedList Read(ref Reader reader, LegacyPointer offset, ReadElement readElement, LinkedList.Flags flags = LinkedList.Flags.None, Type type = Type.Default) { LinkedList li = ReadHeader(reader, offset, type: type); @@ -208,20 +208,20 @@ public static LinkedList Read(ref Reader reader, Pointer offset, ReadElement return li; } - public void FillPointers(Reader reader, Pointer lastEntry, Pointer header, uint nextOffset = 0, uint prevOffset = 4, uint headerOffset = 8) { - Pointer current_entry = lastEntry; - Pointer next_entry = null; - Pointer off_current = Pointer.Current(reader); + public void FillPointers(Reader reader, LegacyPointer lastEntry, LegacyPointer header, uint nextOffset = 0, uint prevOffset = 4, uint headerOffset = 8) { + LegacyPointer current_entry = lastEntry; + LegacyPointer next_entry = null; + LegacyPointer off_current = LegacyPointer.Current(reader); while (current_entry != null) { - Pointer.Goto(ref reader, current_entry); + LegacyPointer.Goto(ref reader, current_entry); current_entry.file.AddPointer(current_entry.offset + nextOffset, next_entry); if (header != null) { current_entry.file.AddPointer(current_entry.offset + headerOffset, header); } next_entry = current_entry; - current_entry = Pointer.GetPointerAtOffset(current_entry + prevOffset); + current_entry = LegacyPointer.GetPointerAtOffset(current_entry + prevOffset); } - Pointer.Goto(ref reader, off_current); + LegacyPointer.Goto(ref reader, off_current); } public IEnumerator GetEnumerator() { diff --git a/Assets/Scripts/OpenSpace/General/Matrix.cs b/Assets/Scripts/OpenSpace/General/Matrix.cs index f73cb9b2..9d940306 100644 --- a/Assets/Scripts/OpenSpace/General/Matrix.cs +++ b/Assets/Scripts/OpenSpace/General/Matrix.cs @@ -9,13 +9,13 @@ namespace OpenSpace { /// Transformation matrix storing position, rotation and scale. Also, an unknown vector4 and type. /// public class Matrix { - public Pointer offset; + public LegacyPointer offset; public UInt32 type; public Matrix4x4 m; public Matrix4x4? scaleMatrix; public Vector4? v; - public Matrix(Pointer offset, uint type, Matrix4x4 matrix, Vector4? vec) { + public Matrix(LegacyPointer offset, uint type, Matrix4x4 matrix, Vector4? vec) { this.offset = offset; this.type = type; this.m = matrix; @@ -246,25 +246,25 @@ public Quaternion GetRotation(bool convertAxes = false) { return q; } - public static Matrix Read(Reader reader, Pointer offset) { + public static Matrix Read(Reader reader, LegacyPointer offset) { MapLoader l = MapLoader.Loader; //l.print("MATRIX " + offset); - UInt32 type = Settings.s.game != Settings.Game.R2Revolution ? reader.ReadUInt32() : 0; // 0x02: always at the start of a transformation matrix + UInt32 type = Legacy_Settings.s.game != Legacy_Settings.Game.R2Revolution ? reader.ReadUInt32() : 0; // 0x02: always at the start of a transformation matrix Matrix mat = new Matrix(offset, type, new Matrix4x4(), null); - if (Settings.s.engineVersion < Settings.EngineVersion.R3 && Settings.s.game != Settings.Game.R2Revolution) { + if (Legacy_Settings.s.engineVersion < Legacy_Settings.EngineVersion.R3 && Legacy_Settings.s.game != Legacy_Settings.Game.R2Revolution) { Vector3 pos = Vector3.zero; - if (Settings.s.platform != Settings.Platform.DC) { + if (Legacy_Settings.s.platform != Legacy_Settings.Platform.DC) { pos = new Vector3(reader.ReadSingle(), reader.ReadSingle(), reader.ReadSingle()); } mat.m.SetColumn(0, new Vector4(reader.ReadSingle(), reader.ReadSingle(), reader.ReadSingle(), 0f)); mat.m.SetColumn(1, new Vector4(reader.ReadSingle(), reader.ReadSingle(), reader.ReadSingle(), 0f)); mat.m.SetColumn(2, new Vector4(reader.ReadSingle(), reader.ReadSingle(), reader.ReadSingle(), 0f)); Matrix4x4 sclMatrix = new Matrix4x4(); - sclMatrix.SetColumn(0, new Vector4(reader.ReadSingle(), reader.ReadSingle(), reader.ReadSingle(), Settings.s.platform == Settings.Platform.DC ? reader.ReadSingle() : 0f)); - sclMatrix.SetColumn(1, new Vector4(reader.ReadSingle(), reader.ReadSingle(), reader.ReadSingle(), Settings.s.platform == Settings.Platform.DC ? reader.ReadSingle() : 0f)); - sclMatrix.SetColumn(2, new Vector4(reader.ReadSingle(), reader.ReadSingle(), reader.ReadSingle(), Settings.s.platform == Settings.Platform.DC ? reader.ReadSingle() : 0f)); - if (Settings.s.platform == Settings.Platform.DC) { + sclMatrix.SetColumn(0, new Vector4(reader.ReadSingle(), reader.ReadSingle(), reader.ReadSingle(), Legacy_Settings.s.platform == Legacy_Settings.Platform.DC ? reader.ReadSingle() : 0f)); + sclMatrix.SetColumn(1, new Vector4(reader.ReadSingle(), reader.ReadSingle(), reader.ReadSingle(), Legacy_Settings.s.platform == Legacy_Settings.Platform.DC ? reader.ReadSingle() : 0f)); + sclMatrix.SetColumn(2, new Vector4(reader.ReadSingle(), reader.ReadSingle(), reader.ReadSingle(), Legacy_Settings.s.platform == Legacy_Settings.Platform.DC ? reader.ReadSingle() : 0f)); + if (Legacy_Settings.s.platform == Legacy_Settings.Platform.DC) { pos = new Vector3(reader.ReadSingle(), reader.ReadSingle(), reader.ReadSingle()); } @@ -282,7 +282,7 @@ public static Matrix Read(Reader reader, Pointer offset) { transMatrix.SetColumn(2, sclColZ); }*/ } else { - if (Settings.s.platform == Settings.Platform.PS2 && Settings.s.game != Settings.Game.R2Revolution) { + if (Legacy_Settings.s.platform == Legacy_Settings.Platform.PS2 && Legacy_Settings.s.game != Legacy_Settings.Game.R2Revolution) { Vector3 v = new Vector3(reader.ReadSingle(), reader.ReadSingle(), reader.ReadSingle()); } mat.m.SetColumn(0, new Vector4(reader.ReadSingle(), reader.ReadSingle(), reader.ReadSingle(), reader.ReadSingle())); @@ -297,14 +297,14 @@ public static Matrix Read(Reader reader, Pointer offset) { new Vector4(0, 0, 0, v.w)));*/ } - if (Settings.s.game == Settings.Game.R2Revolution) { + if (Legacy_Settings.s.game == Legacy_Settings.Game.R2Revolution) { mat.type = reader.ReadUInt32(); // There's 0x8c more? } return mat; } - public static Matrix ReadCompressed(Reader reader, Pointer offset) { + public static Matrix ReadCompressed(Reader reader, LegacyPointer offset) { MapLoader l = MapLoader.Loader; ushort type = reader.ReadUInt16(); Vector4 vec = new Vector4(1f, 1f, 1f, 1f); @@ -401,10 +401,10 @@ public void SetTRS(Vector3 pos, Quaternion rot, Vector3 scale, bool convertAxes } public void Write(Writer writer) { - Pointer.Goto(ref writer, offset); + LegacyPointer.Goto(ref writer, offset); writer.Write(type); - if (Settings.s.engineVersion < Settings.EngineVersion.R3) { + if (Legacy_Settings.s.engineVersion < Legacy_Settings.EngineVersion.R3) { Vector4 pos = m.GetColumn(3); writer.Write(pos.x); writer.Write(pos.y); diff --git a/Assets/Scripts/OpenSpace/General/OpenSpaceStruct.cs b/Assets/Scripts/OpenSpace/General/OpenSpaceStruct.cs index 0c512830..b94cb3a9 100644 --- a/Assets/Scripts/OpenSpace/General/OpenSpaceStruct.cs +++ b/Assets/Scripts/OpenSpace/General/OpenSpaceStruct.cs @@ -10,20 +10,20 @@ namespace OpenSpace { /// Recently introduced, so don't expect it to be used a lot yet /// public abstract class OpenSpaceStruct { - public Pointer Offset { get; protected set; } + public LegacyPointer Offset { get; protected set; } - public void Init(Pointer offset) { + public void Init(LegacyPointer offset) { this.Offset = offset; } protected abstract void ReadInternal(Reader reader); public void Read(Reader reader, bool inline = false) { if (inline) { ReadInternal(reader); - Size = Pointer.Current(reader).offset - Offset.offset; + Size = LegacyPointer.Current(reader).offset - Offset.offset; } else { - Pointer.DoAt(ref reader, Offset, () => { + LegacyPointer.DoAt(ref reader, Offset, () => { ReadInternal(reader); - Size = Pointer.Current(reader).offset - Offset.offset; + Size = LegacyPointer.Current(reader).offset - Offset.offset; }); } } diff --git a/Assets/Scripts/OpenSpace/General/PointerJsonConverter.cs b/Assets/Scripts/OpenSpace/General/PointerJsonConverter.cs index ba326d8e..312cc9fd 100644 --- a/Assets/Scripts/OpenSpace/General/PointerJsonConverter.cs +++ b/Assets/Scripts/OpenSpace/General/PointerJsonConverter.cs @@ -11,7 +11,7 @@ namespace OpenSpace { public class PointerJsonConverter : JsonConverter { const string PointerPattern = @"^(?[^\|]*)\|0x(?[a-fA-F0-9]{8})(\[0x(?[a-fA-F0-9]{8})\])?$"; public override bool CanConvert(Type objectType) { - return objectType == typeof(Pointer); + return objectType == typeof(LegacyPointer); } public override void WriteJson(JsonWriter writer, object value, JsonSerializer serializer) { @@ -37,7 +37,7 @@ public override object ReadJson(JsonReader reader, Type objectType, object exist if (uint.TryParse(offset, System.Globalization.NumberStyles.HexNumber, default, out uint result)) { for (int i = 0; i < files_array.Length; i++) { if (files_array[i] != null && files_array[i].name == file) { - return new Pointer(result, files_array[i]); + return new LegacyPointer(result, files_array[i]); } } } diff --git a/Assets/Scripts/OpenSpace/General/Util.cs b/Assets/Scripts/OpenSpace/General/Util.cs index 3fa994d3..0936fb9f 100644 --- a/Assets/Scripts/OpenSpace/General/Util.cs +++ b/Assets/Scripts/OpenSpace/General/Util.cs @@ -46,7 +46,7 @@ public static void AppendArrayAndMergeReferences(ref T[] array1, ref T[] arra public static bool ByteArrayToFile(string fileName, byte[] byteArray) { if (byteArray == null) return false; - if (FileSystem.mode == FileSystem.Mode.Web) return false; + if (BinarySerializer.Unity.FileSystem.mode == BinarySerializer.Unity.FileSystem.Mode.Web) return false; try { Directory.CreateDirectory(new FileInfo(fileName).Directory.FullName); using (var fs = new FileStream(fileName, FileMode.Create, FileAccess.Write)) { diff --git a/Assets/Scripts/OpenSpace/IO/JsonIgnorePointersResolver.cs b/Assets/Scripts/OpenSpace/IO/JsonIgnorePointersResolver.cs index a2a7d597..1a88aa6c 100644 --- a/Assets/Scripts/OpenSpace/IO/JsonIgnorePointersResolver.cs +++ b/Assets/Scripts/OpenSpace/IO/JsonIgnorePointersResolver.cs @@ -13,7 +13,7 @@ public class JsonIgnorePointersResolver : DefaultContractResolver { protected override JsonProperty CreateProperty(MemberInfo member, MemberSerialization memberSerialization) { JsonProperty property = base.CreateProperty(member, memberSerialization); - if (member.MemberType == MemberTypes.Property || typeof(Pointer).IsAssignableFrom(member.DeclaringType)) { + if (member.MemberType == MemberTypes.Property || typeof(LegacyPointer).IsAssignableFrom(member.DeclaringType)) { property.Ignored = true; } if (member.GetCustomAttribute() != null) { diff --git a/Assets/Scripts/OpenSpace/IO/Reader.cs b/Assets/Scripts/OpenSpace/IO/Reader.cs index 5d897041..301b0a15 100644 --- a/Assets/Scripts/OpenSpace/IO/Reader.cs +++ b/Assets/Scripts/OpenSpace/IO/Reader.cs @@ -11,7 +11,7 @@ public enum MaskingMode { Window, RedPlanet } - public delegate void ReadAction(Reader reader, Pointer offset); + public delegate void ReadAction(Reader reader, LegacyPointer offset); Encoding wind1252 = Encoding.GetEncoding(1252); bool isLittleEndian = true; MaskingMode masking = MaskingMode.Off; @@ -210,7 +210,7 @@ uint GetNextMask(uint currentMask) { return (uint)((mask & 0xFFFF0000) + (mask1 << 8) + (mask0)); } else { // 0x075BD924 = 123459876 - if (Settings.s.platform == Settings.Platform.iOS) { + if (Legacy_Settings.s.platform == Legacy_Settings.Platform.iOS) { return (uint)(16807 * ((currentMask ^ 0x75BD924u) % 0x1F31D) - 2836 * ((currentMask ^ 0x75BD924u) / 0x1F31D)); } else { return (uint)(16807 * (currentMask ^ 0x75BD924) - 0x7FFFFFFF * ((currentMask ^ 0x75BD924) / 0x1F31D)); @@ -219,19 +219,19 @@ uint GetNextMask(uint currentMask) { } public int InitMask() { - switch (Settings.s.encryption) { - case Settings.Encryption.ReadInit: + switch (Legacy_Settings.s.encryption) { + case Legacy_Settings.Encryption.ReadInit: ReadMask(); return 4; - case Settings.Encryption.Window: + case Legacy_Settings.Encryption.Window: InitWindowMask(); return 0; - case Settings.Encryption.FixedInit: + case Legacy_Settings.Encryption.FixedInit: mask = 0x6AB5CC79; return 0; - case Settings.Encryption.RedPlanet: + case Legacy_Settings.Encryption.RedPlanet: ReadUInt32(); mask = 0x6AB5CC79; masking = MaskingMode.RedPlanet; return 4; - case Settings.Encryption.CalculateInit: + case Legacy_Settings.Encryption.CalculateInit: uint currentMask = 0xFFFFFFFF; // 0x075BD924 = 123459876 mask = (uint)(16807 * (currentMask ^ 0x75BD924) - (((currentMask ^ 0x75BD924) / -127773 << 31) - (currentMask ^ 0x75BD924) / 127773)); diff --git a/Assets/Scripts/OpenSpace/Input/EntryAction.cs b/Assets/Scripts/OpenSpace/Input/EntryAction.cs index 48e9cbd7..7a3f31a3 100644 --- a/Assets/Scripts/OpenSpace/Input/EntryAction.cs +++ b/Assets/Scripts/OpenSpace/Input/EntryAction.cs @@ -5,12 +5,12 @@ namespace OpenSpace.Input { public class EntryAction : ILinkedListEntry { // IPT_tdstEntryElement - public Pointer offset; + public LegacyPointer offset; public uint num_keywords; - public Pointer off_keywords; - public Pointer off_name; - public Pointer off_name2; + public LegacyPointer off_keywords; + public LegacyPointer off_name; + public LegacyPointer off_name2; public byte active; public string name = null; @@ -18,15 +18,15 @@ public class EntryAction : ILinkedListEntry { // IPT_tdstEntryElement public LinkedList keywords = null; // Only in Tonic Trouble: Special Edition - public Pointer off_entryAction_next = null; - public Pointer off_entryAction_prev = null; - public Pointer off_entryAction_hdr = null; + public LegacyPointer off_entryAction_next = null; + public LegacyPointer off_entryAction_prev = null; + public LegacyPointer off_entryAction_hdr = null; - public Pointer NextEntry { + public LegacyPointer NextEntry { get { return off_entryAction_next; } } - public Pointer PreviousEntry { + public LegacyPointer PreviousEntry { get { return off_entryAction_prev; } } @@ -38,51 +38,51 @@ public string ExportName } } - public EntryAction(Pointer offset) { + public EntryAction(LegacyPointer offset) { this.offset = offset; } - public static EntryAction Read(Reader reader, Pointer offset) { + public static EntryAction Read(Reader reader, LegacyPointer offset) { MapLoader l = MapLoader.Loader; EntryAction ea = new EntryAction(offset); //l.print("EntryAction " + offset); l.entryActions.Add(ea); - if (Settings.s.game == Settings.Game.TTSE) { - ea.off_entryAction_next = Pointer.Read(reader); - ea.off_entryAction_prev = Pointer.Read(reader); + if (Legacy_Settings.s.game == Legacy_Settings.Game.TTSE) { + ea.off_entryAction_next = LegacyPointer.Read(reader); + ea.off_entryAction_prev = LegacyPointer.Read(reader); reader.ReadUInt32(); //element.off_entryAction_hdr = Pointer.Read(reader); // hdr pointer doesn't work here - ea.keywords = LinkedList.Read(ref reader, Pointer.Current(reader), + ea.keywords = LinkedList.Read(ref reader, LegacyPointer.Current(reader), (off_element) => { return KeyWord.Read(reader, off_element); }, - flags: Settings.s.hasLinkedListHeaderPointers ? + flags: Legacy_Settings.s.hasLinkedListHeaderPointers ? LinkedList.Flags.HasHeaderPointers : LinkedList.Flags.NoPreviousPointersForDouble, type: LinkedList.Type.Default); - ea.off_name = Pointer.Read(reader); + ea.off_name = LegacyPointer.Read(reader); reader.ReadInt32(); // -2 reader.ReadUInt32(); reader.ReadByte(); ea.active = reader.ReadByte(); reader.ReadBytes(2); } else { - if (Settings.s.hasExtraInputData) { + if (Legacy_Settings.s.hasExtraInputData) { reader.ReadBytes(0x18); } - if (Settings.s.platform == Settings.Platform.PS2 && - (Settings.s.game == Settings.Game.RM - || Settings.s.game == Settings.Game.RA - || Settings.s.mode == Settings.Mode.Rayman3PS2Demo_2002_12_18 - || Settings.s.mode == Settings.Mode.Rayman3PS2Demo_2002_05_17)) { + if (Legacy_Settings.s.platform == Legacy_Settings.Platform.PS2 && + (Legacy_Settings.s.game == Legacy_Settings.Game.RM + || Legacy_Settings.s.game == Legacy_Settings.Game.RA + || Legacy_Settings.s.mode == Legacy_Settings.Mode.Rayman3PS2Demo_2002_12_18 + || Legacy_Settings.s.mode == Legacy_Settings.Mode.Rayman3PS2Demo_2002_05_17)) { reader.ReadBytes(0x8); } ea.num_keywords = reader.ReadUInt32(); - ea.off_keywords = Pointer.Read(reader); - ea.keywords = new LinkedList(Pointer.Current(reader), ea.off_keywords, ea.num_keywords, type: LinkedList.Type.SingleNoElementPointers); - if (Settings.s.engineVersion < Settings.EngineVersion.R2) reader.ReadUInt32(); // Offset of extra input data in tmp memory? It's different by 0x18 every time - ea.off_name = Pointer.Read(reader); - if (Settings.s.hasExtraInputData || Settings.s.platform == Settings.Platform.DC || Settings.s.engineVersion == Settings.EngineVersion.R3) ea.off_name2 = Pointer.Read(reader); + ea.off_keywords = LegacyPointer.Read(reader); + ea.keywords = new LinkedList(LegacyPointer.Current(reader), ea.off_keywords, ea.num_keywords, type: LinkedList.Type.SingleNoElementPointers); + if (Legacy_Settings.s.engineVersion < Legacy_Settings.EngineVersion.R2) reader.ReadUInt32(); // Offset of extra input data in tmp memory? It's different by 0x18 every time + ea.off_name = LegacyPointer.Read(reader); + if (Legacy_Settings.s.hasExtraInputData || Legacy_Settings.s.platform == Legacy_Settings.Platform.DC || Legacy_Settings.s.engineVersion == Legacy_Settings.EngineVersion.R3) ea.off_name2 = LegacyPointer.Read(reader); reader.ReadInt32(); // -2 reader.ReadUInt32(); ea.active = reader.ReadByte(); @@ -95,17 +95,17 @@ public static EntryAction Read(Reader reader, Pointer offset) { if (ea.keywords != null && ea.keywords.Count > 0) { int keywordsRead = ea.keywords[0].FillInSubKeywords(ref reader, ea.keywords, 0); if (keywordsRead != ea.keywords.Count) { - if (Settings.s.game != Settings.Game.RedPlanet) { // Seems to be normal in this game + if (Legacy_Settings.s.game != Legacy_Settings.Game.RedPlanet) { // Seems to be normal in this game Debug.LogError(offset + " - Keywords read was: " + keywordsRead + " vs " + ea.keywords.Count); Debug.LogError(ea.ToString()); } } } - if (Settings.s.game != Settings.Game.RedPlanet) { - Pointer.DoAt(ref reader, ea.off_name, () => { + if (Legacy_Settings.s.game != Legacy_Settings.Game.RedPlanet) { + LegacyPointer.DoAt(ref reader, ea.off_name, () => { ea.name = reader.ReadNullDelimitedString(); }); - Pointer.DoAt(ref reader, ea.off_name2, () => { + LegacyPointer.DoAt(ref reader, ea.off_name2, () => { ea.name2 = reader.ReadNullDelimitedString(); }); } @@ -155,16 +155,16 @@ public string GetValueOnlyString() { return ""; } - public static EntryAction FromOffset(Pointer offset) { + public static EntryAction FromOffset(LegacyPointer offset) { if (offset == null) return null; return MapLoader.Loader.entryActions.FirstOrDefault(a => a.offset == offset); } - public static EntryAction FromOffsetOrRead(Pointer offset, Reader reader) { + public static EntryAction FromOffsetOrRead(LegacyPointer offset, Reader reader) { if (offset == null) return null; EntryAction e = EntryAction.FromOffset(offset); if (e == null) { - Pointer.DoAt(ref reader, offset, () => { + LegacyPointer.DoAt(ref reader, offset, () => { e = EntryAction.Read(reader, offset); MapLoader.Loader.print(e.ToString()); }); diff --git a/Assets/Scripts/OpenSpace/Input/InputFunctions.cs b/Assets/Scripts/OpenSpace/Input/InputFunctions.cs index 96da1df0..c26b1831 100644 --- a/Assets/Scripts/OpenSpace/Input/InputFunctions.cs +++ b/Assets/Scripts/OpenSpace/Input/InputFunctions.cs @@ -344,15 +344,15 @@ public enum FunctionType { public static FunctionType GetFunctionType(uint index) { try { - if (Settings.s.game == Settings.Game.TTSE) return functionTypesSE[index]; - if (Settings.s.game == Settings.Game.TT) return functionTypesTT[index]; - if (Settings.s.game == Settings.Game.LargoWinch) return functionTypesLargo[index]; - if (Settings.s.game == Settings.Game.R2Revolution) return functionTypesRevolution[index]; - if (Settings.s.engineVersion == Settings.EngineVersion.Montreal) return functionTypesHype[index]; - if (Settings.s.platform == Settings.Platform.GC) return functionTypesGC[index]; - if (Settings.s.platform == Settings.Platform.DC || Settings.s.platform == Settings.Platform.iOS) return functionTypesDC[index]; - if (Settings.s.engineVersion > Settings.EngineVersion.R2 && - Settings.s.platform == Settings.Platform.PS2) return functionTypesPS2[index]; + if (Legacy_Settings.s.game == Legacy_Settings.Game.TTSE) return functionTypesSE[index]; + if (Legacy_Settings.s.game == Legacy_Settings.Game.TT) return functionTypesTT[index]; + if (Legacy_Settings.s.game == Legacy_Settings.Game.LargoWinch) return functionTypesLargo[index]; + if (Legacy_Settings.s.game == Legacy_Settings.Game.R2Revolution) return functionTypesRevolution[index]; + if (Legacy_Settings.s.engineVersion == Legacy_Settings.EngineVersion.Montreal) return functionTypesHype[index]; + if (Legacy_Settings.s.platform == Legacy_Settings.Platform.GC) return functionTypesGC[index]; + if (Legacy_Settings.s.platform == Legacy_Settings.Platform.DC || Legacy_Settings.s.platform == Legacy_Settings.Platform.iOS) return functionTypesDC[index]; + if (Legacy_Settings.s.engineVersion > Legacy_Settings.EngineVersion.R2 && + Legacy_Settings.s.platform == Legacy_Settings.Platform.PS2) return functionTypesPS2[index]; return (FunctionType)(index); } catch (Exception) { return FunctionType.Unknown; diff --git a/Assets/Scripts/OpenSpace/Input/InputStructure.cs b/Assets/Scripts/OpenSpace/Input/InputStructure.cs index 04e478f1..2fe80aa7 100644 --- a/Assets/Scripts/OpenSpace/Input/InputStructure.cs +++ b/Assets/Scripts/OpenSpace/Input/InputStructure.cs @@ -5,97 +5,97 @@ namespace OpenSpace.Input { public class InputStructure { - public Pointer offset; + public LegacyPointer offset; public uint num_entryActions; - public Pointer off_entryActions; + public LegacyPointer off_entryActions; public List entryActions = new List(); - public InputStructure(Pointer offset) { + public InputStructure(LegacyPointer offset) { this.offset = offset; } - public static InputStructure Read(Reader reader, Pointer offset) { + public static InputStructure Read(Reader reader, LegacyPointer offset) { InputStructure input = new InputStructure(offset); - if (Settings.s.game == Settings.Game.LargoWinch) { + if (Legacy_Settings.s.game == Legacy_Settings.Game.LargoWinch) { input.num_entryActions = reader.ReadUInt32(); - input.off_entryActions = Pointer.Read(reader); + input.off_entryActions = LegacyPointer.Read(reader); } else { - switch (Settings.s.platform) { - case Settings.Platform.GC: + switch (Legacy_Settings.s.platform) { + case Legacy_Settings.Platform.GC: //reader.ReadBytes(0x1714); - if (Settings.s.game == Settings.Game.R3) { + if (Legacy_Settings.s.game == Legacy_Settings.Game.R3) { reader.ReadBytes(0x12E0); - } else if (Settings.s.game == Settings.Game.RA - || Settings.s.game == Settings.Game.DDPK) { + } else if (Legacy_Settings.s.game == Legacy_Settings.Game.RA + || Legacy_Settings.s.game == Legacy_Settings.Game.DDPK) { //reader.ReadBytes(0x16e8); reader.ReadBytes(0x12C8); } input.num_entryActions = reader.ReadUInt32(); - input.off_entryActions = Pointer.Read(reader); + input.off_entryActions = LegacyPointer.Read(reader); reader.ReadBytes(0x418); break; - case Settings.Platform.PC: - case Settings.Platform.MacOS: - if (Settings.s.game == Settings.Game.RedPlanet) { + case Legacy_Settings.Platform.PC: + case Legacy_Settings.Platform.MacOS: + if (Legacy_Settings.s.game == Legacy_Settings.Game.RedPlanet) { reader.ReadBytes(0x32CC); - } else if (Settings.s.engineVersion == Settings.EngineVersion.R2) { + } else if (Legacy_Settings.s.engineVersion == Legacy_Settings.EngineVersion.R2) { reader.ReadBytes(0x700); - } else if (Settings.s.game == Settings.Game.Dinosaur) { + } else if (Legacy_Settings.s.game == Legacy_Settings.Game.Dinosaur) { reader.ReadBytes(0xC58); } else { reader.ReadBytes(0x16BC); } input.num_entryActions = reader.ReadUInt32(); - input.off_entryActions = Pointer.Read(reader); - if (Settings.s.game == Settings.Game.RedPlanet) { + input.off_entryActions = LegacyPointer.Read(reader); + if (Legacy_Settings.s.game == Legacy_Settings.Game.RedPlanet) { reader.ReadBytes(0x14); } else { reader.ReadBytes(0x418); } break; - case Settings.Platform.Xbox: - case Settings.Platform.Xbox360: - case Settings.Platform.PS3: + case Legacy_Settings.Platform.Xbox: + case Legacy_Settings.Platform.Xbox360: + case Legacy_Settings.Platform.PS3: reader.ReadBytes(0x16BC); input.num_entryActions = reader.ReadUInt32(); - input.off_entryActions = Pointer.Read(reader); + input.off_entryActions = LegacyPointer.Read(reader); reader.ReadBytes(0x418); break; - case Settings.Platform.iOS: + case Legacy_Settings.Platform.iOS: reader.ReadBytes(0x2A0); input.num_entryActions = reader.ReadUInt32(); - input.off_entryActions = Pointer.Read(reader); + input.off_entryActions = LegacyPointer.Read(reader); reader.ReadBytes(0x14); break; - case Settings.Platform.DC: + case Legacy_Settings.Platform.DC: reader.ReadBytes(0x278); input.num_entryActions = reader.ReadUInt32(); - input.off_entryActions = Pointer.Read(reader); + input.off_entryActions = LegacyPointer.Read(reader); reader.ReadUInt32(); - Pointer.Read(reader); + LegacyPointer.Read(reader); break; - case Settings.Platform.PS2: - if (Settings.s.game == Settings.Game.R2Revolution) { + case Legacy_Settings.Platform.PS2: + if (Legacy_Settings.s.game == Legacy_Settings.Game.R2Revolution) { reader.ReadBytes(0x130); input.num_entryActions = reader.ReadUInt32(); - input.off_entryActions = Pointer.Read(reader); - Pointer.Read(reader); + input.off_entryActions = LegacyPointer.Read(reader); + LegacyPointer.Read(reader); reader.ReadUInt16(); reader.ReadUInt16(); reader.ReadUInt32(); // 0F00020000040100 reader.ReadBytes(0x300); } else { - if (Settings.s.mode == Settings.Mode.Rayman3PS2Demo_2002_05_17) { + if (Legacy_Settings.s.mode == Legacy_Settings.Mode.Rayman3PS2Demo_2002_05_17) { reader.ReadBytes(0x1368); } else { reader.ReadBytes(0x1250); - if (Settings.s.game == Settings.Game.RA || Settings.s.game == Settings.Game.RM - || Settings.s.mode == Settings.Mode.Rayman3PS2Demo_2002_12_18) { + if (Legacy_Settings.s.game == Legacy_Settings.Game.RA || Legacy_Settings.s.game == Legacy_Settings.Game.RM + || Legacy_Settings.s.mode == Legacy_Settings.Mode.Rayman3PS2Demo_2002_12_18) { reader.ReadBytes(0x10); } } input.num_entryActions = reader.ReadUInt32(); - input.off_entryActions = Pointer.Read(reader); + input.off_entryActions = LegacyPointer.Read(reader); reader.ReadBytes(0x418); } break; @@ -104,9 +104,9 @@ public static InputStructure Read(Reader reader, Pointer offset) { if (input.off_entryActions != null && input.num_entryActions > 0) { //input.entryActions = new EntryAction[input.num_entryActions]; - Pointer.DoAt(ref reader, input.off_entryActions, () => { + LegacyPointer.DoAt(ref reader, input.off_entryActions, () => { for (int i = 0; i < input.num_entryActions; i++) { - input.entryActions.Add(EntryAction.Read(reader, Pointer.Current(reader))); + input.entryActions.Add(EntryAction.Read(reader, LegacyPointer.Current(reader))); } }); } diff --git a/Assets/Scripts/OpenSpace/Input/KeyWord.cs b/Assets/Scripts/OpenSpace/Input/KeyWord.cs index ad68a0d5..3a650440 100644 --- a/Assets/Scripts/OpenSpace/Input/KeyWord.cs +++ b/Assets/Scripts/OpenSpace/Input/KeyWord.cs @@ -4,11 +4,11 @@ namespace OpenSpace.Input { public class KeyWord { // IPT_tdstEntryElement - public Pointer offset; + public LegacyPointer offset; public ushort indexOrKeyCode; public int valueAsInt; - public Pointer valueAsPointer; + public LegacyPointer valueAsPointer; public KeyWord[] subkeywords; public bool isFunction = false; @@ -25,34 +25,34 @@ public byte Index { get { return (byte)(indexOrKeyCode & 0xFF); } } - public KeyWord(Pointer offset) { + public KeyWord(LegacyPointer offset) { this.offset = offset; } - public static KeyWord Read(Reader reader, Pointer offset, bool isFunction=true) { + public static KeyWord Read(Reader reader, LegacyPointer offset, bool isFunction=true) { KeyWord keyword = new KeyWord(offset); // Read 20 in total for R2iOS - if (Settings.s.hasExtraInputData) { + if (Legacy_Settings.s.hasExtraInputData) { reader.ReadInt32(); reader.ReadInt32(); reader.ReadInt32(); } - Pointer off_value = Pointer.Current(reader); + LegacyPointer off_value = LegacyPointer.Current(reader); keyword.indexOrKeyCode = reader.ReadUInt16(); - Pointer.Goto(ref reader, off_value); + LegacyPointer.Goto(ref reader, off_value); - if (Settings.s == Settings.R2PC) { + if (Legacy_Settings.s == Legacy_Settings.R2PC) { keyword.valueAsInt = reader.ReadInt16(); reader.ReadInt16(); } else { keyword.valueAsInt = reader.ReadInt32(); } - keyword.valueAsPointer = Pointer.GetPointerAtOffset(off_value); - if (Settings.s.engineVersion == Settings.EngineVersion.R3 && Settings.s.game != Settings.Game.LargoWinch) reader.ReadInt32(); - if(Settings.s.game != Settings.Game.R2Revolution) reader.ReadInt32(); + keyword.valueAsPointer = LegacyPointer.GetPointerAtOffset(off_value); + if (Legacy_Settings.s.engineVersion == Legacy_Settings.EngineVersion.R3 && Legacy_Settings.s.game != Legacy_Settings.Game.LargoWinch) reader.ReadInt32(); + if(Legacy_Settings.s.game != Legacy_Settings.Game.R2Revolution) reader.ReadInt32(); /*if (isFunction && Settings.s.game != Settings.Game.TTSE) { keyWord.isFunction = true; @@ -149,7 +149,7 @@ public int FillInSubKeywords(ref Reader reader, LinkedList keywords, in break; case InputFunctions.FunctionType.SequencePad: case InputFunctions.FunctionType.SequencePadEnd: - if (Settings.s.game == Settings.Game.LargoWinch) { + if (Legacy_Settings.s.game == Legacy_Settings.Game.LargoWinch) { subkeywords = new KeyWord[3]; subkeywords[0] = keywords[thisIndex + keywordsRead]; keywordsRead += 1; @@ -194,7 +194,7 @@ public int FillInSubKeywords(ref Reader reader, LinkedList keywords, in case InputFunctions.FunctionType.JoystickOrPadReleased: case InputFunctions.FunctionType.JoystickOrPadJustPressed: case InputFunctions.FunctionType.JoystickOrPadJustReleased: - if (Settings.s.game == Settings.Game.LargoWinch) { + if (Legacy_Settings.s.game == Legacy_Settings.Game.LargoWinch) { subkeywords = new KeyWord[3]; subkeywords[0] = keywords[thisIndex + keywordsRead]; keywordsRead += 1; @@ -211,7 +211,7 @@ public int FillInSubKeywords(ref Reader reader, LinkedList keywords, in } break; case InputFunctions.FunctionType.JoystickAxeValue: - if (Settings.s.game == Settings.Game.LargoWinch) { + if (Legacy_Settings.s.game == Legacy_Settings.Game.LargoWinch) { subkeywords = new KeyWord[5]; subkeywords[0] = keywords[thisIndex + keywordsRead]; keywordsRead += 1; @@ -256,7 +256,7 @@ public int FillInSubKeywords(ref Reader reader, LinkedList keywords, in case InputFunctions.FunctionType.ActionJustInvalidated: subkeywords = new KeyWord[1]; subkeywords[0] = keywords[thisIndex + keywordsRead]; - if (subkeywords[0] != null && Settings.s.game == Settings.Game.TT) { + if (subkeywords[0] != null && Legacy_Settings.s.game == Legacy_Settings.Game.TT) { EntryAction.FromOffsetOrRead(subkeywords[0].valueAsPointer, reader); } keywordsRead += 1; @@ -311,7 +311,7 @@ public override string ToString() { case InputFunctions.FunctionType.JoystickOrPadJustReleased: return FunctionType + GetJoyPadString(subkeywords); case InputFunctions.FunctionType.JoystickAxeValue: - if (Settings.s.game == Settings.Game.LargoWinch) { + if (Legacy_Settings.s.game == Legacy_Settings.Game.LargoWinch) { return FunctionType + "(" + (subkeywords[2].indexOrKeyCode == 4 ? "X" : "Y") + ", " + subkeywords[3].valueAsInt @@ -328,8 +328,8 @@ public override string ToString() { case InputFunctions.FunctionType.ActionInvalidated: case InputFunctions.FunctionType.ActionJustValidated: case InputFunctions.FunctionType.ActionJustInvalidated: - Pointer off_action = subkeywords[0].valueAsPointer; - if (Settings.s.engineVersion <= Settings.EngineVersion.Montreal) return FunctionType + "()"; + LegacyPointer off_action = subkeywords[0].valueAsPointer; + if (Legacy_Settings.s.engineVersion <= Legacy_Settings.EngineVersion.Montreal) return FunctionType + "()"; EntryAction action = EntryAction.FromOffset(off_action); return FunctionType + "{" + (action != null ? ((action.name != null && action.name.Trim() != "") ? ("\"" + action.name + "\"") : action.ToBasicString()) : "null") + "}"; default: @@ -342,13 +342,13 @@ public override string ToString() { private string GetJoyPadString(KeyWord[] subkeywords) { int firstKW = 0; - if (Settings.s.game == Settings.Game.LargoWinch) firstKW++; - if (Settings.s.platform == Settings.Platform.GC) { + if (Legacy_Settings.s.game == Legacy_Settings.Game.LargoWinch) firstKW++; + if (Legacy_Settings.s.platform == Legacy_Settings.Platform.GC) { return "(" + Enum.GetName(typeof(GameCubeKeyCode), subkeywords[firstKW + 1].indexOrKeyCode) + (subkeywords[firstKW + 0].indexOrKeyCode != 0 ? (", " + subkeywords[firstKW + 0].indexOrKeyCode) : "") + ")"; - } else if (Settings.s.platform == Settings.Platform.DC) { + } else if (Legacy_Settings.s.platform == Legacy_Settings.Platform.DC) { return "(" + Enum.GetName(typeof(DreamcastKeyCode), subkeywords[firstKW + 1].indexOrKeyCode) + (subkeywords[firstKW + 0].indexOrKeyCode != 0 ? (", " + subkeywords[firstKW + 0].indexOrKeyCode) : "") + ")"; - } else if (Settings.s.platform == Settings.Platform.PS2) { - if (Settings.s.engineVersion < Settings.EngineVersion.R3) { + } else if (Legacy_Settings.s.platform == Legacy_Settings.Platform.PS2) { + if (Legacy_Settings.s.engineVersion < Legacy_Settings.EngineVersion.R3) { return "(" + Enum.GetName(typeof(RevolutionPS2KeyCode), subkeywords[firstKW + 1].indexOrKeyCode) + (subkeywords[firstKW + 0].indexOrKeyCode != 0 ? (", " + subkeywords[firstKW + 0].indexOrKeyCode) : "") + ")"; } else { return "(" + Enum.GetName(typeof(PS2KeyCode), subkeywords[firstKW + 1].indexOrKeyCode) + (subkeywords[firstKW + 0].indexOrKeyCode != 0 ? (", " + subkeywords[firstKW + 0].indexOrKeyCode) : "") + ")"; diff --git a/Assets/Scripts/OpenSpace/Loader/LWLoader.cs b/Assets/Scripts/OpenSpace/Loader/LWLoader.cs index 0fa72caa..f4366053 100644 --- a/Assets/Scripts/OpenSpace/Loader/LWLoader.cs +++ b/Assets/Scripts/OpenSpace/Loader/LWLoader.cs @@ -20,6 +20,7 @@ using lzo.net; using System.Threading.Tasks; using Cysharp.Threading.Tasks; +using BinarySerializer.Unity; namespace OpenSpace.Loader { public class LWLoader : MapLoader { @@ -42,25 +43,25 @@ protected override async UniTask Load() { await CreateCNT(); if (lvlName.EndsWith(".exe")) { - if (!Settings.s.hasMemorySupport) throw new Exception("This game does not have memory support."); - Settings.s.loadFromMemory = true; + if (!Legacy_Settings.s.hasMemorySupport) throw new Exception("This game does not have memory support."); + Legacy_Settings.s.loadFromMemory = true; MemoryFile mem = new MemoryFile(lvlName); files_array[0] = mem; await WaitIfNecessary(); await LoadMemory(); } else { // Prepare folder names - string fixFolder = gameDataBinFolder + ConvertCase("Fix/", Settings.CapsType.LevelFolder); - string lvlFolder = gameDataBinFolder + ConvertCase(lvlName + "/", Settings.CapsType.LevelFolder); + string fixFolder = gameDataBinFolder + ConvertCase("Fix/", Legacy_Settings.CapsType.LevelFolder); + string lvlFolder = gameDataBinFolder + ConvertCase(lvlName + "/", Legacy_Settings.CapsType.LevelFolder); // Prepare paths - paths["fix.lvl"] = fixFolder + ConvertCase("Fix.lvl", Settings.CapsType.LevelFile); - paths["fix.ptr"] = fixFolder + ConvertCase("Fix.ptr", Settings.CapsType.LevelFile); - paths["fix.pbt"] = fixFolder + ConvertCase("Fix.pbt", Settings.CapsType.LevelFile); - paths["lvl.lvl"] = lvlFolder + ConvertCase(lvlName + ".lvl", Settings.CapsType.LevelFile); - paths["lvl.ptr"] = lvlFolder + ConvertCase(lvlName + ".ptr", Settings.CapsType.LevelFile); - paths["lvl.pbt"] = lvlFolder + ConvertCase(lvlName + ".pbt", Settings.CapsType.LevelFile); - paths["lvl.lms"] = lvlFolder + ConvertCase(lvlName + ".lms", Settings.CapsType.LMFile); + paths["fix.lvl"] = fixFolder + ConvertCase("Fix.lvl", Legacy_Settings.CapsType.LevelFile); + paths["fix.ptr"] = fixFolder + ConvertCase("Fix.ptr", Legacy_Settings.CapsType.LevelFile); + paths["fix.pbt"] = fixFolder + ConvertCase("Fix.pbt", Legacy_Settings.CapsType.LevelFile); + paths["lvl.lvl"] = lvlFolder + ConvertCase(lvlName + ".lvl", Legacy_Settings.CapsType.LevelFile); + paths["lvl.ptr"] = lvlFolder + ConvertCase(lvlName + ".ptr", Legacy_Settings.CapsType.LevelFile); + paths["lvl.pbt"] = lvlFolder + ConvertCase(lvlName + ".pbt", Legacy_Settings.CapsType.LevelFile); + paths["lvl.lms"] = lvlFolder + ConvertCase(lvlName + ".lms", Legacy_Settings.CapsType.LMFile); // Download files foreach (KeyValuePair path in paths) { @@ -80,11 +81,11 @@ protected override async UniTask Load() { files_array[i] = new LVL(lvlNames[i], lvlPaths[i], i); } } - ReadLargoLVL(Mem.Fix, fixFolder + ConvertCase("Fix.dmp", Settings.CapsType.LevelFile)); - ReadLargoLVL(Mem.Lvl, lvlFolder + ConvertCase(lvlName + ".dmp", Settings.CapsType.LevelFile)); + ReadLargoLVL(Mem.Fix, fixFolder + ConvertCase("Fix.dmp", Legacy_Settings.CapsType.LevelFile)); + ReadLargoLVL(Mem.Lvl, lvlFolder + ConvertCase(lvlName + ".dmp", Legacy_Settings.CapsType.LevelFile)); - pbt[Mem.Fix] = ReadPBT(paths["fix.pbt"], fixFolder + ConvertCase("Fix_PBT.dmp", Settings.CapsType.LevelFile)); - pbt[Mem.Lvl] = ReadPBT(paths["lvl.pbt"], lvlFolder + ConvertCase(lvlName + "_PBT.dmp", Settings.CapsType.LevelFile)); + pbt[Mem.Fix] = ReadPBT(paths["fix.pbt"], fixFolder + ConvertCase("Fix_PBT.dmp", Legacy_Settings.CapsType.LevelFile)); + pbt[Mem.Lvl] = ReadPBT(paths["lvl.pbt"], lvlFolder + ConvertCase(lvlName + "_PBT.dmp", Legacy_Settings.CapsType.LevelFile)); lms = ReadLMS(paths["lvl.lms"]); for (int i = 0; i < loadOrder.Length; i++) { @@ -126,7 +127,7 @@ private void ReadLargoLVL(int index, string path) { private PBT ReadPBT(string path, string dmpPath) { if (FileSystem.FileExists(path)) { - using (Reader reader = new Reader(FileSystem.GetFileReadStream(path), Settings.s.IsLittleEndian)) { + using (Reader reader = new Reader(FileSystem.GetFileReadStream(path), Legacy_Settings.s.IsLittleEndian)) { uint decompressed = reader.ReadUInt32(); uint compressed = reader.ReadUInt32(); byte[] decData = DecompressLargo(reader, compressed, decompressed); @@ -142,9 +143,9 @@ private LMS ReadLMS(string path) { if (FileSystem.FileExists(path)) { LMS lms = new LMS(FileSystem.GetFileReadStream(path)); if (lms != null && exportTextures) { - string lvlFolder = gameDataBinFolder + ConvertCase(lvlName + "/", Settings.CapsType.LevelFolder); + string lvlFolder = gameDataBinFolder + ConvertCase(lvlName + "/", Legacy_Settings.CapsType.LevelFolder); for (int i = 0; i < lms.Count; i++) { - Util.ByteArrayToFile(lvlFolder + "textures/" + ConvertCase(lvlName + "_" + i + ".png", Settings.CapsType.LevelFile), lms.textures[i].EncodeToPNG()); + Util.ByteArrayToFile(lvlFolder + "textures/" + ConvertCase(lvlName + "_" + i + ".png", Legacy_Settings.CapsType.LevelFile), lms.textures[i].EncodeToPNG()); } } return lms; @@ -154,7 +155,7 @@ private LMS ReadLMS(string path) { - public void ReadLanguagesVoice(Reader reader, Pointer off_languages, uint num_languages) { + public void ReadLanguagesVoice(Reader reader, LegacyPointer off_languages, uint num_languages) { languages_voice = new string[num_languages]; languages_voice_loc = new string[num_languages]; for (uint i = 0; i < num_languages; i++) { @@ -165,7 +166,7 @@ public void ReadLanguagesVoice(Reader reader, Pointer off_languages, uint num_la } #region FIX - Pointer off_animBankFix; + LegacyPointer off_animBankFix; async UniTask LoadFIX() { textures = new TextureInfo[0]; loadingState = "Loading fixed memory"; @@ -177,8 +178,8 @@ async UniTask LoadFIX() { reader.ReadByte(); reader.ReadByte(); reader.ReadByte(); - ReadLevelNames(reader, Pointer.Current(reader), num_lvlNames); - if (Settings.s.platform == Settings.Platform.PC) { + ReadLevelNames(reader, LegacyPointer.Current(reader), num_lvlNames); + if (Legacy_Settings.s.platform == Legacy_Settings.Platform.PC) { reader.ReadChars(0x1E); reader.ReadChars(0x1E); // two zero entries } @@ -187,13 +188,13 @@ async UniTask LoadFIX() { byte num_languages_voice = reader.ReadByte(); reader.ReadByte(); reader.ReadByte(); - print(Pointer.Current(reader)); - Pointer off_languages_subtitles = Pointer.Read(reader); - Pointer off_languages_voice = Pointer.Read(reader); - Pointer.DoAt(ref reader, off_languages_subtitles, () => { + print(LegacyPointer.Current(reader)); + LegacyPointer off_languages_subtitles = LegacyPointer.Read(reader); + LegacyPointer off_languages_voice = LegacyPointer.Read(reader); + LegacyPointer.DoAt(ref reader, off_languages_subtitles, () => { ReadLanguages(reader, off_languages_subtitles, num_languages_subtitles); }); - Pointer.DoAt(ref reader, off_languages_voice, () => { + LegacyPointer.DoAt(ref reader, off_languages_voice, () => { ReadLanguagesVoice(reader, off_languages_voice, num_languages_voice); }); @@ -207,7 +208,7 @@ async UniTask LoadFIX() { } loadingState = "Loading input structure"; await WaitIfNecessary(); - inputStruct = InputStructure.Read(reader, Pointer.Current(reader)); + inputStruct = InputStructure.Read(reader, LegacyPointer.Current(reader)); foreach (EntryAction ea in inputStruct.entryActions) { print(ea.ToString()); } @@ -216,18 +217,18 @@ async UniTask LoadFIX() { reader.ReadUInt32(); ushort num_unk2 = reader.ReadUInt16(); reader.ReadUInt16(); - Pointer off_unk2 = Pointer.Read(reader); - Pointer off_entryActions = Pointer.Read(reader); - Pointer[] unkMatrices = new Pointer[2]; + LegacyPointer off_unk2 = LegacyPointer.Read(reader); + LegacyPointer off_entryActions = LegacyPointer.Read(reader); + LegacyPointer[] unkMatrices = new LegacyPointer[2]; for (int i = 0; i < 2; i++) { - unkMatrices[i] = Pointer.Read(reader); + unkMatrices[i] = LegacyPointer.Read(reader); } - fonts = FromOffsetOrRead(reader, Pointer.Current(reader), inline: true); + fonts = FromOffsetOrRead(reader, LegacyPointer.Current(reader), inline: true); - Pointer off_matrices = Pointer.Read(reader); - Pointer off_specialEntryAction = Pointer.Read(reader); - Pointer off_identityMatrix = Pointer.Read(reader); - Pointer off_unk = Pointer.Read(reader); + LegacyPointer off_matrices = LegacyPointer.Read(reader); + LegacyPointer off_specialEntryAction = LegacyPointer.Read(reader); + LegacyPointer off_identityMatrix = LegacyPointer.Read(reader); + LegacyPointer off_unk = LegacyPointer.Read(reader); reader.ReadUInt32(); reader.ReadUInt32(); reader.ReadBytes(0xc8); @@ -237,10 +238,10 @@ async UniTask LoadFIX() { reader.ReadByte(); reader.ReadByte(); reader.ReadByte(); - Pointer.Read(reader); - Pointer off_haloTexture = Pointer.Read(reader); - Pointer off_material1 = Pointer.Read(reader); - Pointer off_material2 = Pointer.Read(reader); + LegacyPointer.Read(reader); + LegacyPointer off_haloTexture = LegacyPointer.Read(reader); + LegacyPointer off_material1 = LegacyPointer.Read(reader); + LegacyPointer off_material2 = LegacyPointer.Read(reader); for (int i = 0; i < 10; i++) { reader.ReadBytes(0xcc); } @@ -261,8 +262,8 @@ async UniTask LoadLVL() { reader.ReadUInt32(); - Pointer.Read(reader); - Pointer.Read(reader); + LegacyPointer.Read(reader); + LegacyPointer.Read(reader); reader.ReadString(0x1E); reader.ReadString(0x1E); @@ -271,38 +272,38 @@ async UniTask LoadLVL() { loadingState = "Loading globals"; await WaitIfNecessary(); globals.off_transitDynamicWorld = null; - globals.off_actualWorld = Pointer.Read(reader); - globals.off_dynamicWorld = Pointer.Read(reader); - globals.off_fatherSector = Pointer.Read(reader); // It is I, Father Sector. - globals.off_firstSubMapPosition = Pointer.Read(reader); + globals.off_actualWorld = LegacyPointer.Read(reader); + globals.off_dynamicWorld = LegacyPointer.Read(reader); + globals.off_fatherSector = LegacyPointer.Read(reader); // It is I, Father Sector. + globals.off_firstSubMapPosition = LegacyPointer.Read(reader); globals.num_always = reader.ReadUInt32(); - globals.spawnablePersos = LinkedList.ReadHeader(reader, Pointer.Current(reader), LinkedList.Type.Double); - Pointer.Read(reader); - globals.off_always_reusableSO = Pointer.Read(reader); // There are (num_always) empty SuperObjects starting with this one. - globals.off_always_reusableUnknown1 = Pointer.Read(reader); // (num_always) * 0x2c blocks - globals.off_always_reusableUnknown2 = Pointer.Read(reader); // (num_always) * 0x4 blocks + globals.spawnablePersos = LinkedList.ReadHeader(reader, LegacyPointer.Current(reader), LinkedList.Type.Double); + LegacyPointer.Read(reader); + globals.off_always_reusableSO = LegacyPointer.Read(reader); // There are (num_always) empty SuperObjects starting with this one. + globals.off_always_reusableUnknown1 = LegacyPointer.Read(reader); // (num_always) * 0x2c blocks + globals.off_always_reusableUnknown2 = LegacyPointer.Read(reader); // (num_always) * 0x4 blocks // Settings for perso in fix? Lights? - Pointer.Read(reader); - Pointer.Read(reader); - Pointer.Read(reader); - - Pointer.Read(reader); // perso - Pointer.Read(reader); - Pointer off_unknown_first = Pointer.Read(reader); - Pointer off_unknown_last = Pointer.Read(reader); + LegacyPointer.Read(reader); + LegacyPointer.Read(reader); + LegacyPointer.Read(reader); + + LegacyPointer.Read(reader); // perso + LegacyPointer.Read(reader); + LegacyPointer off_unknown_first = LegacyPointer.Read(reader); + LegacyPointer off_unknown_last = LegacyPointer.Read(reader); uint num_unknown = reader.ReadUInt32(); - families = LinkedList.ReadHeader(reader, Pointer.Current(reader), type: LinkedList.Type.Double); + families = LinkedList.ReadHeader(reader, LegacyPointer.Current(reader), type: LinkedList.Type.Double); - Pointer off_alwaysActiveCharacters_first = Pointer.Read(reader); - Pointer off_alwaysActiveCharacters_last = Pointer.Read(reader); + LegacyPointer off_alwaysActiveCharacters_first = LegacyPointer.Read(reader); + LegacyPointer off_alwaysActiveCharacters_last = LegacyPointer.Read(reader); uint num_alwaysActiveChars = reader.ReadUInt32(); - Pointer.Read(reader); + LegacyPointer.Read(reader); reader.ReadUInt32(); - globals.off_camera = Pointer.Read(reader); + globals.off_camera = LegacyPointer.Read(reader); reader.ReadUInt32(); reader.ReadByte(); reader.ReadByte(); @@ -310,69 +311,69 @@ async UniTask LoadLVL() { reader.ReadByte(); //print(Pointer.Current(reader)); - Pointer.Read(reader); - Pointer off_unk0_first = Pointer.Read(reader); - Pointer off_unk0_last = Pointer.Read(reader); + LegacyPointer.Read(reader); + LegacyPointer off_unk0_first = LegacyPointer.Read(reader); + LegacyPointer off_unk0_last = LegacyPointer.Read(reader); uint num_unk = reader.ReadUInt32(); - Pointer off_unk = Pointer.Read(reader); + LegacyPointer off_unk = LegacyPointer.Read(reader); loadingState = "Loading level textures"; - await ReadTexturesLvl(reader, Pointer.Current(reader)); + await ReadTexturesLvl(reader, LegacyPointer.Current(reader)); - Pointer.Read(reader); // maybe perso in fix + LegacyPointer.Read(reader); // maybe perso in fix reader.ReadUInt32(); - Pointer.Read(reader); + LegacyPointer.Read(reader); uint num_soundMaterials = reader.ReadUInt32(); - Pointer off_soundMaterials = Pointer.Read(reader); - Pointer off_unkBlocks = Pointer.Read(reader); // 3 blocks of 0xb4 + LegacyPointer off_soundMaterials = LegacyPointer.Read(reader); + LegacyPointer off_unkBlocks = LegacyPointer.Read(reader); // 3 blocks of 0xb4 uint num_unkBlocks = reader.ReadUInt32(); - Pointer.Read(reader); + LegacyPointer.Read(reader); reader.ReadUInt32(); - BoundingVolume.Read(reader, Pointer.Current(reader), BoundingVolume.Type.Box); + BoundingVolume.Read(reader, LegacyPointer.Current(reader), BoundingVolume.Type.Box); reader.ReadUInt16(); reader.ReadUInt16(); - Pointer.Read(reader); + LegacyPointer.Read(reader); reader.ReadUInt32(); uint num_ipo = reader.ReadUInt32(); // Entries with an IPO SO pointer and a mesh pointer, then a pointer to an empty offset. RLI table? - Pointer off_ipo = Pointer.Read(reader); + LegacyPointer off_ipo = LegacyPointer.Read(reader); reader.ReadBytes(0x30); uint num_unkPtrs = reader.ReadUInt32(); for (int i = 0; i < num_unkPtrs; i++) { - Pointer.Read(reader); + LegacyPointer.Read(reader); } reader.ReadBytes(0x10d8); // that's a lot of null bytes uint num_shadowDQ = reader.ReadUInt32(); for (int i = 0; i < 21; i++) { - Pointer.Read(reader); + LegacyPointer.Read(reader); } uint num_shadowHQ = reader.ReadUInt32(); for (int i = 0; i < 21; i++) { - Pointer.Read(reader); + LegacyPointer.Read(reader); } - localization = FromOffsetOrRead(reader, Pointer.Current(reader), inline: true); + localization = FromOffsetOrRead(reader, LegacyPointer.Current(reader), inline: true); //print("Yay " + Pointer.Current(reader)); reader.ReadUInt16(); reader.ReadUInt16(); reader.ReadUInt32(); uint num_lightmaps = reader.ReadUInt32(); - Pointer off_lightmapUVs = Pointer.Read(reader); - Pointer.DoAt(ref reader, off_lightmapUVs, () => { - off_lightmapUV = new Pointer[num_lightmaps]; + LegacyPointer off_lightmapUVs = LegacyPointer.Read(reader); + LegacyPointer.DoAt(ref reader, off_lightmapUVs, () => { + off_lightmapUV = new LegacyPointer[num_lightmaps]; for (int i = 0; i < num_lightmaps; i++) { reader.ReadUInt32(); reader.ReadByte(); reader.ReadBytes(3); - off_lightmapUV[i] = Pointer.Read(reader); + off_lightmapUV[i] = LegacyPointer.Read(reader); } }); reader.ReadByte(); reader.ReadBytes(3); reader.ReadUInt32(); reader.ReadUInt32(); - Pointer.Read(reader); - Pointer.Read(reader); - Pointer.Read(reader); + LegacyPointer.Read(reader); + LegacyPointer.Read(reader); + LegacyPointer.Read(reader); // Parse actual world & always structure loadingState = "Loading families"; diff --git a/Assets/Scripts/OpenSpace/Loader/MapLoader.cs b/Assets/Scripts/OpenSpace/Loader/MapLoader.cs index 3f49cb7c..31846b22 100644 --- a/Assets/Scripts/OpenSpace/Loader/MapLoader.cs +++ b/Assets/Scripts/OpenSpace/Loader/MapLoader.cs @@ -21,6 +21,7 @@ using System.Threading.Tasks; using System.Diagnostics; using Cysharp.Threading.Tasks; +using BinarySerializer.Unity; namespace OpenSpace { public class MapLoader { @@ -43,7 +44,7 @@ public class MapLoader { public TextureInfo[] textures; public TextureInfo overlightTexture; public TextureInfo lightmapTexture; - public Pointer[] persoInFix; + public LegacyPointer[] persoInFix; public AnimationBank[] animationBanks; public LinkedList families; @@ -89,8 +90,8 @@ public bool HasTransit { public List objectLists = new List(); public List uncategorizedObjectLists = new List(); public List entryActions = new List(); - public Dictionary strings = new Dictionary(); - public Dictionary> structs = new Dictionary>(); + public Dictionary strings = new Dictionary(); + public Dictionary> structs = new Dictionary>(); public GameObject familiesRoot = null; //List parsedGO = new List(); public List onPostLoad = new List(); @@ -108,12 +109,12 @@ public bool HasTransit { protected DSB gameDsb = null; protected DSB lvlDsb = null; protected Dictionary paths = new Dictionary(); - public Pointer[] off_lightmapUV; + public LegacyPointer[] off_lightmapUV; public Globals globals = null; - public Settings settings = null; + public Legacy_Settings settings = null; public List searchableStrings = new List(); - public Dictionary pointerTraces = new Dictionary(); + public Dictionary pointerTraces = new Dictionary(); public static class Mem { public const int Fix = 0; @@ -132,20 +133,20 @@ public static class Mem { public static MapLoader Loader { get { if (loader == null) { - if (Settings.s == null) return null; - if (Settings.s.engineVersion < Settings.EngineVersion.R3) { - switch (Settings.s.platform) { - case Settings.Platform.DC: loader = new R2DCLoader(); break; - case Settings.Platform.PS2: loader = new R2PS2Loader(); break; - case Settings.Platform.PS1: loader = new R2PS1Loader(); break; - case Settings.Platform.DS: - case Settings.Platform._3DS: - case Settings.Platform.N64: + if (Legacy_Settings.s == null) return null; + if (Legacy_Settings.s.engineVersion < Legacy_Settings.EngineVersion.R3) { + switch (Legacy_Settings.s.platform) { + case Legacy_Settings.Platform.DC: loader = new R2DCLoader(); break; + case Legacy_Settings.Platform.PS2: loader = new R2PS2Loader(); break; + case Legacy_Settings.Platform.PS1: loader = new R2PS1Loader(); break; + case Legacy_Settings.Platform.DS: + case Legacy_Settings.Platform._3DS: + case Legacy_Settings.Platform.N64: loader = new R2ROMLoader(); break; default: loader = new R2Loader(); break; } } else { - if (Settings.s.game == Settings.Game.LargoWinch) { + if (Legacy_Settings.s.game == Legacy_Settings.Game.LargoWinch) { loader = new LWLoader(); } else { loader = new R3Loader(); @@ -274,84 +275,84 @@ public async UniTask LoadMemory() { Reader reader = mem.reader; // Read object names - Pointer.Goto(ref reader, new Pointer(Settings.s.memoryAddresses["objectTypes"], mem)); + LegacyPointer.Goto(ref reader, new LegacyPointer(Legacy_Settings.s.memoryAddresses["objectTypes"], mem)); objectTypes = new ObjectType[3][]; for (uint i = 0; i < 3; i++) { - Pointer off_names_header = Pointer.Current(reader); - Pointer off_names_first = Pointer.Read(reader); - Pointer off_names_last = Pointer.Read(reader); + LegacyPointer off_names_header = LegacyPointer.Current(reader); + LegacyPointer off_names_first = LegacyPointer.Read(reader); + LegacyPointer off_names_last = LegacyPointer.Read(reader); uint num_names = reader.ReadUInt32(); ReadObjectNamesTable(reader, off_names_first, num_names, i); } // Read globals - Pointer.Goto(ref reader, new Pointer(Settings.s.memoryAddresses["actualWorld"], mem)); - globals.off_actualWorld = Pointer.Read(reader); - Pointer.Goto(ref reader, new Pointer(Settings.s.memoryAddresses["dynamicWorld"], mem)); - globals.off_dynamicWorld = Pointer.Read(reader); - Pointer.Goto(ref reader, new Pointer(Settings.s.memoryAddresses["inactiveDynamicWorld"], mem)); - globals.off_inactiveDynamicWorld = Pointer.Read(reader); - Pointer.Goto(ref reader, new Pointer(Settings.s.memoryAddresses["fatherSector"], mem)); - globals.off_fatherSector = Pointer.Read(reader); - Pointer.Goto(ref reader, new Pointer(Settings.s.memoryAddresses["firstSubmapPosition"], mem)); - globals.off_firstSubMapPosition = Pointer.Read(reader); - Pointer.Goto(ref reader, new Pointer(Settings.s.memoryAddresses["always"], mem)); + LegacyPointer.Goto(ref reader, new LegacyPointer(Legacy_Settings.s.memoryAddresses["actualWorld"], mem)); + globals.off_actualWorld = LegacyPointer.Read(reader); + LegacyPointer.Goto(ref reader, new LegacyPointer(Legacy_Settings.s.memoryAddresses["dynamicWorld"], mem)); + globals.off_dynamicWorld = LegacyPointer.Read(reader); + LegacyPointer.Goto(ref reader, new LegacyPointer(Legacy_Settings.s.memoryAddresses["inactiveDynamicWorld"], mem)); + globals.off_inactiveDynamicWorld = LegacyPointer.Read(reader); + LegacyPointer.Goto(ref reader, new LegacyPointer(Legacy_Settings.s.memoryAddresses["fatherSector"], mem)); + globals.off_fatherSector = LegacyPointer.Read(reader); + LegacyPointer.Goto(ref reader, new LegacyPointer(Legacy_Settings.s.memoryAddresses["firstSubmapPosition"], mem)); + globals.off_firstSubMapPosition = LegacyPointer.Read(reader); + LegacyPointer.Goto(ref reader, new LegacyPointer(Legacy_Settings.s.memoryAddresses["always"], mem)); globals.num_always = reader.ReadUInt32(); - globals.spawnablePersos = LinkedList.ReadHeader(reader, Pointer.Current(reader), LinkedList.Type.Double); - globals.off_always_reusableSO = Pointer.Read(reader); // There are (num_always) empty SuperObjects starting with this one. - globals.off_always_reusableUnknown1 = Pointer.Read(reader); // (num_always) * 0x2c blocks - globals.off_always_reusableUnknown2 = Pointer.Read(reader); // (num_always) * 0x4 blocks - Pointer.Goto(ref reader, new Pointer(Settings.s.memoryAddresses["families"], mem)); - families = LinkedList.ReadHeader(reader, Pointer.Current(reader), type: LinkedList.Type.Double); + globals.spawnablePersos = LinkedList.ReadHeader(reader, LegacyPointer.Current(reader), LinkedList.Type.Double); + globals.off_always_reusableSO = LegacyPointer.Read(reader); // There are (num_always) empty SuperObjects starting with this one. + globals.off_always_reusableUnknown1 = LegacyPointer.Read(reader); // (num_always) * 0x2c blocks + globals.off_always_reusableUnknown2 = LegacyPointer.Read(reader); // (num_always) * 0x4 blocks + LegacyPointer.Goto(ref reader, new LegacyPointer(Legacy_Settings.s.memoryAddresses["families"], mem)); + families = LinkedList.ReadHeader(reader, LegacyPointer.Current(reader), type: LinkedList.Type.Double); animationBanks = new AnimationBank[2]; // Read animations - Pointer.Goto(ref reader, new Pointer(Settings.s.memoryAddresses["anim_stacks"], mem)); - if (Settings.s.engineVersion < Settings.EngineVersion.R3) { - animationBanks[0] = AnimationBank.Read(reader, Pointer.Current(reader), 0, 1, null)[0]; + LegacyPointer.Goto(ref reader, new LegacyPointer(Legacy_Settings.s.memoryAddresses["anim_stacks"], mem)); + if (Legacy_Settings.s.engineVersion < Legacy_Settings.EngineVersion.R3) { + animationBanks[0] = AnimationBank.Read(reader, LegacyPointer.Current(reader), 0, 1, null)[0]; animationBanks[1] = animationBanks[0]; } else { - animationBanks = AnimationBank.Read(reader, Pointer.Current(reader), 0, 5, null); + animationBanks = AnimationBank.Read(reader, LegacyPointer.Current(reader), 0, 5, null); } // Read textures uint[] texMemoryChannels = new uint[1024]; - Pointer.Goto(ref reader, new Pointer(Settings.s.memoryAddresses["textureMemoryChannels"], mem)); + LegacyPointer.Goto(ref reader, new LegacyPointer(Legacy_Settings.s.memoryAddresses["textureMemoryChannels"], mem)); for (int i = 0; i < 1024; i++) { texMemoryChannels[i] = reader.ReadUInt32(); } - Pointer.Goto(ref reader, new Pointer(Settings.s.memoryAddresses["textures"], mem)); + LegacyPointer.Goto(ref reader, new LegacyPointer(Legacy_Settings.s.memoryAddresses["textures"], mem)); List textureInfos = new List(); for (int i = 0; i < 1024; i++) { - Pointer off_texture = Pointer.Read(reader); + LegacyPointer off_texture = LegacyPointer.Read(reader); if (off_texture != null && texMemoryChannels[i] != 0xC0DE0005) { - Pointer off_current = Pointer.Goto(ref reader, off_texture); + LegacyPointer off_current = LegacyPointer.Goto(ref reader, off_texture); TextureInfo texInfo = TextureInfo.Read(reader, off_texture); //texInfo.ReadTextureFromData(reader); // Reading from GL memory doesn't seem to be possible sadly // texInfo.Texture = Util.CreateDummyTexture(); GF gf = cnt.GetGFByTGAName(texInfo.name); texInfo.Texture = gf != null ? gf.GetTexture() : null; textureInfos.Add(texInfo); - Pointer.Goto(ref reader, off_current); + LegacyPointer.Goto(ref reader, off_current); } } textures = textureInfos.ToArray(); // Parse materials list - if (Settings.s.memoryAddresses.ContainsKey("visualMaterials") && Settings.s.memoryAddresses.ContainsKey("num_visualMaterials")) { - Pointer.Goto(ref reader, new Pointer(Settings.s.memoryAddresses["num_visualMaterials"], mem)); + if (Legacy_Settings.s.memoryAddresses.ContainsKey("visualMaterials") && Legacy_Settings.s.memoryAddresses.ContainsKey("num_visualMaterials")) { + LegacyPointer.Goto(ref reader, new LegacyPointer(Legacy_Settings.s.memoryAddresses["num_visualMaterials"], mem)); uint num_visual_materials = reader.ReadUInt32(); - Pointer.Goto(ref reader, new Pointer(Settings.s.memoryAddresses["visualMaterials"], mem)); - Pointer off_visualMaterials = Pointer.Read(reader); + LegacyPointer.Goto(ref reader, new LegacyPointer(Legacy_Settings.s.memoryAddresses["visualMaterials"], mem)); + LegacyPointer off_visualMaterials = LegacyPointer.Read(reader); if (off_visualMaterials != null) { - Pointer.Goto(ref reader, off_visualMaterials); + LegacyPointer.Goto(ref reader, off_visualMaterials); for (uint i = 0; i < num_visual_materials; i++) { - Pointer off_material = Pointer.Read(reader); - Pointer off_current_mat = Pointer.Goto(ref reader, off_material); + LegacyPointer off_material = LegacyPointer.Read(reader); + LegacyPointer off_current_mat = LegacyPointer.Goto(ref reader, off_material); visualMaterials.Add(VisualMaterial.Read(reader, off_material)); - Pointer.Goto(ref reader, off_current_mat); + LegacyPointer.Goto(ref reader, off_current_mat); } } } @@ -362,14 +363,14 @@ public async UniTask LoadMemory() { Debug.LogError("BRIGHTNESS IS " + brightness); }*/ - Pointer.Goto(ref reader, new Pointer(Settings.s.memoryAddresses["inputStructure"], mem)); - inputStruct = InputStructure.Read(reader, Pointer.Current(reader)); + LegacyPointer.Goto(ref reader, new LegacyPointer(Legacy_Settings.s.memoryAddresses["inputStructure"], mem)); + inputStruct = InputStructure.Read(reader, LegacyPointer.Current(reader)); foreach (EntryAction ea in inputStruct.entryActions) { print(ea.ToString()); } - Pointer.Goto(ref reader, new Pointer(Settings.s.memoryAddresses["localizationStructure"], mem)); - localization = FromOffsetOrRead(reader, Pointer.Current(reader), inline: true); + LegacyPointer.Goto(ref reader, new LegacyPointer(Legacy_Settings.s.memoryAddresses["localizationStructure"], mem)); + localization = FromOffsetOrRead(reader, LegacyPointer.Current(reader), inline: true); // Parse actual world & always structure ReadFamilies(reader); @@ -378,7 +379,7 @@ public async UniTask LoadMemory() { ReadCrossReferences(reader); // TODO: Make more generic - if (Settings.s.game == Settings.Game.R2) { + if (Legacy_Settings.s.game == Legacy_Settings.Game.R2) { string path = gameDataBinFolder + "R2DC_Comports.json"; if (!FileSystem.FileExists(path)) { path = "Assets/StreamingAssets/R2DC_Comports.json"; // Offline, the json doesn't exist, so grab it from StreamingAssets @@ -441,35 +442,35 @@ public FileWithPointers InitExtraLVL(string name, string lvlPath, string ptrPath protected async UniTask CreateCNT() { await WaitIfNecessary(); - if (Settings.s.mode == Settings.Mode.Rayman3PS2Demo_2002_05_17 && exportTextures) { + if (Legacy_Settings.s.mode == Legacy_Settings.Mode.Rayman3PS2Demo_2002_05_17 && exportTextures) { List cntPaths = new List(); - cntPaths.Add(gameDataBinFolder + ConvertCase("TEXTURES.CNT", Settings.CapsType.All)); + cntPaths.Add(gameDataBinFolder + ConvertCase("TEXTURES.CNT", Legacy_Settings.CapsType.All)); if (cntPaths.Count > 0) { foreach (string path in cntPaths) { await PrepareBigFile(path, 512 * 1024); } cnt = new CNT(cntPaths.ToArray()); } - TBF tbf = new TBF(gameDataBinFolder + ConvertCase("TEXTURES.TXC", Settings.CapsType.All), hasNames: true); + TBF tbf = new TBF(gameDataBinFolder + ConvertCase("TEXTURES.TXC", Legacy_Settings.CapsType.All), hasNames: true); string textureFolder = "textures_txc/"; for (int i = 0; i < tbf.headers.Length; i++) { Util.ByteArrayToFile(gameDataBinFolder + textureFolder + tbf.headers[i].name.ToLower().Substring(0, tbf.headers[i].name.LastIndexOf('.')) + ".png", tbf.headers[i].texture.EncodeToPNG()); } } - if (Settings.s.game == Settings.Game.LargoWinch) { + if (Legacy_Settings.s.game == Legacy_Settings.Game.LargoWinch) { cntPaths = new string[1]; cntPaths[0] = gameDataBinFolder + "Vignette.cnt"; foreach (string path in cntPaths) { await PrepareBigFile(path, 512 * 1024); } cnt = new CNT(cntPaths); - } else if (Settings.s.engineVersion < Settings.EngineVersion.R3) { - if (Settings.s.platform != Settings.Platform.DC && - Settings.s.platform != Settings.Platform.PS1 && - Settings.s.platform != Settings.Platform.PS2) { + } else if (Legacy_Settings.s.engineVersion < Legacy_Settings.EngineVersion.R3) { + if (Legacy_Settings.s.platform != Legacy_Settings.Platform.DC && + Legacy_Settings.s.platform != Legacy_Settings.Platform.PS1 && + Legacy_Settings.s.platform != Legacy_Settings.Platform.PS2) { List cntPaths = new List(); - if (gameDsb.bigfileTextures != null) cntPaths.Add(gameDataBinFolder + ConvertCase(ConvertPath(gameDsb.bigfileTextures), Settings.CapsType.All)); - if (gameDsb.bigfileVignettes != null) cntPaths.Add(gameDataBinFolder + ConvertCase(ConvertPath(gameDsb.bigfileVignettes), Settings.CapsType.All)); + if (gameDsb.bigfileTextures != null) cntPaths.Add(gameDataBinFolder + ConvertCase(ConvertPath(gameDsb.bigfileTextures), Legacy_Settings.CapsType.All)); + if (gameDsb.bigfileVignettes != null) cntPaths.Add(gameDataBinFolder + ConvertCase(ConvertPath(gameDsb.bigfileVignettes), Legacy_Settings.CapsType.All)); if (cntPaths.Count > 0) { foreach (string path in cntPaths) { await PrepareBigFile(path, 512 * 1024); @@ -478,8 +479,8 @@ protected async UniTask CreateCNT() { } } } else { - if (Settings.s.platform == Settings.Platform.PC || Settings.s.platform == Settings.Platform.MacOS) { - if (Settings.s.game == Settings.Game.R3 && Settings.s.mode == Settings.Mode.Rayman3PC) { + if (Legacy_Settings.s.platform == Legacy_Settings.Platform.PC || Legacy_Settings.s.platform == Legacy_Settings.Platform.MacOS) { + if (Legacy_Settings.s.game == Legacy_Settings.Game.R3 && Legacy_Settings.s.mode == Legacy_Settings.Mode.Rayman3PC) { cntPaths = new string[3]; cntPaths[0] = gameDataBinFolder + "vignette.cnt"; cntPaths[1] = gameDataBinFolder + "tex32_1.cnt"; @@ -488,7 +489,7 @@ protected async UniTask CreateCNT() { await PrepareBigFile(path, 512 * 1024); } cnt = new CNT(cntPaths); - } else if (Settings.s.game == Settings.Game.R3 || Settings.s.game == Settings.Game.RA || Settings.s.game == Settings.Game.RM) { + } else if (Legacy_Settings.s.game == Legacy_Settings.Game.R3 || Legacy_Settings.s.game == Legacy_Settings.Game.RA || Legacy_Settings.s.game == Legacy_Settings.Game.RM) { cntPaths = new string[2]; cntPaths[0] = gameDataBinFolder + "vignette.cnt"; cntPaths[1] = gameDataBinFolder + "tex32.cnt"; @@ -496,7 +497,7 @@ protected async UniTask CreateCNT() { await PrepareBigFile(path, 512 * 1024); } cnt = new CNT(cntPaths); - } else if (Settings.s.game == Settings.Game.Dinosaur) { + } else if (Legacy_Settings.s.game == Legacy_Settings.Game.Dinosaur) { cntPaths = new string[2]; cntPaths[0] = gameDataBinFolder + "VIGNETTE.CNT"; cntPaths[1] = gameDataBinFolder + "TEXTURES.CNT"; @@ -516,7 +517,7 @@ protected async UniTask CreateCNT() { await MapLoader.WaitIfNecessary(); // Export all textures in cnt string textureFolder = "textures/"; - if(Settings.s.mode == Settings.Mode.Rayman3PS2Demo_2002_05_17) textureFolder = "textures_cnt/"; + if(Legacy_Settings.s.mode == Legacy_Settings.Mode.Rayman3PS2Demo_2002_05_17) textureFolder = "textures_cnt/"; foreach (CNT.FileStruct file in cnt.fileList) { GF gf = cnt.GetGF(file); Util.ByteArrayToFile(gameDataBinFolder + textureFolder + file.FullName.Replace(".gf", ".png"), gf.GetTexture().EncodeToPNG()); @@ -529,44 +530,44 @@ protected async UniTask CreateCNT() { } } - public void FillLinkedListPointers(Reader reader, Pointer lastEntry, Pointer header, uint nextOffset = 0, uint prevOffset = 4, uint headerOffset = 8) { - Pointer current_entry = lastEntry; - Pointer next_entry = null; - Pointer off_current = Pointer.Current(reader); + public void FillLinkedListPointers(Reader reader, LegacyPointer lastEntry, LegacyPointer header, uint nextOffset = 0, uint prevOffset = 4, uint headerOffset = 8) { + LegacyPointer current_entry = lastEntry; + LegacyPointer next_entry = null; + LegacyPointer off_current = LegacyPointer.Current(reader); while (current_entry != null) { - Pointer.Goto(ref reader, current_entry); + LegacyPointer.Goto(ref reader, current_entry); current_entry.file.AddPointer(current_entry.offset + nextOffset, next_entry); if (header != null) { current_entry.file.AddPointer(current_entry.offset + headerOffset, header); } next_entry = current_entry; - current_entry = Pointer.GetPointerAtOffset(current_entry + prevOffset); + current_entry = LegacyPointer.GetPointerAtOffset(current_entry + prevOffset); } - Pointer.Goto(ref reader, off_current); + LegacyPointer.Goto(ref reader, off_current); } - public void ReadObjectNamesTable(Reader reader, Pointer off_names_first, uint num_names, uint index) { - Pointer off_current = Pointer.Goto(ref reader, off_names_first); + public void ReadObjectNamesTable(Reader reader, LegacyPointer off_names_first, uint num_names, uint index) { + LegacyPointer off_current = LegacyPointer.Goto(ref reader, off_names_first); objectTypes[index] = new ObjectType[num_names]; for (int j = 0; j < num_names; j++) { objectTypes[index][j] = new ObjectType(); - Pointer off_names_next = Pointer.Read(reader); - Pointer off_names_prev = Pointer.Read(reader); - Pointer off_header = Pointer.Read(reader); - Pointer off_name = Pointer.Read(reader); + LegacyPointer off_names_next = LegacyPointer.Read(reader); + LegacyPointer off_names_prev = LegacyPointer.Read(reader); + LegacyPointer off_header = LegacyPointer.Read(reader); + LegacyPointer off_name = LegacyPointer.Read(reader); objectTypes[index][j].unk1 = reader.ReadByte(); objectTypes[index][j].id = reader.ReadByte(); objectTypes[index][j].unk2 = reader.ReadUInt16(); - Pointer.Goto(ref reader, off_name); + LegacyPointer.Goto(ref reader, off_name); objectTypes[index][j].name = reader.ReadNullDelimitedString(); - if (off_names_next != null) Pointer.Goto(ref reader, off_names_next); + if (off_names_next != null) LegacyPointer.Goto(ref reader, off_names_next); } - Pointer.Goto(ref reader, off_current); + LegacyPointer.Goto(ref reader, off_current); } - public void ReadKeypadDefine(Reader reader, Pointer off_keypadDefine) { + public void ReadKeypadDefine(Reader reader, LegacyPointer off_keypadDefine) { if (off_keypadDefine == null) return; - Pointer.DoAt(ref reader, off_keypadDefine, () => { + LegacyPointer.DoAt(ref reader, off_keypadDefine, () => { bool readKeypadDefine = true; while (readKeypadDefine) { KeypadEntry entry = new KeypadEntry(); @@ -576,14 +577,14 @@ public void ReadKeypadDefine(Reader reader, Pointer off_keypadDefine) { /* Interestingly, some pointers in this list are not in the relocation table. * and don't point to any key name, so they can't be read with Pointer.Read. * Perhaps restoring this can help to restore debug functions... */ - Pointer off_name = Pointer.GetPointerAtOffset(Pointer.Current(reader)); + LegacyPointer off_name = LegacyPointer.GetPointerAtOffset(LegacyPointer.Current(reader)); reader.ReadUInt32(); - Pointer off_name2 = Pointer.GetPointerAtOffset(Pointer.Current(reader)); + LegacyPointer off_name2 = LegacyPointer.GetPointerAtOffset(LegacyPointer.Current(reader)); reader.ReadUInt32(); - Pointer.DoAt(ref reader, off_name, () => { + LegacyPointer.DoAt(ref reader, off_name, () => { entry.name = reader.ReadNullDelimitedString(); }); - Pointer.DoAt(ref reader, off_name2, () => { + LegacyPointer.DoAt(ref reader, off_name2, () => { entry.name2 = reader.ReadNullDelimitedString(); }); keypadEntries.Add(entry); @@ -592,14 +593,14 @@ public void ReadKeypadDefine(Reader reader, Pointer off_keypadDefine) { }); } - public void ReadLevelNames(Reader reader, Pointer off_levels, uint num_levels) { + public void ReadLevelNames(Reader reader, LegacyPointer off_levels, uint num_levels) { levels = new string[num_levels]; for (uint i = 0; i < num_levels; i++) { levels[i] = reader.ReadString(0x1E); } } - public void ReadLanguages(Reader reader, Pointer off_languages, uint num_languages) { + public void ReadLanguages(Reader reader, LegacyPointer off_languages, uint num_languages) { languages = new string[num_languages]; languages_loc = new string[num_languages]; for (uint i = 0; i < num_languages; i++) { @@ -609,9 +610,9 @@ public void ReadLanguages(Reader reader, Pointer off_languages, uint num_languag } } - protected async UniTask ReadTexturesFix(Reader reader, Pointer off_textures) { + protected async UniTask ReadTexturesFix(Reader reader, LegacyPointer off_textures) { uint num_textureMemoryChannels = 0; - if (Settings.s.engineVersion <= Settings.EngineVersion.R2) num_textureMemoryChannels = reader.ReadUInt32(); + if (Legacy_Settings.s.engineVersion <= Legacy_Settings.EngineVersion.R2) num_textureMemoryChannels = reader.ReadUInt32(); uint num_textures = reader.ReadUInt32(); print("Texture count fix: " + num_textures); string state = loadingState; @@ -621,19 +622,19 @@ protected async UniTask ReadTexturesFix(Reader reader, Pointer off_textures) { loadingState = "Loading fixed textures"; await UniTask.WaitForEndOfFrame(); for (uint i = 0; i < num_textures; i++) { - Pointer off_texture = Pointer.Read(reader); - Pointer.DoAt(ref reader, off_texture, () => { + LegacyPointer off_texture = LegacyPointer.Read(reader); + LegacyPointer.DoAt(ref reader, off_texture, () => { textures[i] = TextureInfo.Read(reader, off_texture); }); } - if (Settings.s.platform == Settings.Platform.GC) { + if (Legacy_Settings.s.platform == Legacy_Settings.Platform.GC) { Dictionary texturesSeenFile = new Dictionary(); TPL fixTPL = new TPL(paths["fix.tpl"]); - if (Settings.s.game == Settings.Game.R3) { + if (Legacy_Settings.s.game == Legacy_Settings.Game.R3) { uint num_textures_menu = reader.ReadUInt32(); TPL menuTPL = new TPL(paths["menu.tpl"]); for (uint i = 0; i < num_textures_menu; i++) { - Pointer off_texture = Pointer.Read(reader); + LegacyPointer off_texture = LegacyPointer.Read(reader); TextureInfo tex = textures.Where(t => t.offset == off_texture).First(); /*if (exportTextures) { Util.ByteArrayToFile(gameDataBinFolder + "textures/" + tex.name.Substring(0, tex.name.LastIndexOf('.')) + ".png", menuTPL.textures[i].EncodeToPNG()); @@ -658,7 +659,7 @@ protected async UniTask ReadTexturesFix(Reader reader, Pointer off_textures) { textures[i].Texture = tex; texturesSeenFile[file_texture]++; } - } else if (Settings.s.platform == Settings.Platform.Xbox || Settings.s.platform == Settings.Platform.Xbox360) { + } else if (Legacy_Settings.s.platform == Legacy_Settings.Platform.Xbox || Legacy_Settings.s.platform == Legacy_Settings.Platform.Xbox360) { Dictionary texturesSeenFile = new Dictionary(); BTF fixBTF = new BTF(paths["fix.btf"], paths["fix.bhf"]); @@ -678,9 +679,9 @@ protected async UniTask ReadTexturesFix(Reader reader, Pointer off_textures) { textures[i].Texture = tex; texturesSeenFile[file_texture]++; } - } else if (Settings.s.platform == Settings.Platform.PS2) { + } else if (Legacy_Settings.s.platform == Legacy_Settings.Platform.PS2) { Dictionary texturesSeenFile = new Dictionary(); - bool hasNames = (Settings.s.game == Settings.Game.RM || Settings.s.game == Settings.Game.RA); + bool hasNames = (Legacy_Settings.s.game == Legacy_Settings.Game.RM || Legacy_Settings.s.game == Legacy_Settings.Game.RA); TBF fixTBF = null; if (FileSystem.FileExists(paths["fix.tbf"])) { fixTBF = new TBF(paths["fix.tbf"], hasNames: hasNames); @@ -715,7 +716,7 @@ protected async UniTask ReadTexturesFix(Reader reader, Pointer off_textures) { Util.ByteArrayToFile(gameDataBinFolder + "textures/" + /*type + "/" +*/ fixTBF.headers[i].name.ToLower().Substring(0, fixTBF.headers[i].name.LastIndexOf('.')) + ".png", fixTBF.headers[i].texture.EncodeToPNG()); } } - } else if(Settings.s.platform == Settings.Platform.PS3) { + } else if(Legacy_Settings.s.platform == Legacy_Settings.Platform.PS3) { Dictionary texturesSeenFile = new Dictionary(); for (int i = 0, j = 0; i < num_textures; i++, j++) { uint file_texture = reader.ReadUInt32(); @@ -735,13 +736,13 @@ protected async UniTask ReadTexturesFix(Reader reader, Pointer off_textures) { textures[i].Texture = tex; texturesSeenFile[file_texture]++; } - } else if (Settings.s.platform == Settings.Platform.iOS) { + } else if (Legacy_Settings.s.platform == Legacy_Settings.Platform.iOS) { for (int i = 0; i < num_textures; i++) { loadingState = "Loading fixed textures: " + (i+1) + "/" + num_textures; await WaitIfNecessary(); string texturePath = "World/Graphics/Textures/" + textures[i].name.Substring(0, textures[i].name.LastIndexOf('.')) + ".gf"; texturePath = texturePath.Replace('\\', '/'); - if (Settings.s.platform == Settings.Platform.iOS) { + if (Legacy_Settings.s.platform == Legacy_Settings.Platform.iOS) { texturePath = texturePath.ToUpper(); } texturePath = gameDataBinFolder + texturePath; @@ -758,7 +759,7 @@ protected async UniTask ReadTexturesFix(Reader reader, Pointer off_textures) { if (gf != null) textures[i].Texture = gf.GetTexture(); } // Memory channels, eg which file is this - if (Settings.s.engineVersion == Settings.EngineVersion.R3) { + if (Legacy_Settings.s.engineVersion == Legacy_Settings.EngineVersion.R3) { for (uint i = 0; i < num_textures; i++) { reader.ReadUInt32(); // 0 or 8. } @@ -769,7 +770,7 @@ protected async UniTask ReadTexturesFix(Reader reader, Pointer off_textures) { loadingState = state; } - protected async UniTask ReadTexturesLvl(Reader reader, Pointer off_textures) { + protected async UniTask ReadTexturesLvl(Reader reader, LegacyPointer off_textures) { uint num_textures_fix = (uint)textures.Length, num_memoryChannels = 0, num_textures_lvl = 0, @@ -777,21 +778,21 @@ protected async UniTask ReadTexturesLvl(Reader reader, Pointer off_textures) { string state = loadingState; loadingState = "Loading level textures"; - if (Settings.s.engineVersion <= Settings.EngineVersion.R2 || Settings.s.game == Settings.Game.LargoWinch) { + if (Legacy_Settings.s.engineVersion <= Legacy_Settings.EngineVersion.R2 || Legacy_Settings.s.game == Legacy_Settings.Game.LargoWinch) { num_textures_fix = (uint)textures.Length; num_memoryChannels = reader.ReadUInt32(); num_textures_lvl = reader.ReadUInt32(); num_textures_total = num_textures_fix + num_textures_lvl; } else { - if (Settings.s.platform == Settings.Platform.PS2 - && (Settings.s.game == Settings.Game.R3 - || Settings.s.game == Settings.Game.DDPK) - && Settings.s.mode != Settings.Mode.Rayman3PS2Demo_2002_05_17) { + if (Legacy_Settings.s.platform == Legacy_Settings.Platform.PS2 + && (Legacy_Settings.s.game == Legacy_Settings.Game.R3 + || Legacy_Settings.s.game == Legacy_Settings.Game.DDPK) + && Legacy_Settings.s.mode != Legacy_Settings.Mode.Rayman3PS2Demo_2002_05_17) { num_textures_lvl = reader.ReadUInt32(); num_textures_fix = (uint)textures.Length; num_textures_total = num_textures_fix + num_textures_lvl; } else { - bool readTotal = (Settings.s.platform == Settings.Platform.GC || Settings.s.platform == Settings.Platform.PS2); + bool readTotal = (Legacy_Settings.s.platform == Legacy_Settings.Platform.GC || Legacy_Settings.s.platform == Legacy_Settings.Platform.PS2); num_textures_total = readTotal ? reader.ReadUInt32() : 1024; num_textures_fix = readTotal ? (uint)textures.Length : reader.ReadUInt32(); num_textures_lvl = num_textures_total - num_textures_fix; @@ -799,19 +800,19 @@ protected async UniTask ReadTexturesLvl(Reader reader, Pointer off_textures) { } Array.Resize(ref textures, (int)num_textures_total); for (uint i = num_textures_fix; i < num_textures_total; i++) { - Pointer off_texture = Pointer.Read(reader); - Pointer.DoAt(ref reader, off_texture, () => { + LegacyPointer off_texture = LegacyPointer.Read(reader); + LegacyPointer.DoAt(ref reader, off_texture, () => { textures[i] = TextureInfo.Read(reader, off_texture); }); } - if (Settings.s.engineVersion <= Settings.EngineVersion.R2) { + if (Legacy_Settings.s.engineVersion <= Legacy_Settings.EngineVersion.R2) { uint num_texturesToCreate = reader.ReadUInt32(); for (uint i = 0; i < num_textures_fix; i++) { // ? reader.ReadUInt32(); //1 } uint currentMemoryChannel = reader.ReadUInt32(); } - if (Settings.s.platform == Settings.Platform.GC) { + if (Legacy_Settings.s.platform == Legacy_Settings.Platform.GC) { // Load textures from TPL //TPL fixTPL = null; TPL lvlTPL = new TPL(paths["lvl.tpl"]); @@ -843,7 +844,7 @@ protected async UniTask ReadTexturesLvl(Reader reader, Pointer off_textures) { textures[i].Texture = tex; texturesSeenFile[file_texture]++; } - } else if (Settings.s.platform == Settings.Platform.Xbox || Settings.s.platform == Settings.Platform.Xbox360) { + } else if (Legacy_Settings.s.platform == Legacy_Settings.Platform.Xbox || Legacy_Settings.s.platform == Legacy_Settings.Platform.Xbox360) { // Load textures from TPL BTF fixBTF = null; BTF lvlBTF = new BTF(paths["lvl.btf"], paths["lvl.bhf"]); @@ -871,7 +872,7 @@ protected async UniTask ReadTexturesLvl(Reader reader, Pointer off_textures) { if (file_texture == 0) { if (fixBTF == null) fixBTF = new BTF(paths["fix.btf"], paths["fix.bhf"]); tex = fixBTF.GetTexture((int)num_textures_fix + texturesSeenFile[file_texture], textures[i].width_, textures[i].height_); - if (Settings.s.game == Settings.Game.RA) { + if (Legacy_Settings.s.game == Legacy_Settings.Game.RA) { if (!texturesSeenFile.ContainsKey(2)) texturesSeenFile[2] = 0; texturesSeenFile[2]++; } @@ -886,17 +887,17 @@ protected async UniTask ReadTexturesLvl(Reader reader, Pointer off_textures) { textures[i].Texture = tex; texturesSeenFile[file_texture]++; } - } else if (Settings.s.platform == Settings.Platform.PS2) { + } else if (Legacy_Settings.s.platform == Legacy_Settings.Platform.PS2) { // Load textures from TPL TBF fixTBF = null; - bool hasNames = (Settings.s.game == Settings.Game.RM || Settings.s.game == Settings.Game.RA); + bool hasNames = (Legacy_Settings.s.game == Legacy_Settings.Game.RM || Legacy_Settings.s.game == Legacy_Settings.Game.RA); TBF lvlTBF = new TBF(paths["lvl.tbf"]); TBF transitTBF = hasTransit ? new TBF(paths["transit.tbf"]) : null; print("Lvl TBF Texture count: " + lvlTBF.Count); if (hasTransit) print("Transit TBF Texture count: " + transitTBF.Count); Dictionary texturesSeenFile = new Dictionary(); - if (Settings.s.game == Settings.Game.RM || Settings.s.game == Settings.Game.RA) { + if (Legacy_Settings.s.game == Legacy_Settings.Game.RM || Legacy_Settings.s.game == Legacy_Settings.Game.RA) { for (uint i = 0; i < num_textures_fix; i++) { Texture2D tex = lvlTBF.textures[i]; textures[i].Texture = tex; @@ -919,7 +920,7 @@ protected async UniTask ReadTexturesLvl(Reader reader, Pointer off_textures) { tex = fixTBF.textures[(int)num_textures_fix + texturesSeenFile[file_texture]]; } //type = string.Format("{0:X4}", fixTBF.headers[(int)num_textures_fix + texturesSeenFile[file_texture]].flags); - if (Settings.s.game == Settings.Game.RA || Settings.s.game == Settings.Game.RM) { + if (Legacy_Settings.s.game == Legacy_Settings.Game.RA || Legacy_Settings.s.game == Legacy_Settings.Game.RM) { if (!texturesSeenFile.ContainsKey(2)) texturesSeenFile[2] = 0; texturesSeenFile[2]++; } @@ -936,7 +937,7 @@ protected async UniTask ReadTexturesLvl(Reader reader, Pointer off_textures) { textures[i].Texture = tex; texturesSeenFile[file_texture]++; } - } else if(Settings.s.platform == Settings.Platform.PS3) { + } else if(Legacy_Settings.s.platform == Legacy_Settings.Platform.PS3) { Dictionary texturesSeenFile = new Dictionary(); for (uint i = num_textures_fix; i < num_textures_total; i++) { uint file_texture = reader.ReadUInt32(); @@ -956,7 +957,7 @@ protected async UniTask ReadTexturesLvl(Reader reader, Pointer off_textures) { textures[i].Texture = tex; texturesSeenFile[file_texture]++; } - } else if (Settings.s.platform == Settings.Platform.iOS || Settings.s.game == Settings.Game.RedPlanet) { + } else if (Legacy_Settings.s.platform == Legacy_Settings.Platform.iOS || Legacy_Settings.s.game == Legacy_Settings.Game.RedPlanet) { // Load textures from separate GF files for (uint i = num_textures_fix; i < num_textures_total; i++) { if (textures[i] == null) continue; @@ -964,7 +965,7 @@ protected async UniTask ReadTexturesLvl(Reader reader, Pointer off_textures) { await WaitIfNecessary(); string texturePath = "World/Graphics/Textures/" + textures[i].name.Substring(0, textures[i].name.LastIndexOf('.')) + ".gf"; texturePath = texturePath.Replace('\\', '/'); - if (Settings.s.platform == Settings.Platform.iOS) { + if (Legacy_Settings.s.platform == Legacy_Settings.Platform.iOS) { texturePath = texturePath.ToUpper(); } texturePath = gameDataBinFolder + texturePath; @@ -978,15 +979,15 @@ protected async UniTask ReadTexturesLvl(Reader reader, Pointer off_textures) { // Load textures from CNT int transitTexturesSeen = 0; int num_textures_level_real = 0; - Pointer off_current = Pointer.Current(reader); + LegacyPointer off_current = LegacyPointer.Current(reader); for (uint i = num_textures_fix; i < num_textures_total; i++) { - uint file_texture = Settings.s.engineVersion == Settings.EngineVersion.R3 ? reader.ReadUInt32() : 0; + uint file_texture = Legacy_Settings.s.engineVersion == Legacy_Settings.EngineVersion.R3 ? reader.ReadUInt32() : 0; if (file_texture == 0xC0DE2005 || textures[i] == null) continue; // texture is undefined num_textures_level_real++; } - Pointer.Goto(ref reader, off_current); + LegacyPointer.Goto(ref reader, off_current); int current_texture = 0; - if (Settings.s.game == Settings.Game.LargoWinch) { + if (Legacy_Settings.s.game == Legacy_Settings.Game.LargoWinch) { int fixTexturesSeen = 0; int lvlTexturesSeen = 0; PBT[] pbt = (this as LWLoader).pbt; @@ -1009,7 +1010,7 @@ protected async UniTask ReadTexturesLvl(Reader reader, Pointer off_textures) { } } else { for (uint i = num_textures_fix; i < num_textures_total; i++) { - uint file_texture = Settings.s.engineVersion == Settings.EngineVersion.R3 ? reader.ReadUInt32() : 0; + uint file_texture = Legacy_Settings.s.engineVersion == Legacy_Settings.EngineVersion.R3 ? reader.ReadUInt32() : 0; if (file_texture == 0xC0DE2005 || textures[i] == null) continue; // texture is undefined current_texture++; loadingState = "Loading level textures: " + current_texture + "/" + (num_textures_level_real); @@ -1080,16 +1081,16 @@ public void ReadAlways(Reader reader) { controller.SpawnableParent = new GameObject("Spawnable persos"); globals.spawnablePersos.ReadEntries(ref reader, (offset) => { uint index; - Pointer off_spawnable_perso; - if (Settings.s.game == Settings.Game.R2Revolution) { - off_spawnable_perso = Pointer.Read(reader); + LegacyPointer off_spawnable_perso; + if (Legacy_Settings.s.game == Legacy_Settings.Game.R2Revolution) { + off_spawnable_perso = LegacyPointer.Read(reader); index = reader.ReadUInt32(); } else { index = reader.ReadUInt32(); - off_spawnable_perso = Pointer.Read(reader); + off_spawnable_perso = LegacyPointer.Read(reader); } Perso perso = null; - Pointer.DoAt(ref reader, off_spawnable_perso, () => { + LegacyPointer.DoAt(ref reader, off_spawnable_perso, () => { perso = Perso.Read(reader, off_spawnable_perso, null); if (perso != null) { perso.Gao.transform.parent = controller.SpawnableParent.transform; @@ -1194,19 +1195,19 @@ protected async UniTask PrepareBigFile(string path, int cacheLength) { } } - public string ConvertCase(string path, Settings.CapsType capsType) { - Settings.Caps caps = Settings.Caps.Normal; - if (Settings.s.caps != null && Settings.s.caps.ContainsKey(capsType)) { - caps = Settings.s.caps[capsType]; - } else if (Settings.s.caps != null && Settings.s.caps.ContainsKey(Settings.CapsType.All)) { - caps = Settings.s.caps[Settings.CapsType.All]; + public string ConvertCase(string path, Legacy_Settings.CapsType capsType) { + Legacy_Settings.Caps caps = Legacy_Settings.Caps.Normal; + if (Legacy_Settings.s.caps != null && Legacy_Settings.s.caps.ContainsKey(capsType)) { + caps = Legacy_Settings.s.caps[capsType]; + } else if (Legacy_Settings.s.caps != null && Legacy_Settings.s.caps.ContainsKey(Legacy_Settings.CapsType.All)) { + caps = Legacy_Settings.s.caps[Legacy_Settings.CapsType.All]; } switch (caps) { - case Settings.Caps.All: + case Legacy_Settings.Caps.All: return path.ToUpper(); - case Settings.Caps.None: + case Legacy_Settings.Caps.None: return path.ToLower(); - case Settings.Caps.AllExceptExtension: + case Legacy_Settings.Caps.AllExceptExtension: if (path.LastIndexOf('.') > 0) { string pathWithoutExtension = path.Substring(0, path.LastIndexOf('.')).ToUpper(); return pathWithoutExtension + path.Substring(path.LastIndexOf('.')); @@ -1218,20 +1219,20 @@ public string ConvertCase(string path, Settings.CapsType capsType) { - public T FromOffset(Pointer pointer) where T : OpenSpaceStruct { + public T FromOffset(LegacyPointer pointer) where T : OpenSpaceStruct { if (pointer == null) return null; System.Type type = typeof(T); if (!structs.ContainsKey(type) || !structs[type].ContainsKey(pointer)) return null; return structs[type][pointer] as T; } - private T Read(Reader reader, Pointer pointer, Action onPreRead = null, bool inline = false) where T : OpenSpaceStruct, new() { + private T Read(Reader reader, LegacyPointer pointer, Action onPreRead = null, bool inline = false) where T : OpenSpaceStruct, new() { if (pointer != null) { T rs = new T(); rs.Init(pointer); System.Type type = typeof(T); if (!structs.ContainsKey(type)) { - structs[type] = new Dictionary(); + structs[type] = new Dictionary(); } if (!structs[type].ContainsKey(pointer)) { structs[type][pointer] = rs; @@ -1245,33 +1246,33 @@ public T FromOffset(Pointer pointer) where T : OpenSpaceStruct { return null; } - public T FromOffsetOrRead(Reader reader, Pointer pointer, Action onPreRead = null, bool inline = false) where T : OpenSpaceStruct, new() { + public T FromOffsetOrRead(Reader reader, LegacyPointer pointer, Action onPreRead = null, bool inline = false) where T : OpenSpaceStruct, new() { if (pointer == null) return null; T rs = FromOffset(pointer); - Pointer curPointer = pointer; + LegacyPointer curPointer = pointer; if (rs == null) { rs = Read(reader, pointer, onPreRead: onPreRead, inline: inline); } else { - if(inline) Pointer.Goto(ref reader, curPointer + rs.Size); + if(inline) LegacyPointer.Goto(ref reader, curPointer + rs.Size); } return rs; } - public T[] ReadArray(long length, Reader reader, Pointer pointer, Action onPreRead = null, bool inline = false) where T : OpenSpaceStruct, new() { + public T[] ReadArray(long length, Reader reader, LegacyPointer pointer, Action onPreRead = null, bool inline = false) where T : OpenSpaceStruct, new() { if (!inline && pointer == null) return new T[0]; T[] ts = new T[(int)length]; - Pointer curPointer = pointer != null ? pointer : Pointer.Current(reader); + LegacyPointer curPointer = pointer != null ? pointer : LegacyPointer.Current(reader); if (inline) { //print(typeof(T) + " - " + curPointer); for (int i = 0; i < length; i++) { ts[i] = FromOffsetOrRead(reader, curPointer, onPreRead: onPreRead, inline: true); - curPointer = Pointer.Current(reader); + curPointer = LegacyPointer.Current(reader); } } else { - Pointer.DoAt(ref reader, pointer, () => { + LegacyPointer.DoAt(ref reader, pointer, () => { for (int i = 0; i < length; i++) { ts[i] = FromOffsetOrRead(reader, curPointer, onPreRead: onPreRead, inline: true); - curPointer = Pointer.Current(reader); + curPointer = LegacyPointer.Current(reader); } }); } diff --git a/Assets/Scripts/OpenSpace/Loader/R2DCLoader.cs b/Assets/Scripts/OpenSpace/Loader/R2DCLoader.cs index 59f57f0e..fdb8f10b 100644 --- a/Assets/Scripts/OpenSpace/Loader/R2DCLoader.cs +++ b/Assets/Scripts/OpenSpace/Loader/R2DCLoader.cs @@ -18,6 +18,7 @@ using System.Text.RegularExpressions; using System.Threading.Tasks; using Cysharp.Threading.Tasks; +using BinarySerializer.Unity; namespace OpenSpace.Loader { public class R2DCLoader : MapLoader { @@ -52,7 +53,7 @@ protected override async UniTask Load() { await LoadDreamcast(); - if (Settings.s.game == Settings.Game.R2) { + if (Legacy_Settings.s.game == Legacy_Settings.Game.R2) { string logPathTexFix = gameDataBinFolder + "TEXTURE_FIX.LOG"; string logPathTexLvl = gameDataBinFolder + lvlName + "/TEXTURE_" + lvlName + ".LOG"; string logPathInfo = gameDataBinFolder + lvlName + "/INFO.LOG"; @@ -71,8 +72,8 @@ protected override async UniTask Load() { ReadLog(logPathTexLvl); await WaitIfNecessary(); }*/ - } else if (Settings.s.game == Settings.Game.DD) { - string backgroundPath = gameDataBinFolder + ConvertCase(lvlName, Settings.CapsType.LevelFolder) + "/FOND.PVR"; + } else if (Legacy_Settings.s.game == Legacy_Settings.Game.DD) { + string backgroundPath = gameDataBinFolder + ConvertCase(lvlName, Legacy_Settings.CapsType.LevelFolder) + "/FOND.PVR"; await PrepareFile(backgroundPath); if (FileSystem.FileExists(backgroundPath)) { TEX backgroundTexFile = new TEX(backgroundPath, compressed: false); @@ -119,17 +120,17 @@ async UniTask LoadDreamcast() { await WaitIfNecessary(); files_array[Mem.Fix].GotoHeader(); Reader reader = files_array[Mem.Fix].reader; - Pointer off_base_fix = Pointer.Current(reader); + LegacyPointer off_base_fix = LegacyPointer.Current(reader); uint base_language = reader.ReadUInt32(); //Pointer off_language = Pointer.Read(reader); reader.ReadUInt32(); uint num_text_language = reader.ReadUInt32(); reader.ReadUInt16(); reader.ReadUInt16(); reader.ReadUInt32(); // base - Pointer off_text_general = Pointer.Read(reader); + LegacyPointer off_text_general = LegacyPointer.Read(reader); localization = FromOffsetOrRead(reader, off_text_general); - Pointer off_inputStructure = Pointer.Read(reader); - Pointer.DoAt(ref reader, off_inputStructure, () => { + LegacyPointer off_inputStructure = LegacyPointer.Read(reader); + LegacyPointer.DoAt(ref reader, off_inputStructure, () => { inputStruct = InputStructure.Read(reader, off_inputStructure); foreach (EntryAction ea in inputStruct.entryActions) { print(ea.ToString()); @@ -137,18 +138,18 @@ async UniTask LoadDreamcast() { }); await WaitIfNecessary(); - Pointer.Read(reader); - Pointer.Read(reader); - Pointer.Read(reader); - Pointer.Read(reader); - Pointer.Read(reader); - Pointer.Read(reader); - Pointer.Read(reader); - Pointer.Read(reader); - Pointer.Read(reader); - Pointer.Read(reader); - Pointer.Read(reader); - Pointer.Read(reader); + LegacyPointer.Read(reader); + LegacyPointer.Read(reader); + LegacyPointer.Read(reader); + LegacyPointer.Read(reader); + LegacyPointer.Read(reader); + LegacyPointer.Read(reader); + LegacyPointer.Read(reader); + LegacyPointer.Read(reader); + LegacyPointer.Read(reader); + LegacyPointer.Read(reader); + LegacyPointer.Read(reader); + LegacyPointer.Read(reader); reader.ReadUInt32(); reader.ReadUInt32(); reader.ReadUInt32(); @@ -159,19 +160,19 @@ async UniTask LoadDreamcast() { reader.ReadUInt32(); reader.ReadUInt32(); reader.ReadUInt32(); - Pointer.Read(reader); - Pointer off_levelNames = Pointer.Read(reader); - Pointer off_languages = Pointer.Read(reader); + LegacyPointer.Read(reader); + LegacyPointer off_levelNames = LegacyPointer.Read(reader); + LegacyPointer off_languages = LegacyPointer.Read(reader); uint num_levelNames = reader.ReadUInt32(); uint num_languages = reader.ReadUInt32(); reader.ReadUInt32(); // same as num_levelNames - Pointer.DoAt(ref reader, off_levelNames, () => { + LegacyPointer.DoAt(ref reader, off_levelNames, () => { lvlNames = new string[num_levelNames]; for (uint i = 0; i < num_levelNames; i++) { lvlNames[i] = reader.ReadString(0x1E); } }); - Pointer.DoAt(ref reader, off_languages, () => { + LegacyPointer.DoAt(ref reader, off_languages, () => { ReadLanguages(reader, off_languages, num_languages); }); if (languages != null && localization != null) { @@ -189,16 +190,16 @@ async UniTask LoadDreamcast() { loadingState = "Loading fixed textures"; await WaitIfNecessary(); - Pointer off_events_fix = Pointer.Read(reader); + LegacyPointer off_events_fix = LegacyPointer.Read(reader); uint num_events_fix = reader.ReadUInt32(); uint num_textures_fix = reader.ReadUInt32(); - Pointer off_textures_fix = Pointer.Read(reader); - Pointer.DoAt(ref reader, off_textures_fix, () => { + LegacyPointer off_textures_fix = LegacyPointer.Read(reader); + LegacyPointer.DoAt(ref reader, off_textures_fix, () => { Array.Resize(ref textures, (int)num_textures_fix); for (uint i = 0; i < num_textures_fix; i++) { - Pointer off_texture = Pointer.Read(reader); + LegacyPointer off_texture = LegacyPointer.Read(reader); textures[i] = null; - Pointer.DoAt(ref reader, off_texture, () => { + LegacyPointer.DoAt(ref reader, off_texture, () => { textures[i] = TextureInfo.Read(reader, off_texture); }); } @@ -215,69 +216,69 @@ async UniTask LoadDreamcast() { reader = files_array[Mem.Lvl].reader; // Animation stuff - Pointer off_animationBank = Pointer.Current(reader); - Pointer.Read(reader); - Pointer.Read(reader); - Pointer.Read(reader); - Pointer.Read(reader); - Pointer.Read(reader); - Pointer.Read(reader); - Pointer.Read(reader); - Pointer.Read(reader); - Pointer.Read(reader); - Pointer.Read(reader); - Pointer.Read(reader); + LegacyPointer off_animationBank = LegacyPointer.Current(reader); + LegacyPointer.Read(reader); + LegacyPointer.Read(reader); + LegacyPointer.Read(reader); + LegacyPointer.Read(reader); + LegacyPointer.Read(reader); + LegacyPointer.Read(reader); + LegacyPointer.Read(reader); + LegacyPointer.Read(reader); + LegacyPointer.Read(reader); + LegacyPointer.Read(reader); + LegacyPointer.Read(reader); reader.ReadUInt32(); - Pointer.Read(reader); + LegacyPointer.Read(reader); // Globals - globals.off_actualWorld = Pointer.Read(reader); - globals.off_dynamicWorld = Pointer.Read(reader); - globals.off_inactiveDynamicWorld = Pointer.Read(reader); - globals.off_fatherSector = Pointer.Read(reader); + globals.off_actualWorld = LegacyPointer.Read(reader); + globals.off_dynamicWorld = LegacyPointer.Read(reader); + globals.off_inactiveDynamicWorld = LegacyPointer.Read(reader); + globals.off_fatherSector = LegacyPointer.Read(reader); reader.ReadUInt32(); - Pointer off_always = Pointer.Read(reader); - Pointer.DoAt(ref reader, off_always, () => { + LegacyPointer off_always = LegacyPointer.Read(reader); + LegacyPointer.DoAt(ref reader, off_always, () => { globals.num_always = reader.ReadUInt32(); - globals.spawnablePersos = LinkedList.ReadHeader(reader, Pointer.Current(reader), LinkedList.Type.Double); + globals.spawnablePersos = LinkedList.ReadHeader(reader, LegacyPointer.Current(reader), LinkedList.Type.Double); globals.spawnablePersos.FillPointers(reader, globals.spawnablePersos.off_tail, globals.spawnablePersos.offset); - globals.off_always_reusableSO = Pointer.Read(reader); // There are (num_always) empty SuperObjects starting with this one. + globals.off_always_reusableSO = LegacyPointer.Read(reader); // There are (num_always) empty SuperObjects starting with this one. }); - Pointer.Read(reader); - Pointer off_objectTypes = Pointer.Read(reader); - Pointer.DoAt(ref reader, off_objectTypes, () => { + LegacyPointer.Read(reader); + LegacyPointer off_objectTypes = LegacyPointer.Read(reader); + LegacyPointer.DoAt(ref reader, off_objectTypes, () => { // Fill in pointers for the object type tables and read them objectTypes = new ObjectType[3][]; for (uint i = 0; i < 3; i++) { - Pointer off_names_header = Pointer.Current(reader); - Pointer off_names_first = Pointer.Read(reader); - Pointer off_names_last = Pointer.Read(reader); + LegacyPointer off_names_header = LegacyPointer.Current(reader); + LegacyPointer off_names_first = LegacyPointer.Read(reader); + LegacyPointer off_names_last = LegacyPointer.Read(reader); uint num_names = reader.ReadUInt32(); FillLinkedListPointers(reader, off_names_last, off_names_header); ReadObjectNamesTable(reader, off_names_first, num_names, i); } }); - Pointer.Read(reader); - Pointer off_mainChar = Pointer.Read(reader); + LegacyPointer.Read(reader); + LegacyPointer off_mainChar = LegacyPointer.Read(reader); reader.ReadUInt32(); uint num_persoInFixPointers = reader.ReadUInt32(); - Pointer off_persoInFixPointers = Pointer.Read(reader); + LegacyPointer off_persoInFixPointers = LegacyPointer.Read(reader); //Pointer[] persoInFixPointers = new Pointer[num_persoInFixPointers]; - Pointer.DoAt(ref reader, off_persoInFixPointers, () => { + LegacyPointer.DoAt(ref reader, off_persoInFixPointers, () => { for (int i = 0; i < num_persoInFixPointers; i++) { - Pointer off_perso = Pointer.Read(reader); - Pointer off_so = Pointer.Read(reader); + LegacyPointer off_perso = LegacyPointer.Read(reader); + LegacyPointer off_so = LegacyPointer.Read(reader); byte[] unk = reader.ReadBytes(4); - Pointer off_matrix = Pointer.Current(reader); // It's better to change the pointer instead of the data as that is reused in some places + LegacyPointer off_matrix = LegacyPointer.Current(reader); // It's better to change the pointer instead of the data as that is reused in some places byte[] matrixData = reader.ReadBytes(0x68); byte[] soFlags = reader.ReadBytes(4); byte[] brothersAndParent = reader.ReadBytes(12); - Pointer.DoAt(ref reader, off_perso, () => { + LegacyPointer.DoAt(ref reader, off_perso, () => { reader.ReadUInt32(); - Pointer off_stdGame = Pointer.Read(reader); + LegacyPointer off_stdGame = LegacyPointer.Read(reader); if (off_stdGame != null && off_so != null) { ((DCDAT)off_stdGame.file).OverwriteData(off_stdGame.FileOffset + 0xC, off_so.offset); } @@ -291,17 +292,17 @@ async UniTask LoadDreamcast() { }); await WaitIfNecessary(); - Pointer.Read(reader); // contains a pointer to the camera SO - Pointer off_cameras = Pointer.Read(reader); // Double linkedlist of cameras - Pointer off_families = Pointer.Read(reader); - Pointer.DoAt(ref reader, off_families, () => { - families = LinkedList.ReadHeader(reader, Pointer.Current(reader), type: LinkedList.Type.Double); + LegacyPointer.Read(reader); // contains a pointer to the camera SO + LegacyPointer off_cameras = LegacyPointer.Read(reader); // Double linkedlist of cameras + LegacyPointer off_families = LegacyPointer.Read(reader); + LegacyPointer.DoAt(ref reader, off_families, () => { + families = LinkedList.ReadHeader(reader, LegacyPointer.Current(reader), type: LinkedList.Type.Double); families.FillPointers(reader, families.off_tail, families.off_head); }); - Pointer.Read(reader); // At this pointer: a double linkedlist of fix perso's with headers (soptr, next, prev, hdr) - Pointer.Read(reader); // Rayman + LegacyPointer.Read(reader); // At this pointer: a double linkedlist of fix perso's with headers (soptr, next, prev, hdr) + LegacyPointer.Read(reader); // Rayman reader.ReadUInt32(); - Pointer.Read(reader); // Camera + LegacyPointer.Read(reader); // Camera reader.ReadUInt32(); reader.ReadUInt32(); @@ -309,13 +310,13 @@ async UniTask LoadDreamcast() { await WaitIfNecessary(); uint num_textures_lvl = reader.ReadUInt32(); uint num_textures_total = num_textures_fix + num_textures_lvl; - Pointer off_textures_lvl = Pointer.Read(reader); - Pointer.DoAt(ref reader, off_textures_lvl, () => { + LegacyPointer off_textures_lvl = LegacyPointer.Read(reader); + LegacyPointer.DoAt(ref reader, off_textures_lvl, () => { Array.Resize(ref textures, (int)num_textures_total); for (uint i = num_textures_fix; i < num_textures_total; i++) { - Pointer off_texture = Pointer.Read(reader); + LegacyPointer off_texture = LegacyPointer.Read(reader); textures[i] = null; - Pointer.DoAt(ref reader, off_texture, () => { + LegacyPointer.DoAt(ref reader, off_texture, () => { textures[i] = TextureInfo.Read(reader, off_texture); }); } @@ -332,7 +333,7 @@ async UniTask LoadDreamcast() { ReadFamilies(reader); loadingState = "Loading animation banks"; await WaitIfNecessary(); - Pointer.DoAt(ref reader, off_animationBank, () => { + LegacyPointer.DoAt(ref reader, off_animationBank, () => { animationBanks = new AnimationBank[2]; animationBanks[0] = AnimationBank.ReadDreamcast(reader, off_animationBank, off_events_fix, num_events_fix); animationBanks[1] = animationBanks[0]; @@ -406,7 +407,7 @@ private void ReadLog(Stream logStream) { string offset2Str = logMatch.Groups["offset2"].Value; if (offsetStr.Length < 8) offsetStr = new String('0', offsetStr.Length - 8) + offsetStr; uint offsetUint = Convert.ToUInt32(offsetStr, 16); - Pointer offset = file.GetUnsafePointer(offsetUint); + LegacyPointer offset = file.GetUnsafePointer(offsetUint); switch (type) { case "eST_Comport": Behavior b = FromOffset(offset); @@ -416,7 +417,7 @@ private void ReadLog(Stream logStream) { string modelName = comportMatch.Groups["model"].Value; AIModel aiModel = aiModels.FirstOrDefault(ai => ai.name == modelName); Reader reader = files_array[Mem.Fix].reader; - Pointer.DoAt(ref reader, offset, () => { + LegacyPointer.DoAt(ref reader, offset, () => { Behavior newB = FromOffsetOrRead(reader, offset); if (aiModel != null && newB != null) { switch (comportMatch.Groups["type"].Value) { @@ -486,7 +487,7 @@ private void ReadBehaviorCopies(Reader reader) { if (node.param_ptr != null && node.nodeType == ScriptNode.NodeType.ComportRef) { Behavior b = FromOffset(node.param_ptr); if (b == null) { - Pointer.DoAt(ref reader, node.param_ptr, () => { + LegacyPointer.DoAt(ref reader, node.param_ptr, () => { ReadBehaviorCopy(reader, node.param_ptr, ai); }); } @@ -505,7 +506,7 @@ private void ReadBehaviorCopies(Reader reader) { if (node.param_ptr != null && node.nodeType == ScriptNode.NodeType.ComportRef) { Behavior b = FromOffset(node.param_ptr); if (b == null) { - Pointer.DoAt(ref reader, node.param_ptr, () => { + LegacyPointer.DoAt(ref reader, node.param_ptr, () => { ReadBehaviorCopy(reader, node.param_ptr, ai); }); } @@ -517,7 +518,7 @@ private void ReadBehaviorCopies(Reader reader) { } } } - private void ReadBehaviorCopy(Reader reader, Pointer offset, AIModel ai) { + private void ReadBehaviorCopy(Reader reader, LegacyPointer offset, AIModel ai) { Behavior b = FromOffsetOrRead(reader, offset); if (b != null && ai != null && ai.behaviors_normal != null) { foreach (Behavior originalBehavior in ai.behaviors_normal) { diff --git a/Assets/Scripts/OpenSpace/Loader/R2Loader.cs b/Assets/Scripts/OpenSpace/Loader/R2Loader.cs index 4eb0e3a2..50dfd60d 100644 --- a/Assets/Scripts/OpenSpace/Loader/R2Loader.cs +++ b/Assets/Scripts/OpenSpace/Loader/R2Loader.cs @@ -17,6 +17,7 @@ using System.Collections; using System.Threading.Tasks; using Cysharp.Threading.Tasks; +using BinarySerializer.Unity; namespace OpenSpace.Loader { public class R2Loader : MapLoader { @@ -31,30 +32,30 @@ protected override async UniTask Load() { loadingState = "Initializing files"; await WaitIfNecessary(); - string gameDsbPath = gameDataBinFolder + ConvertCase("Game.dsb", Settings.CapsType.DSB); - if (Settings.s.engineVersion == Settings.EngineVersion.Montreal) { - gameDsbPath = gameDataBinFolder + ConvertCase("gamedsc.bin", Settings.CapsType.DSB); - } else if (Settings.s.game == Settings.Game.TTSE) { - gameDsbPath = gameDataBinFolder + ConvertCase("GAME.DSC", Settings.CapsType.DSB); + string gameDsbPath = gameDataBinFolder + ConvertCase("Game.dsb", Legacy_Settings.CapsType.DSB); + if (Legacy_Settings.s.engineVersion == Legacy_Settings.EngineVersion.Montreal) { + gameDsbPath = gameDataBinFolder + ConvertCase("gamedsc.bin", Legacy_Settings.CapsType.DSB); + } else if (Legacy_Settings.s.game == Legacy_Settings.Game.TTSE) { + gameDsbPath = gameDataBinFolder + ConvertCase("GAME.DSC", Legacy_Settings.CapsType.DSB); } await PrepareFile(gameDsbPath); gameDsb = new DSB("Game", gameDsbPath); if (FileSystem.mode != FileSystem.Mode.Web) { - gameDsb.Save(gameDataBinFolder + ConvertCase("Game_dsb.dmp", Settings.CapsType.DSB)); + gameDsb.Save(gameDataBinFolder + ConvertCase("Game_dsb.dmp", Legacy_Settings.CapsType.DSB)); } gameDsb.ReadAllSections(); gameDsb.Dispose(); await CreateCNT(); - if (Settings.s.game == Settings.Game.R2) { + if (Legacy_Settings.s.game == Legacy_Settings.Game.R2) { string comportsPath = gameDataBinFolder + "R2DC_Comports.json"; await PrepareFile(comportsPath); } if (lvlName.EndsWith(".exe")) { - if (!Settings.s.hasMemorySupport) throw new Exception("This game does not have memory support."); - Settings.s.loadFromMemory = true; + if (!Legacy_Settings.s.hasMemorySupport) throw new Exception("This game does not have memory support."); + Legacy_Settings.s.loadFromMemory = true; MemoryFile mem = new MemoryFile(lvlName); files_array[0] = mem; await WaitIfNecessary(); @@ -62,15 +63,15 @@ protected override async UniTask Load() { } else { hasTransit = false; DAT dat = null; - string levelsSubFolder = ConvertCase(ConvertPath(gameDsb.levelsDataPath), Settings.CapsType.All) + "/"; + string levelsSubFolder = ConvertCase(ConvertPath(gameDsb.levelsDataPath), Legacy_Settings.CapsType.All) + "/"; string levelsFolder = gameDataBinFolder + levelsSubFolder; string langDataPath = gameDataBinFolder - + ConvertCase("../LangData/English/", Settings.CapsType.All) + + ConvertCase("../LangData/English/", Legacy_Settings.CapsType.All) + levelsSubFolder; - if (Settings.s.engineVersion == Settings.EngineVersion.Montreal) { + if (Legacy_Settings.s.engineVersion == Legacy_Settings.EngineVersion.Montreal) { await FileSystem.CheckDirectory(langDataPath); if (FileSystem.mode != FileSystem.Mode.Web && !FileSystem.DirectoryExists(langDataPath)) { - string langPath = gameDataBinFolder + ConvertCase("../LangData/", Settings.CapsType.All); + string langPath = gameDataBinFolder + ConvertCase("../LangData/", Legacy_Settings.CapsType.All); await FileSystem.CheckDirectory(langPath); if (FileSystem.DirectoryExists(langPath)) { DirectoryInfo dirInfo = new DirectoryInfo(langPath); @@ -85,7 +86,7 @@ protected override async UniTask Load() { await WaitIfNecessary(); bool hasRelocationFiles = true; - if (Settings.s.mode == Settings.Mode.Rayman2PC || Settings.s.mode == Settings.Mode.DonaldDuckPC) { + if (Legacy_Settings.s.mode == Legacy_Settings.Mode.Rayman2PC || Legacy_Settings.s.mode == Legacy_Settings.Mode.DonaldDuckPC) { string dataPath = levelsFolder + "LEVELS0.DAT"; await PrepareBigFile(dataPath, 512*1024); if (FileSystem.FileExists(dataPath)) { @@ -95,28 +96,28 @@ protected override async UniTask Load() { } // Prepare folder names - string lvlFolder = ConvertCase(lvlName + "/", Settings.CapsType.LevelFolder); - string langLvlFolder = ConvertCase(lvlName + "/", Settings.CapsType.LangLevelFolder); + string lvlFolder = ConvertCase(lvlName + "/", Legacy_Settings.CapsType.LevelFolder); + string langLvlFolder = ConvertCase(lvlName + "/", Legacy_Settings.CapsType.LangLevelFolder); // Prepare paths - paths["fix.sna"] = levelsFolder + ConvertCase("Fix.sna", Settings.CapsType.Fix); - paths["fix.rtb"] = levelsFolder + ConvertCase("Fix.rtb", Settings.CapsType.FixRelocation); - paths["fix.gpt"] = levelsFolder + ConvertCase("Fix.gpt", Settings.CapsType.Fix); - paths["fix.rtp"] = levelsFolder + ConvertCase("Fix.rtp", Settings.CapsType.FixRelocation); - paths["fix.ptx"] = levelsFolder + ConvertCase("Fix.ptx", Settings.CapsType.Fix); - paths["fix.rtt"] = levelsFolder + ConvertCase("Fix.rtt", Settings.CapsType.FixRelocation); - if (Settings.s.engineVersion < Settings.EngineVersion.R2) { - paths["fixlvl.rtb"] = levelsFolder + lvlFolder + ConvertCase("FixLvl.rtb", Settings.CapsType.FixLvl); + paths["fix.sna"] = levelsFolder + ConvertCase("Fix.sna", Legacy_Settings.CapsType.Fix); + paths["fix.rtb"] = levelsFolder + ConvertCase("Fix.rtb", Legacy_Settings.CapsType.FixRelocation); + paths["fix.gpt"] = levelsFolder + ConvertCase("Fix.gpt", Legacy_Settings.CapsType.Fix); + paths["fix.rtp"] = levelsFolder + ConvertCase("Fix.rtp", Legacy_Settings.CapsType.FixRelocation); + paths["fix.ptx"] = levelsFolder + ConvertCase("Fix.ptx", Legacy_Settings.CapsType.Fix); + paths["fix.rtt"] = levelsFolder + ConvertCase("Fix.rtt", Legacy_Settings.CapsType.FixRelocation); + if (Legacy_Settings.s.engineVersion < Legacy_Settings.EngineVersion.R2) { + paths["fixlvl.rtb"] = levelsFolder + lvlFolder + ConvertCase("FixLvl.rtb", Legacy_Settings.CapsType.FixLvl); } else { paths["fixlvl.rtb"] = null; } - if (Settings.s.engineVersion == Settings.EngineVersion.Montreal) { - paths["fix.sda"] = levelsFolder + ConvertCase("Fix.sda", Settings.CapsType.Fix); - paths["fix.lng"] = langDataPath + ConvertCase("Fix.lng", Settings.CapsType.LangFix); - paths["fix.rtg"] = langDataPath + ConvertCase("Fix.rtg", Settings.CapsType.FixRelocation); - paths["fix.dlg"] = langDataPath + ConvertCase("Fix.dlg", Settings.CapsType.LangFix); - paths["fix.rtd"] = langDataPath + ConvertCase("Fix.rtd", Settings.CapsType.FixRelocation); - paths["fixlvl.rtg"] = langDataPath + langLvlFolder + ConvertCase("FixLvl.rtg", Settings.CapsType.FixLvl); + if (Legacy_Settings.s.engineVersion == Legacy_Settings.EngineVersion.Montreal) { + paths["fix.sda"] = levelsFolder + ConvertCase("Fix.sda", Legacy_Settings.CapsType.Fix); + paths["fix.lng"] = langDataPath + ConvertCase("Fix.lng", Legacy_Settings.CapsType.LangFix); + paths["fix.rtg"] = langDataPath + ConvertCase("Fix.rtg", Legacy_Settings.CapsType.FixRelocation); + paths["fix.dlg"] = langDataPath + ConvertCase("Fix.dlg", Legacy_Settings.CapsType.LangFix); + paths["fix.rtd"] = langDataPath + ConvertCase("Fix.rtd", Legacy_Settings.CapsType.FixRelocation); + paths["fixlvl.rtg"] = langDataPath + langLvlFolder + ConvertCase("FixLvl.rtg", Legacy_Settings.CapsType.FixLvl); } else { paths["fix.sda"] = null; paths["fix.lng"] = null; @@ -126,24 +127,24 @@ protected override async UniTask Load() { paths["fixlvl.rtg"] = null; } - paths["lvl.sna"] = levelsFolder + lvlFolder + ConvertCase(lvlName + ".sna", Settings.CapsType.LevelFile); - paths["lvl.gpt"] = levelsFolder + lvlFolder + ConvertCase(lvlName + ".gpt", Settings.CapsType.LevelFile); - paths["lvl.ptx"] = levelsFolder + lvlFolder + ConvertCase(lvlName + ".ptx", Settings.CapsType.LevelFile); + paths["lvl.sna"] = levelsFolder + lvlFolder + ConvertCase(lvlName + ".sna", Legacy_Settings.CapsType.LevelFile); + paths["lvl.gpt"] = levelsFolder + lvlFolder + ConvertCase(lvlName + ".gpt", Legacy_Settings.CapsType.LevelFile); + paths["lvl.ptx"] = levelsFolder + lvlFolder + ConvertCase(lvlName + ".ptx", Legacy_Settings.CapsType.LevelFile); if (hasRelocationFiles) { - paths["lvl.rtb"] = levelsFolder + lvlFolder + ConvertCase(lvlName + ".rtb", Settings.CapsType.LevelRelocation); - paths["lvl.rtp"] = levelsFolder + lvlFolder + ConvertCase(lvlName + ".rtp", Settings.CapsType.LevelRelocation); - paths["lvl.rtt"] = levelsFolder + lvlFolder + ConvertCase(lvlName + ".rtt", Settings.CapsType.LevelRelocation); + paths["lvl.rtb"] = levelsFolder + lvlFolder + ConvertCase(lvlName + ".rtb", Legacy_Settings.CapsType.LevelRelocation); + paths["lvl.rtp"] = levelsFolder + lvlFolder + ConvertCase(lvlName + ".rtp", Legacy_Settings.CapsType.LevelRelocation); + paths["lvl.rtt"] = levelsFolder + lvlFolder + ConvertCase(lvlName + ".rtt", Legacy_Settings.CapsType.LevelRelocation); } else { paths["lvl.rtb"] = null; paths["lvl.rtp"] = null; paths["lvl.rtt"] = null; } - if (Settings.s.engineVersion == Settings.EngineVersion.Montreal) { - paths["lvl.sda"] = levelsFolder + lvlFolder + ConvertCase(lvlName + ".sda", Settings.CapsType.LevelFile); - paths["lvl.lng"] = langDataPath + langLvlFolder + ConvertCase(lvlName + ".lng", Settings.CapsType.LangLevelFile); - paths["lvl.rtg"] = langDataPath + langLvlFolder + ConvertCase(lvlName + ".rtg", Settings.CapsType.LangLevelFile); - paths["lvl.dlg"] = langDataPath + langLvlFolder + ConvertCase(lvlName + ".dlg", Settings.CapsType.LangLevelFile); - paths["lvl.rtd"] = langDataPath + langLvlFolder + ConvertCase(lvlName + ".rtd", Settings.CapsType.LangLevelRelocation); + if (Legacy_Settings.s.engineVersion == Legacy_Settings.EngineVersion.Montreal) { + paths["lvl.sda"] = levelsFolder + lvlFolder + ConvertCase(lvlName + ".sda", Legacy_Settings.CapsType.LevelFile); + paths["lvl.lng"] = langDataPath + langLvlFolder + ConvertCase(lvlName + ".lng", Legacy_Settings.CapsType.LangLevelFile); + paths["lvl.rtg"] = langDataPath + langLvlFolder + ConvertCase(lvlName + ".rtg", Legacy_Settings.CapsType.LangLevelFile); + paths["lvl.dlg"] = langDataPath + langLvlFolder + ConvertCase(lvlName + ".dlg", Legacy_Settings.CapsType.LangLevelFile); + paths["lvl.rtd"] = langDataPath + langLvlFolder + ConvertCase(lvlName + ".rtd", Legacy_Settings.CapsType.LangLevelRelocation); } else { paths["lvl.sda"] = null; paths["lvl.lng"] = null; @@ -151,9 +152,9 @@ protected override async UniTask Load() { paths["lvl.dlg"] = null; paths["lvl.rtd"] = null; } - paths["lvl.dsb"] = levelsFolder + lvlFolder + ConvertCase(lvlName + ".dsb", Settings.CapsType.DSB); - if (Settings.s.engineVersion < Settings.EngineVersion.R2) { - paths["lvl.dsb"] = levelsFolder + lvlFolder + ConvertCase(lvlName + ".dsc", Settings.CapsType.DSB); + paths["lvl.dsb"] = levelsFolder + lvlFolder + ConvertCase(lvlName + ".dsb", Legacy_Settings.CapsType.DSB); + if (Legacy_Settings.s.engineVersion < Legacy_Settings.EngineVersion.R2) { + paths["lvl.dsb"] = levelsFolder + lvlFolder + ConvertCase(lvlName + ".dsc", Legacy_Settings.CapsType.DSB); } // Download files @@ -182,7 +183,7 @@ protected override async UniTask Load() { fixRtb.Add(fixLvlRtb); } SNA fixSna = new SNA("Fix", paths["fix.sna"], fixRtb); - if (Settings.s.engineVersion == Settings.EngineVersion.Montreal && FileSystem.DirectoryExists(langDataPath)) { + if (Legacy_Settings.s.engineVersion == Legacy_Settings.EngineVersion.Montreal && FileSystem.DirectoryExists(langDataPath)) { RelocationTable fixLangRTG = new RelocationTable(paths["fix.rtg"], dat, "fixLang", RelocationType.RTG); await fixLangRTG.Init(); if (FileSystem.FileExists(paths["fixlvl.rtg"])) { @@ -215,7 +216,7 @@ protected override async UniTask Load() { RelocationTable lvlRtb = new RelocationTable(paths["lvl.rtb"], dat, lvlName, RelocationType.RTB); await lvlRtb.Init(); SNA lvlSna = new SNA(lvlName, paths["lvl.sna"], lvlRtb); - if (Settings.s.engineVersion == Settings.EngineVersion.Montreal && FileSystem.DirectoryExists(langDataPath)) { + if (Legacy_Settings.s.engineVersion == Legacy_Settings.EngineVersion.Montreal && FileSystem.DirectoryExists(langDataPath)) { RelocationTable lvlLangRTG = new RelocationTable(paths["lvl.rtg"], dat, lvlName + "Lang", RelocationType.RTG); await lvlLangRTG.Init(); SNA lvlLangSna = new SNA(lvlName + "Lang", paths["lvl.lng"], lvlLangRTG); @@ -227,7 +228,7 @@ protected override async UniTask Load() { lvlSna.ReadDLG(paths["lvl.dlg"], lvlRtd); } - if (Settings.s.engineVersion > Settings.EngineVersion.TT) { + if (Legacy_Settings.s.engineVersion > Legacy_Settings.EngineVersion.TT) { RelocationTable lvlRtp = new RelocationTable(paths["lvl.rtp"], dat, lvlName, RelocationType.RTP); await lvlRtp.Init(); lvlSna.ReadGPT(paths["lvl.gpt"], lvlRtp); @@ -285,32 +286,32 @@ async UniTask LoadFIXSNA() { await WaitIfNecessary(); files_array[Mem.Fix].GotoHeader(); Reader reader = files_array[Mem.Fix].reader; - print("FIX GPT offset: " + Pointer.Current(reader)); + print("FIX GPT offset: " + LegacyPointer.Current(reader)); SNA sna = (SNA)files_array[Mem.Fix]; - if (Settings.s.engineVersion <= Settings.EngineVersion.TT) { + if (Legacy_Settings.s.engineVersion <= Legacy_Settings.EngineVersion.TT) { // Tonic Trouble inputStruct = new InputStructure(null); - uint stringCount = Settings.s.game == Settings.Game.TTSE ? 351 : (uint)gameDsb.textFiles.Sum(t => t.strings.Count); - Pointer.Read(reader); - Pointer.Read(reader); - Pointer.Read(reader); - if (Settings.s.game == Settings.Game.TTSE) { - for (int i = 0; i < 50; i++) Pointer.Read(reader); + uint stringCount = Legacy_Settings.s.game == Legacy_Settings.Game.TTSE ? 351 : (uint)gameDsb.textFiles.Sum(t => t.strings.Count); + LegacyPointer.Read(reader); + LegacyPointer.Read(reader); + LegacyPointer.Read(reader); + if (Legacy_Settings.s.game == Legacy_Settings.Game.TTSE) { + for (int i = 0; i < 50; i++) LegacyPointer.Read(reader); } else { - for (int i = 0; i < 100; i++) Pointer.Read(reader); + for (int i = 0; i < 100; i++) LegacyPointer.Read(reader); } reader.ReadUInt32(); // 0x35 - if (Settings.s.game != Settings.Game.TTSE) reader.ReadBytes(0x80); // contains strings like MouseXPos, input related. first dword of this is a pointer to inputstructure probably + if (Legacy_Settings.s.game != Legacy_Settings.Game.TTSE) reader.ReadBytes(0x80); // contains strings like MouseXPos, input related. first dword of this is a pointer to inputstructure probably reader.ReadBytes(0x90); - Pointer.Read(reader); + LegacyPointer.Read(reader); reader.ReadUInt32(); // 0x28 reader.ReadUInt32(); // 0x1 - if (Settings.s.game == Settings.Game.TTSE) Pointer.Read(reader); - for (int i = 0; i < 100; i++) Pointer.Read(reader); - for (int i = 0; i < 100; i++) Pointer.Read(reader); + if (Legacy_Settings.s.game == Legacy_Settings.Game.TTSE) LegacyPointer.Read(reader); + for (int i = 0; i < 100; i++) LegacyPointer.Read(reader); + for (int i = 0; i < 100; i++) LegacyPointer.Read(reader); reader.ReadUInt32(); // 0x1 - if (Settings.s.game == Settings.Game.TTSE) { + if (Legacy_Settings.s.game == Legacy_Settings.Game.TTSE) { reader.ReadBytes(0xB4); } else { if (stringCount != 598) { // English version and probably other versions have 603 strings. It's a hacky way to check which version. @@ -325,21 +326,21 @@ async UniTask LoadFIXSNA() { reader.ReadUInt32(); // 0 reader.ReadUInt32(); // 1 reader.ReadUInt32(); // ??? - Pointer.Read(reader); - for (int i = 0; i < stringCount; i++) Pointer.Read(reader); // read num_loaded_strings pointers here + LegacyPointer.Read(reader); + for (int i = 0; i < stringCount; i++) LegacyPointer.Read(reader); // read num_loaded_strings pointers here reader.ReadBytes(0xC); // dword_51A728. probably a table of some sort: 2 ptrs and a number - if (Settings.s.game != Settings.Game.TTSE) { // There's more but what is even the point in reading all this + if (Legacy_Settings.s.game != Legacy_Settings.Game.TTSE) { // There's more but what is even the point in reading all this reader.ReadUInt32(); - Pointer.Read(reader); + LegacyPointer.Read(reader); reader.ReadBytes(0x14); - Pointer.Read(reader); - Pointer.Read(reader); - Pointer.Read(reader); - Pointer.Read(reader); - Pointer.Read(reader); - Pointer.Read(reader); - Pointer.Read(reader); - Pointer.Read(reader); + LegacyPointer.Read(reader); + LegacyPointer.Read(reader); + LegacyPointer.Read(reader); + LegacyPointer.Read(reader); + LegacyPointer.Read(reader); + LegacyPointer.Read(reader); + LegacyPointer.Read(reader); + LegacyPointer.Read(reader); reader.ReadUInt32(); // 0, so can be pointer too reader.ReadUInt32(); // 0, so can be pointer too reader.ReadUInt32(); // 0, so can be pointer too @@ -351,113 +352,113 @@ async UniTask LoadFIXSNA() { reader.ReadBytes(0x30); reader.ReadBytes(0x960); } - } else if (Settings.s.engineVersion == Settings.EngineVersion.Montreal) { + } else if (Legacy_Settings.s.engineVersion == Legacy_Settings.EngineVersion.Montreal) { uint num_strings = 0; inputStruct = new InputStructure(null); // SDA - Pointer.DoAt(ref reader, sna.SDA, () => { - print(Pointer.Current(reader)); + LegacyPointer.DoAt(ref reader, sna.SDA, () => { + print(LegacyPointer.Current(reader)); reader.ReadUInt32(); reader.ReadUInt32(); // same as next num_strings = reader.ReadUInt32(); uint indexOfTextGlobal = reader.ReadUInt32(); // dword_6EEE78 uint dword_83EC58 = reader.ReadUInt32(); - print(num_strings + " - " + Pointer.Current(reader)); + print(num_strings + " - " + LegacyPointer.Current(reader)); }); // DLG - Pointer.DoAt(ref reader, sna.DLG, () => { - Pointer off_strings = Pointer.Read(reader); + LegacyPointer.DoAt(ref reader, sna.DLG, () => { + LegacyPointer off_strings = LegacyPointer.Read(reader); for (int i = 0; i < num_strings; i++) { - Pointer.Read(reader); + LegacyPointer.Read(reader); } reader.ReadUInt32(); }); // GPT sna.GotoHeader(); - Pointer.Read(reader); - Pointer off_mainLight = Pointer.Read(reader); + LegacyPointer.Read(reader); + LegacyPointer off_mainLight = LegacyPointer.Read(reader); uint lpPerformanceCount = reader.ReadUInt32(); - Pointer.Read(reader); - Pointer off_defaultMaterial = Pointer.Read(reader); - Pointer off_geometricObject1 = Pointer.Read(reader); - Pointer off_geometricObject2 = Pointer.Read(reader); - Pointer off_geometricObject3 = Pointer.Read(reader); + LegacyPointer.Read(reader); + LegacyPointer off_defaultMaterial = LegacyPointer.Read(reader); + LegacyPointer off_geometricObject1 = LegacyPointer.Read(reader); + LegacyPointer off_geometricObject2 = LegacyPointer.Read(reader); + LegacyPointer off_geometricObject3 = LegacyPointer.Read(reader); reader.ReadBytes(0x90); // FON_ related reader.ReadBytes(0x3D54); // FON_ related - for (int i = 0; i < 100; i++) Pointer.Read(reader); // matrix in stack + for (int i = 0; i < 100; i++) LegacyPointer.Read(reader); // matrix in stack uint matrixInStack = reader.ReadUInt32(); // number of matrix in stack reader.ReadBytes(0xC); reader.ReadBytes(0x20); reader.ReadUInt32(); reader.ReadUInt32(); - Pointer.Read(reader); - Pointer.Read(reader); + LegacyPointer.Read(reader); + LegacyPointer.Read(reader); for (int i = 0; i < num_strings; i++) { - Pointer.Read(reader); + LegacyPointer.Read(reader); } - LinkedList fontDefinitions = LinkedList.ReadHeader(reader, Pointer.Current(reader)); - Pointer.Read(reader); + LinkedList fontDefinitions = LinkedList.ReadHeader(reader, LegacyPointer.Current(reader)); + LegacyPointer.Read(reader); reader.ReadUInt32(); reader.ReadUInt32(); reader.ReadUInt32(); - Pointer off_geometricObject4 = Pointer.Read(reader); - Pointer off_geometricObject5 = Pointer.Read(reader); - Pointer off_geometricObject6 = Pointer.Read(reader); - Pointer off_visualmaterial1 = Pointer.Read(reader); - Pointer off_visualmaterial2 = Pointer.Read(reader); + LegacyPointer off_geometricObject4 = LegacyPointer.Read(reader); + LegacyPointer off_geometricObject5 = LegacyPointer.Read(reader); + LegacyPointer off_geometricObject6 = LegacyPointer.Read(reader); + LegacyPointer off_visualmaterial1 = LegacyPointer.Read(reader); + LegacyPointer off_visualmaterial2 = LegacyPointer.Read(reader); for (int i = 0; i < 10; i++) { - Pointer off_texture = Pointer.Read(reader); + LegacyPointer off_texture = LegacyPointer.Read(reader); } - Pointer off_visualmaterial3 = Pointer.Read(reader); - Pointer off_gamematerial = Pointer.Read(reader); + LegacyPointer off_visualmaterial3 = LegacyPointer.Read(reader); + LegacyPointer off_gamematerial = LegacyPointer.Read(reader); uint geometricElementIndexGlobal = reader.ReadUInt32(); - Pointer off_texture2 = Pointer.Read(reader); - Pointer off_geometricObject7 = Pointer.Read(reader); + LegacyPointer off_texture2 = LegacyPointer.Read(reader); + LegacyPointer off_geometricObject7 = LegacyPointer.Read(reader); for (uint i = 0; i < 7; i++) { - Pointer.Read(reader); // Material for stencils. Order: corner, border, center, side, redarrow, bullet, and another one + LegacyPointer.Read(reader); // Material for stencils. Order: corner, border, center, side, redarrow, bullet, and another one } - Pointer dword_5DCB9C = Pointer.Read(reader); + LegacyPointer dword_5DCB9C = LegacyPointer.Read(reader); // Now comes INV_fn_vSnaMultilanguageLoading - print(Pointer.Current(reader)); + print(LegacyPointer.Current(reader)); } else { - Pointer off_identityMatrix = Pointer.Read(reader); + LegacyPointer off_identityMatrix = LegacyPointer.Read(reader); reader.ReadBytes(50 * 4); uint matrixInStack = reader.ReadUInt32(); - Pointer off_collisionGeoObj = Pointer.Read(reader); - Pointer off_staticCollisionGeoObj = Pointer.Read(reader); + LegacyPointer off_collisionGeoObj = LegacyPointer.Read(reader); + LegacyPointer off_staticCollisionGeoObj = LegacyPointer.Read(reader); loadingState = "Loading input structure"; await WaitIfNecessary(); - for (int i = 0; i < Settings.s.numEntryActions; i++) { - Pointer.Read(reader); // 3DOS_EntryActions + for (int i = 0; i < Legacy_Settings.s.numEntryActions; i++) { + LegacyPointer.Read(reader); // 3DOS_EntryActions } - Pointer off_IPT_keyAndPadDefine = Pointer.Read(reader); + LegacyPointer off_IPT_keyAndPadDefine = LegacyPointer.Read(reader); ReadKeypadDefine(reader, off_IPT_keyAndPadDefine); - inputStruct = InputStructure.Read(reader, Pointer.Current(reader)); + inputStruct = InputStructure.Read(reader, LegacyPointer.Current(reader)); foreach (EntryAction ea in inputStruct.entryActions) { print(ea.ToString()); } print("Num entractions: " + inputStruct.num_entryActions); print("Off entryactions: " + inputStruct.off_entryActions); - Pointer off_IPT_entryElementList = Pointer.Read(reader); + LegacyPointer off_IPT_entryElementList = LegacyPointer.Read(reader); print("Off entryelements: " + off_IPT_entryElementList); loadingState = "Loading text"; await WaitIfNecessary(); - localization = FromOffsetOrRead(reader, Pointer.Current(reader), inline: true); // FON_g_stGeneral + localization = FromOffsetOrRead(reader, LegacyPointer.Current(reader), inline: true); // FON_g_stGeneral loadingState = "Loading fixed animation bank"; await WaitIfNecessary(); animationBanks = new AnimationBank[2]; // 1 in fix, 1 in lvl - animationBanks[0] = AnimationBank.Read(reader, Pointer.Current(reader), 0, 1, files_array[Mem.FixKeyFrames])[0]; + animationBanks[0] = AnimationBank.Read(reader, LegacyPointer.Current(reader), 0, 1, files_array[Mem.FixKeyFrames])[0]; print("Fix animation bank: " + animationBanks[0].off_header); - Pointer off_fixInfo = Pointer.Read(reader); + LegacyPointer off_fixInfo = LegacyPointer.Read(reader); } // Read PTX @@ -465,9 +466,9 @@ async UniTask LoadFIXSNA() { await WaitIfNecessary(); // Can't yield inside a lambda, so we must do it the old fashioned way, with off_current if (sna.PTX != null) { - Pointer off_current = Pointer.Goto(ref reader, sna.PTX); - await ReadTexturesFix(reader, Pointer.Current(reader)); - Pointer.Goto(ref reader, off_current); + LegacyPointer off_current = LegacyPointer.Goto(ref reader, sna.PTX); + await ReadTexturesFix(reader, LegacyPointer.Current(reader)); + LegacyPointer.Goto(ref reader, off_current); } /*Pointer.DoAt(ref reader, sna.PTX, () => { ReadTexturesFix(reader, Pointer.Current(reader)); @@ -480,15 +481,15 @@ async UniTask LoadLVLSNA() { loadingState = "Loading level memory"; await WaitIfNecessary(); Reader reader = files_array[Mem.Lvl].reader; - Pointer off_current; + LegacyPointer off_current; SNA sna = (SNA)files_array[Mem.Lvl]; // First read GPT files_array[Mem.Lvl].GotoHeader(); reader = files_array[Mem.Lvl].reader; - print("LVL GPT offset: " + Pointer.Current(reader)); + print("LVL GPT offset: " + LegacyPointer.Current(reader)); - if (Settings.s.engineVersion == Settings.EngineVersion.Montreal) { + if (Legacy_Settings.s.engineVersion == Legacy_Settings.EngineVersion.Montreal) { // SDA /*sna.GotoSDA(); @@ -510,71 +511,71 @@ async UniTask LoadLVLSNA() { // GPT sna.GotoHeader(); - if (Settings.s.game != Settings.Game.PlaymobilLaura) { - Pointer.Read(reader); // sound related + if (Legacy_Settings.s.game != Legacy_Settings.Game.PlaymobilLaura) { + LegacyPointer.Read(reader); // sound related } - Pointer.Read(reader); - Pointer.Read(reader); + LegacyPointer.Read(reader); + LegacyPointer.Read(reader); reader.ReadUInt32(); } - if (Settings.s.engineVersion != Settings.EngineVersion.Montreal) { + if (Legacy_Settings.s.engineVersion != Legacy_Settings.EngineVersion.Montreal) { loadingState = "Reading settings for persos in fix"; await WaitIfNecessary(); // Fill in fix -> lvl pointers for perso's in fix uint num_persoInFixPointers = reader.ReadUInt32(); - Pointer[] persoInFixPointers = new Pointer[num_persoInFixPointers]; + LegacyPointer[] persoInFixPointers = new LegacyPointer[num_persoInFixPointers]; for (int i = 0; i < num_persoInFixPointers; i++) { - Pointer off_perso = Pointer.Read(reader); + LegacyPointer off_perso = LegacyPointer.Read(reader); if (off_perso != null) { - off_current = Pointer.Goto(ref reader, off_perso); + off_current = LegacyPointer.Goto(ref reader, off_perso); reader.ReadUInt32(); - Pointer off_stdGame = Pointer.Read(reader); + LegacyPointer off_stdGame = LegacyPointer.Read(reader); if (off_stdGame != null) { - if (Settings.s.engineVersion > Settings.EngineVersion.TT) { - Pointer.Goto(ref reader, off_stdGame); + if (Legacy_Settings.s.engineVersion > Legacy_Settings.EngineVersion.TT) { + LegacyPointer.Goto(ref reader, off_stdGame); reader.ReadUInt32(); // type 0 reader.ReadUInt32(); // type 1 reader.ReadUInt32(); // type 2 - Pointer off_superObject = Pointer.Read(reader); - Pointer.Goto(ref reader, off_current); + LegacyPointer off_superObject = LegacyPointer.Read(reader); + LegacyPointer.Goto(ref reader, off_current); if (off_superObject == null) continue; } else { - Pointer.Goto(ref reader, off_current); + LegacyPointer.Goto(ref reader, off_current); } // First read everything from the GPT - Pointer off_newSuperObject = null, off_nextBrother = null, off_prevBrother = null, off_father = null; + LegacyPointer off_newSuperObject = null, off_nextBrother = null, off_prevBrother = null, off_father = null; byte[] matrixData = null, floatData = null, renderBits = null; - if (Settings.s.engineVersion > Settings.EngineVersion.TT) { - off_newSuperObject = Pointer.Read(reader); + if (Legacy_Settings.s.engineVersion > Legacy_Settings.EngineVersion.TT) { + off_newSuperObject = LegacyPointer.Read(reader); matrixData = reader.ReadBytes(0x58); renderBits = reader.ReadBytes(4); floatData = reader.ReadBytes(4); - off_nextBrother = Pointer.Read(reader); - off_prevBrother = Pointer.Read(reader); - off_father = Pointer.Read(reader); + off_nextBrother = LegacyPointer.Read(reader); + off_prevBrother = LegacyPointer.Read(reader); + off_father = LegacyPointer.Read(reader); } else { matrixData = reader.ReadBytes(0x58); - off_newSuperObject = Pointer.Read(reader); - Pointer.DoAt(ref reader, off_stdGame + 0xC, () => { + off_newSuperObject = LegacyPointer.Read(reader); + LegacyPointer.DoAt(ref reader, off_stdGame + 0xC, () => { ((SNA)off_stdGame.file).AddPointer(off_stdGame.offset + 0xC, off_newSuperObject); }); } // Then fill everything in - off_current = Pointer.Goto(ref reader, off_newSuperObject); + off_current = LegacyPointer.Goto(ref reader, off_newSuperObject); uint newSOtype = reader.ReadUInt32(); - Pointer off_newSOengineObject = Pointer.Read(reader); + LegacyPointer off_newSOengineObject = LegacyPointer.Read(reader); if (SuperObject.GetSOType(newSOtype) == SuperObject.Type.Perso) { persoInFixPointers[i] = off_newSOengineObject; - Pointer.Goto(ref reader, off_newSOengineObject); - Pointer off_p3dData = Pointer.Read(reader); - if (Settings.s.game == Settings.Game.R2Demo) { + LegacyPointer.Goto(ref reader, off_newSOengineObject); + LegacyPointer off_p3dData = LegacyPointer.Read(reader); + if (Legacy_Settings.s.game == Legacy_Settings.Game.R2Demo) { ((SNA)off_p3dData.file).OverwriteData(off_p3dData.FileOffset + 0x1C, matrixData); } else { ((SNA)off_p3dData.file).OverwriteData(off_p3dData.FileOffset + 0x18, matrixData); } - if (Settings.s.engineVersion > Settings.EngineVersion.TT) { + if (Legacy_Settings.s.engineVersion > Legacy_Settings.EngineVersion.TT) { FileWithPointers file = off_newSuperObject.file; file.AddPointer(off_newSuperObject.FileOffset + 0x14, off_nextBrother); file.AddPointer(off_newSuperObject.FileOffset + 0x18, off_prevBrother); @@ -587,48 +588,48 @@ async UniTask LoadLVLSNA() { } } - Pointer.Goto(ref reader, off_current); + LegacyPointer.Goto(ref reader, off_current); } } } loadingState = "Loading globals"; await WaitIfNecessary(); - if (Settings.s.engineVersion > Settings.EngineVersion.Montreal) { - globals.off_actualWorld = Pointer.Read(reader); - globals.off_dynamicWorld = Pointer.Read(reader); - globals.off_inactiveDynamicWorld = Pointer.Read(reader); - globals.off_fatherSector = Pointer.Read(reader); - globals.off_firstSubMapPosition = Pointer.Read(reader); + if (Legacy_Settings.s.engineVersion > Legacy_Settings.EngineVersion.Montreal) { + globals.off_actualWorld = LegacyPointer.Read(reader); + globals.off_dynamicWorld = LegacyPointer.Read(reader); + globals.off_inactiveDynamicWorld = LegacyPointer.Read(reader); + globals.off_fatherSector = LegacyPointer.Read(reader); + globals.off_firstSubMapPosition = LegacyPointer.Read(reader); } else { - globals.off_actualWorld = Pointer.Read(reader); - globals.off_dynamicWorld = Pointer.Read(reader); - globals.off_fatherSector = Pointer.Read(reader); + globals.off_actualWorld = LegacyPointer.Read(reader); + globals.off_dynamicWorld = LegacyPointer.Read(reader); + globals.off_fatherSector = LegacyPointer.Read(reader); uint soundEventIndex = reader.ReadUInt32(); // In Montreal version this is a pointer, also sound event related - if (Settings.s.game == Settings.Game.PlaymobilLaura) { - Pointer.Read(reader); + if (Legacy_Settings.s.game == Legacy_Settings.Game.PlaymobilLaura) { + LegacyPointer.Read(reader); } } globals.num_always = reader.ReadUInt32(); - globals.spawnablePersos = LinkedList.ReadHeader(reader, Pointer.Current(reader), LinkedList.Type.Double); - globals.off_always_reusableSO = Pointer.Read(reader); // There are (num_always) empty SuperObjects starting with this one. - if (Settings.s.engineVersion > Settings.EngineVersion.Montreal) { - globals.off_always_reusableUnknown1 = Pointer.Read(reader); // (num_always) * 0x2c blocks - globals.off_always_reusableUnknown2 = Pointer.Read(reader); // (num_always) * 0x4 blocks + globals.spawnablePersos = LinkedList.ReadHeader(reader, LegacyPointer.Current(reader), LinkedList.Type.Double); + globals.off_always_reusableSO = LegacyPointer.Read(reader); // There are (num_always) empty SuperObjects starting with this one. + if (Legacy_Settings.s.engineVersion > Legacy_Settings.EngineVersion.Montreal) { + globals.off_always_reusableUnknown1 = LegacyPointer.Read(reader); // (num_always) * 0x2c blocks + globals.off_always_reusableUnknown2 = LegacyPointer.Read(reader); // (num_always) * 0x4 blocks } else { reader.ReadUInt32(); // 0x6F. In Montreal version this is a pointer to a pointer table for always globals.spawnablePersos.FillPointers(reader, globals.spawnablePersos.off_tail, globals.spawnablePersos.offset); } - if (Settings.s.game == Settings.Game.DD) reader.ReadUInt32(); - if (Settings.s.engineVersion > Settings.EngineVersion.Montreal) { - Pointer dword_4A6B1C_always_header = Pointer.Read(reader); - Pointer dword_4A6B20_always_last = Pointer.Read(reader); + if (Legacy_Settings.s.game == Legacy_Settings.Game.DD) reader.ReadUInt32(); + if (Legacy_Settings.s.engineVersion > Legacy_Settings.EngineVersion.Montreal) { + LegacyPointer dword_4A6B1C_always_header = LegacyPointer.Read(reader); + LegacyPointer dword_4A6B20_always_last = LegacyPointer.Read(reader); - Pointer v28 = Pointer.Read(reader); - Pointer v31 = Pointer.Read(reader); - Pointer v32 = Pointer.Read(reader); - Pointer v33 = Pointer.Read(reader); + LegacyPointer v28 = LegacyPointer.Read(reader); + LegacyPointer v31 = LegacyPointer.Read(reader); + LegacyPointer v32 = LegacyPointer.Read(reader); + LegacyPointer v33 = LegacyPointer.Read(reader); // These things aren't parsed, but in raycap they're null. This way we'll notice when they aren't. if (v28 != null) print("v28 is not null, it's " + v28); @@ -643,9 +644,9 @@ async UniTask LoadLVLSNA() { // Fill in pointers for the object type tables and read them objectTypes = new ObjectType[3][]; for (uint i = 0; i < 3; i++) { - Pointer off_names_header = Pointer.Current(reader); - Pointer off_names_first = Pointer.Read(reader); - Pointer off_names_last = Pointer.Read(reader); + LegacyPointer off_names_header = LegacyPointer.Current(reader); + LegacyPointer off_names_first = LegacyPointer.Read(reader); + LegacyPointer off_names_last = LegacyPointer.Read(reader); uint num_names = reader.ReadUInt32(); FillLinkedListPointers(reader, off_names_last, off_names_header); @@ -655,8 +656,8 @@ async UniTask LoadLVLSNA() { // Begin of engineStructure loadingState = "Loading engine structure"; await WaitIfNecessary(); - print("Start of EngineStructure: " + Pointer.Current(reader)); - if (Settings.s.engineVersion > Settings.EngineVersion.Montreal) { + print("Start of EngineStructure: " + LegacyPointer.Current(reader)); + if (Legacy_Settings.s.engineVersion > Legacy_Settings.EngineVersion.Montreal) { reader.ReadByte(); string mapName = reader.ReadString(0x1E); reader.ReadChars(0x1E); @@ -668,89 +669,89 @@ async UniTask LoadLVLSNA() { string mapName = reader.ReadString(0x104); reader.ReadChars(0x104); string mapName2 = reader.ReadString(0x104); - if (Settings.s.game == Settings.Game.PlaymobilLaura) { + if (Legacy_Settings.s.game == Legacy_Settings.Game.PlaymobilLaura) { reader.ReadChars(0x104); reader.ReadChars(0x104); } string mapName3 = reader.ReadString(0x104); - if (Settings.s.game == Settings.Game.TT) { + if (Legacy_Settings.s.game == Legacy_Settings.Game.TT) { reader.ReadBytes(0x47F7); // don't know what this data is - } else if (Settings.s.game == Settings.Game.TTSE) { + } else if (Legacy_Settings.s.game == Legacy_Settings.Game.TTSE) { reader.ReadBytes(0x240F); - } else if (Settings.s.game == Settings.Game.PlaymobilLaura) { + } else if (Legacy_Settings.s.game == Legacy_Settings.Game.PlaymobilLaura) { reader.ReadBytes(0x240F); // don't know what this data is } else { // Hype & Alex reader.ReadBytes(0x2627); // don't know what this data is } } - Pointer off_unknown_first = Pointer.Read(reader); - Pointer off_unknown_last = Pointer.Read(reader); + LegacyPointer off_unknown_first = LegacyPointer.Read(reader); + LegacyPointer off_unknown_last = LegacyPointer.Read(reader); uint num_unknown = reader.ReadUInt32(); - families = LinkedList.ReadHeader(reader, Pointer.Current(reader), type: LinkedList.Type.Double); + families = LinkedList.ReadHeader(reader, LegacyPointer.Current(reader), type: LinkedList.Type.Double); families.FillPointers(reader, families.off_tail, families.off_head); - if (Settings.s.game == Settings.Game.PlaymobilLaura) { - LinkedList.ReadHeader(reader, Pointer.Current(reader), type: LinkedList.Type.Double); + if (Legacy_Settings.s.game == Legacy_Settings.Game.PlaymobilLaura) { + LinkedList.ReadHeader(reader, LegacyPointer.Current(reader), type: LinkedList.Type.Double); } - LinkedList alwaysActiveCharacters = LinkedList.ReadHeader(reader, Pointer.Current(reader), type: LinkedList.Type.Double); + LinkedList alwaysActiveCharacters = LinkedList.ReadHeader(reader, LegacyPointer.Current(reader), type: LinkedList.Type.Double); - if (Settings.s.engineVersion > Settings.EngineVersion.Montreal) { + if (Legacy_Settings.s.engineVersion > Legacy_Settings.EngineVersion.Montreal) { reader.ReadUInt32(); reader.ReadUInt32(); reader.ReadUInt32(); - if (Settings.s.game == Settings.Game.RedPlanet ||Settings.s.game == Settings.Game.R2Demo) reader.ReadUInt32(); - Pointer off_languages = Pointer.Read(reader); + if (Legacy_Settings.s.game == Legacy_Settings.Game.RedPlanet ||Legacy_Settings.s.game == Legacy_Settings.Game.R2Demo) reader.ReadUInt32(); + LegacyPointer off_languages = LegacyPointer.Read(reader); reader.ReadUInt32(); - Pointer.DoAt(ref reader, off_languages, () => { + LegacyPointer.DoAt(ref reader, off_languages, () => { ReadLanguages(reader, off_languages, localization.num_languages); }); for (uint i = 0; i < 2; i++) { - Pointer off_matrix = Pointer.Current(reader); + LegacyPointer off_matrix = LegacyPointer.Current(reader); Matrix mat = Matrix.Read(reader, off_matrix); } reader.ReadUInt32(); reader.ReadUInt16(); - ReadLevelNames(reader, Pointer.Current(reader), 80); + ReadLevelNames(reader, LegacyPointer.Current(reader), 80); uint num_mapNames = reader.ReadUInt32(); Array.Resize(ref levels, (int)num_mapNames); reader.ReadUInt16(); reader.ReadUInt32(); reader.ReadUInt32(); - if (Settings.s.game == Settings.Game.DD) { + if (Legacy_Settings.s.game == Legacy_Settings.Game.DD) { reader.ReadUInt32(); } // End of engineStructure - Pointer off_light = Pointer.Read(reader); // the offset of a light. It's just an ordinary light. - Pointer off_mainChar = Pointer.Read(reader); // superobject - Pointer off_characterLaunchingSoundEvents = Pointer.Read(reader); - if (Settings.s.game == Settings.Game.DD) { - globals.off_backgroundGameMaterial = Pointer.Read(reader); + LegacyPointer off_light = LegacyPointer.Read(reader); // the offset of a light. It's just an ordinary light. + LegacyPointer off_mainChar = LegacyPointer.Read(reader); // superobject + LegacyPointer off_characterLaunchingSoundEvents = LegacyPointer.Read(reader); + if (Legacy_Settings.s.game == Legacy_Settings.Game.DD) { + globals.off_backgroundGameMaterial = LegacyPointer.Read(reader); } - Pointer off_shadowPolygonVisualMaterial = Pointer.Read(reader); - Pointer off_shadowPolygonGameMaterialInit = Pointer.Read(reader); - Pointer off_shadowPolygonGameMaterial = Pointer.Read(reader); - Pointer off_textureOfTextureShadow = Pointer.Read(reader); - Pointer off_col_taggedFacesTable = Pointer.Read(reader); + LegacyPointer off_shadowPolygonVisualMaterial = LegacyPointer.Read(reader); + LegacyPointer off_shadowPolygonGameMaterialInit = LegacyPointer.Read(reader); + LegacyPointer off_shadowPolygonGameMaterial = LegacyPointer.Read(reader); + LegacyPointer off_textureOfTextureShadow = LegacyPointer.Read(reader); + LegacyPointer off_col_taggedFacesTable = LegacyPointer.Read(reader); for (int i = 0; i < 10; i++) { - Pointer off_elementForShadow = Pointer.Read(reader); - Pointer off_geometricShadowObject = Pointer.Read(reader); + LegacyPointer off_elementForShadow = LegacyPointer.Read(reader); + LegacyPointer off_geometricShadowObject = LegacyPointer.Read(reader); } - Pointer.Read(reader); // DemoSOList + LegacyPointer.Read(reader); // DemoSOList - if (Settings.s.game == Settings.Game.R2Demo || Settings.s.game == Settings.Game.RedPlanet || Settings.s.mode == Settings.Mode.DonaldDuckPCDemo) { - Pointer.Read(reader); + if (Legacy_Settings.s.game == Legacy_Settings.Game.R2Demo || Legacy_Settings.s.game == Legacy_Settings.Game.RedPlanet || Legacy_Settings.s.mode == Legacy_Settings.Mode.DonaldDuckPCDemo) { + LegacyPointer.Read(reader); } - if (Settings.s.mode == Settings.Mode.DonaldDuckPCDemo) { + if (Legacy_Settings.s.mode == Legacy_Settings.Mode.DonaldDuckPCDemo) { reader.ReadUInt32(); reader.ReadUInt32(); } @@ -758,7 +759,7 @@ async UniTask LoadLVLSNA() { loadingState = "Loading level animation bank"; //print("Animation bank: " + Pointer.Current(reader)); await WaitIfNecessary(); - AnimationBank.Read(reader, Pointer.Current(reader), 0, 1, files_array[Mem.LvlKeyFrames], append: true); + AnimationBank.Read(reader, LegacyPointer.Current(reader), 0, 1, files_array[Mem.LvlKeyFrames], append: true); animationBanks[1] = animationBanks[0]; } if (FileSystem.mode != FileSystem.Mode.Web) { @@ -773,9 +774,9 @@ async UniTask LoadLVLSNA() { // Can't yield inside a lambda, so we must do it the old fashioned way, with off_current if (sna.PTX != null) { - off_current = Pointer.Goto(ref reader, sna.PTX); - await ReadTexturesLvl(reader, Pointer.Current(reader)); - Pointer.Goto(ref reader, off_current); + off_current = LegacyPointer.Goto(ref reader, sna.PTX); + await ReadTexturesLvl(reader, LegacyPointer.Current(reader)); + LegacyPointer.Goto(ref reader, off_current); } /*Pointer.DoAt(ref reader, sna.PTX, () => { ReadTexturesLvl(reader, Pointer.Current(reader)); @@ -791,13 +792,13 @@ async UniTask LoadLVLSNA() { loadingState = "Creating animation bank"; await WaitIfNecessary(); - if (Settings.s.engineVersion == Settings.EngineVersion.Montreal) { + if (Legacy_Settings.s.engineVersion == Legacy_Settings.EngineVersion.Montreal) { animationBanks = new AnimationBank[2]; animationBanks[0] = new AnimationBank(null) { animations = new Animation.Component.AnimA3DGeneral[0] }; animationBanks[1] = animationBanks[0]; - } else if (Settings.s.engineVersion <= Settings.EngineVersion.TT) { + } else if (Legacy_Settings.s.engineVersion <= Legacy_Settings.EngineVersion.TT) { uint maxAnimIndex = 0; foreach (State s in states) { if (s.anim_ref != null && s.anim_ref.anim_index > maxAnimIndex) maxAnimIndex = s.anim_ref.anim_index; @@ -823,7 +824,7 @@ async UniTask LoadLVLSNA() { ReadCrossReferences(reader); // TODO: Make more generic - if (Settings.s.game == Settings.Game.R2) { + if (Legacy_Settings.s.game == Legacy_Settings.Game.R2) { loadingState = "Filling in comport names"; await WaitIfNecessary(); string path = gameDataBinFolder + "R2DC_Comports.json"; diff --git a/Assets/Scripts/OpenSpace/Loader/R2PS1Loader.cs b/Assets/Scripts/OpenSpace/Loader/R2PS1Loader.cs index 5d06e3d3..1c519ea3 100644 --- a/Assets/Scripts/OpenSpace/Loader/R2PS1Loader.cs +++ b/Assets/Scripts/OpenSpace/Loader/R2PS1Loader.cs @@ -10,6 +10,7 @@ using OpenSpace.PS1; using OpenSpace.PS1.GLI; using Cysharp.Threading.Tasks; +using BinarySerializer.Unity; namespace OpenSpace.Loader { public class R2PS1Loader : MapLoader { @@ -45,8 +46,8 @@ public class R2PS1Loader : MapLoader { public GameObject gao_always; public string[] LoadLevelList() { - if (PS1GameInfo.Games.ContainsKey(Settings.s.mode)) { - return PS1GameInfo.Games[Settings.s.mode].maps; + if (PS1GameInfo.Games.ContainsKey(Legacy_Settings.s.mode)) { + return PS1GameInfo.Games[Legacy_Settings.s.mode].maps; } return new string[] { "" }; } @@ -59,10 +60,10 @@ protected override async UniTask Load() { gameDataBinFolder += "/"; await FileSystem.CheckDirectory(gameDataBinFolder); if (!FileSystem.DirectoryExists(gameDataBinFolder)) throw new Exception("GAMEDATABIN folder doesn't exist"); - if (!PS1GameInfo.Games.ContainsKey(Settings.s.mode)) throw new Exception("PS1 info wasn't defined for this mode"); + if (!PS1GameInfo.Games.ContainsKey(Legacy_Settings.s.mode)) throw new Exception("PS1 info wasn't defined for this mode"); loadingState = "Initializing files"; //RipRHRLoc(); - game = PS1GameInfo.Games[Settings.s.mode]; + game = PS1GameInfo.Games[Legacy_Settings.s.mode]; CurrentLevel = Array.IndexOf(game.maps, lvlName); Actor1Index = Array.FindIndex(game.actors, a => a.Actor1 == actor1Name); Actor2Index = Array.FindIndex(game.actors, a => a.Actor2 == actor2Name); @@ -177,7 +178,7 @@ private uint GetActorAddress(int i) { case 0: return mainFile.memoryBlocks[CurrentLevel].overrideActor1Address ?? game.actor1Address; case 1: - if (Settings.s.game == Settings.Game.JungleBook) { + if (Legacy_Settings.s.game == Legacy_Settings.Game.JungleBook) { return (mainFile.memoryBlocks[CurrentLevel].overrideActor1Address ?? game.actor1Address) + (uint)actor1File.reader.BaseStream.Length; } @@ -186,7 +187,7 @@ private uint GetActorAddress(int i) { } } private void SetForcedActor() { - if (Settings.s.game == Settings.Game.JungleBook) { + if (Legacy_Settings.s.game == Legacy_Settings.Game.JungleBook) { if (CurrentLevel < 9) { // Story levels Actor1Index = CurrentLevel; @@ -212,7 +213,7 @@ private void SetForcedActor() { // Base address for Act2: 80149400 // I guess anything goes between >= 9 && <= 26 } - } else if (Settings.s.game == Settings.Game.RRush) { + } else if (Legacy_Settings.s.game == Legacy_Settings.Game.RRush) { if (CurrentLevel == 12) { // mainmenu Actor1Index = 8; // menubox1 Actor2Index = 9; // menubox2 @@ -223,29 +224,29 @@ private void SetForcedActor() { private void RelocateActorMemoryDonaldDuck() { Reader reader = files_array[Mem.Fix]?.reader; if (reader == null) throw new Exception("Level \"" + lvlName + "\" does not exist"); - Pointer.DoAt(ref reader, Pointer.Current(reader) + 0xe0, () => { - Pointer off_geo_dynamic = Pointer.Read(reader); + LegacyPointer.DoAt(ref reader, LegacyPointer.Current(reader) + 0xe0, () => { + LegacyPointer off_geo_dynamic = LegacyPointer.Read(reader); uint num_skinnableObjects = reader.ReadUInt32(); int num_skins = 5; - Pointer[] off_skins = new Pointer[num_skins]; + LegacyPointer[] off_skins = new LegacyPointer[num_skins]; //skins = new SkinnableGeometricObjectList[num_skins]; for (int i = 0; i < num_skins; i++) { - off_skins[i] = Pointer.Read(reader); + off_skins[i] = LegacyPointer.Read(reader); //skins[i] = Load.FromOffsetOrRead(reader, off_skins[i], onPreRead: s => s.length = num_skinnableObjects); } - Pointer off_defaultSkin = Pointer.Read(reader); - Pointer.DoAt(ref reader, off_skins[Actor1Index], () => { - Pointer off_entries = Pointer.Read(reader); - Pointer off_memory = Pointer.Read(reader); + LegacyPointer off_defaultSkin = LegacyPointer.Read(reader); + LegacyPointer.DoAt(ref reader, off_skins[Actor1Index], () => { + LegacyPointer off_entries = LegacyPointer.Read(reader); + LegacyPointer off_memory = LegacyPointer.Read(reader); uint sz_memory = reader.ReadUInt32(); byte[] memory = null; - Pointer.DoAt(ref reader, off_memory, () => { + LegacyPointer.DoAt(ref reader, off_memory, () => { memory = reader.ReadBytes((int)sz_memory); }); ((off_defaultSkin.file) as PS1Data).OverwriteData(off_defaultSkin.FileOffset, memory); }); reader.ReadUInt32(); - Pointer off_geo_static = Pointer.Read(reader); + LegacyPointer off_geo_static = LegacyPointer.Read(reader); uint num_geo_dynamic = reader.ReadUInt32(); /*if (num_skinnableObjects > 0) { // Write geometric objects into list @@ -275,27 +276,27 @@ private void RelocateActorFile(int index) { file = actor2File; } if (file != null) { - Pointer soPointer = null; + LegacyPointer soPointer = null; byte[] perso = null, unk = null, unk2 = null; - if (Settings.s.game == Settings.Game.RRush) { - Pointer.DoAt(ref reader, new Pointer((uint)file.headerOffset, file), () => { - soPointer = Pointer.Read(reader); + if (Legacy_Settings.s.game == Legacy_Settings.Game.RRush) { + LegacyPointer.DoAt(ref reader, new LegacyPointer((uint)file.headerOffset, file), () => { + soPointer = LegacyPointer.Read(reader); perso = reader.ReadBytes(0x18); unk = reader.ReadBytes(4); unk2 = reader.ReadBytes(2); }); - Pointer.DoAt(ref reader, Pointer.Current(reader) + 0x68, () => { - Pointer off_persos = Pointer.Read(reader); - Pointer.DoAt(ref reader, off_persos + (index * 0x18), () => { - (off_persos.file as PS1Data).OverwriteData(Pointer.Current(reader).FileOffset, perso); + LegacyPointer.DoAt(ref reader, LegacyPointer.Current(reader) + 0x68, () => { + LegacyPointer off_persos = LegacyPointer.Read(reader); + LegacyPointer.DoAt(ref reader, off_persos + (index * 0x18), () => { + (off_persos.file as PS1Data).OverwriteData(LegacyPointer.Current(reader).FileOffset, perso); }); }); - Pointer.DoAt(ref reader, Pointer.Current(reader) + 0x40, () => { - Pointer off_dynamicWorld = Pointer.Read(reader); - Pointer.DoAt(ref reader, off_dynamicWorld, () => { + LegacyPointer.DoAt(ref reader, LegacyPointer.Current(reader) + 0x40, () => { + LegacyPointer off_dynamicWorld = LegacyPointer.Read(reader); + LegacyPointer.DoAt(ref reader, off_dynamicWorld, () => { reader.ReadBytes(0x8); - Pointer firstChild = Pointer.Read(reader); - Pointer lastChild = Pointer.Read(reader); + LegacyPointer firstChild = LegacyPointer.Read(reader); + LegacyPointer lastChild = LegacyPointer.Read(reader); uint numChild = reader.ReadUInt32(); if (numChild == 0) { firstChild = soPointer; @@ -311,31 +312,31 @@ private void RelocateActorFile(int index) { (off_dynamicWorld.file as PS1Data).OverwriteData(off_dynamicWorld.FileOffset + 0x10, numChild); }); }); - } else if (Settings.s.game == Settings.Game.JungleBook) { - Pointer.DoAt(ref reader, new Pointer((uint)file.headerOffset, file) + 0x98, () => { + } else if (Legacy_Settings.s.game == Legacy_Settings.Game.JungleBook) { + LegacyPointer.DoAt(ref reader, new LegacyPointer((uint)file.headerOffset, file) + 0x98, () => { //soPointer = Pointer.Read(reader); perso = reader.ReadBytes(0x18); /*unk = reader.ReadBytes(4); unk2 = reader.ReadBytes(2);*/ }); - Pointer.DoAt(ref reader, Pointer.Current(reader) + 0x114, () => { - Pointer off_persos = Pointer.Read(reader); - Pointer.DoAt(ref reader, off_persos + (index * 0x18), () => { - (off_persos.file as PS1Data).OverwriteData(Pointer.Current(reader).FileOffset, perso); + LegacyPointer.DoAt(ref reader, LegacyPointer.Current(reader) + 0x114, () => { + LegacyPointer off_persos = LegacyPointer.Read(reader); + LegacyPointer.DoAt(ref reader, off_persos + (index * 0x18), () => { + (off_persos.file as PS1Data).OverwriteData(LegacyPointer.Current(reader).FileOffset, perso); // Start reading the data we've just overwritten reader.ReadUInt32(); - Pointer soPointerPointer = Pointer.Read(reader); - Pointer.DoAt(ref reader, soPointerPointer, () => { - soPointer = Pointer.Read(reader); + LegacyPointer soPointerPointer = LegacyPointer.Read(reader); + LegacyPointer.DoAt(ref reader, soPointerPointer, () => { + soPointer = LegacyPointer.Read(reader); }); }); }); - Pointer.DoAt(ref reader, Pointer.Current(reader) + 0xEC, () => { - Pointer off_dynamicWorld = Pointer.Read(reader); - Pointer.DoAt(ref reader, off_dynamicWorld, () => { + LegacyPointer.DoAt(ref reader, LegacyPointer.Current(reader) + 0xEC, () => { + LegacyPointer off_dynamicWorld = LegacyPointer.Read(reader); + LegacyPointer.DoAt(ref reader, off_dynamicWorld, () => { reader.ReadBytes(0x8); - Pointer firstChild = Pointer.Read(reader); - Pointer lastChild = Pointer.Read(reader); + LegacyPointer firstChild = LegacyPointer.Read(reader); + LegacyPointer lastChild = LegacyPointer.Read(reader); uint numChild = reader.ReadUInt32(); if (numChild == 0) { firstChild = soPointer; @@ -352,10 +353,10 @@ private void RelocateActorFile(int index) { }); }); } - Pointer.DoAt(ref reader, soPointer, () => { + LegacyPointer.DoAt(ref reader, soPointer, () => { reader.ReadBytes(0x20); - Pointer off_matrix = Pointer.Read(reader); - Pointer.DoAt(ref reader, off_matrix, () => { + LegacyPointer off_matrix = LegacyPointer.Read(reader); + LegacyPointer.DoAt(ref reader, off_matrix, () => { (off_matrix.file as PS1Data).OverwriteData(off_matrix.FileOffset, new byte[0x14]); (off_matrix.file as PS1Data).OverwriteData(off_matrix.FileOffset + 0x14, (uint)(index * 0x100)); (off_matrix.file as PS1Data).OverwriteData(off_matrix.FileOffset + 0x18, (uint)(0 * 0x100)); @@ -469,7 +470,7 @@ public void CalculateNumberOfStatesPerFamily() { } } public void ReadCollSetsR2(Reader reader) { - if (Settings.s.game != Settings.Game.R2) return; + if (Legacy_Settings.s.game != Legacy_Settings.Game.R2) return; Dictionary> collSets = new Dictionary>(); Dictionary> fcollSets = new Dictionary>(); foreach (PS1.Perso p in levelHeader.persos) { @@ -503,7 +504,7 @@ public async UniTask LoadLevel() { RelocateActorFile(0); RelocateActorFile(1); } - if (Settings.s.game == Settings.Game.DD) { + if (Legacy_Settings.s.game == Legacy_Settings.Game.DD) { RelocateActorMemoryDonaldDuck(); } @@ -513,7 +514,7 @@ public async UniTask LoadLevel() { loadingState = "Loading level header"; await WaitIfNecessary(); - levelHeader = FromOffsetOrRead(reader, Pointer.Current(reader)); + levelHeader = FromOffsetOrRead(reader, LegacyPointer.Current(reader)); loadingState = "Loading superobject hierarchy"; await WaitIfNecessary(); @@ -521,11 +522,11 @@ public async UniTask LoadLevel() { levelHeader.dynamicWorld = FromOffsetOrRead(reader, levelHeader.off_dynamicWorld, onPreRead: s => s.isDynamic = true); levelHeader.inactiveDynamicWorld = FromOffsetOrRead(reader, levelHeader.off_inactiveDynamicWorld, onPreRead: s => s.isDynamic = true); - if (Settings.s.game == Settings.Game.RRush || Settings.s.game == Settings.Game.JungleBook) { + if (Legacy_Settings.s.game == Legacy_Settings.Game.RRush || Legacy_Settings.s.game == Legacy_Settings.Game.JungleBook) { loadingState = "Loading actor files"; await WaitIfNecessary(); - if (actor1File != null) actor1Header = FromOffsetOrRead(reader, new Pointer((uint)actor1File.headerOffset, actor1File), onPreRead: h => h.file_index = 1); - if (actor2File != null) actor2Header = FromOffsetOrRead(reader, new Pointer((uint)actor2File.headerOffset, actor2File), onPreRead: h => h.file_index = 2); + if (actor1File != null) actor1Header = FromOffsetOrRead(reader, new LegacyPointer((uint)actor1File.headerOffset, actor1File), onPreRead: h => h.file_index = 1); + if (actor2File != null) actor2Header = FromOffsetOrRead(reader, new LegacyPointer((uint)actor2File.headerOffset, actor2File), onPreRead: h => h.file_index = 2); } CalculateNumberOfStatesPerFamily(); ReadCollSetsR2(reader); @@ -608,7 +609,7 @@ public async UniTask LoadLevel() { loadingState = $"Loading cinematic streams : {j+1}/{b.cutscenes.Length}"; await WaitIfNecessary(); reader = files_array[2 + j].reader; - streams[j] = FromOffsetOrRead(reader, Pointer.Current(reader), inline: true); + streams[j] = FromOffsetOrRead(reader, LegacyPointer.Current(reader), inline: true); } } @@ -648,7 +649,7 @@ public async UniTask LoadDataFromDAT(PS1GameInfo gameInfo, PS1GameInfo.File file loadingState = "Extracting data from bigfile(s)"; await WaitIfNecessary(); if (FileSystem.FileExists(bigFilePath)) { - using (Reader reader = new Reader(FileSystem.GetFileReadStream(bigFilePath), isLittleEndian: Settings.s.IsLittleEndian)) { + using (Reader reader = new Reader(FileSystem.GetFileReadStream(bigFilePath), isLittleEndian: Legacy_Settings.s.IsLittleEndian)) { loadingState = "Extracting data from bigfile(s): main data"; await WaitIfNecessary(); @@ -658,7 +659,7 @@ public async UniTask LoadDataFromDAT(PS1GameInfo gameInfo, PS1GameInfo.File file if (fileInfo.type == PS1GameInfo.File.Type.Map) { if (CurrentLevel < 0 || CurrentLevel >= fileInfo.memoryBlocks.Length) return; if (!b.inEngine) return; - if (Settings.s.game != Settings.Game.RRush && !b.exeOnly) FileSystem.AddVirtualFile(levelDir + "vignette.tim", mainBlock[blockIndex++]); + if (Legacy_Settings.s.game != Legacy_Settings.Game.RRush && !b.exeOnly) FileSystem.AddVirtualFile(levelDir + "vignette.tim", mainBlock[blockIndex++]); if (!b.exeOnly && b.inEngine) { if (b.hasSoundEffects) { FileSystem.AddVirtualFile(levelDir + "sound.vb", mainBlock[blockIndex++]); @@ -730,7 +731,7 @@ public async UniTask ExtractDAT(PS1GameInfo gameInfo, PS1GameInfo.File fileInfo, List mainBlock = await ExtractPackedBlocks(reader, b.main_compressed, fileInfo.baseLBA); int blockIndex = 0; if (fileInfo.type == PS1GameInfo.File.Type.Map) { - if (Settings.s.game != Settings.Game.RRush && !b.exeOnly) Util.ByteArrayToFile(levelDir + "vignette.tim", mainBlock[blockIndex++]); + if (Legacy_Settings.s.game != Legacy_Settings.Game.RRush && !b.exeOnly) Util.ByteArrayToFile(levelDir + "vignette.tim", mainBlock[blockIndex++]); if (!b.exeOnly && b.inEngine) { if (b.hasSoundEffects) { Util.ByteArrayToFile(levelDir + "sound.vb", mainBlock[blockIndex++]); @@ -882,7 +883,7 @@ public async UniTask ExtractDAT(PS1GameInfo gameInfo, PS1GameInfo.File fileInfo, public void ParseMainBlock(byte[] data, PS1GameInfo.File.MemoryBlock block, int index, string basename) { using (MemoryStream ms = new MemoryStream(data)) { - using (Reader reader = new Reader(ms, Settings.s.IsLittleEndian)) { + using (Reader reader = new Reader(ms, Legacy_Settings.s.IsLittleEndian)) { reader.ReadUInt32(); reader.ReadUInt32(); uint loadingImgSize = reader.ReadUInt32(); @@ -919,7 +920,7 @@ public void SplitCutsceneStream(byte[] cutsceneData, out byte[] cutsceneAudio, o List cutsceneAudioList = new List(); List cutsceneFramesList = new List(); using (MemoryStream ms = new MemoryStream(cutsceneData)) { - using (Reader reader = new Reader(ms, Settings.s.IsLittleEndian)) { + using (Reader reader = new Reader(ms, Legacy_Settings.s.IsLittleEndian)) { uint size_frame_packet = 1; while (reader.BaseStream.Position < reader.BaseStream.Length && size_frame_packet > 0) { size_frame_packet = reader.ReadUInt32(); @@ -1028,7 +1029,7 @@ public async UniTask> ExtractPackedBlocks(Reader reader, PS1GameInf byte[] compressedData = reader.ReadBytes((int)compressedSize); using (var compressedStream = new MemoryStream(compressedData)) using (var lzo = new LzoStream(compressedStream, CompressionMode.Decompress)) - using (Reader lzoReader = new Reader(lzo, Settings.s.IsLittleEndian)) { + using (Reader lzoReader = new Reader(lzo, Legacy_Settings.s.IsLittleEndian)) { lzo.SetLength(decompressedSize); uncompressedData = lzoReader.ReadBytes((int)decompressedSize); } @@ -1050,7 +1051,7 @@ public async UniTask> ExtractPackedBlocks(Reader reader, PS1GameInf #region Textures public void FillVRAM() { int startXPage = 5; - if (Settings.s.game == Settings.Game.JungleBook) { + if (Legacy_Settings.s.game == Legacy_Settings.Game.JungleBook) { startXPage = 8; } vram.currentXPage = startXPage; diff --git a/Assets/Scripts/OpenSpace/Loader/R2PS2Loader.cs b/Assets/Scripts/OpenSpace/Loader/R2PS2Loader.cs index 3671b1ce..d0f06c8b 100644 --- a/Assets/Scripts/OpenSpace/Loader/R2PS2Loader.cs +++ b/Assets/Scripts/OpenSpace/Loader/R2PS2Loader.cs @@ -20,12 +20,13 @@ using System.Text; using System.Threading.Tasks; using Cysharp.Threading.Tasks; +using BinarySerializer.Unity; namespace OpenSpace.Loader { public class R2PS2Loader : MapLoader { public List txds = new List(); public MeshFile ato; - public Pointer[] off_materials; + public LegacyPointer[] off_materials; public uint meshesRead = 0; public VisualMaterial lightCookieMaterial; public Color[] lightCookieColors; @@ -43,20 +44,20 @@ protected override async UniTask Load() { // Prepare folder names - string fixFolder = gameDataBinFolder + ConvertCase("Fix/", Settings.CapsType.LevelFolder); - string lvlFolder = gameDataBinFolder + ConvertCase(lvlName + "/", Settings.CapsType.LevelFolder); + string fixFolder = gameDataBinFolder + ConvertCase("Fix/", Legacy_Settings.CapsType.LevelFolder); + string lvlFolder = gameDataBinFolder + ConvertCase(lvlName + "/", Legacy_Settings.CapsType.LevelFolder); // Prepare paths - paths["fix.lv2"] = fixFolder + ConvertCase("Fix.lv2", Settings.CapsType.LevelFile); - paths["fix.pt2"] = fixFolder + ConvertCase("Fix.pt2", Settings.CapsType.LevelFile); - paths["lvl.lv2"] = lvlFolder + ConvertCase(lvlName + ".lv2", Settings.CapsType.LevelFile); - paths["lvl.pt2"] = lvlFolder + ConvertCase(lvlName + ".pt2", Settings.CapsType.LevelFile); - paths["lvl.ato.0"] = lvlFolder + ConvertCase(lvlName + ".ato.0", Settings.CapsType.LevelFile); - paths["lvl.rw3.0"] = lvlFolder + ConvertCase(lvlName + ".rw3.0", Settings.CapsType.LevelFile); - paths["lvl.lm3.0"] = lvlFolder + ConvertCase(lvlName + ".lm3.0", Settings.CapsType.LevelFile); - paths["lvl.lm3.1"] = lvlFolder + ConvertCase(lvlName + ".lm3.1", Settings.CapsType.LevelFile); - paths["lvl.lm3.2"] = lvlFolder + ConvertCase(lvlName + ".lm3.2", Settings.CapsType.LevelFile); - paths["lvl.dmo"] = lvlFolder + ConvertCase(lvlName + ".dmo", Settings.CapsType.LevelFile); + paths["fix.lv2"] = fixFolder + ConvertCase("Fix.lv2", Legacy_Settings.CapsType.LevelFile); + paths["fix.pt2"] = fixFolder + ConvertCase("Fix.pt2", Legacy_Settings.CapsType.LevelFile); + paths["lvl.lv2"] = lvlFolder + ConvertCase(lvlName + ".lv2", Legacy_Settings.CapsType.LevelFile); + paths["lvl.pt2"] = lvlFolder + ConvertCase(lvlName + ".pt2", Legacy_Settings.CapsType.LevelFile); + paths["lvl.ato.0"] = lvlFolder + ConvertCase(lvlName + ".ato.0", Legacy_Settings.CapsType.LevelFile); + paths["lvl.rw3.0"] = lvlFolder + ConvertCase(lvlName + ".rw3.0", Legacy_Settings.CapsType.LevelFile); + paths["lvl.lm3.0"] = lvlFolder + ConvertCase(lvlName + ".lm3.0", Legacy_Settings.CapsType.LevelFile); + paths["lvl.lm3.1"] = lvlFolder + ConvertCase(lvlName + ".lm3.1", Legacy_Settings.CapsType.LevelFile); + paths["lvl.lm3.2"] = lvlFolder + ConvertCase(lvlName + ".lm3.2", Legacy_Settings.CapsType.LevelFile); + paths["lvl.dmo"] = lvlFolder + ConvertCase(lvlName + ".dmo", Legacy_Settings.CapsType.LevelFile); // Download files foreach (KeyValuePair path in paths) { @@ -108,19 +109,19 @@ async UniTask LoadPS2() { await WaitIfNecessary(); files_array[Mem.Fix].GotoHeader(); Reader reader = files_array[Mem.Fix].reader; - Pointer off_base_fix = Pointer.Current(reader); + LegacyPointer off_base_fix = LegacyPointer.Current(reader); loadingState = "Loading input struct"; await WaitIfNecessary(); - for (int i = 0; i < Settings.s.numEntryActions; i++) { - Pointer.Read(reader); // 3DOS_EntryActions + for (int i = 0; i < Legacy_Settings.s.numEntryActions; i++) { + LegacyPointer.Read(reader); // 3DOS_EntryActions } - inputStruct = InputStructure.Read(reader, Pointer.Current(reader)); + inputStruct = InputStructure.Read(reader, LegacyPointer.Current(reader)); foreach (EntryAction ea in inputStruct.entryActions) { print(ea.ToString()); } - localization = FromOffsetOrRead(reader, Pointer.Current(reader), inline: true); + localization = FromOffsetOrRead(reader, LegacyPointer.Current(reader), inline: true); /* Pointer off_inputStructure = Pointer.Read(reader); @@ -231,33 +232,33 @@ async UniTask LoadPS2() { reader.ReadUInt32(); reader.ReadUInt32(); // 0xc reader.ReadUInt32(); // 0 - Pointer.Read(reader); - Pointer.Read(reader); + LegacyPointer.Read(reader); + LegacyPointer.Read(reader); // Globals - globals.off_actualWorld = Pointer.Read(reader); - globals.off_dynamicWorld = Pointer.Read(reader); - globals.off_fatherSector = Pointer.Read(reader); + globals.off_actualWorld = LegacyPointer.Read(reader); + globals.off_dynamicWorld = LegacyPointer.Read(reader); + globals.off_fatherSector = LegacyPointer.Read(reader); globals.num_always = reader.ReadUInt32(); - globals.spawnablePersos = LinkedList.ReadHeader(reader, Pointer.Current(reader), LinkedList.Type.Double); + globals.spawnablePersos = LinkedList.ReadHeader(reader, LegacyPointer.Current(reader), LinkedList.Type.Double); //globals.spawnablePersos.FillPointers(reader, globals.spawnablePersos.off_tail, globals.spawnablePersos.offset); - Pointer.Read(reader); // format: (0x4 number, number * 0x4: null) - globals.off_always_reusableSO = Pointer.Read(reader); // There are (num_always) empty SuperObjects starting with this one. - Pointer.Read(reader); - Pointer.Read(reader); - Pointer.Read(reader); - Pointer.Read(reader); - Pointer.Read(reader); + LegacyPointer.Read(reader); // format: (0x4 number, number * 0x4: null) + globals.off_always_reusableSO = LegacyPointer.Read(reader); // There are (num_always) empty SuperObjects starting with this one. + LegacyPointer.Read(reader); + LegacyPointer.Read(reader); + LegacyPointer.Read(reader); + LegacyPointer.Read(reader); + LegacyPointer.Read(reader); - LinkedList cameras = LinkedList.ReadHeader(reader, Pointer.Current(reader), LinkedList.Type.Double); - families = LinkedList.ReadHeader(reader, Pointer.Current(reader), type: LinkedList.Type.Double); - LinkedList mainChars = LinkedList.ReadHeader(reader, Pointer.Current(reader), LinkedList.Type.Double); - Pointer.Read(reader); // Rayman + LinkedList cameras = LinkedList.ReadHeader(reader, LegacyPointer.Current(reader), LinkedList.Type.Double); + families = LinkedList.ReadHeader(reader, LegacyPointer.Current(reader), type: LinkedList.Type.Double); + LinkedList mainChars = LinkedList.ReadHeader(reader, LegacyPointer.Current(reader), LinkedList.Type.Double); + LegacyPointer.Read(reader); // Rayman reader.ReadUInt32(); - globals.off_camera = Pointer.Read(reader); // Camera - Pointer.Read(reader); - Pointer.Read(reader); - Pointer.Read(reader); + globals.off_camera = LegacyPointer.Read(reader); // Camera + LegacyPointer.Read(reader); + LegacyPointer.Read(reader); + LegacyPointer.Read(reader); uint numMeshes = (uint)files_array[Mem.Lvl].extraData["numMeshes"]; uint numMaterials = (uint)files_array[Mem.Lvl].extraData["numMaterials"]; @@ -267,46 +268,46 @@ async UniTask LoadPS2() { textures = new TextureInfo[numTextures]; - Pointer[] off_meshes = new Pointer[numMeshes]; - off_materials = new Pointer[numMaterials]; + LegacyPointer[] off_meshes = new LegacyPointer[numMeshes]; + off_materials = new LegacyPointer[numMaterials]; for (int i = 0; i < numMeshes; i++) { - off_meshes[i] = Pointer.Read(reader); + off_meshes[i] = LegacyPointer.Read(reader); } for (int i = 0; i < numMaterials; i++) { - off_materials[i] = Pointer.Read(reader); + off_materials[i] = LegacyPointer.Read(reader); } for (int i = 0; i < numTextures; i++) { - Pointer off_textureInfo = Pointer.Read(reader); + LegacyPointer off_textureInfo = LegacyPointer.Read(reader); int texture_index = reader.ReadInt32(); - Pointer.DoAt(ref reader, off_textureInfo, () => { + LegacyPointer.DoAt(ref reader, off_textureInfo, () => { textures[i] = TextureInfo.Read(reader, off_textureInfo); textures[i].Texture = txds[0].Lookup(texture_index.ToString("D3")); //textures[i].Texture = txds[0].textures[txds[0].Count - 1 - texture_index]; }); } - Pointer.Read(reader); + LegacyPointer.Read(reader); reader.ReadUInt32(); reader.ReadUInt32(); - Pointer.Read(reader); + LegacyPointer.Read(reader); uint num_unk = reader.ReadUInt32(); for (int i = 0; i < num_unk; i++) { - Pointer.Read(reader); + LegacyPointer.Read(reader); } uint num_unk2 = reader.ReadUInt32(); for (int i = 0; i < num_unk2; i++) { - Pointer.Read(reader); + LegacyPointer.Read(reader); } - Pointer.Read(reader); + LegacyPointer.Read(reader); reader.ReadSingle(); // a bounding volume most likely reader.ReadSingle(); reader.ReadSingle(); reader.ReadSingle(); reader.ReadSingle(); reader.ReadSingle(); - Pointer.Read(reader); + LegacyPointer.Read(reader); reader.ReadUInt32(); // 2? uint num_poTable = reader.ReadUInt32(); - Pointer off_poTable = Pointer.Read(reader); + LegacyPointer off_poTable = LegacyPointer.Read(reader); reader.ReadUInt32(); // 1. 10x 0 reader.ReadUInt32(); // 2 reader.ReadUInt32(); // 3 @@ -337,14 +338,14 @@ async UniTask LoadPS2() { reader.ReadByte(); } reader.Align(0x4); - Pointer off_lightCookieMaterial = Pointer.Read(reader); + LegacyPointer off_lightCookieMaterial = LegacyPointer.Read(reader); lightCookieMaterial = VisualMaterial.FromOffsetOrRead(off_lightCookieMaterial, reader); - off_lightmapUV = new Pointer[numLightmappedObjects]; + off_lightmapUV = new LegacyPointer[numLightmappedObjects]; for (int i = 0; i < numLightmappedObjects; i++) { reader.ReadUInt32(); reader.ReadUInt32(); reader.ReadUInt32(); - off_lightmapUV[i] = Pointer.Read(reader); + off_lightmapUV[i] = LegacyPointer.Read(reader); } @@ -353,7 +354,7 @@ async UniTask LoadPS2() { VisualMaterial.FromOffsetOrRead(off_materials[i], reader); } for (int i = 0; i < numMeshes; i++) { - Pointer.DoAt(ref reader, off_meshes[i], () => { + LegacyPointer.DoAt(ref reader, off_meshes[i], () => { GeometricObject mesh = GeometricObject.Read(reader, off_meshes[i]); meshObjects.Add(mesh); //print("Mesh " + i + ": " + mesh.num_vertices + " - " + mesh.subblock_types[0] + " - " + mesh.num_subblocks); diff --git a/Assets/Scripts/OpenSpace/Loader/R2ROMLoader.cs b/Assets/Scripts/OpenSpace/Loader/R2ROMLoader.cs index 84345222..be51db32 100644 --- a/Assets/Scripts/OpenSpace/Loader/R2ROMLoader.cs +++ b/Assets/Scripts/OpenSpace/Loader/R2ROMLoader.cs @@ -11,6 +11,7 @@ using System.Threading.Tasks; using Newtonsoft.Json; using Cysharp.Threading.Tasks; +using BinarySerializer.Unity; namespace OpenSpace.Loader { public class R2ROMLoader : MapLoader { @@ -27,8 +28,8 @@ public class R2ROMLoader : MapLoader { public LevelHeader level; public Localization localizationROM = null; - public Pointer[] texturesTable; - public Pointer[] palettesTable; + public LegacyPointer[] texturesTable; + public LegacyPointer[] palettesTable; public uint ind_textureTable_i4; public uint ind_textureTable_i8; public uint ind_textureTable_rgba; @@ -52,12 +53,12 @@ public string[] LoadLevelList() { fatTables = new FATTable[num_tables + 2]; } for (uint i = 0; i < num_tables + 2; i++) { - fatTables[i] = FATTable.Read(reader, Pointer.Current(reader), readEntries: i < 2); + fatTables[i] = FATTable.Read(reader, LegacyPointer.Current(reader), readEntries: i < 2); } string[] levels = new string[num_tables]; - Pointer off_levelList = GetStructPtr(FATEntry.Type.LevelList, (ushort)(0 | FATEntry.Flag.Fix), false); + LegacyPointer off_levelList = GetStructPtr(FATEntry.Type.LevelList, (ushort)(0 | FATEntry.Flag.Fix), false); for (int i = 0; i < levels.Length; i++) { - Pointer.DoAt(ref reader, off_levelList + 64*i, () => { + LegacyPointer.DoAt(ref reader, off_levelList + 64*i, () => { reader.ReadUInt16(); levels[i] = reader.ReadNullDelimitedString(); }); @@ -107,8 +108,8 @@ protected override async UniTask Load() { Debug.LogError("Textures saved. Due to how N64 loading works, levels can only be loaded without Save Textures."); return; } - if (Settings.s.game == Settings.Game.R2 - && (Settings.s.platform == Settings.Platform.N64 || Settings.s.platform == Settings.Platform.DS)) { + if (Legacy_Settings.s.game == Legacy_Settings.Game.R2 + && (Legacy_Settings.s.platform == Legacy_Settings.Platform.N64 || Legacy_Settings.s.platform == Legacy_Settings.Platform.DS)) { string objectNamesFileName = "objectNames_" + lvlName.ToLower() + ".json"; string objectNamesPath = gameDataBinFolder + "objectNames/" + objectNamesFileName; await PrepareFile(objectNamesPath); @@ -261,7 +262,7 @@ public async UniTask LoadFat() { loadingState = "Loading struct table " + (i + 1) + "/" + (num_tables + 2); await WaitIfNecessary(); } - fatTables[i] = FATTable.Read(reader, Pointer.Current(reader), readEntries: i < 2); + fatTables[i] = FATTable.Read(reader, LegacyPointer.Current(reader), readEntries: i < 2); } await WaitIfNecessary(); } @@ -289,51 +290,51 @@ public async UniTask LoadFix() { ushort num_levels = reader.ReadUInt16(); reader.ReadUInt16(); - if (Settings.s.platform == Settings.Platform.DS || Settings.s.platform == Settings.Platform.N64) { + if (Legacy_Settings.s.platform == Legacy_Settings.Platform.DS || Legacy_Settings.s.platform == Legacy_Settings.Platform.N64) { loadingState = "Loading texture tables"; await WaitIfNecessary(); for (int i = 0; i < 18; i++) { - Pointer off_list = Pointer.Read(reader); + LegacyPointer off_list = LegacyPointer.Read(reader); uint num_list = reader.ReadUInt32(); } - Pointer off_table_i4 = Pointer.Read(reader); + LegacyPointer off_table_i4 = LegacyPointer.Read(reader); uint sz_table_i4 = reader.ReadUInt32() >> 2; - Pointer off_table_i8 = Pointer.Read(reader); + LegacyPointer off_table_i8 = LegacyPointer.Read(reader); uint sz_table_i8 = reader.ReadUInt32() >> 2; - Pointer off_table_rgba = Pointer.Read(reader); + LegacyPointer off_table_rgba = LegacyPointer.Read(reader); uint sz_table_rgba = reader.ReadUInt32() >> 2; ind_textureTable_i4 = 0; ind_textureTable_i8 = ind_textureTable_i4 + (sz_table_i4); ind_textureTable_rgba = ind_textureTable_i8 + (sz_table_i8); uint totalSz = ind_textureTable_rgba + (sz_table_rgba); - texturesTable = new Pointer[totalSz]; - Pointer.DoAt(ref reader, off_table_i4, () => { + texturesTable = new LegacyPointer[totalSz]; + LegacyPointer.DoAt(ref reader, off_table_i4, () => { for (int i = 0; i < sz_table_i4; i++) { - texturesTable[ind_textureTable_i4 + i] = Pointer.Read(reader); + texturesTable[ind_textureTable_i4 + i] = LegacyPointer.Read(reader); } }); - Pointer.DoAt(ref reader, off_table_i8, () => { + LegacyPointer.DoAt(ref reader, off_table_i8, () => { for (int i = 0; i < sz_table_i8; i++) { - texturesTable[ind_textureTable_i8 + i] = Pointer.Read(reader); + texturesTable[ind_textureTable_i8 + i] = LegacyPointer.Read(reader); } }); - Pointer.DoAt(ref reader, off_table_rgba, () => { + LegacyPointer.DoAt(ref reader, off_table_rgba, () => { for (int i = 0; i < sz_table_rgba; i++) { - texturesTable[ind_textureTable_rgba + i] = Pointer.Read(reader); + texturesTable[ind_textureTable_rgba + i] = LegacyPointer.Read(reader); } }); - Pointer off_palettesTable = Pointer.Read(reader); - if (Settings.s.platform == Settings.Platform.DS) { + LegacyPointer off_palettesTable = LegacyPointer.Read(reader); + if (Legacy_Settings.s.platform == Legacy_Settings.Platform.DS) { uint sz_palettesTable = reader.ReadUInt32() >> 2; - palettesTable = new Pointer[sz_palettesTable]; + palettesTable = new LegacyPointer[sz_palettesTable]; print(texturesTable.Length + " - " + palettesTable.Length); - Pointer.DoAt(ref reader, off_palettesTable, () => { + LegacyPointer.DoAt(ref reader, off_palettesTable, () => { for (int i = 0; i < sz_palettesTable; i++) { - palettesTable[i] = Pointer.Read(reader); + palettesTable[i] = LegacyPointer.Read(reader); } }); } else { - palettesTable = new Pointer[0]; + palettesTable = new LegacyPointer[0]; } } @@ -481,7 +482,7 @@ public async UniTask LoadAnims() { reader.ReadUInt32(); reader.ReadUInt32(); reader.ReadUInt32(); - Pointer eof = null; + LegacyPointer eof = null; romAnims = new ROMAnimation[num_anims]; for (uint i = 0; i < num_anims; i++) { uint offset = reader.ReadUInt32(); @@ -489,12 +490,12 @@ public async UniTask LoadAnims() { compressed = (offset & 0x80000000) == 0x80000000, index = i }; - romAnims[i].Init(new Pointer(offset & 0x7FFFFFFF, files_array[SMem.Anims])); + romAnims[i].Init(new LegacyPointer(offset & 0x7FFFFFFF, files_array[SMem.Anims])); if (i > 0) { romAnims[i - 1].compressedSize = romAnims[i].Offset.offset - romAnims[i - 1].Offset.offset; } } - eof = new Pointer(reader.ReadUInt32(), files_array[SMem.Anims]); // EOF + eof = new LegacyPointer(reader.ReadUInt32(), files_array[SMem.Anims]); // EOF if (num_anims > 0) { romAnims[num_anims - 1].compressedSize = eof.offset - romAnims[num_anims - 1].Offset.offset; } @@ -513,7 +514,7 @@ public async UniTask LoadAnims() { List shAnimsList = new List(); while (reader.BaseStream.Position < reader.BaseStream.Length) { ROMShAnimation shAnim = new ROMShAnimation(); - shAnim.Init(Pointer.Current(reader)); + shAnim.Init(LegacyPointer.Current(reader)); shAnim.Read(reader, true); shAnimsList.Add(shAnim); } @@ -524,7 +525,7 @@ public async UniTask LoadAnims() { loadingState = "Loading animations: cuttable"; await WaitIfNecessary(); cutTable = new ROMAnimationCutTable(); - cutTable.Init(Pointer.Current(reader)); + cutTable.Init(LegacyPointer.Current(reader)); cutTable.length = (ushort)num_anims; cutTable.Read(reader, true); } @@ -536,7 +537,7 @@ public void ExportTextures(Reader reader) { for (int i = 0; i < fatTables.Length; i++) { for (int j = 0; j < fatTables[i].entries.Length; j++) { if (fatTables[i].entries[j].EntryType != FATEntry.Type.TextureInfo) continue; - Pointer ptr = new Pointer(fatTables[i].entries[j].off_data, files_array[SMem.Data]); + LegacyPointer ptr = new LegacyPointer(fatTables[i].entries[j].off_data, files_array[SMem.Data]); TextureInfo texInfo = new TextureInfo(); texInfo.Init(ptr, fatTables[i].entries[j].index); texInfo.Read(reader); @@ -593,7 +594,7 @@ public void ExportTextures(Reader reader) { } }*/ //print("Unused textures: " + texturesTableSeen.Where(t => !t).Count() + " - Unused palettes: " + palettesTableSeen.Where(p => !p).Count()); - if (Settings.s.platform == Settings.Platform.DS) { + if (Legacy_Settings.s.platform == Legacy_Settings.Platform.DS) { // R2 DS /*PAL palette = new PAL(gameDataBinFolder + "hud/objpal.bin"); ExportNBFC("hud/sprlums1.nbfc", 4, 4, palette.palette); @@ -669,7 +670,7 @@ public void ExportTextures(Reader reader) { ExportNBFC("hud/wifi_level_2.bgc", 2, 2, new PAL(gameDataBinFolder + "hud/wifi_level_0.pal").palette, i4: true); ExportNBFC("hud/wifi_level_3.bgc", 2, 2, new PAL(gameDataBinFolder + "hud/wifi_level_0.pal").palette, i4: true);*/ } - if (Settings.s.platform == Settings.Platform._3DS) { + if (Legacy_Settings.s.platform == Legacy_Settings.Platform._3DS) { // Stored separately for (int i = 1; i < 25; i++) { ExportEtcFile("LoadingAnimation/Course_" + i.ToString("D2") + ".etc", 64, 64, false); @@ -701,7 +702,7 @@ public T Get(ushort index) where T : ROMStruct { if (rs == null) { if (index != 0xFFFF) { FATEntry.Type type = FATEntry.types[typeof(T)]; - Pointer offset = null; + LegacyPointer offset = null; // For some reason, this type receives special treatment if (type == FATEntry.Type.EntryAction && ((index & (ushort)FATEntry.Flag.Fix) != (ushort)FATEntry.Flag.Fix)) { @@ -734,7 +735,7 @@ public T Get(ushort index) where T : ROMStruct { } public void ExportEtcFile(string name, int w, int h, bool hasAlpha) { - if (Settings.s.platform == Settings.Platform._3DS) { + if (Legacy_Settings.s.platform == Legacy_Settings.Platform._3DS) { using (Reader reader = new Reader(FileSystem.GetFileReadStream(gameDataBinFolder + name))) { byte[] textureBytes = reader.ReadBytes((int)reader.BaseStream.Length); if (!File.Exists(gameDataBinFolder + "/textures/" + Path.GetDirectoryName(name) + "/" + Path.GetFileNameWithoutExtension(name) + ".png")) { @@ -745,7 +746,7 @@ public void ExportEtcFile(string name, int w, int h, bool hasAlpha) { } } public void ExportNBFC(string name, int w, int h, Color[] palette, bool i4 = false) { - if (Settings.s.platform == Settings.Platform.DS) { + if (Legacy_Settings.s.platform == Legacy_Settings.Platform.DS) { if(FileSystem.FileExists(gameDataBinFolder + name)) { if (!File.Exists(gameDataBinFolder + "/textures/" + Path.GetDirectoryName(name) + "/" + Path.GetFileNameWithoutExtension(name) + ".png")) { Texture2D tex = new NBFC(gameDataBinFolder + name, w, h, palette, i4).texture; @@ -755,7 +756,7 @@ public void ExportNBFC(string name, int w, int h, Color[] palette, bool i4 = fal } } public void ExportGFX(string name, string mapName, string palName, int w, int h) { - if (Settings.s.platform == Settings.Platform.DS) { + if (Legacy_Settings.s.platform == Legacy_Settings.Platform.DS) { if (FileSystem.FileExists(gameDataBinFolder + name)) { //if (!File.Exists(gameDataBinFolder + "/textures/" + Path.GetDirectoryName(name) + "/" + Path.GetFileNameWithoutExtension(name) + ".png")) { Texture2D tex = new GFX(gameDataBinFolder + name, gameDataBinFolder + mapName, gameDataBinFolder + palName, w, h).texture; @@ -823,19 +824,19 @@ public FATEntry GetEntry(FATEntry.Type type, ushort index, bool global = false) return null; } - public Pointer GetStructPtr(ushort type, ushort index, bool global = false) { + public LegacyPointer GetStructPtr(ushort type, ushort index, bool global = false) { FATEntry entry = GetEntry(type, index, global: global); if (entry != null) { - return new Pointer(entry.off_data, files_array[SMem.Data]); + return new LegacyPointer(entry.off_data, files_array[SMem.Data]); } else { return null; } } - public Pointer GetStructPtr(FATEntry.Type type, ushort index, bool global = false) { + public LegacyPointer GetStructPtr(FATEntry.Type type, ushort index, bool global = false) { FATEntry entry = GetEntry(type, index, global: global); if (entry != null) { - return new Pointer(entry.off_data, files_array[SMem.Data]); + return new LegacyPointer(entry.off_data, files_array[SMem.Data]); } else { return null; } diff --git a/Assets/Scripts/OpenSpace/Loader/R3Loader.cs b/Assets/Scripts/OpenSpace/Loader/R3Loader.cs index 39237dba..d0cfe2ef 100644 --- a/Assets/Scripts/OpenSpace/Loader/R3Loader.cs +++ b/Assets/Scripts/OpenSpace/Loader/R3Loader.cs @@ -1,4 +1,5 @@ -using Cysharp.Threading.Tasks; +using BinarySerializer.Unity; +using Cysharp.Threading.Tasks; using OpenSpace.Animation; using OpenSpace.Cinematics; using OpenSpace.FileFormat; @@ -28,8 +29,8 @@ protected override async UniTask Load() { await CreateCNT(); if (lvlName.EndsWith(".exe")) { - if (!Settings.s.hasMemorySupport) throw new Exception("This game does not have memory support."); - Settings.s.loadFromMemory = true; + if (!Legacy_Settings.s.hasMemorySupport) throw new Exception("This game does not have memory support."); + Legacy_Settings.s.loadFromMemory = true; MemoryFile mem = new MemoryFile(lvlName); files_array[0] = mem; await WaitIfNecessary(); @@ -37,48 +38,48 @@ protected override async UniTask Load() { } else { // Prepare paths string fixFolder = gameDataBinFolder; - string lvlFolder = gameDataBinFolder + ConvertCase(lvlName + "/", Settings.CapsType.LevelFolder); + string lvlFolder = gameDataBinFolder + ConvertCase(lvlName + "/", Legacy_Settings.CapsType.LevelFolder); - paths["fix.lvl"] = fixFolder + ConvertCase("Fix.lvl", Settings.CapsType.Fix); - paths["fix.ptr"] = fixFolder + ConvertCase("Fix.ptr", Settings.CapsType.Fix); - paths["lvl.lvl"] = lvlFolder + ConvertCase(lvlName + ".lvl", Settings.CapsType.LevelFile); - paths["lvl.ptr"] = lvlFolder + ConvertCase(lvlName + ".ptr", Settings.CapsType.LevelFile); - paths["transit.lvl"] = lvlFolder + ConvertCase("transit.lvl", Settings.CapsType.LevelFile); - paths["transit.ptr"] = lvlFolder + ConvertCase("transit.ptr", Settings.CapsType.LevelFile); - if (Settings.s.platform == Settings.Platform.GC) { - paths["menu.tpl"] = fixFolder + ConvertCase("menu.tpl", Settings.CapsType.Fix); - paths["fix.tpl"] = fixFolder + ConvertCase((Settings.s.mode == Settings.Mode.RaymanArenaGC) ? "../common.tpl" : "Fix.tpl", Settings.CapsType.Fix); - paths["lvl.tpl"] = lvlFolder + ConvertCase(lvlName + (Settings.s.game == Settings.Game.R3 ? "_Lvl" : "") + ".tpl", Settings.CapsType.TextureFile); - paths["transit.tpl"] = lvlFolder + ConvertCase(lvlName + "_Trans.tpl", Settings.CapsType.TextureFile); - } else if (Settings.s.platform == Settings.Platform.Xbox) { - paths["fix.btf"] = fixFolder + ConvertCase("Fix.btf", Settings.CapsType.Fix); - paths["fix.bhf"] = fixFolder + ConvertCase("Fix.bhf", Settings.CapsType.Fix); - paths["lvl.btf"] = lvlFolder + ConvertCase(lvlName + ".btf", Settings.CapsType.TextureFile); - paths["lvl.bhf"] = lvlFolder + ConvertCase(lvlName + ".bhf", Settings.CapsType.TextureFile); - paths["transit.btf"] = lvlFolder + ConvertCase("transit.btf", Settings.CapsType.TextureFile); - paths["transit.bhf"] = lvlFolder + ConvertCase("transit.bhf", Settings.CapsType.TextureFile); - } else if (Settings.s.platform == Settings.Platform.Xbox360) { - paths["fix.btf"] = fixFolder + ConvertCase("Fix.btf", Settings.CapsType.Fix); - paths["fix.bhf"] = fixFolder + ConvertCase("Fix.bhf", Settings.CapsType.Fix); - paths["lvl.btf"] = lvlFolder + ConvertCase(lvlName + "_2.btf", Settings.CapsType.TextureFile); - paths["lvl.bhf"] = lvlFolder + ConvertCase(lvlName + "_2.bhf", Settings.CapsType.TextureFile); - paths["transit.btf"] = lvlFolder + ConvertCase("transit_6.btf", Settings.CapsType.TextureFile); - paths["transit.bhf"] = lvlFolder + ConvertCase("transit_6.bhf", Settings.CapsType.TextureFile); - } else if (Settings.s.platform == Settings.Platform.PS2) { - if (Settings.s.game == Settings.Game.RA || Settings.s.game == Settings.Game.RM) { - paths["fix.tbf"] = fixFolder + ConvertCase("Textures.txc", Settings.CapsType.Fix); + paths["fix.lvl"] = fixFolder + ConvertCase("Fix.lvl", Legacy_Settings.CapsType.Fix); + paths["fix.ptr"] = fixFolder + ConvertCase("Fix.ptr", Legacy_Settings.CapsType.Fix); + paths["lvl.lvl"] = lvlFolder + ConvertCase(lvlName + ".lvl", Legacy_Settings.CapsType.LevelFile); + paths["lvl.ptr"] = lvlFolder + ConvertCase(lvlName + ".ptr", Legacy_Settings.CapsType.LevelFile); + paths["transit.lvl"] = lvlFolder + ConvertCase("transit.lvl", Legacy_Settings.CapsType.LevelFile); + paths["transit.ptr"] = lvlFolder + ConvertCase("transit.ptr", Legacy_Settings.CapsType.LevelFile); + if (Legacy_Settings.s.platform == Legacy_Settings.Platform.GC) { + paths["menu.tpl"] = fixFolder + ConvertCase("menu.tpl", Legacy_Settings.CapsType.Fix); + paths["fix.tpl"] = fixFolder + ConvertCase((Legacy_Settings.s.mode == Legacy_Settings.Mode.RaymanArenaGC) ? "../common.tpl" : "Fix.tpl", Legacy_Settings.CapsType.Fix); + paths["lvl.tpl"] = lvlFolder + ConvertCase(lvlName + (Legacy_Settings.s.game == Legacy_Settings.Game.R3 ? "_Lvl" : "") + ".tpl", Legacy_Settings.CapsType.TextureFile); + paths["transit.tpl"] = lvlFolder + ConvertCase(lvlName + "_Trans.tpl", Legacy_Settings.CapsType.TextureFile); + } else if (Legacy_Settings.s.platform == Legacy_Settings.Platform.Xbox) { + paths["fix.btf"] = fixFolder + ConvertCase("Fix.btf", Legacy_Settings.CapsType.Fix); + paths["fix.bhf"] = fixFolder + ConvertCase("Fix.bhf", Legacy_Settings.CapsType.Fix); + paths["lvl.btf"] = lvlFolder + ConvertCase(lvlName + ".btf", Legacy_Settings.CapsType.TextureFile); + paths["lvl.bhf"] = lvlFolder + ConvertCase(lvlName + ".bhf", Legacy_Settings.CapsType.TextureFile); + paths["transit.btf"] = lvlFolder + ConvertCase("transit.btf", Legacy_Settings.CapsType.TextureFile); + paths["transit.bhf"] = lvlFolder + ConvertCase("transit.bhf", Legacy_Settings.CapsType.TextureFile); + } else if (Legacy_Settings.s.platform == Legacy_Settings.Platform.Xbox360) { + paths["fix.btf"] = fixFolder + ConvertCase("Fix.btf", Legacy_Settings.CapsType.Fix); + paths["fix.bhf"] = fixFolder + ConvertCase("Fix.bhf", Legacy_Settings.CapsType.Fix); + paths["lvl.btf"] = lvlFolder + ConvertCase(lvlName + "_2.btf", Legacy_Settings.CapsType.TextureFile); + paths["lvl.bhf"] = lvlFolder + ConvertCase(lvlName + "_2.bhf", Legacy_Settings.CapsType.TextureFile); + paths["transit.btf"] = lvlFolder + ConvertCase("transit_6.btf", Legacy_Settings.CapsType.TextureFile); + paths["transit.bhf"] = lvlFolder + ConvertCase("transit_6.bhf", Legacy_Settings.CapsType.TextureFile); + } else if (Legacy_Settings.s.platform == Legacy_Settings.Platform.PS2) { + if (Legacy_Settings.s.game == Legacy_Settings.Game.RA || Legacy_Settings.s.game == Legacy_Settings.Game.RM) { + paths["fix.tbf"] = fixFolder + ConvertCase("Textures.txc", Legacy_Settings.CapsType.Fix); } else { - paths["fix.tbf"] = fixFolder + ConvertCase("Fix.tbf", Settings.CapsType.Fix); + paths["fix.tbf"] = fixFolder + ConvertCase("Fix.tbf", Legacy_Settings.CapsType.Fix); } - paths["lvl.tbf"] = lvlFolder + ConvertCase(lvlName + ".tbf", Settings.CapsType.TextureFile); - paths["transit.tbf"] = lvlFolder + ConvertCase("transit.tbf", Settings.CapsType.TextureFile); + paths["lvl.tbf"] = lvlFolder + ConvertCase(lvlName + ".tbf", Legacy_Settings.CapsType.TextureFile); + paths["transit.tbf"] = lvlFolder + ConvertCase("transit.tbf", Legacy_Settings.CapsType.TextureFile); } - paths["lvl_vb.lvl"] = lvlFolder + ConvertCase(lvlName + "_vb.lvl", Settings.CapsType.LevelFile); - paths["lvl_vb.ptr"] = lvlFolder + ConvertCase(lvlName + "_vb.ptr", Settings.CapsType.LevelFile); - paths["fixkf.lvl"] = fixFolder + ConvertCase("Fixkf.lvl", Settings.CapsType.Fix); - paths["fixkf.ptr"] = fixFolder + ConvertCase("Fixkf.ptr", Settings.CapsType.Fix); - paths["lvlkf.lvl"] = lvlFolder + ConvertCase(lvlName + "kf.lvl", Settings.CapsType.LevelFile); - paths["lvlkf.ptr"] = lvlFolder + ConvertCase(lvlName + "kf.ptr", Settings.CapsType.LevelFile); + paths["lvl_vb.lvl"] = lvlFolder + ConvertCase(lvlName + "_vb.lvl", Legacy_Settings.CapsType.LevelFile); + paths["lvl_vb.ptr"] = lvlFolder + ConvertCase(lvlName + "_vb.ptr", Legacy_Settings.CapsType.LevelFile); + paths["fixkf.lvl"] = fixFolder + ConvertCase("Fixkf.lvl", Legacy_Settings.CapsType.Fix); + paths["fixkf.ptr"] = fixFolder + ConvertCase("Fixkf.ptr", Legacy_Settings.CapsType.Fix); + paths["lvlkf.lvl"] = lvlFolder + ConvertCase(lvlName + "kf.lvl", Legacy_Settings.CapsType.LevelFile); + paths["lvlkf.ptr"] = lvlFolder + ConvertCase(lvlName + "kf.ptr", Legacy_Settings.CapsType.LevelFile); // Download files /*foreach (KeyValuePair path in paths) { @@ -91,14 +92,14 @@ protected override async UniTask Load() { lvlNames[0] = "fix"; lvlPaths[0] = paths["fix.lvl"]; ptrPaths[0] = paths["fix.ptr"]; - if (Settings.s.platform == Settings.Platform.GC) { + if (Legacy_Settings.s.platform == Legacy_Settings.Platform.GC) { await PrepareFile(paths["fix.tpl"]); await PrepareFile(paths["menu.tpl"]); - } else if (Settings.s.platform == Settings.Platform.Xbox - || Settings.s.platform == Settings.Platform.Xbox360) { + } else if (Legacy_Settings.s.platform == Legacy_Settings.Platform.Xbox + || Legacy_Settings.s.platform == Legacy_Settings.Platform.Xbox360) { await PrepareFile(paths["fix.btf"]); await PrepareFile(paths["fix.bhf"]); - } else if (Settings.s.platform == Settings.Platform.PS2) { + } else if (Legacy_Settings.s.platform == Legacy_Settings.Platform.PS2) { await PrepareFile(paths["fix.tbf"]); } await PrepareFile(lvlPaths[0]); @@ -113,13 +114,13 @@ protected override async UniTask Load() { await PrepareFile(lvlPaths[1]); if (FileSystem.FileExists(lvlPaths[1])) { await PrepareFile(ptrPaths[1]); - if (Settings.s.platform == Settings.Platform.GC) { + if (Legacy_Settings.s.platform == Legacy_Settings.Platform.GC) { await PrepareFile(paths["lvl.tpl"]); - } else if (Settings.s.platform == Settings.Platform.Xbox - || Settings.s.platform == Settings.Platform.Xbox360) { + } else if (Legacy_Settings.s.platform == Legacy_Settings.Platform.Xbox + || Legacy_Settings.s.platform == Legacy_Settings.Platform.Xbox360) { await PrepareFile(paths["lvl.btf"]); await PrepareFile(paths["lvl.bhf"]); - } else if (Settings.s.platform == Settings.Platform.PS2) { + } else if (Legacy_Settings.s.platform == Legacy_Settings.Platform.PS2) { await PrepareFile(paths["lvl.tbf"]); } } @@ -131,13 +132,13 @@ protected override async UniTask Load() { await PrepareFile(lvlPaths[2]); if (FileSystem.FileExists(lvlPaths[2])) { await PrepareFile(ptrPaths[2]); - if (Settings.s.platform == Settings.Platform.GC) { + if (Legacy_Settings.s.platform == Legacy_Settings.Platform.GC) { await PrepareFile(paths["transit.tpl"]); - } else if (Settings.s.platform == Settings.Platform.Xbox - || Settings.s.platform == Settings.Platform.Xbox360) { + } else if (Legacy_Settings.s.platform == Legacy_Settings.Platform.Xbox + || Legacy_Settings.s.platform == Legacy_Settings.Platform.Xbox360) { await PrepareFile(paths["transit.btf"]); await PrepareFile(paths["transit.bhf"]); - } else if (Settings.s.platform == Settings.Platform.PS2) { + } else if (Legacy_Settings.s.platform == Legacy_Settings.Platform.PS2) { await PrepareFile(paths["transit.tbf"]); } } @@ -183,10 +184,10 @@ protected override async UniTask Load() { } } // Export PS2 vignette textures - if (exportTextures && Settings.s.platform == Settings.Platform.PS2) { - if (Settings.s.game == Settings.Game.R3) { + if (exportTextures && Legacy_Settings.s.platform == Legacy_Settings.Platform.PS2) { + if (Legacy_Settings.s.game == Legacy_Settings.Game.R3) { ExportR3PS2Textures(); - } else if (Settings.s.game == Settings.Game.RM || Settings.s.game == Settings.Game.RA) { + } else if (Legacy_Settings.s.game == Legacy_Settings.Game.RM || Legacy_Settings.s.game == Legacy_Settings.Game.RA) { ExportRAPS2Textures(); } } @@ -319,7 +320,7 @@ void ExportVIG(string name, string extension, int width, int height) { } #region FIX - Pointer off_animBankFix; + LegacyPointer off_animBankFix; async UniTask LoadFIX() { loadingState = "Loading fixed memory"; @@ -332,27 +333,27 @@ async UniTask LoadFIX() { reader.ReadUInt32(); reader.ReadUInt32(); reader.ReadUInt32(); - if (Settings.s.platform == Settings.Platform.PC - || Settings.s.platform == Settings.Platform.MacOS - || Settings.s.platform == Settings.Platform.Xbox - || Settings.s.platform == Settings.Platform.Xbox360 - || Settings.s.platform == Settings.Platform.PS3 - || Settings.s.platform == Settings.Platform.PS2) { - if (Settings.s.game == Settings.Game.R3 - && (Settings.s.mode != Settings.Mode.Rayman3PCDemo_2002_10_01 - && Settings.s.mode != Settings.Mode.Rayman3PCDemo_2002_10_21)) { + if (Legacy_Settings.s.platform == Legacy_Settings.Platform.PC + || Legacy_Settings.s.platform == Legacy_Settings.Platform.MacOS + || Legacy_Settings.s.platform == Legacy_Settings.Platform.Xbox + || Legacy_Settings.s.platform == Legacy_Settings.Platform.Xbox360 + || Legacy_Settings.s.platform == Legacy_Settings.Platform.PS3 + || Legacy_Settings.s.platform == Legacy_Settings.Platform.PS2) { + if (Legacy_Settings.s.game == Legacy_Settings.Game.R3 + && (Legacy_Settings.s.mode != Legacy_Settings.Mode.Rayman3PCDemo_2002_10_01 + && Legacy_Settings.s.mode != Legacy_Settings.Mode.Rayman3PCDemo_2002_10_21)) { string timeStamp = reader.ReadString(0x18); reader.ReadUInt32(); reader.ReadUInt32(); reader.ReadUInt32(); reader.ReadUInt32(); reader.ReadUInt32(); - if (Settings.s.mode != Settings.Mode.Rayman3PS2Demo_2002_05_17) { + if (Legacy_Settings.s.mode != Legacy_Settings.Mode.Rayman3PS2Demo_2002_05_17) { reader.ReadUInt32(); reader.ReadUInt32(); } - } else if (Settings.s.game == Settings.Game.RM || Settings.s.game == Settings.Game.RA || Settings.s.game == Settings.Game.Dinosaur ||Settings.s.game == Settings.Game.R3) { - if (Settings.s.platform == Settings.Platform.PS2) { + } else if (Legacy_Settings.s.game == Legacy_Settings.Game.RM || Legacy_Settings.s.game == Legacy_Settings.Game.RA || Legacy_Settings.s.game == Legacy_Settings.Game.Dinosaur ||Legacy_Settings.s.game == Legacy_Settings.Game.R3) { + if (Legacy_Settings.s.platform == Legacy_Settings.Platform.PS2) { string timeStamp = reader.ReadString(0x14); reader.ReadUInt32(); reader.ReadUInt32(); @@ -363,11 +364,11 @@ async UniTask LoadFIX() { reader.ReadUInt32(); } } - Pointer off_identityMatrix = Pointer.Read(reader); + LegacyPointer off_identityMatrix = LegacyPointer.Read(reader); loadingState = "Loading text"; await WaitIfNecessary(); - localization = FromOffsetOrRead(reader, Pointer.Current(reader), inline: true); - if (Settings.s.platform != Settings.Platform.PS2) { + localization = FromOffsetOrRead(reader, LegacyPointer.Current(reader), inline: true); + if (Legacy_Settings.s.platform != Legacy_Settings.Platform.PS2) { uint num_lvlNames = reader.ReadUInt32(); uint num_fixEntries1 = reader.ReadUInt32(); // Read tables under header @@ -377,12 +378,12 @@ async UniTask LoadFIX() { for (uint i = 0; i < num_fixEntries1; i++) { string savMapName = new string(reader.ReadChars(0xC)); } - ReadLevelNames(reader, Pointer.Current(reader), num_lvlNames); - if (Settings.s.platform == Settings.Platform.PC - || Settings.s.platform == Settings.Platform.MacOS - || Settings.s.platform == Settings.Platform.Xbox - || Settings.s.platform == Settings.Platform.Xbox360 - || Settings.s.platform == Settings.Platform.PS3) { + ReadLevelNames(reader, LegacyPointer.Current(reader), num_lvlNames); + if (Legacy_Settings.s.platform == Legacy_Settings.Platform.PC + || Legacy_Settings.s.platform == Legacy_Settings.Platform.MacOS + || Legacy_Settings.s.platform == Legacy_Settings.Platform.Xbox + || Legacy_Settings.s.platform == Legacy_Settings.Platform.Xbox360 + || Legacy_Settings.s.platform == Legacy_Settings.Platform.PS3) { reader.ReadChars(0x1E); reader.ReadChars(0x1E); // two zero entries } @@ -398,7 +399,7 @@ async UniTask LoadFIX() { byte num_lvlNames = reader.ReadByte(); byte num_fixEntries1 = reader.ReadByte(); reader.ReadBytes(2); // padding - ReadLevelNames(reader, Pointer.Current(reader), num_lvlNames); + ReadLevelNames(reader, LegacyPointer.Current(reader), num_lvlNames); string firstMapName = new string(reader.ReadChars(0x1E)); for (uint i = 0; i < num_fixEntries1; i++) { string savName = new string(reader.ReadChars(0xC)); @@ -406,30 +407,30 @@ async UniTask LoadFIX() { for (uint i = 0; i < num_fixEntries1; i++) { string savMapName = new string(reader.ReadChars(0xC)); } - if (Settings.s.game == Settings.Game.RA || Settings.s.game == Settings.Game.RM || Settings.s.mode == Settings.Mode.Rayman3PS2Demo_2002_05_17) { + if (Legacy_Settings.s.game == Legacy_Settings.Game.RA || Legacy_Settings.s.game == Legacy_Settings.Game.RM || Legacy_Settings.s.mode == Legacy_Settings.Mode.Rayman3PS2Demo_2002_05_17) { reader.Align(4); } } uint num_languages = reader.ReadUInt32(); - Pointer off_languages = Pointer.Read(reader); - Pointer.DoAt(ref reader, off_languages, () => { + LegacyPointer off_languages = LegacyPointer.Read(reader); + LegacyPointer.DoAt(ref reader, off_languages, () => { ReadLanguages(reader, off_languages, num_languages); }); - if (Settings.s.platform == Settings.Platform.PS2 && localization != null && Settings.s.game == Settings.Game.R3 && Settings.s.mode != Settings.Mode.Rayman3PS2Demo_2002_05_17) { + if (Legacy_Settings.s.platform == Legacy_Settings.Platform.PS2 && localization != null && Legacy_Settings.s.game == Legacy_Settings.Game.R3 && Legacy_Settings.s.mode != Legacy_Settings.Mode.Rayman3PS2Demo_2002_05_17) { for (int i = 0; i < localization.num_languages; i++) { if (localization.languages[i].off_textTable == null) { // Load text from file - string filePath = ConvertCase("Texts/", Settings.CapsType.LangLevelFolder); + string filePath = ConvertCase("Texts/", Legacy_Settings.CapsType.LangLevelFolder); string fileName = "Lang" + i; loadingState = "Loading text files: " + (i + 1) + "/" + localization.num_languages; - paths["lang" + i + ".lvl"] = gameDataBinFolder + ConvertCase(fileName + ".lvl", Settings.CapsType.LangLevelFile); - paths["lang" + i + ".ptr"] = gameDataBinFolder + ConvertCase(fileName + ".ptr", Settings.CapsType.LangLevelFile); + paths["lang" + i + ".lvl"] = gameDataBinFolder + ConvertCase(fileName + ".lvl", Legacy_Settings.CapsType.LangLevelFile); + paths["lang" + i + ".ptr"] = gameDataBinFolder + ConvertCase(fileName + ".ptr", Legacy_Settings.CapsType.LangLevelFile); await PrepareFile(paths["lang" + i + ".lvl"]); if (FileSystem.FileExists(paths["lang" + i + ".lvl"])) { await PrepareFile(paths["lang" + i + ".ptr"]); int fileId = i + 207; FileWithPointers f = InitExtraLVL(fileName, paths["lang" + i + ".lvl"], paths["lang" + i + ".ptr"], fileId); - Pointer.DoAt(ref reader, new Pointer(0, f), () => { + LegacyPointer.DoAt(ref reader, new LegacyPointer(0, f), () => { string timeStamp = reader.ReadString(0x18); reader.ReadUInt32(); @@ -443,8 +444,8 @@ async UniTask LoadFIX() { } } loadingState = "Loading fixed textures"; - print("Fix textures address: " + Pointer.Current(reader)); - await ReadTexturesFix(reader, Pointer.Current(reader)); + print("Fix textures address: " + LegacyPointer.Current(reader)); + await ReadTexturesFix(reader, LegacyPointer.Current(reader)); // Defaults for Rayman 3 PC. Sizes are hardcoded in the exes and might differ for versions too :/ int sz_entryActions = 0x100; int sz_randomStructure = 0xDC; @@ -453,50 +454,50 @@ async UniTask LoadFIX() { int sz_binDataForMenu = 0x020C; int num_menuPages = 35; - if (Settings.s.mode == Settings.Mode.Rayman3GC) { + if (Legacy_Settings.s.mode == Legacy_Settings.Mode.Rayman3GC) { sz_entryActions = 0xE8; sz_binDataForMenu = 0x01F0; - } else if (Settings.s.mode == Settings.Mode.RaymanArenaGC - || Settings.s.mode == Settings.Mode.RaymanArenaGCDemo_2002_03_07) { + } else if (Legacy_Settings.s.mode == Legacy_Settings.Mode.RaymanArenaGC + || Legacy_Settings.s.mode == Legacy_Settings.Mode.RaymanArenaGCDemo_2002_03_07) { sz_entryActions = 0xC4; - } else if (Settings.s.mode == Settings.Mode.RaymanArenaPC - || Settings.s.mode == Settings.Mode.RaymanMPC) { + } else if (Legacy_Settings.s.mode == Legacy_Settings.Mode.RaymanArenaPC + || Legacy_Settings.s.mode == Legacy_Settings.Mode.RaymanMPC) { sz_entryActions = 0xDC; - } else if (Settings.s.mode == Settings.Mode.DinosaurPC) { + } else if (Legacy_Settings.s.mode == Legacy_Settings.Mode.DinosaurPC) { sz_entryActions = 0xD8; sz_randomStructure = 0xE0; - } else if (Settings.s.mode == Settings.Mode.DonaldDuckPKGC) { + } else if (Legacy_Settings.s.mode == Legacy_Settings.Mode.DonaldDuckPKGC) { sz_entryActions = 0xC0; - } else if (Settings.s.mode == Settings.Mode.RaymanArenaXbox) { + } else if (Legacy_Settings.s.mode == Legacy_Settings.Mode.RaymanArenaXbox) { sz_entryActions = 0xF0; - } else if (Settings.s.mode == Settings.Mode.Rayman3PCDemo_2003_01_06) { + } else if (Legacy_Settings.s.mode == Legacy_Settings.Mode.Rayman3PCDemo_2003_01_06) { sz_binDataForMenu = 0x1a4; - } else if (Settings.s.mode == Settings.Mode.Rayman3PCDemo_2002_12_09) { + } else if (Legacy_Settings.s.mode == Legacy_Settings.Mode.Rayman3PCDemo_2002_12_09) { sz_binDataForMenu = 0x1ac; - } else if (Settings.s.mode == Settings.Mode.Rayman3PCDemo_2002_10_21) { + } else if (Legacy_Settings.s.mode == Legacy_Settings.Mode.Rayman3PCDemo_2002_10_21) { sz_entryActions = 0xFC; sz_binDataForMenu = 0x1F4; - } else if (Settings.s.mode == Settings.Mode.Rayman3PCDemo_2002_10_01) { + } else if (Legacy_Settings.s.mode == Legacy_Settings.Mode.Rayman3PCDemo_2002_10_01) { sz_entryActions = 0xFC; sz_binDataForMenu = 0x10C; num_menuPages = 25; } - if (Settings.s.platform == Settings.Platform.PS2) { + if (Legacy_Settings.s.platform == Legacy_Settings.Platform.PS2) { sz_videoStructure = 0x108; - if (Settings.s.game == Settings.Game.RA || Settings.s.game == Settings.Game.RM) { + if (Legacy_Settings.s.game == Legacy_Settings.Game.RA || Legacy_Settings.s.game == Legacy_Settings.Game.RM) { sz_entryActions = 0xE8; - } else if (Settings.s.game == Settings.Game.R3) { - if (Settings.s.mode == Settings.Mode.Rayman3PS2DevBuild_2002_09_06) { + } else if (Legacy_Settings.s.game == Legacy_Settings.Game.R3) { + if (Legacy_Settings.s.mode == Legacy_Settings.Mode.Rayman3PS2DevBuild_2002_09_06) { sz_entryActions = 0xF8; sz_binDataForMenu = 0x78; - } else if (Settings.s.mode == Settings.Mode.Rayman3PS2Demo_2002_05_17) { + } else if (Legacy_Settings.s.mode == Legacy_Settings.Mode.Rayman3PS2Demo_2002_05_17) { sz_videoStructure = 0x18; sz_entryActions = 0xCC; sz_binDataForMenu = 0; - } else if (Settings.s.mode == Settings.Mode.Rayman3PS2Demo_2002_08_07) { + } else if (Legacy_Settings.s.mode == Legacy_Settings.Mode.Rayman3PS2Demo_2002_08_07) { sz_entryActions = 0xF8; sz_binDataForMenu = 0; - } else if (Settings.s.mode == Settings.Mode.Rayman3PS2Demo_2002_10_29) { + } else if (Legacy_Settings.s.mode == Legacy_Settings.Mode.Rayman3PS2Demo_2002_10_29) { sz_entryActions = 0x108; // probably not right but oh well sz_binDataForMenu = 0x1F4; } else { @@ -504,88 +505,88 @@ async UniTask LoadFIX() { sz_binDataForMenu = 0x1A4; } } - } else if (Settings.s.platform == Settings.Platform.Xbox) { + } else if (Legacy_Settings.s.platform == Legacy_Settings.Platform.Xbox) { sz_videoStructure = 0x108; sz_binDataForMenu = 0x1AC; - } else if (Settings.s.platform == Settings.Platform.Xbox360) { + } else if (Legacy_Settings.s.platform == Legacy_Settings.Platform.Xbox360) { sz_videoStructure = 0x108; sz_entryActions = 0x108; sz_binDataForMenu = 0x33C; num_menuPages = 96; - } else if (Settings.s.platform == Settings.Platform.PS3) { + } else if (Legacy_Settings.s.platform == Legacy_Settings.Platform.PS3) { sz_videoStructure = 0x108; sz_entryActions = 0x108; sz_binDataForMenu = 0x348; num_menuPages = 96; } - if (Settings.s.platform != Settings.Platform.PS2) { + if (Legacy_Settings.s.platform != Legacy_Settings.Platform.PS2) { loadingState = "Loading input structure"; await WaitIfNecessary(); - inputStruct = InputStructure.Read(reader, Pointer.Current(reader)); + inputStruct = InputStructure.Read(reader, LegacyPointer.Current(reader)); foreach (EntryAction ea in inputStruct.entryActions) { print(ea.ToString()); } - if (Settings.s.platform == Settings.Platform.PC - || Settings.s.platform == Settings.Platform.MacOS - || Settings.s.platform == Settings.Platform.Xbox - || Settings.s.platform == Settings.Platform.Xbox360 - || Settings.s.platform == Settings.Platform.PS3) { - Pointer off_IPT_keyAndPadDefine = Pointer.Read(reader); + if (Legacy_Settings.s.platform == Legacy_Settings.Platform.PC + || Legacy_Settings.s.platform == Legacy_Settings.Platform.MacOS + || Legacy_Settings.s.platform == Legacy_Settings.Platform.Xbox + || Legacy_Settings.s.platform == Legacy_Settings.Platform.Xbox360 + || Legacy_Settings.s.platform == Legacy_Settings.Platform.PS3) { + LegacyPointer off_IPT_keyAndPadDefine = LegacyPointer.Read(reader); ReadKeypadDefine(reader, off_IPT_keyAndPadDefine); } reader.ReadBytes(sz_entryActions); // 3DOS_EntryActions } uint num_persoInFix = reader.ReadUInt32(); - persoInFix = new Pointer[num_persoInFix]; + persoInFix = new LegacyPointer[num_persoInFix]; for (int i = 0; i < persoInFix.Length; i++) { - persoInFix[i] = Pointer.Read(reader); + persoInFix[i] = LegacyPointer.Read(reader); } reader.ReadBytes(sz_randomStructure); uint soundEventTableIndexInFix = reader.ReadUInt32(); - Pointer off_soundEventTable = Pointer.Read(reader); - fonts = FromOffsetOrRead(reader, Pointer.Current(reader), inline: true); - if (Settings.s.mode != Settings.Mode.Rayman3PS2Demo_2002_05_17) { + LegacyPointer off_soundEventTable = LegacyPointer.Read(reader); + fonts = FromOffsetOrRead(reader, LegacyPointer.Current(reader), inline: true); + if (Legacy_Settings.s.mode != Legacy_Settings.Mode.Rayman3PS2Demo_2002_05_17) { reader.ReadBytes(sz_videoStructure); // Contains amount of videos and pointer to video filename table } - if (Settings.s.platform == Settings.Platform.PS2) { + if (Legacy_Settings.s.platform == Legacy_Settings.Platform.PS2) { loadingState = "Loading input structure"; await WaitIfNecessary(); - inputStruct = InputStructure.Read(reader, Pointer.Current(reader)); + inputStruct = InputStructure.Read(reader, LegacyPointer.Current(reader)); foreach (EntryAction ea in inputStruct.entryActions) { print(ea.ToString()); } reader.ReadBytes(sz_entryActions); // 3DOS_EntryActions } - if (Settings.s.mode == Settings.Mode.Rayman3PS2Demo_2002_05_17) { + if (Legacy_Settings.s.mode == Legacy_Settings.Mode.Rayman3PS2Demo_2002_05_17) { reader.ReadBytes(sz_videoStructure); // Contains amount of videos and pointer to video filename table } - if (Settings.s.game == Settings.Game.R3 && Settings.s.mode != Settings.Mode.Rayman3PS2Demo_2002_05_17) { + if (Legacy_Settings.s.game == Legacy_Settings.Game.R3 && Legacy_Settings.s.mode != Legacy_Settings.Mode.Rayman3PS2Demo_2002_05_17) { uint num_musicMarkerSlots = reader.ReadUInt32(); for (int i = 0; i < num_musicMarkerSlots; i++) { reader.ReadBytes(sz_musicMarkerSlot); } reader.ReadBytes(sz_binDataForMenu); - if (Settings.s.platform == Settings.Platform.PC - || Settings.s.platform == Settings.Platform.MacOS - || Settings.s.platform == Settings.Platform.Xbox - || Settings.s.platform == Settings.Platform.Xbox360 - || Settings.s.platform == Settings.Platform.PS3) { - Pointer off_bgMaterialForMenu2D = Pointer.Read(reader); - Pointer off_fixMaterialForMenu2D = Pointer.Read(reader); - if (Settings.s.mode != Settings.Mode.Rayman3PCDemo_2002_10_01 && Settings.s.mode != Settings.Mode.Rayman3PCDemo_2002_10_21) { - Pointer off_fixMaterialForSelectedFilms = Pointer.Read(reader); - Pointer off_fixMaterialForArcadeAndFilms = Pointer.Read(reader); + if (Legacy_Settings.s.platform == Legacy_Settings.Platform.PC + || Legacy_Settings.s.platform == Legacy_Settings.Platform.MacOS + || Legacy_Settings.s.platform == Legacy_Settings.Platform.Xbox + || Legacy_Settings.s.platform == Legacy_Settings.Platform.Xbox360 + || Legacy_Settings.s.platform == Legacy_Settings.Platform.PS3) { + LegacyPointer off_bgMaterialForMenu2D = LegacyPointer.Read(reader); + LegacyPointer off_fixMaterialForMenu2D = LegacyPointer.Read(reader); + if (Legacy_Settings.s.mode != Legacy_Settings.Mode.Rayman3PCDemo_2002_10_01 && Legacy_Settings.s.mode != Legacy_Settings.Mode.Rayman3PCDemo_2002_10_21) { + LegacyPointer off_fixMaterialForSelectedFilms = LegacyPointer.Read(reader); + LegacyPointer off_fixMaterialForArcadeAndFilms = LegacyPointer.Read(reader); } for (int i = 0; i < num_menuPages; i++) { - Pointer off_menuPage = Pointer.Read(reader); + LegacyPointer off_menuPage = LegacyPointer.Read(reader); } } } /*loadingState = "Loading fixed animation bank"; await WaitIfNecessary();*/ - if (Settings.s.game != Settings.Game.Dinosaur) { - off_animBankFix = Pointer.Read(reader); // Note: only one 0x104 bank in fix. + if (Legacy_Settings.s.game != Legacy_Settings.Game.Dinosaur) { + off_animBankFix = LegacyPointer.Read(reader); // Note: only one 0x104 bank in fix. //print(Pointer.Current(reader)); print("Fix animation bank address: " + off_animBankFix); } @@ -611,33 +612,33 @@ async UniTask LoadLVL() { Reader reader = files_array[Mem.Lvl].reader; long totalSize = reader.BaseStream.Length; //reader.ReadUInt32(); - if (Settings.s.game == Settings.Game.R3 - && (Settings.s.platform == Settings.Platform.PC - || Settings.s.platform == Settings.Platform.MacOS - || Settings.s.platform == Settings.Platform.Xbox - || Settings.s.platform == Settings.Platform.Xbox360 - || Settings.s.platform == Settings.Platform.PS3 - || Settings.s.platform == Settings.Platform.PS2)) { + if (Legacy_Settings.s.game == Legacy_Settings.Game.R3 + && (Legacy_Settings.s.platform == Legacy_Settings.Platform.PC + || Legacy_Settings.s.platform == Legacy_Settings.Platform.MacOS + || Legacy_Settings.s.platform == Legacy_Settings.Platform.Xbox + || Legacy_Settings.s.platform == Legacy_Settings.Platform.Xbox360 + || Legacy_Settings.s.platform == Legacy_Settings.Platform.PS3 + || Legacy_Settings.s.platform == Legacy_Settings.Platform.PS2)) { reader.ReadUInt32(); // fix checksum? } - if (Settings.s.platform == Settings.Platform.PS2 && - (Settings.s.game == Settings.Game.RM || Settings.s.game == Settings.Game.RA)) { + if (Legacy_Settings.s.platform == Legacy_Settings.Platform.PS2 && + (Legacy_Settings.s.game == Legacy_Settings.Game.RM || Legacy_Settings.s.game == Legacy_Settings.Game.RA)) { reader.ReadUInt32(); // fix checksum? } reader.ReadUInt32(); reader.ReadUInt32(); reader.ReadUInt32(); reader.ReadUInt32(); - if (Settings.s.platform == Settings.Platform.PC - || Settings.s.platform == Settings.Platform.MacOS - || Settings.s.platform == Settings.Platform.Xbox - || Settings.s.platform == Settings.Platform.Xbox360 - || Settings.s.platform == Settings.Platform.PS3 - || Settings.s.platform == Settings.Platform.PS2) { - if (Settings.s.game == Settings.Game.R3 - && (Settings.s.mode != Settings.Mode.Rayman3PCDemo_2002_10_01 - && Settings.s.mode != Settings.Mode.Rayman3PCDemo_2002_10_21 - && Settings.s.mode != Settings.Mode.Rayman3PS2Demo_2002_05_17)) { + if (Legacy_Settings.s.platform == Legacy_Settings.Platform.PC + || Legacy_Settings.s.platform == Legacy_Settings.Platform.MacOS + || Legacy_Settings.s.platform == Legacy_Settings.Platform.Xbox + || Legacy_Settings.s.platform == Legacy_Settings.Platform.Xbox360 + || Legacy_Settings.s.platform == Legacy_Settings.Platform.PS3 + || Legacy_Settings.s.platform == Legacy_Settings.Platform.PS2) { + if (Legacy_Settings.s.game == Legacy_Settings.Game.R3 + && (Legacy_Settings.s.mode != Legacy_Settings.Mode.Rayman3PCDemo_2002_10_01 + && Legacy_Settings.s.mode != Legacy_Settings.Mode.Rayman3PCDemo_2002_10_21 + && Legacy_Settings.s.mode != Legacy_Settings.Mode.Rayman3PS2Demo_2002_05_17)) { string timeStamp = reader.ReadString(0x18); reader.ReadUInt32(); reader.ReadUInt32(); @@ -645,12 +646,12 @@ async UniTask LoadLVL() { reader.ReadUInt32(); reader.ReadUInt32(); reader.ReadUInt32(); - if(Settings.s.platform != Settings.Platform.PS2) reader.ReadUInt32(); - } else if (Settings.s.game == Settings.Game.RM - || Settings.s.game == Settings.Game.RA - || Settings.s.game == Settings.Game.Dinosaur - || Settings.s.game == Settings.Game.R3) { - if (Settings.s.platform == Settings.Platform.PS2) { + if(Legacy_Settings.s.platform != Legacy_Settings.Platform.PS2) reader.ReadUInt32(); + } else if (Legacy_Settings.s.game == Legacy_Settings.Game.RM + || Legacy_Settings.s.game == Legacy_Settings.Game.RA + || Legacy_Settings.s.game == Legacy_Settings.Game.Dinosaur + || Legacy_Settings.s.game == Legacy_Settings.Game.R3) { + if (Legacy_Settings.s.platform == Legacy_Settings.Platform.PS2) { string timeStamp = reader.ReadString(0x18); reader.ReadUInt32(); reader.ReadUInt32(); @@ -659,38 +660,38 @@ async UniTask LoadLVL() { reader.ReadUInt32(); } } - if (Settings.s.platform == Settings.Platform.MacOS) { + if (Legacy_Settings.s.platform == Legacy_Settings.Platform.MacOS) { reader.ReadBytes(0x404); // vignette - } else if (Settings.s.platform != Settings.Platform.PS2) { + } else if (Legacy_Settings.s.platform != Legacy_Settings.Platform.PS2) { reader.ReadBytes(0x104); // vignette - if (Settings.s.game != Settings.Game.Dinosaur) { + if (Legacy_Settings.s.game != Legacy_Settings.Game.Dinosaur) { reader.ReadUInt32(); } } loadingState = "Loading level textures"; - await ReadTexturesLvl(reader, Pointer.Current(reader)); - if ((Settings.s.platform == Settings.Platform.PC - || Settings.s.platform == Settings.Platform.MacOS - || Settings.s.platform == Settings.Platform.Xbox - || Settings.s.platform == Settings.Platform.Xbox360 - || Settings.s.platform == Settings.Platform.PS3) - && !hasTransit && Settings.s.game != Settings.Game.Dinosaur) { - Pointer off_lightMapTexture = Pointer.Read(reader); // g_p_stLMTexture - Pointer.DoAt(ref reader, off_lightMapTexture, () => { + await ReadTexturesLvl(reader, LegacyPointer.Current(reader)); + if ((Legacy_Settings.s.platform == Legacy_Settings.Platform.PC + || Legacy_Settings.s.platform == Legacy_Settings.Platform.MacOS + || Legacy_Settings.s.platform == Legacy_Settings.Platform.Xbox + || Legacy_Settings.s.platform == Legacy_Settings.Platform.Xbox360 + || Legacy_Settings.s.platform == Legacy_Settings.Platform.PS3) + && !hasTransit && Legacy_Settings.s.game != Legacy_Settings.Game.Dinosaur) { + LegacyPointer off_lightMapTexture = LegacyPointer.Read(reader); // g_p_stLMTexture + LegacyPointer.DoAt(ref reader, off_lightMapTexture, () => { lightmapTexture = TextureInfo.Read(reader, off_lightMapTexture); }); - if (Settings.s.game == Settings.Game.R3) { - Pointer off_overlightTexture = Pointer.Read(reader); // *(_DWORD *)(GLI_BIG_GLOBALS + 370068) - Pointer.DoAt(ref reader, off_overlightTexture, () => { + if (Legacy_Settings.s.game == Legacy_Settings.Game.R3) { + LegacyPointer off_overlightTexture = LegacyPointer.Read(reader); // *(_DWORD *)(GLI_BIG_GLOBALS + 370068) + LegacyPointer.DoAt(ref reader, off_overlightTexture, () => { overlightTexture = TextureInfo.Read(reader, off_overlightTexture); }); } } - Pointer off_animBankLvl = null; + LegacyPointer off_animBankLvl = null; await WaitIfNecessary(); - if (Settings.s.game == Settings.Game.Dinosaur) { + if (Legacy_Settings.s.game == Legacy_Settings.Game.Dinosaur) { // animation bank is read right here. - off_animBankLvl = Pointer.Current(reader); // Note: only one 0x104 bank in fix. + off_animBankLvl = LegacyPointer.Current(reader); // Note: only one 0x104 bank in fix. print("Lvl animation bank address: " + off_animBankLvl); animationBanks = new AnimationBank[5]; AnimationBank[] banks = AnimationBank.Read(reader, off_animBankLvl, 0, 1, files_array[Mem.LvlKeyFrames]); @@ -699,172 +700,172 @@ async UniTask LoadLVL() { loadingState = "Loading globals"; await WaitIfNecessary(); globals.off_transitDynamicWorld = null; - globals.off_actualWorld = Pointer.Read(reader); - globals.off_dynamicWorld = Pointer.Read(reader); - if (Settings.s.game == Settings.Game.R3 - && (Settings.s.platform == Settings.Platform.PC - || Settings.s.platform == Settings.Platform.MacOS - || Settings.s.platform == Settings.Platform.Xbox - || Settings.s.platform == Settings.Platform.Xbox360 - || Settings.s.platform == Settings.Platform.PS3)) { + globals.off_actualWorld = LegacyPointer.Read(reader); + globals.off_dynamicWorld = LegacyPointer.Read(reader); + if (Legacy_Settings.s.game == Legacy_Settings.Game.R3 + && (Legacy_Settings.s.platform == Legacy_Settings.Platform.PC + || Legacy_Settings.s.platform == Legacy_Settings.Platform.MacOS + || Legacy_Settings.s.platform == Legacy_Settings.Platform.Xbox + || Legacy_Settings.s.platform == Legacy_Settings.Platform.Xbox360 + || Legacy_Settings.s.platform == Legacy_Settings.Platform.PS3)) { reader.ReadUInt32(); // ??? } - globals.off_inactiveDynamicWorld = Pointer.Read(reader); - globals.off_fatherSector = Pointer.Read(reader); // It is I, Father Sector. - globals.off_firstSubMapPosition = Pointer.Read(reader); + globals.off_inactiveDynamicWorld = LegacyPointer.Read(reader); + globals.off_fatherSector = LegacyPointer.Read(reader); // It is I, Father Sector. + globals.off_firstSubMapPosition = LegacyPointer.Read(reader); globals.num_always = reader.ReadUInt32(); - globals.spawnablePersos = LinkedList.ReadHeader(reader, Pointer.Current(reader), LinkedList.Type.Double); - globals.off_always_reusableSO = Pointer.Read(reader); // There are (num_always) empty SuperObjects starting with this one. - globals.off_always_reusableUnknown1 = Pointer.Read(reader); // (num_always) * 0x2c blocks - globals.off_always_reusableUnknown2 = Pointer.Read(reader); // (num_always) * 0x4 blocks + globals.spawnablePersos = LinkedList.ReadHeader(reader, LegacyPointer.Current(reader), LinkedList.Type.Double); + globals.off_always_reusableSO = LegacyPointer.Read(reader); // There are (num_always) empty SuperObjects starting with this one. + globals.off_always_reusableUnknown1 = LegacyPointer.Read(reader); // (num_always) * 0x2c blocks + globals.off_always_reusableUnknown2 = LegacyPointer.Read(reader); // (num_always) * 0x4 blocks // Read object types objectTypes = new ObjectType[3][]; for (uint i = 0; i < 3; i++) { - Pointer off_names_header = Pointer.Current(reader); - Pointer off_names_first = Pointer.Read(reader); - Pointer off_names_last = Pointer.Read(reader); + LegacyPointer off_names_header = LegacyPointer.Current(reader); + LegacyPointer off_names_first = LegacyPointer.Read(reader); + LegacyPointer off_names_last = LegacyPointer.Read(reader); uint num_names = reader.ReadUInt32(); ReadObjectNamesTable(reader, off_names_first, num_names, i); } await WaitIfNecessary(); - Pointer off_light = Pointer.Read(reader); // the offset of a light. It's just an ordinary light. - Pointer off_characterLaunchingSoundEvents = Pointer.Read(reader); + LegacyPointer off_light = LegacyPointer.Read(reader); // the offset of a light. It's just an ordinary light. + LegacyPointer off_characterLaunchingSoundEvents = LegacyPointer.Read(reader); - if (Settings.s.platform != Settings.Platform.PS2) { - Pointer off_collisionGeoObj = Pointer.Read(reader); - Pointer off_staticCollisionGeoObj = Pointer.Read(reader); + if (Legacy_Settings.s.platform != Legacy_Settings.Platform.PS2) { + LegacyPointer off_collisionGeoObj = LegacyPointer.Read(reader); + LegacyPointer off_staticCollisionGeoObj = LegacyPointer.Read(reader); } if (!hasTransit) { reader.ReadUInt32(); // viewport related <--- cameras in here } - LinkedList unknown = LinkedList.ReadHeader(reader, Pointer.Current(reader), type: LinkedList.Type.Double); + LinkedList unknown = LinkedList.ReadHeader(reader, LegacyPointer.Current(reader), type: LinkedList.Type.Double); - families = LinkedList.ReadHeader(reader, Pointer.Current(reader), type: LinkedList.Type.Double); + families = LinkedList.ReadHeader(reader, LegacyPointer.Current(reader), type: LinkedList.Type.Double); - LinkedList alwaysActiveCharacters = LinkedList.ReadHeader(reader, Pointer.Current(reader), type: LinkedList.Type.Double); + LinkedList alwaysActiveCharacters = LinkedList.ReadHeader(reader, LegacyPointer.Current(reader), type: LinkedList.Type.Double); if (!hasTransit) { - LinkedList mainCharacters = LinkedList.ReadHeader(reader, Pointer.Current(reader), type: LinkedList.Type.Double); + LinkedList mainCharacters = LinkedList.ReadHeader(reader, LegacyPointer.Current(reader), type: LinkedList.Type.Double); } - if (Settings.s.platform == Settings.Platform.PS2) { - Pointer off_mainCharacters_first = Pointer.Read(reader); + if (Legacy_Settings.s.platform == Legacy_Settings.Platform.PS2) { + LegacyPointer off_mainCharacters_first = LegacyPointer.Read(reader); uint num_mainCharacters_entries = reader.ReadUInt32(); } reader.ReadUInt32(); // only used if there was no transit in the previous lvl. Always 00165214 in R3GC? reader.ReadUInt32(); // related to "SOL". What is this? Good question. reader.ReadUInt32(); // same - if (Settings.s.game != Settings.Game.Dinosaur && Settings.s.platform != Settings.Platform.PS2) { + if (Legacy_Settings.s.game != Legacy_Settings.Game.Dinosaur && Legacy_Settings.s.platform != Legacy_Settings.Platform.PS2) { reader.ReadUInt32(); // same } - Pointer off_cineManager = Pointer.Read(reader); - if (Settings.s.platform != Settings.Platform.PS2) { + LegacyPointer off_cineManager = LegacyPointer.Read(reader); + if (Legacy_Settings.s.platform != Legacy_Settings.Platform.PS2) { byte unk = reader.ReadByte(); byte IPO_numRLItables = reader.ReadByte(); reader.ReadUInt16(); } - if (Settings.s.platform == Settings.Platform.PS2 && (Settings.s.game == Settings.Game.RA || Settings.s.game == Settings.Game.RM)) { + if (Legacy_Settings.s.platform == Legacy_Settings.Platform.PS2 && (Legacy_Settings.s.game == Legacy_Settings.Game.RA || Legacy_Settings.s.game == Legacy_Settings.Game.RM)) { reader.ReadUInt32(); reader.ReadUInt32(); reader.ReadUInt32(); reader.AlignOffset(0x10, 4); // 4 because LVL starts at 4 - Matrix identity = Matrix.Read(reader, Pointer.Current(reader)); + Matrix identity = Matrix.Read(reader, LegacyPointer.Current(reader)); reader.ReadUInt32(); reader.ReadUInt32(); reader.ReadUInt32(); reader.ReadUInt32(); } - Pointer off_COL_taggedFacesTable = Pointer.Read(reader); + LegacyPointer off_COL_taggedFacesTable = LegacyPointer.Read(reader); uint num_COL_maxTaggedFaces = reader.ReadUInt32(); - if (Settings.s.platform != Settings.Platform.PS2) { - Pointer off_collisionGeoObj2 = Pointer.Read(reader); - Pointer off_staticCollisionGeoObj2 = Pointer.Read(reader); + if (Legacy_Settings.s.platform != Legacy_Settings.Platform.PS2) { + LegacyPointer off_collisionGeoObj2 = LegacyPointer.Read(reader); + LegacyPointer off_staticCollisionGeoObj2 = LegacyPointer.Read(reader); } // The ptrsTable seems to be related to sound events. Perhaps cuuids. reader.ReadUInt32(); - if (Settings.s.game == Settings.Game.Dinosaur) { + if (Legacy_Settings.s.game == Legacy_Settings.Game.Dinosaur) { for (int i = 0; i < 50; i++) { reader.ReadUInt32(); } // Actually, the previous uint is an amount for this array of uints, but it's padded to always be 50 long } uint num_ptrsTable = reader.ReadUInt32(); - if (Settings.s.game == Settings.Game.R3) { + if (Legacy_Settings.s.game == Legacy_Settings.Game.R3) { uint bool_ptrsTable = reader.ReadUInt32(); } - Pointer off_ptrsTable = Pointer.Read(reader); + LegacyPointer off_ptrsTable = LegacyPointer.Read(reader); uint num_internalStructure = num_ptrsTable; - if (Settings.s.mode == Settings.Mode.Rayman3GC - || Settings.s.mode == Settings.Mode.Rayman3PS2Demo_2002_05_17 - || Settings.s.mode == Settings.Mode.Rayman3PS2Demo_2002_12_18 - || (Settings.s.platform == Settings.Platform.PS2 && (Settings.s.game == Settings.Game.RA || Settings.s.game == Settings.Game.RM))) { + if (Legacy_Settings.s.mode == Legacy_Settings.Mode.Rayman3GC + || Legacy_Settings.s.mode == Legacy_Settings.Mode.Rayman3PS2Demo_2002_05_17 + || Legacy_Settings.s.mode == Legacy_Settings.Mode.Rayman3PS2Demo_2002_12_18 + || (Legacy_Settings.s.platform == Legacy_Settings.Platform.PS2 && (Legacy_Settings.s.game == Legacy_Settings.Game.RA || Legacy_Settings.s.game == Legacy_Settings.Game.RM))) { reader.ReadUInt32(); } - Pointer off_internalStructure_first = Pointer.Read(reader); - Pointer off_internalStructure_last = Pointer.Read(reader); + LegacyPointer off_internalStructure_first = LegacyPointer.Read(reader); + LegacyPointer off_internalStructure_last = LegacyPointer.Read(reader); - if (Settings.s.platform != Settings.Platform.PS2) { - if (!hasTransit && Settings.s.game == Settings.Game.R3) { + if (Legacy_Settings.s.platform != Legacy_Settings.Platform.PS2) { + if (!hasTransit && Legacy_Settings.s.game == Legacy_Settings.Game.R3) { uint num_geometric = reader.ReadUInt32(); - Pointer off_array_geometric = Pointer.Read(reader); - Pointer off_array_geometric_RLI = Pointer.Read(reader); - Pointer off_array_transition_flags = Pointer.Read(reader); - } else if (Settings.s.game == Settings.Game.RA - || Settings.s.game == Settings.Game.RM - || Settings.s.game == Settings.Game.Dinosaur - || Settings.s.game == Settings.Game.DDPK) { + LegacyPointer off_array_geometric = LegacyPointer.Read(reader); + LegacyPointer off_array_geometric_RLI = LegacyPointer.Read(reader); + LegacyPointer off_array_transition_flags = LegacyPointer.Read(reader); + } else if (Legacy_Settings.s.game == Legacy_Settings.Game.RA + || Legacy_Settings.s.game == Legacy_Settings.Game.RM + || Legacy_Settings.s.game == Legacy_Settings.Game.Dinosaur + || Legacy_Settings.s.game == Legacy_Settings.Game.DDPK) { uint num_unk = reader.ReadUInt32(); - Pointer unk_first = Pointer.Read(reader); - if (Settings.s.game != Settings.Game.Dinosaur) { - Pointer unk_last = Pointer.Read(reader); + LegacyPointer unk_first = LegacyPointer.Read(reader); + if (Legacy_Settings.s.game != Legacy_Settings.Game.Dinosaur) { + LegacyPointer unk_last = LegacyPointer.Read(reader); } } } - Pointer off_settingsForPersoInFix = null; - if (Settings.s.platform == Settings.Platform.PS2) { - off_settingsForPersoInFix = Pointer.Current(reader); + LegacyPointer off_settingsForPersoInFix = null; + if (Legacy_Settings.s.platform == Legacy_Settings.Platform.PS2) { + off_settingsForPersoInFix = LegacyPointer.Current(reader); uint num_persoInFix = (uint)persoInFix.Length; - if (Settings.s.game == Settings.Game.R3) { + if (Legacy_Settings.s.game == Legacy_Settings.Game.R3) { num_persoInFix = reader.ReadUInt32(); } for (int i = 0; i < num_persoInFix; i++) { - if (Settings.s.game == Settings.Game.R3) { - Pointer.Read(reader); + if (Legacy_Settings.s.game == Legacy_Settings.Game.R3) { + LegacyPointer.Read(reader); reader.AlignOffset(0x10, 4); // 4 because LVL starts at 4 - Matrix.Read(reader, Pointer.Current(reader)); + Matrix.Read(reader, LegacyPointer.Current(reader)); reader.ReadUInt32(); // is one of these the state? doesn't appear to change tho reader.ReadUInt32(); - } else if (Settings.s.game == Settings.Game.RA - || Settings.s.game == Settings.Game.RM - || Settings.s.game == Settings.Game.Dinosaur) { - Matrix.Read(reader, Pointer.Current(reader)); + } else if (Legacy_Settings.s.game == Legacy_Settings.Game.RA + || Legacy_Settings.s.game == Legacy_Settings.Game.RM + || Legacy_Settings.s.game == Legacy_Settings.Game.Dinosaur) { + Matrix.Read(reader, LegacyPointer.Current(reader)); } } - Pointer.Read(reader); - if (Settings.s.game == Settings.Game.R3 || Settings.s.game == Settings.Game.DDPK) { + LegacyPointer.Read(reader); + if (Legacy_Settings.s.game == Legacy_Settings.Game.R3 || Legacy_Settings.s.game == Legacy_Settings.Game.DDPK) { reader.ReadUInt32(); reader.ReadUInt32(); } } uint num_visual_materials = reader.ReadUInt32(); - Pointer off_array_visual_materials = Pointer.Read(reader); + LegacyPointer off_array_visual_materials = LegacyPointer.Read(reader); - if (Settings.s.platform != Settings.Platform.PS2 - && Settings.s.mode != Settings.Mode.RaymanArenaGC - && Settings.s.mode != Settings.Mode.RaymanArenaGCDemo_2002_03_07 - && Settings.s.mode != Settings.Mode.DonaldDuckPKGC) { - Pointer off_dynamic_so_list = Pointer.Read(reader); + if (Legacy_Settings.s.platform != Legacy_Settings.Platform.PS2 + && Legacy_Settings.s.mode != Legacy_Settings.Mode.RaymanArenaGC + && Legacy_Settings.s.mode != Legacy_Settings.Mode.RaymanArenaGCDemo_2002_03_07 + && Legacy_Settings.s.mode != Legacy_Settings.Mode.DonaldDuckPKGC) { + LegacyPointer off_dynamic_so_list = LegacyPointer.Read(reader); // Parse SO list - Pointer.DoAt(ref reader, off_dynamic_so_list, () => { + LegacyPointer.DoAt(ref reader, off_dynamic_so_list, () => { LinkedList.ReadHeader(reader, off_dynamic_so_list); /*Pointer off_so_list_first = Pointer.Read(reader); Pointer off_so_list_last = Pointer.Read(reader); @@ -888,10 +889,10 @@ async UniTask LoadLVL() { // Parse materials list loadingState = "Loading visual materials"; await WaitIfNecessary(); - Pointer.DoAt(ref reader, off_array_visual_materials, () => { + LegacyPointer.DoAt(ref reader, off_array_visual_materials, () => { for (uint i = 0; i < num_visual_materials; i++) { - Pointer off_material = Pointer.Read(reader); - Pointer.DoAt(ref reader, off_material, () => { + LegacyPointer off_material = LegacyPointer.Read(reader); + LegacyPointer.DoAt(ref reader, off_material, () => { //print(Pointer.Current(reader)); visualMaterials.Add(VisualMaterial.Read(reader, off_material)); }); @@ -901,28 +902,28 @@ async UniTask LoadLVL() { if (hasTransit) { loadingState = "Loading transit memory"; await WaitIfNecessary(); - Pointer off_transit = new Pointer(16, files_array[Mem.Transit]); // It's located at offset 20 in transit - Pointer.DoAt(ref reader, off_transit, () => { - if (Settings.s.platform == Settings.Platform.PC - || Settings.s.platform == Settings.Platform.MacOS - || Settings.s.platform == Settings.Platform.Xbox - || Settings.s.platform == Settings.Platform.Xbox360 - || Settings.s.platform == Settings.Platform.PS3) { - Pointer off_lightMapTexture = Pointer.Read(reader); // g_p_stLMTexture - Pointer.DoAt(ref reader, off_lightMapTexture, () => { + LegacyPointer off_transit = new LegacyPointer(16, files_array[Mem.Transit]); // It's located at offset 20 in transit + LegacyPointer.DoAt(ref reader, off_transit, () => { + if (Legacy_Settings.s.platform == Legacy_Settings.Platform.PC + || Legacy_Settings.s.platform == Legacy_Settings.Platform.MacOS + || Legacy_Settings.s.platform == Legacy_Settings.Platform.Xbox + || Legacy_Settings.s.platform == Legacy_Settings.Platform.Xbox360 + || Legacy_Settings.s.platform == Legacy_Settings.Platform.PS3) { + LegacyPointer off_lightMapTexture = LegacyPointer.Read(reader); // g_p_stLMTexture + LegacyPointer.DoAt(ref reader, off_lightMapTexture, () => { lightmapTexture = TextureInfo.Read(reader, off_lightMapTexture); }); - if (Settings.s.game == Settings.Game.R3) { - Pointer off_overlightTexture = Pointer.Read(reader); // *(_DWORD *)(GLI_BIG_GLOBALS + 370068) - Pointer.DoAt(ref reader, off_overlightTexture, () => { + if (Legacy_Settings.s.game == Legacy_Settings.Game.R3) { + LegacyPointer off_overlightTexture = LegacyPointer.Read(reader); // *(_DWORD *)(GLI_BIG_GLOBALS + 370068) + LegacyPointer.DoAt(ref reader, off_overlightTexture, () => { overlightTexture = TextureInfo.Read(reader, off_overlightTexture); }); } } - globals.off_transitDynamicWorld = Pointer.Read(reader); - globals.off_actualWorld = Pointer.Read(reader); - globals.off_dynamicWorld = Pointer.Read(reader); - globals.off_inactiveDynamicWorld = Pointer.Read(reader); + globals.off_transitDynamicWorld = LegacyPointer.Read(reader); + globals.off_actualWorld = LegacyPointer.Read(reader); + globals.off_dynamicWorld = LegacyPointer.Read(reader); + globals.off_inactiveDynamicWorld = LegacyPointer.Read(reader); }); } @@ -939,36 +940,36 @@ async UniTask LoadLVL() { await WaitIfNecessary(); - Pointer.DoAt(ref reader, off_cineManager, () => { + LegacyPointer.DoAt(ref reader, off_cineManager, () => { cinematicsManager = CinematicsManager.Read(reader, off_cineManager); }); // off_current should be after the dynamic SO list positions. - if (Settings.s.platform == Settings.Platform.PS2) { - Pointer off_current = Pointer.Goto(ref reader, off_settingsForPersoInFix); + if (Legacy_Settings.s.platform == Legacy_Settings.Platform.PS2) { + LegacyPointer off_current = LegacyPointer.Goto(ref reader, off_settingsForPersoInFix); await ReadSettingsForPersoInFix(reader); - Pointer.Goto(ref reader, off_current); + LegacyPointer.Goto(ref reader, off_current); } else { await ReadSettingsForPersoInFix(reader); } - if (Settings.s.platform == Settings.Platform.GC) { + if (Legacy_Settings.s.platform == Legacy_Settings.Platform.GC) { reader.ReadBytes(0x800); // floats } loadingState = "Loading animation banks"; await WaitIfNecessary(); - if (Settings.s.game != Settings.Game.Dinosaur) { - off_animBankLvl = Pointer.Read(reader); // Note: 4 0x104 banks in lvl. + if (Legacy_Settings.s.game != Legacy_Settings.Game.Dinosaur) { + off_animBankLvl = LegacyPointer.Read(reader); // Note: 4 0x104 banks in lvl. //print(Pointer.Current(reader)); print("Lvl animation bank address: " + off_animBankLvl); animationBanks = new AnimationBank[5]; if (off_animBankFix != off_animBankLvl) { - Pointer.DoAt(ref reader, off_animBankFix, () => { + LegacyPointer.DoAt(ref reader, off_animBankFix, () => { animationBanks[0] = AnimationBank.Read(reader, off_animBankFix, 0, 1, files_array[Mem.FixKeyFrames])[0]; }); } await WaitIfNecessary(); - Pointer.DoAt(ref reader, off_animBankLvl, () => { + LegacyPointer.DoAt(ref reader, off_animBankLvl, () => { AnimationBank[] banks = AnimationBank.Read(reader, off_animBankLvl, 1, 4, files_array[Mem.LvlKeyFrames]); for (int i = 0; i < 4; i++) { animationBanks[1 + i] = banks[i]; @@ -980,17 +981,17 @@ async UniTask LoadLVL() { } // Load additional animation banks string extraAnimFolder = "Anim/"; - if (Settings.s.mode == Settings.Mode.RaymanArenaGCDemo_2002_03_07 || Settings.s.platform == Settings.Platform.PS2) { + if (Legacy_Settings.s.mode == Legacy_Settings.Mode.RaymanArenaGCDemo_2002_03_07 || Legacy_Settings.s.platform == Legacy_Settings.Platform.PS2) { extraAnimFolder = lvlName + "/"; } - extraAnimFolder = ConvertCase(extraAnimFolder, Settings.CapsType.LevelFolder); + extraAnimFolder = ConvertCase(extraAnimFolder, Legacy_Settings.CapsType.LevelFolder); for (int i = 0; i < families.Count; i++) { if (families[i] != null && families[i].animBank > 4 && objectTypes[0][families[i].family_index].id != 0xFF) { int animBank = families[i].animBank; loadingState = "Loading additional animation bank " + animBank; await WaitIfNecessary(); int animFileID = objectTypes[0][families[i].family_index].id; - if (Settings.s.mode == Settings.Mode.RaymanArenaGCDemo_2002_03_07 || Settings.s.platform == Settings.Platform.PS2) { + if (Legacy_Settings.s.mode == Legacy_Settings.Mode.RaymanArenaGCDemo_2002_03_07 || Legacy_Settings.s.platform == Legacy_Settings.Platform.PS2) { animFileID = animBank - 5; } string animName = "ani" + animFileID.ToString(); @@ -999,15 +1000,15 @@ async UniTask LoadLVL() { //print(animBank + " - " + objectTypes[0][families[i].family_index].id); int fileID = animBank + 102; int kfFileID = animBank + 2; // Anim bank will start at 5, so this will start at 7 - if (Settings.s.game == Settings.Game.RM || (Settings.s.game == Settings.Game.RA && Settings.s.platform == Settings.Platform.PS2)) { + if (Legacy_Settings.s.game == Legacy_Settings.Game.RM || (Legacy_Settings.s.game == Legacy_Settings.Game.RA && Legacy_Settings.s.platform == Legacy_Settings.Platform.PS2)) { fileID = animBank; } // Prepare files for WebGL - string animFileLvl = gameDataBinFolder + extraAnimFolder + ConvertCase(animName + ".lvl", Settings.CapsType.LevelFile); - string animFilePtr = gameDataBinFolder + extraAnimFolder + ConvertCase(animName + ".ptr", Settings.CapsType.LevelFile); - string kfFileLvl = gameDataBinFolder + extraAnimFolder + ConvertCase(kfName + ".lvl", Settings.CapsType.LevelFile); - string kfFilePtr = gameDataBinFolder + extraAnimFolder + ConvertCase(kfName + ".ptr", Settings.CapsType.LevelFile); + string animFileLvl = gameDataBinFolder + extraAnimFolder + ConvertCase(animName + ".lvl", Legacy_Settings.CapsType.LevelFile); + string animFilePtr = gameDataBinFolder + extraAnimFolder + ConvertCase(animName + ".ptr", Legacy_Settings.CapsType.LevelFile); + string kfFileLvl = gameDataBinFolder + extraAnimFolder + ConvertCase(kfName + ".lvl", Legacy_Settings.CapsType.LevelFile); + string kfFilePtr = gameDataBinFolder + extraAnimFolder + ConvertCase(kfName + ".ptr", Legacy_Settings.CapsType.LevelFile); await PrepareFile(animFileLvl); if (FileSystem.FileExists(animFileLvl)) { await PrepareFile(animFilePtr); @@ -1023,9 +1024,9 @@ async UniTask LoadLVL() { if (animBank >= animationBanks.Length) { Array.Resize(ref animationBanks, animBank + 1); } - Pointer off_animBankExtra = new Pointer(0, animFile); - Pointer.DoAt(ref reader, off_animBankExtra, () => { - if (Settings.s.platform == Settings.Platform.PS2) { + LegacyPointer off_animBankExtra = new LegacyPointer(0, animFile); + LegacyPointer.DoAt(ref reader, off_animBankExtra, () => { + if (Legacy_Settings.s.platform == Legacy_Settings.Platform.PS2) { string timestamp = reader.ReadString(0x18); reader.ReadUInt32(); reader.ReadUInt32(); @@ -1036,7 +1037,7 @@ async UniTask LoadLVL() { int alignBytes = reader.ReadInt32(); if (alignBytes > 0) reader.Align(4, alignBytes); } - off_animBankExtra = Pointer.Current(reader); + off_animBankExtra = LegacyPointer.Current(reader); animationBanks[animBank] = AnimationBank.Read(reader, off_animBankExtra, (uint)animBank, 1, kfFile)[0]; }); } @@ -1054,32 +1055,32 @@ protected async UniTask ReadSettingsForPersoInFix(Reader reader) { loadingState = "Loading settings for persos in fix"; await WaitIfNecessary(); uint num_perso_with_settings_in_fix = (uint)persoInFix.Length; - if (Settings.s.game == Settings.Game.R3) num_perso_with_settings_in_fix = reader.ReadUInt32(); + if (Legacy_Settings.s.game == Legacy_Settings.Game.R3) num_perso_with_settings_in_fix = reader.ReadUInt32(); for (int i = 0; i < num_perso_with_settings_in_fix; i++) { - Pointer off_perso_so_with_settings_in_fix = null, off_matrix = null; + LegacyPointer off_perso_so_with_settings_in_fix = null, off_matrix = null; SuperObject so = null; Matrix mat = null; - if (Settings.s.game == Settings.Game.R3) { - if (Settings.s.platform == Settings.Platform.PS2) { - off_perso_so_with_settings_in_fix = Pointer.Read(reader); + if (Legacy_Settings.s.game == Legacy_Settings.Game.R3) { + if (Legacy_Settings.s.platform == Legacy_Settings.Platform.PS2) { + off_perso_so_with_settings_in_fix = LegacyPointer.Read(reader); reader.AlignOffset(0x10, 4); // 4 because LVL starts at 4 - off_matrix = Pointer.Current(reader); + off_matrix = LegacyPointer.Current(reader); mat = Matrix.Read(reader, off_matrix); reader.ReadUInt32(); // is one of these the state? doesn't appear to change tho reader.ReadUInt32(); } else { - off_perso_so_with_settings_in_fix = Pointer.Read(reader); - off_matrix = Pointer.Current(reader); + off_perso_so_with_settings_in_fix = LegacyPointer.Read(reader); + off_matrix = LegacyPointer.Current(reader); mat = Matrix.Read(reader, off_matrix); reader.ReadUInt32(); // is one of these the state? doesn't appear to change tho reader.ReadUInt32(); } so = SuperObject.FromOffset(off_perso_so_with_settings_in_fix); - } else if (Settings.s.game == Settings.Game.RA - || Settings.s.game == Settings.Game.RM - || Settings.s.game == Settings.Game.DDPK - || Settings.s.game == Settings.Game.Dinosaur) { - off_matrix = Pointer.Current(reader); + } else if (Legacy_Settings.s.game == Legacy_Settings.Game.RA + || Legacy_Settings.s.game == Legacy_Settings.Game.RM + || Legacy_Settings.s.game == Legacy_Settings.Game.DDPK + || Legacy_Settings.s.game == Legacy_Settings.Game.Dinosaur) { + off_matrix = LegacyPointer.Current(reader); mat = Matrix.Read(reader, off_matrix); so = superObjects.FirstOrDefault(s => s.off_data == persoInFix[i]); } diff --git a/Assets/Scripts/OpenSpace/Object/IPO.cs b/Assets/Scripts/OpenSpace/Object/IPO.cs index 5c1e6e4b..ca2fa14b 100644 --- a/Assets/Scripts/OpenSpace/Object/IPO.cs +++ b/Assets/Scripts/OpenSpace/Object/IPO.cs @@ -10,10 +10,10 @@ namespace OpenSpace.Object { /// IPO = Instantiated Physical Object. Used for level geometry /// public class IPO : IEngineObject { - public Pointer offset; - public Pointer off_data; - public Pointer off_radiosity; - public Pointer off_portalCamera; + public LegacyPointer offset; + public LegacyPointer off_data; + public LegacyPointer off_radiosity; + public LegacyPointer off_portalCamera; public PhysicalObject data; public Radiosity radiosity; @@ -53,30 +53,30 @@ public SuperObject SuperObject { } } - public IPO(Pointer offset, SuperObject so) { + public IPO(LegacyPointer offset, SuperObject so) { this.offset = offset; this.superObject = so; } - public static IPO Read(Reader reader, Pointer offset, SuperObject so) { + public static IPO Read(Reader reader, LegacyPointer offset, SuperObject so) { MapLoader l = MapLoader.Loader; IPO ipo = new IPO(offset, so); - ipo.off_data = Pointer.Read(reader); - ipo.off_radiosity = Pointer.Read(reader); + ipo.off_data = LegacyPointer.Read(reader); + ipo.off_radiosity = LegacyPointer.Read(reader); ipo.name = "IPO @ " + offset; // TODO: Read radiosity on all platforms. Currently crashes on Xbox 360 //ipo.radiosity = l.FromOffsetOrRead(reader, ipo.off_radiosity); - if (Settings.s.engineVersion >= Settings.EngineVersion.R3) { + if (Legacy_Settings.s.engineVersion >= Legacy_Settings.EngineVersion.R3) { reader.ReadUInt32(); - ipo.off_portalCamera = Pointer.Read(reader); + ipo.off_portalCamera = LegacyPointer.Read(reader); reader.ReadUInt32(); reader.ReadUInt32(); reader.ReadUInt32(); - if (Settings.s.hasNames) ipo.name = reader.ReadString(0x32); + if (Legacy_Settings.s.hasNames) ipo.name = reader.ReadString(0x32); } - Pointer.DoAt(ref reader, ipo.off_data, () => { + LegacyPointer.DoAt(ref reader, ipo.off_data, () => { ipo.data = PhysicalObject.Read(reader, ipo.off_data, so:ipo.superObject, radiosity: ipo.radiosity); }); /*Pointer.DoAt(ref reader, ipo.off_portalCamera, () => { diff --git a/Assets/Scripts/OpenSpace/Object/Perso.cs b/Assets/Scripts/OpenSpace/Object/Perso.cs index a8767376..ce08943f 100644 --- a/Assets/Scripts/OpenSpace/Object/Perso.cs +++ b/Assets/Scripts/OpenSpace/Object/Perso.cs @@ -14,18 +14,18 @@ namespace OpenSpace.Object { /// Also called "Actor" in the code which might be a better name, but I'll stick to the R2 one for now /// public class Perso : IEngineObject, IReferenceable { - public Pointer offset; + public LegacyPointer offset; // Struct - public Pointer off_3dData; - public Pointer off_stdGame; - public Pointer off_dynam; - public Pointer off_brain; - public Pointer off_camera; - public Pointer off_collSet; - public Pointer off_msWay; - public Pointer off_msLight; - public Pointer off_sectInfo; + public LegacyPointer off_3dData; + public LegacyPointer off_stdGame; + public LegacyPointer off_dynam; + public LegacyPointer off_brain; + public LegacyPointer off_camera; + public LegacyPointer off_collSet; + public LegacyPointer off_msWay; + public LegacyPointer off_msLight; + public LegacyPointer off_sectInfo; // Derived @@ -70,44 +70,44 @@ public SuperObject SuperObject { } } - public Perso(Pointer offset, SuperObject so) { + public Perso(LegacyPointer offset, SuperObject so) { this.offset = offset; this.superObject = so; } - public static Perso Read(Reader reader, Pointer offset, SuperObject so) { + public static Perso Read(Reader reader, LegacyPointer offset, SuperObject so) { MapLoader l = MapLoader.Loader; Perso p = new Perso(offset, so); //l.print("Perso " + offset); l.persos.Add(p); - p.off_3dData = Pointer.Read(reader); // 0x0 - p.off_stdGame = Pointer.Read(reader); // 4 Standard Game info - p.off_dynam = Pointer.Read(reader); // 0x8 Dynam - if (Settings.s.engineVersion == Settings.EngineVersion.Montreal) reader.ReadUInt32(); - p.off_brain = Pointer.Read(reader); // 0xC - p.off_camera = Pointer.Read(reader); // 0x10 is Camera in Rayman 2 - p.off_collSet = Pointer.Read(reader); // 0x14 collset - p.off_msWay = Pointer.Read(reader); // 0x18 - p.off_msLight = Pointer.Read(reader); // 0x1C - MSLight - if (Settings.s.engineVersion <= Settings.EngineVersion.Montreal) reader.ReadUInt32(); - p.off_sectInfo = Pointer.Read(reader); // 0x20 // Pointer to struct that points to active sector + p.off_3dData = LegacyPointer.Read(reader); // 0x0 + p.off_stdGame = LegacyPointer.Read(reader); // 4 Standard Game info + p.off_dynam = LegacyPointer.Read(reader); // 0x8 Dynam + if (Legacy_Settings.s.engineVersion == Legacy_Settings.EngineVersion.Montreal) reader.ReadUInt32(); + p.off_brain = LegacyPointer.Read(reader); // 0xC + p.off_camera = LegacyPointer.Read(reader); // 0x10 is Camera in Rayman 2 + p.off_collSet = LegacyPointer.Read(reader); // 0x14 collset + p.off_msWay = LegacyPointer.Read(reader); // 0x18 + p.off_msLight = LegacyPointer.Read(reader); // 0x1C - MSLight + if (Legacy_Settings.s.engineVersion <= Legacy_Settings.EngineVersion.Montreal) reader.ReadUInt32(); + p.off_sectInfo = LegacyPointer.Read(reader); // 0x20 // Pointer to struct that points to active sector reader.ReadUInt32(); // 0x24 reader.ReadUInt32(); - if (Settings.s.game == Settings.Game.RA || Settings.s.game == Settings.Game.RM) reader.ReadUInt32(); - if (Settings.s.engineVersion < Settings.EngineVersion.R3) { + if (Legacy_Settings.s.game == Legacy_Settings.Game.RA || Legacy_Settings.s.game == Legacy_Settings.Game.RM) reader.ReadUInt32(); + if (Legacy_Settings.s.engineVersion < Legacy_Settings.EngineVersion.R3) { reader.ReadUInt32(); reader.ReadUInt32(); reader.ReadUInt32(); reader.ReadUInt32(); } - Pointer.DoAt(ref reader, p.off_3dData, () => { + LegacyPointer.DoAt(ref reader, p.off_3dData, () => { p.p3dData = Perso3dData.Read(reader, p.off_3dData); }); - Pointer.DoAt(ref reader, p.off_stdGame, () => { + LegacyPointer.DoAt(ref reader, p.off_stdGame, () => { p.stdGame = StandardGame.Read(reader, p.off_stdGame); - if (Settings.s.hasObjectTypes) { + if (Legacy_Settings.s.hasObjectTypes) { p.nameFamily = p.stdGame.GetName(0); p.nameModel = p.stdGame.GetName(1); p.namePerso = p.stdGame.GetName(2); @@ -127,13 +127,13 @@ public static Perso Read(Reader reader, Pointer offset, SuperObject so) { }); l.print("[" + p.nameFamily + "] " + p.nameModel + " | " + p.namePerso + " - offset: " + offset+" superObject offset: "+(so!=null?so.offset.ToString():"null")); - if (Settings.s.engineVersion > Settings.EngineVersion.Montreal && Settings.s.game != Settings.Game.R2Revolution) { - Pointer.DoAt(ref reader, p.off_dynam, () => { + if (Legacy_Settings.s.engineVersion > Legacy_Settings.EngineVersion.Montreal && Legacy_Settings.s.game != Legacy_Settings.Game.R2Revolution) { + LegacyPointer.DoAt(ref reader, p.off_dynam, () => { p.dynam = Dynam.Read(reader, p.off_dynam); }); } - Pointer.DoAt(ref reader, p.off_brain, () => { + LegacyPointer.DoAt(ref reader, p.off_brain, () => { p.brain = Brain.Read(reader, p.off_brain); if (p.brain != null && p.brain.mind != null && p.brain.mind.AI_model != null && p.nameModel != null) p.brain.mind.AI_model.name = p.nameModel; }); @@ -180,7 +180,7 @@ public static Perso Read(Reader reader, Pointer offset, SuperObject so) { }*/ } if (p.brain != null && p.brain.mind != null && p.brain.mind.AI_model != null - && !(Settings.s.engineVersion == Settings.EngineVersion.R3 && Settings.s.loadFromMemory)) { // Weird bug for R3 memory loading + && !(Legacy_Settings.s.engineVersion == Legacy_Settings.EngineVersion.R3 && Legacy_Settings.s.loadFromMemory)) { // Weird bug for R3 memory loading // Add physical objects tables hidden in scripts AIModel ai = p.brain.mind.AI_model; if (ai.behaviors_normal != null) { @@ -235,18 +235,18 @@ public static Perso Read(Reader reader, Pointer offset, SuperObject so) { } } - Pointer.DoAt(ref reader, p.off_collSet, () => { + LegacyPointer.DoAt(ref reader, p.off_collSet, () => { p.collset = CollSet.Read(reader, p, p.off_collSet); }); - Pointer.DoAt(ref reader, p.off_sectInfo, () => { + LegacyPointer.DoAt(ref reader, p.off_sectInfo, () => { p.sectInfo = PersoSectorInfo.Read(reader, p.off_sectInfo); }); return p; } - public static Perso FromOffset(Pointer offset) { + public static Perso FromOffset(LegacyPointer offset) { if (offset == null) return null; MapLoader l = MapLoader.Loader; return l.persos.FirstOrDefault(f => f.offset == offset); @@ -304,12 +304,12 @@ public void Write(Writer writer) { } if (persoBehaviour.clearTheBrain) { - if (Settings.s.engineVersion == Settings.EngineVersion.Montreal) { - Pointer.Goto(ref writer, offset + 0x10); + if (Legacy_Settings.s.engineVersion == Legacy_Settings.EngineVersion.Montreal) { + LegacyPointer.Goto(ref writer, offset + 0x10); } else { - Pointer.Goto(ref writer, offset + 0xC); + LegacyPointer.Goto(ref writer, offset + 0xC); } - Pointer.Write(writer, null); + LegacyPointer.Write(writer, null); persoBehaviour.clearTheBrain = false; } diff --git a/Assets/Scripts/OpenSpace/Object/PhysicalObject.cs b/Assets/Scripts/OpenSpace/Object/PhysicalObject.cs index eab440f6..b5823019 100644 --- a/Assets/Scripts/OpenSpace/Object/PhysicalObject.cs +++ b/Assets/Scripts/OpenSpace/Object/PhysicalObject.cs @@ -12,11 +12,11 @@ namespace OpenSpace.Object { public class PhysicalObject : IEquatable, IEngineObject { - public Pointer offset; - public Pointer off_visualSet; - public Pointer off_collideSet; - public Pointer off_visualBoundingVolume; - public Pointer off_collideBoundingVolume; + public LegacyPointer offset; + public LegacyPointer off_visualSet; + public LegacyPointer off_collideSet; + public LegacyPointer off_visualBoundingVolume; + public LegacyPointer off_collideBoundingVolume; public VisualSetLOD[] visualSet; public ushort visualSetType = 0; public GeometricObjectCollide collideMesh; @@ -81,7 +81,7 @@ public SuperObject SuperObject { get { return superObject; } } - public PhysicalObject(Pointer offset, SuperObject so = null) { + public PhysicalObject(LegacyPointer offset, SuperObject so = null) { this.offset = offset; this.superObject = so; visualSet = new VisualSetLOD[0]; @@ -107,69 +107,69 @@ public bool Equals(PhysicalObject other) { return !(x == y); } - public static PhysicalObject Read(Reader reader, Pointer offset, SuperObject so = null, Radiosity radiosity = null) { + public static PhysicalObject Read(Reader reader, LegacyPointer offset, SuperObject so = null, Radiosity radiosity = null) { PhysicalObject po = new PhysicalObject(offset, so); //MapLoader.Loader.print("PO @ " + offset); // Header - po.off_visualSet = Pointer.Read(reader); - po.off_collideSet = Pointer.Read(reader); - po.off_visualBoundingVolume = Pointer.Read(reader); - if (Settings.s.engineVersion > Settings.EngineVersion.TT && Settings.s.game != Settings.Game.LargoWinch) { - if (Settings.s.engineVersion < Settings.EngineVersion.R3) { + po.off_visualSet = LegacyPointer.Read(reader); + po.off_collideSet = LegacyPointer.Read(reader); + po.off_visualBoundingVolume = LegacyPointer.Read(reader); + if (Legacy_Settings.s.engineVersion > Legacy_Settings.EngineVersion.TT && Legacy_Settings.s.game != Legacy_Settings.Game.LargoWinch) { + if (Legacy_Settings.s.engineVersion < Legacy_Settings.EngineVersion.R3) { po.off_collideBoundingVolume = po.off_visualBoundingVolume; reader.ReadUInt32(); } else { - po.off_collideBoundingVolume = Pointer.Read(reader); + po.off_collideBoundingVolume = LegacyPointer.Read(reader); } } // Parse visual set - Pointer.DoAt(ref reader, po.off_visualSet, () => { + LegacyPointer.DoAt(ref reader, po.off_visualSet, () => { ushort numberOfLOD = 1; po.visualSetType = 0; - if (Settings.s.game == Settings.Game.LargoWinch) { + if (Legacy_Settings.s.game == Legacy_Settings.Game.LargoWinch) { po.visualSet = new VisualSetLOD[1]; po.visualSet[0] = new VisualSetLOD(); po.visualSet[0].obj = null; po.visualSet[0].off_data = po.off_visualSet; po.visualSet[0].LODdistance = 5f; - } else if (Settings.s.game == Settings.Game.R2Revolution) { + } else if (Legacy_Settings.s.game == Legacy_Settings.Game.R2Revolution) { po.visualSet = new VisualSetLOD[1]; po.visualSet[0] = new VisualSetLOD(); po.visualSet[0].obj = MapLoader.Loader.meshObjects.FirstOrDefault(p => p.offset == po.off_visualSet); po.visualSet[0].off_data = po.off_visualSet; po.visualSet[0].LODdistance = 5f; } else { - if (Settings.s.platform != Settings.Platform.DC) { + if (Legacy_Settings.s.platform != Legacy_Settings.Platform.DC) { reader.ReadUInt32(); // 0 numberOfLOD = reader.ReadUInt16(); //if (numberOfLOD > 1) MapLoader.Loader.print("Found a PO with " + numberOfLOD + " levels of detail @ " + offset); po.visualSetType = reader.ReadUInt16(); if (numberOfLOD > 0) { - Pointer off_LODDistances = Pointer.Read(reader); - Pointer off_LODDataOffsets = Pointer.Read(reader); + LegacyPointer off_LODDistances = LegacyPointer.Read(reader); + LegacyPointer off_LODDataOffsets = LegacyPointer.Read(reader); reader.ReadUInt32(); // always 0? RLI table offset - if (Settings.s.engineVersion > Settings.EngineVersion.Montreal) reader.ReadUInt32(); // always 0? number of RLI + if (Legacy_Settings.s.engineVersion > Legacy_Settings.EngineVersion.Montreal) reader.ReadUInt32(); // always 0? number of RLI po.visualSet = new VisualSetLOD[numberOfLOD]; for (uint i = 0; i < numberOfLOD; i++) { po.visualSet[i] = new VisualSetLOD(); } - Pointer.DoAt(ref reader, off_LODDistances, () => { + LegacyPointer.DoAt(ref reader, off_LODDistances, () => { for (uint i = 0; i < numberOfLOD; i++) { // if distance > the float at this offset, game engine uses next LOD if there is one po.visualSet[i].LODdistance = reader.ReadSingle(); } }); - Pointer.DoAt(ref reader, off_LODDataOffsets, () => { + LegacyPointer.DoAt(ref reader, off_LODDataOffsets, () => { for (uint i = 0; i < numberOfLOD; i++) { - po.visualSet[i].off_data = Pointer.Read(reader); + po.visualSet[i].off_data = LegacyPointer.Read(reader); } }); } } else { // Platform = Dreamcast - Pointer.Read(reader); // Material pointer? - Pointer off_data = Pointer.Read(reader); + LegacyPointer.Read(reader); // Material pointer? + LegacyPointer off_data = LegacyPointer.Read(reader); reader.ReadUInt32(); // always 0? reader.ReadUInt32(); // always 0? po.visualSet = new VisualSetLOD[1]; @@ -179,7 +179,7 @@ public static PhysicalObject Read(Reader reader, Pointer offset, SuperObject so } int radiosityLODIndex = 0; for (uint i = 0; i < numberOfLOD; i++) { - Pointer.DoAt(ref reader, po.visualSet[i].off_data, () => { + LegacyPointer.DoAt(ref reader, po.visualSet[i].off_data, () => { switch (po.visualSetType) { case 0: if(po.visualSet[i].obj == null) po.visualSet[i].obj = GeometricObject.Read(reader, po.visualSet[i].off_data, radiosity: radiosity?.lod?[radiosityLODIndex++]); @@ -196,8 +196,8 @@ public static PhysicalObject Read(Reader reader, Pointer offset, SuperObject so }); // Parse collide set - Pointer.DoAt(ref reader, po.off_collideSet, () => { - if (Settings.s.game == Settings.Game.R2Revolution) { + LegacyPointer.DoAt(ref reader, po.off_collideSet, () => { + if (Legacy_Settings.s.game == Legacy_Settings.Game.R2Revolution) { // Read collide mesh object here directly po.collideMesh = GeometricObjectCollide.Read(reader, po.off_collideSet); } else { @@ -205,8 +205,8 @@ public static PhysicalObject Read(Reader reader, Pointer offset, SuperObject so uint u1 = reader.ReadUInt32(); // 0, zdm uint u2 = reader.ReadUInt32(); // 0, zdd uint u3 = reader.ReadUInt32(); // 0, zde - Pointer off_zdr = Pointer.Read(reader); - Pointer.DoAt(ref reader, off_zdr, () => { + LegacyPointer off_zdr = LegacyPointer.Read(reader); + LegacyPointer.DoAt(ref reader, off_zdr, () => { po.collideMesh = GeometricObjectCollide.Read(reader, off_zdr); }); } diff --git a/Assets/Scripts/OpenSpace/Object/Properties/Family.cs b/Assets/Scripts/OpenSpace/Object/Properties/Family.cs index 5cc1656f..13197bd9 100644 --- a/Assets/Scripts/OpenSpace/Object/Properties/Family.cs +++ b/Assets/Scripts/OpenSpace/Object/Properties/Family.cs @@ -11,18 +11,18 @@ namespace OpenSpace.Object.Properties { public class Family : ILinkedListEntry { - public Pointer offset; - public Pointer off_family_next; - public Pointer off_family_prev; - public Pointer off_family_hdr; // at this offset, start and end pointers appear again + public LegacyPointer offset; + public LegacyPointer off_family_next; + public LegacyPointer off_family_prev; + public LegacyPointer off_family_hdr; // at this offset, start and end pointers appear again public uint family_index; public LinkedList states; public LinkedList preloadAnim; // int is just a placeholder type, change to actual type when I finally read it - public Pointer off_physical_list_default; + public LegacyPointer off_physical_list_default; [JsonProperty(PropertyName = "objectListReferences")] public LinkedList objectLists; - public Pointer off_bounding_volume; - public Pointer off_vector4s; + public LegacyPointer off_bounding_volume; + public LegacyPointer off_vector4s; public uint num_vector4s; public byte animBank; public byte properties; @@ -40,19 +40,19 @@ public GameObject Gao { } } - public Pointer NextEntry { + public LegacyPointer NextEntry { get { return off_family_next; } } - public Pointer PreviousEntry { + public LegacyPointer PreviousEntry { get { return off_family_prev; } } - public Family(Pointer offset) { + public Family(LegacyPointer offset) { this.offset = offset; } - public int GetIndexOfPhysicalList(Pointer off_physicalList) { + public int GetIndexOfPhysicalList(LegacyPointer off_physicalList) { for(int i = 0; i < objectLists.Count; i++) { ObjectList ol = objectLists[i]; if (ol != null && ol.offset == off_physicalList) return i; @@ -69,52 +69,52 @@ public void AddNewPhysicalList(ObjectList ol, bool alreadyAdded = false) { if (!alreadyAdded && !objectLists.Contains(ol)) objectLists.Add(ol); } - public static Family Read(Reader reader, Pointer offset) { + public static Family Read(Reader reader, LegacyPointer offset) { MapLoader l = MapLoader.Loader; //l.print("Family " + offset); Family f = new Family(offset); - f.off_family_next = Pointer.Read(reader); - f.off_family_prev = Pointer.Read(reader); - f.off_family_hdr = Pointer.Read(reader); // at this offset, start and end pointers appear again - if (Settings.s.game != Settings.Game.R2Revolution) { + f.off_family_next = LegacyPointer.Read(reader); + f.off_family_prev = LegacyPointer.Read(reader); + f.off_family_hdr = LegacyPointer.Read(reader); // at this offset, start and end pointers appear again + if (Legacy_Settings.s.game != Legacy_Settings.Game.R2Revolution) { f.family_index = reader.ReadUInt32(); } - if (Settings.s.hasObjectTypes) { + if (Legacy_Settings.s.hasObjectTypes) { f.name = l.objectTypes[0][f.family_index].name; } //l.print("(" + f.family_index + ") " + f.name + " - " + offset); int stateIndex = 0; - f.states = LinkedList.Read(ref reader, Pointer.Current(reader), (off_element) => { + f.states = LinkedList.Read(ref reader, LegacyPointer.Current(reader), (off_element) => { //l.print(f.name + " [" + stateIndex + "]: " + off_element); State s = State.Read(reader, off_element, f, stateIndex++); return s; }); - if (Settings.s.engineVersion == Settings.EngineVersion.R3 && Settings.s.game != Settings.Game.LargoWinch) { + if (Legacy_Settings.s.engineVersion == Legacy_Settings.EngineVersion.R3 && Legacy_Settings.s.game != Legacy_Settings.Game.LargoWinch) { // (0x10 blocks: next, prev, list end, a3d pointer) - f.preloadAnim = LinkedList.ReadHeader(reader, Pointer.Current(reader)); + f.preloadAnim = LinkedList.ReadHeader(reader, LegacyPointer.Current(reader)); } - if (Settings.s.game == Settings.Game.R2Revolution) { - f.objectLists = LinkedList.ReadHeader(reader, Pointer.Current(reader), LinkedList.Type.Double); + if (Legacy_Settings.s.game == Legacy_Settings.Game.R2Revolution) { + f.objectLists = LinkedList.ReadHeader(reader, LegacyPointer.Current(reader), LinkedList.Type.Double); } else { - f.off_physical_list_default = Pointer.Read(reader); // Default objects table - f.objectLists = LinkedList.ReadHeader(reader, Pointer.Current(reader)); + f.off_physical_list_default = LegacyPointer.Read(reader); // Default objects table + f.objectLists = LinkedList.ReadHeader(reader, LegacyPointer.Current(reader)); } - if ((Settings.s.mode == Settings.Mode.Rayman3PS2DevBuild_2002_09_06 + if ((Legacy_Settings.s.mode == Legacy_Settings.Mode.Rayman3PS2DevBuild_2002_09_06 || f.objectLists.off_head == f.objectLists.off_tail) && f.objectLists.Count > 1) f.objectLists.Count = 1; // Correction for Rayman 2 - f.off_bounding_volume = Pointer.Read(reader); - if (Settings.s.game == Settings.Game.R3) { - f.off_vector4s = Pointer.Read(reader); + f.off_bounding_volume = LegacyPointer.Read(reader); + if (Legacy_Settings.s.game == Legacy_Settings.Game.R3) { + f.off_vector4s = LegacyPointer.Read(reader); f.num_vector4s = reader.ReadUInt32(); reader.ReadUInt32(); } - if (Settings.s.game == Settings.Game.LargoWinch) { + if (Legacy_Settings.s.game == Legacy_Settings.Game.LargoWinch) { reader.ReadUInt32(); f.animBank = reader.ReadByte(); f.properties = reader.ReadByte(); reader.ReadByte(); reader.ReadByte(); - } else if (Settings.s.engineVersion < Settings.EngineVersion.R3) { + } else if (Legacy_Settings.s.engineVersion < Legacy_Settings.EngineVersion.R3) { reader.ReadUInt32(); f.animBank = reader.ReadByte(); reader.ReadByte(); @@ -136,7 +136,7 @@ public static Family Read(Reader reader, Pointer offset) { ObjectList ol = ObjectList.FromOffsetOrRead(off_list, reader); f.AddNewPhysicalList(ol, alreadyAdded: true); - if (Settings.s.game == Settings.Game.LargoWinch) { + if (Legacy_Settings.s.game == Legacy_Settings.Game.LargoWinch) { foreach (State state in f.states) { if (state != null && state.anim_ref != null && state.anim_ref.a3dLargo != null) { foreach (Animation.Component.AnimNTTO n in state.anim_ref.a3dLargo.ntto) { @@ -173,7 +173,7 @@ public static Family Read(Reader reader, Pointer offset) { return f; } - public static Family FromOffset(Pointer offset) { + public static Family FromOffset(LegacyPointer offset) { if (offset == null) return null; MapLoader l = MapLoader.Loader; return l.families.FirstOrDefault(f => f.offset == offset); diff --git a/Assets/Scripts/OpenSpace/Object/Properties/ObjectList.cs b/Assets/Scripts/OpenSpace/Object/Properties/ObjectList.cs index 4046af57..f2a4b1a8 100644 --- a/Assets/Scripts/OpenSpace/Object/Properties/ObjectList.cs +++ b/Assets/Scripts/OpenSpace/Object/Properties/ObjectList.cs @@ -12,13 +12,13 @@ namespace OpenSpace.Object.Properties { public class ObjectList : ILinkedListEntry, IList { - public Pointer offset; - public Pointer off_objList_next = null; - public Pointer off_objList_prev = null; - public Pointer off_objList_hdr = null; // at this offset, start and end pointers appear again + public LegacyPointer offset; + public LegacyPointer off_objList_next = null; + public LegacyPointer off_objList_prev = null; + public LegacyPointer off_objList_hdr = null; // at this offset, start and end pointers appear again - public Pointer off_objList_start; - public Pointer off_objList_2; + public LegacyPointer off_objList_start; + public LegacyPointer off_objList_2; public ushort num_entries; public string unknownFamilyName; @@ -45,11 +45,11 @@ private void InitGameObject() { } } - public Pointer NextEntry { + public LegacyPointer NextEntry { get { return off_objList_next; } } - public Pointer PreviousEntry { + public LegacyPointer PreviousEntry { get { return off_objList_prev; } } @@ -75,51 +75,51 @@ public ObjectListEntry this[int index] { } } - public ObjectList(Pointer offset) { + public ObjectList(LegacyPointer offset) { this.offset = offset; } - public static ObjectList Read(Reader reader, Pointer offset) { + public static ObjectList Read(Reader reader, LegacyPointer offset) { MapLoader l = MapLoader.Loader; ObjectList ol = new ObjectList(offset); //l.print("ObjectList: " + Pointer.Current(reader)); - if(Settings.s.linkedListType != LinkedList.Type.Minimize) ol.off_objList_next = Pointer.Read(reader); - if (Settings.s.hasLinkedListHeaderPointers) { - ol.off_objList_prev = Pointer.Read(reader); - ol.off_objList_hdr = Pointer.Read(reader); + if(Legacy_Settings.s.linkedListType != LinkedList.Type.Minimize) ol.off_objList_next = LegacyPointer.Read(reader); + if (Legacy_Settings.s.hasLinkedListHeaderPointers) { + ol.off_objList_prev = LegacyPointer.Read(reader); + ol.off_objList_hdr = LegacyPointer.Read(reader); } - ol.off_objList_start = Pointer.Read(reader); - ol.off_objList_2 = Pointer.Read(reader); // is this a copy of the list or something? + ol.off_objList_start = LegacyPointer.Read(reader); + ol.off_objList_2 = LegacyPointer.Read(reader); // is this a copy of the list or something? ol.num_entries = reader.ReadUInt16(); reader.ReadUInt16(); - if (Settings.s.linkedListType == LinkedList.Type.Minimize) ol.off_objList_next = Pointer.Current(reader); + if (Legacy_Settings.s.linkedListType == LinkedList.Type.Minimize) ol.off_objList_next = LegacyPointer.Current(reader); //l.print("ObjectList " + offset + " - " + ol.num_entries); if (ol.off_objList_start != null) { - Pointer.Goto(ref reader, ol.off_objList_start); + LegacyPointer.Goto(ref reader, ol.off_objList_start); ol.entries = new ObjectListEntry[ol.num_entries]; for (uint i = 0; i < ol.num_entries; i++) { // each entry is 0x14 ol.entries[i] = new ObjectListEntry(); - if (Settings.s.game == Settings.Game.LargoWinch) { - ol.entries[i].off_po = Pointer.Read(reader); + if (Legacy_Settings.s.game == Legacy_Settings.Game.LargoWinch) { + ol.entries[i].off_po = LegacyPointer.Read(reader); } else { - ol.entries[i].off_scale = Pointer.Read(reader); - ol.entries[i].off_po = Pointer.Read(reader); + ol.entries[i].off_scale = LegacyPointer.Read(reader); + ol.entries[i].off_po = LegacyPointer.Read(reader); ol.entries[i].thirdvalue = reader.ReadUInt32(); ol.entries[i].unk0 = reader.ReadUInt16(); ol.entries[i].unk1 = reader.ReadUInt16(); - if (Settings.s.platform != Settings.Platform.DC) { + if (Legacy_Settings.s.platform != Legacy_Settings.Platform.DC) { ol.entries[i].lastvalue = reader.ReadUInt32(); } } // TODO: Figure out what this points to: if(off_po != null && lastvalue == 0) l.print(off_po); - if (/*ol.entries[i].unk0 == 0 || ol.entries[i].unk0 == 4*/ ol.entries[i].lastvalue != 0 || ol.entries[i].thirdvalue != 0 || Settings.s.engineVersion == Settings.EngineVersion.TT) { + if (/*ol.entries[i].unk0 == 0 || ol.entries[i].unk0 == 4*/ ol.entries[i].lastvalue != 0 || ol.entries[i].thirdvalue != 0 || Legacy_Settings.s.engineVersion == Legacy_Settings.EngineVersion.TT) { ol.entries[i].po = null; ol.entries[i].scale = null; - Pointer.DoAt(ref reader, ol.entries[i].off_scale, () => { + LegacyPointer.DoAt(ref reader, ol.entries[i].off_scale, () => { float x = reader.ReadSingle(); float z = reader.ReadSingle(); float y = reader.ReadSingle(); @@ -153,7 +153,7 @@ public static ObjectList Read(Reader reader, Pointer offset) { public void ReadPO(Reader reader, int i) { if (entries[i].po != null) return; - Pointer.DoAt(ref reader, entries[i].off_po, () => { + LegacyPointer.DoAt(ref reader, entries[i].off_po, () => { entries[i].po = PhysicalObject.Read(reader, entries[i].off_po); if (entries[i].po != null && entries[i].scale.HasValue) { entries[i].po.scaleMultiplier = entries[i].scale.Value; @@ -164,17 +164,17 @@ public void ReadPO(Reader reader, int i) { }); } - public static ObjectList FromOffset(Pointer offset) { + public static ObjectList FromOffset(LegacyPointer offset) { if (offset == null) return null; MapLoader l = MapLoader.Loader; return l.objectLists.FirstOrDefault(f => f.offset == offset); } - public static ObjectList FromOffsetOrRead(Pointer offset, Reader reader) { + public static ObjectList FromOffsetOrRead(LegacyPointer offset, Reader reader) { if (offset == null) return null; ObjectList ol = FromOffset(offset); if (ol == null) { - Pointer.DoAt(ref reader, offset, () => { + LegacyPointer.DoAt(ref reader, offset, () => { ol = ObjectList.Read(reader, offset); MapLoader.Loader.objectLists.Add(ol); }); @@ -219,7 +219,7 @@ public void AddToFamilyLists(Perso perso) { } } else { - if (Settings.s.linkUncategorizedObjectsToScriptFamily) { + if (Legacy_Settings.s.linkUncategorizedObjectsToScriptFamily) { perso.p3dData.family.AddNewPhysicalList(this); } else { MapLoader.Loader.AddUncategorizedObjectList(this); diff --git a/Assets/Scripts/OpenSpace/Object/Properties/ObjectListEntry.cs b/Assets/Scripts/OpenSpace/Object/Properties/ObjectListEntry.cs index e5c33361..30088120 100644 --- a/Assets/Scripts/OpenSpace/Object/Properties/ObjectListEntry.cs +++ b/Assets/Scripts/OpenSpace/Object/Properties/ObjectListEntry.cs @@ -8,8 +8,8 @@ namespace OpenSpace.Object.Properties { public struct ObjectListEntry { - public Pointer off_scale; - public Pointer off_po; + public LegacyPointer off_scale; + public LegacyPointer off_po; public uint thirdvalue; public ushort unk0; public ushort unk1; diff --git a/Assets/Scripts/OpenSpace/Object/Properties/Perso3dData.cs b/Assets/Scripts/OpenSpace/Object/Properties/Perso3dData.cs index f729ecfe..4b24a923 100644 --- a/Assets/Scripts/OpenSpace/Object/Properties/Perso3dData.cs +++ b/Assets/Scripts/OpenSpace/Object/Properties/Perso3dData.cs @@ -3,37 +3,37 @@ namespace OpenSpace.Object.Properties { public class Perso3dData { - public Pointer offset; + public LegacyPointer offset; - public Pointer off_stateInitial; - public Pointer off_stateCurrent; - public Pointer off_state2; + public LegacyPointer off_stateInitial; + public LegacyPointer off_stateCurrent; + public LegacyPointer off_state2; - public Pointer off_objectList; - public Pointer off_objectListInitial; - public Pointer off_family; + public LegacyPointer off_objectList; + public LegacyPointer off_objectListInitial; + public LegacyPointer off_family; - public Pointer off_morphList; + public LegacyPointer off_morphList; public Family family = null; public ObjectList objectList = null; public State stateCurrent = null; - public Perso3dData(Pointer offset) { + public Perso3dData(LegacyPointer offset) { this.offset = offset; } - public static Perso3dData Read(Reader reader, Pointer offset) { + public static Perso3dData Read(Reader reader, LegacyPointer offset) { MapLoader l = MapLoader.Loader; Perso3dData d = new Perso3dData(offset); - d.off_stateInitial = Pointer.Read(reader); - d.off_stateCurrent = Pointer.Read(reader); - d.off_state2 = Pointer.Read(reader); + d.off_stateInitial = LegacyPointer.Read(reader); + d.off_stateCurrent = LegacyPointer.Read(reader); + d.off_state2 = LegacyPointer.Read(reader); - d.off_objectList = Pointer.Read(reader); - d.off_objectListInitial = Pointer.Read(reader); - d.off_family = Pointer.Read(reader); + d.off_objectList = LegacyPointer.Read(reader); + d.off_objectListInitial = LegacyPointer.Read(reader); + d.off_family = LegacyPointer.Read(reader); d.family = Family.FromOffset(d.off_family); d.stateCurrent = State.FromOffset(d.family, d.off_stateCurrent); // 0x1C @@ -47,18 +47,18 @@ public void UpdateCurrentState(Reader reader) { MapLoader l = MapLoader.Loader; - off_stateInitial = Pointer.Read(reader); - off_stateCurrent = Pointer.Read(reader); - off_state2 = Pointer.Read(reader); + off_stateInitial = LegacyPointer.Read(reader); + off_stateCurrent = LegacyPointer.Read(reader); + off_state2 = LegacyPointer.Read(reader); stateCurrent = State.FromOffset(family, off_stateCurrent); } public void Write(Writer writer) { - Pointer.Goto(ref writer, offset); - Pointer.Write(writer, off_stateInitial); - Pointer.Write(writer, off_stateCurrent); - Pointer.Write(writer, off_state2); - Pointer.Write(writer, off_objectList); + LegacyPointer.Goto(ref writer, offset); + LegacyPointer.Write(writer, off_stateInitial); + LegacyPointer.Write(writer, off_stateCurrent); + LegacyPointer.Write(writer, off_state2); + LegacyPointer.Write(writer, off_objectList); } } } \ No newline at end of file diff --git a/Assets/Scripts/OpenSpace/Object/Properties/PersoSectorInfo.cs b/Assets/Scripts/OpenSpace/Object/Properties/PersoSectorInfo.cs index 4bf33e42..8b7613fc 100644 --- a/Assets/Scripts/OpenSpace/Object/Properties/PersoSectorInfo.cs +++ b/Assets/Scripts/OpenSpace/Object/Properties/PersoSectorInfo.cs @@ -3,20 +3,20 @@ namespace OpenSpace.Object.Properties { public class PersoSectorInfo { - public Pointer offset; + public LegacyPointer offset; - public Pointer off_sector; + public LegacyPointer off_sector; public Sector sector; - public PersoSectorInfo(Pointer offset) { + public PersoSectorInfo(LegacyPointer offset) { this.offset = offset; } - public static PersoSectorInfo Read(Reader reader, Pointer offset) { + public static PersoSectorInfo Read(Reader reader, LegacyPointer offset) { MapLoader l = MapLoader.Loader; PersoSectorInfo si = new PersoSectorInfo(offset); - si.off_sector = Pointer.Read(reader); + si.off_sector = LegacyPointer.Read(reader); // Size in r2: 14 dwords total // Size in r3 & ra: 6 dwords total return si; diff --git a/Assets/Scripts/OpenSpace/Object/Properties/StandardGame.cs b/Assets/Scripts/OpenSpace/Object/Properties/StandardGame.cs index 4cc37af3..d5498432 100644 --- a/Assets/Scripts/OpenSpace/Object/Properties/StandardGame.cs +++ b/Assets/Scripts/OpenSpace/Object/Properties/StandardGame.cs @@ -3,9 +3,9 @@ namespace OpenSpace.Object.Properties { public class StandardGame { - public Pointer offset; + public LegacyPointer offset; public uint[] objectTypes = new uint[3]; - public Pointer off_superobject; + public LegacyPointer off_superobject; public uint customBits; public uint aiCustomBits; @@ -37,25 +37,25 @@ public bool IsMainActor } } - public StandardGame(Pointer offset) + public StandardGame(LegacyPointer offset) { this.offset = offset; } - public static StandardGame Read(Reader reader, Pointer offset) + public static StandardGame Read(Reader reader, LegacyPointer offset) { MapLoader l = MapLoader.Loader; //l.print("StdGame: " + offset); StandardGame stdGame = new StandardGame(offset); - if (Settings.s.game != Settings.Game.R2Revolution && Settings.s.game != Settings.Game.LargoWinch) { + if (Legacy_Settings.s.game != Legacy_Settings.Game.R2Revolution && Legacy_Settings.s.game != Legacy_Settings.Game.LargoWinch) { stdGame.objectTypes[0] = reader.ReadUInt32(); stdGame.objectTypes[1] = reader.ReadUInt32(); stdGame.objectTypes[2] = reader.ReadUInt32(); - stdGame.off_superobject = Pointer.Read(reader); // 0xC SuperObject from Perso probably + stdGame.off_superobject = LegacyPointer.Read(reader); // 0xC SuperObject from Perso probably - if (Settings.s.engineVersion < Settings.EngineVersion.R3) { - if (Settings.s.platform == Settings.Platform.DC) { + if (Legacy_Settings.s.engineVersion < Legacy_Settings.EngineVersion.R3) { + if (Legacy_Settings.s.platform == Legacy_Settings.Platform.DC) { reader.ReadInt32(); reader.ReadInt32(); reader.ReadInt32(); @@ -97,7 +97,7 @@ public static StandardGame Read(Reader reader, Pointer offset) stdGame.customBitsInitial = reader.ReadUInt32(); stdGame.aiCustomBitsInitial = reader.ReadUInt32(); } - } else if (Settings.s.game == Settings.Game.R2Revolution) { + } else if (Legacy_Settings.s.game == Legacy_Settings.Game.R2Revolution) { // Revolution reader.ReadInt32(); reader.ReadInt32(); @@ -111,7 +111,7 @@ public static StandardGame Read(Reader reader, Pointer offset) stdGame.objectTypes[1] = reader.ReadUInt16(); stdGame.objectTypes[2] = reader.ReadUInt16(); reader.ReadUInt32(); - stdGame.off_superobject = Pointer.Read(reader); + stdGame.off_superobject = LegacyPointer.Read(reader); reader.ReadBytes(0xC); stdGame.platformType = reader.ReadByte(); stdGame.miscFlags = reader.ReadByte(); @@ -121,7 +121,7 @@ public static StandardGame Read(Reader reader, Pointer offset) reader.ReadUInt32(); reader.ReadUInt32(); // a pointer? stdGame.customBitsInitial = reader.ReadUInt32(); - } else if (Settings.s.game == Settings.Game.LargoWinch) { + } else if (Legacy_Settings.s.game == Legacy_Settings.Game.LargoWinch) { // Almost same as revo reader.ReadInt32(); reader.ReadInt32(); @@ -132,7 +132,7 @@ public static StandardGame Read(Reader reader, Pointer offset) stdGame.objectTypes[1] = reader.ReadUInt32(); stdGame.objectTypes[2] = reader.ReadUInt32(); reader.ReadUInt32(); - stdGame.off_superobject = Pointer.Read(reader); + stdGame.off_superobject = LegacyPointer.Read(reader); reader.ReadBytes(0x10); stdGame.platformType = reader.ReadByte(); stdGame.miscFlags = reader.ReadByte(); @@ -174,9 +174,9 @@ public bool ConsideredTooFarAway() public void Write(Writer writer) { - Pointer.Goto(ref writer, offset); - if (Settings.s.engineVersion < Settings.EngineVersion.R3) { - Pointer.Goto(ref writer, offset + 0x24); + LegacyPointer.Goto(ref writer, offset); + if (Legacy_Settings.s.engineVersion < Legacy_Settings.EngineVersion.R3) { + LegacyPointer.Goto(ref writer, offset + 0x24); writer.Write(customBits); writer.Write(platformType); writer.Write(miscFlags); @@ -184,7 +184,7 @@ public void Write(Writer writer) writer.Write(transparencyZoneMax); writer.Write(customBitsInitial); } else { - Pointer.Goto(ref writer, offset + 0x20); + LegacyPointer.Goto(ref writer, offset + 0x20); writer.Write(customBits); writer.Write(aiCustomBits); writer.Write(platformType); diff --git a/Assets/Scripts/OpenSpace/Object/Properties/State.cs b/Assets/Scripts/OpenSpace/Object/Properties/State.cs index cad69680..b5959947 100644 --- a/Assets/Scripts/OpenSpace/Object/Properties/State.cs +++ b/Assets/Scripts/OpenSpace/Object/Properties/State.cs @@ -8,45 +8,45 @@ namespace OpenSpace.Object.Properties { public class State : ILinkedListEntry { - public Pointer offset; + public LegacyPointer offset; [JsonIgnore] public Family family; public int index = 0; public string name = null; - public Pointer off_entry_next; - public Pointer off_entry_prev; - public Pointer off_anim_ref; + public LegacyPointer off_entry_next; + public LegacyPointer off_entry_prev; + public LegacyPointer off_anim_ref; public LinkedList stateTransitions; public LinkedList prohobitStates; - public Pointer off_mechanicsIDCard = null; - public Pointer off_cine_mapname = null; - public Pointer off_cine_name = null; + public LegacyPointer off_mechanicsIDCard = null; + public LegacyPointer off_cine_mapname = null; + public LegacyPointer off_cine_name = null; public string cine_mapname = null; public string cine_name = null; public byte speed; - public Pointer off_nextState; // Go to this state after a while if nothing changes + public LegacyPointer off_nextState; // Go to this state after a while if nothing changes public AnimationReference anim_ref = null; public AnimationMontreal anim_refMontreal = null; public MechanicsIDCard mechanicsIDCard; public byte customStateBits; - public Pointer NextEntry { + public LegacyPointer NextEntry { get { - if (Settings.s.linkedListType != LinkedList.Type.Minimize) { + if (Legacy_Settings.s.linkedListType != LinkedList.Type.Minimize) { return off_entry_next; } else { - if (Settings.s.mode == Settings.Mode.RaymanArenaGC - || Settings.s.mode == Settings.Mode.RaymanArenaGCDemo_2002_03_07 - || Settings.s.mode == Settings.Mode.DonaldDuckPKGC - || (Settings.s.platform == Settings.Platform.PS2 && Settings.s.engineVersion == Settings.EngineVersion.R3)) { - return offset + 0x28 + (Settings.s.hasNames ? 0x50 : 0); + if (Legacy_Settings.s.mode == Legacy_Settings.Mode.RaymanArenaGC + || Legacy_Settings.s.mode == Legacy_Settings.Mode.RaymanArenaGCDemo_2002_03_07 + || Legacy_Settings.s.mode == Legacy_Settings.Mode.DonaldDuckPKGC + || (Legacy_Settings.s.platform == Legacy_Settings.Platform.PS2 && Legacy_Settings.s.engineVersion == Legacy_Settings.EngineVersion.R3)) { + return offset + 0x28 + (Legacy_Settings.s.hasNames ? 0x50 : 0); } else {//if (MapLoader.Loader.mode == MapLoader.Mode.Rayman2DC) { - return offset + 0x20 + (Settings.s.hasNames ? 0x50 : 0); + return offset + 0x20 + (Legacy_Settings.s.hasNames ? 0x50 : 0); } } } } - public Pointer PreviousEntry { + public LegacyPointer PreviousEntry { get { return off_entry_prev; } } @@ -65,7 +65,7 @@ public string ShortName { } } - public State(Pointer offset, Family family, int index) { + public State(LegacyPointer offset, Family family, int index) { this.offset = offset; this.family = family; this.index = index; @@ -78,33 +78,33 @@ public override string ToString() { return result; } - public static State Read(Reader reader, Pointer offset, Family family, int index) { + public static State Read(Reader reader, LegacyPointer offset, Family family, int index) { MapLoader l = MapLoader.Loader; //l.print("State " + Pointer.Current(reader)); State s = new State(offset, family, index); l.states.Add(s); - if (Settings.s.hasNames) s.name = new string(reader.ReadChars(0x50)).TrimEnd('\0'); - if (Settings.s.linkedListType != LinkedList.Type.Minimize) s.off_entry_next = Pointer.Read(reader); - if (Settings.s.hasLinkedListHeaderPointers) { - s.off_entry_prev = Pointer.Read(reader); - Pointer.Read(reader); // another header at tail of state list + if (Legacy_Settings.s.hasNames) s.name = new string(reader.ReadChars(0x50)).TrimEnd('\0'); + if (Legacy_Settings.s.linkedListType != LinkedList.Type.Minimize) s.off_entry_next = LegacyPointer.Read(reader); + if (Legacy_Settings.s.hasLinkedListHeaderPointers) { + s.off_entry_prev = LegacyPointer.Read(reader); + LegacyPointer.Read(reader); // another header at tail of state list } - s.off_anim_ref = Pointer.Read(reader); - s.stateTransitions = LinkedList.Read(ref reader, Pointer.Current(reader), element => { + s.off_anim_ref = LegacyPointer.Read(reader); + s.stateTransitions = LinkedList.Read(ref reader, LegacyPointer.Current(reader), element => { return l.FromOffsetOrRead(reader, element); }); - s.prohobitStates = LinkedList.Read(ref reader, Pointer.Current(reader), element => { + s.prohobitStates = LinkedList.Read(ref reader, LegacyPointer.Current(reader), element => { return l.FromOffsetOrRead(reader, element); }); - s.off_nextState = Pointer.Read(reader, allowMinusOne: true); - s.off_mechanicsIDCard = Pointer.Read(reader); - if (Settings.s.engineVersion == Settings.EngineVersion.R3 - && Settings.s.game != Settings.Game.Dinosaur - && Settings.s.game != Settings.Game.LargoWinch) { - s.off_cine_mapname = Pointer.Read(reader); - s.off_cine_name = Pointer.Read(reader); + s.off_nextState = LegacyPointer.Read(reader, allowMinusOne: true); + s.off_mechanicsIDCard = LegacyPointer.Read(reader); + if (Legacy_Settings.s.engineVersion == Legacy_Settings.EngineVersion.R3 + && Legacy_Settings.s.game != Legacy_Settings.Game.Dinosaur + && Legacy_Settings.s.game != Legacy_Settings.Game.LargoWinch) { + s.off_cine_mapname = LegacyPointer.Read(reader); + s.off_cine_name = LegacyPointer.Read(reader); } - if (Settings.s.engineVersion <= Settings.EngineVersion.Montreal) { + if (Legacy_Settings.s.engineVersion <= Legacy_Settings.EngineVersion.Montreal) { reader.ReadUInt32(); reader.ReadUInt32(); reader.ReadByte(); @@ -116,18 +116,18 @@ public static State Read(Reader reader, Pointer offset, Family family, int index s.speed = reader.ReadByte(); reader.ReadByte(); s.customStateBits = reader.ReadByte(); - if (Settings.s.game == Settings.Game.LargoWinch) reader.ReadByte(); + if (Legacy_Settings.s.game == Legacy_Settings.Game.LargoWinch) reader.ReadByte(); } if (s.off_mechanicsIDCard != null) { s.mechanicsIDCard = MechanicsIDCard.FromOffsetOrRead(s.off_mechanicsIDCard, reader); } - Pointer.DoAt(ref reader, s.off_cine_mapname, () => { + LegacyPointer.DoAt(ref reader, s.off_cine_mapname, () => { s.cine_mapname = reader.ReadNullDelimitedString(); }); - Pointer.DoAt(ref reader, s.off_cine_name, () => { + LegacyPointer.DoAt(ref reader, s.off_cine_name, () => { s.cine_name = reader.ReadNullDelimitedString(); }); - if (Settings.s.engineVersion == Settings.EngineVersion.Montreal || Settings.s.game == Settings.Game.TTSE) { + if (Legacy_Settings.s.engineVersion == Legacy_Settings.EngineVersion.Montreal || Legacy_Settings.s.game == Legacy_Settings.Game.TTSE) { s.anim_refMontreal = l.FromOffsetOrRead(reader, s.off_anim_ref); } else { s.anim_ref = l.FromOffsetOrRead(reader, s.off_anim_ref); @@ -135,41 +135,41 @@ public static State Read(Reader reader, Pointer offset, Family family, int index return s; } - public static State FromOffset(Family f, Pointer offset) { + public static State FromOffset(Family f, LegacyPointer offset) { if (f == null || offset == null) return null; return f.states.FirstOrDefault(s => (s != null && s.offset == offset)); } - public static State FromOffset(Pointer offset) { + public static State FromOffset(LegacyPointer offset) { if (offset == null) return null; MapLoader l = MapLoader.Loader; return l.states.FirstOrDefault(s => s.offset == offset); } public class Transition : OpenSpaceStruct, ILinkedListEntry { - public Pointer off_entry_next; - public Pointer off_entry_prev; - public Pointer off_entry_hdr; + public LegacyPointer off_entry_next; + public LegacyPointer off_entry_prev; + public LegacyPointer off_entry_hdr; - public Pointer off_targetState; - public Pointer off_stateToGo; + public LegacyPointer off_targetState; + public LegacyPointer off_stateToGo; public byte linkingType; // Custom - public Pointer NextEntry => (Settings.s.linkedListType != LinkedList.Type.Minimize) ? (off_entry_next) : (Offset + Size); - public Pointer PreviousEntry => off_entry_prev; + public LegacyPointer NextEntry => (Legacy_Settings.s.linkedListType != LinkedList.Type.Minimize) ? (off_entry_next) : (Offset + Size); + public LegacyPointer PreviousEntry => off_entry_prev; protected override void ReadInternal(Reader reader) { - if (Settings.s.linkedListType != LinkedList.Type.Minimize) { - off_entry_next = Pointer.Read(reader); - if (Settings.s.hasLinkedListHeaderPointers) { - off_entry_prev = Pointer.Read(reader); - off_entry_hdr = Pointer.Read(reader); + if (Legacy_Settings.s.linkedListType != LinkedList.Type.Minimize) { + off_entry_next = LegacyPointer.Read(reader); + if (Legacy_Settings.s.hasLinkedListHeaderPointers) { + off_entry_prev = LegacyPointer.Read(reader); + off_entry_hdr = LegacyPointer.Read(reader); } } //MapLoader.Loader.print("Transition " + Offset); - off_targetState = Pointer.Read(reader); - off_stateToGo = Pointer.Read(reader); + off_targetState = LegacyPointer.Read(reader); + off_stateToGo = LegacyPointer.Read(reader); linkingType = reader.ReadByte(); reader.ReadByte(); reader.ReadByte(); @@ -178,26 +178,26 @@ protected override void ReadInternal(Reader reader) { } public class Prohibit : OpenSpaceStruct, ILinkedListEntry { - public Pointer off_entry_next; - public Pointer off_entry_prev; - public Pointer off_entry_hdr; + public LegacyPointer off_entry_next; + public LegacyPointer off_entry_prev; + public LegacyPointer off_entry_hdr; - public Pointer off_state; + public LegacyPointer off_state; //Custom - public Pointer NextEntry => (Settings.s.linkedListType != LinkedList.Type.Minimize) ? (off_entry_next) : (Offset + Size); - public Pointer PreviousEntry => off_entry_prev; + public LegacyPointer NextEntry => (Legacy_Settings.s.linkedListType != LinkedList.Type.Minimize) ? (off_entry_next) : (Offset + Size); + public LegacyPointer PreviousEntry => off_entry_prev; protected override void ReadInternal(Reader reader) { - if (Settings.s.linkedListType != LinkedList.Type.Minimize) { - off_entry_next = Pointer.Read(reader); - if (Settings.s.hasLinkedListHeaderPointers) { - off_entry_prev = Pointer.Read(reader); - off_entry_hdr = Pointer.Read(reader); + if (Legacy_Settings.s.linkedListType != LinkedList.Type.Minimize) { + off_entry_next = LegacyPointer.Read(reader); + if (Legacy_Settings.s.hasLinkedListHeaderPointers) { + off_entry_prev = LegacyPointer.Read(reader); + off_entry_hdr = LegacyPointer.Read(reader); } } //MapLoader.Loader.print("Prohibit " + Offset); - off_state = Pointer.Read(reader); + off_state = LegacyPointer.Read(reader); } } } diff --git a/Assets/Scripts/OpenSpace/Object/Sector.cs b/Assets/Scripts/OpenSpace/Object/Sector.cs index 325ae0ed..d9f027eb 100644 --- a/Assets/Scripts/OpenSpace/Object/Sector.cs +++ b/Assets/Scripts/OpenSpace/Object/Sector.cs @@ -9,7 +9,7 @@ namespace OpenSpace.Object { public class Sector : IEngineObject, IReferenceable { - public Pointer offset; + public LegacyPointer offset; public string name = "Sector"; public LinkedList persos; @@ -21,7 +21,7 @@ public class Sector : IEngineObject, IReferenceable { public byte isSectorVirtual; public byte sectorPriority; - public Pointer off_skyMaterial; + public LegacyPointer off_skyMaterial; public VisualMaterial skyMaterial; public BoundingVolume sectorBorder; @@ -51,7 +51,7 @@ public SuperObject SuperObject { public ReferenceFields References { get; set; } = new ReferenceFields(); - public Sector(Pointer offset, SuperObject so) { + public Sector(LegacyPointer offset, SuperObject so) { this.offset = offset; this.superObject = so; } @@ -62,20 +62,20 @@ public void ProcessPointers(Reader reader) { graphicSectors.ReadEntries(ref reader, (off_element) => { //l.print(off_element); NeighborSector n = new NeighborSector(); - if (Settings.s.game != Settings.Game.LargoWinch) { + if (Legacy_Settings.s.game != Legacy_Settings.Game.LargoWinch) { n.short0 = reader.ReadUInt16(); n.short2 = reader.ReadUInt16(); } - Pointer sp = Pointer.Read(reader); + LegacyPointer sp = LegacyPointer.Read(reader); n.sector = Sector.FromSuperObjectOffset(sp); //l.print(name + " -> " + n.sector.name + ": " + n.short0 + " - " + n.short2); - if (Settings.s.linkedListType == LinkedList.Type.Minimize) { + if (Legacy_Settings.s.linkedListType == LinkedList.Type.Minimize) { n.off_next = off_element + 8; // No next pointer, each entry is immediately after the first one. } else { - n.off_next = Pointer.Read(reader); - if (Settings.s.hasLinkedListHeaderPointers) { - n.off_previous = Pointer.Read(reader); - Pointer off_sector_start = Pointer.Read(reader); + n.off_next = LegacyPointer.Read(reader); + if (Legacy_Settings.s.hasLinkedListHeaderPointers) { + n.off_previous = LegacyPointer.Read(reader); + LegacyPointer off_sector_start = LegacyPointer.Read(reader); } } return n; @@ -85,20 +85,20 @@ public void ProcessPointers(Reader reader) { //l.print(sectors_unk1.off_head + " - " + sectors_unk1.off_tail + " - " + sectors_unk1.Count); collisionSectors.ReadEntries(ref reader, (off_element) => { NeighborSector n = new NeighborSector(); - if (Settings.s.engineVersion == Settings.EngineVersion.Montreal) { + if (Legacy_Settings.s.engineVersion == Legacy_Settings.EngineVersion.Montreal) { n.short0 = reader.ReadUInt16(); n.short2 = reader.ReadUInt16(); } - Pointer sp = Pointer.Read(reader); + LegacyPointer sp = LegacyPointer.Read(reader); n.sector = Sector.FromSuperObjectOffset(sp); //l.print(name + " -> " + n.sector.name + ": " + n.short0 + " - " + n.short2); - if (Settings.s.linkedListType == LinkedList.Type.Minimize) { + if (Legacy_Settings.s.linkedListType == LinkedList.Type.Minimize) { n.off_next = off_element + 4; // No next pointer, each entry is immediately after the first one. } else { - n.off_next = Pointer.Read(reader); - if (Settings.s.hasLinkedListHeaderPointers) { - n.off_previous = Pointer.Read(reader); - Pointer off_sector_start = Pointer.Read(reader); + n.off_next = LegacyPointer.Read(reader); + if (Legacy_Settings.s.hasLinkedListHeaderPointers) { + n.off_previous = LegacyPointer.Read(reader); + LegacyPointer off_sector_start = LegacyPointer.Read(reader); } } return n; @@ -112,7 +112,7 @@ public void ProcessPointers(Reader reader) { }, flags: LinkedList.Flags.ElementPointerFirst | LinkedList.Flags.ReadAtPointer - | ((Settings.s.hasLinkedListHeaderPointers) ? + | ((Legacy_Settings.s.hasLinkedListHeaderPointers) ? LinkedList.Flags.HasHeaderPointers : LinkedList.Flags.NoPreviousPointersForDouble)); } @@ -123,28 +123,28 @@ public void ProcessPointers(Reader reader) { } } - public static Sector Read(Reader reader, Pointer offset, SuperObject so) { + public static Sector Read(Reader reader, LegacyPointer offset, SuperObject so) { MapLoader l = MapLoader.Loader; Sector s = new Sector(offset, so); s.name = "Sector @ " + offset + ", SPO @ "+so.offset; //l.print(s.name); - if (Settings.s.engineVersion <= Settings.EngineVersion.Montreal) { - if (Settings.s.game == Settings.Game.TTSE) { + if (Legacy_Settings.s.engineVersion <= Legacy_Settings.EngineVersion.Montreal) { + if (Legacy_Settings.s.game == Legacy_Settings.Game.TTSE) { s.isSectorVirtual = reader.ReadByte(); reader.ReadByte(); reader.ReadByte(); reader.ReadByte(); } - Pointer off_collideObj = Pointer.Read(reader); - Pointer.DoAt(ref reader, off_collideObj, () => { + LegacyPointer off_collideObj = LegacyPointer.Read(reader); + LegacyPointer.DoAt(ref reader, off_collideObj, () => { s.collider = GeometricObjectCollide.Read(reader, off_collideObj, isBoundingVolume: true); // This has the exact same structure as a CollideMeshObject but with a sector superobject as material for the collieMeshElements }); - LinkedList.ReadHeader(reader, Pointer.Current(reader), type: LinkedList.Type.Double); // "environments list" - LinkedList.ReadHeader(reader, Pointer.Current(reader), type: LinkedList.Type.Double); // "surface list" + LinkedList.ReadHeader(reader, LegacyPointer.Current(reader), type: LinkedList.Type.Double); // "environments list" + LinkedList.ReadHeader(reader, LegacyPointer.Current(reader), type: LinkedList.Type.Double); // "surface list" } - s.persos = LinkedList.ReadHeader(reader, Pointer.Current(reader), type: LinkedList.Type.Double); - s.staticLights = LinkedList.Read(ref reader, Pointer.Current(reader), + s.persos = LinkedList.ReadHeader(reader, LegacyPointer.Current(reader), type: LinkedList.Type.Double); + s.staticLights = LinkedList.Read(ref reader, LegacyPointer.Current(reader), (off_element) => { LightInfo li = l.FromOffsetOrRead(reader, off_element); if (li != null) li.containingSectors.Add(s); @@ -152,26 +152,26 @@ public static Sector Read(Reader reader, Pointer offset, SuperObject so) { }, flags: LinkedList.Flags.ElementPointerFirst | LinkedList.Flags.ReadAtPointer - | ((Settings.s.hasLinkedListHeaderPointers) ? + | ((Legacy_Settings.s.hasLinkedListHeaderPointers) ? LinkedList.Flags.HasHeaderPointers : LinkedList.Flags.NoPreviousPointersForDouble), type: LinkedList.Type.Minimize ); - s.dynamicLights = LinkedList.ReadHeader(reader, Pointer.Current(reader), type: LinkedList.Type.Double); - if (Settings.s.engineVersion <= Settings.EngineVersion.Montreal) { - LinkedList.ReadHeader(reader, Pointer.Current(reader)); // "streams list", probably related to water + s.dynamicLights = LinkedList.ReadHeader(reader, LegacyPointer.Current(reader), type: LinkedList.Type.Double); + if (Legacy_Settings.s.engineVersion <= Legacy_Settings.EngineVersion.Montreal) { + LinkedList.ReadHeader(reader, LegacyPointer.Current(reader)); // "streams list", probably related to water } - s.graphicSectors = LinkedList.ReadHeader(reader, Pointer.Current(reader), type: LinkedList.Type.Minimize); - s.collisionSectors = LinkedList.ReadHeader(reader, Pointer.Current(reader), type: LinkedList.Type.Minimize); - s.activitySectors = LinkedList.ReadHeader(reader, Pointer.Current(reader), type: LinkedList.Type.Minimize); + s.graphicSectors = LinkedList.ReadHeader(reader, LegacyPointer.Current(reader), type: LinkedList.Type.Minimize); + s.collisionSectors = LinkedList.ReadHeader(reader, LegacyPointer.Current(reader), type: LinkedList.Type.Minimize); + s.activitySectors = LinkedList.ReadHeader(reader, LegacyPointer.Current(reader), type: LinkedList.Type.Minimize); - LinkedList.ReadHeader(reader, Pointer.Current(reader)); // TT says: Sound Sectors - LinkedList.ReadHeader(reader, Pointer.Current(reader)); // Placeholder + LinkedList.ReadHeader(reader, LegacyPointer.Current(reader)); // TT says: Sound Sectors + LinkedList.ReadHeader(reader, LegacyPointer.Current(reader)); // Placeholder - if (Settings.s.engineVersion > Settings.EngineVersion.Montreal) { - s.sectorBorder = BoundingVolume.Read(reader, Pointer.Current(reader), BoundingVolume.Type.Box); + if (Legacy_Settings.s.engineVersion > Legacy_Settings.EngineVersion.Montreal) { + s.sectorBorder = BoundingVolume.Read(reader, LegacyPointer.Current(reader), BoundingVolume.Type.Box); reader.ReadUInt32(); - if (Settings.s.game == Settings.Game.R2Revolution || Settings.s.game == Settings.Game.LargoWinch) { + if (Legacy_Settings.s.game == Legacy_Settings.Game.R2Revolution || Legacy_Settings.s.game == Legacy_Settings.Game.LargoWinch) { s.isSectorVirtual = reader.ReadByte(); reader.ReadByte(); s.sectorPriority = reader.ReadByte(); @@ -181,35 +181,35 @@ public static Sector Read(Reader reader, Pointer offset, SuperObject so) { reader.ReadByte(); reader.ReadByte(); s.sectorPriority = reader.ReadByte(); - if (Settings.s.engineVersion <= Settings.EngineVersion.R2) { - s.off_skyMaterial = Pointer.Read(reader); + if (Legacy_Settings.s.engineVersion <= Legacy_Settings.EngineVersion.R2) { + s.off_skyMaterial = LegacyPointer.Read(reader); s.skyMaterial = VisualMaterial.FromOffsetOrRead(s.off_skyMaterial, reader); } else { reader.ReadUInt32(); } reader.ReadByte(); - if (Settings.s.hasNames) { + if (Legacy_Settings.s.hasNames) { s.name = reader.ReadString(0x104); l.print(s.name); } } } else { - if (Settings.s.engineVersion == Settings.EngineVersion.Montreal) { + if (Legacy_Settings.s.engineVersion == Legacy_Settings.EngineVersion.Montreal) { reader.ReadUInt32(); reader.ReadUInt32(); reader.ReadUInt32(); } - if (Settings.s.game != Settings.Game.TTSE) { + if (Legacy_Settings.s.game != Legacy_Settings.Game.TTSE) { s.isSectorVirtual = reader.ReadByte(); reader.ReadByte(); reader.ReadByte(); reader.ReadByte(); } - if (Settings.s.engineVersion == Settings.EngineVersion.Montreal) { + if (Legacy_Settings.s.engineVersion == Legacy_Settings.EngineVersion.Montreal) { reader.ReadUInt32(); // activation flag } - Pointer off_name = Pointer.Read(reader); - Pointer.DoAt(ref reader, off_name, () => { + LegacyPointer off_name = LegacyPointer.Read(reader); + LegacyPointer.DoAt(ref reader, off_name, () => { s.name = reader.ReadNullDelimitedString() + " @ " + offset; }); } @@ -231,13 +231,13 @@ public static Sector Read(Reader reader, Pointer offset, SuperObject so) { return s; } - public static Sector FromOffset(Pointer offset) { + public static Sector FromOffset(LegacyPointer offset) { if (offset == null) return null; MapLoader l = MapLoader.Loader; return l.sectors.FirstOrDefault(s => s.offset == offset); } - public static Sector FromSuperObjectOffset(Pointer offset) { + public static Sector FromSuperObjectOffset(LegacyPointer offset) { if (offset == null) return null; MapLoader l = MapLoader.Loader; return l.sectors.FirstOrDefault(s => s.SuperObject.offset == offset); @@ -248,11 +248,11 @@ public struct NeighborSector : ILinkedListEntry { public ushort short2; public Sector sector; - public Pointer off_next; - public Pointer off_previous; + public LegacyPointer off_next; + public LegacyPointer off_previous; - public Pointer NextEntry { get { return off_next; } } - public Pointer PreviousEntry { get { return off_previous; } } + public LegacyPointer NextEntry { get { return off_next; } } + public LegacyPointer PreviousEntry { get { return off_previous; } } } } } diff --git a/Assets/Scripts/OpenSpace/Object/SuperObject.cs b/Assets/Scripts/OpenSpace/Object/SuperObject.cs index 5dba274d..b87c98cb 100644 --- a/Assets/Scripts/OpenSpace/Object/SuperObject.cs +++ b/Assets/Scripts/OpenSpace/Object/SuperObject.cs @@ -23,18 +23,18 @@ public enum Type { GeometricShadowObject, // Instantiated Geometric Object } - public Pointer offset; + public LegacyPointer offset; public uint typeCode; public Type type; - public Pointer off_data; + public LegacyPointer off_data; public LinkedList children; - public Pointer off_brother_next; - public Pointer off_brother_prev; - public Pointer off_parent; + public LegacyPointer off_brother_next; + public LegacyPointer off_brother_prev; + public LegacyPointer off_parent; [JsonIgnore] public SuperObject parent; - public Pointer off_matrix; - public Pointer off_staticMatrix; + public LegacyPointer off_matrix; + public LegacyPointer off_staticMatrix; public int globalMatrix; public Matrix matrix; public Matrix staticMatrix; @@ -129,13 +129,13 @@ public async UniTask InitGameObject() { } } - public Pointer NextEntry { + public LegacyPointer NextEntry { get { return off_brother_next; } } - public Pointer PreviousEntry { + public LegacyPointer PreviousEntry { get { return off_brother_prev; } @@ -153,11 +153,11 @@ public SuperObject ParentSector } } - public SuperObject(Pointer offset) { + public SuperObject(LegacyPointer offset) { this.offset = offset; } - public static SuperObject Read(Reader reader, Pointer off_so, SuperObject parent = null) { + public static SuperObject Read(Reader reader, LegacyPointer off_so, SuperObject parent = null) { MapLoader l = MapLoader.Loader; if (IsParsed(off_so)) return null; bool isValidNode = true; @@ -167,21 +167,21 @@ public static SuperObject Read(Reader reader, Pointer off_so, SuperObject parent so.parent = parent; } so.typeCode = reader.ReadUInt32(); // 0 - 4 - so.off_data = Pointer.Read(reader); // 4 - 8 - so.children = LinkedList.ReadHeader(reader, Pointer.Current(reader), LinkedList.Type.Double); // 8 - 14 - so.off_brother_next = Pointer.Read(reader); // 14 - 18 - so.off_brother_prev = Pointer.Read(reader); // 18 - 1C - so.off_parent = Pointer.Read(reader); // 1C - 20 - so.off_matrix = Pointer.Read(reader); // 0x20->0x24 - so.off_staticMatrix = Pointer.Read(reader); // other matrix + so.off_data = LegacyPointer.Read(reader); // 4 - 8 + so.children = LinkedList.ReadHeader(reader, LegacyPointer.Current(reader), LinkedList.Type.Double); // 8 - 14 + so.off_brother_next = LegacyPointer.Read(reader); // 14 - 18 + so.off_brother_prev = LegacyPointer.Read(reader); // 18 - 1C + so.off_parent = LegacyPointer.Read(reader); // 1C - 20 + so.off_matrix = LegacyPointer.Read(reader); // 0x20->0x24 + so.off_staticMatrix = LegacyPointer.Read(reader); // other matrix so.globalMatrix = reader.ReadInt32(); // 0x28 -> 0x2C so.drawFlags = SuperObjectDrawFlags.Read(reader); so.flags = SuperObjectFlags.Read(reader); // 0x30->0x34 - if (Settings.s.engineVersion == Settings.EngineVersion.R3) reader.ReadUInt32(); // Visual Bounding Volume? - Pointer off_boundingVolume = Pointer.Read(reader); + if (Legacy_Settings.s.engineVersion == Legacy_Settings.EngineVersion.R3) reader.ReadUInt32(); // Visual Bounding Volume? + LegacyPointer off_boundingVolume = LegacyPointer.Read(reader); //l.print("SuperObject T" + so.typeCode + ": " + off_so + " - " + so.off_matrix); - Pointer.DoAt(ref reader, so.off_matrix, () => { + LegacyPointer.DoAt(ref reader, so.off_matrix, () => { so.matrix = Matrix.Read(reader, so.off_matrix); }); /*Pointer.DoAt(ref reader, so.off_matrix2, () => { @@ -195,25 +195,25 @@ public static SuperObject Read(Reader reader, Pointer off_so, SuperObject parent so.type = GetSOType(so.typeCode); switch (so.type) { case Type.IPO: - Pointer.DoAt(ref reader, so.off_data, () => { + LegacyPointer.DoAt(ref reader, so.off_data, () => { so.data = IPO.Read(reader, so.off_data, so); }); break; case Type.IPO_2: - Pointer.DoAt(ref reader, so.off_data, () => { + LegacyPointer.DoAt(ref reader, so.off_data, () => { l.print("IPO with code 0x40 at offset " + so.off_data); so.data = IPO.Read(reader, so.off_data, so); }); break; case Type.PhysicalObject: - if (!Settings.s.loadFromMemory) { - Pointer.DoAt(ref reader, so.off_data, () => { + if (!Legacy_Settings.s.loadFromMemory) { + LegacyPointer.DoAt(ref reader, so.off_data, () => { so.data = PhysicalObject.Read(reader, so.off_data, so); }); } break; case Type.Perso: - Pointer.DoAt(ref reader, so.off_data, () => { + LegacyPointer.DoAt(ref reader, so.off_data, () => { so.data = Perso.Read(reader, so.off_data, so); }); break; @@ -222,17 +222,17 @@ public static SuperObject Read(Reader reader, Pointer off_so, SuperObject parent //print("parsing world superobject with " + num_children + " children"); break; case Type.Sector: - Pointer.DoAt(ref reader, so.off_data, () => { + LegacyPointer.DoAt(ref reader, so.off_data, () => { so.data = Sector.Read(reader, so.off_data, so); }); break; case Type.GeometricObject: - Pointer.DoAt(ref reader, so.off_data, () => { + LegacyPointer.DoAt(ref reader, so.off_data, () => { so.data = Visual.GeometricObject.Read(reader, so.off_data); }); break; case Type.GeometricShadowObject: - Pointer.DoAt(ref reader, so.off_data, () => { + LegacyPointer.DoAt(ref reader, so.off_data, () => { so.data = Visual.GeometricShadowObject.Read(reader, so.off_data, so); }); break; @@ -242,9 +242,9 @@ public static SuperObject Read(Reader reader, Pointer off_so, SuperObject parent break; } - Pointer.DoAt(ref reader, off_boundingVolume, () => { + LegacyPointer.DoAt(ref reader, off_boundingVolume, () => { //l.print(so.type + " - " + so.offset + " - " + off_boundingVolume); - if (Settings.s.engineVersion <= Settings.EngineVersion.Montreal) { + if (Legacy_Settings.s.engineVersion <= Legacy_Settings.EngineVersion.Montreal) { so.boundingVolumeTT = GeometricObjectCollide.Read(reader, off_boundingVolume, isBoundingVolume: true); } else { so.boundingVolume = BoundingVolume.Read(reader, off_boundingVolume, so.flags.HasFlag(SuperObjectFlags.Flags.BoundingBoxInsteadOfSphere) ? @@ -262,17 +262,17 @@ public static SuperObject Read(Reader reader, Pointer off_so, SuperObject parent return so; } - public static SuperObject FromOffset(Pointer offset) { + public static SuperObject FromOffset(LegacyPointer offset) { if (offset == null) return null; MapLoader l = MapLoader.Loader; return l.superObjects.FirstOrDefault(so => so.offset == offset); } - public static SuperObject FromOffsetOrRead(Pointer offset, Reader reader, SuperObject parent = null) { + public static SuperObject FromOffsetOrRead(LegacyPointer offset, Reader reader, SuperObject parent = null) { if (offset == null) return null; SuperObject so = FromOffset(offset); if (so == null) { - Pointer.DoAt(ref reader, offset, () => { + LegacyPointer.DoAt(ref reader, offset, () => { so = SuperObject.Read(reader, offset, parent: parent); }); } else { @@ -281,13 +281,13 @@ public static SuperObject FromOffsetOrRead(Pointer offset, Reader reader, SuperO return so; } - public static bool IsParsed(Pointer offset) { + public static bool IsParsed(LegacyPointer offset) { return FromOffset(offset) != null; } public static Type GetSOType(uint typeCode) { Type type = Type.Unknown; - if (Settings.s.engineVersion > Settings.EngineVersion.Montreal) { + if (Legacy_Settings.s.engineVersion > Legacy_Settings.EngineVersion.Montreal) { switch (typeCode) { case 0x1: type = Type.World; break; case 0x2: type = Type.Perso; break; diff --git a/Assets/Scripts/OpenSpace/PS1/ALW/AlwaysItem.cs b/Assets/Scripts/OpenSpace/PS1/ALW/AlwaysItem.cs index f7ce4c6a..d6a8c206 100644 --- a/Assets/Scripts/OpenSpace/PS1/ALW/AlwaysItem.cs +++ b/Assets/Scripts/OpenSpace/PS1/ALW/AlwaysItem.cs @@ -8,7 +8,7 @@ namespace OpenSpace.PS1 { public class AlwaysItem : OpenSpaceStruct { - public Pointer off_superObject; + public LegacyPointer off_superObject; public uint uint_04; //public Pointer off_04; @@ -22,7 +22,7 @@ public class AlwaysItem : OpenSpaceStruct { public SuperObject superObject; protected override void ReadInternal(Reader reader) { - off_superObject = Pointer.Read(reader); + off_superObject = LegacyPointer.Read(reader); uint_04 = reader.ReadUInt32(); uint_08 = reader.ReadUInt32(); uint_0C = reader.ReadUInt32(); diff --git a/Assets/Scripts/OpenSpace/PS1/ALW/AlwaysList.cs b/Assets/Scripts/OpenSpace/PS1/ALW/AlwaysList.cs index 64c61dc7..9301b13d 100644 --- a/Assets/Scripts/OpenSpace/PS1/ALW/AlwaysList.cs +++ b/Assets/Scripts/OpenSpace/PS1/ALW/AlwaysList.cs @@ -10,7 +10,7 @@ namespace OpenSpace.PS1 { public class AlwaysList : OpenSpaceStruct { public uint index; public uint length; - public Pointer off_items; + public LegacyPointer off_items; public uint invalidPointer; // pointer in exe? public AlwaysItem[] items; @@ -18,7 +18,7 @@ public class AlwaysList : OpenSpaceStruct { protected override void ReadInternal(Reader reader) { index = reader.ReadUInt32(); length = reader.ReadUInt32(); - off_items = Pointer.Read(reader); + off_items = LegacyPointer.Read(reader); invalidPointer = reader.ReadUInt32(); items = Load.ReadArray(length, reader, off_items); diff --git a/Assets/Scripts/OpenSpace/PS1/ANIM/PS1Animation.cs b/Assets/Scripts/OpenSpace/PS1/ANIM/PS1Animation.cs index ad576bc3..e24ed923 100644 --- a/Assets/Scripts/OpenSpace/PS1/ANIM/PS1Animation.cs +++ b/Assets/Scripts/OpenSpace/PS1/ANIM/PS1Animation.cs @@ -8,12 +8,12 @@ namespace OpenSpace.PS1 { public class PS1Animation : OpenSpaceStruct { // Animation/state related public uint speed; - public Pointer off_channels; + public LegacyPointer off_channels; public uint num_channels; public ushort num_frames; public ushort ushort_0E; public uint num_hierarchies; - public Pointer off_hierarchies; + public LegacyPointer off_hierarchies; public uint uint_18; // Non R2 @@ -21,7 +21,7 @@ public class PS1Animation : OpenSpaceStruct { // Animation/state related public ushort file_index; public ushort ushort_18; public ushort ushort_1A; - public Pointer off_bones; + public LegacyPointer off_bones; public ushort num_bones; // Parsed @@ -32,18 +32,18 @@ public class PS1Animation : OpenSpaceStruct { // Animation/state related protected override void ReadInternal(Reader reader) { //Load.print("Anim " + Pointer.Current(reader)); - if (Settings.s.game == Settings.Game.R2) { + if (Legacy_Settings.s.game == Legacy_Settings.Game.R2) { speed = reader.ReadUInt32(); - off_channels = Pointer.Read(reader); + off_channels = LegacyPointer.Read(reader); num_channels = reader.ReadUInt32(); num_frames = reader.ReadUInt16(); ushort_0E = reader.ReadUInt16(); num_hierarchies = reader.ReadUInt32(); - off_hierarchies = Pointer.Read(reader); + off_hierarchies = LegacyPointer.Read(reader); uint_18 = reader.ReadUInt32(); - } else if(Settings.s.game == Settings.Game.RRush) { - off_channels = Pointer.Read(reader); - off_hierarchies = Pointer.Read(reader); + } else if(Legacy_Settings.s.game == Legacy_Settings.Game.RRush) { + off_channels = LegacyPointer.Read(reader); + off_hierarchies = LegacyPointer.Read(reader); num_hierarchies = reader.ReadUInt16(); file_index = reader.ReadUInt16(); speed = reader.ReadByte(); @@ -51,17 +51,17 @@ protected override void ReadInternal(Reader reader) { num_frames = reader.ReadUInt16(); } else { flags = reader.ReadUInt32(); - off_channels = Pointer.Read(reader); + off_channels = LegacyPointer.Read(reader); num_channels = reader.ReadUInt32(); num_frames = reader.ReadUInt16(); //Load.print("Anim " + Offset + " - " + num_frames); ushort_0E = reader.ReadUInt16(); num_hierarchies = reader.ReadUInt32(); - if (Settings.s.game == Settings.Game.VIP || Settings.s.game == Settings.Game.JungleBook) { - off_hierarchies = Pointer.Read(reader); + if (Legacy_Settings.s.game == Legacy_Settings.Game.VIP || Legacy_Settings.s.game == Legacy_Settings.Game.JungleBook) { + off_hierarchies = LegacyPointer.Read(reader); ushort_18 = reader.ReadUInt16(); num_bones = reader.ReadUInt16(); - off_bones = Pointer.Read(reader); + off_bones = LegacyPointer.Read(reader); /*Load.print("Animation: " + Offset + " - " + num_channels + " - " + num_bones @@ -71,7 +71,7 @@ protected override void ReadInternal(Reader reader) { } else { speed = reader.ReadUInt16(); ushort_1A = reader.ReadUInt16(); - off_hierarchies = Pointer.Read(reader); + off_hierarchies = LegacyPointer.Read(reader); uint_18 = reader.ReadUInt32(); uint_18 = reader.ReadUInt32(); uint_18 = reader.ReadUInt32(); @@ -82,7 +82,7 @@ protected override void ReadInternal(Reader reader) { hierarchies = Load.ReadArray(num_hierarchies, reader, off_hierarchies); //Load.print(channels.Max(c => c.frames.Length == 0 ? 0 : c.frames.Max(f => f.ntto >= 1 ? f.frameNumber.GetValueOrDefault(0) : 0)) + " - " + num_frames + " - " + num_channels); if (off_hierarchies != null) { - Pointer.DoAt(ref reader, off_hierarchies - (Settings.s.game == Settings.Game.DD ? 0x14 : 0x10), () => { + LegacyPointer.DoAt(ref reader, off_hierarchies - (Legacy_Settings.s.game == Legacy_Settings.Game.DD ? 0x14 : 0x10), () => { name = reader.ReadString(0x10); //Load.print(Offset + " - " + name); }); diff --git a/Assets/Scripts/OpenSpace/PS1/ANIM/PS1AnimationBoneChannelLinks.cs b/Assets/Scripts/OpenSpace/PS1/ANIM/PS1AnimationBoneChannelLinks.cs index 38eb5801..e22fce63 100644 --- a/Assets/Scripts/OpenSpace/PS1/ANIM/PS1AnimationBoneChannelLinks.cs +++ b/Assets/Scripts/OpenSpace/PS1/ANIM/PS1AnimationBoneChannelLinks.cs @@ -8,7 +8,7 @@ namespace OpenSpace.PS1 { public class PS1AnimationBoneChannelLinks : OpenSpaceStruct { public ushort ind_ntto_channel; public ushort num_indices; - public Pointer off_indices; // channels + public LegacyPointer off_indices; // channels // Parsed public ushort[] indices; @@ -16,9 +16,9 @@ public class PS1AnimationBoneChannelLinks : OpenSpaceStruct { protected override void ReadInternal(Reader reader) { ind_ntto_channel = reader.ReadUInt16(); num_indices = reader.ReadUInt16(); - off_indices = Pointer.Read(reader); + off_indices = LegacyPointer.Read(reader); - Pointer.DoAt(ref reader, off_indices, () => { + LegacyPointer.DoAt(ref reader, off_indices, () => { //Load.print("Bone: " + ind_ntto_channel + " - " + off_indices + " - " + num_indices); indices = new ushort[num_indices]; for (int i = 0; i < num_indices; i++) { diff --git a/Assets/Scripts/OpenSpace/PS1/ANIM/PS1AnimationChannel.cs b/Assets/Scripts/OpenSpace/PS1/ANIM/PS1AnimationChannel.cs index 1c64af58..bc3afd3e 100644 --- a/Assets/Scripts/OpenSpace/PS1/ANIM/PS1AnimationChannel.cs +++ b/Assets/Scripts/OpenSpace/PS1/ANIM/PS1AnimationChannel.cs @@ -6,14 +6,14 @@ namespace OpenSpace.PS1 { public class PS1AnimationChannel : OpenSpaceStruct { - public Pointer off_frames; + public LegacyPointer off_frames; public ushort num_frames; public short id; public PS1AnimationKeyframe[] frames; protected override void ReadInternal(Reader reader) { - off_frames = Pointer.Read(reader); + off_frames = LegacyPointer.Read(reader); num_frames = reader.ReadUInt16(); id = reader.ReadInt16(); diff --git a/Assets/Scripts/OpenSpace/PS1/ANIM/PS1Stream.cs b/Assets/Scripts/OpenSpace/PS1/ANIM/PS1Stream.cs index 6c5d9ff4..38be0a7e 100644 --- a/Assets/Scripts/OpenSpace/PS1/ANIM/PS1Stream.cs +++ b/Assets/Scripts/OpenSpace/PS1/ANIM/PS1Stream.cs @@ -14,7 +14,7 @@ protected override void ReadInternal(Reader reader) { uint size = reader.ReadUInt32(); long start_frame_packet = reader.BaseStream.Position; while (reader.BaseStream.Position < start_frame_packet + size - 4) { - PS1StreamFrame f = Load.FromOffsetOrRead(reader, Pointer.Current(reader), inline: true); + PS1StreamFrame f = Load.FromOffsetOrRead(reader, LegacyPointer.Current(reader), inline: true); if (f.num_frame == -1) { num_frames = frames[frames.Count - 1].num_frame; } diff --git a/Assets/Scripts/OpenSpace/PS1/ActorFileHeader.cs b/Assets/Scripts/OpenSpace/PS1/ActorFileHeader.cs index 395060e4..652fb8fd 100644 --- a/Assets/Scripts/OpenSpace/PS1/ActorFileHeader.cs +++ b/Assets/Scripts/OpenSpace/PS1/ActorFileHeader.cs @@ -9,20 +9,20 @@ namespace OpenSpace.PS1 { public class ActorFileHeader : OpenSpaceStruct { - public Pointer off_superObject; + public LegacyPointer off_superObject; public byte[] copiedActorData; - public Pointer off_states; + public LegacyPointer off_states; public ushort num_states; public ushort ushort_22; - public Pointer off_animPositions; - public Pointer off_animRotations; - public Pointer off_animScales; - public Pointer off_geometricObjects_dynamic; + public LegacyPointer off_animPositions; + public LegacyPointer off_animRotations; + public LegacyPointer off_animScales; + public LegacyPointer off_geometricObjects_dynamic; public uint num_geometricObjects_dynamic; public ushort ushort_38; public ushort ushort_3A; - public Pointer off_state_indices; + public LegacyPointer off_state_indices; // Parsed @@ -35,24 +35,24 @@ public class ActorFileHeader : OpenSpaceStruct { protected override void ReadInternal(Reader reader) { R2PS1Loader l = Load as R2PS1Loader; - if (Settings.s.game == Settings.Game.RRush) { - off_superObject = Pointer.Read(reader); - } else if (Settings.s.game == Settings.Game.JungleBook) { + if (Legacy_Settings.s.game == Legacy_Settings.Game.RRush) { + off_superObject = LegacyPointer.Read(reader); + } else if (Legacy_Settings.s.game == Legacy_Settings.Game.JungleBook) { reader.ReadBytes(0x98); } copiedActorData = reader.ReadBytes(0x18); - off_states = Pointer.Read(reader); + off_states = LegacyPointer.Read(reader); num_states = reader.ReadUInt16(); ushort_22 = reader.ReadUInt16(); - off_animPositions = Pointer.Read(reader); // 0x6 size - off_animRotations = Pointer.Read(reader); // big array of structs of 0x8 size. 4 ushorts per struct - off_animScales = Pointer.Read(reader); - off_geometricObjects_dynamic = Pointer.Read(reader); + off_animPositions = LegacyPointer.Read(reader); // 0x6 size + off_animRotations = LegacyPointer.Read(reader); // big array of structs of 0x8 size. 4 ushorts per struct + off_animScales = LegacyPointer.Read(reader); + off_geometricObjects_dynamic = LegacyPointer.Read(reader); num_geometricObjects_dynamic = reader.ReadUInt32(); - if (Settings.s.game == Settings.Game.RRush) { + if (Legacy_Settings.s.game == Legacy_Settings.Game.RRush) { ushort_38 = reader.ReadUInt16(); ushort_3A = reader.ReadUInt16(); - off_state_indices = Pointer.Read(reader); + off_state_indices = LegacyPointer.Read(reader); } // Parse states = Load.FromOffsetOrRead>(reader, off_states, s => s.length = num_states); diff --git a/Assets/Scripts/OpenSpace/PS1/CAM/CameraGraph.cs b/Assets/Scripts/OpenSpace/PS1/CAM/CameraGraph.cs index 79eccc29..4ec7d3cf 100644 --- a/Assets/Scripts/OpenSpace/PS1/CAM/CameraGraph.cs +++ b/Assets/Scripts/OpenSpace/PS1/CAM/CameraGraph.cs @@ -5,9 +5,9 @@ namespace OpenSpace.PS1 { public class CameraGraph : OpenSpaceStruct { public uint uint_00; - public Pointer off_current; - public Pointer off_last; - public Pointer off_first; + public LegacyPointer off_current; + public LegacyPointer off_last; + public LegacyPointer off_first; public uint flags; // Parsed @@ -18,9 +18,9 @@ public class CameraGraph : OpenSpaceStruct { protected override void ReadInternal(Reader reader) { uint_00 = reader.ReadUInt32(); - off_current = Pointer.Read(reader); - off_last = Pointer.Read(reader); - off_first = Pointer.Read(reader); + off_current = LegacyPointer.Read(reader); + off_last = LegacyPointer.Read(reader); + off_first = LegacyPointer.Read(reader); flags = reader.ReadUInt32(); current = Load.FromOffsetOrRead(reader, off_current); diff --git a/Assets/Scripts/OpenSpace/PS1/CAM/CameraGraphNode.cs b/Assets/Scripts/OpenSpace/PS1/CAM/CameraGraphNode.cs index 095e90ec..e4f6c6ca 100644 --- a/Assets/Scripts/OpenSpace/PS1/CAM/CameraGraphNode.cs +++ b/Assets/Scripts/OpenSpace/PS1/CAM/CameraGraphNode.cs @@ -4,8 +4,8 @@ namespace OpenSpace.PS1 { public class CameraGraphNode : OpenSpaceStruct { - public Pointer off_previous; - public Pointer off_next; + public LegacyPointer off_previous; + public LegacyPointer off_next; public int x; public int y; public int z; @@ -18,8 +18,8 @@ public class CameraGraphNode : OpenSpaceStruct { protected override void ReadInternal(Reader reader) { - off_previous = Pointer.Read(reader); - off_next = Pointer.Read(reader); + off_previous = LegacyPointer.Read(reader); + off_next = LegacyPointer.Read(reader); x = reader.ReadInt32(); y = reader.ReadInt32(); z = reader.ReadInt32(); diff --git a/Assets/Scripts/OpenSpace/PS1/CAM/CameraModifier.cs b/Assets/Scripts/OpenSpace/PS1/CAM/CameraModifier.cs index f55e6bc6..15bfd981 100644 --- a/Assets/Scripts/OpenSpace/PS1/CAM/CameraModifier.cs +++ b/Assets/Scripts/OpenSpace/PS1/CAM/CameraModifier.cs @@ -12,7 +12,7 @@ public class CameraModifier : OpenSpaceStruct { public int int_14; public int int_18; public int int_1C; - public Pointer off_20; // if type == 9: a linkedlist. otherwise: a SO pointer + public LegacyPointer off_20; // if type == 9: a linkedlist. otherwise: a SO pointer public int x2; public int y2; public int z2; @@ -43,7 +43,7 @@ protected override void ReadInternal(Reader reader) { int_14 = reader.ReadInt32(); int_18 = reader.ReadInt32(); int_1C = reader.ReadInt32(); - off_20 = Pointer.Read(reader); + off_20 = LegacyPointer.Read(reader); x2 = reader.ReadInt32(); y2 = reader.ReadInt32(); z2 = reader.ReadInt32(); diff --git a/Assets/Scripts/OpenSpace/PS1/COL/GeometricObjectCollide.cs b/Assets/Scripts/OpenSpace/PS1/COL/GeometricObjectCollide.cs index bfa053ec..6ca6d625 100644 --- a/Assets/Scripts/OpenSpace/PS1/COL/GeometricObjectCollide.cs +++ b/Assets/Scripts/OpenSpace/PS1/COL/GeometricObjectCollide.cs @@ -14,10 +14,10 @@ public class GeometricObjectCollide : OpenSpaceStruct, IGeometricObjectElementCo public ushort num_triangles; public ushort num_quads; public byte[] unknownBytes; - public Pointer off_vertices; - public Pointer off_normals; - public Pointer off_triangles; - public Pointer off_quads; + public LegacyPointer off_vertices; + public LegacyPointer off_normals; + public LegacyPointer off_triangles; + public LegacyPointer off_quads; public uint uint_38; // Parsed @@ -33,10 +33,10 @@ protected override void ReadInternal(Reader reader) { num_triangles = reader.ReadUInt16(); num_quads = reader.ReadUInt16(); unknownBytes = reader.ReadBytes(0x20); - off_vertices = Pointer.Read(reader); - off_normals = Pointer.Read(reader); - off_triangles = Pointer.Read(reader); - off_quads = Pointer.Read(reader); + off_vertices = LegacyPointer.Read(reader); + off_normals = LegacyPointer.Read(reader); + off_triangles = LegacyPointer.Read(reader); + off_quads = LegacyPointer.Read(reader); uint_38 = reader.ReadUInt32(); if (uint_38 != 0) Debug.LogWarning("Uint_38 wasn't 0 at " + Offset + ": " + uint_38); diff --git a/Assets/Scripts/OpenSpace/PS1/COL/IPS1PolygonCollide.cs b/Assets/Scripts/OpenSpace/PS1/COL/IPS1PolygonCollide.cs index 03c6d2bc..eed7de16 100644 --- a/Assets/Scripts/OpenSpace/PS1/COL/IPS1PolygonCollide.cs +++ b/Assets/Scripts/OpenSpace/PS1/COL/IPS1PolygonCollide.cs @@ -8,6 +8,6 @@ namespace OpenSpace.PS1 { public interface IPS1PolygonCollide { byte MaterialIndex { get; } - Pointer Offset { get; } + LegacyPointer Offset { get; } } } diff --git a/Assets/Scripts/OpenSpace/PS1/CS/ActivationList..cs b/Assets/Scripts/OpenSpace/PS1/CS/ActivationList..cs index 974b0d1f..995fcfc0 100644 --- a/Assets/Scripts/OpenSpace/PS1/CS/ActivationList..cs +++ b/Assets/Scripts/OpenSpace/PS1/CS/ActivationList..cs @@ -4,14 +4,14 @@ namespace OpenSpace.PS1 { public class ActivationList : OpenSpaceStruct { public uint num_activationZones; - public Pointer off_activations; + public LegacyPointer off_activations; // Parsed public ActivationZone[] activationZones; protected override void ReadInternal(Reader reader) { num_activationZones = reader.ReadUInt32(); - off_activations = Pointer.Read(reader); + off_activations = LegacyPointer.Read(reader); activationZones = Load.ReadArray(num_activationZones, reader, off_activations); } diff --git a/Assets/Scripts/OpenSpace/PS1/CS/ActivationZone.cs b/Assets/Scripts/OpenSpace/PS1/CS/ActivationZone.cs index 25bd0b86..128448d8 100644 --- a/Assets/Scripts/OpenSpace/PS1/CS/ActivationZone.cs +++ b/Assets/Scripts/OpenSpace/PS1/CS/ActivationZone.cs @@ -4,18 +4,18 @@ namespace OpenSpace.PS1 { public class ActivationZone : OpenSpaceStruct { public uint num_activations; - public Pointer off_activations; + public LegacyPointer off_activations; // Parsed public uint[] activations; protected override void ReadInternal(Reader reader) { num_activations = reader.ReadUInt32(); - off_activations = Pointer.Read(reader); + off_activations = LegacyPointer.Read(reader); activations = new uint[num_activations]; if (num_activations > 0) { - Pointer.DoAt(ref reader, off_activations, () => { + LegacyPointer.DoAt(ref reader, off_activations, () => { for (int i = 0; i < num_activations; i++) { activations[i] = reader.ReadUInt32(); } diff --git a/Assets/Scripts/OpenSpace/PS1/CS/CollSet.cs b/Assets/Scripts/OpenSpace/PS1/CS/CollSet.cs index f4d455bf..55d38b74 100644 --- a/Assets/Scripts/OpenSpace/PS1/CS/CollSet.cs +++ b/Assets/Scripts/OpenSpace/PS1/CS/CollSet.cs @@ -5,8 +5,8 @@ namespace OpenSpace.PS1 { public class CollSet : OpenSpaceStruct { - public Dictionary off_zdxList = new Dictionary(); - public Pointer off_activationList; + public Dictionary off_zdxList = new Dictionary(); + public LegacyPointer off_activationList; public byte byte_14; public byte byte_15; public byte byte_16; @@ -20,18 +20,18 @@ public class CollSet : OpenSpaceStruct { protected override void ReadInternal(Reader reader) { //Load.print("CollSet @ " + Offset); - if (Settings.s.game == Settings.Game.R2) { + if (Legacy_Settings.s.game == Legacy_Settings.Game.R2) { reader.ReadUInt32(); reader.ReadUInt32(); reader.ReadUInt32(); reader.ReadUInt32(); } else { - off_zdxList[CollideType.ZDD] = Pointer.Read(reader); - off_zdxList[CollideType.ZDE] = Pointer.Read(reader); - off_zdxList[CollideType.ZDM] = Pointer.Read(reader); - off_zdxList[CollideType.ZDR] = Pointer.Read(reader); + off_zdxList[CollideType.ZDD] = LegacyPointer.Read(reader); + off_zdxList[CollideType.ZDE] = LegacyPointer.Read(reader); + off_zdxList[CollideType.ZDM] = LegacyPointer.Read(reader); + off_zdxList[CollideType.ZDR] = LegacyPointer.Read(reader); } - off_activationList = Pointer.Read(reader); + off_activationList = LegacyPointer.Read(reader); byte_14 = reader.ReadByte(); byte_15 = reader.ReadByte(); byte_16 = reader.ReadByte(); @@ -46,7 +46,7 @@ protected override void ReadInternal(Reader reader) { } public void ReadZdxListDependingOnStates(Reader reader, State[] states) { - if (Settings.s.game == Settings.Game.R2) { + if (Legacy_Settings.s.game == Legacy_Settings.Game.R2) { Loader.R2PS1Loader l = Load as Loader.R2PS1Loader; if (zdxParsed) return; zdxParsed = true; @@ -57,15 +57,15 @@ bool HasZdxList(CollideType type) { && activationList?.activationZones.Length > s.zoneZdx[type] && activationList?.activationZones[s.zoneZdx[type]].num_activations != 0); } - off_zdxList[CollideType.ZDD] = HasZdxList(CollideType.ZDD) ? Pointer.GetPointerAtOffset(Offset) : null; // 0 - off_zdxList[CollideType.ZDE] = HasZdxList(CollideType.ZDE) ? Pointer.GetPointerAtOffset(Offset + 4) : null; // 2 - off_zdxList[CollideType.ZDM] = HasZdxList(CollideType.ZDM) ? Pointer.GetPointerAtOffset(Offset + 8) : null; // 1 - off_zdxList[CollideType.ZDR] = HasZdxList(CollideType.ZDR) ? Pointer.GetPointerAtOffset(Offset + 0xC) : null; // 3 + off_zdxList[CollideType.ZDD] = HasZdxList(CollideType.ZDD) ? LegacyPointer.GetPointerAtOffset(Offset) : null; // 0 + off_zdxList[CollideType.ZDE] = HasZdxList(CollideType.ZDE) ? LegacyPointer.GetPointerAtOffset(Offset + 4) : null; // 2 + off_zdxList[CollideType.ZDM] = HasZdxList(CollideType.ZDM) ? LegacyPointer.GetPointerAtOffset(Offset + 8) : null; // 1 + off_zdxList[CollideType.ZDR] = HasZdxList(CollideType.ZDR) ? LegacyPointer.GetPointerAtOffset(Offset + 0xC) : null; // 3 } else { - off_zdxList[CollideType.ZDD] = Pointer.GetPointerAtOffset(Offset); // 0 - off_zdxList[CollideType.ZDE] = Pointer.GetPointerAtOffset(Offset + 4); // 2 - off_zdxList[CollideType.ZDM] = Pointer.GetPointerAtOffset(Offset + 8); // 1 - off_zdxList[CollideType.ZDR] = Pointer.GetPointerAtOffset(Offset + 0xC); // 3 + off_zdxList[CollideType.ZDD] = LegacyPointer.GetPointerAtOffset(Offset); // 0 + off_zdxList[CollideType.ZDE] = LegacyPointer.GetPointerAtOffset(Offset + 4); // 2 + off_zdxList[CollideType.ZDM] = LegacyPointer.GetPointerAtOffset(Offset + 8); // 1 + off_zdxList[CollideType.ZDR] = LegacyPointer.GetPointerAtOffset(Offset + 0xC); // 3 } foreach (CollideType key in off_zdxList.Keys) { //Load.print(key + " - " + off_zdxList[key]); diff --git a/Assets/Scripts/OpenSpace/PS1/CS/PhysicalObjectCollisionMapping.cs b/Assets/Scripts/OpenSpace/PS1/CS/PhysicalObjectCollisionMapping.cs index 702f89bc..fbd8a067 100644 --- a/Assets/Scripts/OpenSpace/PS1/CS/PhysicalObjectCollisionMapping.cs +++ b/Assets/Scripts/OpenSpace/PS1/CS/PhysicalObjectCollisionMapping.cs @@ -2,23 +2,23 @@ namespace OpenSpace.PS1 { public class PhysicalObjectCollisionMapping : OpenSpaceStruct { - public Pointer off_collision; - public Pointer off_poListEntry; + public LegacyPointer off_collision; + public LegacyPointer off_poListEntry; // Parsed - public Pointer off_geo_collide; + public LegacyPointer off_geo_collide; public GeometricObjectCollide geo_collide; protected override void ReadInternal(Reader reader) { - off_collision = Pointer.Read(reader); - off_poListEntry = Pointer.Read(reader); + off_collision = LegacyPointer.Read(reader); + off_poListEntry = LegacyPointer.Read(reader); reader.ReadBytes(0x24); if (off_collision != null) { - Pointer.DoAt(ref reader, off_collision + 0x10, () => { + LegacyPointer.DoAt(ref reader, off_collision + 0x10, () => { uint num_collision = reader.ReadUInt32(); if (num_collision > 0) { - off_geo_collide = Pointer.Read(reader); + off_geo_collide = LegacyPointer.Read(reader); geo_collide = Load.FromOffsetOrRead(reader, off_geo_collide); } }); diff --git a/Assets/Scripts/OpenSpace/PS1/CS/ZdxEntry.cs b/Assets/Scripts/OpenSpace/PS1/CS/ZdxEntry.cs index 3f48aa5d..43ee9e61 100644 --- a/Assets/Scripts/OpenSpace/PS1/CS/ZdxEntry.cs +++ b/Assets/Scripts/OpenSpace/PS1/CS/ZdxEntry.cs @@ -5,11 +5,11 @@ namespace OpenSpace.PS1 { public class ZdxEntry : OpenSpaceStruct { public uint num_spheres; - public Pointer off_spheres; // 0x10 large + public LegacyPointer off_spheres; // 0x10 large public uint num_boxes; - public Pointer off_boxes; // 0x14 large + public LegacyPointer off_boxes; // 0x14 large public uint unk; - public Pointer off_unk; // 0x3c large + public LegacyPointer off_unk; // 0x3c large // Parsed public ZdxSphere[] spheres; @@ -17,11 +17,11 @@ public class ZdxEntry : OpenSpaceStruct { protected override void ReadInternal(Reader reader) { num_spheres = reader.ReadUInt32(); - off_spheres = Pointer.Read(reader); + off_spheres = LegacyPointer.Read(reader); num_boxes = reader.ReadUInt32(); - off_boxes = Pointer.Read(reader); + off_boxes = LegacyPointer.Read(reader); unk = reader.ReadUInt32(); - off_unk = Pointer.Read(reader); + off_unk = LegacyPointer.Read(reader); spheres = Load.ReadArray(num_spheres, reader, off_spheres); boxes = Load.ReadArray(num_boxes, reader, off_boxes); diff --git a/Assets/Scripts/OpenSpace/PS1/CS/ZdxList.cs b/Assets/Scripts/OpenSpace/PS1/CS/ZdxList.cs index a76b13a9..89bb6055 100644 --- a/Assets/Scripts/OpenSpace/PS1/CS/ZdxList.cs +++ b/Assets/Scripts/OpenSpace/PS1/CS/ZdxList.cs @@ -4,14 +4,14 @@ namespace OpenSpace.PS1 { public class ZdxList : OpenSpaceStruct { public uint num_entries; - public Pointer off_entries; + public LegacyPointer off_entries; // Parsed public ZdxEntry[] entries; protected override void ReadInternal(Reader reader) { num_entries = reader.ReadUInt32(); - off_entries = Pointer.Read(reader); + off_entries = LegacyPointer.Read(reader); entries = Load.ReadArray(num_entries, reader, off_entries); } diff --git a/Assets/Scripts/OpenSpace/PS1/GEO/Deform/DeformBone.cs b/Assets/Scripts/OpenSpace/PS1/GEO/Deform/DeformBone.cs index 860eb864..925e31ad 100644 --- a/Assets/Scripts/OpenSpace/PS1/GEO/Deform/DeformBone.cs +++ b/Assets/Scripts/OpenSpace/PS1/GEO/Deform/DeformBone.cs @@ -15,7 +15,7 @@ public class DeformBone : OpenSpaceStruct { public short y; public short z; public short short_0A; - public Pointer off_vertices; + public LegacyPointer off_vertices; public short rot_m00; public short rot_m01; @@ -60,7 +60,7 @@ protected override void ReadInternal(Reader reader) { y = reader.ReadInt16(); z = reader.ReadInt16(); short_0A = reader.ReadInt16(); - off_vertices = Pointer.Read(reader); + off_vertices = LegacyPointer.Read(reader); rot_m00 = reader.ReadInt16(); rot_m01 = reader.ReadInt16(); @@ -81,7 +81,7 @@ protected override void ReadInternal(Reader reader) { unk6 = reader.ReadInt16(); vertices = new ushort[num_vertices]; - Pointer.DoAt(ref reader, off_vertices, () => { + LegacyPointer.DoAt(ref reader, off_vertices, () => { for (int i = 0; i < num_vertices; i++) { vertices[i] = reader.ReadUInt16(); } diff --git a/Assets/Scripts/OpenSpace/PS1/GEO/Deform/DeformVertexWeights.cs b/Assets/Scripts/OpenSpace/PS1/GEO/Deform/DeformVertexWeights.cs index 531ab8ee..ed4f54e7 100644 --- a/Assets/Scripts/OpenSpace/PS1/GEO/Deform/DeformVertexWeights.cs +++ b/Assets/Scripts/OpenSpace/PS1/GEO/Deform/DeformVertexWeights.cs @@ -11,7 +11,7 @@ namespace OpenSpace.PS1 { public class DeformVertexWeights : OpenSpaceStruct { public ushort num_weights; public ushort ind_vertex; - public Pointer off_weights; + public LegacyPointer off_weights; public short unk0; public short unk1; public short unk2; @@ -22,7 +22,7 @@ public class DeformVertexWeights : OpenSpaceStruct { protected override void ReadInternal(Reader reader) { num_weights = reader.ReadUInt16(); ind_vertex = reader.ReadUInt16(); - off_weights = Pointer.Read(reader); + off_weights = LegacyPointer.Read(reader); unk0 = reader.ReadInt16(); unk1 = reader.ReadInt16(); diff --git a/Assets/Scripts/OpenSpace/PS1/GEO/GeometricObject.cs b/Assets/Scripts/OpenSpace/PS1/GEO/GeometricObject.cs index b9930c10..df316b60 100644 --- a/Assets/Scripts/OpenSpace/PS1/GEO/GeometricObject.cs +++ b/Assets/Scripts/OpenSpace/PS1/GEO/GeometricObject.cs @@ -16,8 +16,8 @@ public class GeometricObject : OpenSpaceStruct { public short short_0A; public short short_0C; public ushort ushort_0E; - public Pointer off_vertices; - public Pointer off_triangleLists; + public LegacyPointer off_vertices; + public LegacyPointer off_triangleLists; public short short_18; public short short_1A; public short currentScrollValue; @@ -28,10 +28,10 @@ public class GeometricObject : OpenSpaceStruct { public ushort num_boneWeights; public ushort num_boneUnk; public ushort num_unk4; - public Pointer off_bones; - public Pointer off_boneWeights; - public Pointer off_boneUnk; - public Pointer off_unk4; + public LegacyPointer off_bones; + public LegacyPointer off_boneWeights; + public LegacyPointer off_boneUnk; + public LegacyPointer off_unk4; public uint off_bones_; public uint off_boneWeights_; public uint off_boneUnk_; @@ -53,30 +53,30 @@ protected override void ReadInternal(Reader reader) { short_0A = reader.ReadInt16(); short_0C = reader.ReadInt16(); ushort_0E = reader.ReadUInt16(); - off_vertices = Pointer.Read(reader); - off_triangleLists = Pointer.Read(reader); - if (Settings.s.game == Settings.Game.VIP || Settings.s.game == Settings.Game.JungleBook) { + off_vertices = LegacyPointer.Read(reader); + off_triangleLists = LegacyPointer.Read(reader); + if (Legacy_Settings.s.game == Legacy_Settings.Game.VIP || Legacy_Settings.s.game == Legacy_Settings.Game.JungleBook) { num_bones = reader.ReadUInt16(); num_boneWeights = reader.ReadUInt16(); num_boneUnk = reader.ReadUInt16(); num_unk4 = reader.ReadUInt16(); if (num_bones > 0) { - off_bones = Pointer.Read(reader); + off_bones = LegacyPointer.Read(reader); } else { off_bones_ = reader.ReadUInt32(); } if (num_boneWeights > 0) { - off_boneWeights = Pointer.Read(reader); + off_boneWeights = LegacyPointer.Read(reader); } else { off_boneWeights_ = reader.ReadUInt32(); } if (num_boneUnk > 0) { - off_boneUnk = Pointer.Read(reader); + off_boneUnk = LegacyPointer.Read(reader); } else { off_boneUnk_ = reader.ReadUInt32(); } if (num_unk4 > 0) { - off_unk4 = Pointer.Read(reader); + off_unk4 = LegacyPointer.Read(reader); } else { off_unk4_ = reader.ReadUInt32(); } diff --git a/Assets/Scripts/OpenSpace/PS1/GEO/IPS1Polygon.cs b/Assets/Scripts/OpenSpace/PS1/GEO/IPS1Polygon.cs index 86f5bef8..7fff5a81 100644 --- a/Assets/Scripts/OpenSpace/PS1/GEO/IPS1Polygon.cs +++ b/Assets/Scripts/OpenSpace/PS1/GEO/IPS1Polygon.cs @@ -9,6 +9,6 @@ namespace OpenSpace.PS1 { public interface IPS1Polygon { TextureBounds Texture { get; } VisualMaterial Material { get; } - Pointer Offset { get; } + LegacyPointer Offset { get; } } } diff --git a/Assets/Scripts/OpenSpace/PS1/GEO/PolygonList.cs b/Assets/Scripts/OpenSpace/PS1/GEO/PolygonList.cs index 49d5c5ec..50c3e8a6 100644 --- a/Assets/Scripts/OpenSpace/PS1/GEO/PolygonList.cs +++ b/Assets/Scripts/OpenSpace/PS1/GEO/PolygonList.cs @@ -9,7 +9,7 @@ namespace OpenSpace.PS1 { public class PolygonList : OpenSpaceStruct { public ushort type; public ushort ushort_02; - public Pointer off_polygons; + public LegacyPointer off_polygons; public uint length; public IPS1Polygon[] polygons; @@ -17,8 +17,8 @@ public class PolygonList : OpenSpaceStruct { protected override void ReadInternal(Reader reader) { type = reader.ReadUInt16(); ushort_02 = reader.ReadUInt16(); - off_polygons = Pointer.Read(reader); - Pointer.DoAt(ref reader, off_polygons, () => { + off_polygons = LegacyPointer.Read(reader); + LegacyPointer.DoAt(ref reader, off_polygons, () => { length = reader.ReadUInt32(); switch (type) { case 0: diff --git a/Assets/Scripts/OpenSpace/PS1/GEO/QuadLOD.cs b/Assets/Scripts/OpenSpace/PS1/GEO/QuadLOD.cs index 77a9b779..f53eab1e 100644 --- a/Assets/Scripts/OpenSpace/PS1/GEO/QuadLOD.cs +++ b/Assets/Scripts/OpenSpace/PS1/GEO/QuadLOD.cs @@ -22,7 +22,7 @@ public class QuadLOD : OpenSpaceStruct, IPS1Polygon { public ushort ushort_12; public ushort ushort_14; public ushort ushort_16; - public Pointer off_actualQuads; + public LegacyPointer off_actualQuads; public uint length; public Quad[] quads; @@ -43,9 +43,9 @@ protected override void ReadInternal(Reader reader) { ushort_12 = reader.ReadUInt16();// page info? ushort_14 = reader.ReadUInt16(); ushort_16 = reader.ReadUInt16(); - off_actualQuads = Pointer.Read(reader); + off_actualQuads = LegacyPointer.Read(reader); - Pointer.DoAt(ref reader, off_actualQuads, () => { + LegacyPointer.DoAt(ref reader, off_actualQuads, () => { length = reader.ReadUInt32(); quads = Load.ReadArray(length, reader); }); diff --git a/Assets/Scripts/OpenSpace/PS1/GMT/GameMaterial.cs b/Assets/Scripts/OpenSpace/PS1/GMT/GameMaterial.cs index 8c4a9afb..6fbb88a6 100644 --- a/Assets/Scripts/OpenSpace/PS1/GMT/GameMaterial.cs +++ b/Assets/Scripts/OpenSpace/PS1/GMT/GameMaterial.cs @@ -11,7 +11,7 @@ namespace OpenSpace.PS1 { public class GameMaterial : OpenSpaceStruct { public ushort ushort_00; public ushort ushort_02; - public Pointer off_collideMaterial; + public LegacyPointer off_collideMaterial; public int int_08; public uint uint_0C; @@ -21,7 +21,7 @@ public class GameMaterial : OpenSpaceStruct { protected override void ReadInternal(Reader reader) { ushort_00 = reader.ReadUInt16(); ushort_02 = reader.ReadUInt16(); - off_collideMaterial = Pointer.Read(reader); + off_collideMaterial = LegacyPointer.Read(reader); int_08 = reader.ReadInt32(); uint_0C = reader.ReadUInt32(); diff --git a/Assets/Scripts/OpenSpace/PS1/HIE/SuperObject.cs b/Assets/Scripts/OpenSpace/PS1/HIE/SuperObject.cs index 5d9ec2de..6b81b3d9 100644 --- a/Assets/Scripts/OpenSpace/PS1/HIE/SuperObject.cs +++ b/Assets/Scripts/OpenSpace/PS1/HIE/SuperObject.cs @@ -1,4 +1,5 @@ -using OpenSpace.Loader; +using BinarySerializer.Unity; +using OpenSpace.Loader; using System; using System.Collections.Generic; using System.Linq; @@ -12,11 +13,11 @@ public class SuperObject : OpenSpaceStruct, ILinkedListEntry { public uint typeCode; public int dataIndex; public LinkedList children; - public Pointer off_next_brother; - public Pointer off_prev_brother; - public Pointer off_parent; - public Pointer off_matrix1; - public Pointer off_matrix2; + public LegacyPointer off_next_brother; + public LegacyPointer off_prev_brother; + public LegacyPointer off_parent; + public LegacyPointer off_matrix1; + public LegacyPointer off_matrix2; public short short_28; public short short_2A; public short short_2C; @@ -26,7 +27,7 @@ public class SuperObject : OpenSpaceStruct, ILinkedListEntry { public short short_34; public short short_36; public uint uint_38; - public Pointer off_38; + public LegacyPointer off_38; public short short_3C; public short short_3E; public short short_40; @@ -42,21 +43,21 @@ public class SuperObject : OpenSpaceStruct, ILinkedListEntry { public PS1Matrix matrix1; public PS1Matrix matrix2; - public Pointer NextEntry => off_next_brother; - public Pointer PreviousEntry => off_prev_brother; + public LegacyPointer NextEntry => off_next_brother; + public LegacyPointer PreviousEntry => off_prev_brother; public bool isDynamic = false; protected override void ReadInternal(Reader reader) { //Load.print("SuperObject @ " + Offset); typeCode = reader.ReadUInt32(); dataIndex = reader.ReadInt32(); - children = LinkedList.ReadHeader(reader, Pointer.Current(reader), LinkedList.Type.Double); - off_next_brother = Pointer.Read(reader); // 14 - off_prev_brother = Pointer.Read(reader); // 18 - off_parent = Pointer.Read(reader); // 1c - off_matrix1 = Pointer.Read(reader); // - if (Settings.s.game != Settings.Game.RRush) { - off_matrix2 = Pointer.Read(reader); + children = LinkedList.ReadHeader(reader, LegacyPointer.Current(reader), LinkedList.Type.Double); + off_next_brother = LegacyPointer.Read(reader); // 14 + off_prev_brother = LegacyPointer.Read(reader); // 18 + off_parent = LegacyPointer.Read(reader); // 1c + off_matrix1 = LegacyPointer.Read(reader); // + if (Legacy_Settings.s.game != Legacy_Settings.Game.RRush) { + off_matrix2 = LegacyPointer.Read(reader); short_28 = reader.ReadInt16(); short_2A = reader.ReadInt16(); short_2C = reader.ReadInt16(); @@ -68,7 +69,7 @@ protected override void ReadInternal(Reader reader) { if (isDynamic) { uint_38 = reader.ReadUInt32(); } else { - off_38 = Pointer.Read(reader); + off_38 = LegacyPointer.Read(reader); } short_3C = reader.ReadInt16(); short_3E = reader.ReadInt16(); diff --git a/Assets/Scripts/OpenSpace/PS1/LevelHeader.cs b/Assets/Scripts/OpenSpace/PS1/LevelHeader.cs index 878b10cb..c8cc31b9 100644 --- a/Assets/Scripts/OpenSpace/PS1/LevelHeader.cs +++ b/Assets/Scripts/OpenSpace/PS1/LevelHeader.cs @@ -11,52 +11,52 @@ namespace OpenSpace.PS1 { public class LevelHeader : OpenSpaceStruct { public uint num_geometricObjectsDynamic_cine; - public Pointer off_dynamicWorld; - public Pointer off_fatherSector; - public Pointer off_inactiveDynamicWorld; + public LegacyPointer off_dynamicWorld; + public LegacyPointer off_fatherSector; + public LegacyPointer off_inactiveDynamicWorld; public uint num_always; - public Pointer off_always; + public LegacyPointer off_always; public uint num_wayPoints; public uint num_graphs; - public Pointer off_wayPoints; - public Pointer off_graphs; + public LegacyPointer off_wayPoints; + public LegacyPointer off_graphs; public ushort num_persos; public ushort ushort_116; - public Pointer off_persos; - public Pointer off_states; + public LegacyPointer off_persos; + public LegacyPointer off_states; public ushort num_states; public ushort ushort_122; public uint uint_124; public uint uint_128; - public Pointer off_12C; - public Pointer off_130; + public LegacyPointer off_12C; + public LegacyPointer off_130; public uint uint_134; public uint uint_138; // usually 0x28 public uint uint_13C; public uint uint_140; public uint uint_144; public int initialStreamID; // ID of first cutscene stream upon entering level - public Pointer off_animPositions; - public Pointer off_animRotations; - public Pointer off_animScales; + public LegacyPointer off_animPositions; + public LegacyPointer off_animRotations; + public LegacyPointer off_animScales; // UI Textures public byte num_ui_textures; public byte byte_159; public ushort ushort_15A; - public Pointer off_ui_textures_names; - public Pointer off_ui_textures_width; - public Pointer off_ui_textures_height; - public Pointer off_ui_textures_pageInfo; - public Pointer off_ui_textures_palette; - public Pointer off_ui_textures_xInPage; - public Pointer off_ui_textures_yInPage; + public LegacyPointer off_ui_textures_names; + public LegacyPointer off_ui_textures_width; + public LegacyPointer off_ui_textures_height; + public LegacyPointer off_ui_textures_pageInfo; + public LegacyPointer off_ui_textures_palette; + public LegacyPointer off_ui_textures_xInPage; + public LegacyPointer off_ui_textures_yInPage; - public Pointer off_178; + public LegacyPointer off_178; public int int_17C; - public Pointer off_geometricObjects_dynamic; - public Pointer off_geometricObjects_static; + public LegacyPointer off_geometricObjects_dynamic; + public LegacyPointer off_geometricObjects_static; public uint num_geometricObjects_dynamic; public ushort ushort_18C; @@ -64,47 +64,47 @@ public class LevelHeader : OpenSpaceStruct { public short short_190; public ushort ushort_192; public uint num_ipoCollision; - public Pointer off_ipoCollision; + public LegacyPointer off_ipoCollision; public uint num_meshCollision; - public Pointer off_meshCollision; + public LegacyPointer off_meshCollision; public uint off_meshCollision_; - public Pointer off_sectors; + public LegacyPointer off_sectors; public ushort num_sectors; public ushort ushort_1AA; public uint num_cameraModifiers; public uint uint_1B0; public uint uint_1B4; public uint uint_1B8; - public Pointer off_cameraModifiers_volumes; // 0x28 structs of 0x38 size - public Pointer off_cameraModifiers; // 0x28 structs of 0x68 size. starts with 0x5. - public Pointer off_gameMaterials; // b structs of 0x10 + public LegacyPointer off_cameraModifiers_volumes; // 0x28 structs of 0x38 size + public LegacyPointer off_cameraModifiers; // 0x28 structs of 0x68 size. starts with 0x5. + public LegacyPointer off_gameMaterials; // b structs of 0x10 public uint num_gameMaterials; // b public uint uint_1CC; public ushort ushort_1D0; public ushort ushort_1D2; - public Pointer off_1D4; // same offset as the first pointer in the first struct of off_1C4 + public LegacyPointer off_1D4; // same offset as the first pointer in the first struct of off_1C4 public uint num_ago_textures; - public Pointer off_ago_textures_pageInfo; - public Pointer off_ago_textures_palette; - public Pointer off_ago_textures_xInPage; - public Pointer off_ago_textures_yInPage; - public Pointer off_ago_textures_globalX; - public Pointer off_ago_textures_globalY; + public LegacyPointer off_ago_textures_pageInfo; + public LegacyPointer off_ago_textures_palette; + public LegacyPointer off_ago_textures_xInPage; + public LegacyPointer off_ago_textures_yInPage; + public LegacyPointer off_ago_textures_globalX; + public LegacyPointer off_ago_textures_globalY; public uint uint_1F4; public uint uint_1F8; public uint uint_1FC; // Rush - public Pointer off_rush_114; + public LegacyPointer off_rush_114; public ushort ushort_rush_118; public ushort ushort_rush_11A; - public Pointer off_ago_textures_width; - public Pointer off_ago_textures_height; + public LegacyPointer off_ago_textures_width; + public LegacyPointer off_ago_textures_height; // Donald Duck public uint num_skinnableObjects; - public Pointer[] off_skins; - public Pointer off_current_skin_memory; + public LegacyPointer[] off_skins; + public LegacyPointer off_current_skin_memory; // Parsed @@ -132,114 +132,114 @@ public class LevelHeader : OpenSpaceStruct { protected override void ReadInternal(Reader reader) { R2PS1Loader l = Load as R2PS1Loader; - if (Settings.s.game == Settings.Game.RRush) { + if (Legacy_Settings.s.game == Legacy_Settings.Game.RRush) { reader.ReadBytes(0x40); - } else if (Settings.s.game == Settings.Game.DD) { + } else if (Legacy_Settings.s.game == Legacy_Settings.Game.DD) { reader.ReadBytes(0x58); - } else if (Settings.s.game == Settings.Game.VIP) { + } else if (Legacy_Settings.s.game == Legacy_Settings.Game.VIP) { reader.ReadBytes(0x28); - } else if(Settings.s.game == Settings.Game.JungleBook) { + } else if(Legacy_Settings.s.game == Legacy_Settings.Game.JungleBook) { reader.ReadBytes(0xEC); } else { reader.ReadBytes(0xCC); num_geometricObjectsDynamic_cine = reader.ReadUInt32(); reader.ReadBytes(0x20); // after this we're at 0xf0 } - off_dynamicWorld = Pointer.Read(reader); - off_fatherSector = Pointer.Read(reader); - off_inactiveDynamicWorld = Pointer.Read(reader); + off_dynamicWorld = LegacyPointer.Read(reader); + off_fatherSector = LegacyPointer.Read(reader); + off_inactiveDynamicWorld = LegacyPointer.Read(reader); num_always = reader.ReadUInt32(); - off_always = Pointer.Read(reader); // + off_always = LegacyPointer.Read(reader); // num_wayPoints = reader.ReadUInt32(); // x num_graphs = reader.ReadUInt32(); - off_wayPoints = Pointer.Read(reader); // x structs of 0x14 waypoints - off_graphs = Pointer.Read(reader); // graphs. structs of 0x68 + off_wayPoints = LegacyPointer.Read(reader); // x structs of 0x14 waypoints + off_graphs = LegacyPointer.Read(reader); // graphs. structs of 0x68 num_persos = reader.ReadUInt16(); ushort_116 = reader.ReadUInt16(); - off_persos = Pointer.Read(reader); + off_persos = LegacyPointer.Read(reader); Load.print(off_dynamicWorld + " - " + off_fatherSector + " - " + off_inactiveDynamicWorld + " - " + off_always + " - " + off_wayPoints + " - " + off_graphs + " - " + off_persos); - off_states = Pointer.Read(reader); + off_states = LegacyPointer.Read(reader); num_states = reader.ReadUInt16(); ushort_122 = reader.ReadUInt16(); uint_124 = reader.ReadUInt32(); uint_128 = reader.ReadUInt32(); - off_12C = Pointer.Read(reader); // this + 0x10 = main character - off_130 = Pointer.Read(reader); + off_12C = LegacyPointer.Read(reader); // this + 0x10 = main character + off_130 = LegacyPointer.Read(reader); uint_134 = reader.ReadUInt32(); uint_138 = reader.ReadUInt32(); uint_13C = reader.ReadUInt32(); // same as mainChar_states count uint_140 = reader.ReadUInt32(); uint_144 = reader.ReadUInt32(); initialStreamID = reader.ReadInt32(); // -1 - Load.print(Pointer.Current(reader)); - off_animPositions = Pointer.Read(reader); // 0x6 size - off_animRotations = Pointer.Read(reader); // big array of structs of 0x8 size. 4 ushorts per struct - off_animScales = Pointer.Read(reader); + Load.print(LegacyPointer.Current(reader)); + off_animPositions = LegacyPointer.Read(reader); // 0x6 size + off_animRotations = LegacyPointer.Read(reader); // big array of structs of 0x8 size. 4 ushorts per struct + off_animScales = LegacyPointer.Read(reader); Load.print(off_12C + " - " + off_130 + " - " + off_animPositions + " - " + off_animRotations + " - " + off_animScales); //Load.print(Pointer.Current(reader)); - if (Settings.s.game == Settings.Game.DD) { + if (Legacy_Settings.s.game == Legacy_Settings.Game.DD) { // Also stuff for big textures, but names and amount is stored in exe - Pointer.Read(reader); - Pointer.Read(reader); - Pointer.Read(reader); - Pointer.Read(reader); - Pointer.Read(reader); + LegacyPointer.Read(reader); + LegacyPointer.Read(reader); + LegacyPointer.Read(reader); + LegacyPointer.Read(reader); + LegacyPointer.Read(reader); reader.ReadUInt32(); reader.ReadUInt32(); - Pointer.Read(reader); + LegacyPointer.Read(reader); - off_geometricObjects_dynamic = Pointer.Read(reader); + off_geometricObjects_dynamic = LegacyPointer.Read(reader); num_skinnableObjects = reader.ReadUInt32(); int num_skins = 5; - off_skins = new Pointer[num_skins]; + off_skins = new LegacyPointer[num_skins]; skins = new SkinnableGeometricObjectList[num_skins]; for (int i = 0; i < num_skins; i++) { - off_skins[i] = Pointer.Read(reader); + off_skins[i] = LegacyPointer.Read(reader); skins[i] = Load.FromOffsetOrRead(reader, off_skins[i], onPreRead: s => s.length = num_skinnableObjects); } - off_current_skin_memory = Pointer.Read(reader); + off_current_skin_memory = LegacyPointer.Read(reader); reader.ReadUInt32(); // total skin memory size? - off_geometricObjects_static = Pointer.Read(reader); + off_geometricObjects_static = LegacyPointer.Read(reader); num_geometricObjects_dynamic = reader.ReadUInt32(); - } else if (Settings.s.game == Settings.Game.VIP || Settings.s.game == Settings.Game.JungleBook) { + } else if (Legacy_Settings.s.game == Legacy_Settings.Game.VIP || Legacy_Settings.s.game == Legacy_Settings.Game.JungleBook) { reader.ReadUInt32(); reader.ReadUInt32(); reader.ReadUInt32(); reader.ReadUInt32(); reader.ReadUInt32(); - off_geometricObjects_dynamic = Pointer.Read(reader); - off_geometricObjects_static = Pointer.Read(reader); + off_geometricObjects_dynamic = LegacyPointer.Read(reader); + off_geometricObjects_static = LegacyPointer.Read(reader); num_geometricObjects_dynamic = reader.ReadUInt32(); } else { // Vignette stuff, big textures num_ui_textures = reader.ReadByte(); byte_159 = reader.ReadByte(); ushort_15A = reader.ReadUInt16(); - off_ui_textures_names = Pointer.Read(reader); - off_ui_textures_width = Pointer.Read(reader); // num_vignettes * ushort - off_ui_textures_height = Pointer.Read(reader); // num_vignettes * ushort - off_ui_textures_pageInfo = Pointer.Read(reader); // num_vignettes * ushort - off_ui_textures_palette = Pointer.Read(reader); - off_ui_textures_xInPage = Pointer.Read(reader); - off_ui_textures_yInPage = Pointer.Read(reader); // still related to the vignette stuff + off_ui_textures_names = LegacyPointer.Read(reader); + off_ui_textures_width = LegacyPointer.Read(reader); // num_vignettes * ushort + off_ui_textures_height = LegacyPointer.Read(reader); // num_vignettes * ushort + off_ui_textures_pageInfo = LegacyPointer.Read(reader); // num_vignettes * ushort + off_ui_textures_palette = LegacyPointer.Read(reader); + off_ui_textures_xInPage = LegacyPointer.Read(reader); + off_ui_textures_yInPage = LegacyPointer.Read(reader); // still related to the vignette stuff ParseUITextures(reader); // Something else - off_178 = Pointer.Read(reader); + off_178 = LegacyPointer.Read(reader); int_17C = reader.ReadInt32(); // -1 - off_geometricObjects_dynamic = Pointer.Read(reader); - off_geometricObjects_static = Pointer.Read(reader); + off_geometricObjects_dynamic = LegacyPointer.Read(reader); + off_geometricObjects_static = LegacyPointer.Read(reader); num_geometricObjects_dynamic = reader.ReadUInt32(); } - if (Settings.s.game != Settings.Game.VIP) { + if (Legacy_Settings.s.game != Legacy_Settings.Game.VIP) { ushort_18C = reader.ReadUInt16(); ushort_18E = reader.ReadUInt16(); short_190 = reader.ReadInt16(); ushort_192 = reader.ReadUInt16(); num_ipoCollision = reader.ReadUInt32(); // y - off_ipoCollision = Pointer.Read(reader); // y structs of 0x3c + off_ipoCollision = LegacyPointer.Read(reader); // y structs of 0x3c //Load.print(off_ipoCollision + " - " + num_ipoCollision); num_meshCollision = reader.ReadUInt32(); /*if (num_meshCollision > 0) { @@ -258,51 +258,51 @@ protected override void ReadInternal(Reader reader) { reader.ReadUInt32(); reader.ReadUInt32(); //Pointer.Read(reader); } - off_sectors = Pointer.Read(reader); // num_1A8 structs of 0x54 + off_sectors = LegacyPointer.Read(reader); // num_1A8 structs of 0x54 num_sectors = reader.ReadUInt16(); // actual sectors //Load.print(off_sector_minus_one_things + " - " + bad_off_1A0 + " - " + off_sectors); ushort_1AA = reader.ReadUInt16(); - Load.print(Pointer.Current(reader)); - if (Settings.s.game != Settings.Game.DD) { + Load.print(LegacyPointer.Current(reader)); + if (Legacy_Settings.s.game != Legacy_Settings.Game.DD) { num_cameraModifiers = reader.ReadUInt32(); uint_1B0 = reader.ReadUInt32(); uint_1B4 = reader.ReadUInt32(); uint_1B8 = reader.ReadUInt32(); - if (Settings.s.game != Settings.Game.VIP) { - off_cameraModifiers_volumes = Pointer.Read(reader); // uint_1B4 * 0x70 - off_cameraModifiers = Pointer.Read(reader); // uint_1ac * 0x68. lights? first with type (first byte) = 9 is camera related? position is at 0x14, 0x18, 0x1c? + if (Legacy_Settings.s.game != Legacy_Settings.Game.VIP) { + off_cameraModifiers_volumes = LegacyPointer.Read(reader); // uint_1B4 * 0x70 + off_cameraModifiers = LegacyPointer.Read(reader); // uint_1ac * 0x68. lights? first with type (first byte) = 9 is camera related? position is at 0x14, 0x18, 0x1c? } else { reader.ReadUInt32(); reader.ReadUInt32(); } - if (Settings.s.game == Settings.Game.RRush) { - off_rush_114 = Pointer.Read(reader); + if (Legacy_Settings.s.game == Legacy_Settings.Game.RRush) { + off_rush_114 = LegacyPointer.Read(reader); ushort_rush_118 = reader.ReadUInt16(); ushort_rush_11A = reader.ReadUInt16(); } } - off_gameMaterials = Pointer.Read(reader); + off_gameMaterials = LegacyPointer.Read(reader); num_gameMaterials = reader.ReadUInt32(); uint_1CC = reader.ReadUInt32(); ushort_1D0 = reader.ReadUInt16(); ushort_1D2 = reader.ReadUInt16(); - off_1D4 = Pointer.Read(reader); + off_1D4 = LegacyPointer.Read(reader); num_ago_textures = reader.ReadUInt32(); - off_ago_textures_pageInfo = Pointer.Read(reader); - off_ago_textures_palette = Pointer.Read(reader); - off_ago_textures_xInPage = Pointer.Read(reader); - off_ago_textures_yInPage = Pointer.Read(reader); - off_ago_textures_globalX = Pointer.Read(reader); - off_ago_textures_globalY = Pointer.Read(reader); - if (Settings.s.game == Settings.Game.RRush) { - off_ago_textures_width = Pointer.Read(reader); - off_ago_textures_height = Pointer.Read(reader); + off_ago_textures_pageInfo = LegacyPointer.Read(reader); + off_ago_textures_palette = LegacyPointer.Read(reader); + off_ago_textures_xInPage = LegacyPointer.Read(reader); + off_ago_textures_yInPage = LegacyPointer.Read(reader); + off_ago_textures_globalX = LegacyPointer.Read(reader); + off_ago_textures_globalY = LegacyPointer.Read(reader); + if (Legacy_Settings.s.game == Legacy_Settings.Game.RRush) { + off_ago_textures_width = LegacyPointer.Read(reader); + off_ago_textures_height = LegacyPointer.Read(reader); //Load.print(Pointer.Current(reader)); ParseAGOTextures(reader); - } else if(Settings.s.game == Settings.Game.R2) { + } else if(Legacy_Settings.s.game == Legacy_Settings.Game.R2) { uint_1F4 = reader.ReadUInt32(); uint_1F8 = reader.ReadUInt32(); uint_1FC = reader.ReadUInt32(); @@ -314,7 +314,7 @@ protected override void ReadInternal(Reader reader) { persos = Load.ReadArray(num_persos, reader, off_persos); geometricObjectsDynamic = Load.FromOffsetOrRead(reader, off_geometricObjects_dynamic, onPreRead: t => t.length = num_geometricObjects_dynamic - 2); geometricObjectsStatic = Load.FromOffsetOrRead(reader, off_geometricObjects_static, onPreRead: t => { - if (Settings.s.game == Settings.Game.R2) t.length = num_ipoCollision; + if (Legacy_Settings.s.game == Legacy_Settings.Game.R2) t.length = num_ipoCollision; }); ipoCollision = Load.ReadArray(num_ipoCollision, reader, off_ipoCollision); meshCollision = Load.ReadArray(num_meshCollision, reader, off_meshCollision); @@ -339,40 +339,40 @@ public void ParseUITextures(Reader reader) { for (int i = 0; i < textures.Length; i++) { textures[i] = new UITexture(); } - Pointer.DoAt(ref reader, off_ui_textures_names, () => { + LegacyPointer.DoAt(ref reader, off_ui_textures_names, () => { for (int i = 0; i < textures.Length; i++) { - Pointer p = Pointer.Read(reader); - Pointer.DoAt(ref reader, p, () => { + LegacyPointer p = LegacyPointer.Read(reader); + LegacyPointer.DoAt(ref reader, p, () => { textures[i].name = reader.ReadString(0x1C); }); } }); - Pointer.DoAt(ref reader, off_ui_textures_width, () => { + LegacyPointer.DoAt(ref reader, off_ui_textures_width, () => { for (int i = 0; i < textures.Length; i++) { textures[i].width = reader.ReadUInt16(); } }); - Pointer.DoAt(ref reader, off_ui_textures_height, () => { + LegacyPointer.DoAt(ref reader, off_ui_textures_height, () => { for (int i = 0; i < textures.Length; i++) { textures[i].height = reader.ReadUInt16(); } }); - Pointer.DoAt(ref reader, off_ui_textures_pageInfo, () => { + LegacyPointer.DoAt(ref reader, off_ui_textures_pageInfo, () => { for (int i = 0; i < textures.Length; i++) { textures[i].pageInfo = reader.ReadUInt16(); } }); - Pointer.DoAt(ref reader, off_ui_textures_palette, () => { + LegacyPointer.DoAt(ref reader, off_ui_textures_palette, () => { for (int i = 0; i < textures.Length; i++) { textures[i].palette = reader.ReadUInt16(); } }); - Pointer.DoAt(ref reader, off_ui_textures_xInPage, () => { + LegacyPointer.DoAt(ref reader, off_ui_textures_xInPage, () => { for (int i = 0; i < textures.Length; i++) { textures[i].xInPage = reader.ReadByte(); } }); - Pointer.DoAt(ref reader, off_ui_textures_yInPage, () => { + LegacyPointer.DoAt(ref reader, off_ui_textures_yInPage, () => { for (int i = 0; i < textures.Length; i++) { textures[i].yInPage = reader.ReadByte(); } @@ -399,43 +399,43 @@ public void ParseAGOTextures(Reader reader) { for (int i = 0; i < textures.Length; i++) { textures[i].name = "Tex_" + i; } - Pointer.DoAt(ref reader, off_ago_textures_pageInfo, () => { + LegacyPointer.DoAt(ref reader, off_ago_textures_pageInfo, () => { for (int i = 0; i < textures.Length; i++) { textures[i].pageInfo = reader.ReadUInt16(); } }); - Pointer.DoAt(ref reader, off_ago_textures_palette, () => { + LegacyPointer.DoAt(ref reader, off_ago_textures_palette, () => { for (int i = 0; i < textures.Length; i++) { textures[i].palette = reader.ReadUInt16(); } }); - Pointer.DoAt(ref reader, off_ago_textures_xInPage, () => { + LegacyPointer.DoAt(ref reader, off_ago_textures_xInPage, () => { for (int i = 0; i < textures.Length; i++) { textures[i].xInPage = reader.ReadByte(); } }); - Pointer.DoAt(ref reader, off_ago_textures_yInPage, () => { + LegacyPointer.DoAt(ref reader, off_ago_textures_yInPage, () => { for (int i = 0; i < textures.Length; i++) { textures[i].yInPage = reader.ReadByte(); } }); - Pointer.DoAt(ref reader, off_ago_textures_globalX, () => { + LegacyPointer.DoAt(ref reader, off_ago_textures_globalX, () => { for (int i = 0; i < textures.Length; i++) { textures[i].globalX = reader.ReadUInt16(); } }); - Pointer.DoAt(ref reader, off_ago_textures_globalY, () => { + LegacyPointer.DoAt(ref reader, off_ago_textures_globalY, () => { for (int i = 0; i < textures.Length; i++) { textures[i].globalY = reader.ReadUInt16(); } }); - if (Settings.s.game == Settings.Game.RRush) { - Pointer.DoAt(ref reader, off_ago_textures_width, () => { + if (Legacy_Settings.s.game == Legacy_Settings.Game.RRush) { + LegacyPointer.DoAt(ref reader, off_ago_textures_width, () => { for (int i = 0; i < textures.Length; i++) { textures[i].width = reader.ReadUInt16(); } }); - Pointer.DoAt(ref reader, off_ago_textures_height, () => { + LegacyPointer.DoAt(ref reader, off_ago_textures_height, () => { for (int i = 0; i < textures.Length; i++) { textures[i].height = reader.ReadUInt16(); } diff --git a/Assets/Scripts/OpenSpace/PS1/PERSO/Family.cs b/Assets/Scripts/OpenSpace/PS1/PERSO/Family.cs index a7f839ba..a0cd31f7 100644 --- a/Assets/Scripts/OpenSpace/PS1/PERSO/Family.cs +++ b/Assets/Scripts/OpenSpace/PS1/PERSO/Family.cs @@ -8,7 +8,7 @@ namespace OpenSpace.PS1 { public class Family : OpenSpaceStruct { // Animation/state related public uint uint_00; public uint uint_04; - public Pointer off_animations; + public LegacyPointer off_animations; public uint num_animations; public uint uint_10; public uint uint_14; @@ -25,13 +25,13 @@ public class Family : OpenSpaceStruct { // Animation/state related public State[] states; protected override void ReadInternal(Reader reader) { - Pointer.DoAt(ref reader, Offset - 0x24, () => { // Hack + LegacyPointer.DoAt(ref reader, Offset - 0x24, () => { // Hack name = reader.ReadString(0x24); }); //Load.print(name + " " + Offset); uint_00 = reader.ReadUInt32(); uint_04 = reader.ReadUInt32(); - off_animations = Pointer.Read(reader); + off_animations = LegacyPointer.Read(reader); num_animations = reader.ReadUInt32(); uint_10 = reader.ReadUInt32(); uint_14 = reader.ReadUInt32(); diff --git a/Assets/Scripts/OpenSpace/PS1/PERSO/Perso.cs b/Assets/Scripts/OpenSpace/PS1/PERSO/Perso.cs index 0b3de5b7..25562b49 100644 --- a/Assets/Scripts/OpenSpace/PS1/PERSO/Perso.cs +++ b/Assets/Scripts/OpenSpace/PS1/PERSO/Perso.cs @@ -1,4 +1,5 @@ -using OpenSpace.Loader; +using BinarySerializer.Unity; +using OpenSpace.Loader; using System; using System.Collections.Generic; using System.Linq; @@ -8,12 +9,12 @@ namespace OpenSpace.PS1 { public class Perso : OpenSpaceStruct { // Animation/state related - public Pointer off_p3dData; - public Pointer off_superObjectPointer; - public Pointer off_08; // dynamics - public Pointer off_0C; - public Pointer off_collSet; - public Pointer off_sectorSuperObjectPointer; + public LegacyPointer off_p3dData; + public LegacyPointer off_superObjectPointer; + public LegacyPointer off_08; // dynamics + public LegacyPointer off_0C; + public LegacyPointer off_collSet; + public LegacyPointer off_sectorSuperObjectPointer; // Parsed public Perso3dData p3dData; @@ -22,20 +23,20 @@ public class Perso : OpenSpaceStruct { // Animation/state related protected override void ReadInternal(Reader reader) { //Load.print("Perso @ " + Offset); - off_p3dData = Pointer.Read(reader); - off_superObjectPointer = Pointer.Read(reader); - off_08 = Pointer.Read(reader); // Probably Dynamics! - off_0C = Pointer.Read(reader); // points to struct of 0x18 size - off_collSet = Pointer.Read(reader); - off_sectorSuperObjectPointer = Pointer.Read(reader); // points to 4 bytes: 00000000. Only filled in at runtime + off_p3dData = LegacyPointer.Read(reader); + off_superObjectPointer = LegacyPointer.Read(reader); + off_08 = LegacyPointer.Read(reader); // Probably Dynamics! + off_0C = LegacyPointer.Read(reader); // points to struct of 0x18 size + off_collSet = LegacyPointer.Read(reader); + off_sectorSuperObjectPointer = LegacyPointer.Read(reader); // points to 4 bytes: 00000000. Only filled in at runtime //Load.print(off_00 + " - " + off_04 + " - " + off_08 + " - " + off_0C + " - " + off_10 + " - " + off_14); p3dData = Load.FromOffsetOrRead(reader, off_p3dData); - Pointer.DoAt(ref reader, off_superObjectPointer, () => { - Pointer off_superobject = Pointer.Read(reader); - if (Settings.s.game == Settings.Game.RRush) { - Pointer off_name = Pointer.Read(reader); - Pointer.DoAt(ref reader, off_name, () => { + LegacyPointer.DoAt(ref reader, off_superObjectPointer, () => { + LegacyPointer off_superobject = LegacyPointer.Read(reader); + if (Legacy_Settings.s.game == Legacy_Settings.Game.RRush) { + LegacyPointer off_name = LegacyPointer.Read(reader); + LegacyPointer.DoAt(ref reader, off_name, () => { name = reader.ReadNullDelimitedString(); }); } else { diff --git a/Assets/Scripts/OpenSpace/PS1/PERSO/Perso3dData.cs b/Assets/Scripts/OpenSpace/PS1/PERSO/Perso3dData.cs index b6d7b35b..cabdda3e 100644 --- a/Assets/Scripts/OpenSpace/PS1/PERSO/Perso3dData.cs +++ b/Assets/Scripts/OpenSpace/PS1/PERSO/Perso3dData.cs @@ -7,18 +7,18 @@ namespace OpenSpace.PS1 { public class Perso3dData : OpenSpaceStruct { // Animation/state related public uint flags; - public Pointer off_family; - public Pointer off_58; + public LegacyPointer off_family; + public LegacyPointer off_58; public ushort ushort_5C; public short short_5E; - public Pointer off_animationBuffer; - public Pointer off_64; - public Pointer off_68; - public Pointer off_6C; + public LegacyPointer off_animationBuffer; + public LegacyPointer off_64; + public LegacyPointer off_68; + public LegacyPointer off_6C; public int num_collisionObjects; - public Pointer off_collisionObjects; public uint uint_74; + public LegacyPointer off_collisionObjects; public uint uint_74; public uint stateIndex; - public Pointer off_currentState; + public LegacyPointer off_currentState; // Parsed public Family family; @@ -28,29 +28,29 @@ public class Perso3dData : OpenSpaceStruct { // Animation/state related protected override void ReadInternal(Reader reader) { //Load.print(Offset); flags = reader.ReadUInt32(); - off_family = Pointer.Read(reader); + off_family = LegacyPointer.Read(reader); reader.ReadBytes(0x50); // TODO - off_58 = Pointer.Read(reader); // 3 structs of 0x8 (no pointers) + off_58 = LegacyPointer.Read(reader); // 3 structs of 0x8 (no pointers) ushort_5C = reader.ReadUInt16(); short_5E = reader.ReadInt16(); - off_animationBuffer = Pointer.Read(reader); + off_animationBuffer = LegacyPointer.Read(reader); if (ushort_5C > 0) { - off_64 = Pointer.Read(reader); // short_5e * 0x4 - off_68 = Pointer.Read(reader); // short_5e * 0x2 + off_64 = LegacyPointer.Read(reader); // short_5e * 0x4 + off_68 = LegacyPointer.Read(reader); // short_5e * 0x2 } else { reader.ReadUInt32(); reader.ReadUInt32(); } - off_6C = Pointer.Read(reader); // same as col + off_6C = LegacyPointer.Read(reader); // same as col num_collisionObjects = reader.ReadInt32(); if (num_collisionObjects > 0) { - off_collisionObjects = Pointer.Read(reader); // mapping: off_collisionObject, off_poListEntry + off_collisionObjects = LegacyPointer.Read(reader); // mapping: off_collisionObject, off_poListEntry collisionMapping = Load.ReadArray(num_collisionObjects, reader, off_collisionObjects); } else { uint_74 = reader.ReadUInt32(); } stateIndex = reader.ReadUInt32(); - off_currentState = Pointer.Read(reader); // only at runtime + off_currentState = LegacyPointer.Read(reader); // only at runtime reader.ReadBytes(0x24); // TODO // at 0x92: scale shorts @@ -96,13 +96,13 @@ public bool HasFlag(Perso3dDataJBFlags flags) { } public uint GetFileIndex() { - if (Settings.s.game == Settings.Game.RRush) { + if (Legacy_Settings.s.game == Legacy_Settings.Game.RRush) { if (HasFlag(Perso3dDataFlags.Actor1)) { return 1; } else if (HasFlag(Perso3dDataFlags.Actor2)) { return 2; } - } else if (Settings.s.game == Settings.Game.JungleBook) { + } else if (Legacy_Settings.s.game == Legacy_Settings.Game.JungleBook) { if (HasFlag(Perso3dDataJBFlags.Actor1)) { return 1; } else if (HasFlag(Perso3dDataJBFlags.Actor2)) { diff --git a/Assets/Scripts/OpenSpace/PS1/PLA/State.cs b/Assets/Scripts/OpenSpace/PS1/PLA/State.cs index b0f36472..c94bcc8f 100644 --- a/Assets/Scripts/OpenSpace/PS1/PLA/State.cs +++ b/Assets/Scripts/OpenSpace/PS1/PLA/State.cs @@ -7,12 +7,12 @@ namespace OpenSpace.PS1 { public class State : OpenSpaceStruct { // Animation/state related - public Pointer off_anim; + public LegacyPointer off_anim; public Dictionary zoneZdx = new Dictionary(); - public Pointer off_transitions; + public LegacyPointer off_transitions; public uint num_transitions; - public Pointer off_state_auto; - public Pointer off_18; + public LegacyPointer off_state_auto; + public LegacyPointer off_18; public byte byte_1C; public byte speed; public ushort ushort_1E; @@ -25,16 +25,16 @@ public class State : OpenSpaceStruct { // Animation/state related protected override void ReadInternal(Reader reader) { //Load.print("State @ " + Offset); - off_anim = Pointer.Read(reader); + off_anim = LegacyPointer.Read(reader); zoneZdx[CollideType.ZDM] = reader.ReadInt16(); zoneZdx[CollideType.ZDE] = reader.ReadInt16(); zoneZdx[CollideType.ZDD] = reader.ReadInt16(); zoneZdx[CollideType.ZDR] = reader.ReadInt16(); - off_transitions = Pointer.Read(reader); // Points to animation data, incl name + off_transitions = LegacyPointer.Read(reader); // Points to animation data, incl name num_transitions = reader.ReadUInt32(); - off_state_auto = Pointer.Read(reader); - if (Settings.s.game != Settings.Game.RRush) { - off_18 = Pointer.Read(reader); + off_state_auto = LegacyPointer.Read(reader); + if (Legacy_Settings.s.game != Legacy_Settings.Game.RRush) { + off_18 = LegacyPointer.Read(reader); } byte_1C = reader.ReadByte(); speed = reader.ReadByte(); // Usually 30, but can also be 20, 40, 60, 35 diff --git a/Assets/Scripts/OpenSpace/PS1/PO/ObjectsTable.cs b/Assets/Scripts/OpenSpace/PS1/PO/ObjectsTable.cs index 773e2a9e..1fb60776 100644 --- a/Assets/Scripts/OpenSpace/PS1/PO/ObjectsTable.cs +++ b/Assets/Scripts/OpenSpace/PS1/PO/ObjectsTable.cs @@ -38,7 +38,7 @@ protected override void ReadInternal(Reader reader) { public void ReadExtra(Reader reader, uint count) { Array.Resize(ref entries, (int)(length + count)); - Pointer.DoAt(ref reader, Offset + 8 + (8 * length.Value), () => { + LegacyPointer.DoAt(ref reader, Offset + 8 + (8 * length.Value), () => { //Load.print(Pointer.Current(reader) + " - " + count); for (int i = (int)length; i < entries.Length; i++) { entries[i] = new Entry(); @@ -49,17 +49,17 @@ public void ReadExtra(Reader reader, uint count) { } public class Entry { - public Pointer offset; + public LegacyPointer offset; - public Pointer off_0; // object of 0x50, 5 rows of 0x10 - public Pointer off_geo; + public LegacyPointer off_0; // object of 0x50, 5 rows of 0x10 + public LegacyPointer off_geo; public GeometricObject geo; public void Read(Reader reader) { - offset = Pointer.Current(reader); + offset = LegacyPointer.Current(reader); - off_0 = Pointer.Read(reader); - off_geo = Pointer.Read(reader); + off_0 = LegacyPointer.Read(reader); + off_geo = LegacyPointer.Read(reader); geo = Load.FromOffsetOrRead(reader, off_geo); } public GameObject GetGameObject(PhysicalObjectCollisionMapping[] collision, out GameObject[] bones, Entry morphEntry = null, float morphProgress = 0f) { diff --git a/Assets/Scripts/OpenSpace/PS1/PO/SkinnableGeometricObjectList.cs b/Assets/Scripts/OpenSpace/PS1/PO/SkinnableGeometricObjectList.cs index ba5b4ba7..3d1209fa 100644 --- a/Assets/Scripts/OpenSpace/PS1/PO/SkinnableGeometricObjectList.cs +++ b/Assets/Scripts/OpenSpace/PS1/PO/SkinnableGeometricObjectList.cs @@ -8,8 +8,8 @@ namespace OpenSpace.PS1 { public class SkinnableGeometricObjectList : OpenSpaceStruct { - public Pointer off_entries; - public Pointer off_skin_memory; + public LegacyPointer off_entries; + public LegacyPointer off_skin_memory; public uint sz_skin_memory; // Parsed @@ -18,8 +18,8 @@ public class SkinnableGeometricObjectList : OpenSpaceStruct { public uint length; protected override void ReadInternal(Reader reader) { - off_entries = Pointer.Read(reader); - off_skin_memory = Pointer.Read(reader); + off_entries = LegacyPointer.Read(reader); + off_skin_memory = LegacyPointer.Read(reader); sz_skin_memory = reader.ReadUInt32(); geometricObjects = Load.FromOffsetOrRead>(reader, off_entries, onPreRead: l => l.length = length); diff --git a/Assets/Scripts/OpenSpace/PS1/PS1GameInfo.cs b/Assets/Scripts/OpenSpace/PS1/PS1GameInfo.cs index 9a6a4ce2..93a130ef 100644 --- a/Assets/Scripts/OpenSpace/PS1/PS1GameInfo.cs +++ b/Assets/Scripts/OpenSpace/PS1/PS1GameInfo.cs @@ -1,8 +1,13 @@ using System; using System.Collections.Generic; +using System.IO; using System.Linq; using System.Text; using System.Threading.Tasks; +using BinarySerializer; +using BinarySerializer.Ubisoft.CPA.PS1; +using BinarySerializer.Unity; +using Raymap; namespace OpenSpace.PS1 { @@ -43,6 +48,8 @@ public enum Type { public uint baseLBA; public Type type = Type.Map; + public string BigFilePath => $"{bigfile}.{extension}"; + public class MemoryBlock { public uint address; // Base address for level data public bool hasSoundEffects; @@ -58,6 +65,7 @@ public class MemoryBlock { public uint? overrideActor1Address; public uint? overrideActor2Address; public ushort cineOffset; + public int vignettes = 1; public MemoryBlock(uint address, bool hasSoundEffects, LBA main_compressed, LBA overlay_game, LBA overlay_cine, LBA[] cutscenes = null, bool inEngine = true) { this.address = address; @@ -279,6 +287,61 @@ public LBA(uint lba, uint size, string name = null) { } }; + // Checked for SCUS_94599, SCED-03458, SCED_02636 + public static PS1GameInfo R2_PS1_Demo = new PS1GameInfo() { + maps = new string[] { + "batam_10", + "chase_10", + }, + cines = new Dictionary() { + { "batam_10", new string[] { "batam10a", "batam10b", "batam10c", "batam10d" } }, + }, + files = new File[] { + new File() { + fileID = 0, + bigfile = "COMBIN", + extension = "DAT", + baseLBA = 0x1F4, + memoryBlocks = new File.MemoryBlock[] { + new File.MemoryBlock(0x8010F388, false, new File.LBA(0x1F4, 0x1F6), new File.LBA(0x3EA, 0x45000), new File.LBA(0x0, 0x0), new File.LBA[] { new File.LBA(0x474, 0x344800), new File.LBA(0xAFD, 0x375800), new File.LBA(0x11E8, 0x17A800), new File.LBA(0x14DD, 0x163000), }) { + cineOffset = 0x32, + vignettes = 4, + }, + new File.MemoryBlock(0x800CB240, true, new File.LBA(0x17A3, 0x34C), new File.LBA(0x1AEF, 0x36000), new File.LBA(0x0, 0x0), new File.LBA[] { }) { + vignettes = 3, + }, + } + } + } + }; + + public static PS1GameInfo R2_PS1_Demo_SLUS_90095 = new PS1GameInfo() { + maps = new string[] { + "batam_10", + "chase_10", + }, + cines = new Dictionary() { + { "batam_10", new string[] { "batam10a", "batam10b", "batam10c", "batam10d" } }, + }, + files = new File[] { + new File() { + fileID = 0, + bigfile = "COMBIN", + extension = "DAT", + baseLBA = 0x1F4, + memoryBlocks = new File.MemoryBlock[] { + new File.MemoryBlock(0x8010F388, false, new File.LBA(0x1F4, 0x1F5), new File.LBA(0x3E9, 0x45000), new File.LBA(0x0, 0x0), new File.LBA[] { new File.LBA(0x473, 0x344800), new File.LBA(0xAFC, 0x375800), new File.LBA(0x11E7, 0x17A800), new File.LBA(0x14DC, 0x163000), }) { + cineOffset = 0x32, + vignettes = 4, + }, + new File.MemoryBlock(0x800CB240, true, new File.LBA(0x17A2, 0x34C), new File.LBA(0x1AEE, 0x36000), new File.LBA(0x0, 0x0), new File.LBA[] { }) { + vignettes = 3, + }, + } + } + } + }; + public static PS1GameInfo DD_PS1_US = new PS1GameInfo() { maps = new string[] { "warproom", @@ -797,12 +860,60 @@ public LBA(uint lba, uint size, string name = null) { } }; - public static Dictionary Games = new Dictionary() { - { Settings.Mode.Rayman2PS1, R2_PS1_US }, - { Settings.Mode.RaymanRushPS1, RR_PS1_US }, - { Settings.Mode.DonaldDuckPS1, DD_PS1_US }, - { Settings.Mode.VIPPS1, VIP_PS1_US }, - { Settings.Mode.JungleBookPS1, JB_PS1_US }, + public static Dictionary Games = new Dictionary() { + { Legacy_Settings.Mode.Rayman2PS1, R2_PS1_US }, + { Legacy_Settings.Mode.Rayman2PS1Demo, R2_PS1_Demo }, + { Legacy_Settings.Mode.Rayman2PS1Demo_SLUS_90095, R2_PS1_Demo_SLUS_90095 }, + { Legacy_Settings.Mode.RaymanRushPS1, RR_PS1_US }, + { Legacy_Settings.Mode.DonaldDuckPS1, DD_PS1_US }, + { Legacy_Settings.Mode.VIPPS1, VIP_PS1_US }, + { Legacy_Settings.Mode.JungleBookPS1, JB_PS1_US }, }; + + public static void GenerateR2Table(string exeFilePath, uint offset, long count) + { + using MapViewerContext context = new(new MapViewerSettings(GameModeSelection.Rayman2PS1, Path.GetDirectoryName(exeFilePath), String.Empty)); + LinearFile file = context.AddFile(new LinearFile(context, Path.GetFileName(exeFilePath))); + var refs = FileFactory.Read>(context, file.StartPointer + offset, + (_, x) => x.Pre_Length = count); + + StringBuilder str = new(); + + str.AppendLine(@"public static PS1GameInfo GAME_NAME = new PS1GameInfo() {"); + str.AppendLine(@" maps = new string[] {"); + str.AppendLine(@" },"); + str.AppendLine(@" cines = new Dictionary() {"); + str.AppendLine(@" },"); + str.AppendLine(@" files = new File[] {"); + str.AppendLine(@" new File() {"); + str.AppendLine(@" fileID = 0,"); + str.AppendLine(@" bigfile = ""COMBIN"","); + str.AppendLine(@" extension = ""DAT"","); + str.AppendLine(@$" baseLBA = 0x{refs.Value.First().Main.LBA:X},"); + str.AppendLine(@" memoryBlocks = new File.MemoryBlock[] {"); + + foreach (PackedFileArchiveReference r in refs.Value) + { + const string ind = " "; + str.Append($@"{ind}new File.MemoryBlock(0x{r.Destination:X8}, {(r.Uint_0C == 0 ? "false" : "true")}"); + str.Append($@", new File.LBA(0x{r.Main.LBA:X}, 0x{r.Main.Length:X})"); + str.Append($@", new File.LBA(0x{r.OverlayGame.LBA:X}, 0x{r.OverlayGame.Length:X})"); + str.Append($@", new File.LBA(0x{r.OverlayCine.LBA:X}, 0x{r.OverlayCine.Length:X})"); + str.Append(@", new File.LBA[] { "); + + foreach (PackedFileArchiveReference.BlockRef cine in r.Cinematics.TakeWhile(x => x.LBA != 0 && x.Length != 0)) + str.Append(@$"new File.LBA(0x{cine.LBA:X}, 0x{cine.Length:X}), "); + + str.Append(@"}) { cineOffset = 0x1E },"); + str.AppendLine(); + } + + str.AppendLine(@" }"); + str.AppendLine(@" }"); + str.AppendLine(@" }"); + str.AppendLine(@"};"); + + str.ToString().CopyToClipboard(); + } } } diff --git a/Assets/Scripts/OpenSpace/PS1/SECT/NeighborSector.cs b/Assets/Scripts/OpenSpace/PS1/SECT/NeighborSector.cs index d30a5d28..8f141ead 100644 --- a/Assets/Scripts/OpenSpace/PS1/SECT/NeighborSector.cs +++ b/Assets/Scripts/OpenSpace/PS1/SECT/NeighborSector.cs @@ -7,7 +7,7 @@ namespace OpenSpace.PS1 { public class NeighborSector : OpenSpaceStruct { - public Pointer off_sectorSO; + public LegacyPointer off_sectorSO; public short word04; public short word06; @@ -24,8 +24,8 @@ public Sector Sector { } protected override void ReadInternal(Reader reader) { - off_sectorSO = Pointer.Read(reader); - if (Settings.s.game != Settings.Game.DD && Settings.s.game != Settings.Game.JungleBook) { + off_sectorSO = LegacyPointer.Read(reader); + if (Legacy_Settings.s.game != Legacy_Settings.Game.DD && Legacy_Settings.s.game != Legacy_Settings.Game.JungleBook) { word04 = reader.ReadInt16(); word06 = reader.ReadInt16(); } diff --git a/Assets/Scripts/OpenSpace/PS1/SECT/Sector.cs b/Assets/Scripts/OpenSpace/PS1/SECT/Sector.cs index cdf1e299..439457a2 100644 --- a/Assets/Scripts/OpenSpace/PS1/SECT/Sector.cs +++ b/Assets/Scripts/OpenSpace/PS1/SECT/Sector.cs @@ -8,13 +8,13 @@ namespace OpenSpace.PS1 { public class Sector : OpenSpaceStruct { - public Pointer off_persos; - public Pointer off_graphicSectors; - public Pointer off_collisionSectors; - public Pointer off_activitySectors; - public Pointer off_10; - public Pointer off_ipos; - public Pointer off_18; + public LegacyPointer off_persos; + public LegacyPointer off_graphicSectors; + public LegacyPointer off_collisionSectors; + public LegacyPointer off_activitySectors; + public LegacyPointer off_10; + public LegacyPointer off_ipos; + public LegacyPointer off_18; public int minX; public int minY; public int minZ; @@ -37,7 +37,7 @@ public class Sector : OpenSpaceStruct { public ushort vip_ushort_08; public ushort vip_ushort_0A; public uint vip_uint_0C; - public Pointer off_so; + public LegacyPointer off_so; // Parsed public uint[] persos; @@ -47,21 +47,21 @@ public class Sector : OpenSpaceStruct { protected override void ReadInternal(Reader reader) { Load.print("Sector @ " + Offset); - off_persos = Pointer.Read(reader); - off_graphicSectors = Pointer.Read(reader); - if (Settings.s.game != Settings.Game.R2 && Settings.s.game != Settings.Game.RRush) { + off_persos = LegacyPointer.Read(reader); + off_graphicSectors = LegacyPointer.Read(reader); + if (Legacy_Settings.s.game != Legacy_Settings.Game.R2 && Legacy_Settings.s.game != Legacy_Settings.Game.RRush) { vip_ushort_08 = reader.ReadUInt16(); vip_ushort_0A = reader.ReadUInt16(); vip_uint_0C = reader.ReadUInt32(); } - off_collisionSectors = Pointer.Read(reader); - off_activitySectors = Pointer.Read(reader); - off_10 = Pointer.Read(reader); // Sound sectors? - off_ipos = Pointer.Read(reader); - if (Settings.s.game != Settings.Game.R2 && Settings.s.game != Settings.Game.RRush) { + off_collisionSectors = LegacyPointer.Read(reader); + off_activitySectors = LegacyPointer.Read(reader); + off_10 = LegacyPointer.Read(reader); // Sound sectors? + off_ipos = LegacyPointer.Read(reader); + if (Legacy_Settings.s.game != Legacy_Settings.Game.R2 && Legacy_Settings.s.game != Legacy_Settings.Game.RRush) { int_50 = reader.ReadInt32(); } else { - off_18 = Pointer.Read(reader); + off_18 = LegacyPointer.Read(reader); } minX = reader.ReadInt32(); minY = reader.ReadInt32(); @@ -76,52 +76,52 @@ protected override void ReadInternal(Reader reader) { short_42 = reader.ReadInt16(); short_44 = reader.ReadInt16(); short_46 = reader.ReadInt16(); - if (Settings.s.game != Settings.Game.JungleBook && Settings.s.game != Settings.Game.VIP) { + if (Legacy_Settings.s.game != Legacy_Settings.Game.JungleBook && Legacy_Settings.s.game != Legacy_Settings.Game.VIP) { short_48 = reader.ReadInt16(); short_4A = reader.ReadInt16(); int_4C = reader.ReadInt32(); - if (Settings.s.game == Settings.Game.R2 - || Settings.s.game == Settings.Game.RRush) { + if (Legacy_Settings.s.game == Legacy_Settings.Game.R2 + || Legacy_Settings.s.game == Legacy_Settings.Game.RRush) { int_50 = reader.ReadInt32(); } } else { int_4C = reader.ReadInt32(); int_50 = reader.ReadInt32(); - off_so = Pointer.Read(reader); + off_so = LegacyPointer.Read(reader); } - Pointer.DoAt(ref reader, off_persos, () => { + LegacyPointer.DoAt(ref reader, off_persos, () => { uint length = reader.ReadUInt32(); if (length > 0) { - Pointer off_array = Pointer.Read(reader); + LegacyPointer off_array = LegacyPointer.Read(reader); Load.print("Persos: " + length); } }); - Pointer.DoAt(ref reader, off_ipos, () => { + LegacyPointer.DoAt(ref reader, off_ipos, () => { uint length = reader.ReadUInt32(); if (length > 1) { - Pointer off_array = Pointer.Read(reader); + LegacyPointer off_array = LegacyPointer.Read(reader); Load.print("IPOs: " + length); } }); - Pointer.DoAt(ref reader, off_graphicSectors, () => { + LegacyPointer.DoAt(ref reader, off_graphicSectors, () => { uint length = reader.ReadUInt32(); if (length > 0) { - Pointer off_array = Pointer.Read(reader); + LegacyPointer off_array = LegacyPointer.Read(reader); graphicSectors = Load.ReadArray(length, reader, off_array); } }); - Pointer.DoAt(ref reader, off_collisionSectors, () => { + LegacyPointer.DoAt(ref reader, off_collisionSectors, () => { uint length = reader.ReadUInt32(); if (length > 0) { - Pointer off_array = Pointer.Read(reader); + LegacyPointer off_array = LegacyPointer.Read(reader); collisionSectors = Load.ReadArray(length, reader, off_array); } }); - Pointer.DoAt(ref reader, off_activitySectors, () => { + LegacyPointer.DoAt(ref reader, off_activitySectors, () => { uint length = reader.ReadUInt32(); if (length > 0) { - Pointer off_array = Pointer.Read(reader); + LegacyPointer off_array = LegacyPointer.Read(reader); activitySectors = Load.ReadArray(length, reader, off_array); } }); diff --git a/Assets/Scripts/OpenSpace/PS1/WAY/Arc.cs b/Assets/Scripts/OpenSpace/PS1/WAY/Arc.cs index 67c1808d..3ca70827 100644 --- a/Assets/Scripts/OpenSpace/PS1/WAY/Arc.cs +++ b/Assets/Scripts/OpenSpace/PS1/WAY/Arc.cs @@ -6,8 +6,8 @@ namespace OpenSpace.PS1 { public class Arc : OpenSpaceStruct { - public Pointer off_node1; - public Pointer off_node2; + public LegacyPointer off_node1; + public LegacyPointer off_node2; public uint uint_08; public ushort ushort_0C; public ushort ushort_0E; @@ -16,8 +16,8 @@ public class Arc : OpenSpaceStruct { public WayPoint node2; protected override void ReadInternal(Reader reader) { - off_node1 = Pointer.Read(reader); - off_node2 = Pointer.Read(reader); + off_node1 = LegacyPointer.Read(reader); + off_node2 = LegacyPointer.Read(reader); uint_08 = reader.ReadUInt32(); ushort_0C = reader.ReadUInt16(); ushort_0E = reader.ReadUInt16(); diff --git a/Assets/Scripts/OpenSpace/PS1/WAY/Graph.cs b/Assets/Scripts/OpenSpace/PS1/WAY/Graph.cs index 2626a05b..b79be21c 100644 --- a/Assets/Scripts/OpenSpace/PS1/WAY/Graph.cs +++ b/Assets/Scripts/OpenSpace/PS1/WAY/Graph.cs @@ -7,8 +7,8 @@ namespace OpenSpace.PS1 { public class Graph : OpenSpaceStruct { public uint num_arcs; - public Pointer off_firstNode; - public Pointer off_arcs; + public LegacyPointer off_firstNode; + public LegacyPointer off_arcs; public uint num_nodes; public byte[] unkBytes; @@ -22,8 +22,8 @@ protected override void ReadInternal(Reader reader) { reader.ReadUInt32(); reader.ReadUInt32(); } else { - off_firstNode = Pointer.Read(reader); - off_arcs = Pointer.Read(reader); + off_firstNode = LegacyPointer.Read(reader); + off_arcs = LegacyPointer.Read(reader); } num_nodes = reader.ReadUInt32(); unkBytes = reader.ReadBytes(0x58); diff --git a/Assets/Scripts/OpenSpace/ROM/FATEntry.cs b/Assets/Scripts/OpenSpace/ROM/FATEntry.cs index d4d141cc..c9351ae0 100644 --- a/Assets/Scripts/OpenSpace/ROM/FATEntry.cs +++ b/Assets/Scripts/OpenSpace/ROM/FATEntry.cs @@ -6,7 +6,7 @@ namespace OpenSpace.ROM { public class FATEntry { - public Pointer offset; + public LegacyPointer offset; public uint off_data; public ushort type; public ushort index; @@ -16,7 +16,7 @@ public class FATEntry { public uint entryIndexWithinTable; public uint size; - public static FATEntry Read(Reader reader, Pointer offset) { + public static FATEntry Read(Reader reader, LegacyPointer offset) { FATEntry entry = new FATEntry(); entry.offset = offset; entry.off_data = reader.ReadUInt32(); @@ -582,9 +582,9 @@ public Type EntryType { public static Type GetEntryType(ushort type) { Dictionary dict = null; - switch (Settings.s.platform) { - case Settings.Platform._3DS: dict = Types3DS; break; - case Settings.Platform.N64: dict = TypesN64; break; + switch (Legacy_Settings.s.platform) { + case Legacy_Settings.Platform._3DS: dict = Types3DS; break; + case Legacy_Settings.Platform.N64: dict = TypesN64; break; default: dict = TypesDS; break; } if (dict.ContainsKey(type)) { diff --git a/Assets/Scripts/OpenSpace/ROM/FATTable.cs b/Assets/Scripts/OpenSpace/ROM/FATTable.cs index ff890a31..66eda389 100644 --- a/Assets/Scripts/OpenSpace/ROM/FATTable.cs +++ b/Assets/Scripts/OpenSpace/ROM/FATTable.cs @@ -6,16 +6,16 @@ namespace OpenSpace.ROM { public class FATTable { - public Pointer offset; - public Pointer off_table; + public LegacyPointer offset; + public LegacyPointer off_table; public uint num_entries; public FATEntry[] entries = new FATEntry[0]; public Dictionary> entriesDict = new Dictionary>(); - public static FATTable Read(Reader reader, Pointer offset, bool readEntries = true) { + public static FATTable Read(Reader reader, LegacyPointer offset, bool readEntries = true) { FATTable t = new FATTable(); t.offset = offset; - t.off_table = Pointer.Read(reader); + t.off_table = LegacyPointer.Read(reader); t.num_entries = reader.ReadUInt32(); if (readEntries) { t.ReadEntries(reader); @@ -25,9 +25,9 @@ public static FATTable Read(Reader reader, Pointer offset, bool readEntries = tr public void ReadEntries(Reader reader) { entries = new FATEntry[num_entries]; - Pointer.DoAt(ref reader, off_table, () => { + LegacyPointer.DoAt(ref reader, off_table, () => { for (int i = 0; i < entries.Length; i++) { - entries[i] = FATEntry.Read(reader, Pointer.Current(reader)); + entries[i] = FATEntry.Read(reader, LegacyPointer.Current(reader)); entries[i].entryIndexWithinTable = (uint)i; AddEntryToDict(entries[i]); } diff --git a/Assets/Scripts/OpenSpace/ROM/ROMStruct.cs b/Assets/Scripts/OpenSpace/ROM/ROMStruct.cs index 3108c0a5..c0cd91d3 100644 --- a/Assets/Scripts/OpenSpace/ROM/ROMStruct.cs +++ b/Assets/Scripts/OpenSpace/ROM/ROMStruct.cs @@ -7,17 +7,17 @@ namespace OpenSpace.ROM { public abstract class ROMStruct { - public Pointer Offset { get; protected set; } + public LegacyPointer Offset { get; protected set; } public ushort Index { get; protected set; } public string IndexString { get { return string.Format("{0:X4}", Index); } } - public void Init(Pointer offset, ushort index) { + public void Init(LegacyPointer offset, ushort index) { this.Offset = offset; this.Index = index; } protected abstract void ReadInternal(Reader reader); public void Read(Reader reader) { - Pointer.DoAt(ref reader, Offset, () => { + LegacyPointer.DoAt(ref reader, Offset, () => { ReadInternal(reader); }); } diff --git a/Assets/Scripts/OpenSpace/ROM/Scripts/TranslatedROMScript.cs b/Assets/Scripts/OpenSpace/ROM/Scripts/TranslatedROMScript.cs index f2451dda..514ddd30 100644 --- a/Assets/Scripts/OpenSpace/ROM/Scripts/TranslatedROMScript.cs +++ b/Assets/Scripts/OpenSpace/ROM/Scripts/TranslatedROMScript.cs @@ -50,7 +50,7 @@ public string ToString(Perso perso) { string secondChildNode = (this.children.Count > 1 && this.children[1] != null) ? this.children[1].ToString() : "null"; string prefix = (ts.printAddresses ? "{" + scriptNode.offset + "}" : ""); - AITypes aiTypes = Settings.s.aiTypes; + AITypes aiTypes = Legacy_Settings.s.aiTypes; uint param = scriptNode.param; switch (scriptNode.nodeType) { diff --git a/Assets/Scripts/OpenSpace/ROM/Structs/AI/DsgVarEntry.cs b/Assets/Scripts/OpenSpace/ROM/Structs/AI/DsgVarEntry.cs index ccea1806..b8f40744 100644 --- a/Assets/Scripts/OpenSpace/ROM/Structs/AI/DsgVarEntry.cs +++ b/Assets/Scripts/OpenSpace/ROM/Structs/AI/DsgVarEntry.cs @@ -21,12 +21,12 @@ protected override void ReadInternal(Reader reader) { param = reader.ReadUInt16(); // 0x00 // Read different types of param - Pointer.Goto(ref reader, Offset); paramByte = reader.ReadSByte(); - Pointer.Goto(ref reader, Offset); paramUByte = reader.ReadByte(); - Pointer.Goto(ref reader, Offset); paramShort = reader.ReadInt16(); - Pointer.Goto(ref reader, Offset); paramUInt = reader.ReadUInt32(); - Pointer.Goto(ref reader, Offset); paramInt = reader.ReadInt32(); - Pointer.Goto(ref reader, Offset); paramFloat = reader.ReadSingle(); + LegacyPointer.Goto(ref reader, Offset); paramByte = reader.ReadSByte(); + LegacyPointer.Goto(ref reader, Offset); paramUByte = reader.ReadByte(); + LegacyPointer.Goto(ref reader, Offset); paramShort = reader.ReadInt16(); + LegacyPointer.Goto(ref reader, Offset); paramUInt = reader.ReadUInt32(); + LegacyPointer.Goto(ref reader, Offset); paramInt = reader.ReadInt32(); + LegacyPointer.Goto(ref reader, Offset); paramFloat = reader.ReadSingle(); index_of_entry = reader.ReadUInt16(); // 0x04 index_in_array = reader.ReadUInt16(); // 0x06 diff --git a/Assets/Scripts/OpenSpace/ROM/Structs/AI/DsgVarInfo.cs b/Assets/Scripts/OpenSpace/ROM/Structs/AI/DsgVarInfo.cs index d3d9b25b..0b23b04b 100644 --- a/Assets/Scripts/OpenSpace/ROM/Structs/AI/DsgVarInfo.cs +++ b/Assets/Scripts/OpenSpace/ROM/Structs/AI/DsgVarInfo.cs @@ -32,11 +32,11 @@ public class Entry { public ushort offsetInBuffer; // Custom - public Pointer offset; + public LegacyPointer offset; public DsgVarValue value; public Entry(Reader reader, ushort index_of_info) { - offset = Pointer.Current(reader); + offset = LegacyPointer.Current(reader); type = reader.ReadUInt16(); value = new DsgVarValue(index_of_info, type); diff --git a/Assets/Scripts/OpenSpace/ROM/Structs/AI/DsgVarValue.cs b/Assets/Scripts/OpenSpace/ROM/Structs/AI/DsgVarValue.cs index 400234eb..1cc9153f 100644 --- a/Assets/Scripts/OpenSpace/ROM/Structs/AI/DsgVarValue.cs +++ b/Assets/Scripts/OpenSpace/ROM/Structs/AI/DsgVarValue.cs @@ -12,7 +12,7 @@ public class DsgVarValue { // Custom public DsgVarType dsgVarType; - public Pointer offset; + public LegacyPointer offset; public int index; // Parsed param @@ -38,13 +38,13 @@ public DsgVarValue(ushort index_of_info, ushort type) { this.type = type; } public void Read(Reader reader) { - offset = Pointer.Current(reader); + offset = LegacyPointer.Current(reader); param = reader.ReadUInt16(); // Read different types of param - Pointer.Goto(ref reader, offset); paramByte = reader.ReadSByte(); - Pointer.Goto(ref reader, offset); paramUByte = reader.ReadByte(); - Pointer.Goto(ref reader, offset); paramShort = reader.ReadInt16(); + LegacyPointer.Goto(ref reader, offset); paramByte = reader.ReadSByte(); + LegacyPointer.Goto(ref reader, offset); paramUByte = reader.ReadByte(); + LegacyPointer.Goto(ref reader, offset); paramShort = reader.ReadInt16(); Parse(reader); } @@ -60,7 +60,7 @@ private void Parse(Reader reader) { index = paramEntry.Value.index_of_entry; usedParam = paramEntry.Value.param; } - if (Settings.s.aiTypes != null) dsgVarType = Settings.s.aiTypes.GetDsgVarType(typeNumber); + if (Legacy_Settings.s.aiTypes != null) dsgVarType = Legacy_Settings.s.aiTypes.GetDsgVarType(typeNumber); if (paramEntry == null) { // If paramEntry exists, all params <= 4 bytes, so until float, should be read from paramEntry. // eg. instead of using paramUInt, you use paramEntry.Value.paramUInt diff --git a/Assets/Scripts/OpenSpace/ROM/Structs/AI/ScriptNodeArray.cs b/Assets/Scripts/OpenSpace/ROM/Structs/AI/ScriptNodeArray.cs index 81f6a659..b77d76d5 100644 --- a/Assets/Scripts/OpenSpace/ROM/Structs/AI/ScriptNodeArray.cs +++ b/Assets/Scripts/OpenSpace/ROM/Structs/AI/ScriptNodeArray.cs @@ -32,7 +32,7 @@ public class ScriptNode { // Custom public NodeType nodeType; - public Pointer offset; + public LegacyPointer offset; // Parsed param public Reference paramInt; @@ -54,14 +54,14 @@ public class ScriptNode { public Reference paramButton; public ScriptNode(Reader reader) { - offset = Pointer.Current(reader); + offset = LegacyPointer.Current(reader); type = reader.ReadByte(); indent = reader.ReadByte(); param = reader.ReadUInt16(); nodeType = NodeType.Unknown; - if (Settings.s.aiTypes != null) nodeType = Settings.s.aiTypes.GetNodeType(type); + if (Legacy_Settings.s.aiTypes != null) nodeType = Legacy_Settings.s.aiTypes.GetNodeType(type); switch (nodeType) { case NodeType.GraphRef: @@ -138,7 +138,7 @@ public string ToString(Perso perso, TranslatedROMScript.TranslationSettings ts, R2ROMLoader l = Loader; short mask = 0; - AITypes aiTypes = Settings.s.aiTypes; + AITypes aiTypes = Legacy_Settings.s.aiTypes; Vector3 vector3 = new Vector3 { x = 0, y = 0, z = 0 }; switch (nodeType) { diff --git a/Assets/Scripts/OpenSpace/ROM/Structs/ANIM/Component/AnimChannel.cs b/Assets/Scripts/OpenSpace/ROM/Structs/ANIM/Component/AnimChannel.cs index 9b2dcf91..67a29905 100644 --- a/Assets/Scripts/OpenSpace/ROM/Structs/ANIM/Component/AnimChannel.cs +++ b/Assets/Scripts/OpenSpace/ROM/Structs/ANIM/Component/AnimChannel.cs @@ -24,7 +24,7 @@ protected void ReadInternal(Reader reader) { public static bool Aligned { get { - if (Settings.s.engineVersion > Settings.EngineVersion.TT) { + if (Legacy_Settings.s.engineVersion > Legacy_Settings.EngineVersion.TT) { return true; } else { return false; diff --git a/Assets/Scripts/OpenSpace/ROM/Structs/ANIM/Component/AnimVector.cs b/Assets/Scripts/OpenSpace/ROM/Structs/ANIM/Component/AnimVector.cs index aefdb5e2..8f405cdd 100644 --- a/Assets/Scripts/OpenSpace/ROM/Structs/ANIM/Component/AnimVector.cs +++ b/Assets/Scripts/OpenSpace/ROM/Structs/ANIM/Component/AnimVector.cs @@ -13,7 +13,7 @@ public AnimVector(Reader reader) { } protected void ReadInternal(Reader reader) { - if (Settings.s.platform == Settings.Platform.N64) { + if (Legacy_Settings.s.platform == Legacy_Settings.Platform.N64) { float x = reader.ReadSingle(); float z = reader.ReadSingle(); float y = reader.ReadSingle(); diff --git a/Assets/Scripts/OpenSpace/ROM/Structs/ANIM/ROMAnimation.cs b/Assets/Scripts/OpenSpace/ROM/Structs/ANIM/ROMAnimation.cs index 2980b8f8..705aed45 100644 --- a/Assets/Scripts/OpenSpace/ROM/Structs/ANIM/ROMAnimation.cs +++ b/Assets/Scripts/OpenSpace/ROM/Structs/ANIM/ROMAnimation.cs @@ -50,7 +50,7 @@ public void ReadData() { if (data != null && data.Length > 0) { //Util.ByteArrayToFile(MapLoader.Loader.gameDataBinFolder + "exported_anims/anim_" + index + ".bin", data); using (MemoryStream ms = new MemoryStream(data)) { - using (Reader r = new Reader(ms, Settings.s.IsLittleEndian)) { + using (Reader r = new Reader(ms, Legacy_Settings.s.IsLittleEndian)) { a3d = new AnimA3DGeneral(r); vectors = new AnimVector[a3d.num_vectors]; quaternions = new AnimQuaternion[a3d.num_quaternions]; diff --git a/Assets/Scripts/OpenSpace/ROM/Structs/GEO/DS3D/GeometryParser.cs b/Assets/Scripts/OpenSpace/ROM/Structs/GEO/DS3D/GeometryParser.cs index a5901c65..0fb7c25e 100644 --- a/Assets/Scripts/OpenSpace/ROM/Structs/GEO/DS3D/GeometryParser.cs +++ b/Assets/Scripts/OpenSpace/ROM/Structs/GEO/DS3D/GeometryParser.cs @@ -11,14 +11,14 @@ public class GeometryParser { private static uint extractBits(uint number, int count, int offset) { return (uint)(((1 << count) - 1) & (number >> (offset))); } - public static byte[] Decompress(byte[] compressed) { + public static byte[] Decompress(byte[] compressed) { // MI_UncompressLZ8 byte[] data = new byte[compressed.Length]; Array.Copy(compressed, data, compressed.Length); uint src = 0, dst = 0; byte compressionType = compressed[0]; uint size = 0; using (MemoryStream str = new MemoryStream(compressed)) { - using (Reader reader = new Reader(str, Settings.s.IsLittleEndian)) { + using (Reader reader = new Reader(str, Legacy_Settings.s.IsLittleEndian)) { size = reader.ReadUInt32(); size = extractBits(size, 24, 8); } @@ -116,7 +116,7 @@ public static GeometryCommand[] ReadCommands(byte[] data) { data = Decompress(data); }*/ using (MemoryStream str = new MemoryStream(data)) { - using (Reader dataReader = new Reader(str, Settings.s.IsLittleEndian)) { + using (Reader dataReader = new Reader(str, Legacy_Settings.s.IsLittleEndian)) { while (dataReader.BaseStream.Position < data.Length) { byte com0 = dataReader.ReadByte(); byte com1 = dataReader.ReadByte(); diff --git a/Assets/Scripts/OpenSpace/ROM/Structs/GEO/GeometricObject.cs b/Assets/Scripts/OpenSpace/ROM/Structs/GEO/GeometricObject.cs index 39c64c1f..3f033311 100644 --- a/Assets/Scripts/OpenSpace/ROM/Structs/GEO/GeometricObject.cs +++ b/Assets/Scripts/OpenSpace/ROM/Structs/GEO/GeometricObject.cs @@ -33,14 +33,14 @@ protected override void ReadInternal(Reader reader) { scaleFactor = reader.ReadSingle(); factor_1 = reader.ReadSingle(); verticesCollide = new Reference(reader); - if (Settings.s.platform == Settings.Platform._3DS) { + if (Legacy_Settings.s.platform == Legacy_Settings.Platform._3DS) { verticesVisual = new Reference(reader); normals = new Reference(reader); } elementsCollide = new Reference(reader); elementsVisual = new Reference(reader); num_verticesCollide = reader.ReadUInt16(); - if (Settings.s.platform == Settings.Platform._3DS) { + if (Legacy_Settings.s.platform == Legacy_Settings.Platform._3DS) { num_verticesVisual = reader.ReadUInt16(); } num_elementsCollide = reader.ReadUInt16(); @@ -51,7 +51,7 @@ protected override void ReadInternal(Reader reader) { lookAtMode = reader.ReadUInt16(); //MapLoader.Loader.print("Vertices: " + num_vectors_1 + " or " + string.Format("{0:X4}", num_vectors_1)); - if (Settings.s.platform != Settings.Platform._3DS) { + if (Legacy_Settings.s.platform != Legacy_Settings.Platform._3DS) { num_verticesVisual = num_verticesCollide; /*verticesCollide = normals; verticesVisual = normals;*/ @@ -81,7 +81,7 @@ public GameObject GetGameObject(Type type, CollideType collideType = CollideType if (type == Type.Visual) { if (elementsVisual.Value != null) { // First, reset vertex buffer - if (Settings.s.platform == Settings.Platform.N64) { + if (Legacy_Settings.s.platform == Legacy_Settings.Platform.N64) { foreach (GeometricObjectElementVisualList.GeometricElementListEntry entry in elementsVisual.Value.elements) { if (entry.element.Value is GeometricObjectElementTriangles) { GeometricObjectElementTriangles el = entry.element.Value as GeometricObjectElementTriangles; @@ -145,7 +145,7 @@ public GameObject GetGameObject(Type type, CollideType collideType = CollideType public void MorphVertices(GameObject gao, GeometricObject go, float lerp) { // First, reset vertex buffer - if (Settings.s.platform == Settings.Platform.N64) { + if (Legacy_Settings.s.platform == Legacy_Settings.Platform.N64) { foreach (GeometricObjectElementVisualList.GeometricElementListEntry entry in elementsVisual.Value.elements) { if (entry.element.Value is GeometricObjectElementTriangles) { GeometricObjectElementTriangles el = entry.element.Value as GeometricObjectElementTriangles; @@ -170,7 +170,7 @@ public void MorphVertices(GameObject gao, GeometricObject go, float lerp) { public void ResetMorph(GameObject gao) { // First, reset vertex buffer - if (Settings.s.platform == Settings.Platform.N64) { + if (Legacy_Settings.s.platform == Legacy_Settings.Platform.N64) { foreach (GeometricObjectElementVisualList.GeometricElementListEntry entry in elementsVisual.Value.elements) { if (entry.element.Value is GeometricObjectElementTriangles) { GeometricObjectElementTriangles el = entry.element.Value as GeometricObjectElementTriangles; diff --git a/Assets/Scripts/OpenSpace/ROM/Structs/GEO/GeometricObjectElementSprites.cs b/Assets/Scripts/OpenSpace/ROM/Structs/GEO/GeometricObjectElementSprites.cs index 903f4b6b..31625f41 100644 --- a/Assets/Scripts/OpenSpace/ROM/Structs/GEO/GeometricObjectElementSprites.cs +++ b/Assets/Scripts/OpenSpace/ROM/Structs/GEO/GeometricObjectElementSprites.cs @@ -71,7 +71,7 @@ public GameObject GetGameObject(GeometricObject.Type type, GeometricObject go) { normals[2] = Vector3.forward; normals[3] = Vector3.forward; Vector3[] uvs = new Vector3[4]; - if (Settings.s.platform == Settings.Platform.N64) { + if (Legacy_Settings.s.platform == Legacy_Settings.Platform.N64) { uvs[0] = new Vector3(0, - (mirrorY ? 1 : 0), 1); uvs[1] = new Vector3(1 + (mirrorX ? 1 : 0), -(mirrorY ? 1 : 0), 1); uvs[2] = new Vector3(0, 1, 1); diff --git a/Assets/Scripts/OpenSpace/ROM/Structs/GEO/GeometricObjectElementTriangles.cs b/Assets/Scripts/OpenSpace/ROM/Structs/GEO/GeometricObjectElementTriangles.cs index f275ee0e..49871657 100644 --- a/Assets/Scripts/OpenSpace/ROM/Structs/GEO/GeometricObjectElementTriangles.cs +++ b/Assets/Scripts/OpenSpace/ROM/Structs/GEO/GeometricObjectElementTriangles.cs @@ -16,7 +16,7 @@ public class GeometricObjectElementTriangles : ROMStruct { protected override void ReadInternal(Reader reader) { visualMaterial = new Reference(reader, true); - if (Settings.s.platform == Settings.Platform.N64) { + if (Legacy_Settings.s.platform == Legacy_Settings.Platform.N64) { //MapLoader.Loader.print("Triangles: " + Pointer.Current(reader)); triangles = new Reference(reader); vertices = new Reference(reader); @@ -25,8 +25,8 @@ protected override void ReadInternal(Reader reader) { num_triangles = reader.ReadUInt16(); vertices.Resolve(reader, v => v.length = sz_vertices); - } else if (Settings.s.platform == Settings.Platform.DS) { - if (Settings.s.game == Settings.Game.RRR) { + } else if (Legacy_Settings.s.platform == Legacy_Settings.Platform.DS) { + if (Legacy_Settings.s.game == Legacy_Settings.Game.RRR) { unk0 = reader.ReadUInt16(); sz_triangles = reader.ReadUInt16(); triangles = new Reference(reader); @@ -35,7 +35,7 @@ protected override void ReadInternal(Reader reader) { triangles = new Reference(reader); sz_triangles = reader.ReadUInt16(); } - } else if (Settings.s.platform == Settings.Platform._3DS) { + } else if (Legacy_Settings.s.platform == Legacy_Settings.Platform._3DS) { triangles = new Reference(reader); sz_triangles = reader.ReadUInt16(); sz_vertices = reader.ReadUInt16(); @@ -61,7 +61,7 @@ public GameObject GetGameObject(GeometricObject.Type type, GeometricObject go) { MeshFilter mf = gao.AddComponent(); gao.AddComponent(); Mesh mesh = new Mesh(); - if (Settings.s.platform == Settings.Platform._3DS) { + if (Legacy_Settings.s.platform == Legacy_Settings.Platform._3DS) { if (sz_vertices == 0) { mesh.vertices = go.verticesVisual.Value.GetVectors(go.ScaleFactor); if (go.hasVertexColors == 0) { @@ -87,7 +87,7 @@ public GameObject GetGameObject(GeometricObject.Type type, GeometricObject go) { if (go.hasVertexColors != 0) { mesh.RecalculateNormals(); } - } else if (Settings.s.platform == Settings.Platform.N64) { + } else if (Legacy_Settings.s.platform == Legacy_Settings.Platform.N64) { mesh = RSP.RSPParser.Parse(triangles.Value.rspCommands, vertices.Value.vertices, go, backfaceCulling, mr.material); //gao.name += " " + vertices.Value.Offset + " - " + vertices.Value.vertices.Length + " - " + triangles.Value.Offset; /*for (int i = 0; i < mesh.triangles.Length; i++) { @@ -96,7 +96,7 @@ public GameObject GetGameObject(GeometricObject.Type type, GeometricObject go) { //gao.name += " " + go.unk0 + " " + go.unk1 + " " + go.hasVertexColors + " " + go.unk3; //gao.name += " - Verts ( " + sz_vertices + "):" + vertices.Value.Offset + " - Tris ( " + sz_triangles + " ):" + triangles.Value.Offset + " - " + Index + " - " + flags; //gao.name += " - Flags: " + string.Format("{0:X4}", visualMaterial.Value.textures.Value.vmTex[0].texRef.Value.texInfo.Value.flags); - } else if (Settings.s.platform == Settings.Platform.DS) { + } else if (Legacy_Settings.s.platform == Legacy_Settings.Platform.DS) { if (triangles.Value != null) { mesh = DS3D.GeometryParser.Parse(triangles.Value.ds3dCommands, go, backfaceCulling, mr.material); //gao.name += " - Tris ( " + sz_triangles + " ):" + triangles.Value.Offset + " - " + Index + " - " + flags; @@ -123,12 +123,12 @@ public GameObject GetGameObject(GeometricObject.Type type, GeometricObject go) { public void MorphVertices(Mesh mesh, GeometricObjectElementTriangles tris2, GeometricObject go1, GeometricObject go2, float lerp) { CompressedVector3Array v1, v2; - if (Settings.s.platform == Settings.Platform._3DS) { + if (Legacy_Settings.s.platform == Legacy_Settings.Platform._3DS) { v1 = go1.verticesVisual.Value; v2 = go2.verticesVisual.Value; } GeometricObjectElementTriangles tris1 = this; - if (Settings.s.platform == Settings.Platform.N64) { + if (Legacy_Settings.s.platform == Legacy_Settings.Platform.N64) { if (tris1.sz_vertices != tris2.sz_vertices) return; Vector3[] verts1 = RSP.RSPParser.ParseVerticesOnly(tris1.triangles.Value.rspCommands, tris1.vertices.Value.vertices, go1); Vector3[] verts2 = RSP.RSPParser.ParseVerticesOnly(tris2.triangles.Value.rspCommands, tris2.vertices.Value.vertices, go2); @@ -136,7 +136,7 @@ public void MorphVertices(Mesh mesh, GeometricObjectElementTriangles tris2, Geom verts1[i] = Vector3.Lerp(verts1[i], verts2[i], lerp); } mesh.vertices = verts1; - } else if (Settings.s.platform == Settings.Platform._3DS) { + } else if (Legacy_Settings.s.platform == Legacy_Settings.Platform._3DS) { Vector3[] verts1, verts2; if (tris1.sz_vertices == 0) { verts1 = go1.verticesVisual.Value.GetVectors(go1.ScaleFactor); @@ -155,7 +155,7 @@ public void MorphVertices(Mesh mesh, GeometricObjectElementTriangles tris2, Geom verts1[i] = Vector3.Lerp(verts1[i], verts2[i], lerp); } mesh.vertices = verts1; - } else if (Settings.s.platform == Settings.Platform.DS) { + } else if (Legacy_Settings.s.platform == Legacy_Settings.Platform.DS) { Vector3[] verts1 = DS3D.GeometryParser.ParseVerticesOnly(tris1.triangles.Value.ds3dCommands, go1); Vector3[] verts2 = DS3D.GeometryParser.ParseVerticesOnly(tris2.triangles.Value.ds3dCommands, go2); for (int i = 0; i < verts1.Length; i++) { @@ -166,10 +166,10 @@ public void MorphVertices(Mesh mesh, GeometricObjectElementTriangles tris2, Geom } public void ResetMorph(Mesh mesh, GeometricObject go) { - if (Settings.s.platform == Settings.Platform.N64) { + if (Legacy_Settings.s.platform == Legacy_Settings.Platform.N64) { Vector3[] verts = RSP.RSPParser.ParseVerticesOnly(triangles.Value.rspCommands, vertices.Value.vertices, go); mesh.vertices = verts; - } else if (Settings.s.platform == Settings.Platform._3DS) { + } else if (Legacy_Settings.s.platform == Legacy_Settings.Platform._3DS) { Vector3[] verts; if (sz_vertices == 0) { verts = go.verticesVisual.Value.GetVectors(go.ScaleFactor); @@ -178,14 +178,14 @@ public void ResetMorph(Mesh mesh, GeometricObject go) { verts = triangles.Value.verts.Select(v => v.GetVector(go.ScaleFactor)).ToArray(); } mesh.vertices = verts; - } else if (Settings.s.platform == Settings.Platform.DS) { + } else if (Legacy_Settings.s.platform == Legacy_Settings.Platform.DS) { Vector3[] verts = DS3D.GeometryParser.ParseVerticesOnly(triangles.Value.ds3dCommands, go); mesh.vertices = verts; } } public void ResetVertexBuffer() { - if (Settings.s.platform == Settings.Platform.N64) { + if (Legacy_Settings.s.platform == Legacy_Settings.Platform.N64) { if (vertices.Value != null) { vertices.Value.ResetVertexBuffer(); } diff --git a/Assets/Scripts/OpenSpace/ROM/Structs/GEO/GeometricObjectElementTrianglesData.cs b/Assets/Scripts/OpenSpace/ROM/Structs/GEO/GeometricObjectElementTrianglesData.cs index bb0611d3..68877449 100644 --- a/Assets/Scripts/OpenSpace/ROM/Structs/GEO/GeometricObjectElementTrianglesData.cs +++ b/Assets/Scripts/OpenSpace/ROM/Structs/GEO/GeometricObjectElementTrianglesData.cs @@ -33,7 +33,7 @@ protected override void ReadInternal(Reader reader) { // maybe this can help https://github.com/ricrpi/mupen64plus-video-gles2rice/blob/master/src/RSP_Parser.cpp // 8 bytes per command, 1st byte is RSP byte - if (Settings.s.platform == Settings.Platform._3DS) { + if (Legacy_Settings.s.platform == Legacy_Settings.Platform._3DS) { triangles = new Triangle[length]; for (int i = 0; i < length; i++) { /*if (i % 2 == 0) { @@ -59,18 +59,18 @@ protected override void ReadInternal(Reader reader) { colors[i] = new CompressedVector3(reader); } } else { - if (Settings.s.platform == Settings.Platform.N64) { + if (Legacy_Settings.s.platform == Legacy_Settings.Platform.N64) { data = reader.ReadBytes(length); using (MemoryStream str = new MemoryStream(data)) { - using (Reader dataReader = new Reader(str, Settings.s.IsLittleEndian)) { + using (Reader dataReader = new Reader(str, Legacy_Settings.s.IsLittleEndian)) { rspCommands = new RSPCommand[length / 8]; for (int i = 0; i < rspCommands.Length; i++) { rspCommands[i] = new RSPCommand(dataReader); } } } - } else if (Settings.s.platform == Settings.Platform.DS) { - if (Settings.s.game == Settings.Game.RRR) { + } else if (Legacy_Settings.s.platform == Legacy_Settings.Platform.DS) { + if (Legacy_Settings.s.game == Legacy_Settings.Game.RRR) { data = reader.ReadBytes(compressedLength); data = DS3D.GeometryParser.Decompress(data); //data = DS3D.GeometryParser.ReadCompressed(reader); diff --git a/Assets/Scripts/OpenSpace/ROM/Structs/GEO/VertexArray.cs b/Assets/Scripts/OpenSpace/ROM/Structs/GEO/VertexArray.cs index 76889cdd..a42c0cd2 100644 --- a/Assets/Scripts/OpenSpace/ROM/Structs/GEO/VertexArray.cs +++ b/Assets/Scripts/OpenSpace/ROM/Structs/GEO/VertexArray.cs @@ -13,7 +13,7 @@ public class VertexArray : ROMStruct { protected override void ReadInternal(Reader reader) { - if (Settings.s.platform == Settings.Platform.N64) { + if (Legacy_Settings.s.platform == Legacy_Settings.Platform.N64) { vertices = new Vertex[length / 16]; for (int i = 0; i < vertices.Length; i++) { vertices[i] = new Vertex(reader); @@ -23,7 +23,7 @@ protected override void ReadInternal(Reader reader) { } } public void ResetVertexBuffer() { - if (Settings.s.platform == Settings.Platform.N64) { + if (Legacy_Settings.s.platform == Legacy_Settings.Platform.N64) { foreach(Vertex v in vertices) { v.ResetWorkingCopy(); } diff --git a/Assets/Scripts/OpenSpace/ROM/Structs/GLI/TextureInfo.cs b/Assets/Scripts/OpenSpace/ROM/Structs/GLI/TextureInfo.cs index 493b50fc..b842a70a 100644 --- a/Assets/Scripts/OpenSpace/ROM/Structs/GLI/TextureInfo.cs +++ b/Assets/Scripts/OpenSpace/ROM/Structs/GLI/TextureInfo.cs @@ -23,9 +23,9 @@ public class TextureInfo : ROMStruct { public byte[] textureBytes; public byte[] paletteBytes; - public Pointer off_texture; - public Pointer off_alpha; - public Pointer off_palette; + public LegacyPointer off_texture; + public LegacyPointer off_alpha; + public LegacyPointer off_palette; public GF64 mainTex; public GF64 alphaTex; @@ -116,7 +116,7 @@ public Texture2D Texture { protected override void ReadInternal(Reader reader) { R2ROMLoader l = MapLoader.Loader as R2ROMLoader; - if (Settings.s.platform == Settings.Platform._3DS) { + if (Legacy_Settings.s.platform == Legacy_Settings.Platform._3DS) { wExponent = reader.ReadByte(); hExponent = reader.ReadByte(); flags = reader.ReadUInt16(); @@ -124,7 +124,7 @@ protected override void ReadInternal(Reader reader) { color_size = reader.ReadUInt16(); bpp = reader.ReadUInt16(); name = reader.ReadString(200); - off_texture = Pointer.Current(reader); + off_texture = LegacyPointer.Current(reader); textureBytes = reader.ReadBytes(color_size); // max size: 0x10000 Texture2D rawTex = new ETC(textureBytes, 1 << wExponent, 1 << hExponent, bpp == 32).texture; if (l.exportTextures) { @@ -133,7 +133,7 @@ protected override void ReadInternal(Reader reader) { } } Texture = rawTex; - } else if (Settings.s.platform == Settings.Platform.DS || Settings.s.platform == Settings.Platform.N64) { + } else if (Legacy_Settings.s.platform == Legacy_Settings.Platform.DS || Legacy_Settings.s.platform == Legacy_Settings.Platform.N64) { texture_index = reader.ReadUInt16(); palette_index = reader.ReadUInt16(); alpha_index = reader.ReadUInt16(); @@ -141,7 +141,7 @@ protected override void ReadInternal(Reader reader) { hExponent = reader.ReadByte(); flags = reader.ReadUInt16(); color_size = reader.ReadUInt16(); - if (Settings.s.platform == Settings.Platform.DS) { + if (Legacy_Settings.s.platform == Legacy_Settings.Platform.DS) { palette_num_colors = reader.ReadUInt16(); } else { palette_num_colors = 16; @@ -154,7 +154,7 @@ protected override void ReadInternal(Reader reader) { } else if ((flags & 2) != 0) { format = GF64.Format.I8; ind_texture = (ushort)((texture_index + l.ind_textureTable_i8) & 0xFFFF); - if (Settings.s.platform == Settings.Platform.N64) { + if (Legacy_Settings.s.platform == Legacy_Settings.Platform.N64) { palette_num_colors = 256; } } else if ((flags & 4) != 0) { @@ -174,7 +174,7 @@ protected override void ReadInternal(Reader reader) { format = rgba16 ? GF64.Format.RGBA : (palette_num_colors == 16 ? GF64.Format.I4 : GF64.Format.I8); }*/ if (palette_index != 0xFFFF) { - if (Settings.s.platform == Settings.Platform.DS) { + if (Legacy_Settings.s.platform == Legacy_Settings.Platform.DS) { off_palette = l.palettesTable[palette_index & 0x7FFF]; if(l.palettesTableSeen != null) l.palettesTableSeen[palette_index & 0x7FFF] = true; } else { diff --git a/Assets/Scripts/OpenSpace/ROM/Structs/GLI/VisualMaterial.cs b/Assets/Scripts/OpenSpace/ROM/Structs/GLI/VisualMaterial.cs index c68f1c72..18b0beb2 100644 --- a/Assets/Scripts/OpenSpace/ROM/Structs/GLI/VisualMaterial.cs +++ b/Assets/Scripts/OpenSpace/ROM/Structs/GLI/VisualMaterial.cs @@ -19,7 +19,7 @@ public class VisualMaterial : ROMStruct { protected override void ReadInternal(Reader reader) { R2ROMLoader l = MapLoader.Loader as R2ROMLoader; - if (Settings.s.platform == Settings.Platform.N64) { + if (Legacy_Settings.s.platform == Legacy_Settings.Platform.N64) { r = reader.ReadByte(); g = reader.ReadByte(); b = reader.ReadByte(); @@ -46,7 +46,7 @@ public Material GetMaterial(Hint hints, GameObject gao = null) { if (texInfo.AlphaIsTransparency || texInfo.RenderWater1 || texInfo.RenderWater2) { mat = new Material(MapLoader.Loader.baseTransparentMaterial); } else { - if (Settings.s.platform == Settings.Platform._3DS) { + if (Legacy_Settings.s.platform == Legacy_Settings.Platform._3DS) { mat = new Material(MapLoader.Loader.baseLightMaterial); } else { mat = new Material(MapLoader.Loader.baseTransparentMaterial); @@ -69,7 +69,7 @@ public Material GetMaterial(Hint hints, GameObject gao = null) { mat = new Material(MapLoader.Loader.baseMaterial); } Vector4 ambient, diffuse; - if (Settings.s.platform == Settings.Platform.N64) { + if (Legacy_Settings.s.platform == Legacy_Settings.Platform.N64) { ambient = new Vector4(0.25f, 0.25f, 0.25f, 1f); diffuse = new Vector4(r / 255f, g / 255f, b / 255f, a / 255f); } else { @@ -89,12 +89,12 @@ public Material GetMaterial(Hint hints, GameObject gao = null) { public float ScrollX { get { - return scrollSpeedX * Mathf.Abs(Settings.s.textureAnimationSpeedModifier); + return scrollSpeedX * Mathf.Abs(Legacy_Settings.s.textureAnimationSpeedModifier); } } public float ScrollY { get { - return scrollSpeedY * Settings.s.textureAnimationSpeedModifier; + return scrollSpeedY * Legacy_Settings.s.textureAnimationSpeedModifier; } } @@ -116,7 +116,7 @@ static uint ExtractBits(int number, int count, int offset) { static Vector4 ParseColorRGBA5551(ushort shortCol) { uint alpha, blue, green, red; - if (Settings.s.platform == Settings.Platform.DS || Settings.s.platform == Settings.Platform._3DS) { + if (Legacy_Settings.s.platform == Legacy_Settings.Platform.DS || Legacy_Settings.s.platform == Legacy_Settings.Platform._3DS) { alpha = ExtractBits(shortCol, 1, 15); blue = ExtractBits(shortCol, 5, 10); green = ExtractBits(shortCol, 5, 5); @@ -131,7 +131,7 @@ static Vector4 ParseColorRGBA5551(ushort shortCol) { } static Vector4 ParseColorRGB565(ushort shortCol) { uint blue, green, red; - if (Settings.s.platform == Settings.Platform.DS || Settings.s.platform == Settings.Platform._3DS) { + if (Legacy_Settings.s.platform == Legacy_Settings.Platform.DS || Legacy_Settings.s.platform == Legacy_Settings.Platform._3DS) { red = ExtractBits(shortCol, 5, 0); green = ExtractBits(shortCol, 6, 5); blue = ExtractBits(shortCol, 5, 11); @@ -144,7 +144,7 @@ static Vector4 ParseColorRGB565(ushort shortCol) { } static Vector4 ParseColorRGBA4444(ushort shortCol) { uint alpha, blue, green, red; - if (Settings.s.platform == Settings.Platform.DS || Settings.s.platform == Settings.Platform._3DS) { + if (Legacy_Settings.s.platform == Legacy_Settings.Platform.DS || Legacy_Settings.s.platform == Legacy_Settings.Platform._3DS) { alpha = ExtractBits(shortCol, 4, 12); blue = ExtractBits(shortCol, 4, 8); green = ExtractBits(shortCol, 4, 4); diff --git a/Assets/Scripts/OpenSpace/ROM/Structs/IPT/KeyWordArray.cs b/Assets/Scripts/OpenSpace/ROM/Structs/IPT/KeyWordArray.cs index 6b998229..dfdc0b35 100644 --- a/Assets/Scripts/OpenSpace/ROM/Structs/IPT/KeyWordArray.cs +++ b/Assets/Scripts/OpenSpace/ROM/Structs/IPT/KeyWordArray.cs @@ -296,12 +296,12 @@ public enum KeyCodeN64 { _32 = 0x20, } private static string GetKeyCodeString(int keycode) { - switch (Settings.s.platform) { - case Settings.Platform._3DS: + switch (Legacy_Settings.s.platform) { + case Legacy_Settings.Platform._3DS: return Enum.GetName(typeof(KeyCode3DS), keycode).ToString(); - case Settings.Platform.DS: + case Legacy_Settings.Platform.DS: return Enum.GetName(typeof(KeyCodeDS), keycode).ToString(); - case Settings.Platform.N64: + case Legacy_Settings.Platform.N64: return Enum.GetName(typeof(KeyCodeN64), keycode).ToString(); default: return keycode.ToString(); diff --git a/Assets/Scripts/OpenSpace/ROM/Structs/LevelHeader.cs b/Assets/Scripts/OpenSpace/ROM/Structs/LevelHeader.cs index d6c666e5..4ce6ff8c 100644 --- a/Assets/Scripts/OpenSpace/ROM/Structs/LevelHeader.cs +++ b/Assets/Scripts/OpenSpace/ROM/Structs/LevelHeader.cs @@ -41,19 +41,19 @@ public class LevelHeader : ROMStruct { public Reference backgroundDownRight; protected override void ReadInternal(Reader reader) { - MapLoader.Loader.print("Level Header: " + Pointer.Current(reader)); + MapLoader.Loader.print("Level Header: " + LegacyPointer.Current(reader)); hierarchyRoot = new Reference(reader); ref_46 = reader.ReadUInt16(); spawnablePersos = new Reference(reader); ref_144 = reader.ReadUInt16(); ref_143 = reader.ReadUInt16(); unk6 = reader.ReadUInt16(); - if (Settings.s.platform == Settings.Platform._3DS || (Settings.s.game == Settings.Game.RRR && Settings.s.mode != Settings.Mode.RaymanRavingRabbidsDSDevBuild_2006_05_25)) { + if (Legacy_Settings.s.platform == Legacy_Settings.Platform._3DS || (Legacy_Settings.s.game == Legacy_Settings.Game.RRR && Legacy_Settings.s.mode != Legacy_Settings.Mode.RaymanRavingRabbidsDSDevBuild_2006_05_25)) { unk7_3dsOnly = reader.ReadUInt16(); } length_46 = reader.ReadUInt16(); num_spawnablepersos = reader.ReadUInt16(); - if (Settings.s.platform == Settings.Platform._3DS || (Settings.s.game == Settings.Game.RRR && Settings.s.mode != Settings.Mode.RaymanRavingRabbidsDSDevBuild_2006_05_25)) { + if (Legacy_Settings.s.platform == Legacy_Settings.Platform._3DS || (Legacy_Settings.s.game == Legacy_Settings.Game.RRR && Legacy_Settings.s.mode != Legacy_Settings.Mode.RaymanRavingRabbidsDSDevBuild_2006_05_25)) { unk10_3dsOnly = reader.ReadUInt16(); } unk11 = reader.ReadUInt16(); @@ -76,7 +76,7 @@ protected override void ReadInternal(Reader reader) { len_vectors = reader.ReadUInt16(); len_indices = reader.ReadUInt16(); unk30 = reader.ReadUInt16(); // 1 is divided by this one - if (Settings.s.game == Settings.Game.DD) { + if (Legacy_Settings.s.game == Legacy_Settings.Game.DD) { backgroundUpLeft = new Reference(reader, true); backgroundUpRight = new Reference(reader, true); backgroundDownLeft = new Reference(reader, true); diff --git a/Assets/Scripts/OpenSpace/ROM/Structs/PERSO/Perso.cs b/Assets/Scripts/OpenSpace/ROM/Structs/PERSO/Perso.cs index ce028db8..82ebedb8 100644 --- a/Assets/Scripts/OpenSpace/ROM/Structs/PERSO/Perso.cs +++ b/Assets/Scripts/OpenSpace/ROM/Structs/PERSO/Perso.cs @@ -1,4 +1,5 @@ -using OpenSpace.Loader; +using BinarySerializer.Unity; +using OpenSpace.Loader; using System.Linq; using UnityEngine; diff --git a/Assets/Scripts/OpenSpace/ROM/Structs/PO/PhysicalObject.cs b/Assets/Scripts/OpenSpace/ROM/Structs/PO/PhysicalObject.cs index c2db35b4..ff168510 100644 --- a/Assets/Scripts/OpenSpace/ROM/Structs/PO/PhysicalObject.cs +++ b/Assets/Scripts/OpenSpace/ROM/Structs/PO/PhysicalObject.cs @@ -1,4 +1,5 @@ -using OpenSpace.Loader; +using BinarySerializer.Unity; +using OpenSpace.Loader; using System.Linq; using UnityEngine; diff --git a/Assets/Scripts/OpenSpace/ROM/Structs/SECT/Sector.cs b/Assets/Scripts/OpenSpace/ROM/Structs/SECT/Sector.cs index c9ecdef3..03232819 100644 --- a/Assets/Scripts/OpenSpace/ROM/Structs/SECT/Sector.cs +++ b/Assets/Scripts/OpenSpace/ROM/Structs/SECT/Sector.cs @@ -1,4 +1,5 @@ -using OpenSpace.Loader; +using BinarySerializer.Unity; +using OpenSpace.Loader; using System.Linq; using UnityEngine; diff --git a/Assets/Scripts/OpenSpace/Text/FontStructure.cs b/Assets/Scripts/OpenSpace/Text/FontStructure.cs index 8978e82b..8198d63b 100644 --- a/Assets/Scripts/OpenSpace/Text/FontStructure.cs +++ b/Assets/Scripts/OpenSpace/Text/FontStructure.cs @@ -12,19 +12,19 @@ public class FontStructure : OpenSpaceStruct { public byte num_fonts2; public FontDefine[] fonts2; - public Pointer[] fontsBitmap; + public LegacyPointer[] fontsBitmap; protected override void ReadInternal(Reader reader) { // 1 fontDefine is normally sized 0x12E4 ( 0x12B0 if no names ) num_fontsBitmap = reader.ReadByte(); num_fonts = reader.ReadByte(); fonts = new FontDefine[num_fonts]; - fontsBitmap = new Pointer[num_fontsBitmap]; - if (Settings.s.game != Settings.Game.LargoWinch) { + fontsBitmap = new LegacyPointer[num_fontsBitmap]; + if (Legacy_Settings.s.game != Legacy_Settings.Game.LargoWinch) { for (int i = 0; i < num_fonts; i++) { fonts[i] = new FontDefine(reader); } - if (Settings.s.platform == Settings.Platform.Xbox360 || Settings.s.platform == Settings.Platform.PS3) { + if (Legacy_Settings.s.platform == Legacy_Settings.Platform.Xbox360 || Legacy_Settings.s.platform == Legacy_Settings.Platform.PS3) { reader.Align(4); // Align position num_fontsBitmap2 = reader.ReadByte(); num_fonts2 = reader.ReadByte(); @@ -35,16 +35,16 @@ protected override void ReadInternal(Reader reader) { } reader.Align(4); // Align position for (int i = 0; i < num_fontsBitmap; i++) { - fontsBitmap[i] = Pointer.Read(reader); + fontsBitmap[i] = LegacyPointer.Read(reader); } } else { // Largo Winch reader.Align(4); // Align position for (int i = 0; i < num_fontsBitmap; i++) { - fontsBitmap[i] = Pointer.Read(reader); + fontsBitmap[i] = LegacyPointer.Read(reader); } - Pointer off_fontDefine = Pointer.Read(reader); - Pointer.DoAt(ref reader, off_fontDefine, () => { + LegacyPointer off_fontDefine = LegacyPointer.Read(reader); + LegacyPointer.DoAt(ref reader, off_fontDefine, () => { for (int i = 0; i < num_fonts; i++) { fonts[i] = new FontDefine(reader); } @@ -68,8 +68,8 @@ public CharacterDefine(Reader reader) { y = reader.ReadUInt16(); height = reader.ReadUInt16(); width = reader.ReadUInt16(); - if (Settings.s.game != Settings.Game.Dinosaur) { - if (Settings.s.game != Settings.Game.LargoWinch) { + if (Legacy_Settings.s.game != Legacy_Settings.Game.Dinosaur) { + if (Legacy_Settings.s.game != Legacy_Settings.Game.LargoWinch) { pixelSize = reader.ReadUInt16(); } unk_0A = reader.ReadUInt16(); @@ -96,17 +96,17 @@ public class FontDefine { public ushort unk; public FontDefine(Reader reader) { - if (Settings.s.platform == Settings.Platform.GC - || Settings.s.platform == Settings.Platform.Xbox360 - || Settings.s.platform == Settings.Platform.PS3 - || Settings.s.mode == Settings.Mode.RaymanArenaXbox) { + if (Legacy_Settings.s.platform == Legacy_Settings.Platform.GC + || Legacy_Settings.s.platform == Legacy_Settings.Platform.Xbox360 + || Legacy_Settings.s.platform == Legacy_Settings.Platform.PS3 + || Legacy_Settings.s.mode == Legacy_Settings.Mode.RaymanArenaXbox) { name = reader.ReadString(50); } characters = new CharacterDefine[256]; for (int i = 0; i < characters.Length; i++) { characters[i] = new CharacterDefine(reader); } - if (Settings.s.game != Settings.Game.Dinosaur && Settings.s.game != Settings.Game.LargoWinch) { + if (Legacy_Settings.s.game != Legacy_Settings.Game.Dinosaur && Legacy_Settings.s.game != Legacy_Settings.Game.LargoWinch) { kerningInfo = new KerningInfo[200]; for (int i = 0; i < kerningInfo.Length; i++) { kerningInfo[i] = new KerningInfo(reader); diff --git a/Assets/Scripts/OpenSpace/Text/LocalizationStructure.cs b/Assets/Scripts/OpenSpace/Text/LocalizationStructure.cs index 599547c7..d5242498 100644 --- a/Assets/Scripts/OpenSpace/Text/LocalizationStructure.cs +++ b/Assets/Scripts/OpenSpace/Text/LocalizationStructure.cs @@ -5,7 +5,7 @@ namespace OpenSpace.Text { public class LocalizationStructure : OpenSpaceStruct { public struct TextTable { - public Pointer off_textTable; + public LegacyPointer off_textTable; public ushort num_entries_max; // Reserved memory for this table public ushort num_entries; // Used memory for this table public string[] entries; @@ -15,8 +15,8 @@ public struct TextTable { public uint field4; public ushort num_languages; public ushort fieldA; - public Pointer off_text_languages; //0xC - public Pointer off_text_misc; //0x10 + public LegacyPointer off_text_languages; //0xC + public LegacyPointer off_text_misc; //0x10 public TextTable[] languages; public TextTable misc; @@ -24,24 +24,24 @@ public struct TextTable { protected override void ReadInternal(Reader reader) { MapLoader l = MapLoader.Loader; field0 = reader.ReadUInt32(); - if (Settings.s.game == Settings.Game.R2Revolution) { + if (Legacy_Settings.s.game == Legacy_Settings.Game.R2Revolution) { num_languages = reader.ReadUInt16(); languages = new TextTable[num_languages]; languages[0].num_entries = reader.ReadUInt16(); languages[0].entries = new string[languages[0].num_entries]; reader.ReadUInt32(); - off_text_misc = Pointer.Read(reader); - off_text_languages = Pointer.Read(reader); + off_text_misc = LegacyPointer.Read(reader); + off_text_languages = LegacyPointer.Read(reader); // Read misc table, kinda hacky since there is no amount of entries listed - Pointer.DoAt(ref reader, off_text_misc, () => { - Pointer off_entry1 = Pointer.Read(reader); + LegacyPointer.DoAt(ref reader, off_text_misc, () => { + LegacyPointer off_entry1 = LegacyPointer.Read(reader); misc.num_entries = (ushort)((off_entry1.offset - off_text_misc.offset) / 4); - Pointer.Goto(ref reader, off_text_misc); + LegacyPointer.Goto(ref reader, off_text_misc); misc.entries = new string[misc.num_entries]; for (int j = 0; j < misc.num_entries; j++) { - Pointer off_text = Pointer.Read(reader); - Pointer.DoAt(ref reader, off_text, () => { + LegacyPointer off_text = LegacyPointer.Read(reader); + LegacyPointer.DoAt(ref reader, off_text, () => { misc.entries[j] = reader.ReadNullDelimitedString(); }); } @@ -50,40 +50,40 @@ protected override void ReadInternal(Reader reader) { // Interestingly, other languages are stored in the menu level file. // When you select another language, it replaces the fix table by the one in the menu file // This saves fix memory since not all languages have to remain loaded throughout the whole game. - Pointer.DoAt(ref reader, off_text_languages, () => { + LegacyPointer.DoAt(ref reader, off_text_languages, () => { for (int j = 0; j < languages[0].num_entries; j++) { - Pointer off_text = Pointer.Read(reader); - Pointer.DoAt(ref reader, off_text, () => { + LegacyPointer off_text = LegacyPointer.Read(reader); + LegacyPointer.DoAt(ref reader, off_text, () => { languages[0].entries[j] = reader.ReadNullDelimitedString(); }); } }); } else { - if (Settings.s.platform != Settings.Platform.DC - && Settings.s.platform != Settings.Platform.PS2 - && Settings.s.game != Settings.Game.LargoWinch) field4 = reader.ReadUInt32(); + if (Legacy_Settings.s.platform != Legacy_Settings.Platform.DC + && Legacy_Settings.s.platform != Legacy_Settings.Platform.PS2 + && Legacy_Settings.s.game != Legacy_Settings.Game.LargoWinch) field4 = reader.ReadUInt32(); num_languages = reader.ReadUInt16(); reader.ReadUInt16(); - off_text_languages = Pointer.Read(reader); - if (Settings.s.game != Settings.Game.RedPlanet) { - off_text_misc = Pointer.Read(reader); + off_text_languages = LegacyPointer.Read(reader); + if (Legacy_Settings.s.game != Legacy_Settings.Game.RedPlanet) { + off_text_misc = LegacyPointer.Read(reader); } else { misc.entries = new string[0]; } // Read language table languages = new TextTable[num_languages]; - Pointer.DoAt(ref reader, off_text_languages, () => { + LegacyPointer.DoAt(ref reader, off_text_languages, () => { //f.languages = new TextTable[f.num_languages]; for (int i = 0; i < num_languages; i++) { - languages[i].off_textTable = Pointer.Read(reader); + languages[i].off_textTable = LegacyPointer.Read(reader); languages[i].num_entries_max = reader.ReadUInt16(); languages[i].num_entries = reader.ReadUInt16(); languages[i].entries = new string[languages[i].num_entries]; - Pointer.DoAt(ref reader, languages[i].off_textTable, () => { + LegacyPointer.DoAt(ref reader, languages[i].off_textTable, () => { for (int j = 0; j < languages[i].num_entries; j++) { - Pointer off_text = Pointer.Read(reader); - Pointer.DoAt(ref reader, off_text, () => { + LegacyPointer off_text = LegacyPointer.Read(reader); + LegacyPointer.DoAt(ref reader, off_text, () => { languages[i].entries[j] = reader.ReadNullDelimitedString(); //l.print(languages[i].entries[j]); }); @@ -93,16 +93,16 @@ protected override void ReadInternal(Reader reader) { }); // Read misc table - Pointer.DoAt(ref reader, off_text_misc, () => { - misc.off_textTable = Pointer.Read(reader); + LegacyPointer.DoAt(ref reader, off_text_misc, () => { + misc.off_textTable = LegacyPointer.Read(reader); misc.num_entries_max = reader.ReadUInt16(); misc.num_entries = reader.ReadUInt16(); misc.entries = new string[misc.num_entries]; - Pointer.DoAt(ref reader, misc.off_textTable, () => { + LegacyPointer.DoAt(ref reader, misc.off_textTable, () => { for (int j = 0; j < misc.num_entries; j++) { - Pointer off_text = Pointer.Read(reader); - Pointer.DoAt(ref reader, off_text, () => { + LegacyPointer off_text = LegacyPointer.Read(reader); + LegacyPointer.DoAt(ref reader, off_text, () => { misc.entries[j] = reader.ReadNullDelimitedString(); }); } @@ -113,26 +113,26 @@ protected override void ReadInternal(Reader reader) { } public void ReadLanguageTableDreamcast(Reader reader, int index, ushort num_entries) { - languages[index].off_textTable = Pointer.Current(reader); + languages[index].off_textTable = LegacyPointer.Current(reader); languages[index].num_entries = num_entries; languages[index].num_entries_max = num_entries; languages[index].entries = new string[num_entries]; for (int j = 0; j < languages[index].num_entries; j++) { - Pointer off_text = Pointer.Read(reader); - Pointer.DoAt(ref reader, off_text, () => { + LegacyPointer off_text = LegacyPointer.Read(reader); + LegacyPointer.DoAt(ref reader, off_text, () => { languages[index].entries[j] = reader.ReadNullDelimitedString(); }); } } public void ReadLanguageTablePS2(Reader reader, int index) { - languages[index].off_textTable = Pointer.Read(reader); + languages[index].off_textTable = LegacyPointer.Read(reader); languages[index].num_entries_max = reader.ReadUInt16(); languages[index].num_entries = reader.ReadUInt16(); languages[index].entries = new string[languages[index].num_entries]; for (int j = 0; j < languages[index].num_entries; j++) { - Pointer off_text = Pointer.Read(reader); - Pointer.DoAt(ref reader, off_text, () => { + LegacyPointer off_text = LegacyPointer.Read(reader); + LegacyPointer.DoAt(ref reader, off_text, () => { languages[index].entries[j] = reader.ReadNullDelimitedString(); }); } diff --git a/Assets/Scripts/OpenSpace/Visual/AnimatedTexture.cs b/Assets/Scripts/OpenSpace/Visual/AnimatedTexture.cs index 58fbba55..cad89977 100644 --- a/Assets/Scripts/OpenSpace/Visual/AnimatedTexture.cs +++ b/Assets/Scripts/OpenSpace/Visual/AnimatedTexture.cs @@ -6,13 +6,13 @@ namespace OpenSpace.Visual { public class AnimatedTexture { - public Pointer off_texture; + public LegacyPointer off_texture; public float time; public float currentTime; // Used to update this texture public TextureInfo texture; - public AnimatedTexture(Pointer off_texture, float time) { + public AnimatedTexture(LegacyPointer off_texture, float time) { this.off_texture = off_texture; this.time = time; texture = TextureInfo.FromOffset(off_texture); diff --git a/Assets/Scripts/OpenSpace/Visual/Deform/DeformSet.cs b/Assets/Scripts/OpenSpace/Visual/Deform/DeformSet.cs index 57fd2045..1e4b77bc 100644 --- a/Assets/Scripts/OpenSpace/Visual/Deform/DeformSet.cs +++ b/Assets/Scripts/OpenSpace/Visual/Deform/DeformSet.cs @@ -8,10 +8,10 @@ namespace OpenSpace.Visual.Deform { public class DeformSet : IGeometricObjectElement { [JsonIgnore] public GeometricObject mesh; - public Pointer offset; + public LegacyPointer offset; - public Pointer off_weights; - public Pointer off_bones; + public LegacyPointer off_weights; + public LegacyPointer off_bones; public ushort num_weights; public byte num_bones; @@ -33,7 +33,7 @@ public GameObject Gao { } } - public DeformSet(Pointer offset, GeometricObject mesh) { + public DeformSet(LegacyPointer offset, GeometricObject mesh) { this.mesh = mesh; this.offset = offset; } @@ -77,11 +77,11 @@ public void RecalculateBindPoses() { } - public static DeformSet Read(Reader reader, Pointer offset, GeometricObject m) { + public static DeformSet Read(Reader reader, LegacyPointer offset, GeometricObject m) { MapLoader l = MapLoader.Loader; DeformSet d = new DeformSet(offset, m); - d.off_weights = Pointer.Read(reader); - d.off_bones = Pointer.Read(reader); + d.off_weights = LegacyPointer.Read(reader); + d.off_bones = LegacyPointer.Read(reader); d.num_weights = reader.ReadUInt16(); d.num_bones = reader.ReadByte(); d.num_bones += 1; @@ -92,14 +92,14 @@ public static DeformSet Read(Reader reader, Pointer offset, GeometricObject m) { d.r3weights = new DeformVertexWeights[d.num_weights]; // Read weights - Pointer.Goto(ref reader, d.off_weights); + LegacyPointer.Goto(ref reader, d.off_weights); for (int i = 0; i < d.num_weights; i++) { - Pointer off_weightsForVertex = Pointer.Read(reader); + LegacyPointer off_weightsForVertex = LegacyPointer.Read(reader); ushort vertex_index = reader.ReadUInt16(); byte num_weightsForVertex = reader.ReadByte(); reader.ReadByte(); // 0, padding d.r3weights[i] = new DeformVertexWeights(vertex_index); - Pointer curPos = Pointer.Goto(ref reader, off_weightsForVertex); + LegacyPointer curPos = LegacyPointer.Goto(ref reader, off_weightsForVertex); for (int j = 0; j < num_weightsForVertex; j++) { ushort weight = reader.ReadUInt16(); //float floatWeight = weight / UInt16.MaxValue; @@ -107,14 +107,14 @@ public static DeformSet Read(Reader reader, Pointer offset, GeometricObject m) { reader.ReadByte(); // 0, padding d.r3weights[i].boneWeights.Add(boneIndex, weight); } - Pointer.Goto(ref reader, curPos); + LegacyPointer.Goto(ref reader, curPos); } // Read bones d.r3bones[0] = new DeformBone(); d.r3bones[0].mat = new Matrix(null, 1, Matrix4x4.identity, new Vector4(1f, 1f, 1f, 1f)); d.r3bones[0].index = 0; - Pointer.Goto(ref reader, d.off_bones); + LegacyPointer.Goto(ref reader, d.off_bones); for (int i = 1; i < d.num_bones; i++) { d.r3bones[i] = new DeformBone(); @@ -128,11 +128,11 @@ public static DeformSet Read(Reader reader, Pointer offset, GeometricObject m) { mat.SetColumn(j, new Vector4(reader.ReadSingle(), reader.ReadSingle(), reader.ReadSingle(), 1f)); } d.r3bones[i].mat = new Matrix(null, 1, mat, new Vector4(1f, 1f, 1f, 1f)); - if (Settings.s.game == Settings.Game.LargoWinch) { - Pointer off_shorts = Pointer.Read(reader); // offset of shorts. the next ushort, invert, is actually number of shorts. + if (Legacy_Settings.s.game == Legacy_Settings.Game.LargoWinch) { + LegacyPointer off_shorts = LegacyPointer.Read(reader); // offset of shorts. the next ushort, invert, is actually number of shorts. d.r3bones[i].invert = reader.ReadUInt16(); //l.print("Number of shorts: " + d.r3bones[i].invert); - Pointer.DoAt(ref reader, off_shorts, () => { + LegacyPointer.DoAt(ref reader, off_shorts, () => { for (int j = 0; j < d.r3bones[i].invert; j++) { reader.ReadUInt16(); } diff --git a/Assets/Scripts/OpenSpace/Visual/GeometricObject.cs b/Assets/Scripts/OpenSpace/Visual/GeometricObject.cs index 6d2e2c71..43273d66 100644 --- a/Assets/Scripts/OpenSpace/Visual/GeometricObject.cs +++ b/Assets/Scripts/OpenSpace/Visual/GeometricObject.cs @@ -15,19 +15,19 @@ namespace OpenSpace.Visual { /// Mesh data (both static and dynamic) /// public class GeometricObject : IGeometricObject, IEngineObject { - public Pointer offset; + public LegacyPointer offset; - public Pointer off_vertices; - public Pointer off_normals; - public Pointer off_blendWeights; - public Pointer off_materials; - public Pointer off_element_types; - public Pointer off_elements; - public Pointer off_mapping; // Revolution only + public LegacyPointer off_vertices; + public LegacyPointer off_normals; + public LegacyPointer off_blendWeights; + public LegacyPointer off_materials; + public LegacyPointer off_element_types; + public LegacyPointer off_elements; + public LegacyPointer off_mapping; // Revolution only public uint lookAtMode; public ushort num_vertices; public ushort num_elements; - public Pointer off_parallelBoxes; + public LegacyPointer off_parallelBoxes; public ushort num_parallelBoxes; public Vector3 sphereCenter = Vector3.zero; public float sphereRadius = 0; @@ -76,7 +76,7 @@ public GameObject Gao { public SuperObject so; public SuperObject SuperObject => so; - public GeometricObject(Pointer offset) { + public GeometricObject(LegacyPointer offset) { this.offset = offset; } @@ -119,75 +119,75 @@ public void ReinitBindposes() { } } - public static GeometricObject Read(Reader reader, Pointer offset, RadiosityLOD radiosity = null, PatchGeometricObject mod = null) { + public static GeometricObject Read(Reader reader, LegacyPointer offset, RadiosityLOD radiosity = null, PatchGeometricObject mod = null) { MapLoader l = MapLoader.Loader; //l.print("Geometric Object: " + offset); GeometricObject m = new GeometricObject(offset); m.radiosity = radiosity; - if (Settings.s.game == Settings.Game.LargoWinch) { + if (Legacy_Settings.s.game == Legacy_Settings.Game.LargoWinch) { uint flags = reader.ReadUInt32(); m.num_vertices = reader.ReadUInt16(); m.num_elements = reader.ReadUInt16(); - m.off_element_types = Pointer.Read(reader); - m.off_elements = Pointer.Read(reader); - m.off_vertices = Pointer.Read(reader); - m.off_normals = Pointer.Read(reader); + m.off_element_types = LegacyPointer.Read(reader); + m.off_elements = LegacyPointer.Read(reader); + m.off_vertices = LegacyPointer.Read(reader); + m.off_normals = LegacyPointer.Read(reader); m.sphereRadius = reader.ReadSingle(); // bounding volume radius float sphereX = reader.ReadSingle(); // x float sphereZ = reader.ReadSingle(); // z float sphereY = reader.ReadSingle(); // y m.sphereCenter = new Vector3(sphereX, sphereY, sphereZ); m.lookAtMode = reader.ReadUInt32(); - } else if (Settings.s.game == Settings.Game.R2Revolution) { - m.off_element_types = Pointer.Read(reader); - m.off_elements = Pointer.Read(reader); + } else if (Legacy_Settings.s.game == Legacy_Settings.Game.R2Revolution) { + m.off_element_types = LegacyPointer.Read(reader); + m.off_elements = LegacyPointer.Read(reader); uint flags = reader.ReadUInt32(); m.sphereRadius = reader.ReadSingle(); // bounding volume radius float sphereX = reader.ReadSingle(); // x float sphereZ = reader.ReadSingle(); // z float sphereY = reader.ReadSingle(); // y m.sphereCenter = new Vector3(sphereX, sphereY, sphereZ); - m.off_mapping = Pointer.Read(reader); + m.off_mapping = LegacyPointer.Read(reader); m.num_vertices = reader.ReadUInt16(); m.num_elements = reader.ReadUInt16(); - m.off_vertices = Pointer.Read(reader); - m.off_normals = Pointer.Read(reader); + m.off_vertices = LegacyPointer.Read(reader); + m.off_normals = LegacyPointer.Read(reader); m.lookAtMode = flags & 3; } else { - if (Settings.s.engineVersion <= Settings.EngineVersion.Montreal) m.num_vertices = (ushort)reader.ReadUInt32(); - m.off_vertices = Pointer.Read(reader); - m.off_normals = Pointer.Read(reader); - if (Settings.s.engineVersion < Settings.EngineVersion.R3) { - m.off_materials = Pointer.Read(reader); + if (Legacy_Settings.s.engineVersion <= Legacy_Settings.EngineVersion.Montreal) m.num_vertices = (ushort)reader.ReadUInt32(); + m.off_vertices = LegacyPointer.Read(reader); + m.off_normals = LegacyPointer.Read(reader); + if (Legacy_Settings.s.engineVersion < Legacy_Settings.EngineVersion.R3) { + m.off_materials = LegacyPointer.Read(reader); } else { - m.off_blendWeights = Pointer.Read(reader); + m.off_blendWeights = LegacyPointer.Read(reader); } - if (Settings.s.mode != Settings.Mode.RaymanArenaGC - && Settings.s.mode != Settings.Mode.RaymanArenaGCDemo_2002_03_07 - && Settings.s.game != Settings.Game.RM - && Settings.s.mode != Settings.Mode.DonaldDuckPKGC - && !(Settings.s.platform == Settings.Platform.PS2 && Settings.s.engineVersion == Settings.EngineVersion.R3)) { + if (Legacy_Settings.s.mode != Legacy_Settings.Mode.RaymanArenaGC + && Legacy_Settings.s.mode != Legacy_Settings.Mode.RaymanArenaGCDemo_2002_03_07 + && Legacy_Settings.s.game != Legacy_Settings.Game.RM + && Legacy_Settings.s.mode != Legacy_Settings.Mode.DonaldDuckPKGC + && !(Legacy_Settings.s.platform == Legacy_Settings.Platform.PS2 && Legacy_Settings.s.engineVersion == Legacy_Settings.EngineVersion.R3)) { reader.ReadInt32(); } - if (Settings.s.engineVersion <= Settings.EngineVersion.Montreal) m.num_elements = (ushort)reader.ReadUInt32(); - m.off_element_types = Pointer.Read(reader); - m.off_elements = Pointer.Read(reader); - if (Settings.s.engineVersion == Settings.EngineVersion.R2) { + if (Legacy_Settings.s.engineVersion <= Legacy_Settings.EngineVersion.Montreal) m.num_elements = (ushort)reader.ReadUInt32(); + m.off_element_types = LegacyPointer.Read(reader); + m.off_elements = LegacyPointer.Read(reader); + if (Legacy_Settings.s.engineVersion == Legacy_Settings.EngineVersion.R2) { reader.ReadInt32(); reader.ReadInt32(); } reader.ReadInt32(); - if (Settings.s.engineVersion > Settings.EngineVersion.Montreal) { - m.off_parallelBoxes = Pointer.Read(reader); + if (Legacy_Settings.s.engineVersion > Legacy_Settings.EngineVersion.Montreal) { + m.off_parallelBoxes = LegacyPointer.Read(reader); } else { reader.ReadInt32(); } - if (Settings.s.game == Settings.Game.Dinosaur) { + if (Legacy_Settings.s.game == Legacy_Settings.Game.Dinosaur) { reader.ReadInt32(); reader.ReadInt32(); reader.ReadInt32(); } - if (Settings.s.engineVersion > Settings.EngineVersion.Montreal) { + if (Legacy_Settings.s.engineVersion > Legacy_Settings.EngineVersion.Montreal) { m.lookAtMode = reader.ReadUInt32(); //if (m.lookAtMode != 0) l.print(m.lookAtMode); m.num_vertices = reader.ReadUInt16(); @@ -200,11 +200,11 @@ public static GeometricObject Read(Reader reader, Pointer offset, RadiosityLOD r float sphereY = reader.ReadSingle(); // y m.sphereCenter = new Vector3(sphereX, sphereY, sphereZ); reader.ReadInt32(); - if (Settings.s.engineVersion == Settings.EngineVersion.R3) { + if (Legacy_Settings.s.engineVersion == Legacy_Settings.EngineVersion.R3) { reader.ReadInt32(); - if (!(Settings.s.platform == Settings.Platform.PS2 && (Settings.s.game == Settings.Game.RM || Settings.s.game == Settings.Game.RA))) { + if (!(Legacy_Settings.s.platform == Legacy_Settings.Platform.PS2 && (Legacy_Settings.s.game == Legacy_Settings.Game.RM || Legacy_Settings.s.game == Legacy_Settings.Game.RA))) { reader.ReadInt16(); - if (Settings.s.platform == Settings.Platform.PS2) { + if (Legacy_Settings.s.platform == Legacy_Settings.Platform.PS2) { reader.ReadInt16(); reader.ReadUInt32(); } @@ -221,20 +221,20 @@ public static GeometricObject Read(Reader reader, Pointer offset, RadiosityLOD r } } m.name = "Mesh @ " + offset; - if (Settings.s.hasNames) m.name = reader.ReadString(0x32); - if (Settings.s.platform == Settings.Platform.PS2 && Settings.s.engineVersion >= Settings.EngineVersion.R3) { + if (Legacy_Settings.s.hasNames) m.name = reader.ReadString(0x32); + if (Legacy_Settings.s.platform == Legacy_Settings.Platform.PS2 && Legacy_Settings.s.engineVersion >= Legacy_Settings.EngineVersion.R3) { reader.Align(0x4); reader.ReadUInt32(); reader.ReadUInt32(); m.optimizedObject = new Pointer(reader, resolve: false); reader.ReadUInt32(); reader.ReadUInt32(); - if (Settings.s.game == Settings.Game.R3) { + if (Legacy_Settings.s.game == Legacy_Settings.Game.R3) { m.ps2IsSinus = reader.ReadUInt32(); } } // Vertices - Pointer.DoAt(ref reader, m.off_vertices, () => { + LegacyPointer.DoAt(ref reader, m.off_vertices, () => { m.vertices = new Vector3[m.num_vertices]; for (int i = 0; i < m.num_vertices; i++) { float x = reader.ReadSingle(); @@ -252,7 +252,7 @@ public static GeometricObject Read(Reader reader, Pointer offset, RadiosityLOD r } } // Normals - Pointer.DoAt(ref reader, m.off_normals, () => { + LegacyPointer.DoAt(ref reader, m.off_normals, () => { m.normals = new Vector3[m.num_vertices]; for (int i = 0; i < m.num_vertices; i++) { float x = reader.ReadSingle(); @@ -261,14 +261,14 @@ public static GeometricObject Read(Reader reader, Pointer offset, RadiosityLOD r m.normals[i] = new Vector3(x, y, z); } }); - Pointer.DoAt(ref reader, m.off_blendWeights, () => { + LegacyPointer.DoAt(ref reader, m.off_blendWeights, () => { m.blendWeights = new float[4][]; /*reader.ReadUInt32(); // 0 R3Pointer off_blendWeightsStart = R3Pointer.Read(reader); R3Pointer.Goto(ref reader, off_blendWeightsStart);*/ for (int i = 0; i < 4; i++) { - Pointer off_blendWeights = Pointer.Read(reader); - Pointer.DoAt(ref reader, off_blendWeights, () => { + LegacyPointer off_blendWeights = LegacyPointer.Read(reader); + LegacyPointer.DoAt(ref reader, off_blendWeights, () => { m.blendWeights[i] = new float[m.num_vertices]; for (int j = 0; j < m.num_vertices; j++) { m.blendWeights[i][j] = reader.ReadSingle(); @@ -280,20 +280,20 @@ public static GeometricObject Read(Reader reader, Pointer offset, RadiosityLOD r reader.ReadUInt32(); reader.ReadUInt32(); }); - Pointer.DoAt(ref reader, m.off_mapping, () => { + LegacyPointer.DoAt(ref reader, m.off_mapping, () => { // Revolution only reader.ReadUInt32(); - Pointer.Read(reader); - Pointer off_mappingBlocks = Pointer.Read(reader); - Pointer.Read(reader); - Pointer.Read(reader); + LegacyPointer.Read(reader); + LegacyPointer off_mappingBlocks = LegacyPointer.Read(reader); + LegacyPointer.Read(reader); + LegacyPointer.Read(reader); ushort num_mappingBlocks = reader.ReadUInt16(); reader.ReadUInt16(); - Pointer.DoAt(ref reader, off_mappingBlocks, () => { + LegacyPointer.DoAt(ref reader, off_mappingBlocks, () => { m.mapping = new int[num_mappingBlocks][]; for (int i = 0; i < num_mappingBlocks; i++) { - Pointer off_mapping = Pointer.Read(reader); - Pointer.DoAt(ref reader, off_mapping, () => { + LegacyPointer off_mapping = LegacyPointer.Read(reader); + LegacyPointer.DoAt(ref reader, off_mapping, () => { m.mapping[i] = new int[m.num_vertices]; for (int j = 0; j < m.num_vertices; j++) { m.mapping[i][j] = reader.ReadUInt16(); @@ -304,7 +304,7 @@ public static GeometricObject Read(Reader reader, Pointer offset, RadiosityLOD r }); }); // Read element types & initialize arrays - Pointer.Goto(ref reader, m.off_element_types); + LegacyPointer.Goto(ref reader, m.off_element_types); m.element_types = new ushort[m.num_elements]; m.elements = new IGeometricObjectElement[m.num_elements]; for (uint i = 0; i < m.num_elements; i++) { @@ -312,9 +312,9 @@ public static GeometricObject Read(Reader reader, Pointer offset, RadiosityLOD r } // Process elements for (uint i = 0; i < m.num_elements; i++) { - Pointer.Goto(ref reader, m.off_elements + (i * 4)); - Pointer block_offset = Pointer.Read(reader); - Pointer.Goto(ref reader, block_offset); + LegacyPointer.Goto(ref reader, m.off_elements + (i * 4)); + LegacyPointer block_offset = LegacyPointer.Read(reader); + LegacyPointer.Goto(ref reader, block_offset); switch (m.element_types[i]) { case 1: // Material m.elements[i] = GeometricObjectElementTriangles.Read(reader, block_offset, m); @@ -344,7 +344,7 @@ public static GeometricObject Read(Reader reader, Pointer offset, RadiosityLOD r } } ReadMeshFromATO(reader, m); - if (Settings.s.platform == Settings.Platform.PS2 && Settings.s.engineVersion == Settings.EngineVersion.R3) { + if (Legacy_Settings.s.platform == Legacy_Settings.Platform.PS2 && Legacy_Settings.s.engineVersion == Legacy_Settings.EngineVersion.R3) { m.optimizedObject?.Resolve(reader, onPreRead: opt => opt.isSinus = m.ps2IsSinus); m.ReadMeshFromSDC(); } @@ -373,7 +373,7 @@ private void ReadMeshFromSDC() { private static void ReadMeshFromATO(Reader reader, GeometricObject m) { // Revolution only: Before creating the gameobject, read the actual model data from the ATO - if (Settings.s.game == Settings.Game.R2Revolution) { + if (Legacy_Settings.s.game == Legacy_Settings.Game.R2Revolution) { MapLoader l = MapLoader.Loader; List meshObjects = new List(); for (uint i = 0; i < m.num_elements; i++) { @@ -456,7 +456,7 @@ private static void ReadMeshFromATO(Reader reader, GeometricObject m) { lm.Apply(); } Vector2[] lightmapUVs = new Vector2[mo.num_vertices]; - Pointer.DoAt(ref reader, ps2l.off_lightmapUV[me.lightmap_index], () => { + LegacyPointer.DoAt(ref reader, ps2l.off_lightmapUV[me.lightmap_index], () => { for (int j = 0; j < mo.num_vertices; j++) { lightmapUVs[j] = new Vector2(reader.ReadSingle(), reader.ReadSingle()); } diff --git a/Assets/Scripts/OpenSpace/Visual/GeometricObjectElementSprites.cs b/Assets/Scripts/OpenSpace/Visual/GeometricObjectElementSprites.cs index 3801ee71..b4aeae68 100644 --- a/Assets/Scripts/OpenSpace/Visual/GeometricObjectElementSprites.cs +++ b/Assets/Scripts/OpenSpace/Visual/GeometricObjectElementSprites.cs @@ -9,7 +9,7 @@ namespace OpenSpace.Visual { public class GeometricObjectElementSprites : IGeometricObjectElement { public class IndexedSprite { - public Pointer off_info; + public LegacyPointer off_info; public Vector2 size; public Vector3 constraint; public Vector2 uv1; @@ -18,19 +18,19 @@ public class IndexedSprite { public Vector2 info_scale; public Vector2 info_unknown; - public Pointer off_material_pointer; - public Pointer off_material; + public LegacyPointer off_material_pointer; + public LegacyPointer off_material; public GameMaterial gameMaterial; public VisualMaterial visualMaterial = null; [JsonIgnore] public Mesh meshUnity = null; } [JsonIgnore] public GeometricObject geo; - public Pointer offset; + public LegacyPointer offset; [JsonIgnore] public string name; - public Pointer off_sprites; // called IndexedSprites in the game code + public LegacyPointer off_sprites; // called IndexedSprites in the game code public ushort num_sprites; public IndexedSprite[] sprites; @@ -46,7 +46,7 @@ public GameObject Gao { } } - public GeometricObjectElementSprites(Pointer offset, GeometricObject geo) { + public GeometricObjectElementSprites(LegacyPointer offset, GeometricObject geo) { this.geo = geo; this.offset = offset; } @@ -66,7 +66,7 @@ private void CreateUnityMesh() { bc.size = new Vector3(0, sprites[i].info_scale.y * 2, sprites[i].info_scale.x * 2); spr_gao.layer = LayerMask.NameToLayer("Visual"); if (sprites[i].visualMaterial != null) { - if (Settings.s.game != Settings.Game.R2Revolution && + if (Legacy_Settings.s.game != Legacy_Settings.Game.R2Revolution && sprites[i].visualMaterial.textures != null && sprites[i].visualMaterial.textures.Count > 0) { TextureInfo mainTex = sprites[i].visualMaterial.textures[0].texture; @@ -125,32 +125,32 @@ private void CreateUnityMesh() { } } - public static GeometricObjectElementSprites Read(Reader reader, Pointer offset, GeometricObject m) { + public static GeometricObjectElementSprites Read(Reader reader, LegacyPointer offset, GeometricObject m) { MapLoader l = MapLoader.Loader; GeometricObjectElementSprites s = new GeometricObjectElementSprites(offset, m); s.name = "Sprite @ pos " + offset; //l.print(s.name); - if (Settings.s.engineVersion > Settings.EngineVersion.Montreal) { - if (Settings.s.platform == Settings.Platform.DC) { + if (Legacy_Settings.s.engineVersion > Legacy_Settings.EngineVersion.Montreal) { + if (Legacy_Settings.s.platform == Legacy_Settings.Platform.DC) { s.off_sprites = offset; s.num_sprites = 1; } else { - s.off_sprites = Pointer.Read(reader); + s.off_sprites = LegacyPointer.Read(reader); s.num_sprites = reader.ReadUInt16(); reader.ReadInt16(); // -1 - if (Settings.s.game != Settings.Game.R2Revolution) { + if (Legacy_Settings.s.game != Legacy_Settings.Game.R2Revolution) { reader.ReadUInt32(); - if(Settings.s.game != Settings.Game.LargoWinch) reader.ReadUInt32(); + if(Legacy_Settings.s.game != Legacy_Settings.Game.LargoWinch) reader.ReadUInt32(); } } } else { s.num_sprites = (ushort)reader.ReadUInt32(); - s.off_sprites = Pointer.Read(reader); + s.off_sprites = LegacyPointer.Read(reader); reader.ReadUInt32(); } - if (Settings.s.game == Settings.Game.R2Revolution) { - Pointer.DoAt(ref reader, s.off_sprites, () => { + if (Legacy_Settings.s.game == Legacy_Settings.Game.R2Revolution) { + LegacyPointer.DoAt(ref reader, s.off_sprites, () => { s.sprites = new IndexedSprite[s.num_sprites]; for (uint i = 0; i < s.num_sprites; i++) { s.sprites[i] = new IndexedSprite(); @@ -163,17 +163,17 @@ public static GeometricObjectElementSprites Read(Reader reader, Pointer offset, s.sprites[i].visualMaterial = ps2l.lightCookieMaterial.Clone(); s.sprites[i].visualMaterial.diffuseCoef = ps2l.lightCookieColors[index]; } else { - s.sprites[i].off_material = Pointer.Read(reader); + s.sprites[i].off_material = LegacyPointer.Read(reader); if (s.sprites[i].off_material != null) { s.sprites[i].visualMaterial = VisualMaterial.FromOffsetOrRead(s.sprites[0].off_material, reader); } } } }); - } else if (Settings.s.platform == Settings.Platform.DC) { + } else if (Legacy_Settings.s.platform == Legacy_Settings.Platform.DC) { s.sprites = new IndexedSprite[1]; s.sprites[0] = new IndexedSprite(); - s.sprites[0].off_material = Pointer.Read(reader); + s.sprites[0].off_material = LegacyPointer.Read(reader); if (s.sprites[0].off_material != null) { s.sprites[0].visualMaterial = VisualMaterial.FromOffsetOrRead(s.sprites[0].off_material, reader); } @@ -186,53 +186,53 @@ public static GeometricObjectElementSprites Read(Reader reader, Pointer offset, reader.ReadUInt16(); } else { if (s.off_sprites != null) { - Pointer.Goto(ref reader, s.off_sprites); + LegacyPointer.Goto(ref reader, s.off_sprites); s.sprites = new IndexedSprite[s.num_sprites]; for (uint i = 0; i < s.num_sprites; i++) { s.sprites[i] = new IndexedSprite(); - if (Settings.s.engineVersion <= Settings.EngineVersion.Montreal) reader.ReadUInt32(); - s.sprites[i].off_info = Pointer.Read(reader); + if (Legacy_Settings.s.engineVersion <= Legacy_Settings.EngineVersion.Montreal) reader.ReadUInt32(); + s.sprites[i].off_info = LegacyPointer.Read(reader); s.sprites[i].size = new Vector2(reader.ReadSingle(), reader.ReadSingle()); - if (Settings.s.engineVersion > Settings.EngineVersion.Montreal) { - if (Settings.s.game != Settings.Game.LargoWinch) { + if (Legacy_Settings.s.engineVersion > Legacy_Settings.EngineVersion.Montreal) { + if (Legacy_Settings.s.game != Legacy_Settings.Game.LargoWinch) { s.sprites[i].constraint = new Vector3(reader.ReadSingle(), reader.ReadSingle(), reader.ReadSingle()); s.sprites[i].uv1 = new Vector2(reader.ReadSingle(), reader.ReadSingle()); s.sprites[i].uv2 = new Vector2(reader.ReadSingle(), reader.ReadSingle()); } s.sprites[i].centerPoint = reader.ReadUInt16(); reader.ReadUInt16(); - if (Settings.s.engineVersion < Settings.EngineVersion.R3) reader.ReadUInt32(); + if (Legacy_Settings.s.engineVersion < Legacy_Settings.EngineVersion.R3) reader.ReadUInt32(); } if (s.sprites[i].off_info != null) { - Pointer off_current = Pointer.Goto(ref reader, s.sprites[i].off_info); + LegacyPointer off_current = LegacyPointer.Goto(ref reader, s.sprites[i].off_info); reader.ReadUInt32(); - Pointer.Read(reader); - Pointer.Read(reader); - Pointer off_info_scale = Pointer.Read(reader); - Pointer off_info_unknown = Pointer.Read(reader); - s.sprites[i].off_material_pointer = Pointer.Read(reader); - Pointer.Goto(ref reader, off_current); + LegacyPointer.Read(reader); + LegacyPointer.Read(reader); + LegacyPointer off_info_scale = LegacyPointer.Read(reader); + LegacyPointer off_info_unknown = LegacyPointer.Read(reader); + s.sprites[i].off_material_pointer = LegacyPointer.Read(reader); + LegacyPointer.Goto(ref reader, off_current); - Pointer.DoAt(ref reader, off_info_scale, () => { + LegacyPointer.DoAt(ref reader, off_info_scale, () => { s.sprites[i].info_scale = new Vector2(reader.ReadSingle(), reader.ReadSingle()); }); - Pointer.DoAt(ref reader, off_info_unknown, () => { + LegacyPointer.DoAt(ref reader, off_info_unknown, () => { s.sprites[i].info_unknown = new Vector2(reader.ReadSingle(), reader.ReadSingle()); }); if (s.sprites[i].off_material_pointer != null) { - off_current = Pointer.Goto(ref reader, s.sprites[i].off_material_pointer); - s.sprites[i].off_material = Pointer.Read(reader); + off_current = LegacyPointer.Goto(ref reader, s.sprites[i].off_material_pointer); + s.sprites[i].off_material = LegacyPointer.Read(reader); if (s.sprites[i].off_material != null) { - if (Settings.s.engineVersion < Settings.EngineVersion.R3) { + if (Legacy_Settings.s.engineVersion < Legacy_Settings.EngineVersion.R3) { s.sprites[i].gameMaterial = GameMaterial.FromOffsetOrRead(s.sprites[i].off_material, reader); s.sprites[i].visualMaterial = s.sprites[i].gameMaterial.visualMaterial; } else { s.sprites[i].visualMaterial = VisualMaterial.FromOffsetOrRead(s.sprites[i].off_material, reader); } } - Pointer.Goto(ref reader, off_current); + LegacyPointer.Goto(ref reader, off_current); } } } diff --git a/Assets/Scripts/OpenSpace/Visual/GeometricObjectElementTriangles.cs b/Assets/Scripts/OpenSpace/Visual/GeometricObjectElementTriangles.cs index 83661e77..3ee8fbf4 100644 --- a/Assets/Scripts/OpenSpace/Visual/GeometricObjectElementTriangles.cs +++ b/Assets/Scripts/OpenSpace/Visual/GeometricObjectElementTriangles.cs @@ -13,11 +13,11 @@ namespace OpenSpace.Visual { /// public class GeometricObjectElementTriangles : IGeometricObjectElement { [JsonIgnore] public GeometricObject geo; - public Pointer offset; + public LegacyPointer offset; [JsonIgnore] public string name; - public Pointer off_material; + public LegacyPointer off_material; public GameMaterial gameMaterial; public VisualMaterial visualMaterialOG; public VisualMaterial visualMaterial; @@ -25,20 +25,20 @@ public class GeometricObjectElementTriangles : IGeometricObjectElement { public ushort num_triangles; public ushort num_uvs; public ushort num_uvMaps; - public Pointer off_triangles; - public Pointer off_mapping_uvs; - public Pointer off_normals; - public Pointer off_uvs; - public Pointer off_vertex_indices; + public LegacyPointer off_triangles; + public LegacyPointer off_mapping_uvs; + public LegacyPointer off_normals; + public LegacyPointer off_uvs; + public LegacyPointer off_vertex_indices; public ushort num_vertex_indices; public ushort OPT_num_mapping_entries; - public Pointer OPT_off_mapping_vertices; - public Pointer OPT_off_mapping_uvs; + public LegacyPointer OPT_off_mapping_vertices; + public LegacyPointer OPT_off_mapping_uvs; public ushort OPT_num_triangleStrip; public ushort OPT_num_disconnectedTriangles; - public Pointer OPT_off_triangleStrip; - public Pointer OPT_off_disconnectedTriangles; - public Pointer off_mapping_lightmap; + public LegacyPointer OPT_off_triangleStrip; + public LegacyPointer OPT_off_disconnectedTriangles; + public LegacyPointer off_mapping_lightmap; public ushort num_mapping_lightmap; public ushort parallelBox; public byte isVisibleInPortal; @@ -58,7 +58,7 @@ public class GeometricObjectElementTriangles : IGeometricObjectElement { public int lightmap_index = -1; // R3 PS2 - public Pointer off_sdc_mapping = null; + public LegacyPointer off_sdc_mapping = null; public ushort[] sdc_mapping; public PS2OptimizedSDCStructureElement sdc = null; @@ -85,7 +85,7 @@ public GameObject Gao { } } - public GeometricObjectElementTriangles(Pointer offset, GeometricObject geo) { + public GeometricObjectElementTriangles(LegacyPointer offset, GeometricObject geo) { this.geo = geo; this.offset = offset; } @@ -278,7 +278,7 @@ private void CreateUnityMeshFromSDC() { } OPT_unityMesh.SetUVs(t, uv); } - if (sdc.geo.Type != 3 && Settings.s.game != Settings.Game.R3) { + if (sdc.geo.Type != 3 && Legacy_Settings.s.game != Legacy_Settings.Game.R3) { Color[] colors = new Color[vertices.Length]; for (int u = 0; u < colors.Length; u++) { colors[u] = sdc.GetColor(u); @@ -331,7 +331,7 @@ private void CreateUnityMeshFromSDC() { normals[i] = sdc.GetNormal(i); } OPT_unityMesh.normals = normals; - } else if (sdc.geo.Type == 3 && Settings.s.game != Settings.Game.R3) { + } else if (sdc.geo.Type == 3 && Legacy_Settings.s.game != Legacy_Settings.Game.R3) { OPT_unityMesh.normals = normals; } else { OPT_unityMesh.RecalculateNormals(); @@ -642,7 +642,7 @@ private void CreateUnityMesh() { //gao.name += " " + visualMaterial.offset + " - " + (visualMaterial.textures.Count > 0 ? visualMaterial.textures[0].offset.ToString() : "NULL" ); Material unityMat = visualMaterial.GetMaterial(materialHints); if(rli != null && unityMat != null) unityMat.SetFloat("_Prelit", 2f); - if (((sdc != null && (sdc.geo.Type != 6 || (sdc.geo.Type != 3 && Settings.s.game != Settings.Game.R3))) + if (((sdc != null && (sdc.geo.Type != 6 || (sdc.geo.Type != 3 && Legacy_Settings.s.game != Legacy_Settings.Game.R3))) || vertexColors != null) && unityMat != null) unityMat.SetFloat("_Prelit", 1f); bool receiveShadows = (visualMaterial.properties & VisualMaterial.property_receiveShadows) != 0; bool scroll = visualMaterial.ScrollingEnabled; @@ -771,17 +771,17 @@ public void ResetVertices() { UpdateMeshVertices(geo.vertices); } - public static GeometricObjectElementTriangles Read(Reader reader, Pointer offset, GeometricObject geo) { + public static GeometricObjectElementTriangles Read(Reader reader, LegacyPointer offset, GeometricObject geo) { MapLoader l = MapLoader.Loader; GeometricObjectElementTriangles sm = new GeometricObjectElementTriangles(offset, geo); sm.name = "Submesh @ pos " + offset; //l.print(sm.name); sm.backfaceCulling = !l.forceDisplayBackfaces; - sm.off_material = Pointer.Read(reader); - if (Settings.s.game == Settings.Game.LargoWinch) { + sm.off_material = LegacyPointer.Read(reader); + if (Legacy_Settings.s.game == Legacy_Settings.Game.LargoWinch) { //sm.visualMaterial = VisualMaterial.FromOffset(sm.off_material); sm.visualMaterial = VisualMaterial.FromOffsetOrRead(sm.off_material, reader); - } else if (Settings.s.engineVersion == Settings.EngineVersion.R3 || Settings.s.game == Settings.Game.R2Revolution) { + } else if (Legacy_Settings.s.engineVersion == Legacy_Settings.EngineVersion.R3 || Legacy_Settings.s.game == Legacy_Settings.Game.R2Revolution) { sm.visualMaterial = VisualMaterial.FromOffset(sm.off_material); } else { sm.gameMaterial = GameMaterial.FromOffsetOrRead(sm.off_material, reader); @@ -795,33 +795,33 @@ public static GeometricObjectElementTriangles Read(Reader reader, Pointer offset sm.backfaceCulling = ((sm.visualMaterial.flags & VisualMaterial.flags_backfaceCulling) != 0) && !l.forceDisplayBackfaces; } sm.num_triangles = reader.ReadUInt16(); - if (Settings.s.game == Settings.Game.R2Revolution) { + if (Legacy_Settings.s.game == Legacy_Settings.Game.R2Revolution) { sm.lightmap_index = reader.ReadInt16(); - sm.off_triangles = Pointer.Read(reader); + sm.off_triangles = LegacyPointer.Read(reader); } else { sm.num_uvs = reader.ReadUInt16(); - if (Settings.s.engineVersion == Settings.EngineVersion.R3) { + if (Legacy_Settings.s.engineVersion == Legacy_Settings.EngineVersion.R3) { sm.num_uvMaps = reader.ReadUInt16(); sm.lightmap_index = reader.ReadInt16(); } - sm.off_triangles = Pointer.Read(reader); // 1 entry = 3 shorts. Max: num_vertices - if (Settings.s.mode == Settings.Mode.Rayman3GC) reader.ReadUInt32(); - sm.off_mapping_uvs = Pointer.Read(reader); // 1 entry = 3 shorts. Max: num_weights - sm.off_normals = Pointer.Read(reader); // 1 entry = 3 floats - sm.off_uvs = Pointer.Read(reader); // 1 entry = 2 floats - if (Settings.s.game == Settings.Game.LargoWinch) { - sm.off_mapping_lightmap = Pointer.Read(reader); + sm.off_triangles = LegacyPointer.Read(reader); // 1 entry = 3 shorts. Max: num_vertices + if (Legacy_Settings.s.mode == Legacy_Settings.Mode.Rayman3GC) reader.ReadUInt32(); + sm.off_mapping_uvs = LegacyPointer.Read(reader); // 1 entry = 3 shorts. Max: num_weights + sm.off_normals = LegacyPointer.Read(reader); // 1 entry = 3 floats + sm.off_uvs = LegacyPointer.Read(reader); // 1 entry = 2 floats + if (Legacy_Settings.s.game == Legacy_Settings.Game.LargoWinch) { + sm.off_mapping_lightmap = LegacyPointer.Read(reader); sm.num_mapping_lightmap = reader.ReadUInt16(); reader.ReadUInt16(); - } else if (Settings.s.engineVersion == Settings.EngineVersion.R3) { - if (Settings.s.platform != Settings.Platform.PS2) { + } else if (Legacy_Settings.s.engineVersion == Legacy_Settings.EngineVersion.R3) { + if (Legacy_Settings.s.platform != Legacy_Settings.Platform.PS2) { reader.ReadUInt32(); reader.ReadUInt32(); } else { // PS2 reader.ReadUInt32(); - sm.off_sdc_mapping = Pointer.Read(reader); - Pointer.DoAt(ref reader, sm.off_sdc_mapping, () => { + sm.off_sdc_mapping = LegacyPointer.Read(reader); + LegacyPointer.DoAt(ref reader, sm.off_sdc_mapping, () => { uint length = reader.ReadUInt32(); sm.sdc_mapping = new ushort[length]; for (int i = 0; i < length; i++) { @@ -829,32 +829,32 @@ public static GeometricObjectElementTriangles Read(Reader reader, Pointer offset } }); } - } else if (Settings.s.engineVersion == Settings.EngineVersion.Montreal) { + } else if (Legacy_Settings.s.engineVersion == Legacy_Settings.EngineVersion.Montreal) { reader.ReadUInt32(); } - if (Settings.s.game != Settings.Game.TTSE) { - sm.off_vertex_indices = Pointer.Read(reader); + if (Legacy_Settings.s.game != Legacy_Settings.Game.TTSE) { + sm.off_vertex_indices = LegacyPointer.Read(reader); sm.num_vertex_indices = reader.ReadUInt16(); sm.parallelBox = reader.ReadUInt16(); reader.ReadUInt32(); } } - if (Settings.s.engineVersion == Settings.EngineVersion.R3) { - if (Settings.s.game != Settings.Game.Dinosaur - && Settings.s.game != Settings.Game.LargoWinch - && Settings.s.mode != Settings.Mode.RaymanArenaGCDemo_2002_03_07 - && Settings.s.platform != Settings.Platform.PS2) { + if (Legacy_Settings.s.engineVersion == Legacy_Settings.EngineVersion.R3) { + if (Legacy_Settings.s.game != Legacy_Settings.Game.Dinosaur + && Legacy_Settings.s.game != Legacy_Settings.Game.LargoWinch + && Legacy_Settings.s.mode != Legacy_Settings.Mode.RaymanArenaGCDemo_2002_03_07 + && Legacy_Settings.s.platform != Legacy_Settings.Platform.PS2) { sm.isVisibleInPortal = reader.ReadByte(); reader.ReadByte(); sm.OPT_num_mapping_entries = reader.ReadUInt16(); // num_shorts - sm.OPT_off_mapping_vertices = Pointer.Read(reader); // shorts_offset1 (1st array of size num_shorts, max_num_vertices) - sm.OPT_off_mapping_uvs = Pointer.Read(reader); // shorts_offset2 (2nd array of size num_shorts, max: num_weights) + sm.OPT_off_mapping_vertices = LegacyPointer.Read(reader); // shorts_offset1 (1st array of size num_shorts, max_num_vertices) + sm.OPT_off_mapping_uvs = LegacyPointer.Read(reader); // shorts_offset2 (2nd array of size num_shorts, max: num_weights) sm.OPT_num_triangleStrip = reader.ReadUInt16(); // num_shorts2 sm.OPT_num_disconnectedTriangles = reader.ReadUInt16(); - sm.OPT_off_triangleStrip = Pointer.Read(reader); // shorts2_offset (array of size num_shorts2) - sm.OPT_off_disconnectedTriangles = Pointer.Read(reader); - if (Settings.s.hasNames) sm.name += reader.ReadString(0x34); - } else if(Settings.s.platform == Settings.Platform.PS2) { + sm.OPT_off_triangleStrip = LegacyPointer.Read(reader); // shorts2_offset (array of size num_shorts2) + sm.OPT_off_disconnectedTriangles = LegacyPointer.Read(reader); + if (Legacy_Settings.s.hasNames) sm.name += reader.ReadString(0x34); + } else if(Legacy_Settings.s.platform == Legacy_Settings.Platform.PS2) { reader.ReadUInt32(); sm.isVisibleInPortal = reader.ReadByte(); reader.ReadByte(); @@ -879,7 +879,7 @@ public static GeometricObjectElementTriangles Read(Reader reader, Pointer offset sm.OPT_off_triangleStrip = null; sm.OPT_off_disconnectedTriangles = null; sm.isVisibleInPortal = 1; - if (Settings.s.mode == Settings.Mode.RaymanArenaGCDemo_2002_03_07) { + if (Legacy_Settings.s.mode == Legacy_Settings.Mode.RaymanArenaGCDemo_2002_03_07) { sm.isVisibleInPortal = reader.ReadByte(); reader.ReadByte(); sm.OPT_num_mapping_entries = reader.ReadUInt16(); // num_shorts @@ -901,14 +901,14 @@ public static GeometricObjectElementTriangles Read(Reader reader, Pointer offset // Read mapping tables sm.OPT_mapping_uvs = new int[sm.num_uvMaps][]; if (sm.OPT_num_mapping_entries > 0) { - Pointer.DoAt(ref reader, sm.OPT_off_mapping_vertices, () => { + LegacyPointer.DoAt(ref reader, sm.OPT_off_mapping_vertices, () => { //print("Mapping offset: " + String.Format("0x{0:X}", fs.Position)); sm.OPT_mapping_vertices = new int[sm.OPT_num_mapping_entries]; for (int j = 0; j < sm.OPT_num_mapping_entries; j++) { sm.OPT_mapping_vertices[j] = reader.ReadInt16(); } }); - Pointer.DoAt(ref reader, sm.OPT_off_mapping_uvs, () => { + LegacyPointer.DoAt(ref reader, sm.OPT_off_mapping_uvs, () => { for (int j = 0; j < sm.num_uvMaps; j++) { sm.OPT_mapping_uvs[j] = new int[sm.OPT_num_mapping_entries]; } @@ -920,7 +920,7 @@ public static GeometricObjectElementTriangles Read(Reader reader, Pointer offset }); } if (sm.num_triangles > 0) { - Pointer.DoAt(ref reader, sm.off_mapping_uvs, () => { + LegacyPointer.DoAt(ref reader, sm.off_mapping_uvs, () => { sm.mapping_uvs = new int[sm.num_uvMaps][]; for (int j = 0; j < sm.num_uvMaps; j++) { sm.mapping_uvs[j] = new int[sm.num_triangles * 3]; @@ -935,20 +935,20 @@ public static GeometricObjectElementTriangles Read(Reader reader, Pointer offset } // Read UVs - Pointer.DoAt(ref reader, sm.off_uvs, () => { + LegacyPointer.DoAt(ref reader, sm.off_uvs, () => { sm.uvs = new Vector2[sm.num_uvs]; for (int j = 0; j < sm.num_uvs; j++) { sm.uvs[j] = new Vector2(reader.ReadSingle(), reader.ReadSingle()); } }); // Read triangle data - Pointer.DoAt(ref reader, sm.OPT_off_triangleStrip, () => { + LegacyPointer.DoAt(ref reader, sm.OPT_off_triangleStrip, () => { sm.OPT_triangleStrip = new int[sm.OPT_num_triangleStrip]; for (int j = 0; j < sm.OPT_num_triangleStrip; j++) { sm.OPT_triangleStrip[j] = reader.ReadInt16(); } }); - Pointer.DoAt(ref reader, sm.OPT_off_disconnectedTriangles, () => { + LegacyPointer.DoAt(ref reader, sm.OPT_off_disconnectedTriangles, () => { sm.OPT_disconnectedTriangles = new int[sm.OPT_num_disconnectedTriangles * 3]; //print("Loading disconnected triangles at " + String.Format("0x{0:X}", fs.Position)); for (int j = 0; j < sm.OPT_num_disconnectedTriangles; j++) { @@ -958,7 +958,7 @@ public static GeometricObjectElementTriangles Read(Reader reader, Pointer offset } }); if (sm.num_triangles > 0) { - Pointer.DoAt(ref reader, sm.off_triangles, () => { + LegacyPointer.DoAt(ref reader, sm.off_triangles, () => { sm.triangles = new int[sm.num_triangles * 3]; //print("Loading disconnected triangles at " + String.Format("0x{0:X}", fs.Position)); for (int j = 0; j < sm.num_triangles; j++) { @@ -968,7 +968,7 @@ public static GeometricObjectElementTriangles Read(Reader reader, Pointer offset } }); if (sm.off_normals != null) { - Pointer.DoAt(ref reader, sm.off_normals, () => { + LegacyPointer.DoAt(ref reader, sm.off_normals, () => { sm.normals = new Vector3[sm.num_triangles]; for (int j = 0; j < sm.num_triangles; j++) { float x = reader.ReadSingle(); @@ -979,7 +979,7 @@ public static GeometricObjectElementTriangles Read(Reader reader, Pointer offset }); } } - if (Settings.s.game == Settings.Game.LargoWinch && sm.lightmap_index != -1) { + if (Legacy_Settings.s.game == Legacy_Settings.Game.LargoWinch && sm.lightmap_index != -1) { LWLoader lwl = MapLoader.Loader as LWLoader; if (lwl.lms != null && sm.lightmap_index >= 0 && sm.lightmap_index < lwl.lms.Count) { /*if (sm.lightmap_index < l.off_lightmapUV.Length - 1) { @@ -988,13 +988,13 @@ public static GeometricObjectElementTriangles Read(Reader reader, Pointer offset l.print(offset + " - UVs: " + amount + " - " + sm.mesh.num_vertices + " - " + sm.num_mapping_entries + " - " + sm.num_uvs + " - " + sm.num_disconnected_triangles_spe + " - " + sm.num_mapping_lightmap); }*/ Vector2[] lightmapUVs = new Vector2[sm.num_mapping_lightmap]; - Pointer.DoAt(ref reader, sm.off_mapping_lightmap, () => { + LegacyPointer.DoAt(ref reader, sm.off_mapping_lightmap, () => { sm.mapping_lightmap = new int[sm.num_mapping_lightmap]; for (int i = 0; i < sm.num_mapping_lightmap; i++) { sm.mapping_lightmap[i] = reader.ReadInt16(); } }); - Pointer.DoAt(ref reader, l.off_lightmapUV[sm.lightmap_index], () => { + LegacyPointer.DoAt(ref reader, l.off_lightmapUV[sm.lightmap_index], () => { for (int j = 0; j < lightmapUVs.Length; j++) { lightmapUVs[j] = new Vector2(reader.ReadSingle(), reader.ReadSingle()); } @@ -1016,7 +1016,7 @@ public void AddLightmap(Texture2D lightmap, Vector2[] lightmapUVs) { Array.Resize(ref OPT_mapping_uvs, num_uvMaps + 1); OPT_mapping_uvs[OPT_mapping_uvs.Length - 1] = Enumerable.Range(num_uvs, lightmapUVs.Length).ToArray(); } - if (Settings.s.game == Settings.Game.LargoWinch) { + if (Legacy_Settings.s.game == Legacy_Settings.Game.LargoWinch) { if (mapping_uvs != null && mapping_lightmap != null) { Array.Resize(ref mapping_uvs, num_uvMaps + 1); mapping_uvs[mapping_uvs.Length - 1] = new int[num_triangles * 3]; diff --git a/Assets/Scripts/OpenSpace/Visual/GeometricShadowObject.cs b/Assets/Scripts/OpenSpace/Visual/GeometricShadowObject.cs index a4c5a893..f55dcd7b 100644 --- a/Assets/Scripts/OpenSpace/Visual/GeometricShadowObject.cs +++ b/Assets/Scripts/OpenSpace/Visual/GeometricShadowObject.cs @@ -6,8 +6,8 @@ namespace OpenSpace.Visual { /// Geometric Shadow Object. It's only used in Dinosaur /// public class GeometricShadowObject : IEngineObject { - public Pointer offset; - public Pointer off_data; + public LegacyPointer offset; + public LegacyPointer off_data; public GeometricObject data; public uint unk4; public uint unk8; @@ -28,19 +28,19 @@ public SuperObject SuperObject { } } - public GeometricShadowObject(Pointer offset, SuperObject so) { + public GeometricShadowObject(LegacyPointer offset, SuperObject so) { this.offset = offset; this.superObject = so; } - public static GeometricShadowObject Read(Reader reader, Pointer offset, SuperObject so) { + public static GeometricShadowObject Read(Reader reader, LegacyPointer offset, SuperObject so) { MapLoader l = MapLoader.Loader; GeometricShadowObject igo = new GeometricShadowObject(offset, so); - igo.off_data = Pointer.Read(reader); + igo.off_data = LegacyPointer.Read(reader); igo.unk4 = reader.ReadUInt32(); igo.unk8 = reader.ReadUInt32(); - Pointer.DoAt(ref reader, igo.off_data, () => { + LegacyPointer.DoAt(ref reader, igo.off_data, () => { igo.data = GeometricObject.Read(reader, igo.off_data); if (igo.data != null) { igo.data.Gao.transform.parent = igo.Gao.transform; diff --git a/Assets/Scripts/OpenSpace/Visual/ISI/Radiosity.cs b/Assets/Scripts/OpenSpace/Visual/ISI/Radiosity.cs index 54c02970..83e13501 100644 --- a/Assets/Scripts/OpenSpace/Visual/ISI/Radiosity.cs +++ b/Assets/Scripts/OpenSpace/Visual/ISI/Radiosity.cs @@ -4,13 +4,13 @@ namespace OpenSpace.Visual.ISI { public class Radiosity : OpenSpaceStruct { public uint num_lod; - public Pointer off_lod; + public LegacyPointer off_lod; public RadiosityLOD[] lod; protected override void ReadInternal(Reader reader) { num_lod = reader.ReadUInt32(); - off_lod = Pointer.Read(reader); + off_lod = LegacyPointer.Read(reader); lod = Load.ReadArray(num_lod, reader, off_lod); } diff --git a/Assets/Scripts/OpenSpace/Visual/ISI/RadiosityLOD.cs b/Assets/Scripts/OpenSpace/Visual/ISI/RadiosityLOD.cs index afd139ff..679d31a7 100644 --- a/Assets/Scripts/OpenSpace/Visual/ISI/RadiosityLOD.cs +++ b/Assets/Scripts/OpenSpace/Visual/ISI/RadiosityLOD.cs @@ -4,14 +4,14 @@ namespace OpenSpace.Visual.ISI { public class RadiosityLOD : OpenSpaceStruct { public uint num_colors; - public Pointer off_colors; + public LegacyPointer off_colors; // Parsed public ColorISI[] colors; protected override void ReadInternal(Reader reader) { num_colors = reader.ReadUInt32(); - off_colors = Pointer.Read(reader); + off_colors = LegacyPointer.Read(reader); Load.print(Offset + " - " + off_colors); colors = Load.ReadArray(num_colors, reader, off_colors); diff --git a/Assets/Scripts/OpenSpace/Visual/LightInfo.cs b/Assets/Scripts/OpenSpace/Visual/LightInfo.cs index 3e473d7e..75994541 100644 --- a/Assets/Scripts/OpenSpace/Visual/LightInfo.cs +++ b/Assets/Scripts/OpenSpace/Visual/LightInfo.cs @@ -48,7 +48,7 @@ public class LightInfo : OpenSpaceStruct { public Vector4 background_color; public uint createsShadowsOrNot; public string name = null; - public Pointer dimmer; + public LegacyPointer dimmer; [Flags] @@ -78,8 +78,8 @@ public LightInfo() : base() { } public bool IsObjectLighted(ObjectLightedFlag flags) { - if (Settings.s.engineVersion == Settings.EngineVersion.Montreal) return true; - if (Settings.s.platform != Settings.Platform.PS2 || Settings.s.engineVersion < Settings.EngineVersion.R3) { + if (Legacy_Settings.s.engineVersion == Legacy_Settings.EngineVersion.Montreal) return true; + if (Legacy_Settings.s.platform != Legacy_Settings.Platform.PS2 || Legacy_Settings.s.engineVersion < Legacy_Settings.EngineVersion.R3) { return true; //if (flags == ObjectLightedFlag.Environment) return true; } @@ -88,16 +88,16 @@ public bool IsObjectLighted(ObjectLightedFlag flags) { public void Write(Writer writer) { if (light != null && light.IsModified) { - Pointer.Goto(ref writer, transMatrix.offset); + LegacyPointer.Goto(ref writer, transMatrix.offset); transMatrix.Write(writer); - Pointer.Goto(ref writer, Pointer.Current(writer) + (6 * 4)); + LegacyPointer.Goto(ref writer, LegacyPointer.Current(writer) + (6 * 4)); writer.Write(color.x); writer.Write(color.y); writer.Write(color.z); writer.Write(color.w); - if (Settings.s.engineVersion != Settings.EngineVersion.Montreal) { - if (Settings.s.engineVersion == Settings.EngineVersion.R3) { + if (Legacy_Settings.s.engineVersion != Legacy_Settings.EngineVersion.Montreal) { + if (Legacy_Settings.s.engineVersion == Legacy_Settings.EngineVersion.R3) { writer.Write(shadowIntensity); // 0 } - Pointer.Goto(ref writer, Pointer.Current(writer) + 2); + LegacyPointer.Goto(ref writer, LegacyPointer.Current(writer) + 2); writer.Write(paintingLightFlag); writer.Write(alphaLightFlag); } @@ -126,12 +126,12 @@ 0x160 size turnedOn = reader.ReadByte(); castShadows = reader.ReadByte(); - if (Settings.s.game == Settings.Game.R2Revolution || Settings.s.game == Settings.Game.LargoWinch) { + if (Legacy_Settings.s.game == Legacy_Settings.Game.R2Revolution || Legacy_Settings.s.game == Legacy_Settings.Game.LargoWinch) { type = reader.ReadUInt16(); } else { giroPhare = reader.ReadByte(); pulse = reader.ReadByte(); - if (Settings.s.platform != Settings.Platform.DC) reader.ReadUInt32(); + if (Legacy_Settings.s.platform != Legacy_Settings.Platform.DC) reader.ReadUInt32(); type = reader.ReadUInt16(); reader.ReadUInt16(); } @@ -139,45 +139,45 @@ 0x160 size near = reader.ReadSingle(); littleAlpha_fogInfinite = reader.ReadSingle(); bigAlpha_fogBlendNear = reader.ReadSingle(); - if (Settings.s.game == Settings.Game.LargoWinch) reader.ReadSingle(); + if (Legacy_Settings.s.game == Legacy_Settings.Game.LargoWinch) reader.ReadSingle(); giroStep = reader.ReadSingle(); pulseStep = reader.ReadSingle(); - if (Settings.s.engineVersion == Settings.EngineVersion.R3 && Settings.s.game != Settings.Game.LargoWinch) { + if (Legacy_Settings.s.engineVersion == Legacy_Settings.EngineVersion.R3 && Legacy_Settings.s.game != Legacy_Settings.Game.LargoWinch) { pulseMaxRange = reader.ReadSingle(); giroAngle = reader.ReadSingle(); reader.ReadSingle(); } - if (Settings.s.platform == Settings.Platform.DC) reader.ReadUInt32(); - transMatrix = Matrix.Read(reader, Pointer.Current(reader)); - if (Settings.s.platform != Settings.Platform.PS2 && Settings.s.platform != Settings.Platform.DC && Settings.s.game != Settings.Game.R2Revolution && Settings.s.game != Settings.Game.LargoWinch) { + if (Legacy_Settings.s.platform == Legacy_Settings.Platform.DC) reader.ReadUInt32(); + transMatrix = Matrix.Read(reader, LegacyPointer.Current(reader)); + if (Legacy_Settings.s.platform != Legacy_Settings.Platform.PS2 && Legacy_Settings.s.platform != Legacy_Settings.Platform.DC && Legacy_Settings.s.game != Legacy_Settings.Game.R2Revolution && Legacy_Settings.s.game != Legacy_Settings.Game.LargoWinch) { reader.ReadUInt32(); // 0 reader.ReadUInt32(); // 0 reader.ReadUInt32(); // 0 reader.ReadUInt32(); // 0 } - if (Settings.s.engineVersion != Settings.EngineVersion.Montreal) { - if (Settings.s.platform == Settings.Platform.DC) { + if (Legacy_Settings.s.engineVersion != Legacy_Settings.EngineVersion.Montreal) { + if (Legacy_Settings.s.platform == Legacy_Settings.Platform.DC) { reader.ReadSingle(); - } else if (Settings.s.game != Settings.Game.R2Revolution - && Settings.s.game != Settings.Game.LargoWinch - && Settings.s.platform != Settings.Platform.PS2) { + } else if (Legacy_Settings.s.game != Legacy_Settings.Game.R2Revolution + && Legacy_Settings.s.game != Legacy_Settings.Game.LargoWinch + && Legacy_Settings.s.platform != Legacy_Settings.Platform.PS2) { reader.ReadUInt32(); // 0 reader.ReadUInt32(); // 0 } //lo.print("LIGHT " + Pointer.Current(reader)); color = new Vector4(reader.ReadSingle(), reader.ReadSingle(), reader.ReadSingle(), reader.ReadSingle()); - if (Settings.s.engineVersion == Settings.EngineVersion.R3 && Settings.s.platform == Settings.Platform.PS2) { + if (Legacy_Settings.s.engineVersion == Legacy_Settings.EngineVersion.R3 && Legacy_Settings.s.platform == Legacy_Settings.Platform.PS2) { reader.ReadBytes(0x20); } - if (Settings.s.engineVersion == Settings.EngineVersion.R3 || Settings.s.game == Settings.Game.R2Revolution) { + if (Legacy_Settings.s.engineVersion == Legacy_Settings.EngineVersion.R3 || Legacy_Settings.s.game == Legacy_Settings.Game.R2Revolution) { shadowIntensity = reader.ReadSingle(); // 0 } - if (Settings.s.game == Settings.Game.Dinosaur) { + if (Legacy_Settings.s.game == Legacy_Settings.Game.Dinosaur) { sendLightFlag = reader.ReadByte(); // Non-zero: light enabled objectLightedFlag = reader.ReadByte(); // & 1: Affect IPOs. & 2: Affect Persos. So 3 = affect all alphaLightFlag = reader.ReadByte(); paintingLightFlag = reader.ReadByte(); - } else if (Settings.s.game == Settings.Game.LargoWinch) { + } else if (Legacy_Settings.s.game == Legacy_Settings.Game.LargoWinch) { sendLightFlag = reader.ReadByte(); // Non-zero: light enabled paintingLightFlag = reader.ReadByte(); alphaLightFlag = reader.ReadByte(); @@ -197,10 +197,10 @@ 0x160 size intensityMin_fogBlendFar = reader.ReadSingle(); intensityMax = reader.ReadSingle(); background_color = new Vector4(reader.ReadSingle(), reader.ReadSingle(), reader.ReadSingle(), reader.ReadSingle()); - if ((Settings.s.engineVersion == Settings.EngineVersion.R3 && Settings.s.game != Settings.Game.Dinosaur && Settings.s.game != Settings.Game.LargoWinch) || Settings.s.game == Settings.Game.R2Revolution) { + if ((Legacy_Settings.s.engineVersion == Legacy_Settings.EngineVersion.R3 && Legacy_Settings.s.game != Legacy_Settings.Game.Dinosaur && Legacy_Settings.s.game != Legacy_Settings.Game.LargoWinch) || Legacy_Settings.s.game == Legacy_Settings.Game.R2Revolution) { createsShadowsOrNot = reader.ReadUInt32(); } - if (Settings.s.engineVersion == Settings.EngineVersion.R3 && Settings.s.platform == Settings.Platform.PS2) { + if (Legacy_Settings.s.engineVersion == Legacy_Settings.EngineVersion.R3 && Legacy_Settings.s.platform == Legacy_Settings.Platform.PS2) { reader.ReadBytes(0xC); } } else { @@ -214,7 +214,7 @@ 0x160 size reader.ReadByte(); reader.ReadByte(); intensityMin_fogBlendFar = reader.ReadSingle(); - dimmer = Pointer.Read(reader); + dimmer = LegacyPointer.Read(reader); } } } diff --git a/Assets/Scripts/OpenSpace/Visual/PS2Optimized/PS2OptimizedSDCStructure.cs b/Assets/Scripts/OpenSpace/Visual/PS2Optimized/PS2OptimizedSDCStructure.cs index 72e82afa..ca5b40b6 100644 --- a/Assets/Scripts/OpenSpace/Visual/PS2Optimized/PS2OptimizedSDCStructure.cs +++ b/Assets/Scripts/OpenSpace/Visual/PS2Optimized/PS2OptimizedSDCStructure.cs @@ -8,18 +8,18 @@ namespace OpenSpace.Visual.PS2Optimized { public class PS2OptimizedSDCStructure : OpenSpaceStruct { public uint flags; public uint num_elements; - public Pointer off_visualMaterials; - public Pointer off_elements; - public Pointer off_uint1; - public Pointer off_num_triangles; - public Pointer off_unk; // Seems like an empty buffer? Some 2's in it + public LegacyPointer off_visualMaterials; + public LegacyPointer off_elements; + public LegacyPointer off_uint1; + public LegacyPointer off_num_triangles; + public LegacyPointer off_unk; // Seems like an empty buffer? Some 2's in it public uint unk1; public uint unk2; public uint isSinus; // Parsed - public Pointer[] off_visualMaterials_array; - public Pointer[] off_elements_array; + public LegacyPointer[] off_visualMaterials_array; + public LegacyPointer[] off_elements_array; public PS2OptimizedSDCStructureElement[] elements; public VisualMaterial[] visualMaterials; public uint[] uint1; @@ -29,44 +29,44 @@ protected override void ReadInternal(Reader reader) { flags = reader.ReadUInt32(); //UnityEngine.Debug.LogWarning("GEO: " + Offset + " - " + flags); num_elements = reader.ReadUInt32(); - off_visualMaterials = Pointer.Read(reader); - Pointer.DoAt(ref reader, off_visualMaterials, () => { - off_visualMaterials_array = new Pointer[num_elements]; + off_visualMaterials = LegacyPointer.Read(reader); + LegacyPointer.DoAt(ref reader, off_visualMaterials, () => { + off_visualMaterials_array = new LegacyPointer[num_elements]; visualMaterials = new VisualMaterial[num_elements]; for (int i = 0; i < num_elements; i++) { - off_visualMaterials_array[i] = Pointer.Read(reader); + off_visualMaterials_array[i] = LegacyPointer.Read(reader); visualMaterials[i] = VisualMaterial.FromOffsetOrRead(off_visualMaterials_array[i], reader); } }); - off_elements = Pointer.Read(reader); - off_uint1 = Pointer.Read(reader); - off_num_triangles = Pointer.Read(reader); - off_unk = Pointer.Read(reader); + off_elements = LegacyPointer.Read(reader); + off_uint1 = LegacyPointer.Read(reader); + off_num_triangles = LegacyPointer.Read(reader); + off_unk = LegacyPointer.Read(reader); unk1 = reader.ReadUInt32(); unk2 = reader.ReadUInt32(); - Pointer.DoAt(ref reader, off_uint1, () => { + LegacyPointer.DoAt(ref reader, off_uint1, () => { uint1 = new uint[num_elements]; for (int i = 0; i < num_elements; i++) { uint1[i] = reader.ReadUInt32(); } }); - Pointer.DoAt(ref reader, off_num_triangles, () => { + LegacyPointer.DoAt(ref reader, off_num_triangles, () => { num_triangles = new uint[num_elements]; for (int i = 0; i < num_elements; i++) { num_triangles[i] = reader.ReadUInt32(); } }); - Pointer.DoAt(ref reader, off_elements, () => { - off_elements_array = new Pointer[num_elements]; + LegacyPointer.DoAt(ref reader, off_elements, () => { + off_elements_array = new LegacyPointer[num_elements]; for (int i = 0; i < num_elements; i++) { - off_elements_array[i] = Pointer.Read(reader); + off_elements_array[i] = LegacyPointer.Read(reader); } }); elements = new PS2OptimizedSDCStructureElement[num_elements]; for (int i = 0; i < num_elements; i++) { - Pointer.DoAt(ref reader, off_elements_array[i], () => { + LegacyPointer.DoAt(ref reader, off_elements_array[i], () => { elements[i] = new PS2OptimizedSDCStructureElement(this, i); elements[i].Read(reader); }); diff --git a/Assets/Scripts/OpenSpace/Visual/PS2Optimized/PS2OptimizedSDCStructureElement.cs b/Assets/Scripts/OpenSpace/Visual/PS2Optimized/PS2OptimizedSDCStructureElement.cs index 7aeaab08..e0713c9f 100644 --- a/Assets/Scripts/OpenSpace/Visual/PS2Optimized/PS2OptimizedSDCStructureElement.cs +++ b/Assets/Scripts/OpenSpace/Visual/PS2Optimized/PS2OptimizedSDCStructureElement.cs @@ -8,7 +8,7 @@ namespace OpenSpace.Visual.PS2Optimized { public class PS2OptimizedSDCStructureElement { - public Pointer offset; + public LegacyPointer offset; [JsonIgnore] public PS2OptimizedSDCStructure geo; public int index; @@ -33,7 +33,7 @@ public PS2OptimizedSDCStructureElement(PS2OptimizedSDCStructure geo, int index) } public void Read(Reader reader) { - offset = Pointer.Current(reader); + offset = LegacyPointer.Current(reader); if (geo.Type == 4 || geo.Type == 5 || geo.Type == 6) { // Optimized num_vertices_actual = reader.ReadUInt32(); @@ -63,7 +63,7 @@ public void Read(Reader reader) { for (int i = 0; i < num_vertices; i++) { vertices[i] = new Vertex(reader); } - if (geo.Type == 1 && Settings.s.game == Settings.Game.R3) { + if (geo.Type == 1 && Legacy_Settings.s.game == Legacy_Settings.Game.R3) { uvUnoptimized = new UVUnoptimized[num_vertices]; for (int i = 0; i < uvUnoptimized.Length; i++) { uvUnoptimized[i] = new UVUnoptimized(reader); @@ -107,8 +107,8 @@ public void Read(Reader reader) { sinusState[i] = new VectorForSinusEffect(reader); } } - if ((index < geo.num_elements - 1 && Pointer.Current(reader) != geo.off_elements_array[index + 1]) - || (index == geo.num_elements - 1 && Pointer.Current(reader) != geo.off_uint1)) { + if ((index < geo.num_elements - 1 && LegacyPointer.Current(reader) != geo.off_elements_array[index + 1]) + || (index == geo.num_elements - 1 && LegacyPointer.Current(reader) != geo.off_uint1)) { UnityEngine.Debug.LogWarning("B " + geo.Offset + " - " + offset + " - " + hasUv0 + " - " + hasUv1 + " - " + hasNormals); } else { //UnityEngine.Debug.LogWarning("G " + geo.Offset + " - " + offset + " - " + hasUv0 + " - " + hasUv1 + " - " + hasUv4); @@ -121,7 +121,7 @@ public void Read(Reader reader) { public Vector3 GetUV(int index, int texIndex, bool applyBlendWeight) { Vector3 baseUV = Vector3.zero; - if (geo.Type == 1 && Settings.s.game == Settings.Game.R3) { + if (geo.Type == 1 && Legacy_Settings.s.game == Legacy_Settings.Game.R3) { baseUV = new Vector3(uvUnoptimized[index].u, uvUnoptimized[index].v, 1f); } else { byte uvFunction = 0; diff --git a/Assets/Scripts/OpenSpace/Visual/PatchGeometricObject.cs b/Assets/Scripts/OpenSpace/Visual/PatchGeometricObject.cs index 9c05bce1..e4258d72 100644 --- a/Assets/Scripts/OpenSpace/Visual/PatchGeometricObject.cs +++ b/Assets/Scripts/OpenSpace/Visual/PatchGeometricObject.cs @@ -9,11 +9,11 @@ namespace OpenSpace.Visual { public class PatchGeometricObject : IGeometricObject { [JsonIgnore] public PhysicalObject po; - public Pointer offset; + public LegacyPointer offset; - public Pointer off_geometricObject; + public LegacyPointer off_geometricObject; public uint num_properties; - public Pointer off_properties; + public LegacyPointer off_properties; [JsonIgnore] public GeometricObject mesh = null; public PatchGeometricObjectProperty[] properties; @@ -26,21 +26,21 @@ public GameObject Gao { } } - public PatchGeometricObject(PhysicalObject po, Pointer offset) { + public PatchGeometricObject(PhysicalObject po, LegacyPointer offset) { this.po = po; this.offset = offset; } // I don't even know what this is yet here I am parsing it - public static PatchGeometricObject Read(Reader reader, PhysicalObject po, Pointer offset) { + public static PatchGeometricObject Read(Reader reader, PhysicalObject po, LegacyPointer offset) { MapLoader l = MapLoader.Loader; //Debug.LogWarning("Unknown object @ " + offset); PatchGeometricObject patch = new PatchGeometricObject(po, offset); - patch.off_geometricObject = Pointer.Read(reader); + patch.off_geometricObject = LegacyPointer.Read(reader); patch.num_properties = reader.ReadUInt32(); - patch.off_properties = Pointer.Read(reader); - Pointer.DoAt(ref reader, patch.off_properties, () => { + patch.off_properties = LegacyPointer.Read(reader); + LegacyPointer.DoAt(ref reader, patch.off_properties, () => { patch.properties = new PatchGeometricObjectProperty[patch.num_properties]; for (int i = 0; i < patch.num_properties; i++) { patch.properties[i] = new PatchGeometricObjectProperty(); diff --git a/Assets/Scripts/OpenSpace/Visual/TextureInfo.cs b/Assets/Scripts/OpenSpace/Visual/TextureInfo.cs index d0c91d65..13905c2a 100644 --- a/Assets/Scripts/OpenSpace/Visual/TextureInfo.cs +++ b/Assets/Scripts/OpenSpace/Visual/TextureInfo.cs @@ -12,13 +12,13 @@ namespace OpenSpace.Visual { /// Texture definition /// public class TextureInfo { - public Pointer offset; + public LegacyPointer offset; private Texture2D texture; public uint field0; public ushort field4; public ushort field6; - public Pointer off_tempBuffer; // field8 + public LegacyPointer off_tempBuffer; // field8 public uint fieldC; // [JsonIgnore] // pointer to opengl texture data probaly, not interesting for JSON public uint field10; // @@ -44,13 +44,13 @@ public class TextureInfo { public static uint flags_isTransparent = (1 << 3); - public TextureInfo(Pointer offset) { + public TextureInfo(LegacyPointer offset) { this.offset = offset; } public bool IsTransparent { get { - if (Settings.s.engineVersion < Settings.EngineVersion.R3) { + if (Legacy_Settings.s.engineVersion < Legacy_Settings.EngineVersion.R3) { return (flags & 0x100) != 0 || (flags & (1 << 1)) != 0 || (flags & flags_isTransparent) != 0; } else { return (flags & flags_isTransparent) != 0; @@ -70,7 +70,7 @@ public Texture2D Texture { set { texture = value; - if (Application.platform != RuntimePlatform.WebGLPlayer && Settings.s.platform == Settings.Platform.DC) { + if (Application.platform != RuntimePlatform.WebGLPlayer && Legacy_Settings.s.platform == Legacy_Settings.Platform.DC) { name = HashUtils.MD5Hash(value.GetRawTextureData()); } @@ -81,11 +81,11 @@ public Texture2D Texture { if (!IsRepeatV) { texture.wrapModeV = TextureWrapMode.Clamp; } - if (IsMirrorX && Settings.s.game != Settings.Game.R2Revolution) { + if (IsMirrorX && Legacy_Settings.s.game != Legacy_Settings.Game.R2Revolution) { texture.wrapModeU = TextureWrapMode.Mirror; } - if (IsMirrorY && Settings.s.game != Settings.Game.R2Revolution) { - if (Settings.s.platform == Settings.Platform.DC) { + if (IsMirrorY && Legacy_Settings.s.game != Legacy_Settings.Game.R2Revolution) { + if (Legacy_Settings.s.platform == Legacy_Settings.Platform.DC) { Texture2D flipped = new Texture2D(texture.width, texture.height); int w = texture.width; @@ -109,7 +109,7 @@ public Texture2D Texture { } texture.wrapModeV = TextureWrapMode.Mirror; } - if ((flags & 0x902) != 0 && Settings.s.engineVersion < Settings.EngineVersion.R3) { + if ((flags & 0x902) != 0 && Legacy_Settings.s.engineVersion < Legacy_Settings.EngineVersion.R3) { byte[] alphaMaskBytes = BitConverter.GetBytes(alphaMask); SetTextureAlpha(alphaMaskBytes[0] / 255f, alphaMaskBytes[1] / 255f, alphaMaskBytes[2] / 255f); /*MapLoader.Loader.print(name + " - Alpha mask: " + alphaMask + " - " + String.Format("{0:X}", alphaMask)); @@ -157,15 +157,15 @@ public bool IsMirrorY { } public bool IsRepeatU { get { - if (Settings.s.engineVersion >= Settings.EngineVersion.R3) return true; - if (Settings.s.game == Settings.Game.RedPlanet) return true; + if (Legacy_Settings.s.engineVersion >= Legacy_Settings.EngineVersion.R3) return true; + if (Legacy_Settings.s.game == Legacy_Settings.Game.RedPlanet) return true; return (flagsByte & 2) != 0; } } public bool IsRepeatV { get { - if (Settings.s.engineVersion >= Settings.EngineVersion.R3) return true; - if (Settings.s.game == Settings.Game.RedPlanet) return true; + if (Legacy_Settings.s.engineVersion >= Legacy_Settings.EngineVersion.R3) return true; + if (Legacy_Settings.s.game == Legacy_Settings.Game.RedPlanet) return true; return (flagsByte & 1) != 0; } } @@ -186,10 +186,10 @@ public bool IsGrassFX { get { return (name != null && name.Contains("grassfx")); } } - public static TextureInfo Read(Reader reader, Pointer offset) { + public static TextureInfo Read(Reader reader, LegacyPointer offset) { TextureInfo tex = new TextureInfo(offset); - if (Settings.s.engineVersion > Settings.EngineVersion.Montreal) { - if (Settings.s.game == Settings.Game.LargoWinch) { + if (Legacy_Settings.s.engineVersion > Legacy_Settings.EngineVersion.Montreal) { + if (Legacy_Settings.s.game == Legacy_Settings.Game.LargoWinch) { tex.field0 = reader.ReadUInt32(); // 888 or 8888 tex.fieldC = reader.ReadUInt32(); tex.field10 = reader.ReadUInt32(); @@ -202,7 +202,7 @@ public static TextureInfo Read(Reader reader, Pointer offset) { tex.field48 = reader.ReadByte(); tex.flagsByte = reader.ReadByte(); // contains stuff like tiling mode tex.name = reader.ReadString(0x80); - } else if (Settings.s.game == Settings.Game.R2Revolution) { + } else if (Legacy_Settings.s.game == Legacy_Settings.Game.R2Revolution) { reader.ReadUInt32(); tex.flags = reader.ReadUInt16(); tex.flagsByte = reader.ReadByte(); @@ -215,7 +215,7 @@ public static TextureInfo Read(Reader reader, Pointer offset) { reader.ReadByte(); reader.ReadByte(); reader.ReadByte(); - } else if (Settings.s.platform == Settings.Platform.DC) { + } else if (Legacy_Settings.s.platform == Legacy_Settings.Platform.DC) { reader.ReadUInt32(); tex.flags = reader.ReadUInt32(); reader.ReadUInt32(); @@ -230,12 +230,12 @@ public static TextureInfo Read(Reader reader, Pointer offset) { } else { //MapLoader.Loader.print("tex @ " + offset); tex.field0 = reader.ReadUInt32(); // 888 or 8888 - if (Settings.s.game == Settings.Game.Dinosaur) { + if (Legacy_Settings.s.game == Legacy_Settings.Game.Dinosaur) { reader.ReadUInt32(); } tex.field4 = reader.ReadUInt16(); // 20 tex.field6 = reader.ReadUInt16(); - tex.off_tempBuffer = Pointer.Read(reader); // always null because it's stored here dynamically + tex.off_tempBuffer = LegacyPointer.Read(reader); // always null because it's stored here dynamically tex.fieldC = reader.ReadUInt32(); tex.field10 = reader.ReadUInt32(); tex.flags = reader.ReadUInt32(); @@ -248,7 +248,7 @@ public static TextureInfo Read(Reader reader, Pointer offset) { tex.textureScrollingEnabled = reader.ReadUInt32(); tex.alphaMask = reader.ReadUInt32(); tex.field30 = reader.ReadUInt32(); - if (Settings.s.engineVersion == Settings.EngineVersion.R3) tex.numMipmaps = reader.ReadUInt32(); + if (Legacy_Settings.s.engineVersion == Legacy_Settings.EngineVersion.R3) tex.numMipmaps = reader.ReadUInt32(); tex.field38 = reader.ReadUInt32(); tex.field3C = reader.ReadUInt32(); tex.field40 = reader.ReadUInt32(); @@ -267,7 +267,7 @@ public static TextureInfo Read(Reader reader, Pointer offset) { reader.ReadUInt32(); reader.ReadUInt32(); reader.ReadUInt32(); - if (Settings.s.engineVersion > Settings.EngineVersion.TT) { + if (Legacy_Settings.s.engineVersion > Legacy_Settings.EngineVersion.TT) { reader.ReadUInt32(); reader.ReadUInt32(); reader.ReadUInt32(); @@ -286,12 +286,12 @@ public static TextureInfo Read(Reader reader, Pointer offset) { reader.ReadUInt32(); reader.ReadUInt32(); reader.ReadUInt32(); - if (Settings.s.engineVersion > Settings.EngineVersion.TT) { + if (Legacy_Settings.s.engineVersion > Legacy_Settings.EngineVersion.TT) { tex.name = reader.ReadString(0x50); } else { tex.name = reader.ReadString(0x100); } - if (Settings.s.game == Settings.Game.TTSE) { + if (Legacy_Settings.s.game == Legacy_Settings.Game.TTSE) { tex.field48 = (byte)reader.ReadUInt32(); } else { tex.field48 = reader.ReadByte(); @@ -301,7 +301,7 @@ public static TextureInfo Read(Reader reader, Pointer offset) { return tex; } - public static TextureInfo FromOffset(Pointer offset) { + public static TextureInfo FromOffset(LegacyPointer offset) { if (offset == null) return null; MapLoader l = MapLoader.Loader; for (int i = 0; i < l.textures.Length; i++) { diff --git a/Assets/Scripts/OpenSpace/Visual/VisualMaterial.cs b/Assets/Scripts/OpenSpace/Visual/VisualMaterial.cs index 985ece19..ba518921 100644 --- a/Assets/Scripts/OpenSpace/Visual/VisualMaterial.cs +++ b/Assets/Scripts/OpenSpace/Visual/VisualMaterial.cs @@ -15,7 +15,7 @@ public class VisualMaterial { public List textures; public List animTextures; public uint flags; - public Pointer offset; + public LegacyPointer offset; public Vector4 ambientCoef; public Vector4 diffuseCoef; public Vector4 specularCoef; @@ -23,8 +23,8 @@ public class VisualMaterial { public uint num_textures; public uint num_textures_in_material; - public Pointer off_animTextures_first; - public Pointer off_animTextures_current; + public LegacyPointer off_animTextures_first; + public LegacyPointer off_animTextures_current; public ushort num_animTextures; public byte properties; @@ -40,7 +40,7 @@ public class VisualMaterial { public static uint flags_isBillboard = (1 << 9); public static uint Flags_IsTransparent { get { - if (Settings.s.game == Settings.Game.LargoWinch) { + if (Legacy_Settings.s.game == Legacy_Settings.Game.LargoWinch) { return (1 << 10); } else { return (1 << 3); @@ -141,9 +141,9 @@ public string ToJSON() public bool IsTransparent { get { bool transparent = false; - if (Settings.s.engineVersion == Settings.EngineVersion.R3 && + if (Legacy_Settings.s.engineVersion == Legacy_Settings.EngineVersion.R3 && ((flags & Flags_IsTransparent) != 0 || (receivedHints & Hint.Transparent) == Hint.Transparent)) transparent = true; - if (Settings.s.engineVersion < Settings.EngineVersion.R3) { + if (Legacy_Settings.s.engineVersion < Legacy_Settings.EngineVersion.R3) { if ((flags & 0x4000000) != 0) transparent = true; } if (transparent) { @@ -179,7 +179,7 @@ public bool IsLight { public bool IsPixelShaded { get { - if (Settings.s.engineVersion < Settings.EngineVersion.R3) { + if (Legacy_Settings.s.engineVersion < Legacy_Settings.EngineVersion.R3) { return false; } else { if (textures.Count > 0) { @@ -195,52 +195,52 @@ public bool IsLockedAnimatedTexture { get { return (properties & 1) == 1; } } - public VisualMaterial(Pointer offset) { + public VisualMaterial(LegacyPointer offset) { this.offset = offset; textures = new List(); animTextures = new List(); } - public static VisualMaterial Read(Reader reader, Pointer offset) { + public static VisualMaterial Read(Reader reader, LegacyPointer offset) { MapLoader l = MapLoader.Loader; VisualMaterial m = new VisualMaterial(offset); // Material struct = 0x188 //l.print("Material @ " + offset); m.flags = reader.ReadUInt32(); // After this: 0x4 - if (Settings.s.game != Settings.Game.R2Revolution && Settings.s.game != Settings.Game.LargoWinch) { - if (Settings.s.platform == Settings.Platform.DC) reader.ReadUInt32(); + if (Legacy_Settings.s.game != Legacy_Settings.Game.R2Revolution && Legacy_Settings.s.game != Legacy_Settings.Game.LargoWinch) { + if (Legacy_Settings.s.platform == Legacy_Settings.Platform.DC) reader.ReadUInt32(); m.ambientCoef = new Vector4(reader.ReadSingle(), reader.ReadSingle(), reader.ReadSingle(), reader.ReadSingle()); m.diffuseCoef = new Vector4(reader.ReadSingle(), reader.ReadSingle(), reader.ReadSingle(), reader.ReadSingle()); m.specularCoef = new Vector4(reader.ReadSingle(), reader.ReadSingle(), reader.ReadSingle(), reader.ReadSingle()); m.color = new Vector4(reader.ReadSingle(), reader.ReadSingle(), reader.ReadSingle(), reader.ReadSingle()); // 0x44 - } else if (Settings.s.game == Settings.Game.R2Revolution) { + } else if (Legacy_Settings.s.game == Legacy_Settings.Game.R2Revolution) { // Fill in light info for Revolution m.ambientCoef = new Vector4(0, 0, 0, 1f); m.diffuseCoef = new Vector4(reader.ReadSingle(), reader.ReadSingle(), reader.ReadSingle(), reader.ReadSingle()); //m.diffuseCoef = new Vector4(1, 1, 1, 1); reader.ReadInt32(); // current refresh number for scrolling/animated textures - m.off_animTextures_first = Pointer.Read(reader); - m.off_animTextures_current = Pointer.Read(reader); + m.off_animTextures_first = LegacyPointer.Read(reader); + m.off_animTextures_current = LegacyPointer.Read(reader); reader.ReadInt32(); m.num_animTextures = reader.ReadUInt16(); reader.ReadUInt16(); // 0x70 - } else if (Settings.s.game == Settings.Game.LargoWinch) { + } else if (Legacy_Settings.s.game == Legacy_Settings.Game.LargoWinch) { m.ambientCoef = new Vector4(0, 0, 0, 1f); m.color = new Vector4(reader.ReadSingle(), reader.ReadSingle(), reader.ReadSingle(), reader.ReadSingle()); // 0x44 m.diffuseCoef = new Vector4(reader.ReadSingle(), reader.ReadSingle(), reader.ReadSingle(), reader.ReadSingle()); //m.ambientCoef = m.diffuseCoef; reader.ReadInt32(); // current refresh number for scrolling/animated textures - m.off_animTextures_first = Pointer.Read(reader); - m.off_animTextures_current = Pointer.Read(reader); + m.off_animTextures_first = LegacyPointer.Read(reader); + m.off_animTextures_current = LegacyPointer.Read(reader); reader.ReadInt32(); m.num_animTextures = reader.ReadUInt16(); reader.ReadUInt16(); } - if (Settings.s.game == Settings.Game.LargoWinch) { + if (Legacy_Settings.s.game == Legacy_Settings.Game.LargoWinch) { m.num_textures = 1; VisualMaterialTexture t = new VisualMaterialTexture(); - t.offset = Pointer.Current(reader); - t.off_texture = Pointer.Read(reader); // 0x4c + t.offset = LegacyPointer.Current(reader); + t.off_texture = LegacyPointer.Read(reader); // 0x4c t.texture = TextureInfo.FromOffset(t.off_texture); t.textureOp = reader.ReadByte(); t.shadingMode = reader.ReadByte(); @@ -254,11 +254,11 @@ public static VisualMaterial Read(Reader reader, Pointer offset) { new Vector3(reader.ReadSingle(), reader.ReadSingle(), reader.ReadSingle()); new Vector3(reader.ReadSingle(), reader.ReadSingle(), reader.ReadSingle()); m.textures.Add(t); - } else if (Settings.s.game == Settings.Game.R2Revolution) { + } else if (Legacy_Settings.s.game == Legacy_Settings.Game.R2Revolution) { m.num_textures = 1; VisualMaterialTexture t = new VisualMaterialTexture(); - t.offset = Pointer.Current(reader); - t.off_texture = Pointer.Read(reader); // 0x4c + t.offset = LegacyPointer.Current(reader); + t.off_texture = LegacyPointer.Read(reader); // 0x4c t.texture = TextureInfo.FromOffset(t.off_texture); t.scrollMode = reader.ReadUInt32(); t.scrollX = reader.ReadSingle(); @@ -278,18 +278,18 @@ public static VisualMaterial Read(Reader reader, Pointer offset) { reader.ReadByte(); reader.ReadUInt32(); reader.ReadUInt32();*/ - } else if (Settings.s.engineVersion < Settings.EngineVersion.R3) { + } else if (Legacy_Settings.s.engineVersion < Legacy_Settings.EngineVersion.R3) { m.num_textures = 1; reader.ReadUInt32(); // 0x48 VisualMaterialTexture t = new VisualMaterialTexture(); - t.offset = Pointer.Current(reader); - t.off_texture = Pointer.Read(reader); // 0x4c + t.offset = LegacyPointer.Current(reader); + t.off_texture = LegacyPointer.Read(reader); // 0x4c t.texture = TextureInfo.FromOffset(t.off_texture); - if (Settings.s.game == Settings.Game.TT) { + if (Legacy_Settings.s.game == Legacy_Settings.Game.TT) { /*m.off_animTextures_first = Pointer.Read(reader); // 0x68 m.off_animTextures_current = Pointer.Read(reader); // 0x6c m.num_animTextures = reader.ReadUInt16();*/ - Pointer.Read(reader); // detail texture + LegacyPointer.Read(reader); // detail texture t.currentScrollX = reader.ReadSingle(); t.currentScrollY = reader.ReadSingle(); t.scrollX = reader.ReadSingle(); // 0x58 @@ -299,7 +299,7 @@ public static VisualMaterial Read(Reader reader, Pointer offset) { reader.ReadInt32(); // current refresh number for scrolling/animated textures, 0x64 } else { - if (Settings.s.platform == Settings.Platform.DC) { + if (Legacy_Settings.s.platform == Legacy_Settings.Platform.DC) { // For some reason there's a huge gap here reader.ReadBytes(0xD0); } @@ -310,8 +310,8 @@ public static VisualMaterial Read(Reader reader, Pointer offset) { t.scrollMode = reader.ReadUInt32(); //0x60 m.textures.Add(t); reader.ReadInt32(); // current refresh number for scrolling/animated textures, 0x64 - m.off_animTextures_first = Pointer.Read(reader); // 0x68 - m.off_animTextures_current = Pointer.Read(reader); // 0x6c + m.off_animTextures_first = LegacyPointer.Read(reader); // 0x68 + m.off_animTextures_current = LegacyPointer.Read(reader); // 0x6c m.num_animTextures = reader.ReadUInt16(); reader.ReadUInt16(); // 0x70 } @@ -322,19 +322,19 @@ public static VisualMaterial Read(Reader reader, Pointer offset) { reader.ReadByte(); // padding, not in DC } else { // EngineVersion >= R3 reader.ReadUInt32(); // current refresh number for scrolling/animated textures, 0x48 - if (Settings.s.game == Settings.Game.Dinosaur) { + if (Legacy_Settings.s.game == Legacy_Settings.Game.Dinosaur) { reader.ReadBytes(0x1C); } - Pointer off_ps2Tex = null; + LegacyPointer off_ps2Tex = null; Vector4 ps2Scroll = Vector4.zero; - if (Settings.s.platform == Settings.Platform.PS2) { + if (Legacy_Settings.s.platform == Legacy_Settings.Platform.PS2) { reader.ReadUInt32(); - off_ps2Tex = Pointer.Read(reader); + off_ps2Tex = LegacyPointer.Read(reader); ps2Scroll = new Vector4(reader.ReadSingle(), reader.ReadSingle(), reader.ReadSingle(), reader.ReadSingle()); reader.ReadBytes(0x8); } - m.off_animTextures_first = Pointer.Read(reader); - m.off_animTextures_current = Pointer.Read(reader); + m.off_animTextures_first = LegacyPointer.Read(reader); + m.off_animTextures_current = LegacyPointer.Read(reader); m.num_animTextures = reader.ReadUInt16(); reader.ReadUInt16(); reader.ReadUInt32(); @@ -347,9 +347,9 @@ public static VisualMaterial Read(Reader reader, Pointer offset) { m.num_textures_in_material = reader.ReadUInt32(); for (int i = 0; i < 4; i++) { VisualMaterialTexture t = new VisualMaterialTexture(); - t.offset = Pointer.Current(reader); + t.offset = LegacyPointer.Current(reader); //l.print(t.offset); - t.off_texture = Pointer.Read(reader); + t.off_texture = LegacyPointer.Read(reader); bool usePs2Scroll = false; if (t.off_texture == null && i == 0 && off_ps2Tex != null) { t.off_texture = off_ps2Tex; @@ -375,7 +375,7 @@ public static VisualMaterial Read(Reader reader, Pointer offset) { t.uvFunction = reader.ReadByte(); t.scrollByte = reader.ReadByte(); - if (Settings.s.game == Settings.Game.Dinosaur) { + if (Legacy_Settings.s.game == Legacy_Settings.Game.Dinosaur) { t.properties = reader.ReadInt32(); new Vector3(reader.ReadSingle(), reader.ReadSingle(), reader.ReadSingle()); new Vector3(reader.ReadSingle(), reader.ReadSingle(), reader.ReadSingle()); @@ -398,7 +398,7 @@ public static VisualMaterial Read(Reader reader, Pointer offset) { new Vector2(reader.ReadSingle(), reader.ReadSingle()); new Vector2(reader.ReadSingle(), reader.ReadSingle()); new Vector2(reader.ReadSingle(), reader.ReadSingle()); - } else if (Settings.s.platform == Settings.Platform.PS2) { + } else if (Legacy_Settings.s.platform == Legacy_Settings.Platform.PS2) { t.properties = reader.ReadInt32(); new Vector2(reader.ReadSingle(), reader.ReadSingle()); new Vector2(reader.ReadSingle(), reader.ReadSingle()); @@ -445,17 +445,17 @@ public static VisualMaterial Read(Reader reader, Pointer offset) { m.num_textures = (uint)m.textures.Count; } if (m.num_animTextures > 0 && m.off_animTextures_first != null) { - Pointer off_currentAnimTexture = m.off_animTextures_first; - Pointer.Goto(ref reader, m.off_animTextures_first); + LegacyPointer off_currentAnimTexture = m.off_animTextures_first; + LegacyPointer.Goto(ref reader, m.off_animTextures_first); for (int i = 0; i < m.num_animTextures; i++) { if (off_currentAnimTexture == m.off_animTextures_current) m.currentAnimTexture = i; - Pointer off_animTexture = Pointer.Read(reader); + LegacyPointer off_animTexture = LegacyPointer.Read(reader); float time = reader.ReadSingle(); m.animTextures.Add(new AnimatedTexture(off_animTexture, time)); - Pointer off_nextAnimTexture = Pointer.Read(reader); + LegacyPointer off_nextAnimTexture = LegacyPointer.Read(reader); if (off_nextAnimTexture != null) { off_currentAnimTexture = off_nextAnimTexture; - Pointer.Goto(ref reader, off_nextAnimTexture); + LegacyPointer.Goto(ref reader, off_nextAnimTexture); } } } @@ -463,11 +463,11 @@ public static VisualMaterial Read(Reader reader, Pointer offset) { return m; } - public static VisualMaterial FromOffsetOrRead(Pointer offset, Reader reader) { + public static VisualMaterial FromOffsetOrRead(LegacyPointer offset, Reader reader) { if (offset == null) return null; VisualMaterial vm = FromOffset(offset); if (vm == null) { - Pointer.DoAt(ref reader, offset, () => { + LegacyPointer.DoAt(ref reader, offset, () => { vm = VisualMaterial.Read(reader, offset); MapLoader.Loader.visualMaterials.Add(vm); }); @@ -475,7 +475,7 @@ public static VisualMaterial FromOffsetOrRead(Pointer offset, Reader reader) { return vm; } - public static VisualMaterial FromOffset(Pointer offset) { + public static VisualMaterial FromOffset(LegacyPointer offset) { MapLoader l = MapLoader.Loader; for (int i = 0; i < l.visualMaterials.Count; i++) { if (offset == l.visualMaterials[i].offset) return l.visualMaterials[i]; diff --git a/Assets/Scripts/OpenSpace/Visual/VisualMaterialTexture.cs b/Assets/Scripts/OpenSpace/Visual/VisualMaterialTexture.cs index 53d6f5bb..27e9dc37 100644 --- a/Assets/Scripts/OpenSpace/Visual/VisualMaterialTexture.cs +++ b/Assets/Scripts/OpenSpace/Visual/VisualMaterialTexture.cs @@ -10,10 +10,10 @@ namespace OpenSpace.Visual { /// Visual Material definition /// public class VisualMaterialTexture { - public Pointer offset; + public LegacyPointer offset; public uint scrollMode; // R2 - public Pointer off_texture; + public LegacyPointer off_texture; public byte textureOp; /* 3: Trans @@ -50,7 +50,7 @@ public class VisualMaterialTexture { public Texture2D Texture { get { - if (Settings.s.engineVersion < Settings.EngineVersion.R3) { + if (Legacy_Settings.s.engineVersion < Legacy_Settings.EngineVersion.R3) { if (texture == null) return null; return texture.Texture; } @@ -77,7 +77,7 @@ public Texture2D Texture { public bool ScrollingEnabled { get { - if (Settings.s.engineVersion < Settings.EngineVersion.R3) { + if (Legacy_Settings.s.engineVersion < Legacy_Settings.EngineVersion.R3) { return scrollMode != 0; } else { return ((scrollByte & 6) != 0); @@ -87,7 +87,7 @@ public bool ScrollingEnabled { public bool IsScrollX { get { - if (Settings.s.engineVersion < Settings.EngineVersion.R3) { + if (Legacy_Settings.s.engineVersion < Legacy_Settings.EngineVersion.R3) { return scrollMode != 0 && scrollX != 0; } else { return ((scrollByte & 2) != 0) && scrollX != 0; @@ -96,7 +96,7 @@ public bool IsScrollX { } public bool IsScrollY { get { - if (Settings.s.engineVersion < Settings.EngineVersion.R3) { + if (Legacy_Settings.s.engineVersion < Legacy_Settings.EngineVersion.R3) { return scrollMode != 0 && scrollY != 0; } else { return ((scrollByte & 4) != 0) && scrollY != 0; @@ -105,7 +105,7 @@ public bool IsScrollY { } public bool IsRotate { get { - if (Settings.s.engineVersion < Settings.EngineVersion.R3) { + if (Legacy_Settings.s.engineVersion < Legacy_Settings.EngineVersion.R3) { return false; } else { return ((scrollByte & 8) != 0) || ((scrollByte & 16) != 0); @@ -129,19 +129,19 @@ public float RotateSpeed { public float ScrollX { get { if (!IsScrollX) return 0f; - return scrollX * Mathf.Abs(Settings.s.textureAnimationSpeedModifier); + return scrollX * Mathf.Abs(Legacy_Settings.s.textureAnimationSpeedModifier); } } public float ScrollY { get { if (!IsScrollY) return 0f; - return scrollY * Settings.s.textureAnimationSpeedModifier; + return scrollY * Legacy_Settings.s.textureAnimationSpeedModifier; } } public bool IsPixelShaded { get { - if (Settings.s.engineVersion < Settings.EngineVersion.R3) { + if (Legacy_Settings.s.engineVersion < Legacy_Settings.EngineVersion.R3) { return false; } else { return shadingMode != 2; @@ -151,38 +151,38 @@ public bool IsPixelShaded { public bool IsMirrorX { get { - if (Settings.s.engineVersion < Settings.EngineVersion.R3 && texture != null) return texture.IsMirrorX; + if (Legacy_Settings.s.engineVersion < Legacy_Settings.EngineVersion.R3 && texture != null) return texture.IsMirrorX; return (properties & 4) != 0; } } public bool IsMirrorY { get { - if (Settings.s.engineVersion < Settings.EngineVersion.R3 && texture != null) return texture.IsMirrorY; + if (Legacy_Settings.s.engineVersion < Legacy_Settings.EngineVersion.R3 && texture != null) return texture.IsMirrorY; return (properties & 8) != 0; } } public bool IsRepeatU { get { - if (Settings.s.engineVersion < Settings.EngineVersion.R3 && texture != null) return texture.IsRepeatU; - if (Settings.s.game == Settings.Game.Dinosaur || Settings.s.game == Settings.Game.LargoWinch) return true; + if (Legacy_Settings.s.engineVersion < Legacy_Settings.EngineVersion.R3 && texture != null) return texture.IsRepeatU; + if (Legacy_Settings.s.game == Legacy_Settings.Game.Dinosaur || Legacy_Settings.s.game == Legacy_Settings.Game.LargoWinch) return true; // Hack for R3GC US - if (Settings.s.mode == Settings.Mode.Rayman3GC && MapLoader.Loader.allowDeadPointers && offset?.file.name == "test") return true; + if (Legacy_Settings.s.mode == Legacy_Settings.Mode.Rayman3GC && MapLoader.Loader.allowDeadPointers && offset?.file.name == "test") return true; return (properties & 1) != 0; } } public bool IsRepeatV { get { - if (Settings.s.engineVersion < Settings.EngineVersion.R3 && texture != null) return texture.IsRepeatV; - if (Settings.s.game == Settings.Game.Dinosaur || Settings.s.game == Settings.Game.LargoWinch) return true; + if (Legacy_Settings.s.engineVersion < Legacy_Settings.EngineVersion.R3 && texture != null) return texture.IsRepeatV; + if (Legacy_Settings.s.game == Legacy_Settings.Game.Dinosaur || Legacy_Settings.s.game == Legacy_Settings.Game.LargoWinch) return true; // Hack for R3GC US - if (Settings.s.mode == Settings.Mode.Rayman3GC && MapLoader.Loader.allowDeadPointers && offset?.file.name == "test") return true; + if (Legacy_Settings.s.mode == Legacy_Settings.Mode.Rayman3GC && MapLoader.Loader.allowDeadPointers && offset?.file.name == "test") return true; return (properties & 2) != 0; } } public uint Format { get { - if (Settings.s.engineVersion == Settings.EngineVersion.R3 && texture != null) { + if (Legacy_Settings.s.engineVersion == Legacy_Settings.EngineVersion.R3 && texture != null) { return texture.field0; } else return 0; } diff --git a/Assets/Scripts/OpenSpace/Visual/VisualSetLOD.cs b/Assets/Scripts/OpenSpace/Visual/VisualSetLOD.cs index f174168e..cb8d2a0f 100644 --- a/Assets/Scripts/OpenSpace/Visual/VisualSetLOD.cs +++ b/Assets/Scripts/OpenSpace/Visual/VisualSetLOD.cs @@ -8,7 +8,7 @@ namespace OpenSpace.Visual { public struct VisualSetLOD { public float LODdistance; - public Pointer off_data; + public LegacyPointer off_data; public IGeometricObject obj; } } diff --git a/Assets/Scripts/OpenSpace/Waypoints/Arc.cs b/Assets/Scripts/OpenSpace/Waypoints/Arc.cs index 54dd314e..0085f38c 100644 --- a/Assets/Scripts/OpenSpace/Waypoints/Arc.cs +++ b/Assets/Scripts/OpenSpace/Waypoints/Arc.cs @@ -7,11 +7,11 @@ namespace OpenSpace.Waypoints { public class Arc { - public Pointer offset; - public Pointer off_nextArc; + public LegacyPointer offset; + public LegacyPointer off_nextArc; public uint field_0x4; public uint field_0x8; - public Pointer off_node; + public LegacyPointer off_node; public uint capabilities; public uint field_0x14; public int weight; @@ -19,24 +19,24 @@ public class Arc { public GraphNode graphNode; - public Arc(Pointer offset) + public Arc(LegacyPointer offset) { this.offset = offset; } - public static Arc Read(Reader reader, Pointer offset) + public static Arc Read(Reader reader, LegacyPointer offset) { Arc arc = new Arc(offset); // First three pointers are part of linkedlist (next, previous, header) - arc.off_node = Pointer.Read(reader); + arc.off_node = LegacyPointer.Read(reader); arc.capabilities = reader.ReadUInt32(); arc.field_0x14 = reader.ReadUInt32(); arc.weight = reader.ReadInt32(); arc.field_0x1C = reader.ReadInt32(); if (arc.off_node != null) { - Pointer.DoAt(ref reader, arc.off_node, () => { + LegacyPointer.DoAt(ref reader, arc.off_node, () => { arc.graphNode = GraphNode.FromOffsetOrRead(arc.off_node, reader); }); } diff --git a/Assets/Scripts/OpenSpace/Waypoints/ArcList.cs b/Assets/Scripts/OpenSpace/Waypoints/ArcList.cs index ca978cdf..5a430960 100644 --- a/Assets/Scripts/OpenSpace/Waypoints/ArcList.cs +++ b/Assets/Scripts/OpenSpace/Waypoints/ArcList.cs @@ -4,19 +4,19 @@ namespace OpenSpace.Waypoints { public class ArcList { - public Pointer offset; + public LegacyPointer offset; public LinkedList list; - public ArcList(Pointer offset) + public ArcList(LegacyPointer offset) { this.offset = offset; } - public static ArcList Read(Reader reader, Pointer offset) + public static ArcList Read(Reader reader, LegacyPointer offset) { ArcList arcList = new ArcList(offset); - Pointer.DoAt(ref reader, offset, () => { + LegacyPointer.DoAt(ref reader, offset, () => { //zdxList = LinkedList.ReadHeader(r1, o1); arcList.list = LinkedList.Read(ref reader, offset, (off_element) => { diff --git a/Assets/Scripts/OpenSpace/Waypoints/Graph.cs b/Assets/Scripts/OpenSpace/Waypoints/Graph.cs index dbf8f018..e1624150 100644 --- a/Assets/Scripts/OpenSpace/Waypoints/Graph.cs +++ b/Assets/Scripts/OpenSpace/Waypoints/Graph.cs @@ -4,43 +4,43 @@ namespace OpenSpace.Waypoints { public class Graph : IReferenceable { - public Pointer offset; + public LegacyPointer offset; public LinkedList nodes; public string name = null; - public Pointer off_name; - public Pointer off_wayPointName; + public LegacyPointer off_name; + public LegacyPointer off_wayPointName; [JsonIgnore] public ReferenceFields References { get; set; } = new ReferenceFields(); - public Graph(Pointer offset) // MicroStructure for Waypoint stuff, pointer to this is stored in Engine Object + public Graph(LegacyPointer offset) // MicroStructure for Waypoint stuff, pointer to this is stored in Engine Object { this.offset = offset; } - public static Graph Read(Reader reader, Pointer offset) { + public static Graph Read(Reader reader, LegacyPointer offset) { Graph graph = new Graph(offset); - graph.nodes = LinkedList.Read(ref reader, Pointer.Current(reader), (off_element) => { + graph.nodes = LinkedList.Read(ref reader, LegacyPointer.Current(reader), (off_element) => { return GraphNode.FromOffsetOrRead(off_element, reader); }, flags: LinkedList.Flags.HasHeaderPointers, type: LinkedList.Type.Double); - if (Settings.s.engineVersion < Settings.EngineVersion.R3 - && Settings.s.platform != Settings.Platform.DC - && Settings.s.platform != Settings.Platform.PS2) { - graph.off_name = Pointer.Read(reader); - graph.off_wayPointName = Pointer.Read(reader); - Pointer.DoAt(ref reader, graph.off_name, () => { + if (Legacy_Settings.s.engineVersion < Legacy_Settings.EngineVersion.R3 + && Legacy_Settings.s.platform != Legacy_Settings.Platform.DC + && Legacy_Settings.s.platform != Legacy_Settings.Platform.PS2) { + graph.off_name = LegacyPointer.Read(reader); + graph.off_wayPointName = LegacyPointer.Read(reader); + LegacyPointer.DoAt(ref reader, graph.off_name, () => { graph.name = reader.ReadNullDelimitedString(); }); } return graph; } - public static Graph FromOffsetOrRead(Pointer offset, Reader reader) { + public static Graph FromOffsetOrRead(LegacyPointer offset, Reader reader) { if (offset == null) return null; Graph g = FromOffset(offset); if (g == null) { - Pointer.DoAt(ref reader, offset, () => { + LegacyPointer.DoAt(ref reader, offset, () => { g = Graph.Read(reader, offset); MapLoader.Loader.graphs.Add(g); }); @@ -48,7 +48,7 @@ public static Graph FromOffsetOrRead(Pointer offset, Reader reader) { return g; } - public static Graph FromOffset(Pointer offset) { + public static Graph FromOffset(LegacyPointer offset) { MapLoader l = MapLoader.Loader; for (int i = 0; i < l.graphs.Count; i++) { if (offset == l.graphs[i].offset) return l.graphs[i]; diff --git a/Assets/Scripts/OpenSpace/Waypoints/GraphNode.cs b/Assets/Scripts/OpenSpace/Waypoints/GraphNode.cs index 159eac02..21afc073 100644 --- a/Assets/Scripts/OpenSpace/Waypoints/GraphNode.cs +++ b/Assets/Scripts/OpenSpace/Waypoints/GraphNode.cs @@ -4,70 +4,70 @@ namespace OpenSpace.Waypoints { public class GraphNode : ILinkedListEntry { - public Pointer offset; + public LegacyPointer offset; public WayPoint wayPoint; public ArcList arcList; public uint typeOfWP; public uint typeOfWPInit; - public Pointer off_nextNode; - public Pointer off_prevNode; - public Pointer off_graph; - public Pointer off_node; - public Pointer off_wayPoint; + public LegacyPointer off_nextNode; + public LegacyPointer off_prevNode; + public LegacyPointer off_graph; + public LegacyPointer off_node; + public LegacyPointer off_wayPoint; - public Pointer off_arcList; + public LegacyPointer off_arcList; - public Pointer NextEntry { + public LegacyPointer NextEntry { get { return off_nextNode; } } - public Pointer PreviousEntry { + public LegacyPointer PreviousEntry { get { return off_prevNode; } } - public GraphNode(Pointer offset) { + public GraphNode(LegacyPointer offset) { this.offset = offset; } - public static GraphNode FromOffset(Pointer offset) { + public static GraphNode FromOffset(LegacyPointer offset) { if (offset == null) return null; MapLoader l = MapLoader.Loader; return l.graphNodes.FirstOrDefault(g => g.offset == offset); } - public static GraphNode FromOffsetOrRead(Pointer offset, Reader reader) { + public static GraphNode FromOffsetOrRead(LegacyPointer offset, Reader reader) { if (offset == null) return null; GraphNode g = FromOffset(offset); if (g == null) { - Pointer.DoAt(ref reader, offset, () => { + LegacyPointer.DoAt(ref reader, offset, () => { g = GraphNode.Read(reader, offset); }); } return g; } - public static GraphNode Read(Reader reader, Pointer offset) { + public static GraphNode Read(Reader reader, LegacyPointer offset) { GraphNode node = new GraphNode(offset); MapLoader.Loader.graphNodes.Add(node); - node.off_nextNode = Pointer.Read(reader); - node.off_prevNode = Pointer.Read(reader); + node.off_nextNode = LegacyPointer.Read(reader); + node.off_prevNode = LegacyPointer.Read(reader); - node.off_graph = Pointer.Read(reader); - node.off_wayPoint = Pointer.Read(reader); - if (Settings.s.engineVersion != Settings.EngineVersion.Montreal) { + node.off_graph = LegacyPointer.Read(reader); + node.off_wayPoint = LegacyPointer.Read(reader); + if (Legacy_Settings.s.engineVersion != Legacy_Settings.EngineVersion.Montreal) { node.typeOfWP = reader.ReadUInt32(); node.typeOfWPInit = reader.ReadUInt32(); } - node.off_arcList = Pointer.Read(reader); + node.off_arcList = LegacyPointer.Read(reader); //MapLoader.Loader.print("ArcList: "+node.off_arcList); @@ -77,7 +77,7 @@ public static GraphNode Read(Reader reader, Pointer offset) { node.wayPoint = WayPoint.FromOffsetOrRead(node.off_wayPoint, reader); if (node.wayPoint != null) node.wayPoint.containingGraphNodes.Add(node); - Pointer.DoAt(ref reader, node.off_arcList, () => { + LegacyPointer.DoAt(ref reader, node.off_arcList, () => { node.arcList = ArcList.Read(reader, node.off_arcList); }); diff --git a/Assets/Scripts/OpenSpace/Waypoints/MSway.cs b/Assets/Scripts/OpenSpace/Waypoints/MSway.cs index f2202fea..eff819e8 100644 --- a/Assets/Scripts/OpenSpace/Waypoints/MSway.cs +++ b/Assets/Scripts/OpenSpace/Waypoints/MSway.cs @@ -1,22 +1,22 @@ namespace OpenSpace.Waypoints { public class MSWay { - public Pointer offset; + public LegacyPointer offset; public Graph graph; public uint currentIndex; public byte someFlag; - public Pointer off_graph; + public LegacyPointer off_graph; - public MSWay(Pointer offset) // MicroStructure for Waypoint stuff, pointer to this is stored in Engine Object + public MSWay(LegacyPointer offset) // MicroStructure for Waypoint stuff, pointer to this is stored in Engine Object { this.offset = offset; } - public static MSWay Read(Reader reader, Pointer offset) { + public static MSWay Read(Reader reader, LegacyPointer offset) { MSWay msWay = new MSWay(offset); - msWay.off_graph = Pointer.Read(reader); + msWay.off_graph = LegacyPointer.Read(reader); msWay.graph = Graph.FromOffsetOrRead(msWay.off_graph, reader); msWay.currentIndex = reader.ReadUInt32(); msWay.someFlag = reader.ReadByte(); diff --git a/Assets/Scripts/OpenSpace/Waypoints/WayPoint.cs b/Assets/Scripts/OpenSpace/Waypoints/WayPoint.cs index 1aec9007..c71c014d 100644 --- a/Assets/Scripts/OpenSpace/Waypoints/WayPoint.cs +++ b/Assets/Scripts/OpenSpace/Waypoints/WayPoint.cs @@ -9,11 +9,11 @@ namespace OpenSpace.Waypoints { public class WayPoint : IReferenceable{ - public Pointer offset; + public LegacyPointer offset; public Vector3 position; public float radius; - public Pointer off_perso_so; + public LegacyPointer off_perso_so; [JsonIgnore] public List containingGraphNodes; @@ -39,22 +39,22 @@ private void InitGameObject() { } // ^ for isolate waypoints - public WayPoint(Pointer offset) { + public WayPoint(LegacyPointer offset) { this.offset = offset; containingGraphNodes = new List(); } - public static WayPoint FromOffset(Pointer offset) { + public static WayPoint FromOffset(LegacyPointer offset) { if (offset == null) return null; MapLoader l = MapLoader.Loader; return l.waypoints.FirstOrDefault(w => w.offset == offset); } - public static WayPoint FromOffsetOrRead(Pointer offset, Reader reader) { + public static WayPoint FromOffsetOrRead(LegacyPointer offset, Reader reader) { if (offset == null) return null; WayPoint w = FromOffset(offset); if (w == null) { - Pointer.DoAt(ref reader, offset, () => { + LegacyPointer.DoAt(ref reader, offset, () => { w = WayPoint.Read(reader, offset); MapLoader.Loader.waypoints.Add(w); }); @@ -62,14 +62,14 @@ public static WayPoint FromOffsetOrRead(Pointer offset, Reader reader) { return w; } - public static WayPoint Read(Reader reader, Pointer offset) { + public static WayPoint Read(Reader reader, LegacyPointer offset) { WayPoint wp = new WayPoint(offset); float radius = 0; - if (Settings.s.engineVersion == Settings.EngineVersion.Montreal) { + if (Legacy_Settings.s.engineVersion == Legacy_Settings.EngineVersion.Montreal) { reader.ReadUInt32(); } - if (Settings.s.engineVersion == Settings.EngineVersion.TT) { + if (Legacy_Settings.s.engineVersion == Legacy_Settings.EngineVersion.TT) { radius = reader.ReadSingle(); } @@ -77,11 +77,11 @@ public static WayPoint Read(Reader reader, Pointer offset) { float y = reader.ReadSingle(); float z = reader.ReadSingle(); - if (Settings.s.engineVersion != Settings.EngineVersion.TT) { + if (Legacy_Settings.s.engineVersion != Legacy_Settings.EngineVersion.TT) { radius = reader.ReadSingle(); } - if (Settings.s.engineVersion == Settings.EngineVersion.Montreal) { - wp.off_perso_so = Pointer.Read(reader);// perso + if (Legacy_Settings.s.engineVersion == Legacy_Settings.EngineVersion.Montreal) { + wp.off_perso_so = LegacyPointer.Read(reader);// perso } wp.position = new Vector3(x, y, z); diff --git a/Assets/Scripts/Settings.meta b/Assets/Scripts/Settings.meta new file mode 100644 index 00000000..c97fb27e --- /dev/null +++ b/Assets/Scripts/Settings.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 7dd9b829140ba7b4089d660634f4760d +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Settings/Enums.meta b/Assets/Scripts/Settings/Enums.meta new file mode 100644 index 00000000..858bdc32 --- /dev/null +++ b/Assets/Scripts/Settings/Enums.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: a3c5da03359d9da4f8b04420a91473ab +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Settings/Enums/Attributes.meta b/Assets/Scripts/Settings/Enums/Attributes.meta new file mode 100644 index 00000000..004f4c1a --- /dev/null +++ b/Assets/Scripts/Settings/Enums/Attributes.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: b8a2072cb4d2dea4c88d75027efcc42e +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Settings/Enums/Attributes/EngineAttribute.cs b/Assets/Scripts/Settings/Enums/Attributes/EngineAttribute.cs new file mode 100644 index 00000000..1f0ec01c --- /dev/null +++ b/Assets/Scripts/Settings/Enums/Attributes/EngineAttribute.cs @@ -0,0 +1,21 @@ +using System; + +namespace Raymap { + /// + /// Attribute for the + /// + [AttributeUsage(AttributeTargets.Field)] + public sealed class EngineAttribute : Attribute { + /// + /// Default constructor + /// + public EngineAttribute(string displayName) { + DisplayName = displayName; + } + + /// + /// The display name + /// + public string DisplayName { get; } + } +} \ No newline at end of file diff --git a/Assets/Scripts/Settings/Enums/Attributes/EngineAttribute.cs.meta b/Assets/Scripts/Settings/Enums/Attributes/EngineAttribute.cs.meta new file mode 100644 index 00000000..b88cf562 --- /dev/null +++ b/Assets/Scripts/Settings/Enums/Attributes/EngineAttribute.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 293067587002eb8458c81b947cfa8568 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Settings/Enums/Attributes/EngineCategoryAttribute.cs b/Assets/Scripts/Settings/Enums/Attributes/EngineCategoryAttribute.cs new file mode 100644 index 00000000..825bad4f --- /dev/null +++ b/Assets/Scripts/Settings/Enums/Attributes/EngineCategoryAttribute.cs @@ -0,0 +1,27 @@ +using System; + +namespace Raymap { + /// + /// Attribute for the + /// + [AttributeUsage(AttributeTargets.Field)] + public sealed class EngineCategoryAttribute : Attribute { + /// + /// Default constructor + /// + public EngineCategoryAttribute(Engine engine, string displayName) { + Engine = engine; + DisplayName = displayName; + } + + /// + /// The display name + /// + public string DisplayName { get; } + + /// + /// The engine this category is for + /// + public Engine Engine { get; } + } +} \ No newline at end of file diff --git a/Assets/Scripts/Settings/Enums/Attributes/EngineCategoryAttribute.cs.meta b/Assets/Scripts/Settings/Enums/Attributes/EngineCategoryAttribute.cs.meta new file mode 100644 index 00000000..f3d9031e --- /dev/null +++ b/Assets/Scripts/Settings/Enums/Attributes/EngineCategoryAttribute.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 9817fcbde9fce6f4691bfe7cde4421a7 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Settings/Enums/Attributes/GameModeAttribute.cs b/Assets/Scripts/Settings/Enums/Attributes/GameModeAttribute.cs new file mode 100644 index 00000000..28b4de23 --- /dev/null +++ b/Assets/Scripts/Settings/Enums/Attributes/GameModeAttribute.cs @@ -0,0 +1,33 @@ +using System; + +namespace Raymap { + /// + /// Attribute for the + /// + [AttributeUsage(AttributeTargets.Field)] + public sealed class GameModeAttribute : Attribute { + /// + /// Default constructor + /// + public GameModeAttribute(EngineCategory category, Type managerType, string displayName) { + Category = category; + ManagerType = managerType; + DisplayName = displayName; + } + + /// + /// The engine category + /// + public EngineCategory Category { get; } + + /// + /// The display name + /// + public string DisplayName { get; } + + /// + /// The manager type + /// + public Type ManagerType { get; } + } +} \ No newline at end of file diff --git a/Assets/Scripts/Settings/Enums/Attributes/GameModeAttribute.cs.meta b/Assets/Scripts/Settings/Enums/Attributes/GameModeAttribute.cs.meta new file mode 100644 index 00000000..9a250ba9 --- /dev/null +++ b/Assets/Scripts/Settings/Enums/Attributes/GameModeAttribute.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 41ee9495105fb974382f8caab01e35a8 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Settings/Enums/Engine.cs b/Assets/Scripts/Settings/Enums/Engine.cs new file mode 100644 index 00000000..7da96c2f --- /dev/null +++ b/Assets/Scripts/Settings/Enums/Engine.cs @@ -0,0 +1,8 @@ +namespace Raymap { + /// + /// The engines supported by Raymap + /// + public enum Engine { + [Engine("CPA (OpenSpace)")] CPA + } +} \ No newline at end of file diff --git a/Assets/Scripts/Settings/Enums/Engine.cs.meta b/Assets/Scripts/Settings/Enums/Engine.cs.meta new file mode 100644 index 00000000..484f4ed6 --- /dev/null +++ b/Assets/Scripts/Settings/Enums/Engine.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 257440a5e01f76c40875b74f7b530ffd +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Settings/Enums/EngineCategory.cs b/Assets/Scripts/Settings/Enums/EngineCategory.cs new file mode 100644 index 00000000..8bd1aca6 --- /dev/null +++ b/Assets/Scripts/Settings/Enums/EngineCategory.cs @@ -0,0 +1,15 @@ +namespace Raymap { + /// + /// The engine categories (purely for the settings window) + /// + public enum EngineCategory { + [EngineCategory(Engine.CPA, "Tonic Trouble")] CPA_TonicTrouble, + [EngineCategory(Engine.CPA, "Rayman 2")] CPA_Rayman2, + [EngineCategory(Engine.CPA, "Rayman M")] CPA_RaymanM, + [EngineCategory(Engine.CPA, "Rayman 3")] CPA_Rayman3, + [EngineCategory(Engine.CPA, "Rayman Raving Rabbids")] CPA_RaymanRavingRabbids, + [EngineCategory(Engine.CPA, "Licensed - Disney")] CPA_Disney, + [EngineCategory(Engine.CPA, "Licensed - Playmobil")] CPA_Playmobil, + [EngineCategory(Engine.CPA, "Other")] CPA_Other, + } +} \ No newline at end of file diff --git a/Assets/Scripts/Settings/Enums/EngineCategory.cs.meta b/Assets/Scripts/Settings/Enums/EngineCategory.cs.meta new file mode 100644 index 00000000..81aab8b7 --- /dev/null +++ b/Assets/Scripts/Settings/Enums/EngineCategory.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 2d773a3574f1da244bb3661a4962534a +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Settings/Enums/Extensions.meta b/Assets/Scripts/Settings/Enums/Extensions.meta new file mode 100644 index 00000000..cc5bea4b --- /dev/null +++ b/Assets/Scripts/Settings/Enums/Extensions.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 1fbb5ebeac8f66d41920eae4f76357a2 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Settings/Enums/Extensions/GameModeExtensions.cs b/Assets/Scripts/Settings/Enums/Extensions/GameModeExtensions.cs new file mode 100644 index 00000000..d4592e11 --- /dev/null +++ b/Assets/Scripts/Settings/Enums/Extensions/GameModeExtensions.cs @@ -0,0 +1,8 @@ +using BinarySerializer.Unity; +using System; + +namespace Raymap { + public static class GameModeExtensions { + public static BaseGameManager GetManager(this GameModeSelection mode) => (BaseGameManager)Activator.CreateInstance(mode.GetAttribute().ManagerType); + } +} \ No newline at end of file diff --git a/Assets/Scripts/Settings/Enums/Extensions/GameModeExtensions.cs.meta b/Assets/Scripts/Settings/Enums/Extensions/GameModeExtensions.cs.meta new file mode 100644 index 00000000..f57a1fa6 --- /dev/null +++ b/Assets/Scripts/Settings/Enums/Extensions/GameModeExtensions.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: ed261dbcb4ca3f84fb93e7c6ab0fffe9 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Settings/Enums/GameModeSelection.cs b/Assets/Scripts/Settings/Enums/GameModeSelection.cs new file mode 100644 index 00000000..1e22a427 --- /dev/null +++ b/Assets/Scripts/Settings/Enums/GameModeSelection.cs @@ -0,0 +1,71 @@ +namespace Raymap { + /// + /// The available games + /// + public enum GameModeSelection { + [GameMode(EngineCategory.CPA_Rayman2, typeof(CPA_SNAManager), "Rayman 2 (PC)")] Rayman2PC, + [GameMode(EngineCategory.CPA_Rayman2, typeof(CPA_SNAManager), "R2 (PC) Demo (1999/08/19)")] Rayman2PCDemo_1999_08_18, + [GameMode(EngineCategory.CPA_Rayman2, typeof(CPA_SNAManager), "R2 (PC) Demo (1999/09/11)")] Rayman2PCDemo_1999_09_04, + [GameMode(EngineCategory.CPA_Rayman2, typeof(LegacyGameManager), "Rayman 2 (DC)")] Rayman2DC, + [GameMode(EngineCategory.CPA_Rayman2, typeof(CPA_SNAManager), "Rayman 2 (iOS)")] Rayman2IOS, + [GameMode(EngineCategory.CPA_Rayman2, typeof(CPA_SNAManager), "Rayman 2 (iOS) Demo")] Rayman2IOSDemo, + [GameMode(EngineCategory.CPA_Rayman2, typeof(CPA_PS1Manager), "Rayman 2 (PS1)")] Rayman2PS1, + [GameMode(EngineCategory.CPA_Rayman2, typeof(CPA_PS1Manager), "Rayman 2 (PS1) Demo")] Rayman2PS1Demo, + [GameMode(EngineCategory.CPA_Rayman2, typeof(CPA_PS1Manager), "Rayman 2 (PS1) Demo (SLUS_90095)")] Rayman2PS1Demo_SLUS_90095, + [GameMode(EngineCategory.CPA_Rayman2, typeof(LegacyGameManager), "Rayman 2 (PS2)")] Rayman2PS2, + [GameMode(EngineCategory.CPA_Rayman2, typeof(CPA_U64Manager), "Rayman 2 (N64)")] Rayman2N64, + [GameMode(EngineCategory.CPA_Rayman2, typeof(CPA_R2DS_Manager), "Rayman 2 (DS)")] Rayman2DS, + [GameMode(EngineCategory.CPA_Rayman2, typeof(CPA_R23DS_Manager), "Rayman 2 (3DS)")] Rayman23DS, + + [GameMode(EngineCategory.CPA_RaymanM, typeof(LegacyGameManager), "Rayman M (PC)")] RaymanMPC, + [GameMode(EngineCategory.CPA_RaymanM, typeof(LegacyGameManager), "Rayman M (PS2)")] RaymanMPS2, + [GameMode(EngineCategory.CPA_RaymanM, typeof(LegacyGameManager), "RM (PS2) Demo (2001/07/25)")] RaymanMPS2Demo_2001_07_25, + [GameMode(EngineCategory.CPA_RaymanM, typeof(LegacyGameManager), "Rayman Arena (PC)")] RaymanArenaPC, + [GameMode(EngineCategory.CPA_RaymanM, typeof(LegacyGameManager), "Rayman Arena (PS2)")] RaymanArenaPS2, + [GameMode(EngineCategory.CPA_RaymanM, typeof(LegacyGameManager), "Rayman Arena (GC)")] RaymanArenaGC, + [GameMode(EngineCategory.CPA_RaymanM, typeof(LegacyGameManager), "RA (GC) Demo (2002/03/07)")] RaymanArenaGCDemo_2002_03_07, + [GameMode(EngineCategory.CPA_RaymanM, typeof(LegacyGameManager), "Rayman Arena (Xbox)")] RaymanArenaXbox, + [GameMode(EngineCategory.CPA_RaymanM, typeof(CPA_PS1Manager), "Rayman Rush (PS1)")] RaymanRushPS1, + + [GameMode(EngineCategory.CPA_Rayman3, typeof(LegacyGameManager), "Rayman 3 (PC)")] Rayman3PC, + [GameMode(EngineCategory.CPA_Rayman3, typeof(LegacyGameManager), "R3 (PC) Demo (2002/10/01)")] Rayman3PCDemo_2002_10_01, + [GameMode(EngineCategory.CPA_Rayman3, typeof(LegacyGameManager), "R3 (PC) Demo (2002/10/21)")] Rayman3PCDemo_2002_10_21, + [GameMode(EngineCategory.CPA_Rayman3, typeof(LegacyGameManager), "R3 (PC) Demo (2002/12/09)")] Rayman3PCDemo_2002_12_09, + [GameMode(EngineCategory.CPA_Rayman3, typeof(LegacyGameManager), "R3 (PC) Demo (2003/01/06)")] Rayman3PCDemo_2003_01_06, + [GameMode(EngineCategory.CPA_Rayman3, typeof(LegacyGameManager), "Rayman 3 (MacOS)")] Rayman3MacOS, + [GameMode(EngineCategory.CPA_Rayman3, typeof(LegacyGameManager), "Rayman 3 (GC)")] Rayman3GC, + [GameMode(EngineCategory.CPA_Rayman3, typeof(LegacyGameManager), "Rayman 3 (PS2)")] Rayman3PS2, + [GameMode(EngineCategory.CPA_Rayman3, typeof(LegacyGameManager), "R3 (PS2) Demo (2002/05/17)")] Rayman3PS2Demo_2002_05_17, + [GameMode(EngineCategory.CPA_Rayman3, typeof(LegacyGameManager), "R3 (PS2) Demo (2002/08/07)")] Rayman3PS2Demo_2002_08_07, + [GameMode(EngineCategory.CPA_Rayman3, typeof(LegacyGameManager), "R3 (PS2) Dev Build (2002/09/06)")] Rayman3PS2DevBuild_2002_09_06, + [GameMode(EngineCategory.CPA_Rayman3, typeof(LegacyGameManager), "R3 (PS2) Demo (2002/10/29)")] Rayman3PS2Demo_2002_10_29, + [GameMode(EngineCategory.CPA_Rayman3, typeof(LegacyGameManager), "R3 (PS2) Demo (2002/12/18)")] Rayman3PS2Demo_2002_12_18, + [GameMode(EngineCategory.CPA_Rayman3, typeof(LegacyGameManager), "Rayman 3 (Xbox)")] Rayman3Xbox, + [GameMode(EngineCategory.CPA_Rayman3, typeof(LegacyGameManager), "Rayman 3 (Xbox 360)")] Rayman3Xbox360, + [GameMode(EngineCategory.CPA_Rayman3, typeof(LegacyGameManager), "Rayman 3 (PS3)")] Rayman3PS3, + + [GameMode(EngineCategory.CPA_RaymanRavingRabbids, typeof(CPA_RRRDS_Manager), "Rayman Raving Rabbids (DS)")] RaymanRavingRabbidsDS, + [GameMode(EngineCategory.CPA_RaymanRavingRabbids, typeof(CPA_U64Manager), "Rayman Raving Rabbids (DS) Dev Build (2006/05/25)")] RaymanRavingRabbidsDSDevBuild_2006_05_25, + + [GameMode(EngineCategory.CPA_TonicTrouble, typeof(CPA_TTPC_Manager), "Tonic Trouble (PC)")] TonicTroublePC, + [GameMode(EngineCategory.CPA_TonicTrouble, typeof(CPA_SNAManager), "Tonic Trouble: SE (PC)")] TonicTroubleSEPC, + [GameMode(EngineCategory.CPA_TonicTrouble, typeof(CPA_U64Manager), "Tonic Trouble (N64 NTSC)")] TonicTroubleN64, + + [GameMode(EngineCategory.CPA_Disney, typeof(CPA_SNAManager), "Donald Duck: Quack Attack (PC)")] DonaldDuckPC, + [GameMode(EngineCategory.CPA_Disney, typeof(CPA_SNAManager), "Donald Duck: Quack Attack (PC) Demo")] DonaldDuckPCDemo, + [GameMode(EngineCategory.CPA_Disney, typeof(LegacyGameManager), "Donald Duck: Quack Attack (DC)")] DonaldDuckDC, + [GameMode(EngineCategory.CPA_Disney, typeof(CPA_U64Manager), "Donald Duck: Quack Attack (N64)")] DonaldDuckN64, + [GameMode(EngineCategory.CPA_Disney, typeof(CPA_PS1Manager), "Donald Duck: Quack Attack (PS1)")] DonaldDuckPS1, + [GameMode(EngineCategory.CPA_Disney, typeof(LegacyGameManager), "Donald Duck: PK (GC)")] DonaldDuckPKGC, + [GameMode(EngineCategory.CPA_Disney, typeof(LegacyGameManager), "Disney's Dinosaur (PC)")] DinosaurPC, + [GameMode(EngineCategory.CPA_Disney, typeof(CPA_PS1Manager), "Jungle Book: Groove Party (PS1)")] JungleBookPS1, + + [GameMode(EngineCategory.CPA_Playmobil, typeof(CPA_Montreal_Manager), "Playmobil: Hype (PC)")] PlaymobilHypePC, + [GameMode(EngineCategory.CPA_Playmobil, typeof(CPA_Montreal_Manager), "Playmobil: Laura (PC)")] PlaymobilLauraPC, + [GameMode(EngineCategory.CPA_Playmobil, typeof(CPA_Montreal_Manager), "Playmobil: Alex (PC)")] PlaymobilAlexPC, + + [GameMode(EngineCategory.CPA_Other, typeof(LegacyGameManager), "Largo Winch (PC)")] LargoWinchPC, + [GameMode(EngineCategory.CPA_Other, typeof(CPA_PS1Manager), "VIP (PS1)")] VIPPS1, + [GameMode(EngineCategory.CPA_Other, typeof(CPA_SNAManager), "Red Planet (PC)")] RedPlanetPC, + } +} \ No newline at end of file diff --git a/Assets/Scripts/Settings/Enums/GameModeSelection.cs.meta b/Assets/Scripts/Settings/Enums/GameModeSelection.cs.meta new file mode 100644 index 00000000..b6e2d64f --- /dev/null +++ b/Assets/Scripts/Settings/Enums/GameModeSelection.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 410088c42acdd734ea72925273059324 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Settings/MapViewerSettings.cs b/Assets/Scripts/Settings/MapViewerSettings.cs new file mode 100644 index 00000000..1c4d65bb --- /dev/null +++ b/Assets/Scripts/Settings/MapViewerSettings.cs @@ -0,0 +1,53 @@ +using BinarySerializer.Unity; + +namespace Raymap +{ + /// + /// The common map viewer settings + /// + public class MapViewerSettings + { + /// + /// Default constructor + /// + /// The game mode selection + /// The game directory + /// String describing the map to be loaded + public MapViewerSettings(GameModeSelection gameModeSelection, string gameDirectory, string map) + { + // Get the attribute data + GameModeAttribute atr = gameModeSelection.GetAttribute(); + + GameModeSelection = gameModeSelection; + Engine = atr.Category.GetAttribute().Engine; + GameDirectory = Util.NormalizePath(gameDirectory, isFolder: true); + Map = map; + } + + private BaseGameManager _manager; + + /// + /// The game mode selection + /// + public GameModeSelection GameModeSelection { get; } + + /// + /// The major engine version + /// + public Engine Engine { get; } + + /// + /// The game directory + /// + public string GameDirectory { get; set; } + + /// + /// String describing the map to be loaded + /// + public string Map { get; set; } + + public BaseGameManager GetGameManager => _manager ??= GameModeSelection.GetManager(); + public T GetGameManagerOfType() where T : BaseGameManager => (T)GetGameManager; + + } +} \ No newline at end of file diff --git a/Assets/Scripts/Settings/MapViewerSettings.cs.meta b/Assets/Scripts/Settings/MapViewerSettings.cs.meta new file mode 100644 index 00000000..f9eb78f3 --- /dev/null +++ b/Assets/Scripts/Settings/MapViewerSettings.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 40be15076c6226d4e9b8d046eca73480 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Unity/AI/BaseScriptComponent.cs b/Assets/Scripts/Unity/AI/BaseScriptComponent.cs index 17621c9c..60969615 100644 --- a/Assets/Scripts/Unity/AI/BaseScriptComponent.cs +++ b/Assets/Scripts/Unity/AI/BaseScriptComponent.cs @@ -6,7 +6,7 @@ using OpenSpace; public abstract class BaseScriptComponent : MonoBehaviour { - public OpenSpace.Pointer Offset; + public OpenSpace.LegacyPointer Offset; public string offsetString; public string comportOffset; public bool showOffset = false; diff --git a/Assets/Scripts/Unity/AI/DsgVarComponent.cs b/Assets/Scripts/Unity/AI/DsgVarComponent.cs index 8a752f24..7df0e7cf 100644 --- a/Assets/Scripts/Unity/AI/DsgVarComponent.cs +++ b/Assets/Scripts/Unity/AI/DsgVarComponent.cs @@ -37,7 +37,21 @@ public string Name { return "null"; } } - public bool IsArray { + public string SaveType { + get { + if (entry != null) return (entry.saveType == 0 ? "" : entry.saveType.ToString()); + //if (entryROM != null) return entryROM.NiceVariableName; + return "null"; + } + } + public string InitType { + get { + if (entry != null) return (entry.initType == 4 ? "" : entry.initType.ToString()); + //if (entryROM != null) return entryROM.ini; + return "null"; + } + } + public bool IsArray { get { return DsgVarInfoEntry.GetDsgVarTypeFromArrayType(Type) != DsgVarType.None; } diff --git a/Assets/Scripts/Unity/CinematicSwitcher.cs b/Assets/Scripts/Unity/CinematicSwitcher.cs index fbd1bf1f..44a7cb4c 100644 --- a/Assets/Scripts/Unity/CinematicSwitcher.cs +++ b/Assets/Scripts/Unity/CinematicSwitcher.cs @@ -50,7 +50,7 @@ public void Init() { for (int i = 0; i < ps1Streams.Length; i++) { CinematicNames[i + 1] = "Stream " + i; - PS1GameInfo game = PS1GameInfo.Games[Settings.s.mode]; + PS1GameInfo game = PS1GameInfo.Games[Legacy_Settings.s.mode]; if (game != null && game.cines !=null && game.cines.ContainsKey(l.lvlName)) { if (game.cines[l.lvlName].Length > i) { CinematicNames[i + 1] += ": " + game.cines[l.lvlName][i]; diff --git a/Assets/Scripts/Unity/Controller.cs b/Assets/Scripts/Unity/Controller.cs index cd5fb5b2..9ad529fa 100644 --- a/Assets/Scripts/Unity/Controller.cs +++ b/Assets/Scripts/Unity/Controller.cs @@ -19,8 +19,12 @@ using Cysharp.Threading.Tasks; using TMPro; using Unity; +using BinarySerializer.Unity; +using Raymap; public class Controller : MonoBehaviour { + public LoadController LoadController; + public Material baseMaterial; public Material baseTransparentMaterial; public Material baseLightMaterial; @@ -30,7 +34,8 @@ public class Controller : MonoBehaviour { public LightManager lightManager; public GraphManager graphManager; public PortalManager portalManager; - public LoadingScreen loadingScreen; + + public LoadingScreen loadingScreen => LoadController.LoadingScreen; public ObjectSelector selector; public WebCommunicator communicator; public RecordingTool recordingToolPrefab; @@ -93,7 +98,7 @@ public async UniTaskVoid Start() { string lvlName = ""; string actor1Name = ""; string actor2Name = ""; - Settings.Mode mode = UnitySettings.GameMode; + GameModeSelection mode = UnitySettings.SelectedGameMode; gameDataBinFolder = UnitySettings.CurrentDirectory; lvlName = UnitySettings.MapName; actor1Name = UnitySettings.Actor1Name; @@ -119,7 +124,8 @@ public async UniTaskVoid Start() { UnityEngine.Debug.unityLogger.filterLogType = LogType.Assert; } loadingScreen.Active = true; - Settings.Init(mode); + var manager = UnitySettings.GetGameManager; + ((LegacyGameManager)manager).CreateSettings(UnitySettings.GetGameSettings); loader = MapLoader.Loader; loader.controller = this; loader.gameDataBinFolder = gameDataBinFolder; @@ -450,7 +456,7 @@ private async UniTask CreateScreenshotAfterLoad(bool waitBeforeScreenshot = fals Vector3 center = worldMin + worldSize * 0.5f; sectorManager.displayInactiveSectors = true; - lightManager.luminosity = Settings.s.luminosity * 2.0f; + lightManager.luminosity = Legacy_Settings.s.luminosity * 2.0f; SpawnableParent?.SetActive(false); byte[] screenshotBytes; @@ -737,7 +743,7 @@ async UniTask InitPersos() { if (p.stdGame != null) { CustomBitsComponent c = p.Gao.AddComponent(); c.stdGame = p.stdGame; - if (Settings.s.engineVersion == Settings.EngineVersion.R3) c.hasAiCustomBits = true; + if (Legacy_Settings.s.engineVersion == Legacy_Settings.EngineVersion.R3) c.hasAiCustomBits = true; c.Init(); } } @@ -1202,7 +1208,7 @@ public void UpdateLivePreview() { if (so.off_matrix == null) { continue; } - Pointer.Goto(ref reader, so.off_matrix); + LegacyPointer.Goto(ref reader, so.off_matrix); so.matrix = Matrix.Read(MapLoader.Loader.livePreviewReader, so.off_matrix); if (so.data != null && so.data.Gao != null) { so.data.Gao.transform.localPosition = so.matrix.GetPosition(convertAxes: true); @@ -1215,7 +1221,7 @@ public void UpdateLivePreview() { PersoBehaviour pb = perso.Gao.GetComponent(); if (pb != null) { - Pointer.Goto(ref reader, perso.p3dData.offset); + LegacyPointer.Goto(ref reader, perso.p3dData.offset); perso.p3dData.UpdateCurrentState(reader); // State offset changed? @@ -1228,7 +1234,7 @@ public void UpdateLivePreview() { MindComponent mc = perso.Gao.GetComponent(); if (mc != null) { Mind mind = mc.mind; - Pointer.DoAt(ref reader, mind.Offset, () => { + LegacyPointer.DoAt(ref reader, mind.Offset, () => { mind.UpdateCurrentBehaviors(reader); }); } @@ -1240,7 +1246,7 @@ public void UpdateLivePreview() { CustomBitsComponent customBitsComponent = perso.Gao.GetComponent(); if (customBitsComponent != null) { - Pointer.Goto(ref reader, perso.off_stdGame); + LegacyPointer.Goto(ref reader, perso.off_stdGame); perso.stdGame = StandardGame.Read(reader, perso.off_stdGame); customBitsComponent.stdGame = perso.stdGame; customBitsComponent.Init(); @@ -1248,7 +1254,7 @@ public void UpdateLivePreview() { DynamicsMechanicsComponent dnComponent = perso.Gao.GetComponent(); if (dnComponent != null) { - Pointer.DoAt(ref reader, perso.off_dynam, () => { + LegacyPointer.DoAt(ref reader, perso.off_dynam, () => { perso.dynam = Dynam.Read(reader, perso.off_dynam); }); @@ -1262,7 +1268,7 @@ public void UpdateLivePreview() { if (camera != null) { SuperObject cameraSO = camera.SuperObject; - Pointer.Goto(ref reader, cameraSO.off_matrix); + LegacyPointer.Goto(ref reader, cameraSO.off_matrix); cameraSO.matrix = Matrix.Read(reader, cameraSO.off_matrix); camera.Gao.transform.localPosition = cameraSO.matrix.GetPosition(convertAxes: true); camera.Gao.transform.localRotation = cameraSO.matrix.GetRotation(convertAxes: true); diff --git a/Assets/Scripts/Unity/GrabLocationDisplay/GrabLocationDisplayScript.cs b/Assets/Scripts/Unity/GrabLocationDisplay/GrabLocationDisplayScript.cs index e140225b..f157046f 100644 --- a/Assets/Scripts/Unity/GrabLocationDisplay/GrabLocationDisplayScript.cs +++ b/Assets/Scripts/Unity/GrabLocationDisplay/GrabLocationDisplayScript.cs @@ -26,11 +26,11 @@ void Update() if (reader != null) { MemoryFile mem = (MemoryFile)MapLoader.Loader.files_array[0]; - new Pointer(0x500298, mem).Goto(ref reader); - (Pointer.Read(reader)+ 0x234).Goto(ref reader); - (Pointer.Read(reader)+ 0x10).Goto(ref reader); - (Pointer.Read(reader) + 0xC).Goto(ref reader); - (Pointer.Read(reader) + 0xB0).Goto(ref reader); + new LegacyPointer(0x500298, mem).Goto(ref reader); + (LegacyPointer.Read(reader)+ 0x234).Goto(ref reader); + (LegacyPointer.Read(reader)+ 0x10).Goto(ref reader); + (LegacyPointer.Read(reader) + 0xC).Goto(ref reader); + (LegacyPointer.Read(reader) + 0xB0).Goto(ref reader); float x = reader.ReadSingle(); float y = reader.ReadSingle(); float z = reader.ReadSingle(); diff --git a/Assets/Scripts/Unity/GraphManager.cs b/Assets/Scripts/Unity/GraphManager.cs index d5d93663..458ea673 100644 --- a/Assets/Scripts/Unity/GraphManager.cs +++ b/Assets/Scripts/Unity/GraphManager.cs @@ -171,7 +171,7 @@ public void Init() { isolateWaypointRoot.SetActive(false); } foreach (WayPointBehaviour wp in isolateWaypoints) { - Pointer offset = (wp.wpROM != null ? wp.wpROM.Offset : (wp.wpPS1 != null ? wp.wpPS1.Offset : wp.wp.offset)); + LegacyPointer offset = (wp.wpROM != null ? wp.wpROM.Offset : (wp.wpPS1 != null ? wp.wpPS1.Offset : wp.wp.offset)); wp.name = "Isolate WayPoint @" + offset; wp.transform.SetParent(isolateWaypointRoot.transform); } diff --git a/Assets/Scripts/Unity/LightBehaviour.cs b/Assets/Scripts/Unity/LightBehaviour.cs index 2c17798b..a33a572d 100644 --- a/Assets/Scripts/Unity/LightBehaviour.cs +++ b/Assets/Scripts/Unity/LightBehaviour.cs @@ -25,7 +25,7 @@ public class LightBehaviour : MonoBehaviour { public bool IsActive { get { if (li != null) { - if (Settings.s.game == Settings.Game.TTSE) { + if (Legacy_Settings.s.game == Legacy_Settings.Game.TTSE) { return true; } else { return li.turnedOn != 0; @@ -226,7 +226,7 @@ void Update () { rot = transform.rotation; scl = transform.localScale; if (li != null) { - if (Settings.s.engineVersion == Settings.EngineVersion.R3) { + if (Legacy_Settings.s.engineVersion == Legacy_Settings.EngineVersion.R3) { li.transMatrix.type = 7; li.transMatrix.SetTRS(transform.position, transform.rotation, transform.localScale, convertAxes: true, setVec: true); } else { diff --git a/Assets/Scripts/Unity/LightManager.cs b/Assets/Scripts/Unity/LightManager.cs index 38ee8cf7..1970b9ef 100644 --- a/Assets/Scripts/Unity/LightManager.cs +++ b/Assets/Scripts/Unity/LightManager.cs @@ -407,8 +407,8 @@ public void Init() { } } if (useDefaultSettings) { - luminosity = Settings.s.luminosity; - saturate = Settings.s.saturate; + luminosity = Legacy_Settings.s.luminosity; + saturate = Legacy_Settings.s.saturate; } loaded = true; } diff --git a/Assets/Scripts/Unity/LoadingScreen.cs b/Assets/Scripts/Unity/LoadingScreen.cs index d5741990..ec000a5d 100644 --- a/Assets/Scripts/Unity/LoadingScreen.cs +++ b/Assets/Scripts/Unity/LoadingScreen.cs @@ -1,10 +1,4 @@ -using System.Collections; -using System.Collections.Generic; -using UnityEngine; -using OpenSpace; -using System.Linq; -using OpenSpace.Visual; -using OpenSpace.Object; +using UnityEngine; using UnityEngine.UI; public class LoadingScreen : MonoBehaviour { diff --git a/Assets/Scripts/Unity/Moddable.cs b/Assets/Scripts/Unity/Moddable.cs index 84907c77..5f34e4bf 100644 --- a/Assets/Scripts/Unity/Moddable.cs +++ b/Assets/Scripts/Unity/Moddable.cs @@ -25,7 +25,7 @@ public void Start() { public void SaveChanges(Writer writer) { if (startPos != transform.localPosition || startRot != transform.localRotation || startScale != transform.localScale) { - if (Settings.s.engineVersion == Settings.EngineVersion.R3) { + if (Legacy_Settings.s.engineVersion == Legacy_Settings.EngineVersion.R3) { mat.type = 7; mat.SetTRS(transform.localPosition, transform.localRotation, transform.localScale, convertAxes: true, setVec: true); } else { diff --git a/Assets/Scripts/Unity/New.meta b/Assets/Scripts/Unity/New.meta new file mode 100644 index 00000000..c991453a --- /dev/null +++ b/Assets/Scripts/Unity/New.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 957d6ff81ee55c74b9edf4def2d1a71b +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Unity/New/EnvironmentController.cs b/Assets/Scripts/Unity/New/EnvironmentController.cs new file mode 100644 index 00000000..c4e6ba27 --- /dev/null +++ b/Assets/Scripts/Unity/New/EnvironmentController.cs @@ -0,0 +1,25 @@ +using BinarySerializer; +using BinarySerializer.Unity; +using Cysharp.Threading.Tasks; +using Raymap; +using System; +using System.Diagnostics; +using UnityEngine; + +public class EnvironmentController : MonoBehaviour { + // Set in inspector + public GeneralController GeneralController; + public EnvironmentEntry[] Environments; + + public Unity_Environment InitializeEnvironment(string key) { + var env = Environments.FindItem(e => e.Key.ToLowerInvariant() == key.ToLowerInvariant()); + Unity_Environment newEnv = Instantiate(env.Value); + return newEnv; + } + + [Serializable] + public struct EnvironmentEntry { + public string Key; + public Unity_Environment Value; + } +} diff --git a/Assets/Scripts/Unity/New/EnvironmentController.cs.meta b/Assets/Scripts/Unity/New/EnvironmentController.cs.meta new file mode 100644 index 00000000..86f8e08c --- /dev/null +++ b/Assets/Scripts/Unity/New/EnvironmentController.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: a32d85486c07ec94c87f74cf1afb8496 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Unity/New/GeneralController.cs b/Assets/Scripts/Unity/New/GeneralController.cs new file mode 100644 index 00000000..a747fa9e --- /dev/null +++ b/Assets/Scripts/Unity/New/GeneralController.cs @@ -0,0 +1,13 @@ +using BinarySerializer; +using BinarySerializer.Unity; +using Cysharp.Threading.Tasks; +using Raymap; +using System; +using System.Diagnostics; +using UnityEngine; + +public class GeneralController : MonoBehaviour { + // Set in inspector + public LoadController LoadController; + public EnvironmentController EnvironmentController; +} diff --git a/Assets/Scripts/Unity/New/GeneralController.cs.meta b/Assets/Scripts/Unity/New/GeneralController.cs.meta new file mode 100644 index 00000000..27f833cb --- /dev/null +++ b/Assets/Scripts/Unity/New/GeneralController.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 96b90063245454341acec5c8c125079e +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Unity/New/LoadController.cs b/Assets/Scripts/Unity/New/LoadController.cs new file mode 100644 index 00000000..0905c043 --- /dev/null +++ b/Assets/Scripts/Unity/New/LoadController.cs @@ -0,0 +1,139 @@ +using BinarySerializer; +using BinarySerializer.Unity; +using Cysharp.Threading.Tasks; +using Raymap; +using System.Diagnostics; +using UnityEngine; + +public class LoadController : MonoBehaviour { + // Set in Unity inspector + public GeneralController GeneralController; + public LoadingScreen LoadingScreen; + + // The context, to reuse when writing + private Context SerializeContext { get; set; } + + public Unity_Level Level { get; private set; } + public Unity_Environment Environment { get; private set; } + + private void Awake() { + Application.logMessageReceived += Log; + if (Application.platform == RuntimePlatform.WebGLPlayer) { + UnityEngine.Debug.unityLogger.filterLogType = LogType.Assert; + } + + // Make sure filesystem is set before checking here + UnitySettings.ConfigureFileSystem(); + } + + + async UniTaskVoid Start() { + // TODO: Temporary. Call LoadLevelAsync from Controller later. + await LoadLevelAsync(); + } + + + public async UniTask LoadLevelAsync() { + // Create timer + var loadTimer = new Stopwatch(); + TimeController.StartStopwatch(); + loadTimer.Start(); + + // Start loading screen + LoadingScreen.Active = true; + GlobalLoadState.LoadState = GlobalLoadState.State.Loading; + GlobalLoadState.DetailedState = "Starting..."; + + // Create the context + SerializeContext = new MapViewerContext(UnitySettings.GetGameSettings); + var manager = UnitySettings.GetGameManager; + + // Make sure all the necessary files are downloaded + GlobalLoadState.LoadState = GlobalLoadState.State.LoadingFiles; + await manager.LoadFilesAsync(SerializeContext); + await TimeController.WaitIfNecessary(); + + using (SerializeContext) { + // Init editor data + //await LevelEditorData.InitAsync(context.GetR1Settings()); + //await TimeController.WaitIfNecessary(); + + // Load the level + GlobalLoadState.LoadState = GlobalLoadState.State.Loading; + Level = await manager.LoadAsync(SerializeContext); + + // Store Unity_Level in context + Level.Register(SerializeContext); + } + + await TimeController.WaitIfNecessary(); + if (GlobalLoadState.LoadState == GlobalLoadState.State.Error) return; + + GlobalLoadState.LoadState = GlobalLoadState.State.Initializing; + await TimeController.WaitIfNecessary(); + + // Select an "Environment" based on the Unity_Level. + // This environment will be a prefab or will create all the necessary controllers/monobehaviours. + // And those will be initialized by the environment itself. + // This way CPA and Jade for example can use completely different code without getting in each other's way. + Environment = GeneralController.EnvironmentController.InitializeEnvironment(Level.EnvironmentKey); + Environment.Register(SerializeContext); + Environment.Init(); + + // Initialize level + Level.Init(); + + Environment.OnDataLoaded(); + + await TimeController.WaitIfNecessary(); + if (GlobalLoadState.LoadState == GlobalLoadState.State.Error) return; + + GlobalLoadState.DetailedState = "Finished"; + GlobalLoadState.LoadState = GlobalLoadState.State.Finished; + LoadingScreen.Active = false; + + TimeController.StopStopwatch(); + loadTimer.Stop(); + + UnityEngine.Debug.Log($"Loaded in {loadTimer.ElapsedMilliseconds}ms"); + } + + public void OnDestroy() { + Level = null; + SerializeContext?.Dispose(); + SerializeContext = null; + } + + #region Loading screen + private void Update() { + if (LoadingScreen.Active) { + if (GlobalLoadState.LoadState == GlobalLoadState.State.Error) { + LoadingScreen.LoadingText = GlobalLoadState.DetailedState; + LoadingScreen.LoadingtextColor = Color.red; + } else { + LoadingScreen.LoadingText = GlobalLoadState.DetailedState; + LoadingScreen.LoadingtextColor = Color.white; + } + } + } + + public void Log(string condition, string stacktrace, LogType type) { + switch (type) { + case LogType.Exception: + case LogType.Error: + if (GlobalLoadState.LoadState != GlobalLoadState.State.Finished) { + // Allowed exceptions + if (condition.Contains("cleaning the mesh failed")) break; + if (condition.Contains("desc.isValid() failed!")) break; + + // Go to error state + GlobalLoadState.LoadState = GlobalLoadState.State.Error; + if (LoadingScreen.Active) { + GlobalLoadState.DetailedState = condition; + } + } + break; + } + } + #endregion +} diff --git a/Assets/Scripts/Unity/New/LoadController.cs.meta b/Assets/Scripts/Unity/New/LoadController.cs.meta new file mode 100644 index 00000000..dcde555f --- /dev/null +++ b/Assets/Scripts/Unity/New/LoadController.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: f7bcc5590936f7f47b649330a9e963f9 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Unity/Perso/BasePersoBehaviour.cs b/Assets/Scripts/Unity/Perso/BasePersoBehaviour.cs index d00c2173..a14e725c 100644 --- a/Assets/Scripts/Unity/Perso/BasePersoBehaviour.cs +++ b/Assets/Scripts/Unity/Perso/BasePersoBehaviour.cs @@ -55,7 +55,7 @@ public bool IsEnabled { public BrainComponent brain; // Abstract properties - public abstract Pointer Offset { get; } + public abstract LegacyPointer Offset { get; } public abstract string NameFamily { get; } public abstract string NameModel { get; } public abstract string NameInstance { get; } diff --git a/Assets/Scripts/Unity/Perso/BrainComponent.cs b/Assets/Scripts/Unity/Perso/BrainComponent.cs index c242bda0..79da5e98 100644 --- a/Assets/Scripts/Unity/Perso/BrainComponent.cs +++ b/Assets/Scripts/Unity/Perso/BrainComponent.cs @@ -16,14 +16,14 @@ public class BrainComponent : MonoBehaviour { public List Reflex { get; set; } = new List(); public List Macros { get; set; } = new List(); public class Comport { - public Pointer Offset { get; set; } + public LegacyPointer Offset { get; set; } public string GaoName { get; set; } public string Name { get; set; } public BaseScriptComponent FirstScript { get; set; } public List Scripts { get; set; } = new List(); } public class Macro { - public Pointer Offset { get; set; } + public LegacyPointer Offset { get; set; } public string GaoName { get; set; } public string Name { get; set; } public BaseScriptComponent Script { get; set; } diff --git a/Assets/Scripts/Unity/Perso/PS1PersoBehaviour.cs b/Assets/Scripts/Unity/Perso/PS1PersoBehaviour.cs index 96ee7342..2ca2f1bd 100644 --- a/Assets/Scripts/Unity/Perso/PS1PersoBehaviour.cs +++ b/Assets/Scripts/Unity/Perso/PS1PersoBehaviour.cs @@ -33,7 +33,7 @@ public class PS1PersoBehaviour : BasePersoBehaviour { private Dictionary objectIndexScales = new Dictionary(); // Abstract properties - public override Pointer Offset => perso?.Offset; + public override LegacyPointer Offset => perso?.Offset; public override string NameFamily => perso?.p3dData?.family?.name; public override string NameModel => null; public override string NameInstance => perso?.name; @@ -324,7 +324,7 @@ void InitAnimation() { GameObject c = geometricObjectsDynamic.GetGameObject(j, perso.p3dData?.collisionMapping, out bones); if (c != null) { //GeometricObject geo = geometricObjectsDynamic.entries[j].geo; - if (Settings.s.hasDeformations && bones != null) { + if (Legacy_Settings.s.hasDeformations && bones != null) { subObjectBones[i][k] = bones; hasBones = true; } diff --git a/Assets/Scripts/Unity/Perso/PersoBehaviour.cs b/Assets/Scripts/Unity/Perso/PersoBehaviour.cs index b02a4e36..91d92568 100644 --- a/Assets/Scripts/Unity/Perso/PersoBehaviour.cs +++ b/Assets/Scripts/Unity/Perso/PersoBehaviour.cs @@ -35,7 +35,7 @@ public class PersoBehaviour : BasePersoBehaviour, IReferenceable { public bool clearTheBrain = false; // Abstract properties - public override Pointer Offset => perso?.offset; + public override LegacyPointer Offset => perso?.offset; public override string NameFamily => perso?.nameFamily; public override string NameModel => perso?.nameModel; public override string NameInstance => perso?.namePerso; @@ -586,7 +586,7 @@ void InitAnimation(AnimA3DGeneral a3d) { subObjects[i][j].scaleMultiplier.HasValue ? subObjects[i][j].scaleMultiplier.Value : Vector3.one; c.Gao.transform.parent = channelObjects[i].transform; c.Gao.name = "[" + j + "] " + c.Gao.name; - if (Settings.s.hasDeformations && c.Bones != null) hasBones = true; + if (Legacy_Settings.s.hasDeformations && c.Bones != null) hasBones = true; foreach (VisualSetLOD l in c.visualSet) { if (l.obj != null) { GameObject gao = l.obj.Gao; @@ -613,7 +613,7 @@ void InitAnimation(AnimA3DGeneral a3d) { int channelIndex = this.GetChannelByID(m.channel)[0]; if (channelIndex < morphDataArray.GetLength(0) && m.frame < morphDataArray.GetLength(1)) { morphDataArray[channelIndex, m.frame] = m; - if (Settings.s.engineVersion < Settings.EngineVersion.R3 && m.morphProgress == 100 && perso.p3dData.objectList != null && perso.p3dData.objectList.Count > m.objectIndexTo) { + if (Legacy_Settings.s.engineVersion < Legacy_Settings.EngineVersion.R3 && m.morphProgress == 100 && perso.p3dData.objectList != null && perso.p3dData.objectList.Count > m.objectIndexTo) { if (fullMorphPOs[channelIndex] == null) fullMorphPOs[channelIndex] = new Dictionary(); if (!fullMorphPOs[channelIndex].ContainsKey(m.objectIndexTo)) { PhysicalObject o = perso.p3dData.objectList[m.objectIndexTo].po; @@ -622,7 +622,7 @@ void InitAnimation(AnimA3DGeneral a3d) { c.Gao.transform.localScale = c.scaleMultiplier.HasValue ? c.scaleMultiplier.Value : Vector3.one; c.Gao.transform.parent = channelObjects[channelIndex].transform; c.Gao.name = "[Morph] " + c.Gao.name; - if (Settings.s.hasDeformations && c.Bones != null) hasBones = true; + if (Legacy_Settings.s.hasDeformations && c.Bones != null) hasBones = true; foreach (VisualSetLOD l in c.visualSet) { if (l.obj != null) { GameObject gao = l.obj.Gao; @@ -779,7 +779,7 @@ void InitAnimationLargo(AnimA3DLargo animLargo) { subObjects[i][j].scaleMultiplier.HasValue ? subObjects[i][j].scaleMultiplier.Value : Vector3.one; c.Gao.transform.parent = channelObjects[i].transform; c.Gao.name = "[" + j + "] " + c.Gao.name; - if (Settings.s.hasDeformations && c.Bones != null) hasBones = true; + if (Legacy_Settings.s.hasDeformations && c.Bones != null) hasBones = true; foreach (VisualSetLOD l in c.visualSet) { if (l.obj != null) { GameObject gao = l.obj.Gao; @@ -836,7 +836,7 @@ public void UpdateAnimation() { i < of.start_hierarchies_for_frame + of.num_hierarchies_for_frame; i++) { AnimHierarchy h = a3d.hierarchies[i]; - if (Settings.s.engineVersion <= Settings.EngineVersion.TT) { + if (Legacy_Settings.s.engineVersion <= Legacy_Settings.EngineVersion.TT) { channelObjects[h.childChannelID].transform.SetParent(channelObjects[h.parentChannelID].transform); channelParents[h.childChannelID] = true; } else { @@ -919,7 +919,7 @@ public void UpdateAnimation() { if (physicalObject != null && a3d.num_morphData > 0 && morphDataArray != null && i < morphDataArray.GetLength(0) && currentFrame < morphDataArray.GetLength(1)) { AnimMorphData morphData = morphDataArray[i, currentFrame]; - if (morphData != null && (Settings.s.engineVersion >= Settings.EngineVersion.R3 || (morphData.morphProgress != 0 && morphData.morphProgress != 100))) { + if (morphData != null && (Legacy_Settings.s.engineVersion >= Legacy_Settings.EngineVersion.R3 || (morphData.morphProgress != 0 && morphData.morphProgress != 100))) { int numMorphs = Math.Max(1, (int)morphData.numMorphs); for (int j = 0; j < physicalObject.visualSet.Length; j++) { IGeometricObject obj = physicalObject.visualSet[j].obj; @@ -935,7 +935,7 @@ public void UpdateAnimation() { for (int m = 0; m < numMorphs; m++) { ushort objectIndexTo = morphData.objectIndexTo; float morphProgress = morphData.morphProgressFloat; - if (Settings.s.engineVersion >= Settings.EngineVersion.R3) { + if (Legacy_Settings.s.engineVersion >= Legacy_Settings.EngineVersion.R3) { objectIndexTo = morphData.objectIndexToArray[m]; morphProgress = morphData.GetMorphProgressFloat(m); } diff --git a/Assets/Scripts/Unity/Perso/ROMPersoBehaviour.cs b/Assets/Scripts/Unity/Perso/ROMPersoBehaviour.cs index 16b0ac85..17e2abba 100644 --- a/Assets/Scripts/Unity/Perso/ROMPersoBehaviour.cs +++ b/Assets/Scripts/Unity/Perso/ROMPersoBehaviour.cs @@ -34,7 +34,7 @@ public class ROMPersoBehaviour : BasePersoBehaviour { protected new Dictionary>[] channelIDDictionary; // Abstract properties - public override Pointer Offset => perso?.Offset; + public override LegacyPointer Offset => perso?.Offset; public override string NameFamily => _nameFamily ?? $"Family_{perso.stdGame.Value.family.Value.IndexString}"; public override string NameModel => _nameModel ?? $"Model_{(perso.brain.Value?.aiModel.Value?.IndexString ?? "null")}"; public override string NameInstance => _nameInstance ?? $"Instance_{perso.stdGame.Value.family.Value.IndexString}"; diff --git a/Assets/Scripts/Unity/RaymanTrail.cs b/Assets/Scripts/Unity/RaymanTrail.cs index ee30eff8..33b472a1 100644 --- a/Assets/Scripts/Unity/RaymanTrail.cs +++ b/Assets/Scripts/Unity/RaymanTrail.cs @@ -133,7 +133,7 @@ private void UpdateLivePreview() { Reader reader = MapLoader.Loader.livePreviewReader; - Pointer.Goto(ref reader, Rayman.off_staticMatrix); + LegacyPointer.Goto(ref reader, Rayman.off_staticMatrix); Rayman.matrix = Matrix.Read(MapLoader.Loader.livePreviewReader, Rayman.off_staticMatrix); if (Rayman.data != null && Rayman.data.Gao != null) { Rayman.data.Gao.transform.position = Rayman.matrix.GetPosition(convertAxes: true); @@ -145,7 +145,7 @@ private void UpdateLivePreview() PersoBehaviour pb = RaymanPersoBehaviour; if (pb != null) { - Pointer.Goto(ref reader, perso.p3dData.offset); + LegacyPointer.Goto(ref reader, perso.p3dData.offset); perso.p3dData.UpdateCurrentState(reader); // State offset changed? diff --git a/Assets/Scripts/Unity/RecordingTool.cs b/Assets/Scripts/Unity/RecordingTool.cs index 8bc699af..97280842 100644 --- a/Assets/Scripts/Unity/RecordingTool.cs +++ b/Assets/Scripts/Unity/RecordingTool.cs @@ -152,7 +152,7 @@ private void UpdateLivePreview( PersoBehaviour pb, Reader reader) // Update gameobject being active MapLoader.Loader.controller.UpdatePersoActive(pb); - Pointer.Goto(ref reader, pb.perso.off_stdGame); + LegacyPointer.Goto(ref reader, pb.perso.off_stdGame); // Update stdgame pb.perso.stdGame = StandardGame.Read(reader, pb.perso.off_stdGame); // If stdgame says the object is inactive, deactivate gao too (ignore camera) @@ -163,11 +163,11 @@ private void UpdateLivePreview( PersoBehaviour pb, Reader reader) if (pb.gameObject.activeSelf) { var mind = pb.brain?.mind?.mind; if (mind != null) { - Pointer.DoAt(ref reader, mind.Offset, () => { mind.UpdateCurrentBehaviors(reader); }); // TODO: add a toggle to not record behaviors + LegacyPointer.DoAt(ref reader, mind.Offset, () => { mind.UpdateCurrentBehaviors(reader); }); // TODO: add a toggle to not record behaviors } } - Pointer.Goto(ref reader, spo.off_staticMatrix); + LegacyPointer.Goto(ref reader, spo.off_staticMatrix); spo.matrix = Matrix.Read(MapLoader.Loader.livePreviewReader, spo.off_staticMatrix); if (spo.data != null && spo.data.Gao != null) { @@ -183,7 +183,7 @@ private void UpdateLivePreview( PersoBehaviour pb, Reader reader) var perso = pb.perso; - Pointer.Goto(ref reader, perso.p3dData.offset); + LegacyPointer.Goto(ref reader, perso.p3dData.offset); perso.p3dData.UpdateCurrentState(reader); // State offset changed? @@ -204,7 +204,7 @@ public void StartRecording() RecordingSpawnablesRoot = new GameObject("Recording Spawnables"); } - SpawnedAlwaysObjects = new Dictionary(); + SpawnedAlwaysObjects = new Dictionary(); if (State != RecordingState.Recording) { Data = new RecordingData(MapLoader.Loader); @@ -441,17 +441,17 @@ public void SeekForwards() CurrentTime += 0.5f; } - public Dictionary SpawnedAlwaysObjects; + public Dictionary SpawnedAlwaysObjects; public void ReadAlways(Reader reader) { MemoryFile mem = (MemoryFile)MapLoader.Loader.files_array[0]; - Pointer.Goto(ref reader, new Pointer(Settings.s.memoryAddresses["always"], mem)); + LegacyPointer.Goto(ref reader, new LegacyPointer(Legacy_Settings.s.memoryAddresses["always"], mem)); var num_always = reader.ReadUInt32(); - var spawnablePersos = OpenSpace.LinkedList.ReadHeader(reader, Pointer.Current(reader), LinkedList.Type.Double); - var currentPointer = Pointer.Current(reader); - var off_alwaysSPOs = Pointer.Read(reader); - Pointer.Goto(ref reader, off_alwaysSPOs); + var spawnablePersos = OpenSpace.LinkedList.ReadHeader(reader, LegacyPointer.Current(reader), LinkedList.Type.Double); + var currentPointer = LegacyPointer.Current(reader); + var off_alwaysSPOs = LegacyPointer.Read(reader); + LegacyPointer.Goto(ref reader, off_alwaysSPOs); if (SuperObject.FromOffset(off_alwaysSPOs) != null) { MapLoader.Loader.superObjects.Remove(SuperObject.FromOffset(off_alwaysSPOs)); @@ -459,31 +459,31 @@ public void ReadAlways(Reader reader) var off_alwaysSpoArray = off_alwaysSPOs; - List ObjectsToRemove = SpawnedAlwaysObjects.Keys.ToList(); + List ObjectsToRemove = SpawnedAlwaysObjects.Keys.ToList(); for (int i = 0; i < num_always; i++) { - int spoSize = Settings.s.game == Settings.Game.R3 ? 0x80 : 0x48; // 0x80 for r3 + int spoSize = Legacy_Settings.s.game == Legacy_Settings.Game.R3 ? 0x80 : 0x48; // 0x80 for r3 var off_alwaysSPO = off_alwaysSpoArray + (i * spoSize); - Pointer.Goto(ref reader, off_alwaysSPO + 0x1c); // make sure spo has a parent, otherwise they're not in the world - var parent = Pointer.Read(reader); + LegacyPointer.Goto(ref reader, off_alwaysSPO + 0x1c); // make sure spo has a parent, otherwise they're not in the world + var parent = LegacyPointer.Read(reader); if (parent != null) { - Pointer.Goto(ref reader, off_alwaysSPO + 4); // read linkedObject (data) - var data = Pointer.Read(reader); + LegacyPointer.Goto(ref reader, off_alwaysSPO + 4); // read linkedObject (data) + var data = LegacyPointer.Read(reader); if (data != null) { - Pointer.Goto(ref reader, data + 4); // stdGame - var stdGamePtr = Pointer.Read(reader); + LegacyPointer.Goto(ref reader, data + 4); // stdGame + var stdGamePtr = LegacyPointer.Read(reader); if (stdGamePtr != null) { if (!SpawnedAlwaysObjects.ContainsKey(stdGamePtr)) { MapLoader.Loader.superObjects.Remove(SuperObject.FromOffset(off_alwaysSPO)); - Pointer.Goto(ref reader, off_alwaysSPO); + LegacyPointer.Goto(ref reader, off_alwaysSPO); var spo = SuperObject.Read(reader, off_alwaysSPO); var pb = spo.Gao.AddComponent(); diff --git a/Assets/Scripts/Unity/SectorManager.cs b/Assets/Scripts/Unity/SectorManager.cs index a40ec735..55e5ad42 100644 --- a/Assets/Scripts/Unity/SectorManager.cs +++ b/Assets/Scripts/Unity/SectorManager.cs @@ -68,7 +68,7 @@ private void UpdateSectors() { } public void UpdateSectorLoading(Vector3 camPos) { - if (Settings.s.engineVersion < Settings.EngineVersion.R2 || Settings.s.game == Settings.Game.LargoWinch) { + if (Legacy_Settings.s.engineVersion < Legacy_Settings.EngineVersion.R2 || Legacy_Settings.s.game == Legacy_Settings.Game.LargoWinch) { activeSector = GetActiveSectorOld(camPos, activeSector); } else { activeSector = GetActiveSector(camPos, blockVirtual: true); @@ -91,7 +91,7 @@ public void UpdateSectorLoading(Vector3 camPos) { } public SectorComponent GetActiveSectorWrapper(Vector3 point) { - if (Settings.s.engineVersion < Settings.EngineVersion.R2 || Settings.s.game == Settings.Game.LargoWinch) { + if (Legacy_Settings.s.engineVersion < Legacy_Settings.EngineVersion.R2 || Legacy_Settings.s.game == Legacy_Settings.Game.LargoWinch) { return GetActiveSectorOld(point); } else { return GetActiveSector(point); diff --git a/Assets/Scripts/Unity/SuperObjectComponent.cs b/Assets/Scripts/Unity/SuperObjectComponent.cs index 6369bc48..2c7586fc 100644 --- a/Assets/Scripts/Unity/SuperObjectComponent.cs +++ b/Assets/Scripts/Unity/SuperObjectComponent.cs @@ -69,7 +69,7 @@ public SuperObject.Type Type { return SuperObject.Type.Unknown; } } - public Pointer Offset { + public LegacyPointer Offset { get { if (so != null) return so.offset; if (soROMDynamic != null) return soROMDynamic.Offset; diff --git a/Assets/Scripts/Unity/UnitySettings.cs b/Assets/Scripts/Unity/UnitySettings.cs index d9ed838d..0c8932d1 100644 --- a/Assets/Scripts/Unity/UnitySettings.cs +++ b/Assets/Scripts/Unity/UnitySettings.cs @@ -1,11 +1,12 @@ -using OpenSpace; -using System; +using System; using System.Collections.Generic; using System.Globalization; using System.IO; using OpenSpace.Exporter; using UnityEngine; using BinarySerializer; +using BinarySerializer.Unity; +using Raymap; /// /// Settings for Raymap @@ -16,14 +17,29 @@ public class UnitySettings { private const string editorPrefsPrefix = "Raymap."; private const string settingsFile = "Settings.txt"; - public static bool IsRaymapGame { get; set; } = false; + private const string serverAddress = "https://raym.app/data/raymap/"; + public static bool IsRaymapGame { get; set; } = false; - public static Dictionary GameDirectories = new Dictionary(); - public static Dictionary GameDirectoriesWeb = new Dictionary(); + public static Dictionary GameDirectories = new Dictionary(); + public static Dictionary GameDirectoriesWeb = new Dictionary(); - public static Dictionary HideDirectories { get; set; } = new Dictionary(); + public static Dictionary HideDirectoriesCategory { get; set; } = new Dictionary(); + public static Dictionary HideDirectoriesEngine { get; set; } = new Dictionary(); + /// + /// Gets the current game settings + /// + public static MapViewerSettings GetGameSettings => new MapViewerSettings(SelectedGameMode, CurrentDirectory, MapName) { + // + }; + + /// + /// Gets a new manager instance for the specified mode + /// + /// + public static BaseGameManager GetGameManager => SelectedGameMode.GetManager(); + /// /// Serialization log file /// @@ -45,14 +61,14 @@ public class UnitySettings { public static string CurrentDirectory { get { if (FileSystem.mode == FileSystem.Mode.Web) { - return GameDirectoriesWeb.TryGetValue(GameMode, out string value) ? value : String.Empty; + return GameDirectoriesWeb.TryGetValue(SelectedGameMode, out string value) ? value : String.Empty; } else { - return GameDirectories.TryGetValue(GameMode, out string value) ? value : String.Empty; + return GameDirectories.TryGetValue(SelectedGameMode, out string value) ? value : String.Empty; } } } - public static Settings.Mode GameMode { get; set; } = Settings.Mode.Rayman2PC; + public static GameModeSelection SelectedGameMode { get; set; } = GameModeSelection.Rayman2PC; public static string MapName { get; set; } public static string ProcessName { get; set; } @@ -68,7 +84,6 @@ public static string CurrentDirectory { public static bool AllowDeadPointers { get; set; } public static bool ForceDisplayBackfaces { get; set; } public static bool BlockyMode { get; set; } - public static bool UseLevelTranslation { get; set; } = true; public static bool TracePointers { get; set; } = false; public static bool VisualizeSectorBorders { get; set; } = false; public static bool CreateFamilyGameObjects { get; set; } = false; @@ -102,30 +117,27 @@ public enum ScreenshotAfterLoadSetting { private static void SerializeSettings(ISerializer s, bool cmdLine = false) { if (!cmdLine) { - Settings.Mode[] modes = (Settings.Mode[])Enum.GetValues(typeof(Settings.Mode)); - foreach (Settings.Mode mode in modes) { + GameModeSelection[] modes = (GameModeSelection[])Enum.GetValues(typeof(GameModeSelection)); + foreach (GameModeSelection mode in modes) { string dir = GameDirectories.ContainsKey(mode) ? GameDirectories[mode] : ""; GameDirectories[mode] = s.SerializeString("Directory" + mode.ToString(), dir); } if (UnityEngine.Application.isEditor) { - foreach (Settings.Mode mode in modes) { + foreach (GameModeSelection mode in modes) { string dir = GameDirectoriesWeb.ContainsKey(mode) ? GameDirectoriesWeb[mode] : ""; GameDirectoriesWeb[mode] = s.SerializeString("WebDirectory" + mode.ToString(), dir); } } } - string modeString = s.SerializeString("GameMode", GameMode.ToString(), "mode", "m"); - GameMode = Enum.TryParse(modeString, out Settings.Mode gameMode) ? gameMode : GameMode; + string modeString = s.SerializeString("GameMode", SelectedGameMode.ToString(), "mode", "m"); + SelectedGameMode = Enum.TryParse(modeString, out GameModeSelection gameMode) ? gameMode : SelectedGameMode; if (cmdLine) { - if (Settings.cmdModeNameDict.ContainsKey(modeString)) { - GameMode = Settings.cmdModeNameDict[modeString]; - } if (FileSystem.mode == FileSystem.Mode.Web) { - string dir = GameDirectoriesWeb.ContainsKey(GameMode) ? GameDirectoriesWeb[GameMode] : ""; - GameDirectoriesWeb[GameMode] = s.SerializeString("WebDirectory", dir, "dir", "directory", "folder", "f", "d"); + string dir = GameDirectoriesWeb.ContainsKey(SelectedGameMode) ? GameDirectoriesWeb[SelectedGameMode] : ""; + GameDirectoriesWeb[SelectedGameMode] = s.SerializeString("WebDirectory", dir, "dir", "directory", "folder", "f", "d"); } else { - string dir = GameDirectories.ContainsKey(GameMode) ? GameDirectories[GameMode] : ""; - GameDirectories[GameMode] = s.SerializeString("Directory", dir, "dir", "directory", "folder", "f", "d"); + string dir = GameDirectories.ContainsKey(SelectedGameMode) ? GameDirectories[SelectedGameMode] : ""; + GameDirectories[SelectedGameMode] = s.SerializeString("Directory", dir, "dir", "directory", "folder", "f", "d"); } } MapName = s.SerializeString("MapName", MapName, "level", "lvl", "map"); @@ -182,17 +194,21 @@ private static void SerializeSettings(ISerializer s, bool cmdLine = false) { TracePointers = s.SerializeBool("TracePointers", TracePointers); SaveTextures = s.SerializeBool("SaveTextures", SaveTextures); ExportText = s.SerializeBool("ExportText", ExportText); - UseLevelTranslation = s.SerializeBool("UseLevelTranslation", UseLevelTranslation); VisualizeSectorBorders = s.SerializeBool("VisualizeSectorBorders", VisualizeSectorBorders); CreateFamilyGameObjects = s.SerializeBool("CreateFamilyGameObjects", CreateFamilyGameObjects); ShowCollisionDataForNoCollisionObjects = s.SerializeBool("ShowCollisionDataForNoCollisionObjects", ShowCollisionDataForNoCollisionObjects); - Settings.EngineVersion[] engines = EnumHelpers.GetValues(); - foreach (Settings.EngineVersion engine in engines) { - bool v = HideDirectories.ContainsKey(engine) && HideDirectories[engine]; - HideDirectories[engine] = s.SerializeBool("HideDirectory" + engine.ToString(), v); + EngineCategory[] categories = EnumHelpers.GetValues(); + foreach (EngineCategory category in categories) { + bool v = HideDirectoriesCategory.ContainsKey(category) && HideDirectoriesCategory[category]; + HideDirectoriesCategory[category] = s.SerializeBool("HideDirectoryCategory_" + category.ToString(), v); + } + Engine[] engines = EnumHelpers.GetValues(); + foreach (Engine engine in categories) { + bool v = HideDirectoriesEngine.ContainsKey(engine) && HideDirectoriesEngine[engine]; + HideDirectoriesEngine[engine] = s.SerializeBool("HideDirectoryEngine_" + engine.ToString(), v); } Log = s.SerializeBool("Log", Log); LogFile = s.SerializeString("LogFile", LogFile); @@ -220,6 +236,7 @@ public static void Save() { /// Loads the settings /// public static void Load() { + System.Threading.Thread.CurrentThread.CurrentCulture = System.Globalization.CultureInfo.InvariantCulture; if (Application.isEditor) { #if UNITY_EDITOR ISerializer s = new EditorReadSerializer(); @@ -239,13 +256,13 @@ public static void Load() { } public static void ConfigureFileSystem() { - + FileSystem.serverAddress = serverAddress; if (Application.platform == RuntimePlatform.WebGLPlayer) { - FileSystem.mode = FileSystem.Mode.Web; + FileSystem.mode = BinarySerializer.Unity.FileSystem.Mode.Web; } #if UNITY_EDITOR if (Application.isEditor && UnityEditor.EditorUserBuildSettings.activeBuildTarget == UnityEditor.BuildTarget.WebGL) { - FileSystem.mode = FileSystem.Mode.Web; + FileSystem.mode = BinarySerializer.Unity.FileSystem.Mode.Web; } #endif } diff --git a/Assets/Scripts/Unity/WayPointBehaviour.cs b/Assets/Scripts/Unity/WayPointBehaviour.cs index d55bd660..a2c23e7e 100644 --- a/Assets/Scripts/Unity/WayPointBehaviour.cs +++ b/Assets/Scripts/Unity/WayPointBehaviour.cs @@ -256,7 +256,7 @@ void UpdateLine(int i) { }*/ public void SaveChanges(Writer writer) { - Pointer.Goto(ref writer, wp.offset); + LegacyPointer.Goto(ref writer, wp.offset); writer.Write(transform.position.x); writer.Write(transform.position.z); writer.Write(transform.position.y); diff --git a/Assets/Scripts/Unity/Web/WebCommunicator.cs b/Assets/Scripts/Unity/Web/WebCommunicator.cs index c9207556..49793fdf 100644 --- a/Assets/Scripts/Unity/Web/WebCommunicator.cs +++ b/Assets/Scripts/Unity/Web/WebCommunicator.cs @@ -186,9 +186,9 @@ public WebJSON.GameSettings GetGameSettingsJSON() { } return new WebJSON.GameSettings() { EngineMode = mode, - EngineVersion = OpenSpace.Settings.s.engineVersion, - Game = OpenSpace.Settings.s.game, - Mode = OpenSpace.Settings.s.mode + EngineVersion = OpenSpace.Legacy_Settings.s.engineVersion, + Game = OpenSpace.Legacy_Settings.s.game, + Mode = OpenSpace.Legacy_Settings.s.mode }; } public WebJSON.Message GetCineDataMessageJSON() { @@ -203,7 +203,7 @@ public WebJSON.CineData GetCineDataJSON() { CinematicNames = controller.CinematicSwitcher.CinematicNames, CinematicIndex = controller.CinematicSwitcher.CinematicIndex, Actors = controller.CinematicSwitcher.actors == null || controller.CinematicSwitcher.actors.Length == 0 ? null : controller.CinematicSwitcher.actors.Select(a => GetPersoJSON(a, includeDetails: false)).ToArray(), - AnimationSpeed = OpenSpace.Settings.s.platform == OpenSpace.Settings.Platform.PS1 ? (float?)controller.CinematicSwitcher.animationSpeed : null + AnimationSpeed = OpenSpace.Legacy_Settings.s.platform == OpenSpace.Legacy_Settings.Platform.PS1 ? (float?)controller.CinematicSwitcher.animationSpeed : null }; } return null; @@ -724,7 +724,7 @@ async UniTaskVoid TakeScreenshot(WebJSON.Screenshot msg) { private BaseScriptComponent GetScriptFromRequest(WebJSON.Request msg) { if (selector.selectedPerso == null || selector.selectedPerso.brain == null) return null; BrainComponent brain = selector.selectedPerso.brain; - Pointer offset = msg.Offset; + LegacyPointer offset = msg.Offset; switch (msg.BehaviorType) { case WebJSON.BehaviorType.Intelligence: if (brain.Intelligence == null) return null; @@ -756,7 +756,7 @@ private BaseScriptComponent GetScriptFromRequest(WebJSON.Request msg) { private BrainComponent.Comport GetComportFromRequest(WebJSON.Request msg) { if (selector.selectedPerso == null || selector.selectedPerso.brain == null) return null; BrainComponent brain = selector.selectedPerso.brain; - Pointer offset = msg.Offset; + LegacyPointer offset = msg.Offset; switch (msg.BehaviorType) { case WebJSON.BehaviorType.Intelligence: if (brain.Intelligence == null) return null; @@ -776,7 +776,7 @@ private BrainComponent.Comport GetComportFromRequest(WebJSON.Request msg) { private BrainComponent.Macro GetMacroFromRequest(WebJSON.Request msg) { if (selector.selectedPerso == null || selector.selectedPerso.brain == null) return null; BrainComponent brain = selector.selectedPerso.brain; - Pointer offset = msg.Offset; + LegacyPointer offset = msg.Offset; switch (msg.BehaviorType) { case WebJSON.BehaviorType.Macro: if (brain.Macros == null) return null; @@ -787,7 +787,7 @@ private BrainComponent.Macro GetMacroFromRequest(WebJSON.Request msg) { } return null; } - private BasePersoBehaviour GetPersoFromOffset(Pointer offset) { + private BasePersoBehaviour GetPersoFromOffset(LegacyPointer offset) { if (offset == selectedPerso_?.Offset) { return selectedPerso_; } else { @@ -802,7 +802,7 @@ private BasePersoBehaviour GetPersoFromOffset(Pointer offset) { } } } - private BasePersoBehaviour GetPersoFromSuperObjectOffset(Pointer offset) { + private BasePersoBehaviour GetPersoFromSuperObjectOffset(LegacyPointer offset) { if (offset == selectedPerso_?.Offset) { return selectedPerso_; } else { diff --git a/Assets/Scripts/Unity/Web/WebJSON.cs b/Assets/Scripts/Unity/Web/WebJSON.cs index d60b9f8f..f1321007 100644 --- a/Assets/Scripts/Unity/Web/WebJSON.cs +++ b/Assets/Scripts/Unity/Web/WebJSON.cs @@ -36,10 +36,10 @@ public class OutlineColors { public Color? SelectColor { get; set; } } public class GameSettings { - public OpenSpace.Settings.EngineVersion EngineVersion { get; set; } - public OpenSpace.Settings.Game Game { get; set; } - public OpenSpace.Settings.Platform Platform { get; set; } - public OpenSpace.Settings.Mode Mode { get; set; } + public OpenSpace.Legacy_Settings.EngineVersion EngineVersion { get; set; } + public OpenSpace.Legacy_Settings.Game Game { get; set; } + public OpenSpace.Legacy_Settings.Platform Platform { get; set; } + public OpenSpace.Legacy_Settings.Mode Mode { get; set; } public EngineMode EngineMode { get; set; } } public class CineData { @@ -77,7 +77,7 @@ public class SuperObject { public SuperObject[] Children { get; set; } // Optional - public OpenSpace.Pointer Offset { get; set; } + public OpenSpace.LegacyPointer Offset { get; set; } public Perso Perso { get; set; } public string Name { get; set; } public Vector3? Position { get; set; } @@ -86,7 +86,7 @@ public class SuperObject { } public class Perso { public PersoType Type { get; set; } = PersoType.Instance; - public OpenSpace.Pointer Offset { get; set; } + public OpenSpace.LegacyPointer Offset { get; set; } // Optional public string Name { get; set; } @@ -128,18 +128,18 @@ public class Brain { public DsgVar[] DsgVars { get; set; } } public class Comport { - public OpenSpace.Pointer Offset { get; set; } + public OpenSpace.LegacyPointer Offset { get; set; } public string Name { get; set; } public Script FirstScript { get; set; } public Script[] Scripts { get; set; } } public class Macro { - public OpenSpace.Pointer Offset { get; set; } + public OpenSpace.LegacyPointer Offset { get; set; } public string Name { get; set; } public Script Script { get; set; } } public class Script { - public OpenSpace.Pointer Offset { get; set; } + public OpenSpace.LegacyPointer Offset { get; set; } public string Translation { get; set; } } @@ -211,7 +211,7 @@ public class Request { public RequestType Type { get; set; } // Optional - public OpenSpace.Pointer Offset { get; set; } + public OpenSpace.LegacyPointer Offset { get; set; } public BehaviorType? BehaviorType { get; set; } public Screenshot Screenshot { get; set; } } diff --git a/Packages/manifest.json b/Packages/manifest.json index a60b6b4b..4101fa21 100644 --- a/Packages/manifest.json +++ b/Packages/manifest.json @@ -12,16 +12,15 @@ "com.unity.2d.sprite": "1.0.0", "com.unity.2d.tilemap": "1.0.0", "com.unity.analytics": "3.6.12", - "com.unity.collab-proxy": "1.9.0", "com.unity.ext.nunit": "1.0.6", - "com.unity.ide.rider": "2.0.7", - "com.unity.ide.visualstudio": "2.0.14", - "com.unity.ide.vscode": "1.2.4", - "com.unity.test-framework": "1.1.30", + "com.unity.ide.rider": "3.0.14", + "com.unity.ide.visualstudio": "2.0.15", + "com.unity.ide.vscode": "1.2.5", + "com.unity.nuget.newtonsoft-json": "3.0.2", + "com.unity.test-framework": "1.1.31", "com.unity.textmeshpro": "3.0.6", - "com.unity.timeline": "1.4.8", + "com.unity.timeline": "1.6.4", "com.unity.ugui": "1.0.0", - "jillejr.newtonsoft.json-for-unity": "12.0.302", "com.unity.modules.ai": "1.0.0", "com.unity.modules.androidjni": "1.0.0", "com.unity.modules.animation": "1.0.0", diff --git a/Packages/packages-lock.json b/Packages/packages-lock.json index a14c4276..be1815b3 100644 --- a/Packages/packages-lock.json +++ b/Packages/packages-lock.json @@ -21,13 +21,6 @@ }, "url": "https://packages.unity.com" }, - "com.unity.collab-proxy": { - "version": "1.9.0", - "depth": 0, - "source": "registry", - "dependencies": {}, - "url": "https://packages.unity.com" - }, "com.unity.ext.nunit": { "version": "1.0.6", "depth": 0, @@ -36,16 +29,16 @@ "url": "https://packages.unity.com" }, "com.unity.ide.rider": { - "version": "2.0.7", + "version": "3.0.14", "depth": 0, "source": "registry", "dependencies": { - "com.unity.test-framework": "1.1.1" + "com.unity.ext.nunit": "1.0.6" }, "url": "https://packages.unity.com" }, "com.unity.ide.visualstudio": { - "version": "2.0.14", + "version": "2.0.15", "depth": 0, "source": "registry", "dependencies": { @@ -54,14 +47,21 @@ "url": "https://packages.unity.com" }, "com.unity.ide.vscode": { - "version": "1.2.4", + "version": "1.2.5", + "depth": 0, + "source": "registry", + "dependencies": {}, + "url": "https://packages.unity.com" + }, + "com.unity.nuget.newtonsoft-json": { + "version": "3.0.2", "depth": 0, "source": "registry", "dependencies": {}, "url": "https://packages.unity.com" }, "com.unity.test-framework": { - "version": "1.1.30", + "version": "1.1.31", "depth": 0, "source": "registry", "dependencies": { @@ -81,7 +81,7 @@ "url": "https://packages.unity.com" }, "com.unity.timeline": { - "version": "1.4.8", + "version": "1.6.4", "depth": 0, "source": "registry", "dependencies": { @@ -101,13 +101,6 @@ "com.unity.modules.imgui": "1.0.0" } }, - "jillejr.newtonsoft.json-for-unity": { - "version": "12.0.302", - "depth": 0, - "source": "registry", - "dependencies": {}, - "url": "https://npm.cloudsmith.io/jillejr/newtonsoft-json-for-unity" - }, "com.unity.modules.ai": { "version": "1.0.0", "depth": 0, diff --git a/ProjectSettings/MemorySettings.asset b/ProjectSettings/MemorySettings.asset new file mode 100644 index 00000000..5b5facec --- /dev/null +++ b/ProjectSettings/MemorySettings.asset @@ -0,0 +1,35 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!387306366 &1 +MemorySettings: + m_ObjectHideFlags: 0 + m_EditorMemorySettings: + m_MainAllocatorBlockSize: -1 + m_ThreadAllocatorBlockSize: -1 + m_MainGfxBlockSize: -1 + m_ThreadGfxBlockSize: -1 + m_CacheBlockSize: -1 + m_TypetreeBlockSize: -1 + m_ProfilerBlockSize: -1 + m_ProfilerEditorBlockSize: -1 + m_BucketAllocatorGranularity: -1 + m_BucketAllocatorBucketsCount: -1 + m_BucketAllocatorBlockSize: -1 + m_BucketAllocatorBlockCount: -1 + m_ProfilerBucketAllocatorGranularity: -1 + m_ProfilerBucketAllocatorBucketsCount: -1 + m_ProfilerBucketAllocatorBlockSize: -1 + m_ProfilerBucketAllocatorBlockCount: -1 + m_TempAllocatorSizeMain: -1 + m_JobTempAllocatorBlockSize: -1 + m_BackgroundJobTempAllocatorBlockSize: -1 + m_JobTempAllocatorReducedBlockSize: -1 + m_TempAllocatorSizeGIBakingWorker: -1 + m_TempAllocatorSizeNavMeshWorker: -1 + m_TempAllocatorSizeAudioWorker: -1 + m_TempAllocatorSizeCloudWorker: -1 + m_TempAllocatorSizeGfx: -1 + m_TempAllocatorSizeJobWorker: -1 + m_TempAllocatorSizeBackgroundWorker: -1 + m_TempAllocatorSizePreloadManager: -1 + m_PlatformMemorySettings: {} diff --git a/ProjectSettings/ProjectVersion.txt b/ProjectSettings/ProjectVersion.txt index 39e91255..90d6509f 100644 --- a/ProjectSettings/ProjectVersion.txt +++ b/ProjectSettings/ProjectVersion.txt @@ -1,2 +1,2 @@ -m_EditorVersion: 2020.3.19f1 -m_EditorVersionWithRevision: 2020.3.19f1 (68f137dc9bbe) +m_EditorVersion: 2021.3.1f1 +m_EditorVersionWithRevision: 2021.3.1f1 (3b70a0754835) diff --git a/ProjectSettings/SceneTemplateSettings.json b/ProjectSettings/SceneTemplateSettings.json new file mode 100644 index 00000000..6f3e60fd --- /dev/null +++ b/ProjectSettings/SceneTemplateSettings.json @@ -0,0 +1,167 @@ +{ + "templatePinStates": [], + "dependencyTypeInfos": [ + { + "userAdded": false, + "type": "UnityEngine.AnimationClip", + "ignore": false, + "defaultInstantiationMode": 0, + "supportsModification": true + }, + { + "userAdded": false, + "type": "UnityEditor.Animations.AnimatorController", + "ignore": false, + "defaultInstantiationMode": 0, + "supportsModification": true + }, + { + "userAdded": false, + "type": "UnityEngine.AnimatorOverrideController", + "ignore": false, + "defaultInstantiationMode": 0, + "supportsModification": true + }, + { + "userAdded": false, + "type": "UnityEditor.Audio.AudioMixerController", + "ignore": false, + "defaultInstantiationMode": 0, + "supportsModification": true + }, + { + "userAdded": false, + "type": "UnityEngine.ComputeShader", + "ignore": true, + "defaultInstantiationMode": 1, + "supportsModification": true + }, + { + "userAdded": false, + "type": "UnityEngine.Cubemap", + "ignore": false, + "defaultInstantiationMode": 0, + "supportsModification": true + }, + { + "userAdded": false, + "type": "UnityEngine.GameObject", + "ignore": false, + "defaultInstantiationMode": 0, + "supportsModification": true + }, + { + "userAdded": false, + "type": "UnityEditor.LightingDataAsset", + "ignore": false, + "defaultInstantiationMode": 0, + "supportsModification": false + }, + { + "userAdded": false, + "type": "UnityEngine.LightingSettings", + "ignore": false, + "defaultInstantiationMode": 0, + "supportsModification": true + }, + { + "userAdded": false, + "type": "UnityEngine.Material", + "ignore": false, + "defaultInstantiationMode": 0, + "supportsModification": true + }, + { + "userAdded": false, + "type": "UnityEditor.MonoScript", + "ignore": true, + "defaultInstantiationMode": 1, + "supportsModification": true + }, + { + "userAdded": false, + "type": "UnityEngine.PhysicMaterial", + "ignore": false, + "defaultInstantiationMode": 0, + "supportsModification": true + }, + { + "userAdded": false, + "type": "UnityEngine.PhysicsMaterial2D", + "ignore": false, + "defaultInstantiationMode": 0, + "supportsModification": true + }, + { + "userAdded": false, + "type": "UnityEngine.Rendering.PostProcessing.PostProcessProfile", + "ignore": false, + "defaultInstantiationMode": 0, + "supportsModification": true + }, + { + "userAdded": false, + "type": "UnityEngine.Rendering.PostProcessing.PostProcessResources", + "ignore": false, + "defaultInstantiationMode": 0, + "supportsModification": true + }, + { + "userAdded": false, + "type": "UnityEngine.Rendering.VolumeProfile", + "ignore": false, + "defaultInstantiationMode": 0, + "supportsModification": true + }, + { + "userAdded": false, + "type": "UnityEditor.SceneAsset", + "ignore": false, + "defaultInstantiationMode": 0, + "supportsModification": false + }, + { + "userAdded": false, + "type": "UnityEngine.Shader", + "ignore": true, + "defaultInstantiationMode": 1, + "supportsModification": true + }, + { + "userAdded": false, + "type": "UnityEngine.ShaderVariantCollection", + "ignore": true, + "defaultInstantiationMode": 1, + "supportsModification": true + }, + { + "userAdded": false, + "type": "UnityEngine.Texture", + "ignore": false, + "defaultInstantiationMode": 0, + "supportsModification": true + }, + { + "userAdded": false, + "type": "UnityEngine.Texture2D", + "ignore": false, + "defaultInstantiationMode": 0, + "supportsModification": true + }, + { + "userAdded": false, + "type": "UnityEngine.Timeline.TimelineAsset", + "ignore": false, + "defaultInstantiationMode": 0, + "supportsModification": true + } + ], + "defaultDependencyTypeInfo": { + "userAdded": false, + "type": "", + "ignore": false, + "defaultInstantiationMode": 1, + "supportsModification": true + }, + "newSceneOverride": 0 +} \ No newline at end of file diff --git a/ProjectSettings/boot.config b/ProjectSettings/boot.config new file mode 100644 index 00000000..e69de29b diff --git a/README.md b/README.md index 93320524..6e5e9264 100644 --- a/README.md +++ b/README.md @@ -43,7 +43,7 @@ Map viewer/editor for OpenSpace games: ## How to use -1. Download and install Unity (as of this writing, version 2020.3.6f1) +1. Download and install Unity (as of this writing, version 2021.3.0f1) 2. Download the .zip file of this project from GitHub and extract it to a folder. 3. In Unity, open the MapViewer scene, located in Assets/Scenes. 4. Open the Raymap settings window (located under Raymap in the toolbar)