@carbonenginejs/runtime-resource 0.20.0 → 0.22.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/NOTICE +6 -0
- package/dist/CjsResMan.js +1374 -1318
- package/dist/CjsResMan.js.map +1 -1
- package/dist/format/CjsFormat.js +393 -164
- package/dist/format/CjsFormat.js.map +1 -1
- package/dist/format/CjsFormatStore.js +315 -0
- package/dist/format/CjsFormatStore.js.map +1 -0
- package/dist/format/CjsResourceProbe.js +66 -234
- package/dist/format/CjsResourceProbe.js.map +1 -1
- package/dist/format/payloadContract.js +47 -6
- package/dist/format/payloadContract.js.map +1 -1
- package/dist/formats/black/CjsBlackFormat.js +23 -6
- package/dist/formats/black/CjsBlackFormat.js.map +1 -1
- package/dist/formats/bnk/CjsBnkFormat.js +122 -120
- package/dist/formats/bnk/CjsBnkFormat.js.map +1 -1
- package/dist/formats/bnk/core/helpers.js +5 -15
- package/dist/formats/bnk/core/helpers.js.map +1 -1
- package/dist/formats/cmf/CjsCmfFormat.js +31 -14
- package/dist/formats/cmf/CjsCmfFormat.js.map +1 -1
- package/dist/formats/dds/CjsDdsFormat.js +29 -19
- package/dist/formats/dds/CjsDdsFormat.js.map +1 -1
- package/dist/formats/dds/core/helpers.js +4 -5
- package/dist/formats/dds/core/helpers.js.map +1 -1
- package/dist/formats/dxbc/CjsDxbcFormat.js +15 -13
- package/dist/formats/dxbc/CjsDxbcFormat.js.map +1 -1
- package/dist/formats/fbx/CjsFbxFormat.js +27 -19
- package/dist/formats/fbx/CjsFbxFormat.js.map +1 -1
- package/dist/formats/fbx/core/helpers.js +4 -4
- package/dist/formats/fbx/core/helpers.js.map +1 -1
- package/dist/formats/flac/CjsFlacFormat.js +19 -17
- package/dist/formats/flac/CjsFlacFormat.js.map +1 -1
- package/dist/formats/flac/core/helpers.js +5 -11
- package/dist/formats/flac/core/helpers.js.map +1 -1
- package/dist/formats/fsd/32/CjsFsd32Format.js +55 -0
- package/dist/formats/fsd/32/CjsFsd32Format.js.map +1 -0
- package/dist/formats/fsd/32/index.js +2 -0
- package/dist/formats/fsd/32/index.js.map +1 -0
- package/dist/formats/fsd/64/CjsFsd64Format.js +119 -0
- package/dist/formats/fsd/64/CjsFsd64Format.js.map +1 -0
- package/dist/formats/fsd/64/core/CjsFsd64Binary.js +393 -0
- package/dist/formats/fsd/64/core/CjsFsd64Binary.js.map +1 -0
- package/dist/formats/fsd/64/core/CjsFsd64Reader.js +138 -0
- package/dist/formats/fsd/64/core/CjsFsd64Reader.js.map +1 -0
- package/dist/formats/fsd/64/core/CjsFsd64SchemaDecoder.js +389 -0
- package/dist/formats/fsd/64/core/CjsFsd64SchemaDecoder.js.map +1 -0
- package/dist/formats/fsd/64/core/CjsFsd64SchemaReader.js +43 -0
- package/dist/formats/fsd/64/core/CjsFsd64SchemaReader.js.map +1 -0
- package/dist/formats/fsd/64/core/fsd64Records.js +60 -0
- package/dist/formats/fsd/64/core/fsd64Records.js.map +1 -0
- package/dist/formats/fsd/64/index.js +7 -0
- package/dist/formats/fsd/64/index.js.map +1 -0
- package/dist/formats/fsd/64/readers/CjsFsd64ReaderSetCharacterStaticData.js +33 -0
- package/dist/formats/fsd/64/readers/CjsFsd64ReaderSetCharacterStaticData.js.map +1 -0
- package/dist/formats/fsd/64/readers/CjsFsd64SchemaAgentTypes.js +35 -0
- package/dist/formats/fsd/64/readers/CjsFsd64SchemaAgentTypes.js.map +1 -0
- package/dist/formats/fsd/64/readers/CjsFsd64SchemaAgentsInSpace.js +50 -0
- package/dist/formats/fsd/64/readers/CjsFsd64SchemaAgentsInSpace.js.map +1 -0
- package/dist/formats/fsd/64/readers/CjsFsd64SchemaAncestries.js +75 -0
- package/dist/formats/fsd/64/readers/CjsFsd64SchemaAncestries.js.map +1 -0
- package/dist/formats/fsd/64/readers/CjsFsd64SchemaArchetypes.js +57 -0
- package/dist/formats/fsd/64/readers/CjsFsd64SchemaArchetypes.js.map +1 -0
- package/dist/formats/fsd/64/readers/CjsFsd64SchemaAudioMetadata.js +201 -0
- package/dist/formats/fsd/64/readers/CjsFsd64SchemaAudioMetadata.js.map +1 -0
- package/dist/formats/fsd/64/readers/CjsFsd64SchemaBloodlines.js +73 -0
- package/dist/formats/fsd/64/readers/CjsFsd64SchemaBloodlines.js.map +1 -0
- package/dist/formats/fsd/64/readers/CjsFsd64SchemaCategories.js +53 -0
- package/dist/formats/fsd/64/readers/CjsFsd64SchemaCategories.js.map +1 -0
- package/dist/formats/fsd/64/readers/CjsFsd64SchemaCharacterAvatarBehaviors.js +44 -0
- package/dist/formats/fsd/64/readers/CjsFsd64SchemaCharacterAvatarBehaviors.js.map +1 -0
- package/dist/formats/fsd/64/readers/CjsFsd64SchemaCharacterColorLocations.js +38 -0
- package/dist/formats/fsd/64/readers/CjsFsd64SchemaCharacterColorLocations.js.map +1 -0
- package/dist/formats/fsd/64/readers/CjsFsd64SchemaCharacterColorNames.js +34 -0
- package/dist/formats/fsd/64/readers/CjsFsd64SchemaCharacterColorNames.js.map +1 -0
- package/dist/formats/fsd/64/readers/CjsFsd64SchemaCharacterModifierLocations.js +34 -0
- package/dist/formats/fsd/64/readers/CjsFsd64SchemaCharacterModifierLocations.js.map +1 -0
- package/dist/formats/fsd/64/readers/CjsFsd64SchemaCharacterPortraitResources.js +44 -0
- package/dist/formats/fsd/64/readers/CjsFsd64SchemaCharacterPortraitResources.js.map +1 -0
- package/dist/formats/fsd/64/readers/CjsFsd64SchemaCharacterResources.js +81 -0
- package/dist/formats/fsd/64/readers/CjsFsd64SchemaCharacterResources.js.map +1 -0
- package/dist/formats/fsd/64/readers/CjsFsd64SchemaCharacterSculptingLocations.js +34 -0
- package/dist/formats/fsd/64/readers/CjsFsd64SchemaCharacterSculptingLocations.js.map +1 -0
- package/dist/formats/fsd/64/readers/CjsFsd64SchemaCompressibleTypes.js +41 -0
- package/dist/formats/fsd/64/readers/CjsFsd64SchemaCompressibleTypes.js.map +1 -0
- package/dist/formats/fsd/64/readers/CjsFsd64SchemaContrabandTypes.js +63 -0
- package/dist/formats/fsd/64/readers/CjsFsd64SchemaContrabandTypes.js.map +1 -0
- package/dist/formats/fsd/64/readers/CjsFsd64SchemaControlTowerResources.js +76 -0
- package/dist/formats/fsd/64/readers/CjsFsd64SchemaControlTowerResources.js.map +1 -0
- package/dist/formats/fsd/64/readers/CjsFsd64SchemaCorporationActivities.js +38 -0
- package/dist/formats/fsd/64/readers/CjsFsd64SchemaCorporationActivities.js.map +1 -0
- package/dist/formats/fsd/64/readers/CjsFsd64SchemaCorporationRoleGroups.js +74 -0
- package/dist/formats/fsd/64/readers/CjsFsd64SchemaCorporationRoleGroups.js.map +1 -0
- package/dist/formats/fsd/64/readers/CjsFsd64SchemaCorporationRoles.js +59 -0
- package/dist/formats/fsd/64/readers/CjsFsd64SchemaCorporationRoles.js.map +1 -0
- package/dist/formats/fsd/64/readers/CjsFsd64SchemaDogmaAttributeCategories.js +46 -0
- package/dist/formats/fsd/64/readers/CjsFsd64SchemaDogmaAttributeCategories.js.map +1 -0
- package/dist/formats/fsd/64/readers/CjsFsd64SchemaDogmaAttributes.js +133 -0
- package/dist/formats/fsd/64/readers/CjsFsd64SchemaDogmaAttributes.js.map +1 -0
- package/dist/formats/fsd/64/readers/CjsFsd64SchemaDogmaEffects.js +236 -0
- package/dist/formats/fsd/64/readers/CjsFsd64SchemaDogmaEffects.js.map +1 -0
- package/dist/formats/fsd/64/readers/CjsFsd64SchemaDogmaUnits.js +60 -0
- package/dist/formats/fsd/64/readers/CjsFsd64SchemaDogmaUnits.js.map +1 -0
- package/dist/formats/fsd/64/readers/CjsFsd64SchemaDynamicItemAttributes.js +95 -0
- package/dist/formats/fsd/64/readers/CjsFsd64SchemaDynamicItemAttributes.js.map +1 -0
- package/dist/formats/fsd/64/readers/CjsFsd64SchemaEpicArcs.js +106 -0
- package/dist/formats/fsd/64/readers/CjsFsd64SchemaEpicArcs.js.map +1 -0
- package/dist/formats/fsd/64/readers/CjsFsd64SchemaExpertSystems.js +86 -0
- package/dist/formats/fsd/64/readers/CjsFsd64SchemaExpertSystems.js.map +1 -0
- package/dist/formats/fsd/64/readers/CjsFsd64SchemaFactions.js +117 -0
- package/dist/formats/fsd/64/readers/CjsFsd64SchemaFactions.js.map +1 -0
- package/dist/formats/fsd/64/readers/CjsFsd64SchemaGraphicIds.js +70 -0
- package/dist/formats/fsd/64/readers/CjsFsd64SchemaGraphicIds.js.map +1 -0
- package/dist/formats/fsd/64/readers/CjsFsd64SchemaGraphicMaterialSets.js +173 -0
- package/dist/formats/fsd/64/readers/CjsFsd64SchemaGraphicMaterialSets.js.map +1 -0
- package/dist/formats/fsd/64/readers/CjsFsd64SchemaGroups.js +77 -0
- package/dist/formats/fsd/64/readers/CjsFsd64SchemaGroups.js.map +1 -0
- package/dist/formats/fsd/64/readers/CjsFsd64SchemaIcons.js +62 -0
- package/dist/formats/fsd/64/readers/CjsFsd64SchemaIcons.js.map +1 -0
- package/dist/formats/fsd/64/readers/CjsFsd64SchemaMarketGroups.js +63 -0
- package/dist/formats/fsd/64/readers/CjsFsd64SchemaMarketGroups.js.map +1 -0
- package/dist/formats/fsd/64/readers/CjsFsd64SchemaMetaGroups.js +86 -0
- package/dist/formats/fsd/64/readers/CjsFsd64SchemaMetaGroups.js.map +1 -0
- package/dist/formats/fsd/64/readers/CjsFsd64SchemaNpcCorporationDivisions.js +72 -0
- package/dist/formats/fsd/64/readers/CjsFsd64SchemaNpcCorporationDivisions.js.map +1 -0
- package/dist/formats/fsd/64/readers/CjsFsd64SchemaNpcCorporations.js +326 -0
- package/dist/formats/fsd/64/readers/CjsFsd64SchemaNpcCorporations.js.map +1 -0
- package/dist/formats/fsd/64/readers/CjsFsd64SchemaPaperdolls.js +279 -0
- package/dist/formats/fsd/64/readers/CjsFsd64SchemaPaperdolls.js.map +1 -0
- package/dist/formats/fsd/64/readers/CjsFsd64SchemaRaces.js +64 -0
- package/dist/formats/fsd/64/readers/CjsFsd64SchemaRaces.js.map +1 -0
- package/dist/formats/fsd/64/readers/CjsFsd64SchemaSchoolMap.js +40 -0
- package/dist/formats/fsd/64/readers/CjsFsd64SchemaSchoolMap.js.map +1 -0
- package/dist/formats/fsd/64/readers/CjsFsd64SchemaSchools.js +113 -0
- package/dist/formats/fsd/64/readers/CjsFsd64SchemaSchools.js.map +1 -0
- package/dist/formats/fsd/64/readers/CjsFsd64SchemaSkillPlans.js +130 -0
- package/dist/formats/fsd/64/readers/CjsFsd64SchemaSkillPlans.js.map +1 -0
- package/dist/formats/fsd/64/readers/CjsFsd64SchemaSkinrComponentCategories.js +38 -0
- package/dist/formats/fsd/64/readers/CjsFsd64SchemaSkinrComponentCategories.js.map +1 -0
- package/dist/formats/fsd/64/readers/CjsFsd64SchemaSkinrComponentPointValues.js +45 -0
- package/dist/formats/fsd/64/readers/CjsFsd64SchemaSkinrComponentPointValues.js.map +1 -0
- package/dist/formats/fsd/64/readers/CjsFsd64SchemaSkinrComponentRarities.js +44 -0
- package/dist/formats/fsd/64/readers/CjsFsd64SchemaSkinrComponentRarities.js.map +1 -0
- package/dist/formats/fsd/64/readers/CjsFsd64SchemaSkinrComponents.js +163 -0
- package/dist/formats/fsd/64/readers/CjsFsd64SchemaSkinrComponents.js.map +1 -0
- package/dist/formats/fsd/64/readers/CjsFsd64SchemaSkinrSlotCategories.js +37 -0
- package/dist/formats/fsd/64/readers/CjsFsd64SchemaSkinrSlotCategories.js.map +1 -0
- package/dist/formats/fsd/64/readers/CjsFsd64SchemaSkinrSlotConfigurations.js +77 -0
- package/dist/formats/fsd/64/readers/CjsFsd64SchemaSkinrSlotConfigurations.js.map +1 -0
- package/dist/formats/fsd/64/readers/CjsFsd64SchemaSkinrSlotNames.js +37 -0
- package/dist/formats/fsd/64/readers/CjsFsd64SchemaSkinrSlotNames.js.map +1 -0
- package/dist/formats/fsd/64/readers/CjsFsd64SchemaSkinrSlots.js +74 -0
- package/dist/formats/fsd/64/readers/CjsFsd64SchemaSkinrSlots.js.map +1 -0
- package/dist/formats/fsd/64/readers/CjsFsd64SchemaSkinrTierThresholds.js +44 -0
- package/dist/formats/fsd/64/readers/CjsFsd64SchemaSkinrTierThresholds.js.map +1 -0
- package/dist/formats/fsd/64/readers/CjsFsd64SchemaStationOperations.js +120 -0
- package/dist/formats/fsd/64/readers/CjsFsd64SchemaStationOperations.js.map +1 -0
- package/dist/formats/fsd/64/readers/CjsFsd64SchemaStationServices.js +49 -0
- package/dist/formats/fsd/64/readers/CjsFsd64SchemaStationServices.js.map +1 -0
- package/dist/formats/fsd/64/readers/CjsFsd64SchemaTypeDogma.js +73 -0
- package/dist/formats/fsd/64/readers/CjsFsd64SchemaTypeDogma.js.map +1 -0
- package/dist/formats/fsd/64/readers/CjsFsd64SchemaTypeLists.js +122 -0
- package/dist/formats/fsd/64/readers/CjsFsd64SchemaTypeLists.js.map +1 -0
- package/dist/formats/fsd/64/readers/CjsFsd64SchemaTypeMaterials.js +83 -0
- package/dist/formats/fsd/64/readers/CjsFsd64SchemaTypeMaterials.js.map +1 -0
- package/dist/formats/fsd/64/readers/CjsFsd64SchemaTypes.js +194 -0
- package/dist/formats/fsd/64/readers/CjsFsd64SchemaTypes.js.map +1 -0
- package/dist/formats/fsd/64/readers/index.js +58 -0
- package/dist/formats/fsd/64/readers/index.js.map +1 -0
- package/dist/formats/fsd/CjsFsdFormat.js +62 -0
- package/dist/formats/fsd/CjsFsdFormat.js.map +1 -0
- package/dist/formats/fsd/index.js +9 -0
- package/dist/formats/fsd/index.js.map +1 -0
- package/dist/formats/gif/CjsGifFormat.js +26 -16
- package/dist/formats/gif/CjsGifFormat.js.map +1 -1
- package/dist/formats/gif/core/helpers.js +6 -18
- package/dist/formats/gif/core/helpers.js.map +1 -1
- package/dist/formats/gltf/CjsGltfFormat.js +25 -13
- package/dist/formats/gltf/CjsGltfFormat.js.map +1 -1
- package/dist/formats/gr2/CjsGr2Format.js +27 -6
- package/dist/formats/gr2/CjsGr2Format.js.map +1 -1
- package/dist/formats/hlsl/CjsHlslFormat.js +20 -16
- package/dist/formats/hlsl/CjsHlslFormat.js.map +1 -1
- package/dist/formats/hlsl/core/analysis.js +1 -1
- package/dist/formats/index.js +5 -0
- package/dist/formats/index.js.map +1 -1
- package/dist/formats/jpeg/CjsJpegFormat.js +26 -19
- package/dist/formats/jpeg/CjsJpegFormat.js.map +1 -1
- package/dist/formats/jpeg/core/helpers.js +6 -15
- package/dist/formats/jpeg/core/helpers.js.map +1 -1
- package/dist/formats/jpeg/core/jpeg.js +0 -3
- package/dist/formats/jpeg/core/jpeg.js.map +1 -1
- package/dist/formats/mp3/CjsMp3Format.js +19 -19
- package/dist/formats/mp3/CjsMp3Format.js.map +1 -1
- package/dist/formats/mp3/core/helpers.js +5 -11
- package/dist/formats/mp3/core/helpers.js.map +1 -1
- package/dist/formats/mp4/CjsMp4Format.js +20 -19
- package/dist/formats/mp4/CjsMp4Format.js.map +1 -1
- package/dist/formats/mp4/core/helpers.js +6 -15
- package/dist/formats/mp4/core/helpers.js.map +1 -1
- package/dist/formats/obj/CjsObjFormat.js +25 -12
- package/dist/formats/obj/CjsObjFormat.js.map +1 -1
- package/dist/formats/ogg/CjsOggFormat.js +26 -17
- package/dist/formats/ogg/CjsOggFormat.js.map +1 -1
- package/dist/formats/ogg/core/helpers.js +5 -16
- package/dist/formats/ogg/core/helpers.js.map +1 -1
- package/dist/formats/pickle/CjsPickleFormat.js +64 -5
- package/dist/formats/pickle/CjsPickleFormat.js.map +1 -1
- package/dist/formats/png/CjsPngFormat.js +28 -19
- package/dist/formats/png/CjsPngFormat.js.map +1 -1
- package/dist/formats/png/core/helpers.js +5 -14
- package/dist/formats/png/core/helpers.js.map +1 -1
- package/dist/formats/red/CjsRedFormat.js +19 -5
- package/dist/formats/red/CjsRedFormat.js.map +1 -1
- package/dist/formats/schemabound/CjsSchemaBoundFormat.js +48 -38
- package/dist/formats/schemabound/CjsSchemaBoundFormat.js.map +1 -1
- package/dist/formats/sqlite/CjsSqliteFormat.js +49 -41
- package/dist/formats/sqlite/CjsSqliteFormat.js.map +1 -1
- package/dist/formats/static/CjsStaticFormat.js +15 -57
- package/dist/formats/static/CjsStaticFormat.js.map +1 -1
- package/dist/formats/static/staticContainers.js +6 -6
- package/dist/formats/static/staticContainers.js.map +1 -1
- package/dist/formats/stl/CjsStlFormat.js +25 -12
- package/dist/formats/stl/CjsStlFormat.js.map +1 -1
- package/dist/formats/tga/CjsTgaFormat.js +26 -19
- package/dist/formats/tga/CjsTgaFormat.js.map +1 -1
- package/dist/formats/tga/core/helpers.js +7 -22
- package/dist/formats/tga/core/helpers.js.map +1 -1
- package/dist/formats/wav/CjsWavFormat.js +26 -19
- package/dist/formats/wav/CjsWavFormat.js.map +1 -1
- package/dist/formats/wav/core/helpers.js +7 -16
- package/dist/formats/wav/core/helpers.js.map +1 -1
- package/dist/formats/webgl/CjsWebglFormat.js +11 -13
- package/dist/formats/webgl/CjsWebglFormat.js.map +1 -1
- package/dist/formats/webgl/core/glsl/DxbcGlslEmitter.js +31 -1
- package/dist/formats/webgl/core/glsl/DxbcGlslEmitter.js.map +1 -1
- package/dist/formats/webgl/core/readGlslEffectContainer.js +8 -8
- package/dist/formats/webgl/core/readGlslEffectContainer.js.map +1 -1
- package/dist/formats/webgpu/CjsWebgpuFormat.js +11 -5
- package/dist/formats/webgpu/CjsWebgpuFormat.js.map +1 -1
- package/dist/formats/webm/CjsWebmFormat.js +20 -19
- package/dist/formats/webm/CjsWebmFormat.js.map +1 -1
- package/dist/formats/webm/core/helpers.js +6 -15
- package/dist/formats/webm/core/helpers.js.map +1 -1
- package/dist/formats/webp/CjsWebpFormat.js +19 -17
- package/dist/formats/webp/CjsWebpFormat.js.map +1 -1
- package/dist/formats/webp/core/helpers.js +5 -11
- package/dist/formats/webp/core/helpers.js.map +1 -1
- package/dist/formats/wem/CjsWemFormat.js +128 -141
- package/dist/formats/wem/CjsWemFormat.js.map +1 -1
- package/dist/formats/wem/core/helpers.js +1 -114
- package/dist/formats/wem/core/helpers.js.map +1 -1
- package/dist/formats/wem/core/{resolve.js → probeCodecSupport.js} +11 -18
- package/dist/formats/wem/core/probeCodecSupport.js.map +1 -0
- package/dist/formats/yaml/CjsYamlFormat.js +20 -5
- package/dist/formats/yaml/CjsYamlFormat.js.map +1 -1
- package/dist/generated/index.js +2 -0
- package/dist/generated/index.js.map +1 -0
- package/dist/generated/resources/Tr2RaycastGeometryRes.js +34 -0
- package/dist/generated/resources/Tr2RaycastGeometryRes.js.map +1 -0
- package/dist/generated/resources/index.js +2 -0
- package/dist/generated/resources/index.js.map +1 -0
- package/dist/index.js +3 -1
- package/dist/index.js.map +1 -1
- package/dist/resource/CjsResource.js +134 -0
- package/dist/resource/CjsResource.js.map +1 -1
- package/dist/resource/ResourceRequirement.js +42 -0
- package/dist/resource/ResourceRequirement.js.map +1 -0
- package/dist/resource/Tr2LightProfileRes.js +2 -1
- package/dist/resource/Tr2LightProfileRes.js.map +1 -1
- package/dist/resource/geometry/TriGeometryRes.js +34 -7
- package/dist/resource/geometry/TriGeometryRes.js.map +1 -1
- package/dist/resource/geometry/granny/Tr2GrannyStateRes.js +184 -7
- package/dist/resource/geometry/granny/Tr2GrannyStateRes.js.map +1 -1
- package/dist/resource/geometry/granny/TriGrannyRes.js +20 -8
- package/dist/resource/geometry/granny/TriGrannyRes.js.map +1 -1
- package/dist/resource/index.js +1 -0
- package/dist/resource/index.js.map +1 -1
- package/dist/resource/resourceBoundary.js +24 -1
- package/dist/resource/resourceBoundary.js.map +1 -1
- package/dist/resource/shader/Tr2EffectRes.js +2 -1
- package/dist/resource/shader/Tr2EffectRes.js.map +1 -1
- package/dist/resource/texture/CjsTextureArrayRes.js +2 -1
- package/dist/resource/texture/CjsTextureArrayRes.js.map +1 -1
- package/dist/resource/texture/Tr2ImageRes.js +2 -1
- package/dist/resource/texture/Tr2ImageRes.js.map +1 -1
- package/dist/resource/texture/TriTextureRes.js +40 -2
- package/dist/resource/texture/TriTextureRes.js.map +1 -1
- package/docs/architecture.md +121 -116
- package/docs/concepts/format-capabilities.md +90 -0
- package/docs/formats/README.md +14 -6
- package/docs/formats/fsd.md +104 -0
- package/docs/formats/gr2.md +1 -1
- package/docs/formats/hlsl/reference/api.md +6 -4
- package/docs/formats/provenance.md +18 -0
- package/docs/formats/schemabound.md +10 -4
- package/docs/formats/static.md +26 -26
- package/docs/formats/webgpu/reference/api.md +4 -3
- package/docs/reference/classes/core.md +22 -2
- package/docs/reference/classes/formats.md +643 -1
- package/docs/reference/classes/resources.md +463 -453
- package/docs/reference/queues.md +205 -194
- package/docs/roadmap.md +14 -18
- package/format-notices/fsd/LICENSE +21 -0
- package/format-notices/fsd/NOTICE +11 -0
- package/package.json +70 -64
- package/dist/formats/wem/core/resolve.js.map +0 -1
- package/docs/concepts/format-type-resolution.md +0 -79
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"helpers.js","sources":["../../../../../src/formats/wem/core/helpers.js"],"sourcesContent":["import { convertWemToOgg } from \"./wemToOgg.js\";\nimport { decodePtadpcm } from \"./ptadpcm.js\";\n\nexport const OUTPUT_RAW = \"raw\";\nexport const OUTPUT_JSON = \"json\";\nexport const OUTPUT_WEM_JSON = \"wemJson\";\nexport const OUTPUT_OGG = \"ogg\";\nexport const OUTPUT_PCM = \"pcm\";\n\nexport const DEFAULT_VALUES = Object.freeze({\n emit: OUTPUT_RAW,\n inputType: \"wem\",\n source: \"\"\n});\n\n/**\n * Wwise RIFF format tags mapped to codec names.\n *\n * Tag meanings follow the publicly documented behavior of Wwise media as\n * observed by community tooling (ww2ogg, vgmstream, wwiser). Unknown tags are\n * reported as `wwise-format-0x<tag>` rather than rejected.\n */\nexport const WEM_CODEC_NAMES = Object.freeze({\n 0x0001: \"pcm\",\n 0x0002: \"wwise-ima-adpcm\",\n 0x0069: \"wwise-ima-adpcm\",\n 0x0165: \"xma2\",\n 0x0166: \"xma2\",\n 0x3040: \"wwise-opus\",\n 0x3041: \"wwise-opus-nx\",\n 0x3042: \"wwise-opus-wem\",\n 0x8311: \"wwise-ptadpcm\",\n 0xaac0: \"aac\",\n 0xfffe: \"pcm-extensible\",\n 0xffff: \"wwise-vorbis\"\n});\n\n/**\n * Normalizes reader options against their supported defaults for the WEM format\n * reader.\n */\nexport function normalizeValues(base = DEFAULT_VALUES, options = {}, readerName = \"CjsWemFormat\")\n{\n const values = { ...DEFAULT_VALUES, ...(base || {}), ...(options || {}) };\n values.inputType = values.inputType ? String(values.inputType).replace(/^\\./u, \"\").toLowerCase() : \"wem\";\n values.emit = normalizeEmit(values.emit, readerName);\n return values;\n}\n\n/** Normalizes the requested output representation for the WEM format reader. */\nexport function normalizeEmit(emit, readerName)\n{\n if (emit === undefined || emit === null) return OUTPUT_RAW;\n if (emit === OUTPUT_JSON) return OUTPUT_WEM_JSON;\n if ([ OUTPUT_RAW, OUTPUT_WEM_JSON, OUTPUT_OGG, OUTPUT_PCM ].includes(emit)) return emit;\n throw new TypeError(`${readerName}: unknown emit value ${JSON.stringify(emit)}`);\n}\n\n/** Returns a byte view over the supplied binary input for the WEM format reader. */\nexport function toBytes(input)\n{\n if (input instanceof Uint8Array) return input;\n if (input instanceof ArrayBuffer) return new Uint8Array(input);\n if (ArrayBuffer.isView(input)) return new Uint8Array(input.buffer, input.byteOffset, input.byteLength);\n throw new TypeError(\"Wem input must be Uint8Array, ArrayBuffer, or DataView\");\n}\n\n/**\n * Test for a Wwise RIFF/RIFX WAVE signature.\n *\n * @param {Uint8Array} bytes Candidate bytes.\n * @returns {boolean} True when a RIFF or RIFX WAVE container is present.\n */\nexport function isWEM(bytes)\n{\n if (bytes.byteLength < 12) return false;\n const container = fourCc(bytes, 0);\n return (container === \"RIFF\" || container === \"RIFX\") && fourCc(bytes, 8) === \"WAVE\";\n}\n\n/**\n * Inspect Wwise media bytes without decoding audio data.\n *\n * Reports the chunk map, `fmt ` fields, codec identity, and Vorbis sample\n * count/duration when present. Inspection never throws on unknown chunks or\n * codecs; truncated trailing chunks stop the walk.\n *\n * @param {Uint8Array} bytes Wem bytes.\n * @returns {object} Wem metadata.\n */\nexport function inspectWEM(bytes)\n{\n const littleEndian = fourCc(bytes, 0) !== \"RIFX\";\n const info = {\n sourceFormat: \"wem\",\n container: fourCc(bytes, 0),\n littleEndian,\n riffSize: readU32(bytes, 4, littleEndian),\n codec: \"\",\n codecTag: 0,\n channels: 0,\n sampleRate: 0,\n byteRate: 0,\n blockAlign: 0,\n bitsPerSample: 0,\n extraSize: 0,\n sampleCount: 0,\n durationSeconds: 0,\n dataOffset: 0,\n dataBytes: 0,\n vorbis: null,\n chunks: []\n };\n\n let offset = 12;\n let fmtOffset = 0;\n let fmtSize = 0;\n let vorbOffset = 0;\n let vorbSize = 0;\n\n while (offset + 8 <= bytes.byteLength)\n {\n const id = fourCc(bytes, offset);\n const size = readU32(bytes, offset + 4, littleEndian);\n const dataOffset = offset + 8;\n if (dataOffset + size > bytes.byteLength)\n {\n info.chunks.push({ id, offset, dataOffset, size, truncated: true });\n break;\n }\n info.chunks.push({ id, offset, dataOffset, size });\n\n if (id === \"fmt \" && size >= 16)\n {\n fmtOffset = dataOffset;\n fmtSize = size;\n info.codecTag = readU16(bytes, dataOffset, littleEndian);\n info.channels = readU16(bytes, dataOffset + 2, littleEndian);\n info.sampleRate = readU32(bytes, dataOffset + 4, littleEndian);\n info.byteRate = readU32(bytes, dataOffset + 8, littleEndian);\n info.blockAlign = readU16(bytes, dataOffset + 12, littleEndian);\n info.bitsPerSample = readU16(bytes, dataOffset + 14, littleEndian);\n if (size >= 18) info.extraSize = readU16(bytes, dataOffset + 16, littleEndian);\n info.codec = WEM_CODEC_NAMES[info.codecTag] || `wwise-format-0x${info.codecTag.toString(16).padStart(4, \"0\")}`;\n }\n if (id === \"vorb\")\n {\n vorbOffset = dataOffset;\n vorbSize = size;\n }\n if (id === \"data\")\n {\n info.dataOffset = dataOffset;\n info.dataBytes = size;\n }\n\n offset = dataOffset + size + (size & 1);\n }\n\n if (info.codec === \"wwise-vorbis\")\n {\n // Wwise Vorbis stores its sample count in a separate \"vorb\" chunk, or\n // inline in \"fmt \" at +0x18 when the fmt chunk is 0x42 bytes.\n if (!vorbOffset && fmtSize === 0x42)\n {\n vorbOffset = fmtOffset + 0x18;\n vorbSize = fmtSize - 0x18;\n }\n if (vorbOffset && vorbOffset + 4 <= bytes.byteLength)\n {\n info.sampleCount = readU32(bytes, vorbOffset, littleEndian);\n info.vorbis = {\n vorbOffset,\n vorbSize,\n inline: fmtSize === 0x42,\n sampleCount: info.sampleCount\n };\n }\n }\n\n if (info.sampleCount && info.sampleRate)\n {\n info.durationSeconds = info.sampleCount / info.sampleRate;\n }\n else if ((info.codec === \"pcm\" || info.codec === \"pcm-extensible\") && info.byteRate)\n {\n info.durationSeconds = info.dataBytes / info.byteRate;\n }\n\n return info;\n}\n\n/** Inspects input using normalized format options for the WEM format reader. */\nexport function inspectWithValues(input, values = DEFAULT_VALUES)\n{\n const bytes = toBytes(input);\n if (!isWEM(bytes))\n {\n throw new TypeError(\"CjsWemFormat: expected a RIFF/RIFX WAVE (wem) container\");\n }\n return {\n payloadType: \"audio\",\n mediaTypes: [ \"audio\" ],\n byteLength: bytes.byteLength,\n source: values.source || \"buffer\",\n ...inspectWEM(bytes)\n };\n}\n\n/**\n * Reports whether input is supported under normalized format options for the WEM\n * format reader.\n */\nexport function isSupportedWithValues(input, values = DEFAULT_VALUES)\n{\n try\n {\n const metadata = inspectWithValues(input, values);\n const oggSupport = getOggSupport(metadata);\n const pcmSupport = getPcmSupport(metadata);\n return {\n format: \"wem\",\n source: values.source || \"buffer\",\n supported: metadata.codec ? \"partial\" : \"none\",\n confidence: metadata.codec ? 1 : 0.5,\n preferred: oggSupport.supported ? OUTPUT_OGG : (pcmSupport.supported ? OUTPUT_PCM : \"raw\"),\n reason: metadata.codec\n ? (oggSupport.supported\n ? \"Wwise Vorbis recognized; repacks losslessly to Ogg Vorbis.\"\n : (metadata.codec === \"wwise-vorbis\"\n ? oggSupport.reason\n : \"Wwise media container recognized; payloads pass through undecoded.\"))\n : \"RIFF/RIFX container recognized but no fmt chunk was found.\",\n metadata,\n variants: [\n {\n kind: \"raw\",\n payloadType: \"raw\",\n codec: metadata.codec || \"unknown\",\n mimeType: \"application/octet-stream\",\n supported: true,\n containerOnly: true,\n isDecoded: false,\n pcmDecodeSupported: false\n },\n {\n kind: OUTPUT_OGG,\n payloadType: \"raw\",\n codec: \"vorbis\",\n mimeType: \"audio/ogg\",\n supported: oggSupport.supported,\n containerOnly: true,\n isDecoded: false,\n reason: oggSupport.supported ? \"\" : oggSupport.reason\n },\n {\n kind: OUTPUT_PCM,\n payloadType: OUTPUT_PCM,\n codec: \"float32\",\n supported: pcmSupport.supported,\n containerOnly: false,\n isDecoded: true,\n pcmDecodeSupported: pcmSupport.supported,\n reason: pcmSupport.supported ? \"\" : pcmSupport.reason\n }\n ],\n warnings: [],\n errors: []\n };\n }\n catch (error)\n {\n return {\n format: \"wem\",\n source: values.source || \"buffer\",\n supported: \"none\",\n confidence: 0,\n preferred: \"\",\n reason: error.message,\n metadata: null,\n variants: [],\n warnings: [],\n errors: [ error.message ]\n };\n }\n}\n\n// PCM decode routing by codec: PTADPCM decodes through its own module;\n// uncompressed 16-bit PCM deinterleaves directly. Compressed codecs with\n// their own containers (Vorbis, Opus, XMA) are not decoded here - Vorbis\n// repacks to Ogg instead (OUTPUT_OGG).\nfunction decodeToPcm(bytes, metadata)\n{\n if (metadata.codec === \"wwise-ptadpcm\")\n {\n return decodePtadpcm(bytes, metadata);\n }\n if ((metadata.codec === \"pcm\" || metadata.codec === \"pcm-extensible\") && metadata.bitsPerSample === 16)\n {\n const channels = Math.max(1, metadata.channels);\n const sampleCount = Math.floor(metadata.dataBytes / (2 * channels));\n const channelData = [];\n for (let channel = 0; channel < channels; channel++)\n {\n channelData.push(new Float32Array(sampleCount));\n }\n for (let i = 0; i < sampleCount; i++)\n {\n for (let channel = 0; channel < channels; channel++)\n {\n const at = metadata.dataOffset + (i * channels + channel) * 2;\n const raw = bytes[at] | (bytes[at + 1] << 8);\n channelData[channel][i] = (raw >= 0x8000 ? raw - 0x10000 : raw) / 32768;\n }\n }\n return { channelData, sampleCount, sampleRate: metadata.sampleRate, channels };\n }\n const error = new Error(`wem: pcm decode is not supported for codec ${metadata.codec || \"unknown\"}`);\n error.code = \"CJS_FORMAT_OUTPUT_NOT_SUPPORTED\";\n error.sourceFormat = \"wem\";\n throw error;\n}\n\nfunction getPcmSupport(metadata)\n{\n if (metadata.codec === \"wwise-ptadpcm\") return { supported: true, reason: \"\" };\n if ((metadata.codec === \"pcm\" || metadata.codec === \"pcm-extensible\") && metadata.bitsPerSample === 16)\n {\n return { supported: true, reason: \"\" };\n }\n return {\n supported: false,\n reason: \"PCM decode covers PTADPCM and 16-bit PCM; use the ogg emit for Wwise Vorbis.\"\n };\n}\n\nfunction getOggSupport(metadata)\n{\n if (metadata.codec !== \"wwise-vorbis\")\n {\n return {\n supported: false,\n reason: \"Only Wwise Vorbis media can be repacked to Ogg.\"\n };\n }\n\n const vorbSize = metadata.vorbis?.vorbSize;\n if (vorbSize === 0x28 || vorbSize === 0x2c)\n {\n return {\n supported: false,\n reason: \"Wwise Vorbis recognized, but old header-triad Wwise Vorbis is not supported by this repacker.\"\n };\n }\n\n if (!metadata.vorbis)\n {\n return {\n supported: false,\n reason: \"Wwise Vorbis recognized, but no Vorbis layout metadata was found.\"\n };\n }\n\n return { supported: true, reason: \"\" };\n}\n\n/** Reads input using normalized format options for the WEM format reader. */\nexport function readWithValues(input, values = DEFAULT_VALUES)\n{\n const bytes = toBytes(input);\n const metadata = inspectWithValues(bytes, values);\n if (values.emit === OUTPUT_WEM_JSON) return metadata;\n if (values.emit === OUTPUT_OGG)\n {\n if (metadata.codec !== \"wwise-vorbis\")\n {\n const error = new Error(`wem: only Wwise Vorbis can be repacked to Ogg (found ${metadata.codec || \"unknown\"})`);\n error.code = \"CJS_FORMAT_OUTPUT_NOT_SUPPORTED\";\n error.sourceFormat = \"wem\";\n throw error;\n }\n const ogg = convertWemToOgg(bytes, { codebooks: values.codebooks });\n return {\n payloadType: \"raw\",\n sourceFormat: \"wem\",\n outputFormat: \"ogg\",\n codec: \"vorbis\",\n mimeType: \"audio/ogg\",\n containerOnly: true,\n isDecoded: false,\n pcmDecodeSupported: false,\n sampleCount: ogg.sampleCount,\n sampleRate: ogg.sampleRate,\n channels: ogg.channels,\n durationSeconds: ogg.durationSeconds,\n loop: ogg.loop,\n pageCount: ogg.pageCount,\n metadata,\n bytes: ogg.bytes\n };\n }\n if (values.emit === OUTPUT_PCM)\n {\n const decoded = decodeToPcm(bytes, metadata);\n return {\n payloadType: OUTPUT_PCM,\n sourceFormat: \"wem\",\n outputFormat: OUTPUT_PCM,\n codec: \"float32\",\n sourceCodec: metadata.codec,\n isDecoded: true,\n pcmDecodeSupported: true,\n sampleCount: decoded.sampleCount,\n sampleRate: decoded.sampleRate,\n channels: decoded.channels,\n durationSeconds: decoded.sampleRate ? decoded.sampleCount / decoded.sampleRate : 0,\n channelData: decoded.channelData,\n metadata\n };\n }\n if (values.emit === OUTPUT_RAW)\n {\n return {\n payloadType: \"raw\",\n sourceFormat: \"wem\",\n codec: metadata.codec,\n mimeType: \"application/octet-stream\",\n containerOnly: true,\n isDecoded: false,\n pcmDecodeSupported: false,\n metadata,\n bytes\n };\n }\n\n const error = new Error(`wem: emit \"${values.emit}\" is not implemented yet`);\n error.code = \"CJS_FORMAT_OUTPUT_NOT_IMPLEMENTED\";\n error.sourceFormat = \"wem\";\n error.emit = values.emit;\n throw error;\n}\n\n/** Converts a parsed payload into a JSON-safe value for the WEM format reader. */\nexport function toJsonValue(value)\n{\n if (value instanceof Uint8Array) return { byteLength: value.byteLength };\n if (Array.isArray(value)) return value.map(toJsonValue);\n if (value && typeof value === \"object\")\n {\n const output = {};\n for (const [ key, entry ] of Object.entries(value)) output[key] = toJsonValue(entry);\n return output;\n }\n return value;\n}\n\nfunction fourCc(bytes, offset, length = 4)\n{\n let value = \"\";\n for (let i = 0; i < length; i++) value += String.fromCharCode(bytes[offset + i] || 0);\n return value;\n}\n\nfunction readU16(bytes, offset, littleEndian)\n{\n return littleEndian\n ? bytes[offset] | (bytes[offset + 1] << 8)\n : (bytes[offset] << 8) | bytes[offset + 1];\n}\n\nfunction readU32(bytes, offset, littleEndian)\n{\n return littleEndian\n ? (bytes[offset] | (bytes[offset + 1] << 8) | (bytes[offset + 2] << 16) | (bytes[offset + 3] * 0x1000000)) >>> 0\n : ((bytes[offset] * 0x1000000) + (bytes[offset + 1] << 16) + (bytes[offset + 2] << 8) + bytes[offset + 3]) >>> 0;\n}\n"],"names":["OUTPUT_RAW","OUTPUT_JSON","OUTPUT_WEM_JSON","OUTPUT_OGG","OUTPUT_PCM","DEFAULT_VALUES","Object","freeze","emit","inputType","source","WEM_CODEC_NAMES","normalizeValues","base","options","readerName","values","String","replace","toLowerCase","normalizeEmit","undefined","includes","TypeError","JSON","stringify","toBytes","input","Uint8Array","ArrayBuffer","isView","buffer","byteOffset","byteLength","isWEM","bytes","container","fourCc","inspectWEM","littleEndian","info","sourceFormat","riffSize","readU32","codec","codecTag","channels","sampleRate","byteRate","blockAlign","bitsPerSample","extraSize","sampleCount","durationSeconds","dataOffset","dataBytes","vorbis","chunks","offset","fmtOffset","fmtSize","vorbOffset","vorbSize","id","size","push","truncated","readU16","toString","padStart","inline","inspectWithValues","payloadType","mediaTypes","isSupportedWithValues","metadata","oggSupport","getOggSupport","pcmSupport","getPcmSupport","format","supported","confidence","preferred","reason","variants","kind","mimeType","containerOnly","isDecoded","pcmDecodeSupported","warnings","errors","error","message","decodeToPcm","decodePtadpcm","Math","max","floor","channelData","channel","Float32Array","i","at","raw","Error","code","readWithValues","ogg","convertWemToOgg","codebooks","outputFormat","loop","pageCount","decoded","sourceCodec","toJsonValue","value","Array","isArray","map","output","key","entry","entries","length","fromCharCode"],"mappings":";;;AAGO,MAAMA,UAAU,GAAG;AACnB,MAAMC,WAAW,GAAG;AACpB,MAAMC,eAAe,GAAG;AACxB,MAAMC,UAAU,GAAG;AACnB,MAAMC,UAAU,GAAG;MAE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,MAAM,CAAC,GAAIvB,KAAK,CAACuB,MAAM,GAAG,CAAC,CAAC,IAAI,CAAE,GAAIvB,KAAK,CAACuB,MAAM,GAAG,CAAC,CAAC,IAAI,EAAG,GAAIvB,KAAK,CAACuB,MAAM,GAAG,CAAC,CAAC,GAAG,SAAU,MAAM,CAAC,GAC5GvB,KAAK,CAACuB,MAAM,CAAC,GAAG,SAAS,IAAKvB,KAAK,CAACuB,MAAM,GAAG,CAAC,CAAC,IAAI,EAAE,CAAC,IAAIvB,KAAK,CAACuB,MAAM,GAAG,CAAC,CAAC,IAAI,CAAC,CAAC,GAAGvB,KAAK,CAACuB,MAAM,GAAG,CAAC,CAAC,KAAM,CAAC;AACxH;;;;"}
|
|
1
|
+
{"version":3,"file":"helpers.js","sources":["../../../../../src/formats/wem/core/helpers.js"],"sourcesContent":["import { convertWemToOgg } from \"./wemToOgg.js\";\nimport { decodePtadpcm } from \"./ptadpcm.js\";\n\nexport const OUTPUT_RAW = \"raw\";\nexport const OUTPUT_JSON = \"json\";\nexport const OUTPUT_WEM_JSON = \"wemJson\";\nexport const OUTPUT_OGG = \"ogg\";\nexport const OUTPUT_PCM = \"pcm\";\n\nexport const DEFAULT_VALUES = Object.freeze({\n emit: OUTPUT_RAW,\n inputType: \"wem\",\n source: \"\"\n});\n\n/**\n * Wwise RIFF format tags mapped to codec names.\n *\n * Tag meanings follow the publicly documented behavior of Wwise media as\n * observed by community tooling (ww2ogg, vgmstream, wwiser). Unknown tags are\n * reported as `wwise-format-0x<tag>` rather than rejected.\n */\nexport const WEM_CODEC_NAMES = Object.freeze({\n 0x0001: \"pcm\",\n 0x0002: \"wwise-ima-adpcm\",\n 0x0069: \"wwise-ima-adpcm\",\n 0x0165: \"xma2\",\n 0x0166: \"xma2\",\n 0x3040: \"wwise-opus\",\n 0x3041: \"wwise-opus-nx\",\n 0x3042: \"wwise-opus-wem\",\n 0x8311: \"wwise-ptadpcm\",\n 0xaac0: \"aac\",\n 0xfffe: \"pcm-extensible\",\n 0xffff: \"wwise-vorbis\"\n});\n\n/**\n * Normalizes reader options against their supported defaults for the WEM format\n * reader.\n */\nexport function normalizeValues(base = DEFAULT_VALUES, options = {}, readerName = \"CjsWemFormat\")\n{\n const values = { ...DEFAULT_VALUES, ...(base || {}), ...(options || {}) };\n values.inputType = values.inputType ? String(values.inputType).replace(/^\\./u, \"\").toLowerCase() : \"wem\";\n values.emit = normalizeEmit(values.emit, readerName);\n return values;\n}\n\n/** Normalizes the requested output representation for the WEM format reader. */\nexport function normalizeEmit(emit, readerName)\n{\n if (emit === undefined || emit === null) return OUTPUT_RAW;\n if (emit === OUTPUT_JSON) return OUTPUT_WEM_JSON;\n if ([ OUTPUT_RAW, OUTPUT_WEM_JSON, OUTPUT_OGG, OUTPUT_PCM ].includes(emit)) return emit;\n throw new TypeError(`${readerName}: unknown emit value ${JSON.stringify(emit)}`);\n}\n\n/** Returns a byte view over the supplied binary input for the WEM format reader. */\nexport function toBytes(input)\n{\n if (input instanceof Uint8Array) return input;\n if (input instanceof ArrayBuffer) return new Uint8Array(input);\n if (ArrayBuffer.isView(input)) return new Uint8Array(input.buffer, input.byteOffset, input.byteLength);\n throw new TypeError(\"Wem input must be Uint8Array, ArrayBuffer, or DataView\");\n}\n\n/**\n * Test for a Wwise RIFF/RIFX WAVE signature.\n *\n * @param {Uint8Array} bytes Candidate bytes.\n * @returns {boolean} True when a RIFF or RIFX WAVE container is present.\n */\nexport function isWEM(bytes)\n{\n if (bytes.byteLength < 12) return false;\n const container = fourCc(bytes, 0);\n return (container === \"RIFF\" || container === \"RIFX\") && fourCc(bytes, 8) === \"WAVE\";\n}\n\n/**\n * Inspect Wwise media bytes without decoding audio data.\n *\n * Reports the chunk map, `fmt ` fields, codec identity, and Vorbis sample\n * count/duration when present. Inspection never throws on unknown chunks or\n * codecs; truncated trailing chunks stop the walk.\n *\n * @param {Uint8Array} bytes Wem bytes.\n * @returns {object} Wem metadata.\n */\nexport function inspectWEM(bytes)\n{\n const littleEndian = fourCc(bytes, 0) !== \"RIFX\";\n const info = {\n sourceFormat: \"wem\",\n container: fourCc(bytes, 0),\n littleEndian,\n riffSize: readU32(bytes, 4, littleEndian),\n codec: \"\",\n codecTag: 0,\n channels: 0,\n sampleRate: 0,\n byteRate: 0,\n blockAlign: 0,\n bitsPerSample: 0,\n extraSize: 0,\n sampleCount: 0,\n durationSeconds: 0,\n dataOffset: 0,\n dataBytes: 0,\n vorbis: null,\n chunks: []\n };\n\n let offset = 12;\n let fmtOffset = 0;\n let fmtSize = 0;\n let vorbOffset = 0;\n let vorbSize = 0;\n\n while (offset + 8 <= bytes.byteLength)\n {\n const id = fourCc(bytes, offset);\n const size = readU32(bytes, offset + 4, littleEndian);\n const dataOffset = offset + 8;\n if (dataOffset + size > bytes.byteLength)\n {\n info.chunks.push({ id, offset, dataOffset, size, truncated: true });\n break;\n }\n info.chunks.push({ id, offset, dataOffset, size });\n\n if (id === \"fmt \" && size >= 16)\n {\n fmtOffset = dataOffset;\n fmtSize = size;\n info.codecTag = readU16(bytes, dataOffset, littleEndian);\n info.channels = readU16(bytes, dataOffset + 2, littleEndian);\n info.sampleRate = readU32(bytes, dataOffset + 4, littleEndian);\n info.byteRate = readU32(bytes, dataOffset + 8, littleEndian);\n info.blockAlign = readU16(bytes, dataOffset + 12, littleEndian);\n info.bitsPerSample = readU16(bytes, dataOffset + 14, littleEndian);\n if (size >= 18) info.extraSize = readU16(bytes, dataOffset + 16, littleEndian);\n info.codec = WEM_CODEC_NAMES[info.codecTag] || `wwise-format-0x${info.codecTag.toString(16).padStart(4, \"0\")}`;\n }\n if (id === \"vorb\")\n {\n vorbOffset = dataOffset;\n vorbSize = size;\n }\n if (id === \"data\")\n {\n info.dataOffset = dataOffset;\n info.dataBytes = size;\n }\n\n offset = dataOffset + size + (size & 1);\n }\n\n if (info.codec === \"wwise-vorbis\")\n {\n // Wwise Vorbis stores its sample count in a separate \"vorb\" chunk, or\n // inline in \"fmt \" at +0x18 when the fmt chunk is 0x42 bytes.\n if (!vorbOffset && fmtSize === 0x42)\n {\n vorbOffset = fmtOffset + 0x18;\n vorbSize = fmtSize - 0x18;\n }\n if (vorbOffset && vorbOffset + 4 <= bytes.byteLength)\n {\n info.sampleCount = readU32(bytes, vorbOffset, littleEndian);\n info.vorbis = {\n vorbOffset,\n vorbSize,\n inline: fmtSize === 0x42,\n sampleCount: info.sampleCount\n };\n }\n }\n\n if (info.sampleCount && info.sampleRate)\n {\n info.durationSeconds = info.sampleCount / info.sampleRate;\n }\n else if ((info.codec === \"pcm\" || info.codec === \"pcm-extensible\") && info.byteRate)\n {\n info.durationSeconds = info.dataBytes / info.byteRate;\n }\n\n return info;\n}\n\n/** Inspects input using normalized format options for the WEM format reader. */\nexport function inspectWithValues(input, values = DEFAULT_VALUES)\n{\n const bytes = toBytes(input);\n if (!isWEM(bytes))\n {\n throw new TypeError(\"CjsWemFormat: expected a RIFF/RIFX WAVE (wem) container\");\n }\n return {\n payloadType: \"audio\",\n mediaTypes: [ \"audio\" ],\n byteLength: bytes.byteLength,\n source: values.source || \"buffer\",\n ...inspectWEM(bytes)\n };\n}\n\n/**\n * Reports whether input is supported under normalized format options for the WEM\n * format reader.\n */\nexport function probeSupportWithValues(input, values = DEFAULT_VALUES)\n{\n try\n {\n const metadata = inspectWithValues(input, values);\n const oggSupport = getOggSupport(metadata);\n const pcmSupport = getPcmSupport(metadata);\n return {\n format: \"wem\",\n source: values.source || \"buffer\",\n supported: metadata.codec ? \"partial\" : \"none\",\n confidence: metadata.codec ? 1 : 0.5,\n preferredOutput: oggSupport.supported ? OUTPUT_OGG : (pcmSupport.supported ? OUTPUT_PCM : \"raw\"),\n reason: metadata.codec\n ? (oggSupport.supported\n ? \"Wwise Vorbis recognized; repacks losslessly to Ogg Vorbis.\"\n : (metadata.codec === \"wwise-vorbis\"\n ? oggSupport.reason\n : \"Wwise media container recognized; payloads pass through undecoded.\"))\n : \"RIFF/RIFX container recognized but no fmt chunk was found.\",\n metadata,\n variants: [\n {\n kind: \"raw\",\n payloadType: \"raw\",\n codec: metadata.codec || \"unknown\",\n mimeType: \"application/octet-stream\",\n supported: true,\n },\n {\n kind: OUTPUT_OGG,\n payloadType: \"raw\",\n codec: \"vorbis\",\n mimeType: \"audio/ogg\",\n supported: oggSupport.supported,\n reason: oggSupport.supported ? \"\" : oggSupport.reason\n },\n {\n kind: OUTPUT_PCM,\n payloadType: OUTPUT_PCM,\n codec: \"float32\",\n supported: pcmSupport.supported,\n reason: pcmSupport.supported ? \"\" : pcmSupport.reason\n }\n ],\n warnings: [],\n errors: []\n };\n }\n catch (error)\n {\n return {\n format: \"wem\",\n source: values.source || \"buffer\",\n supported: \"none\",\n confidence: 0,\n preferredOutput: \"\",\n reason: error.message,\n metadata: null,\n variants: [],\n warnings: [],\n errors: [ error.message ]\n };\n }\n}\n\n// PCM decode routing by codec: PTADPCM decodes through its own module;\n// uncompressed 16-bit PCM deinterleaves directly. Compressed codecs with\n// their own containers (Vorbis, Opus, XMA) are not decoded here - Vorbis\n// repacks to Ogg instead (OUTPUT_OGG).\nfunction decodeToPcm(bytes, metadata)\n{\n if (metadata.codec === \"wwise-ptadpcm\")\n {\n return decodePtadpcm(bytes, metadata);\n }\n if ((metadata.codec === \"pcm\" || metadata.codec === \"pcm-extensible\") && metadata.bitsPerSample === 16)\n {\n const channels = Math.max(1, metadata.channels);\n const sampleCount = Math.floor(metadata.dataBytes / (2 * channels));\n const channelData = [];\n for (let channel = 0; channel < channels; channel++)\n {\n channelData.push(new Float32Array(sampleCount));\n }\n for (let i = 0; i < sampleCount; i++)\n {\n for (let channel = 0; channel < channels; channel++)\n {\n const at = metadata.dataOffset + (i * channels + channel) * 2;\n const raw = bytes[at] | (bytes[at + 1] << 8);\n channelData[channel][i] = (raw >= 0x8000 ? raw - 0x10000 : raw) / 32768;\n }\n }\n return { channelData, sampleCount, sampleRate: metadata.sampleRate, channels };\n }\n const error = new Error(`wem: pcm decode is not supported for codec ${metadata.codec || \"unknown\"}`);\n error.code = \"CJS_FORMAT_OUTPUT_NOT_SUPPORTED\";\n error.sourceFormat = \"wem\";\n throw error;\n}\n\nfunction getPcmSupport(metadata)\n{\n if (metadata.codec === \"wwise-ptadpcm\") return { supported: true, reason: \"\" };\n if ((metadata.codec === \"pcm\" || metadata.codec === \"pcm-extensible\") && metadata.bitsPerSample === 16)\n {\n return { supported: true, reason: \"\" };\n }\n return {\n supported: false,\n reason: \"PCM decode covers PTADPCM and 16-bit PCM; use the ogg emit for Wwise Vorbis.\"\n };\n}\n\nfunction getOggSupport(metadata)\n{\n if (metadata.codec !== \"wwise-vorbis\")\n {\n return {\n supported: false,\n reason: \"Only Wwise Vorbis media can be repacked to Ogg.\"\n };\n }\n\n const vorbSize = metadata.vorbis?.vorbSize;\n if (vorbSize === 0x28 || vorbSize === 0x2c)\n {\n return {\n supported: false,\n reason: \"Wwise Vorbis recognized, but old header-triad Wwise Vorbis is not supported by this repacker.\"\n };\n }\n\n if (!metadata.vorbis)\n {\n return {\n supported: false,\n reason: \"Wwise Vorbis recognized, but no Vorbis layout metadata was found.\"\n };\n }\n\n return { supported: true, reason: \"\" };\n}\n\n/** Reads input using normalized format options for the WEM format reader. */\nexport function readWithValues(input, values = DEFAULT_VALUES)\n{\n const bytes = toBytes(input);\n const metadata = inspectWithValues(bytes, values);\n if (values.emit === OUTPUT_WEM_JSON) return metadata;\n if (values.emit === OUTPUT_OGG)\n {\n if (metadata.codec !== \"wwise-vorbis\")\n {\n const error = new Error(`wem: only Wwise Vorbis can be repacked to Ogg (found ${metadata.codec || \"unknown\"})`);\n error.code = \"CJS_FORMAT_OUTPUT_NOT_SUPPORTED\";\n error.sourceFormat = \"wem\";\n throw error;\n }\n const ogg = convertWemToOgg(bytes, { codebooks: values.codebooks });\n return {\n payloadType: \"raw\",\n sourceFormat: \"wem\",\n outputFormat: \"ogg\",\n codec: \"vorbis\",\n mimeType: \"audio/ogg\",\n sampleCount: ogg.sampleCount,\n sampleRate: ogg.sampleRate,\n channels: ogg.channels,\n durationSeconds: ogg.durationSeconds,\n loop: ogg.loop,\n pageCount: ogg.pageCount,\n metadata,\n bytes: ogg.bytes\n };\n }\n if (values.emit === OUTPUT_PCM)\n {\n const decoded = decodeToPcm(bytes, metadata);\n return {\n payloadType: OUTPUT_PCM,\n sourceFormat: \"wem\",\n outputFormat: OUTPUT_PCM,\n codec: \"float32\",\n sourceCodec: metadata.codec,\n sampleCount: decoded.sampleCount,\n sampleRate: decoded.sampleRate,\n channels: decoded.channels,\n durationSeconds: decoded.sampleRate ? decoded.sampleCount / decoded.sampleRate : 0,\n channelData: decoded.channelData,\n metadata\n };\n }\n if (values.emit === OUTPUT_RAW)\n {\n return {\n payloadType: \"raw\",\n sourceFormat: \"wem\",\n codec: metadata.codec,\n mimeType: \"application/octet-stream\",\n metadata,\n bytes\n };\n }\n\n const error = new Error(`wem: emit \"${values.emit}\" is not implemented yet`);\n error.code = \"CJS_FORMAT_OUTPUT_NOT_IMPLEMENTED\";\n error.sourceFormat = \"wem\";\n error.emit = values.emit;\n throw error;\n}\n\n/** Converts a parsed payload into a JSON-safe value for the WEM format reader. */\nexport function toJsonValue(value)\n{\n if (value instanceof Uint8Array) return { byteLength: value.byteLength };\n if (Array.isArray(value)) return value.map(toJsonValue);\n if (value && typeof value === \"object\")\n {\n const output = {};\n for (const [ key, entry ] of Object.entries(value)) output[key] = toJsonValue(entry);\n return output;\n }\n return value;\n}\n\nfunction fourCc(bytes, offset, length = 4)\n{\n let value = \"\";\n for (let i = 0; i < length; i++) value += String.fromCharCode(bytes[offset + i] || 0);\n return value;\n}\n\nfunction readU16(bytes, offset, littleEndian)\n{\n return littleEndian\n ? bytes[offset] | (bytes[offset + 1] << 8)\n : (bytes[offset] << 8) | bytes[offset + 1];\n}\n\nfunction readU32(bytes, offset, littleEndian)\n{\n return littleEndian\n ? (bytes[offset] | (bytes[offset + 1] << 8) | (bytes[offset + 2] << 16) | (bytes[offset + 3] * 0x1000000)) >>> 0\n : ((bytes[offset] * 0x1000000) + (bytes[offset + 1] << 16) + (bytes[offset + 2] << 8) + bytes[offset + 3]) >>> 0;\n}\n"],"names":["OUTPUT_RAW","OUTPUT_JSON","OUTPUT_WEM_JSON","OUTPUT_OGG","OUTPUT_PCM","DEFAULT_VALUES","Object","freeze","emit","inputType","source","WEM_CODEC_NAMES","normalizeValues","base","options","readerName","values","String","replace","toLowerCase","normalizeEmit","undefined","includes","TypeError","JSON","stringify","toBytes","input","Uint8Array","ArrayBuffer","isView","buffer","byteOffset","byteLength","isWEM","bytes","container","fourCc","inspectWEM","littleEndian","info","sourceFormat","riffSize","readU32","codec","codecTag","channels","sampleRate","byteRate","blockAlign","bitsPerSample","extraSize","sampleCount","durationSeconds","dataOffset","dataBytes","vorbis","chunks","offset","fmtOffset","fmtSize","vorbOffset","vorbSize","id","size","push","truncated","readU16","toString","padStart","inline","inspectWithValues","payloadType","mediaTypes","decodeToPcm","metadata","decodePtadpcm","Math","max","floor","channelData","channel","Float32Array","i","at","raw","error","Error","code","readWithValues","ogg","convertWemToOgg","codebooks","outputFormat","mimeType","loop","pageCount","decoded","sourceCodec","toJsonValue","value","Array","isArray","map","output","key","entry","entries","length","fromCharCode"],"mappings":";;;AAGO,MAAMA,UAAU,GAAG;AACnB,MAAMC,WAAW,GAAG;AACpB,MAAMC,eAAe,GAAG;AACxB,MAAMC,UAAU,GAAG;AACnB,MAAMC,UAAU,GAAG;MAEbC,cAAc,GAAGC,MAAM,CAACC,MAAM,CAAC;AACxCC,EAAAA,IAAI,EAAER,UAAU;AAChBS,EAAAA,SAAS,EAAE,KAAK;AAChBC,EAAAA,MAAM,EAAE;AACZ,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA;AACA;MACaC,eAAe,GAAGL,MAAM,CAACC,MAAM,CAAC;AACzC,EAAA,MAAM,EAAE,KAAK;AACb,EAAA,MAAM,EAAE,iBAAiB;AACzB,EAAA,MAAM,EAAE,iBAAiB;AACzB,EAAA,MAAM,EAAE,MAAM;AACd,EAAA,MAAM,EAAE,MAAM;AACd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;;"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { inspectWithValues } from './helpers.js';
|
|
2
2
|
|
|
3
|
-
//
|
|
3
|
+
// Structural codec support for WEM media. The fmt tag is only a declaration;
|
|
4
4
|
// The fmt tag is the declaration; each candidate codec gets ONE bounded
|
|
5
5
|
// structural check against the actual container facts - no audio is decoded:
|
|
6
6
|
//
|
|
@@ -54,10 +54,10 @@ function emitFor(candidate) {
|
|
|
54
54
|
*
|
|
55
55
|
* @param {*} input Wem bytes.
|
|
56
56
|
* @param {object} values Normalized read values.
|
|
57
|
-
* @returns {object} Probe-shaped report
|
|
58
|
-
*
|
|
57
|
+
* @returns {object} Probe-shaped report with declared/resolved/mismatch
|
|
58
|
+
* evidence in `metadata`.
|
|
59
59
|
*/
|
|
60
|
-
function
|
|
60
|
+
function probeCodecSupportWithValues(input, values) {
|
|
61
61
|
const metadata = inspectWithValues(input, values);
|
|
62
62
|
const declared = metadata.codec || null;
|
|
63
63
|
let resolved = null;
|
|
@@ -73,7 +73,7 @@ function resolveTypeWithValues(input, values) {
|
|
|
73
73
|
}
|
|
74
74
|
}
|
|
75
75
|
}
|
|
76
|
-
const
|
|
76
|
+
const preferredOutput = emitFor(resolved);
|
|
77
77
|
const mismatch = resolved !== null && declaredCandidate !== resolved;
|
|
78
78
|
return {
|
|
79
79
|
format: "wem",
|
|
@@ -81,7 +81,7 @@ function resolveTypeWithValues(input, values) {
|
|
|
81
81
|
supported: metadata.codec ? "partial" : "none",
|
|
82
82
|
confidence: resolved ? 1 : 0,
|
|
83
83
|
verified: true,
|
|
84
|
-
|
|
84
|
+
preferredOutput,
|
|
85
85
|
reason: resolved ? mismatch ? `Declared codec ${declared} failed content validation; ${resolved} validated instead.` : `Declared codec validated by content.` : `No decodable codec validated against the content (declared ${declared ?? "none"}).`,
|
|
86
86
|
metadata: {
|
|
87
87
|
...metadata,
|
|
@@ -94,28 +94,21 @@ function resolveTypeWithValues(input, values) {
|
|
|
94
94
|
payloadType: "raw",
|
|
95
95
|
codec: declared || "unknown",
|
|
96
96
|
mimeType: "application/octet-stream",
|
|
97
|
-
supported: true
|
|
98
|
-
containerOnly: true,
|
|
99
|
-
isDecoded: false,
|
|
100
|
-
pcmDecodeSupported: false
|
|
97
|
+
supported: true
|
|
101
98
|
}, {
|
|
102
99
|
kind: "ogg",
|
|
103
100
|
payloadType: "raw",
|
|
104
101
|
codec: "vorbis",
|
|
105
102
|
mimeType: "audio/ogg",
|
|
106
|
-
supported: resolved === "wwise-vorbis"
|
|
107
|
-
containerOnly: true,
|
|
108
|
-
isDecoded: false
|
|
103
|
+
supported: resolved === "wwise-vorbis"
|
|
109
104
|
}, {
|
|
110
105
|
kind: "pcm",
|
|
111
106
|
payloadType: "pcm",
|
|
112
107
|
codec: "float32",
|
|
113
|
-
supported: resolved === "wwise-ptadpcm" || resolved === "pcm"
|
|
114
|
-
isDecoded: true,
|
|
115
|
-
pcmDecodeSupported: resolved === "wwise-ptadpcm" || resolved === "pcm"
|
|
108
|
+
supported: resolved === "wwise-ptadpcm" || resolved === "pcm"
|
|
116
109
|
}]
|
|
117
110
|
};
|
|
118
111
|
}
|
|
119
112
|
|
|
120
|
-
export {
|
|
121
|
-
//# sourceMappingURL=
|
|
113
|
+
export { probeCodecSupportWithValues };
|
|
114
|
+
//# sourceMappingURL=probeCodecSupport.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"probeCodecSupport.js","sources":["../../../../../src/formats/wem/core/probeCodecSupport.js"],"sourcesContent":["// Structural codec support for WEM media. The fmt tag is only a declaration;\n// The fmt tag is the declaration; each candidate codec gets ONE bounded\r\n// structural check against the actual container facts - no audio is decoded:\r\n//\r\n// - wwise-vorbis: the Wwise Vorbis sidecar must exist (vorb chunk or inline\r\n// fmt-0x42 layout) with a positive sample count and data payload;\r\n// - wwise-ptadpcm: the frame layout must satisfy the decoder's own guard\r\n// (blockAlign = frameSize * channels, frameSize >= 6) with block-aligned\r\n// data;\r\n// - pcm / pcm-extensible: 16-bit with self-consistent blockAlign/byteRate\r\n// and sample-aligned data.\r\n//\r\n// The declared codec is validated FIRST; when its check fails (a mislabeled\r\n// tag), the other candidates are tried in order. A 2026-07-19 census of all\r\n// 8,987 embedded wems in EVE build 3435006 found no mislabeled tags, so\r\n// mismatch is the exceptional path - but the check is what makes that a\r\n// verified fact per file rather than a corpus-wide assumption.\r\nimport { inspectWithValues } from \"./helpers.js\";\r\n\r\nconst CANDIDATES = [ \"wwise-vorbis\", \"wwise-ptadpcm\", \"pcm\" ];\r\n\r\nfunction validateVorbis(metadata)\r\n{\r\n if (metadata.codec === \"wwise-vorbis\")\r\n {\r\n return metadata.vorbis !== null && metadata.sampleCount > 0 && metadata.dataBytes > 0;\r\n }\r\n // Mislabeled tag: inspect() only fills `vorbis` when the tag says so, but\r\n // the chunk walk always records a standalone vorb sidecar chunk.\r\n return (metadata.chunks ?? []).some(chunk => chunk.id === \"vorb\") && metadata.dataBytes > 0;\r\n}\r\n\r\nfunction validatePtadpcm(metadata)\r\n{\r\n const channels = metadata.channels;\r\n const frameSize = channels > 0 ? Math.floor(metadata.blockAlign / channels) : 0;\r\n return channels >= 1\r\n && frameSize >= 6\r\n && metadata.blockAlign === frameSize * channels\r\n && metadata.dataBytes >= metadata.blockAlign\r\n && metadata.dataBytes % metadata.blockAlign === 0;\r\n}\r\n\r\nfunction validatePcm(metadata)\r\n{\r\n return metadata.bitsPerSample === 16\r\n && metadata.channels >= 1\r\n && metadata.blockAlign === metadata.channels * 2\r\n && metadata.byteRate === metadata.sampleRate * metadata.blockAlign\r\n && metadata.dataBytes > 0\r\n && metadata.dataBytes % metadata.blockAlign === 0;\r\n}\r\n\r\nfunction validate(candidate, metadata)\r\n{\r\n if (candidate === \"wwise-vorbis\") return validateVorbis(metadata);\r\n if (candidate === \"wwise-ptadpcm\") return validatePtadpcm(metadata);\r\n return validatePcm(metadata);\r\n}\r\n\r\nfunction candidateFor(codec)\r\n{\r\n if (codec === \"pcm-extensible\") return \"pcm\";\r\n return CANDIDATES.includes(codec) ? codec : null;\r\n}\r\n\r\nfunction emitFor(candidate)\r\n{\r\n if (candidate === \"wwise-vorbis\") return \"ogg\";\r\n if (candidate === \"wwise-ptadpcm\" || candidate === \"pcm\") return \"pcm\";\r\n return \"raw\";\r\n}\r\n\r\n/**\r\n * Resolve a wem's actual decode route from content, not just its fmt tag.\r\n *\r\n * @param {*} input Wem bytes.\r\n * @param {object} values Normalized read values.\r\n * @returns {object} Probe-shaped report with declared/resolved/mismatch\n * evidence in `metadata`.\n */\nexport function probeCodecSupportWithValues(input, values)\n{\r\n const metadata = inspectWithValues(input, values);\r\n const declared = metadata.codec || null;\r\n let resolved = null;\r\n const declaredCandidate = candidateFor(declared);\r\n if (declaredCandidate && validate(declaredCandidate, metadata))\r\n {\r\n resolved = declaredCandidate;\r\n }\r\n else\r\n {\r\n for (const candidate of CANDIDATES)\r\n {\r\n if (candidate === declaredCandidate) continue;\r\n if (validate(candidate, metadata))\r\n {\r\n resolved = candidate;\r\n break;\r\n }\r\n }\r\n }\r\n\r\n const preferredOutput = emitFor(resolved);\n const mismatch = resolved !== null && declaredCandidate !== resolved;\r\n return {\r\n format: \"wem\",\r\n source: values.source || \"buffer\",\r\n supported: metadata.codec ? \"partial\" : \"none\",\r\n confidence: resolved ? 1 : 0,\r\n verified: true,\r\n preferredOutput,\n reason: resolved\r\n ? (mismatch\r\n ? `Declared codec ${declared} failed content validation; ${resolved} validated instead.`\r\n : `Declared codec validated by content.`)\r\n : `No decodable codec validated against the content (declared ${declared ?? \"none\"}).`,\r\n metadata: { ...metadata, declared, resolved, mismatch },\r\n variants: [\r\n {\r\n kind: \"raw\",\r\n payloadType: \"raw\",\r\n codec: declared || \"unknown\",\r\n mimeType: \"application/octet-stream\",\r\n supported: true,\r\n },\r\n {\r\n kind: \"ogg\",\r\n payloadType: \"raw\",\r\n codec: \"vorbis\",\r\n mimeType: \"audio/ogg\",\r\n supported: resolved === \"wwise-vorbis\",\r\n },\r\n {\r\n kind: \"pcm\",\r\n payloadType: \"pcm\",\r\n codec: \"float32\",\r\n supported: resolved === \"wwise-ptadpcm\" || resolved === \"pcm\",\r\n }\r\n ]\r\n };\r\n}\r\n"],"names":["CANDIDATES","validateVorbis","metadata","codec","vorbis","sampleCount","dataBytes","chunks","some","chunk","id","validatePtadpcm","channels","frameSize","Math","floor","blockAlign","validatePcm","bitsPerSample","byteRate","sampleRate","validate","candidate","candidateFor","includes","emitFor","probeCodecSupportWithValues","input","values","inspectWithValues","declared","resolved","declaredCandidate","preferredOutput","mismatch","format","source","supported","confidence","verified","reason","variants","kind","payloadType","mimeType"],"mappings":";;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAGA,MAAMA,UAAU,GAAG,CAAE,cAAc,EAAE,eAAe,EAAE,KAAK,CAAE;AAE7D,SAASC,cAAcA,CAACC,QAAQ,EAChC;AACI,EAAA,IAAIA,QAAQ,CAACC,KAAK,KAAK,cAAc,EACrC;AACI,IAAA,OAAOD,QAAQ,CAACE,MAAM,KAAK,IAAI,IAAIF,QAAQ,CAACG,WAAW,GAAG,CAAC,IAAIH,QAAQ,CAACI,SAAS,GAAG,CAAC;AACzF,EAAA;AACA;AACA;EACA,OAAO,CAACJ,QAAQ,CAACK,MAAM,IAAI,EAAE,EAAEC,IAAI,CAACC,KAAK,IAAIA,KAAK,CAACC,EAAE,KAAK,MAAM,CAAC,IAAIR,QAAQ,CAACI,SAAS,GAAG,CAAC;AAC/F;AAEA,SAASK,eAAeA,CAACT,QAAQ,EACjC;AACI,EAAA,MAAMU,QAAQ,GAAGV,QAAQ,CAACU,QAAQ;AAClC,EAAA,MAAMC,SAAS,GAAGD,QAAQ,GAAG,CAAC,GAAGE,IAAI,CAACC,KAAK,CAACb,QAAQ,CAACc,UAAU,GAAGJ,QAAQ,CAAC,GAAG,CAAC;AAC/E,EAAA,OAAOA,QAAQ,IAAI,CAAC,IACbC,SAA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CAAA,CAAsC,GAC1C,8DAA8DD,QAAQ,IAAI,MAAM,CAAA,EAAA,CAAI;AAC1F5B,IAAAA,QAAQ,EAAE;AAAE,MAAA,GAAGA,QAAQ;MAAE4B,QAAQ;MAAEC,QAAQ;AAAEG,MAAAA;KAAU;AACvDO,IAAAA,QAAQ,EAAE,CACN;AACIC,MAAAA,IAAI,EAAE,KAAK;AACXC,MAAAA,WAAW,EAAE,KAAK;MAClBxC,KAAK,EAAE2B,QAAQ,IAAI,SAAS;AAC5Bc,MAAAA,QAAQ,EAAE,0BAA0B;AACpCP,MAAAA,SAAS,EAAE;AACf,KAAC,EACD;AACIK,MAAAA,IAAI,EAAE,KAAK;AACXC,MAAAA,WAAW,EAAE,KAAK;AAClBxC,MAAAA,KAAK,EAAE,QAAQ;AACfyC,MAAAA,QAAQ,EAAE,WAAW;MACrBP,SAAS,EAAEN,QAAQ,KAAK;AAC5B,KAAC,EACD;AACIW,MAAAA,IAAI,EAAE,KAAK;AACXC,MAAAA,WAAW,EAAE,KAAK;AAClBxC,MAAAA,KAAK,EAAE,SAAS;AAChBkC,MAAAA,SAAS,EAAEN,QAAQ,KAAK,eAAe,IAAIA,QAAQ,KAAK;KAC3D;GAER;AACL;;;;"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { CjsFormat } from '../../format/CjsFormat.js';
|
|
1
2
|
import { CjsYamlReader } from './core/CjsYamlReader.js';
|
|
2
3
|
import { DEFAULT_VALUES, normalizeValues, toJsonGraph, OUTPUT_RAW, OUTPUT_DOCUMENT, OUTPUT_PAYLOAD, OUTPUT_JSON, TAG_PRESERVE, TAG_REJECT, TAG_HANDLE } from './core/helpers.js';
|
|
3
4
|
|
|
@@ -8,11 +9,12 @@ const FORMAT_NAME = "CjsYamlFormat";
|
|
|
8
9
|
* JSON-graph, raw, or document output with configurable tag policies, alias
|
|
9
10
|
* limits, and identity/reference markers.
|
|
10
11
|
*/
|
|
11
|
-
class CjsYamlFormat {
|
|
12
|
+
class CjsYamlFormat extends CjsFormat {
|
|
12
13
|
#values = DEFAULT_VALUES;
|
|
13
14
|
|
|
14
15
|
/** Creates a CjsYamlFormat with caller-provided reader configuration. */
|
|
15
16
|
constructor(options = {}) {
|
|
17
|
+
super();
|
|
16
18
|
this.SetValues(options);
|
|
17
19
|
}
|
|
18
20
|
|
|
@@ -123,11 +125,24 @@ class CjsYamlFormat {
|
|
|
123
125
|
static TAG_HANDLE = TAG_HANDLE;
|
|
124
126
|
static id = "yaml";
|
|
125
127
|
static extensions = Object.freeze([".yaml", ".yml"]);
|
|
126
|
-
static type = Object.freeze(["data"]);
|
|
127
128
|
static mediaTypes = Object.freeze(["data"]);
|
|
128
|
-
static
|
|
129
|
-
|
|
130
|
-
|
|
129
|
+
static outputs = CjsFormat.defineOutputs({
|
|
130
|
+
json: {
|
|
131
|
+
decoded: true
|
|
132
|
+
},
|
|
133
|
+
payload: {
|
|
134
|
+
default: true,
|
|
135
|
+
decoded: true
|
|
136
|
+
},
|
|
137
|
+
raw: {
|
|
138
|
+
role: "debug",
|
|
139
|
+
decoded: true
|
|
140
|
+
},
|
|
141
|
+
document: {
|
|
142
|
+
role: "debug",
|
|
143
|
+
decoded: true
|
|
144
|
+
}
|
|
145
|
+
});
|
|
131
146
|
}
|
|
132
147
|
|
|
133
148
|
export { CjsYamlFormat, CjsYamlFormat as default };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CjsYamlFormat.js","sources":["../../../../src/formats/yaml/CjsYamlFormat.js"],"sourcesContent":["import { CjsYamlReader } from \"./core/CjsYamlReader.js\";\nimport {\n DEFAULT_VALUES,\n OUTPUT_DOCUMENT,\n OUTPUT_JSON,\n OUTPUT_PAYLOAD,\n OUTPUT_RAW,\n TAG_HANDLE,\n TAG_PRESERVE,\n TAG_REJECT,\n normalizeValues,\n toJsonGraph\n} from \"./core/helpers.js\";\n\nconst FORMAT_NAME = \"CjsYamlFormat\";\n\n/**\n * YAML format profile that parses YAML text or strict UTF-8 bytes into payload,\n * JSON-graph, raw, or document output with configurable tag policies, alias\n * limits, and identity/reference markers.\n */\nexport class CjsYamlFormat\n{\n #values = DEFAULT_VALUES;\n\n /** Creates a CjsYamlFormat with caller-provided reader configuration. */\n constructor(options = {})\n {\n this.SetValues(options);\n }\n\n /**\n * Applies caller-provided options after normalizing supported fields for the\n * YAML document reader.\n */\n SetValues(options = {})\n {\n this.#values = normalizeValues(this.#values, options, FORMAT_NAME);\n return this;\n }\n\n /**\n * Returns a snapshot of the normalized reader options for the YAML document\n * reader.\n */\n GetValues(options = {})\n {\n return normalizeValues(this.#values, options, FORMAT_NAME);\n }\n\n /**\n * Reads the primary public payload representation from the supplied input\n * for the YAML document reader.\n */\n Read(input, options = {})\n {\n return CjsYamlFormat.read(input, this.GetValues(options));\n }\n\n /** Reads payload from the current YAML document reader. */\n ReadPayload(input, options = {})\n {\n return CjsYamlFormat.readPayload(input, this.GetValues(options));\n }\n\n /** Reads raw from the current YAML document reader. */\n ReadRaw(input, options = {})\n {\n return CjsYamlFormat.readRaw(input, this.GetValues(options));\n }\n\n /** Reads document from the current YAML document reader. */\n ReadDocument(input, options = {})\n {\n return CjsYamlFormat.readDocument(input, this.GetValues(options));\n }\n\n /**\n * Returns structural metadata without materializing the decoded payload for\n * the YAML document reader.\n */\n Inspect(input, options = {})\n {\n return CjsYamlFormat.inspect(input, this.GetValues(options));\n }\n\n /**\n * Converts the current decoded payload into a JSON-safe representation for\n * the YAML document reader.\n */\n ToJSON(value, options = {})\n {\n return toJsonGraph(value, this.GetValues(options));\n }\n\n /** Provides the one-shot YAML payload reader entry point. */\n static read(input, options = {})\n {\n const values = normalizeValues(DEFAULT_VALUES, options, FORMAT_NAME);\n if (values.emit === OUTPUT_RAW) return new CjsYamlReader(input, values).ReadRaw();\n if (values.emit === OUTPUT_DOCUMENT) return new CjsYamlReader(input, values).ReadDocument();\n return new CjsYamlReader(input, values).ReadPayload();\n }\n\n /** Provides the one-shot YAML normalized-payload reader entry point. */\n static readPayload(input, options = {})\n {\n const values = normalizeValues(DEFAULT_VALUES, options, FORMAT_NAME);\n return new CjsYamlReader(input, values).ReadPayload();\n }\n\n /** Provides the one-shot YAML raw-value reader entry point. */\n static readRaw(input, options = {})\n {\n const values = normalizeValues(DEFAULT_VALUES, options, FORMAT_NAME);\n return new CjsYamlReader(input, values).ReadRaw();\n }\n\n /** Provides the one-shot YAML document reader entry point. */\n static readDocument(input, options = {})\n {\n const values = normalizeValues(DEFAULT_VALUES, options, FORMAT_NAME);\n return new CjsYamlReader(input, values).ReadDocument();\n }\n\n /** Provides the one-shot YAML metadata inspection entry point. */\n static inspect(input, options = {})\n {\n const values = normalizeValues(DEFAULT_VALUES, options, FORMAT_NAME);\n return new CjsYamlReader(input, values).Inspect();\n }\n\n /** Provides the one-shot YAML JSON conversion entry point. */\n static toJSON(value, options = {})\n {\n return toJsonGraph(value, normalizeValues(DEFAULT_VALUES, options, FORMAT_NAME));\n }\n\n /**\n * Emit targets for this format (canonical frozen enum).\n */\n static Output = Object.freeze({\n JSON: OUTPUT_JSON,\n PAYLOAD: OUTPUT_PAYLOAD,\n RAW: OUTPUT_RAW,\n DOCUMENT: OUTPUT_DOCUMENT\n });\n static TAG_PRESERVE = TAG_PRESERVE;\n static TAG_REJECT = TAG_REJECT;\n static TAG_HANDLE = TAG_HANDLE;\n static id = \"yaml\";\n static extensions = Object.freeze([ \".yaml\", \".yml\" ]);\n static
|
|
1
|
+
{"version":3,"file":"CjsYamlFormat.js","sources":["../../../../src/formats/yaml/CjsYamlFormat.js"],"sourcesContent":["import { CjsFormat } from \"../../format/CjsFormat.js\";\nimport { CjsYamlReader } from \"./core/CjsYamlReader.js\";\nimport {\n DEFAULT_VALUES,\n OUTPUT_DOCUMENT,\n OUTPUT_JSON,\n OUTPUT_PAYLOAD,\n OUTPUT_RAW,\n TAG_HANDLE,\n TAG_PRESERVE,\n TAG_REJECT,\n normalizeValues,\n toJsonGraph\n} from \"./core/helpers.js\";\n\nconst FORMAT_NAME = \"CjsYamlFormat\";\n\n/**\n * YAML format profile that parses YAML text or strict UTF-8 bytes into payload,\n * JSON-graph, raw, or document output with configurable tag policies, alias\n * limits, and identity/reference markers.\n */\nexport class CjsYamlFormat extends CjsFormat\n{\n #values = DEFAULT_VALUES;\n\n /** Creates a CjsYamlFormat with caller-provided reader configuration. */\n constructor(options = {})\n {\n super();\n this.SetValues(options);\n }\n\n /**\n * Applies caller-provided options after normalizing supported fields for the\n * YAML document reader.\n */\n SetValues(options = {})\n {\n this.#values = normalizeValues(this.#values, options, FORMAT_NAME);\n return this;\n }\n\n /**\n * Returns a snapshot of the normalized reader options for the YAML document\n * reader.\n */\n GetValues(options = {})\n {\n return normalizeValues(this.#values, options, FORMAT_NAME);\n }\n\n /**\n * Reads the primary public payload representation from the supplied input\n * for the YAML document reader.\n */\n Read(input, options = {})\n {\n return CjsYamlFormat.read(input, this.GetValues(options));\n }\n\n /** Reads payload from the current YAML document reader. */\n ReadPayload(input, options = {})\n {\n return CjsYamlFormat.readPayload(input, this.GetValues(options));\n }\n\n /** Reads raw from the current YAML document reader. */\n ReadRaw(input, options = {})\n {\n return CjsYamlFormat.readRaw(input, this.GetValues(options));\n }\n\n /** Reads document from the current YAML document reader. */\n ReadDocument(input, options = {})\n {\n return CjsYamlFormat.readDocument(input, this.GetValues(options));\n }\n\n /**\n * Returns structural metadata without materializing the decoded payload for\n * the YAML document reader.\n */\n Inspect(input, options = {})\n {\n return CjsYamlFormat.inspect(input, this.GetValues(options));\n }\n\n /**\n * Converts the current decoded payload into a JSON-safe representation for\n * the YAML document reader.\n */\n ToJSON(value, options = {})\n {\n return toJsonGraph(value, this.GetValues(options));\n }\n\n /** Provides the one-shot YAML payload reader entry point. */\n static read(input, options = {})\n {\n const values = normalizeValues(DEFAULT_VALUES, options, FORMAT_NAME);\n if (values.emit === OUTPUT_RAW) return new CjsYamlReader(input, values).ReadRaw();\n if (values.emit === OUTPUT_DOCUMENT) return new CjsYamlReader(input, values).ReadDocument();\n return new CjsYamlReader(input, values).ReadPayload();\n }\n\n /** Provides the one-shot YAML normalized-payload reader entry point. */\n static readPayload(input, options = {})\n {\n const values = normalizeValues(DEFAULT_VALUES, options, FORMAT_NAME);\n return new CjsYamlReader(input, values).ReadPayload();\n }\n\n /** Provides the one-shot YAML raw-value reader entry point. */\n static readRaw(input, options = {})\n {\n const values = normalizeValues(DEFAULT_VALUES, options, FORMAT_NAME);\n return new CjsYamlReader(input, values).ReadRaw();\n }\n\n /** Provides the one-shot YAML document reader entry point. */\n static readDocument(input, options = {})\n {\n const values = normalizeValues(DEFAULT_VALUES, options, FORMAT_NAME);\n return new CjsYamlReader(input, values).ReadDocument();\n }\n\n /** Provides the one-shot YAML metadata inspection entry point. */\n static inspect(input, options = {})\n {\n const values = normalizeValues(DEFAULT_VALUES, options, FORMAT_NAME);\n return new CjsYamlReader(input, values).Inspect();\n }\n\n /** Provides the one-shot YAML JSON conversion entry point. */\n static toJSON(value, options = {})\n {\n return toJsonGraph(value, normalizeValues(DEFAULT_VALUES, options, FORMAT_NAME));\n }\n\n /**\n * Emit targets for this format (canonical frozen enum).\n */\n static Output = Object.freeze({\n JSON: OUTPUT_JSON,\n PAYLOAD: OUTPUT_PAYLOAD,\n RAW: OUTPUT_RAW,\n DOCUMENT: OUTPUT_DOCUMENT\n });\n static TAG_PRESERVE = TAG_PRESERVE;\n static TAG_REJECT = TAG_REJECT;\n static TAG_HANDLE = TAG_HANDLE;\n static id = \"yaml\";\n static extensions = Object.freeze([ \".yaml\", \".yml\" ]);\n static mediaTypes = Object.freeze([ \"data\" ]);\n static outputs = CjsFormat.defineOutputs({\n json: { decoded: true },\n payload: { default: true, decoded: true },\n raw: { role: \"debug\", decoded: true },\n document: { role: \"debug\", decoded: true }\n });\n}\n\nexport default CjsYamlFormat;\n"],"names":["FORMAT_NAME","CjsYamlFormat","CjsFormat","DEFAULT_VALUES","constructor","options","SetValues","normalizeValues","GetValues","Read","input","read","ReadPayload","readPayload","ReadRaw","readRaw","ReadDocument","readDocument","Inspect","inspect","ToJSON","value","toJsonGraph","values","emit","OUTPUT_RAW","CjsYamlReader","OUTPUT_DOCUMENT","toJSON","Output","Object","freeze","JSON","OUTPUT_JSON","PAYLOAD","OUTPUT_PAYLOAD","RAW","DOCUMENT","TAG_PRESERVE","TAG_REJECT","TAG_HANDLE","id","extensions","mediaTypes","outputs","defineOutputs","json","decoded","payload","default","raw","role","document"],"mappings":";;;;AAeA,MAAMA,WAAW,GAAG,eAAe;;AAEnC;AACA;AACA;AACA;AACA;AACO,MAAMC,aAAa,SAASC,SAAS,CAC5C;EACI,OAAO,GAAGC,cAAc;;AAExB;AACAC,EAAAA,WAAWA,CAACC,OAAO,GAAG,EAAE,EACxB;AACI,IAAA,KAAK,EAAE;AACP,IAAA,IAAI,CAACC,SAAS,CAACD,OAAO,CAAC;AAC3B,EAAA;;AAEA;AACJ;AACA;AACA;AACIC,EAAAA,SAASA,CAACD,OAAO,GAAG,EAAE,EACtB;AACI,IAAA,IAAI,CAAC,OAAO,GAAGE,eAAe,CAAC,IAAI,CAAC,OAAO,EAAEF,OAAO,EAAEL,WAAW,CAAC;AAClE,IAAA,OAAO,IAAI;AACf,EAAA;;AAEA;AACJ;AACA;AACA;AACIQ,EAAAA,SAASA,CAACH,OAAO,GAAG,EAAE,EACtB;IACI,OAAOE,eAAe,CAAC,IAAI,CAAC,OAAO,EAAEF,OAAO,EAAEL,WAAW,CAAC;AAC9D,EAAA;;AAEA;AACJ;AACA;AACA;AACIS,EAAAA,IAAIA,CAACC,KAAK,EAAEL,OAAO,GAAG,EAAE,EACxB;AACI,IAAA,OAAOJ,aAAa,CAACU,IAAI,CAACD,KAAK,EAAE,IAAI,CAACF,SAAS,CAACH,OAAO,CAAC,CAAC;AAC7D,EAAA;;AAEA;AACAO,EAAAA,WAAWA,CAACF,KAAK,EAAEL,OAAO,GAAG,EAAE,EAC/B;AACI,IAAA,OAAOJ,aAAa,CAACY,WAAW,CAACH,KAAK,EAAE,IAAI,CAACF,SAAS,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AM,CAACC,MAAM,CAAC;AAC1BC,IAAAA,IAAI,EAAEC,WAAW;AACjBC,IAAAA,OAAO,EAAEC,cAAc;AACvBC,IAAAA,GAAG,EAAEX,UAAU;AACfY,IAAAA,QAAQ,EAAEV;AACd,GAAC,CAAC;EACF,OAAOW,YAAY,GAAGA,YAAY;EAClC,OAAOC,UAAU,GAAGA,UAAU;EAC9B,OAAOC,UAAU,GAAGA,UAAU;EAC9B,OAAOC,EAAE,GAAG,MAAM;EAClB,OAAOC,UAAU,GAAGZ,MAAM,CAACC,MAAM,CAAC,CAAE,OAAO,EAAE,MAAM,CAAE,CAAC;EACtD,OAAOY,UAAU,GAAGb,MAAM,CAACC,MAAM,CAAC,CAAE,MAAM,CAAE,CAAC;AAC7C,EAAA,OAAOa,OAAO,GAAG1C,SAAS,CAAC2C,aAAa,CAAC;AACrCC,IAAAA,IAAI,EAAE;AAAEC,MAAAA,OAAO,EAAE;KAAM;AACvBC,IAAAA,OAAO,EAAE;AAAEC,MAAAA,OAAO,EAAE,IAAI;AAAEF,MAAAA,OAAO,EAAE;KAAM;AACzCG,IAAAA,GAAG,EAAE;AAAEC,MAAAA,IAAI,EAAE,OAAO;AAAEJ,MAAAA,OAAO,EAAE;KAAM;AACrCK,IAAAA,QAAQ,EAAE;AAAED,MAAAA,IAAI,EAAE,OAAO;AAAEJ,MAAAA,OAAO,EAAE;AAAK;AAC7C,GAAC,CAAC;AACN;;;;"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { applyDecs2311 as _applyDecs2311 } from '../../_virtual/_rollupPluginBabelHelpers.js';
|
|
2
|
+
import { type } from '@carbonenginejs/runtime-utils/schema';
|
|
3
|
+
import { CjsModel } from '@carbonenginejs/runtime-utils/model';
|
|
4
|
+
|
|
5
|
+
let _initClass, _init_lodIndices, _init_extra_lodIndices, _init_bvh, _init_extra_bvh;
|
|
6
|
+
|
|
7
|
+
/** Tr2RaycastGeometryRes (resources) - generated from schema shapeHash f30f73e8.... */
|
|
8
|
+
let _Tr2RaycastGeometryRe;
|
|
9
|
+
class Tr2RaycastGeometryRes extends CjsModel {
|
|
10
|
+
static {
|
|
11
|
+
({
|
|
12
|
+
e: [_init_lodIndices, _init_extra_lodIndices, _init_bvh, _init_extra_bvh],
|
|
13
|
+
c: [_Tr2RaycastGeometryRe, _initClass]
|
|
14
|
+
} = _applyDecs2311(this, [type.define({
|
|
15
|
+
className: "Tr2RaycastGeometryRes",
|
|
16
|
+
family: "resources"
|
|
17
|
+
})], [[type.list("int32_t"), 0, "lodIndices"], [type.rawStruct("BVH::BoundingVolumeHierarchy"), 0, "bvh"]], 0, void 0, CjsModel));
|
|
18
|
+
}
|
|
19
|
+
constructor(...args) {
|
|
20
|
+
super(...args);
|
|
21
|
+
_init_extra_bvh(this);
|
|
22
|
+
}
|
|
23
|
+
/** m_lodIndices (std::vector<int32_t>) */
|
|
24
|
+
lodIndices = _init_lodIndices(this, []);
|
|
25
|
+
|
|
26
|
+
/** m_bvh (BVH::BoundingVolumeHierarchy) */
|
|
27
|
+
bvh = (_init_extra_lodIndices(this), _init_bvh(this, null));
|
|
28
|
+
static {
|
|
29
|
+
_initClass();
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
export { _Tr2RaycastGeometryRe as Tr2RaycastGeometryRes };
|
|
34
|
+
//# sourceMappingURL=Tr2RaycastGeometryRes.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Tr2RaycastGeometryRes.js","sources":["../../../../src/generated/resources/Tr2RaycastGeometryRes.js"],"sourcesContent":["// Source: trinity/trinity/Resources/TriGeometryRes.h\n// Generated by format-carbon carbon-class --emit. Verify against resources/Tr2RaycastGeometryRes.json.\nimport { type } from \"@carbonenginejs/runtime-utils/schema\";\nimport { CjsModel } from \"@carbonenginejs/runtime-utils/model\";\n\n/** Tr2RaycastGeometryRes (resources) - generated from schema shapeHash f30f73e8.... */\n@type.define({ className: \"Tr2RaycastGeometryRes\", family: \"resources\" })\nexport class Tr2RaycastGeometryRes extends CjsModel\n{\n\n /** m_lodIndices (std::vector<int32_t>) */\n @type.list(\"int32_t\")\n lodIndices = [];\n\n /** m_bvh (BVH::BoundingVolumeHierarchy) */\n @type.rawStruct(\"BVH::BoundingVolumeHierarchy\")\n bvh = null;\n\n}\n"],"names":["_Tr2RaycastGeometryRe","Tr2RaycastGeometryRes","CjsModel","e","_init_lodIndices","_init_extra_lodIndices","_init_bvh","_init_extra_bvh","c","_initClass","_applyDecs","type","define","className","family","list","rawStruct","constructor","args","lodIndices","bvh"],"mappings":";;;;;;AAKA;AAAA,IAAAA;AACA,MAAAC,qBAAA,SAC2CC,QAAQ,CACnD;AAAA,EAAA;AAAA,IAAA,CAAA;AAAAC,MAAAA,CAAA,GAAAC,gBAAA,EAAAC,sBAAA,EAAAC,SAAA,EAAAC,eAAA,CAAA;MAAAC,CAAA,EAAA,CAAAR,qBAAA,EAAAS,UAAA;AAAA,KAAA,GAAAC,cAAA,CAAA,IAAA,EAAA,CAFCC,IAAI,CAACC,MAAM,CAAC;AAAEC,MAAAA,SAAS,EAAE,uBAAuB;AAAEC,MAAAA,MAAM,EAAE;AAAY,KAAC,CAAC,CAAA,EAAA,CAAA,CAKtEH,IAAI,CAACI,IAAI,CAAC,SAAS,CAAC,EAAA,CAAA,EAAA,YAAA,CAAA,EAAA,CAIpBJ,IAAI,CAACK,SAAS,CAAC,8BAA8B,CAAC,yBARNd,QAAQ,CAAA;AAAA;AAAAe,EAAAA,WAAAA,CAAA,GAAAC,IAAA,EAAA;AAAA,IAAA,KAAA,CAAA,GAAAA,IAAA,CAAA;IAAAX,eAAA,CAAA,IAAA,CAAA;AAAA,EAAA;AAGjD;EAEAY,UAAU,GAAAf,gBAAA,CAAA,IAAA,EAAG,EAAE,CAAA;;AAEf;AAEAgB,EAAAA,GAAG,IAAAf,sBAAA,CAAA,IAAA,CAAA,EAAAC,SAAA,OAAG,IAAI,CAAA;AAAC,EAAA;IAAAG,UAAA,EAAA;AAAA;AAEb;;;;"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
|
package/dist/index.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
export { CjsResource } from './resource/CjsResource.js';
|
|
2
2
|
export { CjsLoadingObject } from './resource/CjsLoadingObject.js';
|
|
3
3
|
export { ResourceHandlerMode } from './resource/ResourceHandlerMode.js';
|
|
4
|
+
export { ResourceRequirement, isResourceRequirement } from './resource/ResourceRequirement.js';
|
|
4
5
|
export { Tr2LightProfileRes } from './resource/Tr2LightProfileRes.js';
|
|
5
6
|
export { AudioGeometryResData } from './resource/audio/AudioGeometryResData.js';
|
|
6
7
|
export { CjsAudioBufferRes } from './resource/audio/CjsAudioBufferRes.js';
|
|
@@ -53,7 +54,8 @@ export { Tr2TexturePipelineStepPack } from './resource/texture/Tr2TexturePipelin
|
|
|
53
54
|
export { TriTextureRes } from './resource/texture/TriTextureRes.js';
|
|
54
55
|
export { CjsResourceProbe } from './format/CjsResourceProbe.js';
|
|
55
56
|
export { ResourcePayloadType, ResourcePayloadValues, validateAudioPayload, validateRgbaPayload, validateTexturePayload, validateVideoPayload } from './format/payloadContract.js';
|
|
56
|
-
export { CjsFormat } from './format/CjsFormat.js';
|
|
57
|
+
export { CjsFormat, CjsFormatOutputRole, CjsFormatReadMode } from './format/CjsFormat.js';
|
|
58
|
+
export { CjsFormatRoute, CjsFormatStore } from './format/CjsFormatStore.js';
|
|
57
59
|
export { CjsEventEmitter } from '@carbonenginejs/runtime-utils/model';
|
|
58
60
|
export { CjsMotherLode, getMotherLodeKey } from './CjsMotherLode.js';
|
|
59
61
|
export { CjsResManFetchProvider } from './CjsResManFetchProvider.js';
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { CjsEventEmitter } from '@carbonenginejs/runtime-utils/model';
|
|
2
2
|
import { normalizeResourcePath, normalizeResourceExtension, getResourceExtension } from '@carbonenginejs/runtime-utils/path';
|
|
3
3
|
import { CjsSchema, carbon, impl, type } from '@carbonenginejs/runtime-utils/schema';
|
|
4
|
+
import { CjsFormatRoute } from '../format/CjsFormatStore.js';
|
|
4
5
|
import { ResourceHandlerMode } from './ResourceHandlerMode.js';
|
|
5
6
|
|
|
6
7
|
/**
|
|
@@ -83,6 +84,12 @@ class CjsResource extends CjsEventEmitter {
|
|
|
83
84
|
configurable: true,
|
|
84
85
|
writable: true
|
|
85
86
|
});
|
|
87
|
+
Object.defineProperty(this, "__formatStore", {
|
|
88
|
+
value: null,
|
|
89
|
+
enumerable: false,
|
|
90
|
+
configurable: true,
|
|
91
|
+
writable: true
|
|
92
|
+
});
|
|
86
93
|
Object.defineProperty(this, "__objectLoader", {
|
|
87
94
|
value: null,
|
|
88
95
|
enumerable: false,
|
|
@@ -392,6 +399,133 @@ class CjsResource extends CjsEventEmitter {
|
|
|
392
399
|
return this;
|
|
393
400
|
}
|
|
394
401
|
|
|
402
|
+
/**
|
|
403
|
+
* Take over loading entirely, before the manager fetches anything.
|
|
404
|
+
*
|
|
405
|
+
* Returning `true` means this resource handled its own acquisition and the
|
|
406
|
+
* manager stands down: no fetch, no queue entry. Returning `false` — the
|
|
407
|
+
* default — means load it the ordinary way.
|
|
408
|
+
*
|
|
409
|
+
* This one IS optional, unlike `DoLoad`, and that is why it has a default
|
|
410
|
+
* instead of a refusal. Most resources never take it. Declaring it here
|
|
411
|
+
* rather than optional-chaining at the call site keeps the caller honest:
|
|
412
|
+
* absence is a supported answer, so the base states the answer.
|
|
413
|
+
*
|
|
414
|
+
* @param {string} url Resolved source url.
|
|
415
|
+
* @param {string} extension Lowercased extension including its dot.
|
|
416
|
+
* @returns {boolean} Whether this resource handled its own load.
|
|
417
|
+
*/
|
|
418
|
+
DoCustomLoad(url, extension) {
|
|
419
|
+
return false;
|
|
420
|
+
}
|
|
421
|
+
|
|
422
|
+
/**
|
|
423
|
+
* Bind the format store this resource may resolve its own reader from.
|
|
424
|
+
*
|
|
425
|
+
* A resource must not import its formats - every one of them is a
|
|
426
|
+
* tree-shakeable subpath, so importing one here would drag it into every
|
|
427
|
+
* consumer of this resource. Nor can it hardcode a list, because which
|
|
428
|
+
* formats exist is a property of the composed application. The store is the
|
|
429
|
+
* link that lets both stay true: the composition root registers what it
|
|
430
|
+
* wants, and the resource asks.
|
|
431
|
+
*
|
|
432
|
+
* Optional. A resource loaded through `CjsResMan` never needs it, because the
|
|
433
|
+
* manager resolves the reader from its own extension routes and hands the
|
|
434
|
+
* outcome over as a payload. This is for the resource driving its own load.
|
|
435
|
+
*
|
|
436
|
+
* @param {import("../format/CjsFormatStore.js").CjsFormatStore|null} store
|
|
437
|
+
* @returns {CjsResource} This resource.
|
|
438
|
+
*/
|
|
439
|
+
SetFormatStore(store = null) {
|
|
440
|
+
if (store !== null && typeof store?.Resolve !== "function") {
|
|
441
|
+
throw new TypeError("CjsResource.SetFormatStore requires a format store or null.");
|
|
442
|
+
}
|
|
443
|
+
this.__formatStore = store;
|
|
444
|
+
return this;
|
|
445
|
+
}
|
|
446
|
+
|
|
447
|
+
/** The bound format store, or `null`. */
|
|
448
|
+
GetFormatStore() {
|
|
449
|
+
return this.__formatStore || null;
|
|
450
|
+
}
|
|
451
|
+
|
|
452
|
+
/**
|
|
453
|
+
* The route that should read this resource's source data.
|
|
454
|
+
*
|
|
455
|
+
* An explicitly supplied format always wins: a caller naming a reader knows
|
|
456
|
+
* something the extension does not. It is wrapped in a route so callers have
|
|
457
|
+
* one shape to handle either way.
|
|
458
|
+
*
|
|
459
|
+
* Otherwise the bound store answers from this resource's own extension, and
|
|
460
|
+
* from an `output` only when the caller asks for one.
|
|
461
|
+
*
|
|
462
|
+
* `requirement` IS NOT THE OUTPUT, though it reads like it. It selects the
|
|
463
|
+
* resource class — `CjsResMan.RegisterResourceType` keys on it. A format's
|
|
464
|
+
* outputs are a different axis entirely: `texture` and `rgba` are two
|
|
465
|
+
* representations of one DDS. Conflating them makes a resource loaded with
|
|
466
|
+
* `requirement: "geometry"` filter for routes declaring an output named
|
|
467
|
+
* `geometry`, find none, and resolve to null.
|
|
468
|
+
*
|
|
469
|
+
* Returns `null` when nothing answers, so the caller reports what it could
|
|
470
|
+
* not read rather than handing bytes to a reader that never claimed them.
|
|
471
|
+
*
|
|
472
|
+
* @param {*} [data] Source data, used to separate routes sharing an extension.
|
|
473
|
+
* @param {object|null} [options] May carry an explicit `format`, `read` and `output`.
|
|
474
|
+
* @returns {import("../format/CjsFormatStore.js").CjsFormatRoute|null}
|
|
475
|
+
*/
|
|
476
|
+
ResolveFormat(data, options = null) {
|
|
477
|
+
if (options?.format) {
|
|
478
|
+
return new CjsFormatRoute(options.format, {
|
|
479
|
+
read: options.read,
|
|
480
|
+
output: options.output || null
|
|
481
|
+
});
|
|
482
|
+
}
|
|
483
|
+
return this.GetFormatStore()?.Resolve(this.ext, data, {
|
|
484
|
+
output: options?.output || null
|
|
485
|
+
}) || null;
|
|
486
|
+
}
|
|
487
|
+
|
|
488
|
+
/**
|
|
489
|
+
* How this resource wants its source bytes delivered.
|
|
490
|
+
*
|
|
491
|
+
* The manager must fetch before it knows the format, so the resource states
|
|
492
|
+
* what shape it needs. Defaults to the format-side default, which is what
|
|
493
|
+
* every transport hardcodes today.
|
|
494
|
+
*
|
|
495
|
+
* @returns {string} A fetch response type.
|
|
496
|
+
*/
|
|
497
|
+
GetRequestResponseType() {
|
|
498
|
+
return "arraybuffer";
|
|
499
|
+
}
|
|
500
|
+
|
|
501
|
+
/**
|
|
502
|
+
* Turn raw source bytes into this resource.
|
|
503
|
+
*
|
|
504
|
+
* Declared here rather than left to each subclass because it is the load
|
|
505
|
+
* contract, not an optional capability. The base refuses rather than
|
|
506
|
+
* silently succeeding: a resource reached by the loader that has not been
|
|
507
|
+
* taught to read its own bytes is a registration mistake, and returning
|
|
508
|
+
* quietly would publish an empty resource and mark it prepared.
|
|
509
|
+
*
|
|
510
|
+
* `Tr2EffectRes` already implements exactly this shape, and it is the only
|
|
511
|
+
* resource that does. It takes container bytes and keeps the reader it
|
|
512
|
+
* builds, because a shader body cannot be read later without it — strings
|
|
513
|
+
* are offsets into an arena that lives in the header it consumed. No payload
|
|
514
|
+
* hand-off could have carried that, which is why it bypassed the manager.
|
|
515
|
+
*
|
|
516
|
+
* @param {ArrayBuffer|ArrayBufferView|string} data Raw source data.
|
|
517
|
+
* @param {object|null} [options] Model values applied after the read.
|
|
518
|
+
* @returns {CjsResource} This resource.
|
|
519
|
+
* @throws {Error} When the concrete resource does not implement it.
|
|
520
|
+
*/
|
|
521
|
+
DoLoad(data, options = null) {
|
|
522
|
+
const className = this.constructor?.name || "CjsResource";
|
|
523
|
+
const error = new Error(`${className}.DoLoad is not implemented. A resource reached by the loader ` + "must turn its own source bytes into itself; implement DoLoad, or register " + "a format that populates this resource.");
|
|
524
|
+
error.code = "CJS_RESOURCE_LOAD_NOT_IMPLEMENTED";
|
|
525
|
+
error.className = className;
|
|
526
|
+
throw error;
|
|
527
|
+
}
|
|
528
|
+
|
|
395
529
|
/**
|
|
396
530
|
* Read the plain CPU payload associated with this resource.
|
|
397
531
|
*
|