├── .gitattributes
├── .gitignore
├── .project
├── .settings
└── org.eclipse.jdt.core.prefs
├── LICENSE
├── README.md
├── WinMerge
├── IgnoreSectionMarkers.ini
├── MergeLang.dll
├── WinMergeU.exe
├── libexpat.dll
├── mfc71u.dll
├── msvcp71.dll
├── msvcr71.dll
└── pcre.dll
├── reg_file.txt
├── reg_property.txt
├── reg_spui.txt
├── reg_type.txt
├── src
├── net
│ └── tomahawk
│ │ ├── ExtensionsFilter.java
│ │ └── XFileDialog.java
└── sporemodder
│ ├── MainApp.java
│ ├── extras
│ └── spuieditor
│ │ ├── CommandAction.java
│ │ ├── ComponentChooser.java
│ │ ├── ComponentContainer.java
│ │ ├── ComponentValueAction.java
│ │ ├── DraggableType.java
│ │ ├── ImageChooser.java
│ │ ├── ImagePreviewPanel.java
│ │ ├── InsertComponentAction.java
│ │ ├── MoveComponentAction.java
│ │ ├── PanelUtils.java
│ │ ├── PropertiesPanel.java
│ │ ├── RemoveComponentAction.java
│ │ ├── ResourceLoader.java
│ │ ├── RootComponentContainer.java
│ │ ├── SPUIEditor.java
│ │ ├── SPUIPreview.java
│ │ ├── SPUIViewer.java
│ │ ├── SelectionAction.java
│ │ ├── StandardChooser.java
│ │ ├── StyleChooser.java
│ │ ├── StyleSheet.java
│ │ ├── StyleSheetInstance.java
│ │ ├── UVEditor.java
│ │ ├── UVEditorImagePanel.java
│ │ ├── UndoableEditor.java
│ │ ├── WinComponentAction.java
│ │ ├── components
│ │ ├── ActionableComponent.java
│ │ ├── ButtonDrawableRadio.java
│ │ ├── ButtonDrawableStandard.java
│ │ ├── CascadeEffect.java
│ │ ├── CellFormat.java
│ │ ├── ComboBoxDrawable.java
│ │ ├── ComponentFactory.java
│ │ ├── ConsoleWindow.java
│ │ ├── DialogDrawable.java
│ │ ├── ExplicitNavigator.java
│ │ ├── FadeEffect.java
│ │ ├── FrameDrawable.java
│ │ ├── GlideEffect.java
│ │ ├── HitMask.java
│ │ ├── Image.java
│ │ ├── ImageCursorProvider.java
│ │ ├── ImageDrawable.java
│ │ ├── InflateEffect.java
│ │ ├── ModulateEffect.java
│ │ ├── OutlineFormat.java
│ │ ├── PerspectiveEffect.java
│ │ ├── PropertyObject.java
│ │ ├── ProportionalLayout.java
│ │ ├── RelativeNavigator.java
│ │ ├── RotateEffect.java
│ │ ├── SPUIComponent.java
│ │ ├── SPUIDefaultComponent.java
│ │ ├── SPUIDrawable.java
│ │ ├── SPUIWinProc.java
│ │ ├── ScrollbarDrawable.java
│ │ ├── SimpleLayout.java
│ │ ├── SliderDrawable.java
│ │ ├── SpinnerDrawable.java
│ │ ├── StdDrawable.java
│ │ ├── TreeExpanderDrawable.java
│ │ ├── TreeNode.java
│ │ ├── UIEffect.java
│ │ ├── WatchGraph.java
│ │ ├── WatchWindow.java
│ │ ├── WinButton.java
│ │ ├── WinComboBox.java
│ │ ├── WinComponent.java
│ │ ├── WinDialog.java
│ │ ├── WinGrid.java
│ │ ├── WinMessageBox.java
│ │ ├── WinScrollbar.java
│ │ ├── WinSlider.java
│ │ ├── WinSpinner.java
│ │ ├── WinText.java
│ │ ├── WinTextEdit.java
│ │ ├── WinTreeView.java
│ │ ├── WinXHTML.java
│ │ ├── Window.java
│ │ ├── cSPUIAnimatedIconWin.java
│ │ ├── cSPUIBehaviorActionWinInterpolator.java
│ │ ├── cSPUIBehaviorActionWinState.java
│ │ ├── cSPUIBehaviorEventBase.java
│ │ ├── cSPUIBehaviorPredicateWinState.java
│ │ ├── cSPUIBehaviorTimeFunction.java
│ │ ├── cSPUIBehaviorTimeFunctionDampedPeriodic.java
│ │ ├── cSPUIBehaviorTimeFunctionRamp.java
│ │ ├── cSPUIBehaviorTimeFunctionSmoothRamp.java
│ │ ├── cSPUIBehaviorWinBoolStateEvent.java
│ │ ├── cSPUIBehaviorWinEventBase.java
│ │ ├── cSPUIBehaviorWinInterpolatorScale.java
│ │ ├── cSPUIBehaviorWinInterpolatorShadeColor.java
│ │ ├── cSPUIFrameSequencer.java
│ │ ├── cSPUILaunchScreenWinProc.java
│ │ ├── cSPUILayerIdWinProc.java
│ │ ├── cSPUILayoutZoom.java
│ │ ├── cSPUIMaterialEffect.java
│ │ ├── cSPUIMaterialWinProc.java
│ │ ├── cSPUIPopupMenuItemWin.java
│ │ ├── cSPUIPopupMenuWin.java
│ │ ├── cSPUIProgressBarGradientWin.java
│ │ ├── cSPUIProgressBarWin.java
│ │ ├── cSPUIRotateEffect.java
│ │ ├── cSPUIStdDrawable.java
│ │ ├── cSPUIStdDrawableImageInfo.java
│ │ ├── cSPUISwarmEffect.java
│ │ ├── cSPUITextWin.java
│ │ ├── cSPUITooltipWinProc.java
│ │ └── cSPUIVariableWidthDrawable.java
│ │ ├── resources
│ │ ├── SporeUIDesignerProjectCommon.xml
│ │ ├── SporeUIDesignerProjectCustom.xml
│ │ ├── arialunicodeea.ttf
│ │ ├── layout_bottom.png
│ │ ├── layout_horizontal_fill.png
│ │ ├── layout_left.png
│ │ ├── layout_right.png
│ │ ├── layout_top.png
│ │ ├── layout_vertical_fill.png
│ │ ├── maxispassword.ttf
│ │ ├── palatinosanseabold.ttf
│ │ ├── sporecurrencyea.ttf
│ │ ├── sporeuitextstyles.css
│ │ └── trebucheteabold.ttf
│ │ └── uidesigner
│ │ ├── DesignerCategory.java
│ │ ├── DesignerClass.java
│ │ ├── DesignerElement.java
│ │ ├── DesignerEnum.java
│ │ ├── DesignerNode.java
│ │ ├── DesignerProperty.java
│ │ └── UIDesigner.java
│ ├── files
│ ├── ActionCommand.java
│ ├── BufferedOutputAccessor.java
│ ├── ByteArrayStreamAccessor.java
│ ├── FileStreamAccessor.java
│ ├── FileStructureException.java
│ ├── InputStreamAccessor.java
│ ├── MemoryOutputStream.java
│ ├── OutputStreamAccessor.java
│ ├── ReadWriteStreamAccessor.java
│ ├── StreamAccessor.java
│ ├── formats
│ │ ├── BitMapImages.java
│ │ ├── ConvertAction.java
│ │ ├── FastConvertAction.java
│ │ ├── FileFormatStructure.java
│ │ ├── FileStructure.java
│ │ ├── FileStructureError.java
│ │ ├── LocaleFile.java
│ │ ├── LocalizedText.java
│ │ ├── ResourceKey.java
│ │ ├── anim
│ │ │ ├── Animation.java
│ │ │ └── DataReader.java
│ │ ├── argscript
│ │ │ ├── ArgScript.java
│ │ │ ├── ArgScriptArgumentable.java
│ │ │ ├── ArgScriptBlock.java
│ │ │ ├── ArgScriptCommand.java
│ │ │ ├── ArgScriptEnum.java
│ │ │ ├── ArgScriptException.java
│ │ │ ├── ArgScriptOption.java
│ │ │ └── ArgScriptOptionable.java
│ │ ├── bem
│ │ │ ├── BEMBlock.java
│ │ │ ├── BEMInfo.java
│ │ │ └── BEMMain.java
│ │ ├── dbpf
│ │ │ ├── DBPFHeader.java
│ │ │ ├── DBPFIndex.java
│ │ │ ├── DBPFItem.java
│ │ │ ├── DBPFMain.java
│ │ │ ├── DBPFPacker.java
│ │ │ ├── DBPFPackingTask.java
│ │ │ ├── DBPFPackingTaskOptimized.java
│ │ │ ├── DBPFPackingTaskOptimizedOld.java
│ │ │ ├── DBPFUnpacker.java
│ │ │ ├── DBPFUnpackingTask.java
│ │ │ ├── DebugInformation.java
│ │ │ ├── PackWindow.java
│ │ │ ├── PerformanceTest.java
│ │ │ ├── PerformanceViewer.java
│ │ │ ├── RefPackCompression.java
│ │ │ └── UnpackWindow.java
│ │ ├── dds
│ │ │ ├── DDSHeader.java
│ │ │ ├── DDSHeaderDX10.java
│ │ │ ├── DDSHeaderReader.java
│ │ │ ├── DDSImageReader.java
│ │ │ ├── DDSImageReaderSpi.java
│ │ │ ├── DDSLineReader.java
│ │ │ ├── DDSPixelFormat.java
│ │ │ ├── DDSTexture.java
│ │ │ ├── DDSUtil.java
│ │ │ └── Viewer.java
│ │ ├── effects
│ │ │ ├── BrushEffect.java
│ │ │ ├── CameraEffect.java
│ │ │ ├── CloudEffect.java
│ │ │ ├── DecalEffect.java
│ │ │ ├── DistributeEffect.java
│ │ │ ├── Effect.java
│ │ │ ├── EffectColor.java
│ │ │ ├── EffectComponent.java
│ │ │ ├── EffectMain.java
│ │ │ ├── EffectPacker.java
│ │ │ ├── EffectParser.java
│ │ │ ├── EffectUnpacker.java
│ │ │ ├── FastParticleEffect.java
│ │ │ ├── GameEffect.java
│ │ │ ├── GameModelAnim.java
│ │ │ ├── GameModelEffect.java
│ │ │ ├── GroundCoverEffect.java
│ │ │ ├── ImportedEffect.java
│ │ │ ├── LightEffect.java
│ │ │ ├── MapResource.java
│ │ │ ├── MaterialResource.java
│ │ │ ├── MetaparticleEffect.java
│ │ │ ├── MixEventEffect.java
│ │ │ ├── ModelAnim.java
│ │ │ ├── ModelEffect.java
│ │ │ ├── ParticleAttractor.java
│ │ │ ├── ParticleEffect.java
│ │ │ ├── ParticlePathPoint.java
│ │ │ ├── ParticleRandomWalk.java
│ │ │ ├── ParticleWiggle.java
│ │ │ ├── Resource.java
│ │ │ ├── ResourceID.java
│ │ │ ├── RibbonEffect.java
│ │ │ ├── ScreenEffect.java
│ │ │ ├── ScreenFilter.java
│ │ │ ├── SequenceEffect.java
│ │ │ ├── ShakeEffect.java
│ │ │ ├── SkinpaintDistributeEffect.java
│ │ │ ├── SkinpaintFloodEffect.java
│ │ │ ├── SkinpaintParticleEffect.java
│ │ │ ├── SkinpaintSettingsEffect.java
│ │ │ ├── SoundEffect.java
│ │ │ ├── SplitControllerEffect.java
│ │ │ ├── SplitModelKernelResource.java
│ │ │ ├── Surface.java
│ │ │ ├── TerrainDistributeEffect.java
│ │ │ ├── TerrainDistributeLevel.java
│ │ │ ├── TerrainScriptEffect.java
│ │ │ ├── TextEffect.java
│ │ │ ├── TextureSlot.java
│ │ │ ├── VisualEffect.java
│ │ │ ├── VisualEffectBlock.java
│ │ │ └── VolumeEffect.java
│ │ ├── gait
│ │ │ ├── GAITGroupKey.java
│ │ │ ├── GAITMain.java
│ │ │ ├── GAITStepLengthKey.java
│ │ │ ├── GaitToTxt.java
│ │ │ └── TxtToGait.java
│ │ ├── lvl
│ │ │ ├── CreatureArchetype.java
│ │ │ ├── GameplayMarker.java
│ │ │ ├── GameplayMarkerHolder.java
│ │ │ ├── InteractiveOrnament.java
│ │ │ └── MigrationPoint.java
│ │ ├── pctp
│ │ │ ├── PCTPAggregate.java
│ │ │ ├── PCTPCapability.java
│ │ │ ├── PCTPDeformSpec.java
│ │ │ ├── PCTPMain.java
│ │ │ ├── PCTPRemap.java
│ │ │ ├── PctpToTxt.java
│ │ │ └── TxtToPctp.java
│ │ ├── pdr
│ │ │ ├── PDRMain.java
│ │ │ └── PDRObject.java
│ │ ├── pmet
│ │ │ └── PMETInstance.java
│ │ ├── prop
│ │ │ ├── ArrayProperty.java
│ │ │ ├── FastPropConverter.java
│ │ │ ├── PROPMain.java
│ │ │ ├── PackageSignature.java
│ │ │ ├── PropToXml.java
│ │ │ ├── Property.java
│ │ │ ├── PropertyBBox.java
│ │ │ ├── PropertyBool.java
│ │ │ ├── PropertyChar.java
│ │ │ ├── PropertyColorRGB.java
│ │ │ ├── PropertyColorRGBA.java
│ │ │ ├── PropertyDouble.java
│ │ │ ├── PropertyFloat.java
│ │ │ ├── PropertyInt16.java
│ │ │ ├── PropertyInt32.java
│ │ │ ├── PropertyInt64.java
│ │ │ ├── PropertyInt8.java
│ │ │ ├── PropertyKey.java
│ │ │ ├── PropertyString16.java
│ │ │ ├── PropertyString8.java
│ │ │ ├── PropertyText.java
│ │ │ ├── PropertyTransform.java
│ │ │ ├── PropertyUint16.java
│ │ │ ├── PropertyUint32.java
│ │ │ ├── PropertyUint64.java
│ │ │ ├── PropertyUint8.java
│ │ │ ├── PropertyVector2.java
│ │ │ ├── PropertyVector3.java
│ │ │ ├── PropertyVector4.java
│ │ │ ├── PropertyWChar.java
│ │ │ ├── SpecialCharacters.java
│ │ │ └── XmlToProp.java
│ │ ├── rast
│ │ │ ├── DDStoRast.java
│ │ │ ├── RASTMain.java
│ │ │ └── RastToDDS.java
│ │ ├── renderWare4
│ │ │ ├── D3DStateTypes.java
│ │ │ ├── DDSToRw4.java
│ │ │ ├── RW4Anim.java
│ │ │ ├── RW4Animations.java
│ │ │ ├── RW4BBox.java
│ │ │ ├── RW4BlendShapeConfig.java
│ │ │ ├── RW4Buffer.java
│ │ │ ├── RW4Header.java
│ │ │ ├── RW4HierarchyInfo.java
│ │ │ ├── RW4Main.java
│ │ │ ├── RW4Material.java
│ │ │ ├── RW4Matrices4x3.java
│ │ │ ├── RW4Matrices4x4.java
│ │ │ ├── RW4Mesh.java
│ │ │ ├── RW4MeshMatAssignment.java
│ │ │ ├── RW4ModelHandle.java
│ │ │ ├── RW4Section.java
│ │ │ ├── RW4SimpleMesh.java
│ │ │ ├── RW4Skeleton.java
│ │ │ ├── RW4TexMetadata.java
│ │ │ ├── RW4Texture.java
│ │ │ ├── RW4TriangleArray.java
│ │ │ ├── RW4VertexArray.java
│ │ │ ├── RW4VertexFormat.java
│ │ │ └── Rw4ToDDS.java
│ │ ├── shaders
│ │ │ ├── CompiledShader.java
│ │ │ ├── CompiledShaders.java
│ │ │ ├── DebugShader.java
│ │ │ ├── MaterialAssignments.java
│ │ │ ├── ShaderConstant.java
│ │ │ ├── ShaderEntry.java
│ │ │ ├── ShaderManager.java
│ │ │ ├── SourceManager.java
│ │ │ ├── UncompiledShader.java
│ │ │ ├── UncompiledShaders.java
│ │ │ ├── UncompiledShadersConverter.java
│ │ │ └── material
│ │ │ │ ├── SporeMaterial.java
│ │ │ │ └── TextureSlot.java
│ │ ├── snr
│ │ │ └── SNRMain.java
│ │ ├── spui
│ │ │ ├── InvalidBlockException.java
│ │ │ ├── SPUIBlock.java
│ │ │ ├── SPUIBuilder.java
│ │ │ ├── SPUIChannel.java
│ │ │ ├── SPUIComplexSections.java
│ │ │ ├── SPUIFileResource.java
│ │ │ ├── SPUIHitMaskResource.java
│ │ │ ├── SPUIMain.java
│ │ │ ├── SPUINumberSections.java
│ │ │ ├── SPUIObject.java
│ │ │ ├── SPUIParser.java
│ │ │ ├── SPUIResource.java
│ │ │ ├── SPUIResourceList.java
│ │ │ ├── SPUISection.java
│ │ │ ├── SPUISectionContainer.java
│ │ │ ├── SPUIStructResource.java
│ │ │ ├── SPUIVectorSections.java
│ │ │ ├── SpuiToTxt.java
│ │ │ └── TxtToSpui.java
│ │ └── tlsa
│ │ │ ├── TLSAAnimationGroup.java
│ │ │ ├── TLSAAnimationGroupV10.java
│ │ │ ├── TLSAAnimationGroupV7.java
│ │ │ ├── TLSAAnimationV10.java
│ │ │ ├── TLSAAnimationV7.java
│ │ │ ├── TLSAMain.java
│ │ │ ├── TlsaToTxt.java
│ │ │ └── TxtToTlsa.java
│ └── resources
│ │ ├── BoosterPack2.prop
│ │ └── ExpansionPack1.prop
│ ├── userinterface
│ ├── CollapsiblePanel.java
│ ├── ConsoleDialog.java
│ ├── ErrorManager.java
│ ├── FileUtils.java
│ ├── HashNames.java
│ ├── HintTextField.java
│ ├── JGradientButton.java
│ ├── JLabelLink.java
│ ├── NumberConversor.java
│ ├── ProjectTreeCellRenderer.java
│ ├── TreeTransferHandler.java
│ ├── UIButtonsBar.java
│ ├── UIConvertMenu.java
│ ├── UIDisplayPanel.java
│ ├── UIEditMenu.java
│ ├── UIErrorReport.java
│ ├── UIFileMenu.java
│ ├── UIList.java
│ ├── UIMainApp.java
│ ├── UIManagerDefaults.java
│ ├── UIMaterialManager.java
│ ├── UIProjectMenu.java
│ ├── UIProjectPanel.java
│ ├── UIShaderManager.java
│ ├── UITexturePatcher.java
│ ├── UIToolBar.java
│ ├── UIUtilitiesPanel.java
│ ├── contextmenu
│ │ ├── UIFileContextMenu.java
│ │ └── UITreePopClickListener.java
│ ├── dialogs
│ │ ├── AdvancedFileChooser.java
│ │ ├── DropTargetTextField.java
│ │ ├── UIChooseProjectPath.java
│ │ ├── UIChooseResource.java
│ │ ├── UIConvertDialog.java
│ │ ├── UIDialogEffects.java
│ │ ├── UIDialogGait.java
│ │ ├── UIDialogPack.java
│ │ ├── UIDialogPctp.java
│ │ ├── UIDialogProp.java
│ │ ├── UIDialogRast.java
│ │ ├── UIDialogRw4.java
│ │ ├── UIDialogSporeModderFX.java
│ │ ├── UIDialogSpui.java
│ │ ├── UIDialogTlsa.java
│ │ ├── UIDialogUncompiledShaders.java
│ │ ├── UIDialogUnpack.java
│ │ ├── UIErrorsDialog.java
│ │ ├── UIFindAndReplace.java
│ │ ├── UIOpenProject.java
│ │ ├── UIProgramSettings.java
│ │ └── UISourcePreset.java
│ ├── fileview
│ │ ├── FileView.java
│ │ ├── ImageFileView.java
│ │ ├── ImageOptionsPanel.java
│ │ ├── TextFileView.java
│ │ └── UIImagePanel.java
│ ├── images
│ │ ├── DebugPack_32x32.png
│ │ ├── DebugPack_32x32.psd
│ │ ├── Execute_64.png
│ │ ├── Icon_SPUI.png
│ │ ├── Icon_SPUI_24.png
│ │ ├── Icon_XML.png
│ │ ├── Icon_XML_24.png
│ │ ├── Pack.png
│ │ ├── PackAndRun.png
│ │ ├── PackAndRun_48x32.png
│ │ ├── Pack_32x32.png
│ │ ├── RunWOPack.png
│ │ ├── RunWOPack_32x32.png
│ │ ├── SporeModderIcon.png
│ │ ├── Unpack.png
│ │ ├── Unpack_32x32.png
│ │ ├── UtilitiesPanel_Disabled.png
│ │ ├── UtilitiesPanel_Enabled.png
│ │ ├── config_20.png
│ │ ├── config_24.png
│ │ ├── execute_24.png
│ │ ├── maximize.png
│ │ ├── maximize_24.png
│ │ ├── minimize.png
│ │ ├── minimize_24.png
│ │ ├── save_24.png
│ │ └── save_64.png
│ ├── settings
│ │ └── project
│ │ │ ├── SettingsCategory.java
│ │ │ ├── UIDebugSettings.java
│ │ │ ├── UIGeneralSettings.java
│ │ │ ├── UIPackingSettings.java
│ │ │ └── UIProjectSettings.java
│ └── syntaxpane
│ │ ├── HighlightedView.java
│ │ ├── HlslView.java
│ │ ├── MtlView.java
│ │ ├── NumberedParagraphView.java
│ │ ├── PfxView.java
│ │ ├── SearchedTextView.java
│ │ ├── SpuiView.java
│ │ ├── TextLineNumber.java
│ │ ├── TlsaView.java
│ │ ├── TxtView.java
│ │ └── XmlView.java
│ └── utilities
│ ├── FilteredListModel.java
│ ├── FilteredTree.java
│ ├── FilteredTreeModel.java
│ ├── Hasher.java
│ ├── InputOutputPaths.java
│ ├── Matrix.java
│ ├── ModAPIDebugging.java
│ ├── Project.java
│ ├── ProjectTreeModel.java
│ ├── ProjectTreeNode.java
│ ├── SearchSpec.java
│ ├── SearchSpeedTest.java
│ ├── ShellContextMenu.java
│ ├── SporeGame.java
│ ├── Timer.java
│ ├── UnpackSpeedTest.java
│ ├── WinRegistry.java
│ ├── names
│ ├── Condition.java
│ ├── ConditionedNameRegistry.java
│ ├── NameHashPair.java
│ ├── NameRegistry.java
│ └── SimpleNameRegistry.java
│ └── performance
│ ├── Profiler.java
│ ├── ProfilerBars.java
│ ├── ProfilerData.java
│ └── ProfilerGraph.java
├── xfiledialog.dll
├── xfiledialog.jar
└── xfiledialog64.dll
/.gitattributes:
--------------------------------------------------------------------------------
1 | # Auto detect text files and perform LF normalization
2 | * text=auto
3 |
4 | # Custom for Visual Studio
5 | *.cs diff=csharp
6 |
7 | # Standard to msysgit
8 | *.doc diff=astextplain
9 | *.DOC diff=astextplain
10 | *.docx diff=astextplain
11 | *.DOCX diff=astextplain
12 | *.dot diff=astextplain
13 | *.DOT diff=astextplain
14 | *.pdf diff=astextplain
15 | *.PDF diff=astextplain
16 | *.rtf diff=astextplain
17 | *.RTF diff=astextplain
18 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | # Windows image file caches
2 | Thumbs.db
3 | ehthumbs.db
4 |
5 | # Folder config file
6 | Desktop.ini
7 |
8 | # Recycle Bin used on file shares
9 | $RECYCLE.BIN/
10 |
11 | # Windows Installer files
12 | *.cab
13 | *.msi
14 | *.msm
15 | *.msp
16 |
17 | # Windows shortcuts
18 | *.lnk
19 |
20 | # =========================
21 | # Operating System Files
22 | # =========================
23 |
24 | # OSX
25 | # =========================
26 |
27 | .DS_Store
28 | .AppleDouble
29 | .LSOverride
30 |
31 | # Thumbnails
32 | ._*
33 |
34 | # Files that might appear in the root of a volume
35 | .DocumentRevisions-V100
36 | .fseventsd
37 | .Spotlight-V100
38 | .TemporaryItems
39 | .Trashes
40 | .VolumeIcon.icns
41 |
42 | # Directories potentially created on remote AFP share
43 | .AppleDB
44 | .AppleDesktop
45 | Network Trash Folder
46 | Temporary Items
47 | .apdisk
48 | /bin/
49 |
50 | *.classpath
51 | *.properties
--------------------------------------------------------------------------------
/.project:
--------------------------------------------------------------------------------
1 |
2 |
3 | SporeModder
4 |
5 |
6 |
7 |
8 |
9 | org.eclipse.jdt.core.javabuilder
10 |
11 |
12 |
13 |
14 |
15 | org.eclipse.jdt.core.javanature
16 |
17 |
18 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # SporeModder
2 |
3 | ## FEATURES
4 |
5 | ### SPUI Editor
6 | This new SPUI editor allows you to create or edit user interfaces. This is an example of what you can do with it:
7 |
8 | 
9 | This is from the mod [Sims4Spore, by Darhagonable](http://davoonline.com/phpBB3/viewtopic.php?f=126&p=29316&sid=c12cdd18dc0b21b0b0b2b9cb952dc845#p28383).
10 |
11 | 
12 | This is from the mod [DarkInjection 9.r, by Rob55Rod](http://www.davoonline.com/sporemodder/rob55rod/DI_9r/DI9r.html).
13 |
14 | ### EFFECTS
15 | 
16 | 
17 |
18 | ### Other features
19 |
20 | - It has automatic updates, so you can always have the latest update without having to worry about anything.
21 | - A fast workflow. Convert the files, pack the mod and run the game in just one click.
22 | - Texture viewer, including most of the ones SporeMaster couldn't convert. Supports viewing .rw4, .dds and .raster textures.
23 | - Can convert .tlsa, .pctp, .raster, .spui files.
24 | - Some bugfixes SporeMaster needed. For example, now 'string8s' and 'transform' properties work correctly.
25 |
26 | To download the program, you just have to go to https://github.com/Emd4600/SporeModder/releases/latest and download the file "SporeModder.BETA.1.0.0.zip".
27 |
28 | To open the program execute the file SporeModder Launcher.exe. This one will check for updates and download them as necessary. Your antivirus/firewall might complain about SporeModder trying to connect to the internet; it's just connecting to GitHub to check for updates, so there's no danger.
29 |
30 | SporeModder is still in a beta stage, and it can contain bugs and errors; please, if you have any suggestion or bug report, comment and report it here or in GitHub.
31 |
32 | The program is still a bit slower searching files, so it's recommended to use SporeMaster for that instead.
33 |
34 | Here you have some example projects (just put them in the Projects folder) so you can see how to use SporeModder: http://www.mediafire.com/file/1wyhirfppstxdeh/SporeModder_Example_Projects.rar
35 |
--------------------------------------------------------------------------------
/WinMerge/IgnoreSectionMarkers.ini:
--------------------------------------------------------------------------------
1 | [set0]
2 | StartMarker=/*
3 | EndMarker=*/
4 | InlineMarker=//
5 | FileType0=java
6 | FileType1=cs
7 | FileType2=cpp
8 | FileType3=c
9 | FileType4=h
10 | FileType5=cxx
11 | FileType6=cc
12 | FileType7=js
13 | FileType8=jsl
14 | FileType9=tli
15 | FileType10=tlh
16 | FileType11=rc
17 |
--------------------------------------------------------------------------------
/WinMerge/MergeLang.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/emd4600/SporeModder/142fdcf1c2472b1ceacc2168eb76446840723208/WinMerge/MergeLang.dll
--------------------------------------------------------------------------------
/WinMerge/WinMergeU.exe:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/emd4600/SporeModder/142fdcf1c2472b1ceacc2168eb76446840723208/WinMerge/WinMergeU.exe
--------------------------------------------------------------------------------
/WinMerge/libexpat.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/emd4600/SporeModder/142fdcf1c2472b1ceacc2168eb76446840723208/WinMerge/libexpat.dll
--------------------------------------------------------------------------------
/WinMerge/mfc71u.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/emd4600/SporeModder/142fdcf1c2472b1ceacc2168eb76446840723208/WinMerge/mfc71u.dll
--------------------------------------------------------------------------------
/WinMerge/msvcp71.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/emd4600/SporeModder/142fdcf1c2472b1ceacc2168eb76446840723208/WinMerge/msvcp71.dll
--------------------------------------------------------------------------------
/WinMerge/msvcr71.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/emd4600/SporeModder/142fdcf1c2472b1ceacc2168eb76446840723208/WinMerge/msvcr71.dll
--------------------------------------------------------------------------------
/WinMerge/pcre.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/emd4600/SporeModder/142fdcf1c2472b1ceacc2168eb76446840723208/WinMerge/pcre.dll
--------------------------------------------------------------------------------
/reg_type.txt:
--------------------------------------------------------------------------------
1 | prop 0x00B1B104
2 | soundProp 0x02B9F662
3 | gmdl 0x00E6BCE5
4 | plt 0x011989B7
5 | creature_traits 0x01AD2416
6 | building_traits 0x01AD2417
7 | vehicle_traits 0x01AD2418
8 | gmsh 0x01C135DA
9 | trait_pill 0x01C3C4B3
10 | css 0x0248F226
11 | trigger 0x024A0E52
12 | formation 0x02523258
13 | ttf 0x027C5CEF
14 | summary 0x02D5C9AF
15 | summary_pill 0x02D5C9B0
16 | locale 0x02FAC0B6
17 | pollen_metadata 0x030BDEE3
18 | hm 0x0376C3DA
19 | htra 0x0472329B
20 | xhtml 0x065266B7
21 | raster 0x2F4E681C
22 | jpeg 0x2F7D0002
23 | png 0x2F7D0004
24 | bmp 0x2F7D0005
25 | tga 0x2F7D0006
26 | gif 0x2F7D0007
27 | tlsa 0x4AEB6BC6
28 | pctp 0x7C19AA7A
29 | xml 0xCF6C21B8
30 | layout 0xEFBDA3FF
31 | dat 0x12952634
32 | bem 0x1A99B06B
33 | bat 0x1E99B626
34 | xls 0x1F639D98
35 | bld 0x2399BE55
36 | vcl 0x24682294
37 | spui 0x250FE9A2
38 | gait 0x25DF0112
39 | txt 0x2B6CAB5F
40 | crt 0x2B978C46
41 | vp6 0x376840D7
42 | cfg 0x37979F71
43 | psd 0x3C77532E
44 | mcl 0x3C7E0F63
45 | cll 0x3D97A8E4
46 | ani 0x3F9C28B5
47 | flr 0x438F6347
48 | hkx 0x448AE7E2
49 | ufo 0x476A98C7
50 | pfx 0x497767B9
51 | density 0x5C74D18B
52 | py 0x617715C4
53 | pd 0x617715D9
54 | world 0x9B8E862F
55 | cell 0xDFAD9F51
56 | animation 0xEE17C6AD
57 | cnv 0x055ADA24
58 | rw4 0x2F4E681B
59 | physx_bin 0x76e1259d
60 | physx_xml 0x7eab18fd
61 | cfx 0x278CF8F2
62 | dds 0x17952E6C
63 | snr 0x01a527db
64 | sns 0x01eef63a
65 | cpp 0x0469A3F7
66 | eapd 0x022D2C83
67 | package 0x06EFC6AA
68 | instrument 0x03055F61
69 | mode 0x0497925E
70 | children 0x03f51892
71 | pdr 0x022d2c83
72 | sek 0x042c9cbb
73 | submix 0x02c9eff2
74 | voice 0x029e333b
75 | lvl 0x047B8300
76 | structure 0x4B9EF6DC
77 | populate 0xDA141C1B
78 | advect 0x04805684
79 | loottable 0xD92AF091
80 | backgroundmap 0x612B3191
81 | random_creature 0xF9C3D770
82 | look_table 0x8C042499
83 | effectmap 0x433FB70C
84 | globals 0x2A3CE5B7
85 | creaturedata 0x0F43029A
86 | geo 0x76A8F7D8
87 | cur 0x02393756
88 | effdir 0xEA5118B0
89 | html 0xDD6233D6
90 | xml 0x1E639C34
91 | animstate 0x00339479
92 | bmdl 0x72047DE2
93 | lua 0x3681D755
94 | html 0xDD6233D6
95 | xml 0x1E639C34
96 | lua 0x3681D755
97 | animstate 0x00339479
98 | bitImage 0x03E421E9
99 | 8bitImage 0x03E421EC
100 | 32bitImage 0x03E421ED
101 | bmdl 0x72047DE2
102 | blockdata
103 | db
104 | blend
105 | snd 0x042C9CBB
106 | XA
107 | rdx
108 | rdx9
109 | pcaw 0x02cb4f2f
--------------------------------------------------------------------------------
/src/net/tomahawk/ExtensionsFilter.java:
--------------------------------------------------------------------------------
1 | package net.tomahawk;
2 |
3 | import java.util.*;
4 | import java.io.*;
5 |
6 |
7 | public class ExtensionsFilter extends javax.swing.filechooser.FileFilter
8 | {
9 | static final char SPACE = ' ';
10 | static final char ASTERISK = '*';
11 | static final char SEMICOLON = ';';
12 | static final char VBAR = '|';
13 | static final char OPEN_PAR = '(';
14 | static final char CLOSE_PAR = ')';
15 | static final String POINT = ".";
16 | java.util.List extensions;
17 | String shortDescription;
18 | String description;
19 |
20 |
21 | // constructor 1 (from a List)
22 | public ExtensionsFilter(String shortDescription, List extensions)
23 | {
24 | this.extensions = extensions;
25 | this.shortDescription = shortDescription;
26 | description = shortDescription;
27 |
28 | // description = shortDescription +SPACE+OPEN_PAR;
29 | // for (String ext : extensions)
30 | // {
31 | // this.description += ASTERISK + POINT + ext + SEMICOLON;
32 | // }
33 | // description=description.substring(0,description.length()-1);
34 | // description+=CLOSE_PAR;
35 | }
36 |
37 | // key: the accept method
38 | public boolean accept(File f)
39 | {
40 | if (f.isDirectory()) return true;
41 | if (extensions == null) return true;
42 | if (extensions.isEmpty()) return true;
43 | String filename = f.getName().toLowerCase();
44 | if (filename == null) return false;
45 | for (int i = 0; i < extensions.size(); i++) {
46 | String ext = extensions.get(i);
47 | if (filename.endsWith(POINT + ext)) return true;
48 | }
49 | return false;
50 | }
51 |
52 | // description
53 | public String getDescription() {
54 | return description;
55 | }
56 |
57 |
58 | // get the filter string for native filedialog
59 | //desc0|*.ext00;...;*.ext0n|desc1|*.ext10;...;*.ext1n...
60 | public static String getNativeString(ExtensionsFilter... filters)
61 | {
62 | String filterString = "";
63 | for (ExtensionsFilter extensionsFilter : filters)
64 | {
65 | filterString += extensionsFilter.description + VBAR;
66 |
67 | java.util.List exts = extensionsFilter.extensions;
68 | int count = exts.size();
69 | for (int j = 0; j < count - 1; j++)
70 | {
71 | filterString += ASTERISK + POINT + exts.get(j) + SEMICOLON;
72 | }
73 | filterString += ASTERISK + POINT + exts.get(count - 1);
74 | filterString += VBAR;
75 | }
76 | System.out.println("Native filter string: " + filterString);
77 | return filterString;
78 | }
79 |
80 | }
81 |
82 |
--------------------------------------------------------------------------------
/src/sporemodder/extras/spuieditor/CommandAction.java:
--------------------------------------------------------------------------------
1 | package sporemodder.extras.spuieditor;
2 |
3 | public interface CommandAction {
4 |
5 | public void undo();
6 | public void redo();
7 |
8 | /**
9 | * Must return true if the action was significant (and therefore, has to be saved). Return false if this doesn't modify the SPUI at all.
10 | * @return
11 | */
12 | public boolean isSignificant();
13 | }
14 |
--------------------------------------------------------------------------------
/src/sporemodder/extras/spuieditor/ComponentContainer.java:
--------------------------------------------------------------------------------
1 | package sporemodder.extras.spuieditor;
2 |
3 | import sporemodder.extras.spuieditor.components.SPUIComponent;
4 |
5 | public interface ComponentContainer {
6 |
7 | public boolean isSPUIComponent();
8 |
9 | public void insertComponent(SPUIComponent component, int index);
10 | public void removeComponent(SPUIComponent component);
11 |
12 | public boolean nodeIsMovable();
13 | public boolean nodeAcceptsComponent(SPUIComponent other);
14 | public boolean nodeCanBeMovedAbove();
15 | public boolean nodeCanBeMovedBelow();
16 |
17 | }
18 |
--------------------------------------------------------------------------------
/src/sporemodder/extras/spuieditor/ComponentValueAction.java:
--------------------------------------------------------------------------------
1 | package sporemodder.extras.spuieditor;
2 |
3 | public class ComponentValueAction implements CommandAction {
4 |
5 | public interface ComponentValueListener {
6 | public void valueChanged(T value);
7 | }
8 |
9 | private T originalValue;
10 | private T value;
11 | private ComponentValueListener valueListener;
12 |
13 | public ComponentValueAction(T originalValue, T value, ComponentValueListener valueListener) {
14 | assert(valueListener != null);
15 | this.originalValue = originalValue;
16 | this.value = value;
17 | this.valueListener = valueListener;
18 | }
19 |
20 | @Override
21 | public void undo() {
22 | valueListener.valueChanged(originalValue);
23 | }
24 |
25 | @Override
26 | public void redo() {
27 | valueListener.valueChanged(value);
28 | }
29 |
30 | @Override
31 | public boolean isSignificant() {
32 | return true;
33 | }
34 | }
35 |
--------------------------------------------------------------------------------
/src/sporemodder/extras/spuieditor/ImagePreviewPanel.java:
--------------------------------------------------------------------------------
1 | package sporemodder.extras.spuieditor;
2 |
3 | import java.awt.Dimension;
4 | import java.awt.Graphics;
5 | import java.awt.Graphics2D;
6 |
7 | import javax.swing.JPanel;
8 |
9 | import sporemodder.extras.spuieditor.components.Image;
10 |
11 | public class ImagePreviewPanel extends JPanel {
12 |
13 | private Image image;
14 | private float zoomLevel = 1.0f;
15 |
16 | public ImagePreviewPanel(Image image) {
17 | this.image = image;
18 | }
19 |
20 | @Override
21 | public Dimension getPreferredSize() {
22 | if (image == null || image.getResource() == null || image.getBufferedImage() == null) {
23 | return super.getPreferredSize();
24 | }
25 | Dimension dim = image.getDimensions();
26 |
27 | return new Dimension(Math.round(dim.width * zoomLevel), Math.round(dim.height * zoomLevel));
28 | }
29 |
30 | public void setZoomLevel(float zoomLevel) {
31 | this.zoomLevel = zoomLevel;
32 |
33 | revalidate(); // update parent scrollPane
34 | repaint();
35 | }
36 |
37 | public float getZoomLevel() {
38 | return zoomLevel;
39 | }
40 |
41 | public void setImage(Image image) {
42 | this.image = image;
43 | repaint();
44 | }
45 |
46 | @Override
47 | public void paintComponent(Graphics g) {
48 | super.paintComponent(g);
49 |
50 | if (!Image.isValid(image)) {
51 | return;
52 | }
53 |
54 | Dimension dimensions = image.getDimensions();
55 | float[] uvCoords = image.getUVCoords();
56 |
57 | Dimension panelSize = getSize();
58 | int width = Math.round(dimensions.width * zoomLevel);
59 | int height = Math.round(dimensions.height * zoomLevel);
60 | int posX = (panelSize.width - width) / 2;
61 | int posY = (panelSize.height - height) / 2;
62 |
63 | int imageWidth = image.getBufferedImage().getWidth();
64 | int imageHeight = image.getBufferedImage().getHeight();
65 |
66 | Graphics2D g2 = (Graphics2D)g;
67 | Image.drawImage(g2, image.getBufferedImage(), posX, posY, posX + width, posY + height,
68 | Math.round(uvCoords[0] * imageWidth),
69 | Math.round(uvCoords[1] * imageHeight),
70 | Math.round(uvCoords[2] * imageWidth),
71 | Math.round(uvCoords[3] * imageHeight));
72 |
73 | }
74 | }
75 |
--------------------------------------------------------------------------------
/src/sporemodder/extras/spuieditor/InsertComponentAction.java:
--------------------------------------------------------------------------------
1 | package sporemodder.extras.spuieditor;
2 |
3 | import sporemodder.extras.spuieditor.components.SPUIComponent;
4 |
5 | public class InsertComponentAction implements CommandAction {
6 |
7 | private ComponentContainer parentContainer;
8 | private SPUIComponent component;
9 | private SPUIComponent previousSelectedComponent;
10 | private int index;
11 | private SPUIEditor editor;
12 |
13 | public InsertComponentAction(ComponentContainer parentContainer, SPUIComponent component, SPUIComponent previousSelectedComponent, SPUIEditor editor, int index) {
14 | this.parentContainer = parentContainer;
15 | this.component = component;
16 | this.previousSelectedComponent = previousSelectedComponent;
17 | this.editor = editor;
18 | this.index = index;
19 | }
20 |
21 | @Override
22 | public void undo() {
23 | parentContainer.removeComponent(component);
24 |
25 | editor.fillHierarchyTree();
26 | editor.getSPUIViewer().setActiveComponent(previousSelectedComponent, false);
27 | editor.getSPUIViewer().repaint();
28 | }
29 |
30 | @Override
31 | public void redo() {
32 | parentContainer.insertComponent(component, index);
33 |
34 | editor.fillHierarchyTree();
35 | editor.getSPUIViewer().setActiveComponent(component, false);
36 | editor.getSPUIViewer().repaint();
37 | }
38 |
39 | @Override
40 | public boolean isSignificant() {
41 | return true;
42 | }
43 |
44 | }
45 |
--------------------------------------------------------------------------------
/src/sporemodder/extras/spuieditor/RemoveComponentAction.java:
--------------------------------------------------------------------------------
1 | package sporemodder.extras.spuieditor;
2 |
3 | import java.util.HashMap;
4 | import java.util.List;
5 |
6 | import sporemodder.extras.spuieditor.components.SPUIComponent;
7 |
8 | public class RemoveComponentAction implements CommandAction {
9 |
10 | private final HashMap> componentMap = new HashMap>();
11 | private final SPUIComponent removedComponent;
12 |
13 | public RemoveComponentAction(SPUIComponent removedComponent) {
14 | this.removedComponent = removedComponent;
15 | }
16 |
17 | @Override
18 | public void undo() {
19 | for (SPUIComponent comp : componentMap.keySet()) {
20 | comp.restoreRemovedComponent(this);
21 | }
22 |
23 | removedComponent.getSPUIViewer().getEditor().fillHierarchyTree();
24 | removedComponent.getSPUIViewer().setActiveComponent(removedComponent, false);
25 | removedComponent.getSPUIViewer().repaint();
26 | }
27 |
28 | @Override
29 | public void redo() {
30 | for (SPUIComponent comp : componentMap.keySet()) {
31 | comp.removeComponent(this, false);
32 | }
33 |
34 | removedComponent.getSPUIViewer().getEditor().removeComponentNode(removedComponent);
35 | removedComponent.getSPUIViewer().setActiveComponent(null, false);
36 | removedComponent.getSPUIViewer().repaint();
37 | }
38 |
39 | @Override
40 | public boolean isSignificant() {
41 | return true;
42 | }
43 |
44 | public void putModifiedComponent(SPUIComponent component, List modifiedValues) {
45 | componentMap.put(component, modifiedValues);
46 | }
47 |
48 | public SPUIComponent getRemovedComponent() {
49 | return removedComponent;
50 | }
51 |
52 | public List getModifiedValues(SPUIComponent component) {
53 | return componentMap.get(component);
54 | }
55 | }
56 |
--------------------------------------------------------------------------------
/src/sporemodder/extras/spuieditor/RootComponentContainer.java:
--------------------------------------------------------------------------------
1 | package sporemodder.extras.spuieditor;
2 |
3 | import sporemodder.extras.spuieditor.components.Image;
4 | import sporemodder.extras.spuieditor.components.SPUIComponent;
5 | import sporemodder.extras.spuieditor.components.SPUIDrawable;
6 |
7 | public class RootComponentContainer implements ComponentContainer {
8 | private String name;
9 | private SPUIEditor editor;
10 |
11 | public RootComponentContainer(String name, SPUIEditor editor) {
12 | this.name = name;
13 | this.editor = editor;
14 | }
15 |
16 | @Override
17 | public void insertComponent(SPUIComponent component, int index) {
18 | if (component instanceof SPUIDrawable) {
19 | editor.addDrawableComponent((SPUIDrawable) component);
20 | }
21 | else if (component instanceof Image) {
22 | editor.addImageComponent((Image) component);
23 | }
24 | }
25 |
26 | @Override
27 | public void removeComponent(SPUIComponent component) {
28 | if (component instanceof SPUIDrawable) {
29 | editor.removeDrawableComponent((SPUIDrawable) component);
30 | }
31 | else if (component instanceof Image) {
32 | editor.removeImageComponent((Image) component);
33 | }
34 | }
35 |
36 | @Override
37 | public boolean isSPUIComponent() {
38 | return false;
39 | }
40 |
41 | @Override
42 | public String toString() {
43 | return name;
44 | }
45 |
46 | @Override
47 | public boolean nodeIsMovable() {
48 | return false;
49 | }
50 |
51 | @Override
52 | public boolean nodeAcceptsComponent(SPUIComponent other) {
53 | return false;
54 | }
55 |
56 | @Override
57 | public boolean nodeCanBeMovedAbove() {
58 | return false;
59 | }
60 |
61 | @Override
62 | public boolean nodeCanBeMovedBelow() {
63 | return false;
64 | }
65 | }
66 |
--------------------------------------------------------------------------------
/src/sporemodder/extras/spuieditor/SelectionAction.java:
--------------------------------------------------------------------------------
1 | package sporemodder.extras.spuieditor;
2 |
3 | import sporemodder.extras.spuieditor.components.SPUIComponent;
4 |
5 | public class SelectionAction implements CommandAction {
6 |
7 | private SPUIViewer viewer;
8 | private SPUIComponent previousActiveComponent;
9 | private SPUIComponent activeComponent;
10 |
11 | public SelectionAction(SPUIViewer viewer, SPUIComponent previousActiveComponent, SPUIComponent activeComponent) {
12 | this.viewer = viewer;
13 | this.previousActiveComponent = previousActiveComponent;
14 | this.activeComponent = activeComponent;
15 | }
16 |
17 | @Override
18 | public void undo() {
19 | viewer.setActiveComponent(previousActiveComponent, false);
20 | }
21 |
22 | @Override
23 | public void redo() {
24 | viewer.setActiveComponent(activeComponent, false);
25 | }
26 |
27 | @Override
28 | public boolean isSignificant() {
29 | return false;
30 | }
31 | }
32 |
--------------------------------------------------------------------------------
/src/sporemodder/extras/spuieditor/UndoableEditor.java:
--------------------------------------------------------------------------------
1 | package sporemodder.extras.spuieditor;
2 |
3 | public interface UndoableEditor {
4 |
5 | public void addCommandAction(CommandAction action);
6 | public void undo();
7 | public void redo();
8 | }
9 |
--------------------------------------------------------------------------------
/src/sporemodder/extras/spuieditor/WinComponentAction.java:
--------------------------------------------------------------------------------
1 | package sporemodder.extras.spuieditor;
2 |
3 | import sporemodder.extras.spuieditor.components.WinComponent;
4 |
5 | public class WinComponentAction implements CommandAction {
6 |
7 | private WinComponent component;
8 | private DraggableType type;
9 | private int dx;
10 | private int dy;
11 |
12 |
13 | public WinComponentAction(WinComponent component, DraggableType type, int dx, int dy) {
14 | this.component = component;
15 | this.type = type;
16 | this.dx = dx;
17 | this.dy = dy;
18 | }
19 |
20 | @Override
21 | public void undo() {
22 | if (type != null) {
23 | type.process(component, -dx, -dy);
24 | }
25 | }
26 |
27 | @Override
28 | public void redo() {
29 | if (type != null) {
30 | type.process(component, dx, dy);
31 | }
32 | }
33 |
34 | @Override
35 | public boolean isSignificant() {
36 | return true;
37 | }
38 | }
39 |
--------------------------------------------------------------------------------
/src/sporemodder/extras/spuieditor/components/ActionableComponent.java:
--------------------------------------------------------------------------------
1 | package sporemodder.extras.spuieditor.components;
2 |
3 | import java.awt.Rectangle;
4 |
5 | public interface ActionableComponent {
6 |
7 | public static final int STATE_SELECTED = 0x10; // just a placeholder, don't know what Spore uses
8 | public static final int STATE_HOVER = 0x8;
9 | public static final int STATE_CLICK = 0x2;
10 |
11 | public void setState(int state);
12 | public int getState();
13 | public Rectangle getRealBounds();
14 | }
15 |
--------------------------------------------------------------------------------
/src/sporemodder/extras/spuieditor/components/CascadeEffect.java:
--------------------------------------------------------------------------------
1 | package sporemodder.extras.spuieditor.components;
2 |
3 | import sporemodder.extras.spuieditor.SPUIViewer;
4 | import sporemodder.extras.spuieditor.components.SPUIWinProc.SPUIDefaultWinProc;
5 | import sporemodder.files.formats.spui.InvalidBlockException;
6 | import sporemodder.files.formats.spui.SPUIBlock;
7 | import sporemodder.files.formats.spui.SPUIBuilder;
8 |
9 | public class CascadeEffect extends SPUIDefaultWinProc {
10 |
11 | public static final int TYPE = 0xF90A5AE;
12 |
13 | public CascadeEffect(SPUIBlock block) throws InvalidBlockException {
14 | super(block);
15 |
16 | addUnassignedFloat(block, 0x4F2B0000, (float) 0);
17 | addUnassignedFloat(block, 0x4F2B0001, (float) 0);
18 | }
19 |
20 | private CascadeEffect() {
21 | super();
22 | }
23 |
24 | public CascadeEffect(SPUIViewer viewer) {
25 | super(viewer);
26 |
27 | unassignedProperties.put(0x4F2B0000, (float) 0);
28 | unassignedProperties.put(0x4F2B0001, (float) 0);
29 | }
30 |
31 | @Override
32 | public SPUIBlock saveComponent(SPUIBuilder builder) {
33 |
34 | SPUIBlock block = (SPUIBlock) super.saveComponent(builder);
35 |
36 | saveFloat(builder, block, 0x4F2B0000);
37 | saveFloat(builder, block, 0x4F2B0001);
38 |
39 | return block;
40 | }
41 |
42 | @Override
43 | public CascadeEffect copyComponent(boolean propagate) {
44 | CascadeEffect eff = new CascadeEffect();
45 | copyComponent(eff, propagate);
46 | return eff;
47 | }
48 |
49 | }
50 |
--------------------------------------------------------------------------------
/src/sporemodder/extras/spuieditor/components/ConsoleWindow.java:
--------------------------------------------------------------------------------
1 | package sporemodder.extras.spuieditor.components;
2 |
3 | import java.io.IOException;
4 |
5 | import sporemodder.extras.spuieditor.SPUIViewer;
6 | import sporemodder.files.formats.spui.InvalidBlockException;
7 | import sporemodder.files.formats.spui.SPUIBlock;
8 |
9 | public class ConsoleWindow extends Window {
10 |
11 | public static final int TYPE = 0xEFBC56D8;
12 |
13 | public ConsoleWindow(SPUIBlock block) throws InvalidBlockException, IOException {
14 | super(block);
15 | }
16 |
17 | private ConsoleWindow() {
18 | super();
19 | }
20 |
21 | @Override
22 | public ConsoleWindow copyComponent(boolean propagateIndependent) {
23 | ConsoleWindow other = new ConsoleWindow();
24 | copyComponent(other, propagateIndependent);
25 | return other;
26 | }
27 |
28 | public ConsoleWindow(SPUIViewer viewer) {
29 | super(viewer);
30 | }
31 | }
32 |
--------------------------------------------------------------------------------
/src/sporemodder/extras/spuieditor/components/ExplicitNavigator.java:
--------------------------------------------------------------------------------
1 | package sporemodder.extras.spuieditor.components;
2 |
3 | import sporemodder.extras.spuieditor.SPUIViewer;
4 | import sporemodder.extras.spuieditor.components.SPUIWinProc.SPUIDefaultWinProc;
5 | import sporemodder.files.formats.spui.InvalidBlockException;
6 | import sporemodder.files.formats.spui.SPUIBlock;
7 | import sporemodder.files.formats.spui.SPUIBuilder;
8 |
9 | public class ExplicitNavigator extends SPUIDefaultWinProc {
10 |
11 | public static final int TYPE = 0x4F8772AA;
12 |
13 | public ExplicitNavigator(SPUIBlock block) throws InvalidBlockException {
14 | super(block);
15 |
16 | addUnassignedInt(block, 0x2F860000, 9);
17 | addUnassignedInt(block, 0x2F860001, 1);
18 | }
19 |
20 | public ExplicitNavigator(SPUIViewer viewer) {
21 | super(viewer);
22 |
23 | unassignedProperties.put(0x2F860000, (int) 9);
24 | unassignedProperties.put(0x2F860001, (int) 1);
25 | }
26 |
27 | @Override
28 | public SPUIBlock saveComponent(SPUIBuilder builder) {
29 | SPUIBlock block = (SPUIBlock) super.saveComponent(builder);
30 |
31 | saveInt(builder, block, 0x2F860000);
32 | saveInt(builder, block, 0x2F860001);
33 |
34 | return block;
35 | }
36 |
37 | protected ExplicitNavigator() {
38 | }
39 |
40 | @Override
41 | public ExplicitNavigator copyComponent(boolean propagateIndependent) {
42 | ExplicitNavigator other = new ExplicitNavigator();
43 | copyComponent(other, propagateIndependent);
44 | return other;
45 | }
46 |
47 | }
48 |
--------------------------------------------------------------------------------
/src/sporemodder/extras/spuieditor/components/FadeEffect.java:
--------------------------------------------------------------------------------
1 | package sporemodder.extras.spuieditor.components;
2 |
3 | import sporemodder.extras.spuieditor.SPUIViewer;
4 | import sporemodder.files.formats.spui.InvalidBlockException;
5 | import sporemodder.files.formats.spui.SPUIBlock;
6 |
7 | public class FadeEffect extends UIEffect {
8 |
9 | public static final int TYPE = 0x6F2B6D2C;
10 |
11 | public FadeEffect(SPUIBlock block) throws InvalidBlockException {
12 | super(block);
13 | }
14 |
15 | public FadeEffect(SPUIViewer viewer) {
16 | super(viewer);
17 | }
18 |
19 | private FadeEffect() {
20 | super();
21 | }
22 |
23 | @Override
24 | public FadeEffect copyComponent(boolean propagateIndependent) {
25 | FadeEffect eff = new FadeEffect();
26 | copyComponent(eff, propagateIndependent);
27 | return eff;
28 | }
29 |
30 | }
31 |
--------------------------------------------------------------------------------
/src/sporemodder/extras/spuieditor/components/GlideEffect.java:
--------------------------------------------------------------------------------
1 | package sporemodder.extras.spuieditor.components;
2 |
3 | import sporemodder.extras.spuieditor.SPUIViewer;
4 | import sporemodder.files.formats.spui.InvalidBlockException;
5 | import sporemodder.files.formats.spui.SPUIBlock;
6 | import sporemodder.files.formats.spui.SPUIBuilder;
7 |
8 | public class GlideEffect extends UIEffect {
9 |
10 | public static final int TYPE = 0xCF2B2AD4;
11 |
12 | public GlideEffect(SPUIBlock block) throws InvalidBlockException {
13 | super(block);
14 |
15 | addUnassignedVec2(block, 0x4F2C0000, new float[2]);
16 | }
17 |
18 | public GlideEffect(SPUIViewer viewer) {
19 | super(viewer);
20 |
21 | unassignedProperties.put(0x4F2C0000, new float[2]);
22 | }
23 |
24 | @Override
25 | public SPUIBlock saveComponent(SPUIBuilder builder) {
26 |
27 | SPUIBlock block = (SPUIBlock) super.saveComponent(builder);
28 |
29 | saveVec2(builder, block, 0x4F2C0000);
30 |
31 | return block;
32 | }
33 |
34 | private GlideEffect() {
35 | super();
36 | }
37 |
38 | @Override
39 | public GlideEffect copyComponent(boolean propagateIndependent) {
40 | GlideEffect eff = new GlideEffect();
41 | copyComponent(eff, propagateIndependent);
42 | return eff;
43 | }
44 |
45 | }
46 |
--------------------------------------------------------------------------------
/src/sporemodder/extras/spuieditor/components/ImageCursorProvider.java:
--------------------------------------------------------------------------------
1 | package sporemodder.extras.spuieditor.components;
2 |
3 | import sporemodder.extras.spuieditor.SPUIViewer;
4 | import sporemodder.files.formats.spui.InvalidBlockException;
5 | import sporemodder.files.formats.spui.SPUIBlock;
6 | import sporemodder.files.formats.spui.SPUIBuilder;
7 | import sporemodder.files.formats.spui.SPUIComplexSections.SectionSectionList;
8 |
9 | public class ImageCursorProvider extends SPUIDefaultComponent {
10 |
11 | public static final int TYPE = 0x02CDE37E;
12 |
13 | //TODO ??
14 |
15 | public ImageCursorProvider(SPUIBlock block) throws InvalidBlockException {
16 | super(block);
17 |
18 | addUnassigned(block, 0x02CD0000, null);
19 | int default1;
20 | }
21 |
22 | private ImageCursorProvider() {
23 | super();
24 | }
25 |
26 | public ImageCursorProvider(SPUIViewer viewer) {
27 | super(viewer);
28 |
29 | unassignedProperties.put(0x02CD0000, null);
30 | }
31 |
32 | @Override
33 | public ImageCursorProvider copyComponent(boolean propagateIndependent) {
34 | ImageCursorProvider other = new ImageCursorProvider();
35 | copyComponent(other, propagateIndependent);
36 | return other;
37 | }
38 |
39 | @Override
40 | public SPUIBlock saveComponent(SPUIBuilder builder) {
41 |
42 | SPUIBlock block = (SPUIBlock) super.saveComponent(builder);
43 |
44 | if (unassignedProperties.get(0x02CD0000) != null) {
45 | SectionSectionList sectionList = (SectionSectionList) unassignedProperties.get(0x02CD0000);
46 |
47 | builder.addSectionList(block, 0x02CD0000, sectionList.sections, sectionList.unk);
48 | }
49 |
50 | return block;
51 | }
52 | }
53 |
--------------------------------------------------------------------------------
/src/sporemodder/extras/spuieditor/components/InflateEffect.java:
--------------------------------------------------------------------------------
1 | package sporemodder.extras.spuieditor.components;
2 |
3 | import sporemodder.extras.spuieditor.SPUIViewer;
4 | import sporemodder.files.formats.spui.InvalidBlockException;
5 | import sporemodder.files.formats.spui.SPUIBlock;
6 | import sporemodder.files.formats.spui.SPUIBuilder;
7 |
8 | public class InflateEffect extends UIEffect {
9 |
10 | public static final int TYPE = 0x4F3DAF02;
11 |
12 | public InflateEffect(SPUIBlock block) throws InvalidBlockException {
13 | super(block);
14 |
15 | addUnassignedFloat(block, 0x4F2C0000, 0);
16 | }
17 |
18 | @Override
19 | public SPUIBlock saveComponent(SPUIBuilder builder) {
20 |
21 | SPUIBlock block = (SPUIBlock) super.saveComponent(builder);
22 |
23 | saveFloat(builder, block, 0x4F2C0000);
24 |
25 | return block;
26 | }
27 |
28 | public InflateEffect(SPUIViewer viewer) {
29 | super(viewer);
30 |
31 | unassignedProperties.put(0x4F2C0000, (float) 0);
32 | }
33 |
34 | private InflateEffect() {
35 | super();
36 | }
37 |
38 | @Override
39 | public InflateEffect copyComponent(boolean propagateIndependent) {
40 | InflateEffect eff = new InflateEffect();
41 | copyComponent(eff, propagateIndependent);
42 | return eff;
43 | }
44 |
45 | }
46 |
--------------------------------------------------------------------------------
/src/sporemodder/extras/spuieditor/components/ModulateEffect.java:
--------------------------------------------------------------------------------
1 | package sporemodder.extras.spuieditor.components;
2 |
3 | import sporemodder.extras.spuieditor.SPUIViewer;
4 | import sporemodder.files.formats.spui.InvalidBlockException;
5 | import sporemodder.files.formats.spui.SPUIBlock;
6 | import sporemodder.files.formats.spui.SPUIBuilder;
7 |
8 | public class ModulateEffect extends UIEffect {
9 |
10 | public static final int TYPE = 0x2F8BBB4D;
11 |
12 | public ModulateEffect(SPUIBlock block) throws InvalidBlockException {
13 | super(block);
14 |
15 | addUnassignedInt(block, 0x4F2C0000, 0);
16 | addUnassignedInt(block, 0x4F2C0001, 0);
17 | }
18 |
19 | public ModulateEffect(SPUIViewer viewer) {
20 | super(viewer);
21 |
22 | unassignedProperties.put(0x4F2C0000, (int) 0);
23 | unassignedProperties.put(0x4F2C0001, (int) 0);
24 | }
25 |
26 | @Override
27 | public SPUIBlock saveComponent(SPUIBuilder builder) {
28 |
29 | SPUIBlock block = (SPUIBlock) super.saveComponent(builder);
30 |
31 | saveInt(builder, block, 0x4F2C0000);
32 | saveInt(builder, block, 0x4F2C0001);
33 |
34 | return block;
35 | }
36 |
37 | private ModulateEffect() {
38 | super();
39 | }
40 |
41 | @Override
42 | public ModulateEffect copyComponent(boolean propagateIndependent) {
43 | ModulateEffect eff = new ModulateEffect();
44 | copyComponent(eff, propagateIndependent);
45 | return eff;
46 | }
47 |
48 | }
49 |
--------------------------------------------------------------------------------
/src/sporemodder/extras/spuieditor/components/PerspectiveEffect.java:
--------------------------------------------------------------------------------
1 | package sporemodder.extras.spuieditor.components;
2 |
3 | import sporemodder.extras.spuieditor.SPUIViewer;
4 | import sporemodder.extras.spuieditor.components.SPUIWinProc.SPUIDefaultWinProc;
5 | import sporemodder.files.formats.spui.InvalidBlockException;
6 | import sporemodder.files.formats.spui.SPUIBlock;
7 | import sporemodder.files.formats.spui.SPUIBuilder;
8 |
9 | public class PerspectiveEffect extends SPUIDefaultWinProc {
10 |
11 | public static final int TYPE = 0xCF2B2AD6;
12 |
13 | public PerspectiveEffect(SPUIBlock block) throws InvalidBlockException {
14 | super(block);
15 | addUnassignedFloat(block, 0x4F2C0110, 0);
16 | }
17 |
18 | public PerspectiveEffect(SPUIViewer viewer) {
19 | super(viewer);
20 |
21 | unassignedProperties.put(0x4F2C0110, (float) 0);
22 | }
23 |
24 | @Override
25 | public SPUIBlock saveComponent(SPUIBuilder builder) {
26 |
27 | SPUIBlock block = (SPUIBlock) super.saveComponent(builder);
28 |
29 | saveFloat(builder, block, 0x4F2C0110);
30 |
31 | builder.addBlock(block);
32 |
33 | return block;
34 | }
35 |
36 | private PerspectiveEffect() {
37 | super();
38 | }
39 |
40 | @Override
41 | public PerspectiveEffect copyComponent(boolean propagateIndependent) {
42 | PerspectiveEffect eff = new PerspectiveEffect();
43 | copyComponent(eff, propagateIndependent);
44 | return eff;
45 | }
46 |
47 | }
48 |
--------------------------------------------------------------------------------
/src/sporemodder/extras/spuieditor/components/RelativeNavigator.java:
--------------------------------------------------------------------------------
1 | package sporemodder.extras.spuieditor.components;
2 |
3 | import sporemodder.extras.spuieditor.SPUIViewer;
4 | import sporemodder.files.formats.spui.InvalidBlockException;
5 | import sporemodder.files.formats.spui.SPUIBlock;
6 | import sporemodder.files.formats.spui.SPUIBuilder;
7 |
8 | public class RelativeNavigator extends ExplicitNavigator {
9 |
10 | public static final int TYPE = 0xAF8772AF;
11 |
12 | public RelativeNavigator(SPUIBlock block) throws InvalidBlockException {
13 | super(block);
14 |
15 | addUnassignedInt(block, 0x2F870000, 1);
16 | }
17 |
18 | public RelativeNavigator(SPUIViewer viewer) {
19 | super(viewer);
20 |
21 | unassignedProperties.put(0x2F870000, (int) 1);
22 | }
23 |
24 | @Override
25 | public SPUIBlock saveComponent(SPUIBuilder builder) {
26 | SPUIBlock block = super.saveComponent(builder);
27 |
28 | saveInt(builder, block, 0x2F870000);
29 |
30 | return block;
31 | }
32 |
33 | private RelativeNavigator() {
34 | super();
35 | }
36 |
37 | @Override
38 | public RelativeNavigator copyComponent(boolean propagateIndependent) {
39 | RelativeNavigator other = new RelativeNavigator();
40 | copyComponent(other, propagateIndependent);
41 | return other;
42 | }
43 |
44 | }
45 |
--------------------------------------------------------------------------------
/src/sporemodder/extras/spuieditor/components/SPUIDrawable.java:
--------------------------------------------------------------------------------
1 | package sporemodder.extras.spuieditor.components;
2 |
3 | import java.awt.Dimension;
4 | import java.awt.Graphics2D;
5 | import java.awt.Point;
6 | import java.awt.Rectangle;
7 |
8 | public interface SPUIDrawable extends SPUIComponent {
9 |
10 | public static final String INTERFACE_NAME = "IDrawable";
11 | public static final String BUTTON_INTERFACE_NAME = "IButtonDrawable";
12 |
13 | public static final int IMAGE_MAIN = -1;
14 |
15 | public static final int[] DrawableTypes = new int[] {
16 | ButtonDrawableStandard.TYPE,
17 | ButtonDrawableRadio.TYPE,
18 | ComboBoxDrawable.TYPE,
19 | DialogDrawable.TYPE,
20 | FrameDrawable.TYPE,
21 | ImageDrawable.TYPE,
22 | ScrollbarDrawable.TYPE,
23 | SliderDrawable.TYPE,
24 | SpinnerDrawable.TYPE,
25 | StdDrawable.TYPE,
26 | /* TreeExpanderDrawable */ 0xF02C7C44,
27 | cSPUIStdDrawable.TYPE,
28 | cSPUIVariableWidthDrawable.TYPE
29 | };
30 |
31 | @Override
32 | public SPUIDrawable copyComponent(boolean propagate);
33 |
34 | public void draw(Graphics2D graphics, Rectangle bounds, WinComponent component);
35 |
36 | public Dimension getDimensions(int imageIndex);
37 |
38 | public boolean isValidPoint(Point p, Rectangle bounds);
39 |
40 | }
41 |
--------------------------------------------------------------------------------
/src/sporemodder/extras/spuieditor/components/TreeExpanderDrawable.java:
--------------------------------------------------------------------------------
1 | package sporemodder.extras.spuieditor.components;
2 |
3 | import java.awt.Dimension;
4 | import java.awt.Graphics2D;
5 | import java.awt.Point;
6 | import java.awt.Rectangle;
7 |
8 | import sporemodder.extras.spuieditor.SPUIViewer;
9 | import sporemodder.files.formats.spui.InvalidBlockException;
10 | import sporemodder.files.formats.spui.SPUIObject;
11 |
12 | public class TreeExpanderDrawable extends SPUIDefaultComponent implements SPUIDrawable {
13 |
14 | public static final int TYPE = 0xF02C7C44;
15 |
16 | // apparently, it uses no properties
17 |
18 | public TreeExpanderDrawable(SPUIObject object) throws InvalidBlockException {
19 | super(object);
20 | }
21 |
22 | private TreeExpanderDrawable() {
23 | super();
24 | }
25 |
26 | public TreeExpanderDrawable(SPUIViewer viewer) {
27 | super(viewer);
28 | }
29 |
30 | @Override
31 | public TreeExpanderDrawable copyComponent(boolean propagate) {
32 | TreeExpanderDrawable other = new TreeExpanderDrawable();
33 | copyComponent(other, propagate);
34 | return other;
35 | }
36 |
37 | @Override
38 | public void draw(Graphics2D graphics, Rectangle bounds, WinComponent component) {
39 | // TODO Auto-generated method stub
40 |
41 | }
42 |
43 | @Override
44 | public Dimension getDimensions(int imageIndex) {
45 | return null;
46 | }
47 |
48 | @Override
49 | public boolean isValidPoint(Point p, Rectangle bounds) {
50 | return true;
51 | }
52 | }
53 |
--------------------------------------------------------------------------------
/src/sporemodder/extras/spuieditor/components/UIEffect.java:
--------------------------------------------------------------------------------
1 | package sporemodder.extras.spuieditor.components;
2 |
3 | import sporemodder.extras.spuieditor.SPUIViewer;
4 | import sporemodder.extras.spuieditor.components.SPUIWinProc.SPUIDefaultWinProc;
5 | import sporemodder.files.formats.spui.InvalidBlockException;
6 | import sporemodder.files.formats.spui.SPUIBlock;
7 | import sporemodder.files.formats.spui.SPUIBuilder;
8 |
9 | public abstract class UIEffect extends SPUIDefaultWinProc {
10 |
11 | public UIEffect(SPUIBlock block) throws InvalidBlockException {
12 | super(block);
13 |
14 | addUnassignedFloat(block, 0x4F2B0000, 0);
15 | addUnassignedInt(block, 0x4F2B0001, 0);
16 | addUnassignedInt(block, 0x4F2B0002, 0);
17 | addUnassignedFloat(block, 0x4F2B0003, 0);
18 | addUnassignedFloat(block, 0x4F2B0004, 0);
19 | addUnassignedFloat(block, 0x4F2B0005, 0);
20 | }
21 |
22 | public UIEffect(SPUIViewer viewer) {
23 | super(viewer);
24 |
25 | unassignedProperties.put(0x4F2B0000, (float) 0);
26 | unassignedProperties.put(0x4F2B0001, (int) 0);
27 | unassignedProperties.put(0x4F2B0002, (int) 0);
28 | unassignedProperties.put(0x4F2B0003, (float) 0);
29 | unassignedProperties.put(0x4F2B0004, (float) 0);
30 | unassignedProperties.put(0x4F2B0005, (float) 0);
31 | }
32 |
33 | protected UIEffect() {
34 | super();
35 | }
36 |
37 | @Override
38 | public SPUIBlock saveComponent(SPUIBuilder builder) {
39 |
40 | SPUIBlock block = (SPUIBlock) super.saveComponent(builder);
41 |
42 | saveFloat(builder, block, 0x4F2B0000);
43 | saveInt(builder, block, 0x4F2B0001);
44 | saveInt(builder, block, 0x4F2B0002);
45 | saveFloat(builder, block, 0x4F2B0003);
46 | saveFloat(builder, block, 0x4F2B0004);
47 | saveFloat(builder, block, 0x4F2B0005);
48 |
49 | return block;
50 | }
51 |
52 | }
53 |
--------------------------------------------------------------------------------
/src/sporemodder/extras/spuieditor/components/WatchGraph.java:
--------------------------------------------------------------------------------
1 | package sporemodder.extras.spuieditor.components;
2 |
3 | import java.io.IOException;
4 |
5 | import sporemodder.extras.spuieditor.SPUIViewer;
6 | import sporemodder.files.formats.spui.InvalidBlockException;
7 | import sporemodder.files.formats.spui.SPUIBlock;
8 |
9 | public class WatchGraph extends Window {
10 |
11 | public static final int TYPE = 0x0295571A;
12 |
13 | public WatchGraph(SPUIBlock block) throws InvalidBlockException, IOException {
14 | super(block);
15 | }
16 |
17 | private WatchGraph() {
18 | super();
19 | }
20 |
21 | public WatchGraph(SPUIViewer viewer) {
22 | super(viewer);
23 | }
24 |
25 | @Override
26 | public WatchGraph copyComponent(boolean propagateIndependent) {
27 | WatchGraph other = new WatchGraph();
28 | copyComponent(other, propagateIndependent);
29 | return other;
30 | }
31 | }
32 |
--------------------------------------------------------------------------------
/src/sporemodder/extras/spuieditor/components/WatchWindow.java:
--------------------------------------------------------------------------------
1 | package sporemodder.extras.spuieditor.components;
2 |
3 | import java.io.IOException;
4 |
5 | import sporemodder.extras.spuieditor.SPUIViewer;
6 | import sporemodder.files.formats.spui.InvalidBlockException;
7 | import sporemodder.files.formats.spui.SPUIBlock;
8 |
9 | public class WatchWindow extends Window {
10 |
11 | public static final int TYPE = 0x6FB339C9;
12 |
13 | public WatchWindow(SPUIBlock block) throws InvalidBlockException, IOException {
14 | super(block);
15 | }
16 |
17 | private WatchWindow() {
18 | super();
19 | }
20 |
21 | public WatchWindow(SPUIViewer viewer) {
22 | super(viewer);
23 | }
24 |
25 | @Override
26 | public WatchWindow copyComponent(boolean propagateIndependent) {
27 | WatchWindow other = new WatchWindow();
28 | copyComponent(other, propagateIndependent);
29 | return other;
30 | }
31 | }
32 |
--------------------------------------------------------------------------------
/src/sporemodder/extras/spuieditor/components/WinComponent.java:
--------------------------------------------------------------------------------
1 | package sporemodder.extras.spuieditor.components;
2 |
3 | import java.awt.Color;
4 | import java.awt.Graphics2D;
5 | import java.awt.Point;
6 | import java.awt.Rectangle;
7 | import java.util.List;
8 |
9 | import javax.swing.tree.TreePath;
10 |
11 | import sporemodder.extras.spuieditor.StyleSheetInstance;
12 | import sporemodder.files.formats.LocalizedText;
13 |
14 | public interface WinComponent extends SPUIComponent {
15 |
16 | public static final String INTERFACE_NAME = "IWindow";
17 |
18 | public static final int FLAG_VISIBLE = 0x1;
19 | public static final int FLAG_ENABLED = 0x2;
20 |
21 | @Override
22 | public WinComponent copyComponent(boolean propagateIndependent);
23 |
24 | public String getName();
25 | public void setName(String name);
26 |
27 | public void revalidate();
28 |
29 | public List getChildren();
30 | public List getModifiers();
31 |
32 | public Rectangle getRealBounds();
33 | public Rectangle getBounds();
34 | public void setBounds(Rectangle bounds);
35 | public void translate(int dx, int dy);
36 |
37 | public Color getTintColor();
38 | public void setTintColor(Color color);
39 | public Color getBackgroundColor();
40 | public void setBackgroundColor(Color color);
41 |
42 | public StyleSheetInstance getStyle();
43 | public void setStyle(StyleSheetInstance style);
44 |
45 | public int getFlags();
46 | public void setFlag(int flag, boolean value);
47 |
48 | public LocalizedText getText();
49 | public void setText(LocalizedText text);
50 |
51 | public SPUIDrawable getDrawable();
52 | public void setDrawable(SPUIDrawable drawable);
53 |
54 | public void removeChildComponent(SPUIComponent component);
55 | public void insertChildComponent(SPUIComponent component, int childIndex);
56 | public int getIndexOfChild(SPUIComponent component);
57 |
58 | public WinComponent getParent();
59 | public void setParent(WinComponent parent);
60 |
61 | public void paintComponent(Graphics2D graphics);
62 |
63 | public boolean isActionableComponent();
64 | public boolean isLayoutWindow();
65 | public boolean isMoveable();
66 |
67 | public WinComponent getComponentInCoords(Point p);
68 | public T getComponentInCoords(Point p, Class type);
69 |
70 | public TreePath getHierarchyTreePath();
71 |
72 | }
73 |
--------------------------------------------------------------------------------
/src/sporemodder/extras/spuieditor/components/WinXHTML.java:
--------------------------------------------------------------------------------
1 | package sporemodder.extras.spuieditor.components;
2 |
3 | import java.io.IOException;
4 |
5 | import sporemodder.extras.spuieditor.SPUIViewer;
6 | import sporemodder.files.formats.spui.InvalidBlockException;
7 | import sporemodder.files.formats.spui.SPUIBlock;
8 | import sporemodder.files.formats.spui.SPUIBuilder;
9 |
10 | public class WinXHTML extends Window {
11 |
12 | public static final int TYPE = 0x04D04553;
13 |
14 | public WinXHTML(SPUIBlock block) throws InvalidBlockException, IOException {
15 | super(block);
16 |
17 | addUnassignedInt(block, 0x0FF11739, 0);
18 | addUnassignedInt(block, 0x0FF1173A, 0);
19 | // type 0xEEF3AF8C
20 | addUnassignedShort(block, 0x0FF1173B, null); // ScrollbarDrawable ?
21 | addUnassignedShort(block, 0x0FF1173C, null); // ScrollbarDrawable ?
22 | }
23 |
24 | public WinXHTML(SPUIViewer viewer) {
25 | super(viewer);
26 |
27 | unassignedProperties.put(0x0FF11739, (int) 0);
28 | unassignedProperties.put(0x0FF1173A, (int) 0);
29 | unassignedProperties.put(0x0FF1173B, null);
30 | unassignedProperties.put(0x0FF1173C, null);
31 | }
32 |
33 | private WinXHTML() {
34 | super();
35 | }
36 |
37 | @Override
38 | public WinXHTML copyComponent(boolean propagateIndependent) {
39 | WinXHTML other = new WinXHTML();
40 | copyComponent(other, propagateIndependent);
41 |
42 | return other;
43 | }
44 |
45 | @Override
46 | public SPUIBlock saveComponent(SPUIBuilder builder) {
47 | SPUIBlock block = super.saveComponent(builder);
48 |
49 | saveInt(builder, block, 0x0FF11739);
50 | saveInt(builder, block, 0x0FF1173A);
51 | saveReference(builder, block, 0x0FF1173B);
52 | saveReference(builder, block, 0x0FF1173C);
53 |
54 | return block;
55 | }
56 |
57 | @Override
58 | protected boolean shouldUseFillColor() {
59 | return false;
60 | }
61 | }
62 |
--------------------------------------------------------------------------------
/src/sporemodder/extras/spuieditor/components/cSPUIBehaviorPredicateWinState.java:
--------------------------------------------------------------------------------
1 | package sporemodder.extras.spuieditor.components;
2 |
3 | import sporemodder.extras.spuieditor.SPUIViewer;
4 | import sporemodder.files.formats.spui.InvalidBlockException;
5 | import sporemodder.files.formats.spui.SPUIBlock;
6 | import sporemodder.files.formats.spui.SPUIBuilder;
7 | import sporemodder.files.formats.spui.SPUIObject;
8 |
9 | public class cSPUIBehaviorPredicateWinState extends SPUIDefaultComponent {
10 |
11 | public static final int TYPE = 0x033C9C5B;
12 |
13 | public cSPUIBehaviorPredicateWinState(SPUIBlock block) throws InvalidBlockException {
14 | super(block);
15 |
16 | addUnassignedBoolean(block, 0x02521AFB, false);
17 | addUnassignedInt(block, 0x02521AFA, 0);
18 | addUnassignedInt(block, 0x033CDC1B, 0);
19 | addUnassignedIntName(block, 0x033CDCF4, null);
20 | addUnassignedIntName(block, 0x033CDC22, null);
21 | addUnassignedInt(block, 0x0341EF60, 0);
22 | }
23 |
24 | public cSPUIBehaviorPredicateWinState(SPUIViewer viewer) {
25 | super(viewer);
26 |
27 | unassignedProperties.put(0x02521AFB, (boolean) false);
28 | unassignedProperties.put(0x02521AFA, (int) 0);
29 | unassignedProperties.put(0x033CDC1B, (int) 0);
30 | unassignedProperties.put(0x033CDCF4, null);
31 | unassignedProperties.put(0x033CDC22, null);
32 | unassignedProperties.put(0x0341EF60, (int) 0);
33 | }
34 |
35 | @Override
36 | public SPUIObject saveComponent(SPUIBuilder builder) {
37 |
38 | SPUIBlock block = (SPUIBlock) super.saveComponent(builder);
39 |
40 | saveBoolean(builder, block, 0x02521AFB);
41 | saveInt(builder, block, 0x02521AFA);
42 | saveInt(builder, block, 0x033CDC1B);
43 | saveIntName(builder, block, 0x033CDCF4);
44 | saveIntName(builder, block, 0x033CDC22);
45 | saveInt(builder, block, 0x0341EF60);
46 |
47 | return block;
48 | }
49 |
50 | private cSPUIBehaviorPredicateWinState() {
51 | super();
52 | }
53 |
54 | @Override
55 | public SPUIComponent copyComponent(boolean propagate) {
56 | cSPUIBehaviorPredicateWinState other = new cSPUIBehaviorPredicateWinState();
57 | copyComponent(other, propagate);
58 | return other;
59 | }
60 |
61 | }
62 |
--------------------------------------------------------------------------------
/src/sporemodder/extras/spuieditor/components/cSPUIBehaviorTimeFunction.java:
--------------------------------------------------------------------------------
1 | package sporemodder.extras.spuieditor.components;
2 |
3 | import sporemodder.extras.spuieditor.SPUIViewer;
4 | import sporemodder.files.formats.spui.InvalidBlockException;
5 | import sporemodder.files.formats.spui.SPUIBlock;
6 | import sporemodder.files.formats.spui.SPUIBuilder;
7 | import sporemodder.files.formats.spui.SPUIObject;
8 |
9 | public abstract class cSPUIBehaviorTimeFunction extends SPUIDefaultComponent {
10 |
11 | public cSPUIBehaviorTimeFunction(SPUIBlock block) throws InvalidBlockException {
12 | super(block);
13 |
14 | addUnassignedBoolean(block, 0x0253AD19, false);
15 | addUnassignedFloat(block, 0x0253ACED, 0);
16 | addUnassignedFloat(block, 0x0269A849, 0);
17 | addUnassignedFloat(block, 0x0269A84B, 0);
18 | }
19 |
20 | public cSPUIBehaviorTimeFunction(SPUIViewer viewer) {
21 | super(viewer);
22 |
23 | unassignedProperties.put(0x0253AD19, (boolean) false);
24 | unassignedProperties.put(0x0253ACED, (float) 0);
25 | unassignedProperties.put(0x0269A849, (float) 0);
26 | unassignedProperties.put(0x0269A84B, (float) 0);
27 | }
28 |
29 | @Override
30 | public SPUIObject saveComponent(SPUIBuilder builder) {
31 |
32 | SPUIBlock block = (SPUIBlock) super.saveComponent(builder);
33 |
34 | saveBoolean(builder, block, 0x0253AD19);
35 | saveFloat(builder, block, 0x0253ACED);
36 | saveFloat(builder, block, 0x0269A849);
37 | saveFloat(builder, block, 0x0269A84B);
38 |
39 | return block;
40 | }
41 |
42 | protected cSPUIBehaviorTimeFunction() {
43 | super();
44 | }
45 |
46 | }
47 |
--------------------------------------------------------------------------------
/src/sporemodder/extras/spuieditor/components/cSPUIBehaviorTimeFunctionDampedPeriodic.java:
--------------------------------------------------------------------------------
1 | package sporemodder.extras.spuieditor.components;
2 |
3 | import sporemodder.extras.spuieditor.SPUIViewer;
4 | import sporemodder.files.formats.spui.InvalidBlockException;
5 | import sporemodder.files.formats.spui.SPUIBlock;
6 | import sporemodder.files.formats.spui.SPUIBuilder;
7 | import sporemodder.files.formats.spui.SPUIObject;
8 |
9 | public class cSPUIBehaviorTimeFunctionDampedPeriodic extends cSPUIBehaviorTimeFunction {
10 |
11 | public static final int TYPE = 0x0269A661;
12 |
13 | public cSPUIBehaviorTimeFunctionDampedPeriodic(SPUIBlock block) throws InvalidBlockException {
14 | super(block);
15 |
16 | addUnassignedInt(block, 0x0269B186, 0);
17 | addUnassignedFloat(block, 0x0269A916, 0);
18 | addUnassignedFloat(block, 0x0269A919, 0);
19 | addUnassignedFloat(block, 0x0269A91B, 0);
20 | addUnassignedBoolean(block, 0x026A02AB, false);
21 | }
22 |
23 | public cSPUIBehaviorTimeFunctionDampedPeriodic(SPUIViewer viewer) {
24 | super(viewer);
25 |
26 | unassignedProperties.put(0x0269B186, (int) 0);
27 | unassignedProperties.put(0x0269A916, (float) 0);
28 | unassignedProperties.put(0x0269A919, (float) 0);
29 | unassignedProperties.put(0x0269A91B, (float) 0);
30 | unassignedProperties.put(0x026A02AB, (boolean) false);
31 | }
32 |
33 | @Override
34 | public SPUIObject saveComponent(SPUIBuilder builder) {
35 |
36 | SPUIBlock block = (SPUIBlock) super.saveComponent(builder);
37 |
38 | saveInt(builder, block, 0x0269B186);
39 | saveFloat(builder, block, 0x0269A916);
40 | saveFloat(builder, block, 0x0269A919);
41 | saveFloat(builder, block, 0x0269A91B);
42 | saveBoolean(builder, block, 0x026A02AB);
43 |
44 | return block;
45 | }
46 |
47 | private cSPUIBehaviorTimeFunctionDampedPeriodic() {
48 | super();
49 | }
50 |
51 | @Override
52 | public SPUIComponent copyComponent(boolean propagate) {
53 | cSPUIBehaviorTimeFunctionDampedPeriodic other = new cSPUIBehaviorTimeFunctionDampedPeriodic();
54 | copyComponent(other, propagate);
55 | return other;
56 | }
57 |
58 | }
59 |
--------------------------------------------------------------------------------
/src/sporemodder/extras/spuieditor/components/cSPUIBehaviorTimeFunctionRamp.java:
--------------------------------------------------------------------------------
1 | package sporemodder.extras.spuieditor.components;
2 |
3 | import sporemodder.extras.spuieditor.SPUIViewer;
4 | import sporemodder.files.formats.spui.InvalidBlockException;
5 | import sporemodder.files.formats.spui.SPUIBlock;
6 |
7 | public class cSPUIBehaviorTimeFunctionRamp extends cSPUIBehaviorTimeFunction {
8 |
9 | public static final int TYPE = 0x0253ACD2;
10 |
11 | public cSPUIBehaviorTimeFunctionRamp(SPUIBlock block) throws InvalidBlockException {
12 | super(block);
13 | }
14 |
15 | public cSPUIBehaviorTimeFunctionRamp(SPUIViewer viewer) {
16 | super(viewer);
17 | }
18 |
19 | private cSPUIBehaviorTimeFunctionRamp() {
20 | super();
21 | }
22 |
23 | @Override
24 | public SPUIComponent copyComponent(boolean propagate) {
25 | cSPUIBehaviorTimeFunctionRamp other = new cSPUIBehaviorTimeFunctionRamp();
26 | copyComponent(other, propagate);
27 | return other;
28 | }
29 | }
30 |
--------------------------------------------------------------------------------
/src/sporemodder/extras/spuieditor/components/cSPUIBehaviorTimeFunctionSmoothRamp.java:
--------------------------------------------------------------------------------
1 | package sporemodder.extras.spuieditor.components;
2 |
3 | import sporemodder.extras.spuieditor.SPUIViewer;
4 | import sporemodder.files.formats.spui.InvalidBlockException;
5 | import sporemodder.files.formats.spui.SPUIBlock;
6 | import sporemodder.files.formats.spui.SPUIBuilder;
7 | import sporemodder.files.formats.spui.SPUIObject;
8 |
9 | public class cSPUIBehaviorTimeFunctionSmoothRamp extends cSPUIBehaviorTimeFunction {
10 |
11 | public static final int TYPE = 0x0253ADD9;
12 |
13 | public cSPUIBehaviorTimeFunctionSmoothRamp(SPUIBlock block) throws InvalidBlockException {
14 | super(block);
15 |
16 | addUnassignedFloat(block, 0x0253AD8C, 0);
17 | addUnassignedFloat(block, 0x0253AD8D, 0);
18 |
19 | }
20 |
21 | public cSPUIBehaviorTimeFunctionSmoothRamp(SPUIViewer viewer) {
22 | super(viewer);
23 |
24 | unassignedProperties.put(0x0253AD8C, (float) 0);
25 | unassignedProperties.put(0x0253AD8D, (float) 0);
26 | }
27 |
28 | @Override
29 | public SPUIObject saveComponent(SPUIBuilder builder) {
30 |
31 | SPUIBlock block = (SPUIBlock) super.saveComponent(builder);
32 |
33 | saveFloat(builder, block, 0x0253AD8C);
34 | saveFloat(builder, block, 0x0253AD8D);
35 |
36 | return block;
37 | }
38 |
39 | private cSPUIBehaviorTimeFunctionSmoothRamp() {
40 | super();
41 | }
42 |
43 | @Override
44 | public SPUIComponent copyComponent(boolean propagate) {
45 | cSPUIBehaviorTimeFunctionSmoothRamp other = new cSPUIBehaviorTimeFunctionSmoothRamp();
46 | copyComponent(other, propagate);
47 | return other;
48 | }
49 |
50 | }
51 |
--------------------------------------------------------------------------------
/src/sporemodder/extras/spuieditor/components/cSPUIBehaviorWinBoolStateEvent.java:
--------------------------------------------------------------------------------
1 | package sporemodder.extras.spuieditor.components;
2 |
3 | import sporemodder.extras.spuieditor.SPUIViewer;
4 | import sporemodder.files.formats.spui.InvalidBlockException;
5 | import sporemodder.files.formats.spui.SPUIBlock;
6 | import sporemodder.files.formats.spui.SPUIBuilder;
7 |
8 | public class cSPUIBehaviorWinBoolStateEvent extends cSPUIBehaviorWinEventBase {
9 |
10 | public static final int TYPE = 0x025611ED;
11 |
12 | public cSPUIBehaviorWinBoolStateEvent(SPUIBlock block) throws InvalidBlockException {
13 | super(block);
14 |
15 | addUnassignedInt(block, 0x03339952, 0);
16 | }
17 |
18 | public cSPUIBehaviorWinBoolStateEvent(SPUIViewer viewer) {
19 | super(viewer);
20 |
21 | unassignedProperties.put(0x03339952, (int) 0);
22 | }
23 |
24 | @Override
25 | public SPUIBlock saveComponent(SPUIBuilder builder) {
26 |
27 | SPUIBlock block = (SPUIBlock) super.saveComponent(builder);
28 |
29 | saveInt(builder, block, 0x03339952);
30 |
31 | return block;
32 | }
33 |
34 | private cSPUIBehaviorWinBoolStateEvent() {
35 | super();
36 | }
37 |
38 | @Override
39 | public cSPUIBehaviorWinBoolStateEvent copyComponent(boolean propagateIndependent) {
40 | cSPUIBehaviorWinBoolStateEvent other = new cSPUIBehaviorWinBoolStateEvent();
41 | copyComponent(other, propagateIndependent);
42 | return other;
43 | }
44 | }
45 |
--------------------------------------------------------------------------------
/src/sporemodder/extras/spuieditor/components/cSPUIBehaviorWinEventBase.java:
--------------------------------------------------------------------------------
1 | package sporemodder.extras.spuieditor.components;
2 |
3 | import sporemodder.extras.spuieditor.SPUIViewer;
4 | import sporemodder.files.formats.spui.InvalidBlockException;
5 | import sporemodder.files.formats.spui.SPUIBlock;
6 | import sporemodder.files.formats.spui.SPUIBuilder;
7 |
8 | public class cSPUIBehaviorWinEventBase extends cSPUIBehaviorEventBase {
9 |
10 | public static final int TYPE = 0x0255E38E;
11 |
12 | public cSPUIBehaviorWinEventBase(SPUIBlock block) throws InvalidBlockException {
13 | super(block);
14 |
15 | addUnassignedInt(block, 0x0255EAF8, 0);
16 | addUnassignedBoolean(block, 0x0255EAF9, false);
17 | addUnassignedIntName(block, 0x0255EAFA, null);
18 | }
19 |
20 | public cSPUIBehaviorWinEventBase(SPUIViewer viewer) {
21 | super(viewer);
22 |
23 | unassignedProperties.put(0x0255EAF8, (int) 0);
24 | unassignedProperties.put(0x0255EAF9, (boolean) false);
25 | unassignedProperties.put(0x0255EAFA, null);
26 | }
27 |
28 | @Override
29 | public SPUIBlock saveComponent(SPUIBuilder builder) {
30 |
31 | SPUIBlock block = (SPUIBlock) super.saveComponent(builder);
32 |
33 | saveInt(builder, block, 0x0255EAF8);
34 | saveBoolean(builder, block, 0x0255EAF9);
35 | saveIntName(builder, block, 0x0255EAFA);
36 |
37 | return block;
38 | }
39 |
40 | protected cSPUIBehaviorWinEventBase() {
41 | super();
42 | }
43 |
44 | @Override
45 | public cSPUIBehaviorWinEventBase copyComponent(boolean propagateIndependent) {
46 | cSPUIBehaviorWinEventBase other = new cSPUIBehaviorWinEventBase();
47 | copyComponent(other, propagateIndependent);
48 | return other;
49 | }
50 |
51 | }
52 |
--------------------------------------------------------------------------------
/src/sporemodder/extras/spuieditor/components/cSPUIBehaviorWinInterpolatorScale.java:
--------------------------------------------------------------------------------
1 | package sporemodder.extras.spuieditor.components;
2 |
3 | import sporemodder.extras.spuieditor.SPUIViewer;
4 | import sporemodder.files.formats.spui.InvalidBlockException;
5 | import sporemodder.files.formats.spui.SPUIBlock;
6 | import sporemodder.files.formats.spui.SPUIBuilder;
7 | import sporemodder.files.formats.spui.SPUIObject;
8 |
9 | public class cSPUIBehaviorWinInterpolatorScale extends SPUIDefaultComponent {
10 |
11 | public static final int TYPE = 0x0269EFE5;
12 |
13 | public cSPUIBehaviorWinInterpolatorScale(SPUIBlock block) throws InvalidBlockException {
14 | super(block);
15 |
16 | addUnassignedBoolean(block, 0x0254AB8E, false);
17 | addUnassignedFloat(block, 0x0254B152, 0);
18 | addUnassignedFloat(block, 0x0254b153, 0);
19 | }
20 |
21 | public cSPUIBehaviorWinInterpolatorScale(SPUIViewer viewer) {
22 | super(viewer);
23 |
24 | unassignedProperties.put(0x0254AB8E, (boolean) false);
25 | unassignedProperties.put(0x0254B152, (float) 0);
26 | unassignedProperties.put(0x0254B153, (float) 0);
27 | }
28 |
29 | @Override
30 | public SPUIObject saveComponent(SPUIBuilder builder) {
31 |
32 | SPUIBlock block = (SPUIBlock) super.saveComponent(builder);
33 |
34 | saveBoolean(builder, block, 0x0254AB8E);
35 | saveFloat(builder, block, 0x0254B152);
36 | saveFloat(builder, block, 0x0254b153);
37 |
38 | return block;
39 | }
40 |
41 | private cSPUIBehaviorWinInterpolatorScale() {
42 | super();
43 | }
44 |
45 | @Override
46 | public SPUIComponent copyComponent(boolean propagateIndependent) {
47 | cSPUIBehaviorWinInterpolatorScale other = new cSPUIBehaviorWinInterpolatorScale();
48 | copyComponent(other, propagateIndependent);
49 | return other;
50 | }
51 |
52 | }
53 |
--------------------------------------------------------------------------------
/src/sporemodder/extras/spuieditor/components/cSPUIBehaviorWinInterpolatorShadeColor.java:
--------------------------------------------------------------------------------
1 | package sporemodder.extras.spuieditor.components;
2 |
3 | import sporemodder.extras.spuieditor.SPUIViewer;
4 | import sporemodder.files.formats.spui.InvalidBlockException;
5 | import sporemodder.files.formats.spui.SPUIBlock;
6 | import sporemodder.files.formats.spui.SPUIBuilder;
7 | import sporemodder.files.formats.spui.SPUIObject;
8 |
9 | public class cSPUIBehaviorWinInterpolatorShadeColor extends SPUIDefaultComponent {
10 |
11 | public static final int TYPE = 0x0254AA82;
12 |
13 | public cSPUIBehaviorWinInterpolatorShadeColor(SPUIBlock block) throws InvalidBlockException {
14 | super(block);
15 |
16 | addUnassignedBoolean(block, 0x0254AB8E, false);
17 | addUnassignedInt(block, 0x0254B152, 0xFFFFFFFF);
18 | addUnassignedInt(block, 0x0254B153, 0xFF000000);
19 | }
20 |
21 | public cSPUIBehaviorWinInterpolatorShadeColor(SPUIViewer viewer) {
22 | super(viewer);
23 |
24 | unassignedProperties.put(0x0254AB8E, (boolean) false);
25 | unassignedProperties.put(0x0254B152, (int) 0xFFFFFFFF);
26 | unassignedProperties.put(0x0254B153, (int) 0xFF000000);
27 | }
28 |
29 | @Override
30 | public SPUIObject saveComponent(SPUIBuilder builder) {
31 |
32 | SPUIBlock block = (SPUIBlock) super.saveComponent(builder);
33 |
34 | saveBoolean(builder, block, 0x0254AB8E);
35 | saveInt(builder, block, 0x0254B152);
36 | saveInt(builder, block, 0x0254B153);
37 |
38 | return block;
39 | }
40 |
41 | private cSPUIBehaviorWinInterpolatorShadeColor() {
42 | super();
43 | }
44 |
45 | @Override
46 | public SPUIComponent copyComponent(boolean propagateIndependent) {
47 | cSPUIBehaviorWinInterpolatorShadeColor other = new cSPUIBehaviorWinInterpolatorShadeColor();
48 | copyComponent(other, propagateIndependent);
49 | return other;
50 | }
51 |
52 | }
53 |
--------------------------------------------------------------------------------
/src/sporemodder/extras/spuieditor/components/cSPUIFrameSequencer.java:
--------------------------------------------------------------------------------
1 | package sporemodder.extras.spuieditor.components;
2 |
3 | import sporemodder.extras.spuieditor.SPUIViewer;
4 | import sporemodder.files.formats.spui.InvalidBlockException;
5 | import sporemodder.files.formats.spui.SPUIBlock;
6 |
7 | public class cSPUIFrameSequencer extends SPUIDefaultComponent {
8 |
9 | public static final int TYPE = 0x0106F61E;
10 |
11 | public cSPUIFrameSequencer(SPUIBlock block) throws InvalidBlockException {
12 | super(block);
13 | }
14 |
15 | public cSPUIFrameSequencer(SPUIViewer viewer) {
16 | super(viewer);
17 | }
18 |
19 | protected cSPUIFrameSequencer() {
20 | super();
21 | }
22 |
23 | @Override
24 | public cSPUIFrameSequencer copyComponent(boolean propagate) {
25 | cSPUIFrameSequencer other = new cSPUIFrameSequencer();
26 | copyComponent(other, propagate);
27 | return other;
28 | }
29 |
30 | }
31 |
--------------------------------------------------------------------------------
/src/sporemodder/extras/spuieditor/components/cSPUILaunchScreenWinProc.java:
--------------------------------------------------------------------------------
1 | package sporemodder.extras.spuieditor.components;
2 |
3 | import sporemodder.extras.spuieditor.SPUIViewer;
4 | import sporemodder.extras.spuieditor.components.SPUIWinProc.SPUIDefaultWinProc;
5 | import sporemodder.files.formats.spui.InvalidBlockException;
6 | import sporemodder.files.formats.spui.SPUIBlock;
7 |
8 | public class cSPUILaunchScreenWinProc extends SPUIDefaultWinProc {
9 |
10 | public static final int TYPE = 0x0279BF9E;
11 |
12 | public cSPUILaunchScreenWinProc(SPUIBlock block) throws InvalidBlockException {
13 | super(block);
14 | }
15 |
16 | public cSPUILaunchScreenWinProc(SPUIViewer viewer) {
17 | super(viewer);
18 | }
19 |
20 | protected cSPUILaunchScreenWinProc() {
21 | super();
22 | }
23 |
24 | @Override
25 | public cSPUILaunchScreenWinProc copyComponent(boolean propagate) {
26 | cSPUILaunchScreenWinProc other = new cSPUILaunchScreenWinProc();
27 | copyComponent(other, propagate);
28 | return other;
29 | }
30 | }
31 |
--------------------------------------------------------------------------------
/src/sporemodder/extras/spuieditor/components/cSPUILayerIdWinProc.java:
--------------------------------------------------------------------------------
1 | package sporemodder.extras.spuieditor.components;
2 |
3 | import sporemodder.extras.spuieditor.SPUIViewer;
4 | import sporemodder.extras.spuieditor.components.SPUIWinProc.SPUIDefaultWinProc;
5 | import sporemodder.files.formats.spui.InvalidBlockException;
6 | import sporemodder.files.formats.spui.SPUIBlock;
7 | import sporemodder.files.formats.spui.SPUIBuilder;
8 |
9 | public class cSPUILayerIdWinProc extends SPUIDefaultWinProc {
10 |
11 | public static final int TYPE = 0x02BCFC18;
12 |
13 | public cSPUILayerIdWinProc(SPUIBlock block) throws InvalidBlockException {
14 | super(block);
15 |
16 | addUnassignedInt2(block, 0x02BCFD66, 1);
17 | addUnassignedBoolean(block, 0x02BCFD64, true);
18 | addUnassignedBoolean(block, 0x02BCFD65, true);
19 | }
20 |
21 | public cSPUILayerIdWinProc(SPUIViewer viewer) {
22 | super(viewer);
23 |
24 | unassignedProperties.put(0x02BCFD66, (int) 1);
25 | unassignedProperties.put(0x02BCFD64, (boolean) true);
26 | unassignedProperties.put(0x02BCFD65, (boolean) true);
27 | }
28 |
29 | @Override
30 | public SPUIBlock saveComponent(SPUIBuilder builder) {
31 | SPUIBlock block = (SPUIBlock) super.saveComponent(builder);
32 |
33 | saveInt2(builder, block, 0x02BCFD66);
34 | saveBoolean(builder, block, 0x02BCFD64);
35 | saveBoolean(builder, block, 0x02BCFD65);
36 |
37 | return block;
38 | }
39 |
40 | protected cSPUILayerIdWinProc() {
41 | }
42 |
43 | @Override
44 | public cSPUILayerIdWinProc copyComponent(boolean propagate) {
45 | cSPUILayerIdWinProc other = new cSPUILayerIdWinProc();
46 | copyComponent(other, propagate);
47 | return other;
48 | }
49 |
50 | }
51 |
--------------------------------------------------------------------------------
/src/sporemodder/extras/spuieditor/components/cSPUILayoutZoom.java:
--------------------------------------------------------------------------------
1 | package sporemodder.extras.spuieditor.components;
2 |
3 | import java.awt.Rectangle;
4 |
5 | import sporemodder.extras.spuieditor.SPUIViewer;
6 | import sporemodder.extras.spuieditor.components.SPUIWinProc.SPUIDefaultWinProc;
7 | import sporemodder.files.formats.spui.InvalidBlockException;
8 | import sporemodder.files.formats.spui.SPUIBlock;
9 |
10 | public class cSPUILayoutZoom extends SPUIDefaultWinProc {
11 |
12 | public static final int TYPE = 0x04EA92A3;
13 |
14 | public cSPUILayoutZoom(SPUIBlock block) throws InvalidBlockException {
15 | super(block);
16 | }
17 |
18 | protected cSPUILayoutZoom() {
19 | super();
20 | }
21 |
22 | public cSPUILayoutZoom(SPUIViewer viewer) {
23 | super(viewer);
24 | }
25 |
26 | @Override
27 | public cSPUILayoutZoom copyComponent(boolean propagate) {
28 | cSPUILayoutZoom other = new cSPUILayoutZoom();
29 | copyComponent(other, propagate);
30 | return other;
31 | }
32 |
33 | @Override
34 | public void modify(WinComponent component) {
35 | if (component.getParent() == null) {
36 | return;
37 | }
38 |
39 | // Is this component only used from the code??
40 | float[] values = new float[] {0.0f, 0.0f, 1.0f, 1.0f};
41 | Rectangle result = component.getRealBounds();
42 | Rectangle parentBounds = component.getParent().getRealBounds();
43 |
44 | result.x = (int) (parentBounds.width * values[0]);
45 | result.y = (int) (parentBounds.height * values[1]);
46 | result.width = (int) (parentBounds.width * values[2] - parentBounds.width * values[0]);
47 | result.height = (int) (parentBounds.height * values[3] - parentBounds.height * values[1]);
48 | }
49 | }
50 |
--------------------------------------------------------------------------------
/src/sporemodder/extras/spuieditor/components/cSPUIMaterialEffect.java:
--------------------------------------------------------------------------------
1 | package sporemodder.extras.spuieditor.components;
2 |
3 | import sporemodder.extras.spuieditor.SPUIViewer;
4 | import sporemodder.files.formats.spui.InvalidBlockException;
5 | import sporemodder.files.formats.spui.SPUIBlock;
6 | import sporemodder.files.formats.spui.SPUIBuilder;
7 |
8 | public class cSPUIMaterialEffect extends UIEffect {
9 |
10 | public static final int TYPE = 0x02C200CE;
11 |
12 | public cSPUIMaterialEffect(SPUIBlock block) throws InvalidBlockException {
13 | super(block);
14 |
15 | addUnassignedText(block, 0x02C1F2C7, null);
16 | addUnassignedText(block, 0x02C1F2CA, null);
17 | addUnassignedBoolean(block, 0x02C1F2D4, false);
18 | }
19 |
20 | public cSPUIMaterialEffect(SPUIViewer viewer) {
21 | super(viewer);
22 |
23 | unassignedProperties.put(0x02C1F2C7, null);
24 | unassignedProperties.put(0x02C1F2CA, null);
25 | unassignedProperties.put(0x02C1F2D4, (boolean) false);
26 | }
27 |
28 | private cSPUIMaterialEffect() {
29 | super();
30 | }
31 |
32 | @Override
33 | public SPUIBlock saveComponent(SPUIBuilder builder) {
34 |
35 | SPUIBlock block = (SPUIBlock) super.saveComponent(builder);
36 |
37 | saveText(builder, block, 0x02C1F2C7);
38 | saveText(builder, block, 0x02C1F2CA);
39 | saveBoolean(builder, block, 0x02C1F2D4);
40 |
41 | return block;
42 | }
43 |
44 | @Override
45 | public cSPUIMaterialEffect copyComponent(boolean propagate) {
46 | cSPUIMaterialEffect eff = new cSPUIMaterialEffect();
47 | copyComponent(eff, propagate);
48 | return eff;
49 | }
50 |
51 | }
52 |
--------------------------------------------------------------------------------
/src/sporemodder/extras/spuieditor/components/cSPUIMaterialWinProc.java:
--------------------------------------------------------------------------------
1 | package sporemodder.extras.spuieditor.components;
2 |
3 | import sporemodder.extras.spuieditor.SPUIViewer;
4 | import sporemodder.extras.spuieditor.components.SPUIWinProc.SPUIDefaultWinProc;
5 | import sporemodder.files.formats.spui.InvalidBlockException;
6 | import sporemodder.files.formats.spui.SPUIBlock;
7 | import sporemodder.files.formats.spui.SPUIBuilder;
8 |
9 | public class cSPUIMaterialWinProc extends SPUIDefaultWinProc {
10 |
11 | public static final int TYPE = 0x02BCFC0E;
12 |
13 | public cSPUIMaterialWinProc(SPUIBlock block) throws InvalidBlockException {
14 | super(block);
15 |
16 | addUnassignedBoolean(block, 0x02BCB912, false);
17 | addUnassignedText(block, 0x02BCB913, null);
18 | }
19 |
20 | public cSPUIMaterialWinProc(SPUIViewer viewer) {
21 | super(viewer);
22 |
23 | unassignedProperties.put(0x02BCB912, (boolean) false);
24 | unassignedProperties.put(0x02BCB913, null);
25 | }
26 |
27 | @Override
28 | public SPUIBlock saveComponent(SPUIBuilder builder) {
29 |
30 | SPUIBlock block = (SPUIBlock) super.saveComponent(builder);
31 |
32 | saveBoolean(builder, block, 0x02BCB912);
33 |
34 | if (unassignedProperties.containsKey(0x02BCB913)) {
35 | saveText(builder, block, 0x02BCB913);
36 | }
37 |
38 | return block;
39 | }
40 |
41 | private cSPUIMaterialWinProc() {
42 | super();
43 | }
44 |
45 | @Override
46 | public cSPUIMaterialWinProc copyComponent(boolean propagate) {
47 | cSPUIMaterialWinProc other = new cSPUIMaterialWinProc();
48 | copyComponent(other, propagate);
49 | return other;
50 | }
51 |
52 | }
53 |
--------------------------------------------------------------------------------
/src/sporemodder/extras/spuieditor/components/cSPUIPopupMenuItemWin.java:
--------------------------------------------------------------------------------
1 | package sporemodder.extras.spuieditor.components;
2 |
3 | import java.io.IOException;
4 |
5 | import sporemodder.extras.spuieditor.SPUIViewer;
6 | import sporemodder.files.formats.spui.InvalidBlockException;
7 | import sporemodder.files.formats.spui.SPUIBlock;
8 |
9 | public class cSPUIPopupMenuItemWin extends WinButton {
10 |
11 | public static final int TYPE = 0x04C04B4E;
12 |
13 | public cSPUIPopupMenuItemWin(SPUIBlock block) throws InvalidBlockException, IOException {
14 | super(block);
15 | }
16 |
17 | public cSPUIPopupMenuItemWin(SPUIViewer viewer) {
18 | super(viewer);
19 | }
20 |
21 | private cSPUIPopupMenuItemWin() {
22 | super();
23 | }
24 |
25 | public cSPUIPopupMenuItemWin copyComponent(boolean propagateIndependent) {
26 | cSPUIPopupMenuItemWin other = new cSPUIPopupMenuItemWin();
27 | copyComponent(other, propagateIndependent);
28 | return other;
29 | }
30 |
31 | }
32 |
--------------------------------------------------------------------------------
/src/sporemodder/extras/spuieditor/components/cSPUIProgressBarGradientWin.java:
--------------------------------------------------------------------------------
1 | package sporemodder.extras.spuieditor.components;
2 |
3 | import java.io.IOException;
4 |
5 | import sporemodder.extras.spuieditor.SPUIViewer;
6 | import sporemodder.files.formats.spui.InvalidBlockException;
7 | import sporemodder.files.formats.spui.SPUIBlock;
8 | import sporemodder.files.formats.spui.SPUIBuilder;
9 |
10 | public class cSPUIProgressBarGradientWin extends Window {
11 |
12 | public static final int TYPE = 0x015CBBD6;
13 |
14 | public cSPUIProgressBarGradientWin(SPUIBlock block) throws InvalidBlockException, IOException {
15 | super(block);
16 |
17 | addUnassignedInt(block, 0x015CBE07, 0);
18 | addUnassignedInt(block, 0x015CBE08, 0);
19 | addUnassignedInt(block, 0x015CBE09, 0);
20 | addUnassignedInt(block, 0x015CBE0A, 0);
21 | addUnassignedShort(block, 0x015CBE06, null); // an Image
22 | }
23 |
24 | public cSPUIProgressBarGradientWin(SPUIViewer viewer) {
25 | super(viewer);
26 |
27 | unassignedProperties.put(0x015CBE07, (int) 0);
28 | unassignedProperties.put(0x015CBE08, (int) 0);
29 | unassignedProperties.put(0x015CBE09, (int) 0);
30 | unassignedProperties.put(0x015CBE0A, (int) 0);
31 | unassignedProperties.put(0x015CBE06, null);
32 | }
33 |
34 | private cSPUIProgressBarGradientWin() {
35 | super();
36 | }
37 |
38 | @Override
39 | public cSPUIProgressBarGradientWin copyComponent(boolean propagateIndependent) {
40 | cSPUIProgressBarGradientWin other = new cSPUIProgressBarGradientWin();
41 | copyComponent(other, propagateIndependent);
42 |
43 | return other;
44 | }
45 |
46 | @Override
47 | public SPUIBlock saveComponent(SPUIBuilder builder) {
48 | SPUIBlock block = super.saveComponent(builder);
49 |
50 | saveInt(builder, block, 0x015CBE07);
51 | saveInt(builder, block, 0x015CBE08);
52 | saveInt(builder, block, 0x015CBE09);
53 | saveInt(builder, block, 0x015CBE0A);
54 | saveReference(builder, block, 0x015CBE06);
55 |
56 | return block;
57 | }
58 |
59 | @Override
60 | protected boolean shouldUseFillColor() {
61 | return false;
62 | }
63 | }
64 |
--------------------------------------------------------------------------------
/src/sporemodder/extras/spuieditor/components/cSPUIProgressBarWin.java:
--------------------------------------------------------------------------------
1 | package sporemodder.extras.spuieditor.components;
2 |
3 | import java.io.IOException;
4 |
5 | import sporemodder.extras.spuieditor.SPUIViewer;
6 | import sporemodder.files.formats.spui.InvalidBlockException;
7 | import sporemodder.files.formats.spui.SPUIBlock;
8 |
9 | public class cSPUIProgressBarWin extends Window {
10 |
11 | public static final int TYPE = 0x010EDE03;
12 |
13 | public cSPUIProgressBarWin(SPUIBlock block) throws InvalidBlockException, IOException {
14 | super(block);
15 | }
16 |
17 | private cSPUIProgressBarWin() {
18 | super();
19 | }
20 |
21 | public cSPUIProgressBarWin(SPUIViewer viewer) {
22 | super(viewer);
23 | }
24 |
25 | @Override
26 | public cSPUIProgressBarWin copyComponent(boolean propagateIndependent) {
27 | cSPUIProgressBarWin other = new cSPUIProgressBarWin();
28 | copyComponent(other, propagateIndependent);
29 |
30 | return other;
31 | }
32 |
33 | }
34 |
--------------------------------------------------------------------------------
/src/sporemodder/extras/spuieditor/components/cSPUIRotateEffect.java:
--------------------------------------------------------------------------------
1 | package sporemodder.extras.spuieditor.components;
2 |
3 | import sporemodder.extras.spuieditor.SPUIViewer;
4 | import sporemodder.files.formats.spui.InvalidBlockException;
5 | import sporemodder.files.formats.spui.SPUIBlock;
6 | import sporemodder.files.formats.spui.SPUIBuilder;
7 |
8 | public class cSPUIRotateEffect extends RotateEffect {
9 |
10 | public static final int TYPE = 0x02086743;
11 |
12 | public cSPUIRotateEffect(SPUIBlock block) throws InvalidBlockException {
13 | super(block);
14 |
15 | addUnassignedFloat(block, 0x02086A1D, 0);
16 | }
17 |
18 | public cSPUIRotateEffect(SPUIViewer viewer) {
19 | super(viewer);
20 |
21 | unassignedProperties.put(0x02086A1D, (float) 0);
22 | }
23 |
24 | @Override
25 | public SPUIBlock saveComponent(SPUIBuilder builder) {
26 |
27 | SPUIBlock block = (SPUIBlock) super.saveComponent(builder);
28 |
29 | saveFloat(builder, block, 0x02086A1D);
30 |
31 | return block;
32 | }
33 |
34 | private cSPUIRotateEffect() {
35 | super();
36 | }
37 |
38 | @Override
39 | public cSPUIRotateEffect copyComponent(boolean propagateIndependent) {
40 | cSPUIRotateEffect eff = new cSPUIRotateEffect();
41 | copyComponent(eff, propagateIndependent);
42 | return eff;
43 | }
44 |
45 | }
46 |
--------------------------------------------------------------------------------
/src/sporemodder/extras/spuieditor/components/cSPUISwarmEffect.java:
--------------------------------------------------------------------------------
1 | package sporemodder.extras.spuieditor.components;
2 |
3 | import sporemodder.extras.spuieditor.SPUIViewer;
4 | import sporemodder.files.formats.spui.InvalidBlockException;
5 | import sporemodder.files.formats.spui.SPUIBlock;
6 | import sporemodder.files.formats.spui.SPUIBuilder;
7 |
8 | public class cSPUISwarmEffect extends UIEffect {
9 |
10 | public static final int TYPE = 0x0238EA36;
11 |
12 | public cSPUISwarmEffect(SPUIBlock block) throws InvalidBlockException {
13 | super(block);
14 |
15 | addUnassignedText(block, 0x0238EC88, null);
16 | }
17 |
18 | public cSPUISwarmEffect(SPUIViewer viewer) {
19 | super(viewer);
20 |
21 | unassignedProperties.put(0x0238EC88, null);
22 | }
23 |
24 | private cSPUISwarmEffect() {
25 | super();
26 | }
27 |
28 | @Override
29 | public SPUIBlock saveComponent(SPUIBuilder builder) {
30 |
31 | SPUIBlock block = (SPUIBlock) super.saveComponent(builder);
32 |
33 | saveText(builder, block, 0x0238EC88);
34 |
35 | return block;
36 | }
37 |
38 | @Override
39 | public cSPUISwarmEffect copyComponent(boolean propagateIndependent) {
40 | cSPUISwarmEffect eff = new cSPUISwarmEffect();
41 | copyComponent(eff, propagateIndependent);
42 | return eff;
43 | }
44 |
45 | }
46 |
--------------------------------------------------------------------------------
/src/sporemodder/extras/spuieditor/components/cSPUITextWin.java:
--------------------------------------------------------------------------------
1 | package sporemodder.extras.spuieditor.components;
2 |
3 | import java.io.IOException;
4 |
5 | import sporemodder.extras.spuieditor.SPUIViewer;
6 | import sporemodder.files.formats.spui.InvalidBlockException;
7 | import sporemodder.files.formats.spui.SPUIBlock;
8 |
9 | public class cSPUITextWin extends WinText {
10 |
11 | public static final int TYPE = 0x039A721C;
12 |
13 | public cSPUITextWin(SPUIBlock block) throws InvalidBlockException, IOException {
14 | super(block);
15 | }
16 |
17 | public cSPUITextWin(SPUIViewer viewer) {
18 | super(viewer);
19 | }
20 |
21 | protected cSPUITextWin() {
22 | super();
23 | }
24 |
25 | public cSPUITextWin copyComponent(boolean propagateIndependent) {
26 | cSPUITextWin other = new cSPUITextWin();
27 | super.copyComponent(other, propagateIndependent);
28 | return other;
29 | }
30 | }
31 |
--------------------------------------------------------------------------------
/src/sporemodder/extras/spuieditor/resources/arialunicodeea.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/emd4600/SporeModder/142fdcf1c2472b1ceacc2168eb76446840723208/src/sporemodder/extras/spuieditor/resources/arialunicodeea.ttf
--------------------------------------------------------------------------------
/src/sporemodder/extras/spuieditor/resources/layout_bottom.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/emd4600/SporeModder/142fdcf1c2472b1ceacc2168eb76446840723208/src/sporemodder/extras/spuieditor/resources/layout_bottom.png
--------------------------------------------------------------------------------
/src/sporemodder/extras/spuieditor/resources/layout_horizontal_fill.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/emd4600/SporeModder/142fdcf1c2472b1ceacc2168eb76446840723208/src/sporemodder/extras/spuieditor/resources/layout_horizontal_fill.png
--------------------------------------------------------------------------------
/src/sporemodder/extras/spuieditor/resources/layout_left.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/emd4600/SporeModder/142fdcf1c2472b1ceacc2168eb76446840723208/src/sporemodder/extras/spuieditor/resources/layout_left.png
--------------------------------------------------------------------------------
/src/sporemodder/extras/spuieditor/resources/layout_right.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/emd4600/SporeModder/142fdcf1c2472b1ceacc2168eb76446840723208/src/sporemodder/extras/spuieditor/resources/layout_right.png
--------------------------------------------------------------------------------
/src/sporemodder/extras/spuieditor/resources/layout_top.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/emd4600/SporeModder/142fdcf1c2472b1ceacc2168eb76446840723208/src/sporemodder/extras/spuieditor/resources/layout_top.png
--------------------------------------------------------------------------------
/src/sporemodder/extras/spuieditor/resources/layout_vertical_fill.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/emd4600/SporeModder/142fdcf1c2472b1ceacc2168eb76446840723208/src/sporemodder/extras/spuieditor/resources/layout_vertical_fill.png
--------------------------------------------------------------------------------
/src/sporemodder/extras/spuieditor/resources/maxispassword.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/emd4600/SporeModder/142fdcf1c2472b1ceacc2168eb76446840723208/src/sporemodder/extras/spuieditor/resources/maxispassword.ttf
--------------------------------------------------------------------------------
/src/sporemodder/extras/spuieditor/resources/palatinosanseabold.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/emd4600/SporeModder/142fdcf1c2472b1ceacc2168eb76446840723208/src/sporemodder/extras/spuieditor/resources/palatinosanseabold.ttf
--------------------------------------------------------------------------------
/src/sporemodder/extras/spuieditor/resources/sporecurrencyea.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/emd4600/SporeModder/142fdcf1c2472b1ceacc2168eb76446840723208/src/sporemodder/extras/spuieditor/resources/sporecurrencyea.ttf
--------------------------------------------------------------------------------
/src/sporemodder/extras/spuieditor/resources/trebucheteabold.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/emd4600/SporeModder/142fdcf1c2472b1ceacc2168eb76446840723208/src/sporemodder/extras/spuieditor/resources/trebucheteabold.ttf
--------------------------------------------------------------------------------
/src/sporemodder/extras/spuieditor/uidesigner/DesignerElement.java:
--------------------------------------------------------------------------------
1 | package sporemodder.extras.spuieditor.uidesigner;
2 |
3 | import java.util.List;
4 |
5 | import sporemodder.extras.spuieditor.PropertiesPanel;
6 | import sporemodder.extras.spuieditor.SPUIEditor;
7 | import sporemodder.extras.spuieditor.uidesigner.DesignerClass.DesignerClassDelegate;
8 |
9 | public interface DesignerElement extends DesignerNode {
10 |
11 | public void fillPropertiesPanel(PropertiesPanel panel, DesignerClassDelegate delegate, SPUIEditor editor);
12 |
13 | public void getDesignerElements(List list);
14 |
15 | public String getName();
16 |
17 | public UIDesigner getDesigner();
18 |
19 | }
20 |
--------------------------------------------------------------------------------
/src/sporemodder/extras/spuieditor/uidesigner/DesignerEnum.java:
--------------------------------------------------------------------------------
1 | package sporemodder.extras.spuieditor.uidesigner;
2 |
3 | import java.util.ArrayList;
4 | import java.util.HashMap;
5 | import java.util.List;
6 |
7 | import org.xml.sax.Attributes;
8 | import org.xml.sax.SAXException;
9 |
10 | public class DesignerEnum implements DesignerNode {
11 |
12 | private String name;
13 | private final HashMap intValues = new HashMap();
14 | private final HashMap stringValues = new HashMap();
15 | private final List values = new ArrayList();
16 |
17 | @Override
18 | public void parseElement(String uri, String localName, String qName, Attributes attributes) throws SAXException {
19 |
20 | if (qName.equalsIgnoreCase("Enum")) {
21 | name = attributes.getValue("name");
22 | }
23 | else if (qName.equalsIgnoreCase("EnumVal")) {
24 | String name = attributes.getValue("name");
25 | int index = Integer.decode(attributes.getValue("value"));
26 |
27 | intValues.put(index, name);
28 | stringValues.put(name, index);
29 | values.add(name);
30 | }
31 | }
32 |
33 | public String getName() {
34 | return name;
35 | }
36 |
37 | public void setName(String name) {
38 | this.name = name;
39 | }
40 |
41 | public String getValue(int index) {
42 | return intValues.get(index);
43 | }
44 |
45 | public int getValue(String value) {
46 | return stringValues.get(value);
47 | }
48 |
49 | public List getStringValues() {
50 | return values;
51 | }
52 | }
53 |
--------------------------------------------------------------------------------
/src/sporemodder/extras/spuieditor/uidesigner/DesignerNode.java:
--------------------------------------------------------------------------------
1 | package sporemodder.extras.spuieditor.uidesigner;
2 |
3 | import org.xml.sax.Attributes;
4 | import org.xml.sax.SAXException;
5 |
6 | public interface DesignerNode {
7 |
8 | public void parseElement(String uri, String localName,String qName, Attributes attributes) throws SAXException;
9 |
10 | }
11 |
--------------------------------------------------------------------------------
/src/sporemodder/files/ActionCommand.java:
--------------------------------------------------------------------------------
1 | package sporemodder.files;
2 |
3 | import java.io.File;
4 | import java.util.ArrayList;
5 | import java.util.List;
6 |
7 | import sporemodder.files.formats.ConvertAction;
8 | import sporemodder.utilities.InputOutputPaths;
9 | import sporemodder.utilities.InputOutputPaths.InputOutputPair;
10 |
11 | public class ActionCommand {
12 |
13 | public static void parseDefaultArguments(String[] args, List inputs, List outputs) {
14 | int index = 0;
15 | while (index < args.length) {
16 | if (args[index].equals(ConvertAction.KEYWORD_INPUTS)) {
17 | index++;
18 | while (index < args.length && !args[index].startsWith("-")) {
19 | inputs.add(args[index++]);
20 | }
21 | } else if (args[index].equals(ConvertAction.KEYWORD_OUTPUTS)) {
22 | index++;
23 | while (index < args.length && !args[index].startsWith("-")) {
24 | outputs.add(args[index++]);
25 | }
26 | } else {
27 | // ignore argument or do whatever you want with it
28 | index++;
29 | }
30 | }
31 | }
32 |
33 | public static List parseDefaultArguments(String[] args, String inputExtension, String outputExtension, boolean removeExtension) {
34 | List inputs = new ArrayList();
35 | List outputs = new ArrayList();
36 | parseDefaultArguments(args, inputs, outputs);
37 |
38 | if (inputs.size() == 0) {
39 | return null;
40 | }
41 |
42 | List pairs = null;
43 | if (outputs.size() > 0) {
44 | String[] outputArray = (String[]) outputs.toArray(new String[outputs.size()]);
45 | pairs = InputOutputPaths.parsePairs(
46 | (String[]) inputs.toArray(new String[inputs.size()]),
47 | outputArray,
48 | inputExtension,
49 | outputExtension,
50 | removeExtension);
51 | } else {
52 | pairs = new ArrayList();
53 | for (String s : inputs) {
54 | String name = s;
55 | if (removeExtension) {
56 | name = name.substring(0, name.indexOf("."));
57 | }
58 | name += "." + outputExtension;
59 | pairs.add(new InputOutputPair(s, name));
60 | }
61 | }
62 |
63 | return pairs;
64 | }
65 |
66 | public static File replaceFileExtension(File file, String extension) {
67 | String name = file.getName();
68 | int index = name.indexOf(".");
69 | if (index != -1) {
70 | name = name.substring(0, index);
71 | }
72 | name += extension;
73 |
74 | return new File(file.getParentFile(), name);
75 | }
76 | }
77 |
--------------------------------------------------------------------------------
/src/sporemodder/files/FileStructureException.java:
--------------------------------------------------------------------------------
1 | package sporemodder.files;
2 |
3 | public class FileStructureException extends Exception {
4 | /**
5 | *
6 | */
7 | private static final long serialVersionUID = -7091301181675449390L;
8 | public FileStructureException() { super(); }
9 | public FileStructureException(String message) { super(message); }
10 | public FileStructureException(String message, Throwable cause) { super(message, cause); }
11 | public FileStructureException(Throwable cause) { super(cause); }
12 | }
13 |
--------------------------------------------------------------------------------
/src/sporemodder/files/ReadWriteStreamAccessor.java:
--------------------------------------------------------------------------------
1 | package sporemodder.files;
2 |
3 | public interface ReadWriteStreamAccessor extends InputStreamAccessor, OutputStreamAccessor {
4 |
5 | }
6 |
--------------------------------------------------------------------------------
/src/sporemodder/files/StreamAccessor.java:
--------------------------------------------------------------------------------
1 | package sporemodder.files;
2 |
3 | import java.io.Closeable;
4 | import java.io.IOException;
5 |
6 | public interface StreamAccessor extends Closeable {
7 | public void seek(int off) throws IOException;
8 | public void seekAbs(int off) throws IOException;
9 | public void skipBytes(int len) throws IOException;
10 |
11 | public void close() throws IOException;
12 | public int length() throws IOException;
13 | public void setLength(int len) throws IOException;
14 |
15 | public int getFilePointer() throws IOException;
16 | public int getFilePointerAbs() throws IOException;
17 |
18 | public void setBaseOffset(int val) throws IOException;
19 | public int getBaseOffset() throws IOException;
20 | }
21 |
--------------------------------------------------------------------------------
/src/sporemodder/files/formats/ConvertAction.java:
--------------------------------------------------------------------------------
1 | package sporemodder.files.formats;
2 |
3 | import java.io.File;
4 |
5 | import javax.swing.JPanel;
6 |
7 | import sporemodder.files.InputStreamAccessor;
8 | import sporemodder.files.OutputStreamAccessor;
9 |
10 | public interface ConvertAction {
11 | public static final String KEYWORD_INPUTS = "-i";
12 | public static final String KEYWORD_OUTPUTS = "-o";
13 |
14 | public FileFormatStructure convert(File input, File output) throws Exception;
15 | public FileFormatStructure convert(InputStreamAccessor input, OutputStreamAccessor output) throws Exception;
16 | public FileFormatStructure convert(InputStreamAccessor input, String outputPath) throws Exception;
17 | public FileFormatStructure convert(String inputPath, OutputStreamAccessor output) throws Exception;
18 | public FileFormatStructure process(File input) throws Exception;
19 |
20 | public boolean isValid(ResourceKey key);
21 | public boolean isValid(String extension);
22 | public boolean isValid(File file);
23 |
24 | public File getOutputFile(File file);
25 | public String getOutputExtension(String extension);
26 | public int getOutputExtensionID(String extension);
27 |
28 | public JPanel createOptionsPanel();
29 | }
30 |
--------------------------------------------------------------------------------
/src/sporemodder/files/formats/FastConvertAction.java:
--------------------------------------------------------------------------------
1 | package sporemodder.files.formats;
2 |
3 | import java.io.File;
4 |
5 | import sporemodder.files.MemoryOutputStream;
6 | import sporemodder.files.formats.dbpf.DBPFPackingTask;
7 |
8 | public interface FastConvertAction extends ConvertAction {
9 |
10 | public MemoryOutputStream fastConvert(File input, DBPFPackingTask outputDBPF) throws Exception;
11 | }
12 |
--------------------------------------------------------------------------------
/src/sporemodder/files/formats/FileFormatStructure.java:
--------------------------------------------------------------------------------
1 | package sporemodder.files.formats;
2 |
3 | import java.io.IOException;
4 | import java.util.List;
5 |
6 | import sporemodder.files.OutputStreamAccessor;
7 |
8 | public interface FileFormatStructure {
9 |
10 | public List getAllErrors();
11 |
12 | public void write(OutputStreamAccessor out) throws IOException;
13 |
14 |
15 | public static class DefaulFormatStructure implements FileFormatStructure {
16 |
17 | @Override
18 | public List getAllErrors() {
19 | return null;
20 | }
21 |
22 | @Override
23 | public void write(OutputStreamAccessor out) throws IOException {
24 | }
25 |
26 | }
27 | }
28 |
--------------------------------------------------------------------------------
/src/sporemodder/files/formats/FileStructureError.java:
--------------------------------------------------------------------------------
1 | package sporemodder.files.formats;
2 |
3 | import java.util.List;
4 |
5 | public class FileStructureError {
6 | private String errorCode;
7 | private int position;
8 |
9 | public FileStructureError(String errorCode, int position) {
10 | this.errorCode = errorCode;
11 | this.position = position;
12 | }
13 |
14 | @Override
15 | public String toString() {
16 | return "FileStructureError [errorCode=" + errorCode + ", position="
17 | + position + "]";
18 | }
19 |
20 | public static String getErrorsString(List errors) {
21 | String lineSeparator = System.getProperty("line.separator");
22 | StringBuilder sb = new StringBuilder();
23 | for (FileStructureError error : errors) {
24 | sb.append(error.toString());
25 | sb.append(lineSeparator);
26 | }
27 |
28 | return sb.toString();
29 | }
30 |
31 | public static String getErrorsString(List errors, String prefix) {
32 | String lineSeparator = System.getProperty("line.separator");
33 | StringBuilder sb = new StringBuilder();
34 | for (FileStructureError error : errors) {
35 | sb.append(prefix + error.toString());
36 | sb.append(lineSeparator);
37 | }
38 |
39 | return sb.toString();
40 | }
41 | }
42 |
--------------------------------------------------------------------------------
/src/sporemodder/files/formats/LocaleFile.java:
--------------------------------------------------------------------------------
1 | package sporemodder.files.formats;
2 |
3 | import java.io.BufferedReader;
4 | import java.io.File;
5 | import java.io.FileReader;
6 | import java.io.IOException;
7 | import java.util.HashMap;
8 |
9 | public class LocaleFile extends HashMap {
10 |
11 | public LocaleFile(File file) throws NumberFormatException, IOException {
12 | read(file);
13 | }
14 |
15 | public LocaleFile(BufferedReader reader) throws NumberFormatException, IOException {
16 | read(reader);
17 | }
18 |
19 | public void read(BufferedReader reader) throws NumberFormatException, IOException {
20 |
21 | String line = null;
22 | while ((line = reader.readLine()) != null) {
23 | if (line.startsWith("0x")) {
24 | String[] splits = line.split(" ", 2);
25 |
26 | put(Integer.parseUnsignedInt(splits[0].substring(2), 16), splits[1]);
27 | }
28 | }
29 | }
30 |
31 | public void read(File file) throws NumberFormatException, IOException {
32 | try (BufferedReader reader = new BufferedReader(new FileReader(file))) {
33 | read(reader);
34 | }
35 | }
36 | }
37 |
--------------------------------------------------------------------------------
/src/sporemodder/files/formats/LocalizedText.java:
--------------------------------------------------------------------------------
1 | package sporemodder.files.formats;
2 |
3 | import sporemodder.utilities.Hasher;
4 |
5 | public class LocalizedText {
6 |
7 | public int tableID = -1;
8 | public int instanceID = -1;
9 | public String text = null;
10 |
11 | private static final String DEFAULT_STRING = "null";
12 |
13 | @Override
14 | public String toString() {
15 | if (text == null || text.length() == 0) {
16 | if (tableID == -1 && instanceID == -1) {
17 | return DEFAULT_STRING;
18 | }
19 | return "(" + Hasher.getFileName(tableID) + "!" + Hasher.getFileName(instanceID) + ")";
20 | } else {
21 | return "\"" + text + "\"";
22 | }
23 | }
24 |
25 | public String getString() {
26 | if (text == null || text.length() == 0) {
27 | return "(" + Hasher.getFileName(tableID) + "!" + Hasher.getFileName(instanceID) + ")";
28 | } else {
29 | return text;
30 | }
31 | }
32 |
33 | public String getLocaleInfoString() {
34 | return "(" + Hasher.getFileName(tableID) + "!" + Hasher.getFileName(instanceID) + ")";
35 | }
36 |
37 | public LocalizedText(String text) {
38 | this.text = text;
39 | }
40 |
41 | public LocalizedText(int tableID, int instanceID) {
42 | this.tableID = tableID;
43 | this.instanceID = instanceID;
44 | }
45 |
46 | public LocalizedText(LocalizedText text) {
47 | copy(text);
48 | }
49 |
50 | public void copy(LocalizedText other) {
51 | if (other != null) {
52 | this.text = other.text;
53 | this.tableID = other.tableID;
54 | this.instanceID = other.instanceID;
55 | }
56 | }
57 |
58 | public static boolean isValid(LocalizedText text) {
59 | return text != null && (text.text != null || text.tableID != -1 || text.instanceID != -1);
60 | }
61 | }
62 |
--------------------------------------------------------------------------------
/src/sporemodder/files/formats/anim/Animation.java:
--------------------------------------------------------------------------------
1 | package sporemodder.files.formats.anim;
2 |
3 | import java.io.IOException;
4 |
5 | import sporemodder.MainApp;
6 | import sporemodder.files.FileStreamAccessor;
7 | import sporemodder.files.InputStreamAccessor;
8 | import sporemodder.utilities.Hasher;
9 |
10 | public class Animation {
11 |
12 | private static final int kMaxPath = 260;
13 |
14 | private int version;
15 | private int animID;
16 |
17 | public void read(byte[] data) throws IOException {
18 |
19 | DataReader in = new DataReader(data);
20 |
21 | int header = in.getInt(0);
22 |
23 | if (header != 0x4D494E41) {
24 | throw new UnsupportedOperationException("Unknown magic value (" + Hasher.hashToHex(header, "0x") + ") in animation.");
25 | }
26 |
27 | // fileSize
28 |
29 | version = in.getInt(8);
30 | if (version > 25 || version < 6) {
31 | throw new UnsupportedOperationException("Bad version (" + version + ") in animation.");
32 | }
33 |
34 | if (version < 14) {
35 | //TODO: sub_9A8600
36 | // it's to get the real file size
37 | }
38 |
39 | // in.skipBytes(kMaxPath); // the original filepath
40 |
41 | animID = in.getInt(0x110);
42 | // /* 114h */ uint32_t groupID;
43 | //TODO the things between, we are at 0x114 now
44 |
45 |
46 | // There's an array of 'count' pointers (so offsets in the file) at 'offset'
47 | int arrayCount = in.getInt(0x14C);
48 | int arrayOffset = in.getInt(0x150);
49 |
50 |
51 | int count = in.getInt(0x144);
52 | int offset = in.getInt(0x148);
53 |
54 | for (int i = 0; i < count; i++) {
55 |
56 | int blockOffset = in.getInt(offset, i);
57 | DataReader blockData = new DataReader(in, blockOffset);
58 |
59 | //TODO: sub_9A8550
60 |
61 | int field_DC = blockData.getInt(0xDC);
62 | if (field_DC <= 0) continue;
63 |
64 | for (int j = 0; j < field_DC; j++) {
65 |
66 | }
67 | }
68 | }
69 |
70 | public void print() {
71 | System.out.println(Hasher.getFileName(animID));
72 | }
73 |
74 | public static void main(String[] args) throws IOException {
75 |
76 | MainApp.init();
77 |
78 | String inputPath = "E:\\Eric\\SporeModder\\Projects\\Spore_EP1_Data\\animations~\\EP1_warrior_missile_v1.animation";
79 |
80 | try (InputStreamAccessor in = new FileStreamAccessor(inputPath, "r")) {
81 |
82 | Animation anim = new Animation();
83 |
84 | anim.read(in);
85 |
86 | anim.print();
87 | }
88 | }
89 | }
90 |
--------------------------------------------------------------------------------
/src/sporemodder/files/formats/anim/DataReader.java:
--------------------------------------------------------------------------------
1 | package sporemodder.files.formats.anim;
2 |
3 | import java.nio.ByteBuffer;
4 | import java.nio.ByteOrder;
5 | import java.util.Arrays;
6 |
7 | public class DataReader {
8 |
9 | private byte[] data;
10 | private int pointer;
11 |
12 | public DataReader(byte[] data) {
13 | this.data = data;
14 | this.pointer = 0;
15 | }
16 |
17 | public DataReader(DataReader other, int pointer) {
18 | this.data = other.data;
19 | this.pointer = pointer;
20 | }
21 |
22 | public int getInt(int offset) {
23 | ByteBuffer bb = ByteBuffer.wrap(Arrays.copyOfRange(data, pointer + offset, pointer + offset + 4)).order(ByteOrder.LITTLE_ENDIAN);
24 | return bb.getInt();
25 | }
26 |
27 | public float getFloat(int offset) {
28 | ByteBuffer bb = ByteBuffer.wrap(Arrays.copyOfRange(data, pointer + offset, pointer + offset + 4)).order(ByteOrder.LITTLE_ENDIAN);
29 | return bb.getFloat();
30 | }
31 |
32 | // Treats offset as an array
33 | public int getInt(int offset, int index) {
34 | ByteBuffer bb = ByteBuffer.wrap(Arrays.copyOfRange(data, pointer + offset + index*4, pointer + offset + index*4 + 4)).order(ByteOrder.LITTLE_ENDIAN);
35 | return bb.getInt();
36 | }
37 |
38 | // Treats offset as an array
39 | public float getFloat(int offset, int index) {
40 | ByteBuffer bb = ByteBuffer.wrap(Arrays.copyOfRange(data, pointer + offset + index*4, pointer + offset + index*4 + 4)).order(ByteOrder.LITTLE_ENDIAN);
41 | return bb.getFloat();
42 | }
43 | }
44 |
--------------------------------------------------------------------------------
/src/sporemodder/files/formats/argscript/ArgScriptArgumentable.java:
--------------------------------------------------------------------------------
1 | package sporemodder.files.formats.argscript;
2 |
3 | import java.util.ArrayList;
4 | import java.util.List;
5 |
6 | public abstract class ArgScriptArgumentable {
7 | //protected String keyword
8 | protected List splits;
9 |
10 | protected void splitArguments(String str, int limit) {
11 | // we want to avoid it splitting arrays like (0, 1, 2)
12 | String[] strings = str.trim().split("(?(strings.length);
14 | for (String s : strings) {
15 | splits.add(s);
16 | }
17 | }
18 |
19 | protected void splitArguments(String str) {
20 | // we want to avoid it splitting arrays like (0, 1, 2)
21 | String[] strings = str.trim().split("(?(strings.length);
23 | for (String s : strings) {
24 | splits.add(s);
25 | }
26 | }
27 |
28 | public List getArguments() {
29 | return splits.subList(1, splits.size());
30 | }
31 |
32 | public String getLastArgument() {
33 | return splits.get(splits.size() - 1);
34 | }
35 |
36 | public int getArgumentCount() {
37 | return splits.size() - 1;
38 | }
39 |
40 | public List getArguments(int min, int max) throws ArgScriptException {
41 | int numArguments = splits.size() - 1;
42 | if (numArguments < min) {
43 | throw new ArgScriptException(String.format("Expecting at least %d arguments for option %s", min, splits.get(0)));
44 | }
45 | else if (numArguments > max) {
46 | throw new ArgScriptException(String.format("Expecting at most %d arguments for option %s", max, splits.get(0)));
47 | }
48 |
49 | return splits.subList(1, numArguments + 1);
50 | }
51 |
52 | public List getArguments(int num) throws ArgScriptException {
53 | return getArguments(num, num);
54 | }
55 |
56 | public String getSingleArgument() throws ArgScriptException {
57 | return getArguments(1, 1).get(0);
58 | }
59 |
60 | public boolean addArgument(String argument) {
61 | return splits.add(argument);
62 | }
63 |
64 | public abstract String getKeyword();
65 | }
66 |
--------------------------------------------------------------------------------
/src/sporemodder/files/formats/argscript/ArgScriptCommand.java:
--------------------------------------------------------------------------------
1 | package sporemodder.files.formats.argscript;
2 |
3 | import java.util.ArrayList;
4 |
5 | import sporemodder.files.formats.argscript.ArgScript.ArgScriptType;
6 |
7 | public class ArgScriptCommand extends ArgScriptOptionable {
8 |
9 | public ArgScriptCommand(String str) {
10 | String[] strings = str.split("\\s-(?=[a-zA-Z])");
11 | splitArguments(strings[0]);
12 |
13 | for (int i = 1; i < strings.length; i++) {
14 | ArgScriptOption option = new ArgScriptOption(strings[i].trim());
15 | options.put(option.getKeyword(), option);
16 | }
17 | }
18 |
19 | public ArgScriptCommand(String str, int argumentLimit) {
20 | String[] strings = str.split("\\s-(?=[a-zA-Z])");
21 | splitArguments(strings[0], argumentLimit + 1);
22 |
23 | for (int i = 1; i < strings.length; i++) {
24 | ArgScriptOption option = new ArgScriptOption(strings[i].trim());
25 | options.put(option.getKeyword(), option);
26 | }
27 | }
28 |
29 | public ArgScriptCommand(String keyword, String ... arguments) {
30 | splits = new ArrayList();
31 | splits.add(keyword);
32 |
33 | for (String arg : arguments) {
34 | splits.add(arg);
35 | }
36 | }
37 |
38 | @Override
39 | public String toString() {
40 | StringBuilder sb = new StringBuilder();
41 | int size = splits.size();
42 | for (int i = 0; i < size; i++) {
43 | sb.append(splits.get(i));
44 | if (i != size-1) {
45 | sb.append(" ");
46 | }
47 | }
48 |
49 | for (ArgScriptOption option : options.values()) {
50 | sb.append(" -");
51 | sb.append(option.toString());
52 | }
53 |
54 | if (comment != null) {
55 | sb.append(" // ");
56 | sb.append(comment);
57 | }
58 |
59 | return sb.toString();
60 | }
61 |
62 | @Override
63 | public String getKeyword() {
64 | return splits.get(0);
65 | }
66 |
67 | @Override
68 | public ArgScriptType getType() {
69 | return ArgScriptType.COMMAND;
70 | }
71 |
72 |
73 | }
74 |
--------------------------------------------------------------------------------
/src/sporemodder/files/formats/argscript/ArgScriptEnum.java:
--------------------------------------------------------------------------------
1 | package sporemodder.files.formats.argscript;
2 |
3 | public class ArgScriptEnum {
4 | public static final String DEFAULT_KEY = "ErrorKeyNotFound";
5 | private String[] keys;
6 | private int[] values;
7 | private int defaultValue = -1;
8 | private String defaultKey = DEFAULT_KEY;
9 |
10 | public ArgScriptEnum(String[] keys, int[] values) {
11 | if (keys.length != values.length) {
12 | throw new IllegalArgumentException("Enum length mismatch error");
13 | }
14 | this.keys = keys;
15 | this.values = values;
16 | }
17 |
18 | public ArgScriptEnum(String[] keys, int[] values, int defaultValue, String defaultKey) {
19 | this(keys, values);
20 | this.defaultValue = defaultValue;
21 | this.defaultKey = defaultKey;
22 | }
23 |
24 | public int getValue(String key) {
25 | for (int i = 0; i < keys.length; i++) {
26 | if (keys[i].equals(key)) {
27 | return values[i];
28 | }
29 | }
30 | return defaultValue;
31 | }
32 |
33 | public String getKey(int value) {
34 | for (int i = 0; i < keys.length; i++) {
35 | if (values[i] == value) {
36 | return keys[i];
37 | }
38 | }
39 | return defaultKey;
40 | }
41 |
42 | public String[] getKeys() {
43 | return keys;
44 | }
45 |
46 | public int[] getValues() {
47 | return values;
48 | }
49 |
50 | public int getDefaultValue() {
51 | return defaultValue;
52 | }
53 |
54 | public String getDefaultKey() {
55 | return defaultKey;
56 | }
57 |
58 |
59 | }
60 |
--------------------------------------------------------------------------------
/src/sporemodder/files/formats/argscript/ArgScriptException.java:
--------------------------------------------------------------------------------
1 | package sporemodder.files.formats.argscript;
2 |
3 | public class ArgScriptException extends Exception {
4 |
5 | /**
6 | *
7 | */
8 | private static final long serialVersionUID = -6116810988239270009L;
9 |
10 | public ArgScriptException(String message) {
11 | super(message);
12 | }
13 | }
14 |
--------------------------------------------------------------------------------
/src/sporemodder/files/formats/argscript/ArgScriptOption.java:
--------------------------------------------------------------------------------
1 | package sporemodder.files.formats.argscript;
2 |
3 | import java.util.ArrayList;
4 |
5 | public class ArgScriptOption extends ArgScriptArgumentable {
6 | public ArgScriptOption(String str) {
7 | splitArguments(str);
8 | }
9 |
10 | public ArgScriptOption(String keyword, String ... args) {
11 | splits = new ArrayList(args.length + 1);
12 | splits.add(keyword);
13 |
14 | for (String arg : args) {
15 | splits.add(arg);
16 | }
17 | }
18 |
19 | @Override
20 | public String toString() {
21 | StringBuilder sb = new StringBuilder();
22 | int size = splits.size();
23 | for (int i = 0; i < size; i++) {
24 | sb.append(splits.get(i));
25 | if (i != size-1) sb.append(" ");
26 | }
27 | return sb.toString();
28 | }
29 |
30 | public String getKeyword() {
31 | return splits.get(0);
32 | }
33 |
34 | public boolean isFlag() {
35 | return splits.size() == 1;
36 | }
37 |
38 | // public List getArguments(int num) throws ArgScriptException {
39 | // return getArguments(num, num);
40 | // }
41 | }
42 |
--------------------------------------------------------------------------------
/src/sporemodder/files/formats/dbpf/DBPFIndex.java:
--------------------------------------------------------------------------------
1 | package sporemodder.files.formats.dbpf;
2 |
3 | import java.io.IOException;
4 | import java.util.ArrayList;
5 | import java.util.List;
6 |
7 | import sporemodder.files.InputStreamAccessor;
8 | import sporemodder.files.OutputStreamAccessor;
9 | import sporemodder.files.formats.FileStructure;
10 |
11 | public class DBPFIndex extends FileStructure {
12 | public int groupID = -1;
13 | public int typeID = -1;
14 | public int itemSize = 28;
15 | public List items;
16 | public int itemsPos;
17 |
18 | public int dbpfType;
19 |
20 | public void read(InputStreamAccessor in, int dbpfType) throws IOException {
21 | int typeInt = in.readLEInt();
22 | itemSize = (dbpfType == DBPFHeader.TYPE_DBPF) ? 28 : 32;
23 |
24 | this.dbpfType = dbpfType;
25 |
26 | // type id
27 | if ((typeInt & (1 << 0)) == 1 << 0)
28 | {
29 | itemSize -= 4;
30 | typeID = in.readLEInt();
31 | }
32 |
33 | // group id
34 | if ((typeInt & (1 << 1)) == 1 << 1)
35 | {
36 | itemSize -= 4;
37 | groupID = in.readLEInt();
38 | }
39 |
40 | // unknown value
41 | if ((typeInt & (1 << 2)) == 1 << 2)
42 | {
43 | in.readLEInt();
44 | }
45 |
46 | itemsPos = in.getFilePointer();
47 | }
48 |
49 | public void write(OutputStreamAccessor out) throws IOException {
50 | out.writeLEInt(4);
51 | out.writeInt(0);
52 | for (DBPFItem item : items) {
53 | item.writeInfo(out);
54 | }
55 | }
56 |
57 | public void readItemsInfo(InputStreamAccessor in, int itemCount) throws IOException {
58 | items = new ArrayList(itemCount);
59 |
60 | for (int i = 0; i < itemCount; i++) {
61 | in.seek(itemsPos + (i * itemSize));
62 | DBPFItem item = new DBPFItem();
63 | item.key.setGroupID(groupID);
64 | item.key.setTypeID(typeID);
65 | item.readInfo(in, dbpfType);
66 | items.add(item);
67 | }
68 | }
69 | }
70 |
--------------------------------------------------------------------------------
/src/sporemodder/files/formats/dbpf/DebugInformation.java:
--------------------------------------------------------------------------------
1 | package sporemodder.files.formats.dbpf;
2 |
3 | import java.io.IOException;
4 |
5 | import sporemodder.files.MemoryOutputStream;
6 | import sporemodder.files.formats.prop.ArrayProperty;
7 | import sporemodder.files.formats.prop.PROPMain;
8 | import sporemodder.files.formats.prop.PropertyKey;
9 | import sporemodder.files.formats.prop.PropertyString16;
10 |
11 | public class DebugInformation {
12 |
13 | public static final String FOLDER_NAME = "_SporeModder";
14 |
15 | private String projectName;
16 | private String inputPath;
17 |
18 | private final ArrayProperty fileNames = new ArrayProperty("modFilePaths", PropertyString16.class);
19 | private final ArrayProperty fileKeys = new ArrayProperty("modFileKeys", PropertyKey.class);
20 |
21 | public DebugInformation(String projectName, String inputPath) {
22 | this.projectName = projectName;
23 | this.inputPath = inputPath;
24 | }
25 |
26 | public void addFile(String folderName, String fileName, int groupID, int instanceID, int typeID) {
27 |
28 | fileNames.addValue(new PropertyString16(null, folderName + "\\" + fileName));
29 | fileKeys.addValue(new PropertyKey(null, groupID, instanceID, typeID));
30 | }
31 |
32 | public void saveInformation(DBPFPackingTask dbpfTask) throws IOException {
33 |
34 | DBPFItem item = new DBPFItem();
35 |
36 | item.key.setGroupID(FOLDER_NAME);
37 | item.key.setInstanceID(projectName);
38 | item.key.setTypeID("prop");
39 |
40 | try (MemoryOutputStream stream = new MemoryOutputStream()) {
41 |
42 | PROPMain prop = new PROPMain();
43 | prop.add(new PropertyString16("modDebugPath", inputPath));
44 | prop.add(fileNames);
45 | prop.add(fileKeys);
46 |
47 | prop.write(stream);
48 |
49 | dbpfTask.writeFile(item, stream.getRawData(), stream.length());
50 | dbpfTask.addFile(item);
51 | }
52 |
53 | }
54 | }
55 |
--------------------------------------------------------------------------------
/src/sporemodder/files/formats/dbpf/PackWindow.java:
--------------------------------------------------------------------------------
1 | package sporemodder.files.formats.dbpf;
2 |
3 | import java.beans.PropertyChangeEvent;
4 | import java.beans.PropertyChangeListener;
5 | import java.io.File;
6 | import java.util.List;
7 |
8 | import javax.swing.JFrame;
9 | import javax.swing.JOptionPane;
10 | import javax.swing.JProgressBar;
11 |
12 | import sporemodder.files.formats.ConvertAction;
13 | import sporemodder.userinterface.ErrorManager;
14 |
15 | public class PackWindow extends JFrame {
16 |
17 | /**
18 | *
19 | */
20 | private static final long serialVersionUID = 5030678361780479334L;
21 |
22 | private JProgressBar progressBar;
23 | private DBPFPackingTask task;
24 |
25 | public PackWindow(File input, File output, List converters) {
26 |
27 | String packageName = output.getName();
28 | for (String s : DBPFMain.BANNED_PACKAGE_NAMES) {
29 | if (packageName.equals(s)) {
30 | int result = JOptionPane.showConfirmDialog(this, "The current package name collides with one used by Spore (" + s +
31 | "). Packing this is heavily discouraged since it might cause irreversible problems to your game. Are you sure you want to continue?",
32 | "Warning", JOptionPane.YES_NO_OPTION, JOptionPane.WARNING_MESSAGE);
33 |
34 | if (result != JOptionPane.YES_OPTION) {
35 | dispose();
36 | return;
37 | }
38 | }
39 | }
40 |
41 | setTitle("Packing '" + output.getName() + "'");
42 | // setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE);
43 | setResizable(false);
44 |
45 | progressBar = new JProgressBar(0, 100);
46 | progressBar.setValue(0);
47 | progressBar.setStringPainted(true);
48 |
49 | add(progressBar);
50 |
51 |
52 | try {
53 | task = new DBPFPackingTask(output.getAbsolutePath(), input.getAbsolutePath(), -1, converters, this);
54 | task.addPropertyChangeListener(new TaskProgressListener());
55 | task.execute();
56 | } catch (Exception e) {
57 | JOptionPane.showMessageDialog(this, ErrorManager.getStackTraceString(e), "Error", JOptionPane.ERROR_MESSAGE);
58 | dispose();
59 | return;
60 | }
61 |
62 | pack();
63 | setLocationRelativeTo(null);
64 | setVisible(true);
65 | }
66 |
67 | private class TaskProgressListener implements PropertyChangeListener {
68 |
69 | @Override
70 | public void propertyChange(PropertyChangeEvent arg0) {
71 | progressBar.setValue(task.getProgress());
72 | }
73 | }
74 |
75 | }
76 |
--------------------------------------------------------------------------------
/src/sporemodder/files/formats/effects/CloudEffect.java:
--------------------------------------------------------------------------------
1 | package sporemodder.files.formats.effects;
2 |
3 | import java.io.IOException;
4 |
5 | import sporemodder.files.InputStreamAccessor;
6 | import sporemodder.files.OutputStreamAccessor;
7 | import sporemodder.files.formats.argscript.ArgScriptCommand;
8 |
9 | public class CloudEffect extends ParticleEffect {
10 |
11 | public static final int TYPE = 0x2B;
12 | public static final int MIN_VERSION = 3;
13 | public static final int MAX_VERSION = 3;
14 | public static final String KEYWORD = "cloud";
15 |
16 | public CloudEffect(int type, int version) {
17 | super(type, version);
18 | }
19 |
20 | public CloudEffect(ParticleEffect effect) {
21 | super(effect);
22 | }
23 |
24 | @Override
25 | public boolean read(InputStreamAccessor in) throws IOException {
26 | return readMain(in);
27 | }
28 |
29 | @Override
30 | public boolean write(OutputStreamAccessor out) throws IOException {
31 | return writeMain(out);
32 | }
33 |
34 | @Override
35 | public void parseInline(ArgScriptCommand command) {
36 | throw new UnsupportedOperationException("Inline cloud effect is not supported.");
37 | }
38 |
39 | // For Syntax Highlighting
40 | public static String[] getBlockTags() {
41 | return new String[] {
42 | KEYWORD
43 | };
44 | }
45 | }
46 |
--------------------------------------------------------------------------------
/src/sporemodder/files/formats/effects/Effect.java:
--------------------------------------------------------------------------------
1 | package sporemodder.files.formats.effects;
2 |
3 | import java.io.BufferedWriter;
4 | import java.io.IOException;
5 | import java.util.List;
6 | import java.util.TreeMap;
7 |
8 | import sporemodder.files.InputStreamAccessor;
9 | import sporemodder.files.OutputStreamAccessor;
10 | import sporemodder.files.formats.argscript.ArgScriptBlock;
11 | import sporemodder.files.formats.argscript.ArgScriptCommand;
12 | import sporemodder.files.formats.argscript.ArgScriptException;
13 |
14 | public interface Effect {
15 | public boolean read(InputStreamAccessor in) throws IOException;
16 | public boolean write(OutputStreamAccessor out) throws IOException;
17 |
18 | public boolean parse(ArgScriptBlock block) throws IOException, ArgScriptException;
19 | public boolean toBlock(ArgScriptBlock block);
20 | public ArgScriptBlock toBlock();
21 |
22 | // for those EffectComponents that only support inline mode
23 | public ArgScriptCommand toCommand();
24 | public boolean supportsBlock();
25 |
26 | public String getName();
27 | public void setName(String name);
28 |
29 | // public TreeMap> getEffectMap();
30 | // public void setEffectMap(TreeMap> effects);
31 | public void setParent(EffectMain parent);
32 | public Effect[] getEffects();
33 |
34 | public int getType();
35 |
36 | public void fixEffectIndices(TreeMap baseIndices);
37 |
38 |
39 | public void write(BufferedWriter out, int level) throws IOException;
40 | }
41 |
--------------------------------------------------------------------------------
/src/sporemodder/files/formats/effects/EffectParser.java:
--------------------------------------------------------------------------------
1 | package sporemodder.files.formats.effects;
2 |
3 | import sporemodder.files.formats.argscript.ArgScript.ArgScriptParser;
4 | import sporemodder.files.formats.argscript.ArgScript.ArgScriptType;
5 |
6 | public class EffectParser implements ArgScriptParser {
7 |
8 | private static final String[] LEVEL1_BLOCK_KEYWORDS = new String[] {
9 | "select", "particleSelect", "modifier", "level", "filterChain"
10 | };
11 |
12 | @Override
13 | public ArgScriptType checkElement(String keyword, String line, int level) {
14 |
15 | if (level == 0) {
16 | if (keyword.equals("export") || keyword.equals("import") || keyword.equals(MapResource.KEYWORD)) {
17 | return ArgScriptType.COMMAND;
18 | }
19 | else {
20 | return ArgScriptType.BLOCK;
21 | }
22 | }
23 | else if (level == 1) {
24 | for (String s : LEVEL1_BLOCK_KEYWORDS) {
25 | if (keyword.equals(s)) {
26 | return ArgScriptType.BLOCK;
27 | }
28 | }
29 | }
30 |
31 | return ArgScriptType.COMMAND;
32 | }
33 |
34 | }
35 |
--------------------------------------------------------------------------------
/src/sporemodder/files/formats/effects/GroundCoverEffect.java:
--------------------------------------------------------------------------------
1 | package sporemodder.files.formats.effects;
2 |
3 | import sporemodder.files.formats.argscript.ArgScriptCommand;
4 |
5 | public class GroundCoverEffect extends ParticleEffect {
6 |
7 | public static final int TYPE = 0x2C;
8 | public static final int MIN_VERSION = 1;
9 | public static final int MAX_VERSION = 1;
10 | public static final String KEYWORD = "groundCover";
11 |
12 | public GroundCoverEffect(int type, int version) {
13 | super(type, version);
14 | }
15 |
16 | public GroundCoverEffect(ParticleEffect effect) {
17 | super(effect);
18 | }
19 |
20 | @Override
21 | public void parseInline(ArgScriptCommand command) {
22 | throw new UnsupportedOperationException("Inline groundCover effect is not supported.");
23 | }
24 |
25 | // For Syntax Highlighting
26 | public static String[] getBlockTags() {
27 | return new String[] {
28 | KEYWORD
29 | };
30 | }
31 | }
32 |
--------------------------------------------------------------------------------
/src/sporemodder/files/formats/effects/ParticleAttractor.java:
--------------------------------------------------------------------------------
1 | package sporemodder.files.formats.effects;
2 |
3 | import java.io.IOException;
4 |
5 | import sporemodder.files.InputStreamAccessor;
6 | import sporemodder.files.OutputStreamAccessor;
7 |
8 | public class ParticleAttractor {
9 | protected float[] attractorStrength = new float[0];
10 | protected float range = 1;
11 | protected float killRange;
12 |
13 | public ParticleAttractor() {}
14 | public ParticleAttractor(ParticleAttractor other) {
15 | copy(other);
16 | }
17 |
18 | public void copy(ParticleAttractor other) {
19 | attractorStrength = EffectComponent.copyArray(other.attractorStrength);
20 | range = other.range;
21 | killRange = other.killRange;
22 | }
23 |
24 | public void read(InputStreamAccessor in) throws IOException {
25 | attractorStrength = new float[in.readInt()];
26 | in.readFloats(attractorStrength);
27 | range = in.readFloat();
28 | killRange = in.readFloat();
29 | }
30 |
31 | public void write(OutputStreamAccessor out) throws IOException {
32 | out.writeInt(attractorStrength.length);
33 | out.writeFloats(attractorStrength);
34 | out.writeFloat(range);
35 | out.writeFloat(killRange);
36 | }
37 | }
38 |
--------------------------------------------------------------------------------
/src/sporemodder/files/formats/effects/ParticleRandomWalk.java:
--------------------------------------------------------------------------------
1 | package sporemodder.files.formats.effects;
2 |
3 | import java.io.IOException;
4 |
5 | import sporemodder.files.InputStreamAccessor;
6 | import sporemodder.files.OutputStreamAccessor;
7 |
8 | public class ParticleRandomWalk {
9 | protected final float[] time = {5, 5};
10 | protected final float[] strength = new float[2];
11 | protected float turnRange = 0.25f;
12 | protected float turnOffset;
13 | protected float mix;
14 | protected float[] turnOffsetCurve = new float[0];
15 | protected int loopType = 2; //byte, might not exist
16 |
17 | public ParticleRandomWalk() {}
18 | public ParticleRandomWalk(ParticleRandomWalk other) {
19 | copy(other);
20 | }
21 |
22 | public void copy(ParticleRandomWalk other) {
23 | time[0] = other.time[0];
24 | time[1] = other.time[1];
25 | strength[0] = other.strength[0];
26 | strength[1] = other.strength[1];
27 | turnRange = other.turnRange;
28 | turnOffset = other.turnOffset;
29 | mix = other.mix;
30 | turnOffsetCurve = EffectComponent.copyArray(other.turnOffsetCurve);
31 | loopType = other.loopType;
32 | }
33 |
34 | public void read(InputStreamAccessor in) throws IOException {
35 | time[0] = in.readLEFloat(); // 5
36 | time[1] = in.readLEFloat(); // 5
37 | strength[0] = in.readLEFloat();
38 | strength[1] = in.readLEFloat();
39 | turnRange = in.readFloat(); // 0.25
40 | turnOffset = in.readFloat();
41 | mix = in.readFloat();
42 | turnOffsetCurve = new float[in.readInt()];
43 | in.readFloats(turnOffsetCurve);
44 | loopType = in.readByte(); // 2
45 | }
46 |
47 | public void write(OutputStreamAccessor out) throws IOException {
48 | out.writeLEFloat(time[0]);
49 | out.writeLEFloat(time[1]);
50 | out.writeLEFloat(strength[0]);
51 | out.writeLEFloat(strength[1]);
52 | out.writeFloat(turnRange);
53 | out.writeFloat(turnOffset);
54 | out.writeFloat(mix);
55 | out.writeInt(turnOffsetCurve.length);
56 | out.writeFloats(turnOffsetCurve);
57 | out.writeByte(loopType);
58 | }
59 | }
60 |
--------------------------------------------------------------------------------
/src/sporemodder/files/formats/effects/ParticleWiggle.java:
--------------------------------------------------------------------------------
1 | package sporemodder.files.formats.effects;
2 |
3 | import java.io.IOException;
4 |
5 | import sporemodder.files.InputStreamAccessor;
6 | import sporemodder.files.OutputStreamAccessor;
7 |
8 | public class ParticleWiggle {
9 | protected float timeRate;
10 | protected final float[] rateDirection = new float[3];
11 | protected final float[] wiggleDirection = new float[3];
12 |
13 | public ParticleWiggle() {}
14 | public ParticleWiggle(ParticleWiggle other) {
15 | timeRate = other.timeRate;
16 | rateDirection[0] = other.rateDirection[0];
17 | rateDirection[1] = other.rateDirection[1];
18 | rateDirection[2] = other.rateDirection[2];
19 | wiggleDirection[0] = other.wiggleDirection[0];
20 | wiggleDirection[1] = other.wiggleDirection[1];
21 | wiggleDirection[2] = other.wiggleDirection[2];
22 | }
23 |
24 | public void read(InputStreamAccessor in) throws IOException {
25 | timeRate = in.readFloat();
26 | rateDirection[0] = in.readLEFloat();
27 | rateDirection[1] = in.readLEFloat();
28 | rateDirection[2] = in.readLEFloat();
29 | wiggleDirection[0] = in.readLEFloat();
30 | wiggleDirection[1] = in.readLEFloat();
31 | wiggleDirection[2] = in.readLEFloat();
32 | }
33 |
34 | public void write(OutputStreamAccessor out) throws IOException {
35 | out.writeFloat(timeRate);
36 | out.writeLEFloat(rateDirection[0]);
37 | out.writeLEFloat(rateDirection[1]);
38 | out.writeLEFloat(rateDirection[2]);
39 | out.writeLEFloat(wiggleDirection[0]);
40 | out.writeLEFloat(wiggleDirection[1]);
41 | out.writeLEFloat(wiggleDirection[2]);
42 | }
43 | }
44 |
--------------------------------------------------------------------------------
/src/sporemodder/files/formats/effects/Resource.java:
--------------------------------------------------------------------------------
1 | package sporemodder.files.formats.effects;
2 |
3 | import java.io.BufferedWriter;
4 | import java.io.IOException;
5 | import java.util.TreeMap;
6 |
7 | import sporemodder.files.InputStreamAccessor;
8 | import sporemodder.files.OutputStreamAccessor;
9 | import sporemodder.files.formats.argscript.ArgScriptBlock;
10 | import sporemodder.files.formats.argscript.ArgScriptCommand;
11 | import sporemodder.files.formats.argscript.ArgScriptException;
12 |
13 | public abstract class Resource implements Effect {
14 |
15 | public static final int TYPE_MASK = 0x7F0000;
16 |
17 | private EffectMain parent;
18 | protected int version;
19 | protected final ResourceID resourceID = new ResourceID();
20 |
21 | public Resource() {
22 | }
23 |
24 | @Override
25 | public abstract boolean read(InputStreamAccessor in) throws IOException;
26 |
27 | @Override
28 | public abstract boolean write(OutputStreamAccessor out) throws IOException;
29 |
30 | @Override
31 | public abstract boolean parse(ArgScriptBlock block) throws IOException,
32 | ArgScriptException;
33 |
34 | @Override
35 | public abstract boolean toBlock(ArgScriptBlock block);
36 |
37 | @Override
38 | public abstract ArgScriptBlock toBlock();
39 |
40 | public abstract boolean parseCommand(ArgScriptCommand c) throws ArgScriptException, IOException;
41 |
42 | @Override
43 | public abstract ArgScriptCommand toCommand();
44 |
45 | @Override
46 | public boolean supportsBlock() {
47 | return true;
48 | }
49 |
50 | @Override
51 | public String getName() {
52 | return resourceID.toString();
53 | }
54 |
55 | @Override
56 | public void setName(String name) {
57 | resourceID.parse(name);
58 | }
59 |
60 | @Override
61 | public void setParent(EffectMain parent) {
62 | this.parent = parent;
63 | }
64 |
65 | @Override
66 | public Effect[] getEffects() {
67 | // TODO Auto-generated method stub
68 | return null;
69 | }
70 |
71 | @Override
72 | public abstract int getType();
73 |
74 | @Override
75 | public void fixEffectIndices(TreeMap baseIndices) {
76 | // TODO Auto-generated method stub
77 |
78 | }
79 |
80 | @Override
81 | public void write(BufferedWriter out, int level) throws IOException {
82 | // TODO Auto-generated method stub
83 |
84 | }
85 |
86 | }
87 |
--------------------------------------------------------------------------------
/src/sporemodder/files/formats/effects/SkinpaintFloodEffect.java:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/emd4600/SporeModder/142fdcf1c2472b1ceacc2168eb76446840723208/src/sporemodder/files/formats/effects/SkinpaintFloodEffect.java
--------------------------------------------------------------------------------
/src/sporemodder/files/formats/effects/SkinpaintParticleEffect.java:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/emd4600/SporeModder/142fdcf1c2472b1ceacc2168eb76446840723208/src/sporemodder/files/formats/effects/SkinpaintParticleEffect.java
--------------------------------------------------------------------------------
/src/sporemodder/files/formats/gait/GAITStepLengthKey.java:
--------------------------------------------------------------------------------
1 | package sporemodder.files.formats.gait;
2 |
3 | import java.io.IOException;
4 |
5 | import sporemodder.files.InputStreamAccessor;
6 | import sporemodder.files.OutputStreamAccessor;
7 | import sporemodder.files.formats.FileStructure;
8 | import sporemodder.files.formats.argscript.ArgScriptBlock;
9 | import sporemodder.files.formats.argscript.ArgScriptCommand;
10 | import sporemodder.files.formats.argscript.ArgScriptException;
11 |
12 | public class GAITStepLengthKey extends FileStructure {
13 | private float speedi;
14 | private float stepLength;
15 |
16 | public void read(InputStreamAccessor in) throws IOException {
17 | speedi = in.readLEFloat();
18 | stepLength = in.readLEFloat();
19 | }
20 |
21 | public void write(OutputStreamAccessor out) throws IOException {
22 | out.writeLEFloat(speedi);
23 | out.writeLEFloat(stepLength);
24 | }
25 |
26 | public ArgScriptBlock toBlock() {
27 |
28 | ArgScriptBlock block = new ArgScriptBlock("steplengthkey");
29 | block.putCommand(new ArgScriptCommand("steplength", Float.toString(stepLength)));
30 | block.putCommand(new ArgScriptCommand("speedi", Float.toString(speedi)));
31 |
32 | return block;
33 | }
34 |
35 | public void parse(ArgScriptBlock block) throws IOException, NumberFormatException, ArgScriptException {
36 |
37 | ArgScriptCommand cStepLength = block.getCommand("steplength");
38 | if (cStepLength != null) {
39 | stepLength = Float.parseFloat(cStepLength.getSingleArgument());
40 | }
41 |
42 | ArgScriptCommand cSpeedi = block.getCommand("speedi");
43 | if (cSpeedi != null) {
44 | speedi = Float.parseFloat(cSpeedi.getSingleArgument());
45 | }
46 | }
47 | }
48 |
--------------------------------------------------------------------------------
/src/sporemodder/files/formats/lvl/GameplayMarker.java:
--------------------------------------------------------------------------------
1 | package sporemodder.files.formats.lvl;
2 |
3 | import java.io.IOException;
4 |
5 | import sporemodder.files.InputStreamAccessor;
6 | import sporemodder.files.OutputStreamAccessor;
7 |
8 | public interface GameplayMarker {
9 | public void read(InputStreamAccessor in) throws IOException;
10 | public void write(OutputStreamAccessor out) throws IOException;
11 | public void print();
12 | }
13 |
--------------------------------------------------------------------------------
/src/sporemodder/files/formats/lvl/GameplayMarkerHolder.java:
--------------------------------------------------------------------------------
1 | package sporemodder.files.formats.lvl;
2 |
3 | import java.io.IOException;
4 | import java.util.Arrays;
5 |
6 | import sporemodder.files.InputStreamAccessor;
7 | import sporemodder.files.OutputStreamAccessor;
8 | import sporemodder.utilities.Hasher;
9 |
10 | public class GameplayMarkerHolder {
11 | public float[] position = new float[3];
12 | public float[] unk = new float[4]; //TODO Rotation?
13 | public int[] id = new int[3];
14 | private int pos;
15 | public GameplayMarker gameplayMarker;
16 |
17 | public void read(InputStreamAccessor in) throws IOException {
18 | pos = in.getFilePointer();
19 | position[0] = in.readFloat();
20 | position[1] = in.readFloat();
21 | position[2] = in.readFloat();
22 | unk[0] = in.readFloat();
23 | unk[1] = in.readFloat();
24 | unk[2] = in.readFloat();
25 | unk[3] = in.readFloat();
26 | id[0] = in.readInt();
27 | id[1] = in.readInt();
28 | id[2] = in.readInt();
29 |
30 | if (id[0] == CreatureArchetype.HASH) {
31 | gameplayMarker = new CreatureArchetype();
32 |
33 | } else if (id[0] == MigrationPoint.HASH) {
34 | gameplayMarker = new MigrationPoint();
35 |
36 | } else if (id[0] == InteractiveOrnament.HASH) {
37 | gameplayMarker = new InteractiveOrnament();
38 | }
39 |
40 | gameplayMarker.read(in);
41 | }
42 |
43 | public void write(OutputStreamAccessor out) throws IOException {
44 | out.writeFloat(position[0]);
45 | out.writeFloat(position[1]);
46 | out.writeFloat(position[2]);
47 | out.writeFloat(unk[0]);
48 | out.writeFloat(unk[1]);
49 | out.writeFloat(unk[2]);
50 | out.writeFloat(unk[3]);
51 | out.writeInt(id[0]);
52 | out.writeInt(id[1]);
53 | out.writeInt(id[2]);
54 |
55 | gameplayMarker.write(out);
56 | }
57 |
58 | public void print() {
59 | System.out.println("#####################################");
60 | System.out.println("pos: " + pos);
61 | System.out.println(Arrays.toString(position));
62 | System.out.println(Arrays.toString(unk));
63 | System.out.println(Hasher.getFileName(id[0]) + "\t" + Hasher.getFileName(id[1]) + "\t" + Hasher.getFileName(id[2]));
64 | System.out.println();
65 | gameplayMarker.print();
66 | System.out.println("#####################################");
67 | System.out.println();
68 | }
69 | }
70 |
--------------------------------------------------------------------------------
/src/sporemodder/files/formats/lvl/InteractiveOrnament.java:
--------------------------------------------------------------------------------
1 | package sporemodder.files.formats.lvl;
2 |
3 | import java.io.IOException;
4 |
5 | import sporemodder.files.InputStreamAccessor;
6 | import sporemodder.files.OutputStreamAccessor;
7 | import sporemodder.files.formats.FileStructure;
8 |
9 | public class InteractiveOrnament extends FileStructure implements GameplayMarker {
10 | protected static final int HASH = 0xBEDADA93;
11 |
12 | public void read(InputStreamAccessor in) throws IOException {
13 | for (int i = 0; i < 34; i++) expect(in.readInt(), 0, "LVL-IO-0", in.getFilePointer());
14 | }
15 |
16 | public void print() {
17 | }
18 |
19 | @Override
20 | public void write(OutputStreamAccessor out) throws IOException {
21 | out.write(new byte[34*4]);
22 | }
23 | }
24 |
--------------------------------------------------------------------------------
/src/sporemodder/files/formats/lvl/MigrationPoint.java:
--------------------------------------------------------------------------------
1 | package sporemodder.files.formats.lvl;
2 |
3 | import java.io.IOException;
4 |
5 | import sporemodder.files.InputStreamAccessor;
6 | import sporemodder.files.OutputStreamAccessor;
7 | import sporemodder.files.formats.FileStructure;
8 | import sporemodder.utilities.Hasher;
9 |
10 | public class MigrationPoint extends FileStructure implements GameplayMarker {
11 | protected static final int HASH = 0xC012AE1F;
12 |
13 | private enum MigrationPointTypeEnum {NORMAL, AVATAR_JOURNEY, PATROL_PATH, AVATAR_SPECIES_JOURNEY, CREATURE_PATH};
14 |
15 | private int name;
16 | private int number;
17 | private float radiusMultiplier = 1;
18 | private int nestLevel; //?
19 | private MigrationPointTypeEnum type = MigrationPointTypeEnum.NORMAL;
20 |
21 | public void read(InputStreamAccessor in) throws IOException {
22 | name = in.readLEInt();
23 | nestLevel = in.readLEInt();
24 | number = in.readLEInt();
25 | radiusMultiplier = in.readLEFloat();
26 | type = MigrationPointTypeEnum.values()[in.readLEInt()];
27 |
28 | for (int i = 0; i < 29; i++) expect(in.readInt(), 0, "LVL-MP-0", in.getFilePointer());
29 | }
30 |
31 | public void print() {
32 | System.out.println("name: " + Hasher.getFileName(name));
33 | System.out.println("number: " + number);
34 | System.out.println("radiusMultiplier: " + radiusMultiplier);
35 | System.out.println("type: " + type.toString());
36 | System.out.println("nestLevel: " + nestLevel);
37 | }
38 |
39 | @Override
40 | public void write(OutputStreamAccessor out) throws IOException {
41 | out.writeLEInt(name);
42 | out.writeLEInt(nestLevel);
43 | out.writeLEInt(number);
44 | out.writeLEFloat(radiusMultiplier);
45 | out.write(new byte[29*4]);
46 | }
47 | }
48 |
--------------------------------------------------------------------------------
/src/sporemodder/files/formats/pctp/PCTPAggregate.java:
--------------------------------------------------------------------------------
1 | package sporemodder.files.formats.pctp;
2 |
3 | import java.io.IOException;
4 | import java.util.List;
5 |
6 | import sporemodder.files.InputStreamAccessor;
7 | import sporemodder.files.OutputStreamAccessor;
8 | import sporemodder.files.formats.FileStructure;
9 | import sporemodder.files.formats.argscript.ArgScriptCommand;
10 | import sporemodder.files.formats.argscript.ArgScriptException;
11 |
12 | public class PCTPAggregate extends FileStructure {
13 |
14 | private String identifier; // four bytes
15 | private String[] aggregateIdentifiers; // four bytes
16 |
17 | public void read(InputStreamAccessor in) throws IOException {
18 | identifier = PCTPMain.getIdentifierString(in.readLEInt());
19 |
20 | aggregateIdentifiers = new String[in.readInt()];
21 | for (int i = 0; i < aggregateIdentifiers.length; i++) {
22 | aggregateIdentifiers[i] = PCTPMain.getIdentifierString(in.readLEInt());
23 | }
24 | }
25 |
26 | public void write(OutputStreamAccessor out) throws IOException {
27 | PCTPMain.writeIdentifier(out, identifier);
28 | out.writeInt(aggregateIdentifiers.length);
29 | for (String str : aggregateIdentifiers) {
30 | PCTPMain.writeIdentifier(out, str);
31 | }
32 | }
33 |
34 | public ArgScriptCommand toCommand() {
35 | return new ArgScriptCommand(identifier, aggregateIdentifiers);
36 | }
37 |
38 | public void fromCommand(ArgScriptCommand command) throws ArgScriptException {
39 | List args = command.getArguments(0, Integer.MAX_VALUE);
40 |
41 | identifier = command.getKeyword();
42 | aggregateIdentifiers = new String[args.size()];
43 |
44 | for (int i = 0; i < aggregateIdentifiers.length; i++) {
45 | aggregateIdentifiers[i] = args.get(i);
46 | }
47 | }
48 |
49 | public String getIdentifier() {
50 | return identifier;
51 | }
52 |
53 | public String[] getAggregateIdentifiers() {
54 | return aggregateIdentifiers;
55 | }
56 |
57 | public void setIdentifier(String identifier) {
58 | this.identifier = identifier;
59 | }
60 |
61 | public void setAggregateIdentifiers(String[] aggregateIdentifiers) {
62 | this.aggregateIdentifiers = aggregateIdentifiers;
63 | }
64 |
65 | }
66 |
--------------------------------------------------------------------------------
/src/sporemodder/files/formats/pctp/PCTPCapability.java:
--------------------------------------------------------------------------------
1 | package sporemodder.files.formats.pctp;
2 |
3 | import java.io.IOException;
4 | import java.util.List;
5 |
6 | import sporemodder.files.InputStreamAccessor;
7 | import sporemodder.files.OutputStreamAccessor;
8 | import sporemodder.files.formats.FileStructure;
9 | import sporemodder.files.formats.argscript.ArgScriptCommand;
10 | import sporemodder.files.formats.argscript.ArgScriptException;
11 |
12 | public class PCTPCapability extends FileStructure {
13 |
14 | private String name;
15 | private String identifier; // four bytes
16 |
17 | public void read(InputStreamAccessor in) throws IOException {
18 | name = in.readString8(in.readInt());
19 | identifier = PCTPMain.getIdentifierString(in.readLEInt());
20 | }
21 |
22 | public void write(OutputStreamAccessor out) throws IOException {
23 | out.writeInt(name.length());
24 | out.writeString8(name);
25 | PCTPMain.writeIdentifier(out, identifier);
26 | }
27 |
28 | public ArgScriptCommand toCommand() {
29 | return new ArgScriptCommand(identifier, name);
30 | }
31 |
32 | public void fromCommand(ArgScriptCommand command) throws ArgScriptException {
33 | List args = command.getArguments(1);
34 |
35 | identifier = command.getKeyword();
36 | name = args.get(0);
37 | }
38 |
39 | public String getName() {
40 | return name;
41 | }
42 |
43 | public String getIdentifier() {
44 | return identifier;
45 | }
46 |
47 | public void setName(String name) {
48 | this.name = name;
49 | }
50 |
51 | public void setIdentifier(String identifier) {
52 | this.identifier = identifier;
53 | }
54 |
55 | }
56 |
--------------------------------------------------------------------------------
/src/sporemodder/files/formats/pctp/PCTPRemap.java:
--------------------------------------------------------------------------------
1 | package sporemodder.files.formats.pctp;
2 |
3 | import java.io.IOException;
4 | import java.util.List;
5 |
6 | import sporemodder.files.InputStreamAccessor;
7 | import sporemodder.files.OutputStreamAccessor;
8 | import sporemodder.files.formats.FileStructure;
9 | import sporemodder.files.formats.argscript.ArgScriptCommand;
10 | import sporemodder.files.formats.argscript.ArgScriptException;
11 | import sporemodder.utilities.Hasher;
12 |
13 | public class PCTPRemap extends FileStructure {
14 |
15 | private int verbIconCategory;
16 | private String identifier; // four bytes
17 | private int unk;
18 |
19 | public void read(InputStreamAccessor in) throws IOException {
20 | verbIconCategory = in.readInt();
21 | identifier = PCTPMain.getIdentifierString(in.readLEInt());
22 | unk = in.readInt();
23 | }
24 |
25 | public void write(OutputStreamAccessor out) throws IOException {
26 | out.writeInt(verbIconCategory);
27 | PCTPMain.writeIdentifier(out, identifier);
28 | out.writeInt(unk);
29 | }
30 |
31 | public ArgScriptCommand toCommand() {
32 | return new ArgScriptCommand(Hasher.getFileName(verbIconCategory), identifier, Integer.toString(unk));
33 | }
34 |
35 | public void fromCommand(ArgScriptCommand command) throws ArgScriptException, IOException {
36 | List args = command.getArguments(2);
37 |
38 | verbIconCategory = Hasher.getFileHash(command.getKeyword());
39 | identifier = args.get(0);
40 | unk = Hasher.decodeInt(args.get(1));
41 | }
42 |
43 | public int getVerbIconCategory() {
44 | return verbIconCategory;
45 | }
46 |
47 | public String getIdentifier() {
48 | return identifier;
49 | }
50 |
51 | public int getUnk() {
52 | return unk;
53 | }
54 |
55 | public void setVerbIconCategory(int verbIconCategory) {
56 | this.verbIconCategory = verbIconCategory;
57 | }
58 |
59 | public void setIdentifier(String identifier) {
60 | this.identifier = identifier;
61 | }
62 |
63 | public void setUnk(int unk) {
64 | this.unk = unk;
65 | }
66 |
67 |
68 | }
69 |
--------------------------------------------------------------------------------
/src/sporemodder/files/formats/pdr/PDRMain.java:
--------------------------------------------------------------------------------
1 | package sporemodder.files.formats.pdr;
2 |
3 | import java.io.IOException;
4 |
5 | import sporemodder.files.InputStreamAccessor;
6 | import sporemodder.files.formats.FileStructure;
7 |
8 | public class PDRMain extends FileStructure {
9 | public int unk;
10 | public int entryCount;
11 | public void read(InputStreamAccessor in) throws IOException {
12 | expect(in.readInt(), 0x45415044, "PDR-H001", in.getFilePointer());
13 | unk = in.readLEInt(); //?
14 | expect(in.readLEInt(), 2, "PDR-H002", in.getFilePointer());
15 | expect(in.readLEInt(), in.length(), "PDR-H003", in.getFilePointer());
16 | entryCount = in.readLEInt();
17 | expect(in.readLEInt(), 0, "PDR-H004", in.getFilePointer());
18 | }
19 | }
20 |
--------------------------------------------------------------------------------
/src/sporemodder/files/formats/pdr/PDRObject.java:
--------------------------------------------------------------------------------
1 | package sporemodder.files.formats.pdr;
2 |
3 | import java.io.IOException;
4 |
5 | import sporemodder.files.FileStreamAccessor;
6 | import sporemodder.files.InputStreamAccessor;
7 | import sporemodder.files.StreamAccessor;
8 | import sporemodder.files.formats.FileStructure;
9 |
10 | public class PDRObject extends FileStructure {
11 | private String name = null;
12 | private String fullName = null;
13 | private String extension = null;
14 | private int size;
15 | private byte[] content;
16 |
17 | //TODO This is not correctly supported
18 | public void read(InputStreamAccessor in, String path) throws IOException {
19 | int nameLength = in.readLEInt();
20 | byte[] nameBytes = new byte[nameLength];
21 | in.read(nameBytes);
22 | name = new String(nameBytes).trim();
23 |
24 | byte[] extensionBytes = new byte[4];
25 | in.read(extensionBytes);
26 | extension = new String(extensionBytes).trim();
27 |
28 | fullName = name + "." + extension;
29 |
30 | size = in.readLEInt();
31 | content = new byte[size];
32 | in.read(content);
33 |
34 | System.out.println("name: " + fullName);
35 | System.out.println("size: " + size);
36 |
37 | FileStreamAccessor out = new FileStreamAccessor(path + fullName, "rw", true);
38 | out.write(content);
39 | out.close();
40 | }
41 | }
42 |
--------------------------------------------------------------------------------
/src/sporemodder/files/formats/prop/PropertyWChar.java:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/emd4600/SporeModder/142fdcf1c2472b1ceacc2168eb76446840723208/src/sporemodder/files/formats/prop/PropertyWChar.java
--------------------------------------------------------------------------------
/src/sporemodder/files/formats/prop/SpecialCharacters.java:
--------------------------------------------------------------------------------
1 | package sporemodder.files.formats.prop;
2 |
3 | import java.util.HashMap;
4 | import java.util.Map;
5 |
6 | public class SpecialCharacters {
7 |
8 | private static final HashMap CHARACTERS = new HashMap();
9 | static
10 | {
11 | CHARACTERS.put('!', "!");
12 | CHARACTERS.put('"', """);
13 | CHARACTERS.put('#', "#");
14 | CHARACTERS.put('$', "$");
15 | CHARACTERS.put('%', "%");
16 | CHARACTERS.put('&', "&");
17 | CHARACTERS.put('\'', "'");
18 | CHARACTERS.put('(', "(");
19 | CHARACTERS.put(')', ")");
20 | CHARACTERS.put('*', "*");
21 | CHARACTERS.put('+', "+");
22 | CHARACTERS.put(',', ",");
23 | CHARACTERS.put('-', "-");
24 | CHARACTERS.put('.', ".");
25 | CHARACTERS.put('/', "/");
26 | CHARACTERS.put(':', ":");
27 | CHARACTERS.put(';', ";");
28 | CHARACTERS.put('<', "<");
29 | CHARACTERS.put('=', "=");
30 | CHARACTERS.put('>', ">");
31 | CHARACTERS.put('?', "?");
32 | CHARACTERS.put('@', "@");
33 | CHARACTERS.put('[', "[");
34 | CHARACTERS.put('\\', "\");
35 | CHARACTERS.put(']', "]");
36 | CHARACTERS.put('^', "^");
37 | CHARACTERS.put('_', "_");
38 | CHARACTERS.put('`', "`");
39 | CHARACTERS.put('{', "{");
40 | CHARACTERS.put('|', "|");
41 | CHARACTERS.put('}', "}");
42 | CHARACTERS.put('~', "~");
43 | }
44 |
45 |
46 | public static String fixStringLiteral(String text) {
47 | for (Map.Entry entry : CHARACTERS.entrySet()) {
48 | text.replace(entry.getKey().toString(), entry.getValue());
49 | }
50 |
51 | return text;
52 | }
53 | }
54 |
--------------------------------------------------------------------------------
/src/sporemodder/files/formats/renderWare4/RW4Animations.java:
--------------------------------------------------------------------------------
1 | package sporemodder.files.formats.renderWare4;
2 |
3 | import java.io.IOException;
4 | import java.util.List;
5 |
6 | import sporemodder.files.InputStreamAccessor;
7 | import sporemodder.files.OutputStreamAccessor;
8 | import sporemodder.utilities.Hasher;
9 |
10 | public class RW4Animations extends RW4Section {
11 | public static final int type_code = 0xff0001;
12 | public static final int alignment = 4;
13 | public int numAnims;
14 | public int unk1;
15 | public RW4Anim[] anims;
16 | public int[] animNames;
17 | public int[] animSections;
18 | @Override
19 | public void read(InputStreamAccessor in, List sections) throws IOException {
20 | unk1 = in.readLEInt();
21 | numAnims = in.readLEInt();
22 | animNames = new int[numAnims];
23 | animSections = new int[numAnims];
24 | for (int i = 0; i < numAnims; i++) {
25 | animNames[i] = in.readLEInt();
26 | animSections[i] = in.readLEInt();
27 | }
28 | anims = new RW4Anim[numAnims];
29 | for (int i = 0; i < numAnims; i++) {
30 | anims[i] = (RW4Anim) sections.get(animSections[i]);
31 | }
32 | }
33 |
34 | @Override
35 | public void write(OutputStreamAccessor out, List sections) throws IOException {
36 | out.writeLEInt(unk1);
37 | out.writeLEInt(animNames.length);
38 | for (int i = 0; i < animNames.length; i++) {
39 | animSections[i] = sections.indexOf(anims[i]);
40 | out.writeLEInt(animNames[i]);
41 | out.writeLEInt(animSections[i]);
42 | }
43 | }
44 |
45 | @Override
46 | public void print() {
47 | System.out.println("### " + this.getClass().getSimpleName() + " section " + this.sectionInfo.number);
48 | System.out.println("\tunk1: " + unk1 + "\t" + Hasher.getFileName(unk1));
49 | System.out.println("\tanim count: " + numAnims);
50 | for (int i = 0; i < numAnims; i++) {
51 | System.out.println("\t " + Hasher.getFileName(animNames[i]) + " section " + animSections[i]);
52 | }
53 | }
54 |
55 | @Override
56 | public int getSectionTypeCode() {
57 | return type_code;
58 | }
59 | @Override
60 | public int getSectionAlignment() {
61 | return alignment;
62 | }
63 | }
64 |
--------------------------------------------------------------------------------
/src/sporemodder/files/formats/renderWare4/RW4BBox.java:
--------------------------------------------------------------------------------
1 | package sporemodder.files.formats.renderWare4;
2 |
3 | import java.io.IOException;
4 | import java.util.List;
5 |
6 | import sporemodder.files.InputStreamAccessor;
7 | import sporemodder.files.OutputStreamAccessor;
8 | import sporemodder.utilities.Hasher;
9 |
10 | public class RW4BBox extends RW4Section {
11 | public static final int type_code = 0x80005;
12 | public static final int alignment = 16;
13 | public float[] min = new float[3];
14 | public float[] max = new float[3];
15 | public int unk1, unk2;
16 | @Override
17 | public void read(InputStreamAccessor in, List sections) throws IOException {
18 | min[0] = in.readLEFloat();
19 | min[1] = in.readLEFloat();
20 | min[2] = in.readLEFloat();
21 | unk1 = in.readLEInt(); // MAYBE: xyradius, the circular radius in the X-Y plane
22 | max[0] = in.readLEFloat();
23 | max[1] = in.readLEFloat();
24 | max[2] = in.readLEFloat();
25 | unk2 = in.readLEInt(); // MAYBE: radius, the spherical radius
26 | }
27 |
28 | @Override
29 | public void write(OutputStreamAccessor out, List sections) throws IOException {
30 | out.writeLEFloats(min);
31 | out.writeLEInt(unk1);
32 | out.writeLEFloats(max);
33 | out.writeLEInt(unk2);
34 | }
35 |
36 | @Override
37 | public void print() {
38 | System.out.println("### " + this.getClass().getSimpleName() + " section " + this.sectionInfo.number);
39 | System.out.println("\tmin: [" + min[0]+", "+min[1]+", "+min[2]+"]");
40 | System.out.println("\tmax: [" + max[0]+", "+max[1]+", "+max[2]+"]");
41 | System.out.println("\tunk1: " + unk1 + "\t" + Hasher.getFileName(unk1));
42 | System.out.println("\tunk2: " + unk2 + "\t" + Hasher.getFileName(unk2));
43 | }
44 |
45 | @Override
46 | public int getSectionTypeCode() {
47 | return type_code;
48 | }
49 | @Override
50 | public int getSectionAlignment() {
51 | return alignment;
52 | }
53 | }
54 |
--------------------------------------------------------------------------------
/src/sporemodder/files/formats/renderWare4/RW4HierarchyInfo.java:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/emd4600/SporeModder/142fdcf1c2472b1ceacc2168eb76446840723208/src/sporemodder/files/formats/renderWare4/RW4HierarchyInfo.java
--------------------------------------------------------------------------------
/src/sporemodder/files/formats/renderWare4/RW4Material.java:
--------------------------------------------------------------------------------
1 | package sporemodder.files.formats.renderWare4;
2 |
3 | import java.io.IOException;
4 | import java.util.List;
5 |
6 | import sporemodder.files.InputStreamAccessor;
7 | import sporemodder.files.OutputStreamAccessor;
8 |
9 | public class RW4Material extends RW4Section {
10 | public static final int type_code = 0x7000b;
11 | public static final int alignment = 4;
12 | public int unk1;
13 | public RW4TexMetadata texMet;
14 | public RW4HierarchyInfo hInfo;
15 | public int texMet_secNum, hInfo_secNum;
16 | @Override
17 | public void read(InputStreamAccessor in, List sections) throws IOException {
18 | expect(in.readLEInt(), 0x00400000, "RW4-MT001", in.getFilePointer());
19 | expect(in.readLEInt(), 0x0063FFB0, "RW4-MT002", in.getFilePointer());
20 | expect(in.readLEInt(), in.getFilePointer() + 12, "RW4-MT003", in.getFilePointer()); //TODO Not universal //(int)in.getFilePointer() + 16 , but 4 less because it reads it
21 | expect(in.readLEInt(), 0x00400000, "RW4-MT004", in.getFilePointer());
22 | hInfo_secNum = in.readLEInt();
23 | expect(in.readLEInt(), 1, "RW4-MT005", in.getFilePointer());
24 | texMet_secNum = in.readLEInt();
25 | expect(in.readLEInt(), 0, "RW4-MT006", in.getFilePointer()); //TODO Not Universal
26 |
27 | hInfo = (RW4HierarchyInfo) sections.get(hInfo_secNum);
28 | texMet = (RW4TexMetadata) sections.get(texMet_secNum);
29 | }
30 |
31 | @Override
32 | public void write(OutputStreamAccessor out, List sections) throws IOException {
33 | hInfo_secNum = sections.indexOf(hInfo);
34 | texMet_secNum = sections.indexOf(texMet);
35 | out.writeLEInt(0x00400000);
36 | out.writeLEInt(0x0063FFB0);
37 | out.writeLEInt(out.getFilePointer() + 16);
38 | out.writeLEInt(0x00400000);
39 | out.writeLEInt(hInfo_secNum);
40 | out.writeLEInt(1);
41 | out.writeLEInt(texMet_secNum);
42 | out.writeInt(0);
43 | }
44 |
45 | @Override
46 | public void print() {
47 | System.out.println("### " + this.getClass().getSimpleName() + " section " + this.sectionInfo.number);
48 | System.out.println("\thierarchy info section: " + hInfo_secNum);
49 | System.out.println("\ttex metadata section: " + texMet_secNum);
50 | }
51 |
52 | @Override
53 | public int getSectionTypeCode() {
54 | return type_code;
55 | }
56 | @Override
57 | public int getSectionAlignment() {
58 | return alignment;
59 | }
60 | }
61 |
--------------------------------------------------------------------------------
/src/sporemodder/files/formats/renderWare4/RW4Matrices4x4.java:
--------------------------------------------------------------------------------
1 | package sporemodder.files.formats.renderWare4;
2 |
3 | import java.io.IOException;
4 | import java.util.List;
5 |
6 | import sporemodder.files.InputStreamAccessor;
7 | import sporemodder.files.OutputStreamAccessor;
8 |
9 | public class RW4Matrices4x4 extends RW4Section {
10 | public static final int type_code = 0x70003;
11 | public static final int alignment = 16;
12 | public Mat4x4[] matrices;
13 | @Override
14 | public void read(InputStreamAccessor in, List sections) throws IOException {
15 | int p1 = in.readLEInt();
16 | int count = in.readLEInt();
17 | expect(in.readInt(), 0, "RW4-MAT001", in.getFilePointer());
18 | expect(in.readInt(), 0, "RW4-MAT002", in.getFilePointer());
19 | expect(in.getFilePointer(), p1, "RW4-MAT003", in.getFilePointer());
20 | matrices = new Mat4x4[count];
21 | for (int i = 0; i < count; i++) {
22 | matrices[i] = new Mat4x4();
23 | matrices[i].read(in);
24 | }
25 | }
26 |
27 | @Override
28 | public void write(OutputStreamAccessor out, List sections) throws IOException {
29 | out.writeLEInt(out.getFilePointer() + 16);
30 | out.writeLEInt(matrices.length);
31 | out.writeInt(0);
32 | out.writeInt(0);
33 | for (Mat4x4 matrix : matrices) {
34 | matrix.write(out);
35 | }
36 | }
37 |
38 | @Override
39 | public void print() {
40 | System.out.println("### " + this.getClass().getSimpleName() + " section " + this.sectionInfo.number);
41 | for (Mat4x4 mt : matrices) {
42 | mt.print();
43 | }
44 | }
45 |
46 | public class Mat4x4 {
47 | public float[] values;
48 | public void read(InputStreamAccessor in) throws IOException {
49 | values = new float[16];
50 | for (int i = 0; i < 16; i++) {
51 | values[i] = in.readLEFloat();
52 | }
53 | }
54 | public void write(OutputStreamAccessor out) throws IOException {
55 | out.writeLEFloats(values);
56 | }
57 | public void print() {
58 | System.out.println("\t["+values[0]+", "+values[1]+", "+values[2]+", "+values[3]+"] ["+values[4]+", "+values[5]+", "+values[6]+", "+values[7]+"] ["
59 | +values[8]+", "+values[9]+", "+values[10]+", "+values[11]+"] ["+values[12]+", "+values[13]+", "+values[14]+", "+values[15]+"]");
60 | }
61 | }
62 |
63 | @Override
64 | public int getSectionTypeCode() {
65 | return type_code;
66 | }
67 | @Override
68 | public int getSectionAlignment() {
69 | return alignment;
70 | }
71 | }
72 |
--------------------------------------------------------------------------------
/src/sporemodder/files/formats/renderWare4/RW4MeshMatAssignment.java:
--------------------------------------------------------------------------------
1 | package sporemodder.files.formats.renderWare4;
2 |
3 | import java.io.IOException;
4 | import java.util.List;
5 |
6 | import sporemodder.files.InputStreamAccessor;
7 | import sporemodder.files.OutputStreamAccessor;
8 |
9 | public class RW4MeshMatAssignment extends RW4Section {
10 | public static final int type_code = 0x2001a;
11 | public static final int alignment = 4;
12 | public RW4Mesh mesh;
13 | public RW4TexMetadata[] texMetadatas;
14 | public int tmCount, mesh_secNum;
15 | public int[] tm_secNums;
16 | @Override
17 | public void read(InputStreamAccessor in, List sections) throws IOException {
18 | mesh_secNum = in.readLEInt();
19 | tmCount = in.readLEInt();
20 | tm_secNums = new int[tmCount];
21 | for (int i = 0; i < tmCount; i++) {
22 | tm_secNums[i] = in.readLEInt();
23 | }
24 | mesh = (RW4Mesh) sections.get(mesh_secNum);
25 | texMetadatas = new RW4TexMetadata[tmCount];
26 | for (int i = 0; i < tmCount; i++) {
27 | texMetadatas[i] = (RW4TexMetadata)sections.get(tm_secNums[i]);
28 | }
29 | }
30 |
31 | @Override
32 | public void write(OutputStreamAccessor out, List sections) throws IOException {
33 | mesh_secNum = sections.indexOf(mesh);
34 | tm_secNums = new int[texMetadatas.length];
35 | for (int i = 0; i < tm_secNums.length; i++) {
36 | tm_secNums[i] = sections.indexOf(texMetadatas[i]);
37 | }
38 | out.writeLEInt(mesh_secNum);
39 | out.writeLEInt(tmCount);
40 | out.writeLEInts(tm_secNums);
41 | }
42 |
43 | @Override
44 | public void print() {
45 | System.out.println("### " + this.getClass().getSimpleName() + " section " + this.sectionInfo.number);
46 | System.out.println("\tmesh section: " + mesh_secNum);
47 | System.out.println("\ttex metadata count: " + tmCount);
48 | System.out.println("\ttex metadata section: " + tm_secNums[0]);
49 | }
50 |
51 | @Override
52 | public int getSectionTypeCode() {
53 | return type_code;
54 | }
55 | @Override
56 | public int getSectionAlignment() {
57 | return alignment;
58 | }
59 | }
60 |
--------------------------------------------------------------------------------
/src/sporemodder/files/formats/renderWare4/RW4Skeleton.java:
--------------------------------------------------------------------------------
1 | package sporemodder.files.formats.renderWare4;
2 |
3 | import java.io.IOException;
4 | import java.util.List;
5 |
6 | import sporemodder.files.InputStreamAccessor;
7 | import sporemodder.files.OutputStreamAccessor;
8 |
9 | public class RW4Skeleton extends RW4Section {
10 | public static final int type_code = 0x7000c;
11 | public static final int alignment = 4;
12 | public RW4Matrices4x3 mat4x3; //It look like some kind of mask, always [1, 0, 0], [0, 0, 1], [0, 0, 0], [0, 1, 0]
13 | public RW4Matrices4x4 mat4x4;
14 | public RW4HierarchyInfo jointInfo;
15 | private int mat4x3_secNum, mat4x4_secNum, jointInfo_secNum;
16 | @Override
17 | public void read(InputStreamAccessor in, List sections) throws IOException {
18 | expect(in.readLEInt(), 0x00400000, "RW4-SK001", in.getFilePointer());
19 | expect(in.readLEInt(), 0x008d6da0, "RW4-SK002", in.getFilePointer());
20 | mat4x3_secNum = in.readLEInt();
21 | jointInfo_secNum = in.readLEInt();
22 | mat4x4_secNum = in.readLEInt();
23 |
24 | mat4x3 = (RW4Matrices4x3) sections.get(mat4x3_secNum);
25 | jointInfo = (RW4HierarchyInfo) sections.get(jointInfo_secNum);
26 | mat4x4 = (RW4Matrices4x4) sections.get(mat4x4_secNum);
27 | }
28 |
29 | @Override
30 | public void write(OutputStreamAccessor out, List sections) throws IOException {
31 | mat4x3_secNum = sections.indexOf(mat4x3);
32 | mat4x4_secNum = sections.indexOf(mat4x4);
33 | jointInfo_secNum = sections.indexOf(jointInfo);
34 | out.writeLEInt(0x00400000);
35 | out.writeLEInt(0x008d6da0); // Skeleton type? It's different in limbs, for example
36 | out.writeLEInt(mat4x3_secNum);
37 | out.writeLEInt(jointInfo_secNum);
38 | out.writeLEInt(mat4x4_secNum);
39 | }
40 |
41 | @Override
42 | public void print() {
43 | System.out.println("### " + this.getClass().getSimpleName() + " section " + this.sectionInfo.number);
44 | System.out.println("\tmatrices 4x3 section: " + mat4x3_secNum);
45 | System.out.println("\tmatrices 4x4 section: " + mat4x4_secNum);
46 | System.out.println("\tjoint info section: " + jointInfo_secNum);
47 | }
48 |
49 | @Override
50 | public int getSectionTypeCode() {
51 | return type_code;
52 | }
53 | @Override
54 | public int getSectionAlignment() {
55 | return alignment;
56 | }
57 | }
58 |
--------------------------------------------------------------------------------
/src/sporemodder/files/formats/renderWare4/RW4TriangleArray.java:
--------------------------------------------------------------------------------
1 | package sporemodder.files.formats.renderWare4;
2 |
3 | import java.io.IOException;
4 | import java.util.List;
5 |
6 | import sporemodder.files.InputStreamAccessor;
7 | import sporemodder.files.OutputStreamAccessor;
8 | import sporemodder.utilities.Hasher;
9 |
10 | public class RW4TriangleArray extends RW4Section {
11 | private int field_0;
12 | private int startIndex;
13 | private int indicesCount;
14 | private int primitiveType = 4;
15 | private int secNum;
16 | private RW4Buffer triBuffer;
17 |
18 | public static final int type_code = 0x20007;
19 | public static final int alignment = 4;
20 | @Override
21 | public void read(InputStreamAccessor in, List sections) throws IOException {
22 | field_0 = in.readLEInt();
23 | expect(startIndex = in.readLEInt(), 0, "RW4-TA001", in.getFilePointer());
24 | indicesCount = in.readLEInt();
25 | expect(in.readLEInt(), 8, "RW4-TA002", in.getFilePointer());
26 | expect(in.readLEInt(), 101, "RW4-TA003", in.getFilePointer());
27 | expect(primitiveType = in.readLEInt(), 4, "RW4-TA004", in.getFilePointer());
28 | secNum = in.readLEInt();
29 | if (indicesCount % 3 != 0) System.out.println("RW4-TA010");
30 | triBuffer = (RW4Buffer) sections.get(secNum);
31 | }
32 |
33 | @Override
34 | public void write(OutputStreamAccessor out, List sections) throws IOException {
35 | secNum = sections.indexOf(triBuffer);
36 | out.writeLEInt(field_0);
37 | out.writeLEInt(startIndex);
38 | out.writeLEInt(indicesCount);
39 | out.writeLEInt(8);
40 | out.writeLEInt(101);
41 | out.writeLEInt(primitiveType);
42 | out.writeLEInt(secNum);
43 | }
44 |
45 | @Override
46 | public void print() {
47 | System.out.println("### " + this.getClass().getSimpleName() + " section " + this.sectionInfo.number);
48 | System.out.println("\ttriangle buffer section: " + secNum);
49 | System.out.println("\ttriangle count: " + (indicesCount / 3));
50 | System.out.println("\tunk1: " + field_0 + "\t" + Hasher.hashToHex(field_0));
51 | }
52 |
53 | @Override
54 | public int getSectionTypeCode() {
55 | return type_code;
56 | }
57 | @Override
58 | public int getSectionAlignment() {
59 | return alignment;
60 | }
61 | }
62 |
--------------------------------------------------------------------------------
/src/sporemodder/files/formats/renderWare4/RW4VertexArray.java:
--------------------------------------------------------------------------------
1 | package sporemodder.files.formats.renderWare4;
2 |
3 | import java.io.IOException;
4 | import java.util.List;
5 |
6 | import sporemodder.files.InputStreamAccessor;
7 | import sporemodder.files.OutputStreamAccessor;
8 | import sporemodder.utilities.Hasher;
9 |
10 | public class RW4VertexArray extends RW4Section {
11 | public static final int type_code = 0x20005;
12 | public static final int alignment = 4;
13 |
14 | public RW4VertexFormat vertexFormat;
15 | public RW4Buffer vertexBuffer;
16 |
17 | private int unk1;
18 | private int baseVertexIndex;
19 | private int vertexCount, vertexSize;
20 | private int vertSection;
21 | private int vertFormatSection;
22 |
23 | @Override
24 | public void read(InputStreamAccessor in, List sections) throws IOException {
25 | vertFormatSection = in.readLEInt();
26 | vertexFormat = (RW4VertexFormat)sections.get(vertFormatSection);
27 |
28 | unk1 = in.readLEInt();
29 | expect(baseVertexIndex = in.readLEInt(), 0, "RW4-VA001", in.getFilePointer());
30 | vertexCount = in.readLEInt();
31 | // System.out.println("vertex count: " + vertexCount);
32 | expect(in.readLEInt(), 8, "RW4-VA002", in.getFilePointer());
33 |
34 | vertexSize = in.readLEInt();
35 | vertSection = in.readLEInt();
36 | vertexBuffer = (RW4Buffer)sections.get(vertSection);
37 | }
38 |
39 | @Override
40 | public void write(OutputStreamAccessor out, List sections) throws IOException {
41 | vertFormatSection = sections.indexOf(vertexFormat);
42 | vertSection = sections.indexOf(vertexBuffer);
43 | out.writeLEInt(vertFormatSection);
44 | out.writeLEInt(unk1);
45 | out.writeLEInt(baseVertexIndex);
46 | out.writeLEInt(vertexCount);
47 | out.writeLEInt(8);
48 | out.writeLEInt(vertexSize);
49 | out.writeLEInt(vertSection);
50 | }
51 |
52 | @Override
53 | public void print() {
54 | System.out.println("### " + this.getClass().getSimpleName() + " section " + this.sectionInfo.number);
55 | System.out.println("\tvertex buffer section: " + vertSection);
56 | System.out.println("\tvertex format section: " + vertFormatSection);
57 | System.out.println("\tvertex count: " + vertexCount);
58 | System.out.println("\tvertex size: " + vertexSize);
59 | System.out.println("\tunk1: " + unk1 + "\t" + Hasher.hashToHex(unk1));
60 | }
61 |
62 | @Override
63 | public int getSectionTypeCode() {
64 | return type_code;
65 | }
66 | @Override
67 | public int getSectionAlignment() {
68 | return alignment;
69 | }
70 | }
71 |
--------------------------------------------------------------------------------
/src/sporemodder/files/formats/shaders/DebugShader.java:
--------------------------------------------------------------------------------
1 | package sporemodder.files.formats.shaders;
2 |
3 | import java.io.IOException;
4 |
5 | import sporemodder.files.InputStreamAccessor;
6 | import sporemodder.files.formats.shaders.SourceManager.ShaderSource;
7 |
8 | public class DebugShader extends ShaderSource {
9 |
10 | public static enum ShaderType {VERTEX, PIXEL};
11 |
12 | private byte[] infoData; // ?
13 | private byte[] data;
14 | private ShaderConstant[] constants;
15 | private int[] startRegisters;
16 | private int field_12C;
17 |
18 | // Only used for toString
19 | public int index;
20 | public ShaderType shaderType;
21 |
22 | public DebugShader(ShaderType shaderType, int index) {
23 | this.index = index;
24 | this.shaderType = shaderType;
25 | }
26 |
27 | public String getShaderSource(SourceManager manager) throws IOException, InterruptedException {
28 | // this class either represents a vertex or pixel shader, but we'll always store the source as a vertex shader for convenience
29 | if (vertexShaderSource == null) {
30 | vertexShaderSource = manager.loadSource(this, data);
31 | }
32 | return vertexShaderSource;
33 | }
34 |
35 | public void read(InputStreamAccessor in) throws IOException {
36 | infoData = new byte[32];
37 | in.read(infoData);
38 |
39 | data = new byte[in.readInt()];
40 | in.read(data);
41 |
42 | constants = new ShaderConstant[in.readInt()];
43 | for (int i = 0; i < constants.length; i++) {
44 | constants[i] = new ShaderConstant();
45 | constants[i].read(in);
46 | }
47 |
48 | startRegisters = new int[constants.length];
49 | in.readInts(startRegisters);
50 |
51 | field_12C = in.readInt();
52 | }
53 |
54 | @Override
55 | public String toString() {
56 | return (shaderType == ShaderType.VERTEX ? "_vertex_" : "_pixel_") + index;
57 | }
58 |
59 | public ShaderConstant[] getConstants() {
60 | return constants;
61 | }
62 |
63 | public int getField_12C() {
64 | return field_12C;
65 | }
66 |
67 | public int[] getStartRegisters() {
68 | return startRegisters;
69 | }
70 |
71 | }
72 |
--------------------------------------------------------------------------------
/src/sporemodder/files/formats/shaders/ShaderConstant.java:
--------------------------------------------------------------------------------
1 | package sporemodder.files.formats.shaders;
2 |
3 | import java.io.IOException;
4 |
5 | import sporemodder.files.InputStreamAccessor;
6 |
7 | public class ShaderConstant {
8 | public int constantIndex; // short;
9 | public int field_2; // short;
10 | public int registerSize; // short; register size?
11 | public int register; // short;
12 | public int field_8;
13 |
14 | public void read(InputStreamAccessor in) throws IOException {
15 | constantIndex = in.readShort();
16 | field_2 = in.readShort();
17 | registerSize = in.readShort();
18 | register = in.readShort();
19 | field_8 = in.readInt();
20 | }
21 | }
--------------------------------------------------------------------------------
/src/sporemodder/files/formats/shaders/ShaderEntry.java:
--------------------------------------------------------------------------------
1 | package sporemodder.files.formats.shaders;
2 |
3 | import java.io.IOException;
4 |
5 | import sporemodder.files.InputStreamAccessor;
6 | import sporemodder.utilities.Hasher;
7 |
8 | // TODO need better name
9 | public abstract class ShaderEntry {
10 |
11 | private int entryID;
12 |
13 | private int var_28;
14 | private int var_24;
15 | private int var_2C;
16 | private int var_30;
17 | private int var_34;
18 | private int field_44;
19 |
20 | private String entryName;
21 |
22 | public void read(InputStreamAccessor in, int version) throws IOException {
23 |
24 | entryID = in.readInt();
25 |
26 | var_28 = in.readInt();
27 | var_24 = in.readInt();
28 | var_2C = in.readInt();
29 | var_30 = in.readInt();
30 | var_34 = in.readInt();
31 | field_44 = in.readInt();
32 |
33 | if ((field_44 & 0x10) != 0) {
34 | entryName = in.readString8(in.readInt());
35 | }
36 | }
37 |
38 | public void print() {
39 | System.out.println("entryID: " + Hasher.getFileName(entryID));
40 | System.out.println("var_28: " + var_28);
41 | System.out.println("var_24: " + var_24);
42 | System.out.println("var_2C: " + var_2C);
43 | System.out.println("var_30: 0x" + Integer.toHexString(var_30));
44 | System.out.println("var_34: 0x" + Integer.toHexString(var_34));
45 | System.out.println("field_44: " + field_44);
46 | if (entryName != null) {
47 | System.out.println("shaderName: " + entryName);
48 | }
49 |
50 | System.out.println();
51 | }
52 |
53 | public int getEntryID() {
54 | return entryID;
55 | }
56 |
57 | public String getEntryName() {
58 | return entryName;
59 | }
60 |
61 | public void setEntryID(int entryID) {
62 | this.entryID = entryID;
63 | }
64 |
65 | public void setEntryName(String entryName) {
66 | this.entryName = entryName;
67 | }
68 |
69 | @Override
70 | public String toString() {
71 | return entryName;
72 | }
73 |
74 | public int getVar_28() {
75 | return var_28;
76 | }
77 |
78 | public int getVar_24() {
79 | return var_24;
80 | }
81 |
82 | public int getVar_2C() {
83 | return var_2C;
84 | }
85 |
86 | public int getVar_30() {
87 | return var_30;
88 | }
89 |
90 | public int getVar_34() {
91 | return var_34;
92 | }
93 |
94 | public int getField_44() {
95 | return field_44;
96 | }
97 |
98 | }
99 |
--------------------------------------------------------------------------------
/src/sporemodder/files/formats/shaders/UncompiledShaders.java:
--------------------------------------------------------------------------------
1 | package sporemodder.files.formats.shaders;
2 |
3 | import java.io.BufferedWriter;
4 | import java.io.File;
5 | import java.io.FileWriter;
6 | import java.io.IOException;
7 | import java.util.ArrayList;
8 | import java.util.List;
9 |
10 | import sporemodder.files.FileStreamAccessor;
11 | import sporemodder.files.InputStreamAccessor;
12 | import sporemodder.files.formats.FileFormatStructure.DefaulFormatStructure;
13 |
14 | public class UncompiledShaders extends DefaulFormatStructure {
15 |
16 | private static final int SHADER_COUNT = 255; // 255 ?
17 |
18 | private final List shaders = new ArrayList();
19 |
20 | public List read(InputStreamAccessor in) throws IOException {
21 | int version = in.readInt();
22 |
23 | for (int i = 0; i < SHADER_COUNT; i++) {
24 |
25 | UncompiledShader shader = new UncompiledShader();
26 | shader.read(in);
27 | shaders.add(shader);
28 | }
29 |
30 | return shaders;
31 | }
32 |
33 | public void writeHLSL(File outputFolder) throws IOException {
34 | for (int i = 0; i < shaders.size(); i++) {
35 | String shaderName = shaders.get(i).getShaderName();
36 |
37 | if (shaderName == null || shaderName.length() == 0) {
38 | shaderName = Integer.toString(i);
39 | }
40 |
41 | try (BufferedWriter out = new BufferedWriter(new FileWriter(new File(outputFolder, shaderName + ".hlsl")))) {
42 | shaders.get(i).writeHLSL(out);
43 | }
44 | }
45 | }
46 |
47 | public static void main(String[] args) throws IOException {
48 |
49 | // String inputPath = "E:\\Eric\\SporeMaster AG\\spore.unpacked\\#40212002\\#00000003.cpp";
50 | // String outputPath = "E:\\Eric\\Spore DLL Injection\\Shaders\\#40212002\\";
51 |
52 | String inputPath = "E:\\Downloads\\CompiledMaterials.package.unpacked\\#40212002\\#00000003.#0469A3F7";
53 | String outputPath = "E:\\Eric\\Spore DLL Injection\\Shaders\\Darkspore #40212002\\";
54 |
55 | try (InputStreamAccessor in = new FileStreamAccessor(inputPath, "r")) {
56 |
57 | UncompiledShaders shaders = new UncompiledShaders();
58 | shaders.read(in);
59 | shaders.writeHLSL(new File(outputPath));
60 | }
61 | }
62 | }
63 |
--------------------------------------------------------------------------------
/src/sporemodder/files/formats/snr/SNRMain.java:
--------------------------------------------------------------------------------
1 | package sporemodder.files.formats.snr;
2 |
3 | import java.io.IOException;
4 |
5 | import sporemodder.files.InputStreamAccessor;
6 | import sporemodder.files.StreamAccessor;
7 |
8 | public class SNRMain {
9 | public void read(InputStreamAccessor in) throws IOException {
10 | //TODO Add support for SNR and SNS files
11 | int identifier = in.readByte();
12 |
13 | if (identifier == 4) { //FFMPEG
14 |
15 | }
16 | }
17 | }
18 |
--------------------------------------------------------------------------------
/src/sporemodder/files/formats/spui/InvalidBlockException.java:
--------------------------------------------------------------------------------
1 | package sporemodder.files.formats.spui;
2 |
3 | public class InvalidBlockException extends Exception {
4 |
5 | /**
6 | *
7 | */
8 | private static final long serialVersionUID = -7988981141036016557L;
9 |
10 | public SPUIBlock block;
11 | public SPUISection section;
12 |
13 | public InvalidBlockException(String arg0, SPUIBlock block, SPUISection section) {
14 | super(arg0);
15 | this.block = block;
16 | this.section = section;
17 | }
18 |
19 | public InvalidBlockException(String arg0, SPUISection section) {
20 | super(arg0);
21 | this.section = section;
22 | }
23 |
24 | public InvalidBlockException(String arg0) {
25 | super(arg0);
26 | }
27 | }
28 |
--------------------------------------------------------------------------------
/src/sporemodder/files/formats/spui/SPUIChannel.java:
--------------------------------------------------------------------------------
1 | package sporemodder.files.formats.spui;
2 |
3 | import sporemodder.files.formats.spui.SPUIResource.RESOURCE_TYPE;
4 |
5 | public class SPUIChannel {
6 | //IMAGE_RESOURCE(0x01BE0001, DISPLAY_TYPE.DEFAULT);
7 |
8 | private static final SPUIChannel[] channels = {
9 | new SPUIChannel(0x01BE0001, DISPLAY_TYPE.DEFAULT, RESOURCE_TYPE.ATLAS),
10 | new SPUIChannel(0xEEC1B004, DISPLAY_TYPE.HEX), // tint
11 | };
12 |
13 | protected static enum DISPLAY_TYPE {DEFAULT, HEX, DECIMAL};
14 |
15 | protected int channel;
16 | protected DISPLAY_TYPE displayType = DISPLAY_TYPE.DEFAULT;
17 | protected RESOURCE_TYPE resourceType = null;
18 |
19 | private SPUIChannel(int channel, DISPLAY_TYPE displayType) {
20 | this.channel = channel;
21 | this.displayType = displayType;
22 | }
23 |
24 | private SPUIChannel(int channel, DISPLAY_TYPE displayType, RESOURCE_TYPE resourceType) {
25 | this.channel = channel;
26 | this.displayType = displayType;
27 | this.resourceType = resourceType;
28 | }
29 |
30 | public static SPUIChannel getChannel(int channel) {
31 | for (SPUIChannel c : channels) {
32 | if (c.channel == channel) {
33 | return c;
34 | }
35 | }
36 | return null;
37 | }
38 | }
39 |
--------------------------------------------------------------------------------
/src/sporemodder/files/formats/spui/SPUIObject.java:
--------------------------------------------------------------------------------
1 | package sporemodder.files.formats.spui;
2 |
3 | public interface SPUIObject {
4 |
5 | public int getBlockIndex();
6 | public SPUIMain getParent();
7 | public void setParent(SPUIMain parent);
8 | public int getObjectType();
9 | public String getTypeString();
10 |
11 | public abstract class SPUIDefaultObject implements SPUIObject {
12 |
13 | protected SPUIMain parent;
14 |
15 | public SPUIDefaultObject() {
16 | }
17 |
18 | public abstract int getBlockIndex();
19 |
20 | public SPUIMain getParent() {
21 | return parent;
22 | }
23 |
24 | public void setParent(SPUIMain parent) {
25 | this.parent = parent;
26 | }
27 | }
28 | }
29 |
--------------------------------------------------------------------------------
/src/sporemodder/files/formats/spui/SPUIResource.java:
--------------------------------------------------------------------------------
1 | package sporemodder.files.formats.spui;
2 |
3 | import java.io.IOException;
4 |
5 | import sporemodder.files.InputStreamAccessor;
6 | import sporemodder.files.OutputStreamAccessor;
7 | import sporemodder.files.formats.argscript.ArgScriptCommand;
8 | import sporemodder.files.formats.argscript.ArgScriptException;
9 |
10 | public interface SPUIResource extends SPUIObject {
11 |
12 | public void parse(ArgScriptCommand c) throws ArgScriptException, IOException;
13 | public void parse(String str) throws IOException;
14 | public ArgScriptCommand toCommand();
15 | public String getString();
16 | public void read(InputStreamAccessor in, int version) throws IOException;
17 | public void write(OutputStreamAccessor out, int version) throws IOException;
18 |
19 | public static enum RESOURCE_TYPE {IMAGE, ATLAS, TYPE3, STRUCT};
20 | public RESOURCE_TYPE getType();
21 | }
22 |
--------------------------------------------------------------------------------
/src/sporemodder/files/formats/spui/SPUISectionContainer.java:
--------------------------------------------------------------------------------
1 | package sporemodder.files.formats.spui;
2 |
3 | import java.util.List;
4 |
5 | public interface SPUISectionContainer {
6 |
7 | public List getSections();
8 |
9 | public SPUISection getSection(int channel);
10 |
11 | public T getSection(int channel, Class clazz);
12 | }
13 |
--------------------------------------------------------------------------------
/src/sporemodder/files/formats/tlsa/TLSAAnimationGroup.java:
--------------------------------------------------------------------------------
1 | package sporemodder.files.formats.tlsa;
2 |
3 | import java.io.IOException;
4 |
5 | import sporemodder.files.FileStructureException;
6 | import sporemodder.files.InputStreamAccessor;
7 | import sporemodder.files.OutputStreamAccessor;
8 | import sporemodder.files.formats.argscript.ArgScriptBlock;
9 | import sporemodder.files.formats.argscript.ArgScriptException;
10 |
11 | public interface TLSAAnimationGroup {
12 | public void read(InputStreamAccessor in) throws IOException, FileStructureException;
13 | public void parse(ArgScriptBlock block) throws IOException, ArgScriptException;
14 | public void write(OutputStreamAccessor out) throws IOException;
15 | public ArgScriptBlock toBlock() throws IOException;
16 | }
--------------------------------------------------------------------------------
/src/sporemodder/files/formats/tlsa/TLSAAnimationV7.java:
--------------------------------------------------------------------------------
1 | package sporemodder.files.formats.tlsa;
2 |
3 | import java.io.IOException;
4 | import java.util.List;
5 |
6 | import sporemodder.files.formats.FileStructure;
7 | import sporemodder.files.formats.argscript.ArgScriptCommand;
8 | import sporemodder.files.formats.argscript.ArgScriptException;
9 | import sporemodder.utilities.Hasher;
10 |
11 | public class TLSAAnimationV7 extends FileStructure {
12 | protected int id;
13 | protected String description = "";
14 |
15 | public void parse(ArgScriptCommand command) throws IOException, ArgScriptException {
16 |
17 | id = Hasher.getFileHash(command.getKeyword());
18 | List args = command.getArguments(0, 1);
19 | if (args.size() == 1) {
20 | description = args.get(0);
21 | }
22 | }
23 |
24 | public ArgScriptCommand toCommand() throws IOException {
25 | return new ArgScriptCommand(Hasher.getFileName(id), description);
26 | }
27 | }
28 |
--------------------------------------------------------------------------------
/src/sporemodder/files/resources/BoosterPack2.prop:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/emd4600/SporeModder/142fdcf1c2472b1ceacc2168eb76446840723208/src/sporemodder/files/resources/BoosterPack2.prop
--------------------------------------------------------------------------------
/src/sporemodder/files/resources/ExpansionPack1.prop:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/emd4600/SporeModder/142fdcf1c2472b1ceacc2168eb76446840723208/src/sporemodder/files/resources/ExpansionPack1.prop
--------------------------------------------------------------------------------
/src/sporemodder/userinterface/ErrorManager.java:
--------------------------------------------------------------------------------
1 | package sporemodder.userinterface;
2 |
3 | import java.io.PrintWriter;
4 | import java.io.StringWriter;
5 |
6 | public class ErrorManager {
7 |
8 | private static final int MAX_STACKTRACE = 6;
9 |
10 | public static String getStackTraceString(Throwable e) {
11 | return getStackTraceString(e, "");
12 | }
13 |
14 | private static String getStackTraceString(Throwable e, String indent) {
15 | StringBuilder sb = new StringBuilder();
16 | sb.append(e.toString());
17 | sb.append("\n");
18 |
19 | StackTraceElement[] stack = e.getStackTrace();
20 | if (stack != null) {
21 | for (int i = 0; i < MAX_STACKTRACE && i < stack.length; i++) {
22 | StackTraceElement stackTraceElement = stack[i];
23 | sb.append(indent);
24 | sb.append("\tat ");
25 | sb.append(stackTraceElement.toString());
26 | sb.append("\n");
27 | }
28 | }
29 |
30 | Throwable[] suppressedExceptions = e.getSuppressed();
31 | // Print suppressed exceptions indented one level deeper.
32 | if (suppressedExceptions != null) {
33 | for (Throwable throwable : suppressedExceptions) {
34 | sb.append(indent);
35 | sb.append("\tSuppressed: ");
36 | sb.append(getStackTraceString(throwable, indent + "\t"));
37 | }
38 | }
39 |
40 | Throwable cause = e.getCause();
41 | if (cause != null) {
42 | sb.append(indent);
43 | sb.append("Caused by: ");
44 | sb.append(getStackTraceString(cause, indent));
45 | }
46 |
47 | return sb.toString();
48 | }
49 |
50 | public static String getStringFromException(Exception ex) {
51 | StringWriter errors = new StringWriter();
52 | ex.printStackTrace(new PrintWriter(errors));
53 |
54 | return errors.toString();
55 | }
56 | }
57 |
--------------------------------------------------------------------------------
/src/sporemodder/userinterface/HintTextField.java:
--------------------------------------------------------------------------------
1 | package sporemodder.userinterface;
2 |
3 | import java.awt.event.FocusEvent;
4 | import java.awt.event.FocusListener;
5 |
6 | import javax.swing.JTextField;
7 |
8 | public class HintTextField extends JTextField implements FocusListener {
9 |
10 | /**
11 | *
12 | */
13 | private static final long serialVersionUID = 1089678163089003292L;
14 |
15 | private final String hint;
16 | private boolean showingHint;
17 |
18 | public HintTextField(final String hint) {
19 | super(hint);
20 | this.hint = hint;
21 | this.showingHint = true;
22 | super.addFocusListener(this);
23 | }
24 |
25 | @Override
26 | public void focusGained(FocusEvent e) {
27 | if(this.getText().isEmpty() || showingHint) {
28 | super.setText("");
29 | showingHint = false;
30 | }
31 | }
32 | @Override
33 | public void focusLost(FocusEvent e) {
34 | if(this.getText().isEmpty()) {
35 | super.setText(hint);
36 | showingHint = true;
37 | }
38 | }
39 |
40 | @Override
41 | public String getText() {
42 | return showingHint ? "" : super.getText();
43 | }
44 |
45 | @Override
46 | public void setText(String text) {
47 | if (text == null) {
48 | showingHint = true;
49 | super.setText(hint);
50 | }
51 | else {
52 | showingHint = false;
53 | super.setText(text);
54 | }
55 | }
56 | }
57 |
--------------------------------------------------------------------------------
/src/sporemodder/userinterface/JGradientButton.java:
--------------------------------------------------------------------------------
1 | package sporemodder.userinterface;
2 |
3 | import java.awt.Color;
4 | import java.awt.GradientPaint;
5 | import java.awt.Graphics;
6 | import java.awt.Graphics2D;
7 | import java.awt.Point;
8 |
9 | import javax.swing.JButton;
10 |
11 | public class JGradientButton extends JButton {
12 | /**
13 | *
14 | */
15 | private static final long serialVersionUID = 5987321611378710248L;
16 |
17 | private Color color;
18 |
19 | public JGradientButton() {
20 | this("...", null);
21 | }
22 |
23 | public JGradientButton(String text) {
24 | this(text, null);
25 | }
26 |
27 | public JGradientButton(String text, Color color) {
28 | super(text);
29 | this.color = color;
30 | setContentAreaFilled(false);
31 | // setBorder(BorderFactory.createMatteBorder(1, 1, 1, 1, Color.black));
32 | }
33 |
34 | @Override
35 | protected void paintComponent(Graphics g) {
36 | final Graphics2D g2 = (Graphics2D) g.create();
37 | Color finalColor = Color.GRAY;
38 | if (color != null) {
39 | finalColor = color;
40 | }
41 |
42 | g2.setPaint(new GradientPaint(
43 | new Point(0, 0),
44 | finalColor, /* Color.WHITE, */
45 | new Point(0, getHeight()),
46 | finalColor.darker()));
47 | g2.fillRect(0, 0, getWidth(), getHeight());
48 | g2.setColor(Color.black);
49 | g2.drawRect(0, 0, getWidth() - 1, getHeight() - 1);
50 | g2.dispose();
51 |
52 | super.paintComponent(g);
53 | }
54 |
55 | public Color getColor() {
56 | return color;
57 | }
58 |
59 | public void setColor(Color color) {
60 | this.color = color;
61 | }
62 | }
63 |
--------------------------------------------------------------------------------
/src/sporemodder/userinterface/contextmenu/UITreePopClickListener.java:
--------------------------------------------------------------------------------
1 | package sporemodder.userinterface.contextmenu;
2 |
3 | import java.awt.event.MouseAdapter;
4 | import java.awt.event.MouseEvent;
5 |
6 | import javax.swing.JTree;
7 | import javax.swing.tree.TreePath;
8 |
9 | public class UITreePopClickListener extends MouseAdapter {
10 | private JTree tree;
11 |
12 | public UITreePopClickListener(JTree tree) {
13 | this.tree = tree;
14 | }
15 |
16 | @Override
17 | public void mouseReleased(MouseEvent e) {
18 | if (e.isPopupTrigger()) {
19 | int x = e.getX();
20 | int y = e.getY();
21 | TreePath path = tree.getPathForLocation(x, y);
22 | tree.setSelectionPath(path);
23 |
24 | if (path != null) {
25 | UIFileContextMenu contextMenu = new UIFileContextMenu(path);
26 | contextMenu.show(e.getComponent(), x, y);
27 | }
28 | }
29 | }
30 | }
31 |
--------------------------------------------------------------------------------
/src/sporemodder/userinterface/dialogs/DropTargetTextField.java:
--------------------------------------------------------------------------------
1 | package sporemodder.userinterface.dialogs;
2 |
3 | import java.awt.datatransfer.DataFlavor;
4 | import java.awt.datatransfer.UnsupportedFlavorException;
5 | import java.awt.dnd.DnDConstants;
6 | import java.awt.dnd.DropTarget;
7 | import java.awt.dnd.DropTargetDropEvent;
8 | import java.io.File;
9 | import java.io.IOException;
10 | import java.util.List;
11 |
12 | import javax.swing.JTextField;
13 |
14 | public class DropTargetTextField extends DropTarget {
15 | /**
16 | *
17 | */
18 | private static final long serialVersionUID = -4528122831625911394L;
19 |
20 | private JTextField target;
21 | //TODO this is for the output file; is it necessary?
22 | // private boolean singleFile;
23 |
24 | public DropTargetTextField(JTextField target, boolean singleFile) {
25 | this.target = target;
26 | // this.singleFile = singleFile;
27 | }
28 |
29 | public synchronized void drop(DropTargetDropEvent event) {
30 | event.acceptDrop(DnDConstants.ACTION_COPY);
31 | try {
32 | @SuppressWarnings("unchecked")
33 | List droppedFiles = (List) event.getTransferable().getTransferData(DataFlavor.javaFileListFlavor);
34 |
35 | int count = droppedFiles.size();
36 | StringBuilder sb = new StringBuilder();
37 | for (int i = 0; i < droppedFiles.size(); i++) {
38 | sb.append(droppedFiles.get(i));
39 |
40 | if (i != count-1) {
41 | sb.append("|");
42 | }
43 | }
44 |
45 | target.setText(sb.toString());
46 |
47 | } catch (UnsupportedFlavorException | IOException e) {
48 | // TODO Auto-generated catch block
49 | e.printStackTrace();
50 | }
51 | }
52 | }
53 |
--------------------------------------------------------------------------------
/src/sporemodder/userinterface/dialogs/UIDialogEffects.java:
--------------------------------------------------------------------------------
1 | package sporemodder.userinterface.dialogs;
2 |
3 | import java.awt.Component;
4 | import java.awt.FlowLayout;
5 |
6 | import javax.swing.BorderFactory;
7 | import javax.swing.JCheckBox;
8 | import javax.swing.JDialog;
9 | import javax.swing.JFileChooser;
10 | import javax.swing.JPanel;
11 | import javax.swing.JTabbedPane;
12 | import javax.swing.filechooser.FileNameExtensionFilter;
13 |
14 | import sporemodder.MainApp;
15 | import sporemodder.files.formats.effects.EffectPacker;
16 | import sporemodder.files.formats.effects.EffectUnpacker;
17 |
18 | public class UIDialogEffects extends JDialog {
19 |
20 | /**
21 | *
22 | */
23 | private static final long serialVersionUID = -749325139849689050L;
24 |
25 | private static final FileNameExtensionFilter FILEFILTER_EFFDIR = new FileNameExtensionFilter("Spore Effect Directory (*.effdir)", "effdir");
26 |
27 | private JTabbedPane tabbedPane;
28 |
29 | public UIDialogEffects() {
30 | super(MainApp.getUserInterface());
31 | setModalityType(ModalityType.TOOLKIT_MODAL);
32 | setTitle("Convert Spore Effects (EFFDIR/PFX)");
33 | setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE);
34 | setResizable(false);
35 |
36 | tabbedPane = new JTabbedPane();
37 | UIConvertDialog unpackDialog = new UIConvertDialog(this, FILEFILTER_EFFDIR, FILEFILTER_EFFDIR, "effdir", "effdir", false, new EffectUnpacker(), null,
38 | JFileChooser.FILES_ONLY, false, JFileChooser.DIRECTORIES_ONLY, false);
39 | // unpackDialog.setInputChooserSelectionMode(JFileChooser.FILES_ONLY, false);
40 | // unpackDialog.setOutputChooserSelectionMode(JFileChooser.DIRECTORIES_ONLY, false);
41 | tabbedPane.addTab("Unpack .effdir", unpackDialog);
42 |
43 | UIConvertDialog packDialog = new UIConvertDialog(this, FILEFILTER_EFFDIR, FILEFILTER_EFFDIR, "effdir", "effdir", true, new EffectPacker(), null,
44 | JFileChooser.DIRECTORIES_ONLY, false, JFileChooser.FILES_ONLY, false);
45 | // packDialog.setInputChooserSelectionMode(JFileChooser.DIRECTORIES_ONLY, false);
46 | // packDialog.setOutputChooserSelectionMode(JFileChooser.FILES_ONLY, false);
47 | tabbedPane.addTab("Pack .effdir", packDialog);
48 |
49 | getContentPane().add(tabbedPane);
50 |
51 | pack();
52 | setLocationRelativeTo(null);
53 | setVisible(true);
54 | }
55 | }
56 |
--------------------------------------------------------------------------------
/src/sporemodder/userinterface/dialogs/UIDialogGait.java:
--------------------------------------------------------------------------------
1 | package sporemodder.userinterface.dialogs;
2 |
3 | import javax.swing.JDialog;
4 | import javax.swing.JTabbedPane;
5 | import javax.swing.filechooser.FileNameExtensionFilter;
6 |
7 | import sporemodder.MainApp;
8 | import sporemodder.files.formats.gait.GaitToTxt;
9 | import sporemodder.files.formats.gait.TxtToGait;
10 |
11 | public class UIDialogGait extends JDialog {
12 |
13 | /**
14 | *
15 | */
16 | private static final long serialVersionUID = -1160612132870691425L;
17 |
18 | protected static final FileNameExtensionFilter FILEFILTER_GAIT = new FileNameExtensionFilter("Spore Gait (*.gait)", "gait");
19 | protected static final FileNameExtensionFilter FILEFILTER_GAIT_T = new FileNameExtensionFilter("Text Spore Gait (*.gait_t)", "gait_t");
20 |
21 | private JTabbedPane tabbedPane;
22 |
23 | public UIDialogGait() {
24 | super(MainApp.getUserInterface());
25 | setModalityType(ModalityType.TOOLKIT_MODAL);
26 | setTitle("Convert Spore Gait (GAIT)");
27 | setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE);
28 | setResizable(false);
29 |
30 | tabbedPane = new JTabbedPane();
31 | tabbedPane.addTab(".gait to .gait_t", new UIConvertDialog(this, FILEFILTER_GAIT, FILEFILTER_GAIT_T, "gait", "gait_t", false, new GaitToTxt()));
32 | tabbedPane.addTab(".gait_t to .gait", new UIConvertDialog(this, FILEFILTER_GAIT_T, FILEFILTER_GAIT, "gait_t", "gait", true, new TxtToGait()));
33 |
34 | getContentPane().add(tabbedPane);
35 |
36 | pack();
37 | setLocationRelativeTo(null);
38 | setVisible(true);
39 | }
40 | }
41 |
--------------------------------------------------------------------------------
/src/sporemodder/userinterface/dialogs/UIDialogPctp.java:
--------------------------------------------------------------------------------
1 | package sporemodder.userinterface.dialogs;
2 |
3 | import javax.swing.JDialog;
4 | import javax.swing.JTabbedPane;
5 | import javax.swing.filechooser.FileNameExtensionFilter;
6 |
7 | import sporemodder.MainApp;
8 | import sporemodder.files.formats.pctp.PctpToTxt;
9 | import sporemodder.files.formats.pctp.TxtToPctp;
10 |
11 | public class UIDialogPctp extends JDialog {
12 |
13 | /**
14 | *
15 | */
16 | private static final long serialVersionUID = -1160612132870691425L;
17 |
18 | protected static final FileNameExtensionFilter FILEFILTER_PCTP = new FileNameExtensionFilter("Spore Capability List (*.pctp)", "pctp");
19 | protected static final FileNameExtensionFilter FILEFILTER_PCTP_T = new FileNameExtensionFilter("Text Spore Capability List (*.pctp_t)", "pctp_t");
20 |
21 | private JTabbedPane tabbedPane;
22 |
23 | public UIDialogPctp() {
24 | super(MainApp.getUserInterface());
25 | setModalityType(ModalityType.TOOLKIT_MODAL);
26 | setTitle("Convert Spore Capability List (PCTP)");
27 | setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE);
28 | setResizable(false);
29 |
30 | tabbedPane = new JTabbedPane();
31 | tabbedPane.addTab(".pctp to .pctp_t", new UIConvertDialog(this, FILEFILTER_PCTP, FILEFILTER_PCTP_T, "pctp", "pctp_t", false, new PctpToTxt()));
32 | tabbedPane.addTab(".pctp_t to .pctp", new UIConvertDialog(this, FILEFILTER_PCTP_T, FILEFILTER_PCTP, "pctp_t", "pctp", true, new TxtToPctp()));
33 |
34 | getContentPane().add(tabbedPane);
35 |
36 | pack();
37 | setLocationRelativeTo(null);
38 | setVisible(true);
39 | }
40 | }
41 |
--------------------------------------------------------------------------------
/src/sporemodder/userinterface/dialogs/UIDialogProp.java:
--------------------------------------------------------------------------------
1 | package sporemodder.userinterface.dialogs;
2 |
3 | import javax.swing.JDialog;
4 | import javax.swing.JTabbedPane;
5 | import javax.swing.filechooser.FileNameExtensionFilter;
6 |
7 | import sporemodder.MainApp;
8 | import sporemodder.files.formats.prop.PropToXml;
9 | import sporemodder.files.formats.prop.XmlToProp;
10 |
11 | public class UIDialogProp extends JDialog {
12 |
13 | /**
14 | *
15 | */
16 | private static final long serialVersionUID = 8834838963815833923L;
17 |
18 | private static final FileNameExtensionFilter FILEFILTER_PROP = new FileNameExtensionFilter("Spore Property List (*.prop)", "prop");
19 | private static final FileNameExtensionFilter FILEFILTER_XML = new FileNameExtensionFilter("XML Spore Property List (*.xml)", "xml");
20 |
21 | private JTabbedPane tabbedPane;
22 |
23 | public UIDialogProp() {
24 | super(MainApp.getUserInterface());
25 | setModalityType(ModalityType.TOOLKIT_MODAL);
26 | setTitle("Convert Spore Property List (PROP)");
27 | setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE);
28 | setResizable(false);
29 |
30 | tabbedPane = new JTabbedPane();
31 |
32 | UIConvertDialog.addConvertTab(this, tabbedPane, new PropToXml(), ".prop to .xml", FILEFILTER_PROP, FILEFILTER_XML, "prop", "xml", false);
33 | UIConvertDialog.addConvertTab(this, tabbedPane, new XmlToProp(), ".xml to .prop", FILEFILTER_XML, FILEFILTER_PROP, "xml", "prop", true);
34 |
35 | getContentPane().add(tabbedPane);
36 |
37 | pack();
38 | setLocationRelativeTo(null);
39 | setVisible(true);
40 | }
41 | }
42 |
--------------------------------------------------------------------------------
/src/sporemodder/userinterface/dialogs/UIDialogRast.java:
--------------------------------------------------------------------------------
1 | package sporemodder.userinterface.dialogs;
2 |
3 | import javax.swing.JDialog;
4 | import javax.swing.JTabbedPane;
5 | import javax.swing.filechooser.FileNameExtensionFilter;
6 |
7 | import sporemodder.MainApp;
8 | import sporemodder.files.formats.rast.DDStoRast;
9 | import sporemodder.files.formats.rast.RastToDDS;
10 |
11 | public class UIDialogRast extends JDialog {
12 |
13 | /**
14 | *
15 | */
16 | private static final long serialVersionUID = -1160612132870691425L;
17 |
18 | protected static final FileNameExtensionFilter FILEFILTER_RASTER = new FileNameExtensionFilter("Spore RAST Texture (*.raster)", "raster");
19 | protected static final FileNameExtensionFilter FILEFILTER_DDS = new FileNameExtensionFilter("Direct Draw Surface Texture (*.dds)", "dds");
20 |
21 | private JTabbedPane tabbedPane;
22 |
23 | public UIDialogRast() {
24 | super(MainApp.getUserInterface());
25 | setModalityType(ModalityType.TOOLKIT_MODAL);
26 | setTitle("Convert Spore RAST Texture (RAST)");
27 | setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE);
28 | setResizable(false);
29 |
30 | tabbedPane = new JTabbedPane();
31 | tabbedPane.addTab(".raster to .raster.dds", new UIConvertDialog(this, FILEFILTER_RASTER, FILEFILTER_DDS, "raster", "dds", false, new RastToDDS()));
32 | tabbedPane.addTab(".raster.dds to .raster", new UIConvertDialog(this, FILEFILTER_DDS, FILEFILTER_RASTER, "dds", "raster", true, new DDStoRast()));
33 |
34 | getContentPane().add(tabbedPane);
35 |
36 | pack();
37 | setLocationRelativeTo(null);
38 | setVisible(true);
39 | }
40 | }
41 |
--------------------------------------------------------------------------------
/src/sporemodder/userinterface/dialogs/UIDialogRw4.java:
--------------------------------------------------------------------------------
1 | package sporemodder.userinterface.dialogs;
2 |
3 | import javax.swing.JDialog;
4 | import javax.swing.JTabbedPane;
5 | import javax.swing.filechooser.FileNameExtensionFilter;
6 |
7 | import sporemodder.MainApp;
8 | import sporemodder.files.formats.renderWare4.DDSToRw4;
9 | import sporemodder.files.formats.renderWare4.Rw4ToDDS;
10 |
11 | public class UIDialogRw4 extends JDialog {
12 |
13 | /**
14 | *
15 | */
16 | private static final long serialVersionUID = -1160612132870691425L;
17 |
18 | protected static final FileNameExtensionFilter FILEFILTER_RW4 = new FileNameExtensionFilter("Spore RenderWare4 (*.rw4)", "rw4");
19 | protected static final FileNameExtensionFilter FILEFILTER_DDS = new FileNameExtensionFilter("Direct Draw Surface Texture (*.dds)", "dds");
20 |
21 | private JTabbedPane tabbedPane;
22 |
23 | public UIDialogRw4() {
24 | super(MainApp.getUserInterface());
25 | setModalityType(ModalityType.TOOLKIT_MODAL);
26 | setTitle("Convert Spore RenderWare4 Texture (RW4)");
27 | setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE);
28 | setResizable(false);
29 |
30 | tabbedPane = new JTabbedPane();
31 | tabbedPane.addTab(".rw4 to .rw4.dds", new UIConvertDialog(this, FILEFILTER_RW4, FILEFILTER_DDS, "rw4", "dds", false, new Rw4ToDDS()));
32 | tabbedPane.addTab(".rw4.dds to .rw4", new UIConvertDialog(this, FILEFILTER_DDS, FILEFILTER_RW4, "dds", "rw4", true, new DDSToRw4()));
33 |
34 | getContentPane().add(tabbedPane);
35 |
36 | pack();
37 | setLocationRelativeTo(null);
38 | setVisible(true);
39 | }
40 | }
41 |
--------------------------------------------------------------------------------
/src/sporemodder/userinterface/dialogs/UIDialogTlsa.java:
--------------------------------------------------------------------------------
1 | package sporemodder.userinterface.dialogs;
2 |
3 | import javax.swing.JDialog;
4 | import javax.swing.JTabbedPane;
5 | import javax.swing.filechooser.FileNameExtensionFilter;
6 |
7 | import sporemodder.MainApp;
8 | import sporemodder.files.formats.tlsa.TlsaToTxt;
9 | import sporemodder.files.formats.tlsa.TxtToTlsa;
10 |
11 | public class UIDialogTlsa extends JDialog {
12 |
13 | /**
14 | *
15 | */
16 | private static final long serialVersionUID = -1160612132870691425L;
17 |
18 | protected static final FileNameExtensionFilter FILEFILTER_TLSA = new FileNameExtensionFilter("Spore Animation List (*.tlsa)", "tlsa");
19 | protected static final FileNameExtensionFilter FILEFILTER_TLSA_T = new FileNameExtensionFilter("Text Spore Animation List (*.tlsa_t)", "tlsa_t");
20 |
21 | private JTabbedPane tabbedPane;
22 |
23 | public UIDialogTlsa() {
24 | super(MainApp.getUserInterface());
25 | setModalityType(ModalityType.TOOLKIT_MODAL);
26 | setTitle("Convert Spore Animation List (TLSA)");
27 | setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE);
28 | setResizable(false);
29 |
30 | tabbedPane = new JTabbedPane();
31 | tabbedPane.addTab(".tlsa to .tlsa_t", new UIConvertDialog(this, FILEFILTER_TLSA, FILEFILTER_TLSA_T, "tlsa", "tlsa_t", false, new TlsaToTxt()));
32 | tabbedPane.addTab(".tlsa_t to .tlsa", new UIConvertDialog(this, FILEFILTER_TLSA_T, FILEFILTER_TLSA, "tlsa_t", "tlsa", true, new TxtToTlsa()));
33 |
34 | getContentPane().add(tabbedPane);
35 |
36 | pack();
37 | setLocationRelativeTo(null);
38 | setVisible(true);
39 | }
40 | }
41 |
--------------------------------------------------------------------------------
/src/sporemodder/userinterface/dialogs/UIDialogUncompiledShaders.java:
--------------------------------------------------------------------------------
1 | package sporemodder.userinterface.dialogs;
2 |
3 | import javax.swing.JDialog;
4 | import javax.swing.JFileChooser;
5 | import javax.swing.filechooser.FileNameExtensionFilter;
6 |
7 | import sporemodder.MainApp;
8 | import sporemodder.files.formats.effects.EffectUnpacker;
9 | import sporemodder.files.formats.shaders.UncompiledShadersConverter;
10 |
11 | public class UIDialogUncompiledShaders extends JDialog {
12 |
13 | private static final FileNameExtensionFilter FILEFILTER_EFFDIR = new FileNameExtensionFilter("Spore Effect Directory (*.effdir)", "effdir");
14 |
15 | public UIDialogUncompiledShaders() {
16 | super(MainApp.getUserInterface());
17 | setModalityType(ModalityType.TOOLKIT_MODAL);
18 | setTitle("Unpack Spore Unconverted Shaders");
19 | setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE);
20 | setResizable(false);
21 |
22 | UIConvertDialog unpackDialog = new UIConvertDialog(this, null, null, null, null, false, new UncompiledShadersConverter(), null,
23 | JFileChooser.FILES_ONLY, false, JFileChooser.DIRECTORIES_ONLY, false);
24 |
25 | getContentPane().add(unpackDialog);
26 |
27 | pack();
28 | setLocationRelativeTo(null);
29 | setVisible(true);
30 | }
31 | }
32 |
--------------------------------------------------------------------------------
/src/sporemodder/userinterface/fileview/FileView.java:
--------------------------------------------------------------------------------
1 | package sporemodder.userinterface.fileview;
2 |
3 | import java.io.File;
4 |
5 | import javax.swing.JComponent;
6 | import javax.swing.JTabbedPane;
7 |
8 | import sporemodder.MainApp;
9 |
10 | public abstract class FileView {
11 | protected String path;
12 | protected File file;
13 |
14 | protected int tabIndex;
15 | protected JTabbedPane parentTabbedPane;
16 | protected String name;
17 |
18 | public FileView(String path) {
19 | this.path = path;
20 | file = MainApp.getCurrentProject().getFile(path);
21 | name = file.getName();
22 | }
23 |
24 | public FileView(String path, File file) {
25 | this.path = path;
26 | this.file = file;
27 | name = file.getName();
28 | }
29 |
30 | public abstract JComponent getPanel();
31 |
32 | public void setName(String name) {
33 | this.name = name;
34 | }
35 | public String getName() {
36 | return name;
37 | }
38 |
39 | public void setParentTabbedPane(JTabbedPane parentTabbedPane) {
40 | this.parentTabbedPane = parentTabbedPane;
41 | }
42 |
43 | public JTabbedPane getParentTabbedPane() {
44 | return parentTabbedPane;
45 | }
46 |
47 | public void setTabIndex(int tabIndex) {
48 | //TODO update parent tabbed pane!!!
49 | this.tabIndex = tabIndex;
50 | }
51 |
52 | public int getTabIndex() {
53 | return tabIndex;
54 | }
55 |
56 | public abstract boolean isEditable();
57 |
58 | public abstract void setEditable(boolean editable);
59 |
60 |
61 | public abstract int getViewType();
62 | }
63 |
--------------------------------------------------------------------------------
/src/sporemodder/userinterface/images/DebugPack_32x32.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/emd4600/SporeModder/142fdcf1c2472b1ceacc2168eb76446840723208/src/sporemodder/userinterface/images/DebugPack_32x32.png
--------------------------------------------------------------------------------
/src/sporemodder/userinterface/images/DebugPack_32x32.psd:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/emd4600/SporeModder/142fdcf1c2472b1ceacc2168eb76446840723208/src/sporemodder/userinterface/images/DebugPack_32x32.psd
--------------------------------------------------------------------------------
/src/sporemodder/userinterface/images/Execute_64.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/emd4600/SporeModder/142fdcf1c2472b1ceacc2168eb76446840723208/src/sporemodder/userinterface/images/Execute_64.png
--------------------------------------------------------------------------------
/src/sporemodder/userinterface/images/Icon_SPUI.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/emd4600/SporeModder/142fdcf1c2472b1ceacc2168eb76446840723208/src/sporemodder/userinterface/images/Icon_SPUI.png
--------------------------------------------------------------------------------
/src/sporemodder/userinterface/images/Icon_SPUI_24.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/emd4600/SporeModder/142fdcf1c2472b1ceacc2168eb76446840723208/src/sporemodder/userinterface/images/Icon_SPUI_24.png
--------------------------------------------------------------------------------
/src/sporemodder/userinterface/images/Icon_XML.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/emd4600/SporeModder/142fdcf1c2472b1ceacc2168eb76446840723208/src/sporemodder/userinterface/images/Icon_XML.png
--------------------------------------------------------------------------------
/src/sporemodder/userinterface/images/Icon_XML_24.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/emd4600/SporeModder/142fdcf1c2472b1ceacc2168eb76446840723208/src/sporemodder/userinterface/images/Icon_XML_24.png
--------------------------------------------------------------------------------
/src/sporemodder/userinterface/images/Pack.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/emd4600/SporeModder/142fdcf1c2472b1ceacc2168eb76446840723208/src/sporemodder/userinterface/images/Pack.png
--------------------------------------------------------------------------------
/src/sporemodder/userinterface/images/PackAndRun.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/emd4600/SporeModder/142fdcf1c2472b1ceacc2168eb76446840723208/src/sporemodder/userinterface/images/PackAndRun.png
--------------------------------------------------------------------------------
/src/sporemodder/userinterface/images/PackAndRun_48x32.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/emd4600/SporeModder/142fdcf1c2472b1ceacc2168eb76446840723208/src/sporemodder/userinterface/images/PackAndRun_48x32.png
--------------------------------------------------------------------------------
/src/sporemodder/userinterface/images/Pack_32x32.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/emd4600/SporeModder/142fdcf1c2472b1ceacc2168eb76446840723208/src/sporemodder/userinterface/images/Pack_32x32.png
--------------------------------------------------------------------------------
/src/sporemodder/userinterface/images/RunWOPack.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/emd4600/SporeModder/142fdcf1c2472b1ceacc2168eb76446840723208/src/sporemodder/userinterface/images/RunWOPack.png
--------------------------------------------------------------------------------
/src/sporemodder/userinterface/images/RunWOPack_32x32.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/emd4600/SporeModder/142fdcf1c2472b1ceacc2168eb76446840723208/src/sporemodder/userinterface/images/RunWOPack_32x32.png
--------------------------------------------------------------------------------
/src/sporemodder/userinterface/images/SporeModderIcon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/emd4600/SporeModder/142fdcf1c2472b1ceacc2168eb76446840723208/src/sporemodder/userinterface/images/SporeModderIcon.png
--------------------------------------------------------------------------------
/src/sporemodder/userinterface/images/Unpack.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/emd4600/SporeModder/142fdcf1c2472b1ceacc2168eb76446840723208/src/sporemodder/userinterface/images/Unpack.png
--------------------------------------------------------------------------------
/src/sporemodder/userinterface/images/Unpack_32x32.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/emd4600/SporeModder/142fdcf1c2472b1ceacc2168eb76446840723208/src/sporemodder/userinterface/images/Unpack_32x32.png
--------------------------------------------------------------------------------
/src/sporemodder/userinterface/images/UtilitiesPanel_Disabled.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/emd4600/SporeModder/142fdcf1c2472b1ceacc2168eb76446840723208/src/sporemodder/userinterface/images/UtilitiesPanel_Disabled.png
--------------------------------------------------------------------------------
/src/sporemodder/userinterface/images/UtilitiesPanel_Enabled.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/emd4600/SporeModder/142fdcf1c2472b1ceacc2168eb76446840723208/src/sporemodder/userinterface/images/UtilitiesPanel_Enabled.png
--------------------------------------------------------------------------------
/src/sporemodder/userinterface/images/config_20.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/emd4600/SporeModder/142fdcf1c2472b1ceacc2168eb76446840723208/src/sporemodder/userinterface/images/config_20.png
--------------------------------------------------------------------------------
/src/sporemodder/userinterface/images/config_24.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/emd4600/SporeModder/142fdcf1c2472b1ceacc2168eb76446840723208/src/sporemodder/userinterface/images/config_24.png
--------------------------------------------------------------------------------
/src/sporemodder/userinterface/images/execute_24.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/emd4600/SporeModder/142fdcf1c2472b1ceacc2168eb76446840723208/src/sporemodder/userinterface/images/execute_24.png
--------------------------------------------------------------------------------
/src/sporemodder/userinterface/images/maximize.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/emd4600/SporeModder/142fdcf1c2472b1ceacc2168eb76446840723208/src/sporemodder/userinterface/images/maximize.png
--------------------------------------------------------------------------------
/src/sporemodder/userinterface/images/maximize_24.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/emd4600/SporeModder/142fdcf1c2472b1ceacc2168eb76446840723208/src/sporemodder/userinterface/images/maximize_24.png
--------------------------------------------------------------------------------
/src/sporemodder/userinterface/images/minimize.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/emd4600/SporeModder/142fdcf1c2472b1ceacc2168eb76446840723208/src/sporemodder/userinterface/images/minimize.png
--------------------------------------------------------------------------------
/src/sporemodder/userinterface/images/minimize_24.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/emd4600/SporeModder/142fdcf1c2472b1ceacc2168eb76446840723208/src/sporemodder/userinterface/images/minimize_24.png
--------------------------------------------------------------------------------
/src/sporemodder/userinterface/images/save_24.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/emd4600/SporeModder/142fdcf1c2472b1ceacc2168eb76446840723208/src/sporemodder/userinterface/images/save_24.png
--------------------------------------------------------------------------------
/src/sporemodder/userinterface/images/save_64.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/emd4600/SporeModder/142fdcf1c2472b1ceacc2168eb76446840723208/src/sporemodder/userinterface/images/save_64.png
--------------------------------------------------------------------------------
/src/sporemodder/userinterface/settings/project/SettingsCategory.java:
--------------------------------------------------------------------------------
1 | package sporemodder.userinterface.settings.project;
2 |
3 | import javax.swing.JDialog;
4 | import javax.swing.JPanel;
5 |
6 | import sporemodder.userinterface.settings.project.UIProjectSettings.SettingsMode;
7 | import sporemodder.utilities.Project;
8 |
9 | public abstract class SettingsCategory {
10 |
11 | protected Project project;
12 | protected SettingsMode mode;
13 |
14 | public SettingsCategory(Project project, SettingsMode mode) {
15 | this.project = project;
16 | this.mode = mode;
17 | }
18 |
19 | public void setProject(Project project) {
20 | this.project = project;
21 | }
22 | public Project getProject() {
23 | return project;
24 | }
25 |
26 | public void setSettingsMode(SettingsMode mode) {
27 | this.mode = mode;
28 | }
29 |
30 | public SettingsMode getSettingsMode() {
31 | return mode;
32 | }
33 |
34 | public abstract String getName();
35 |
36 | public abstract JPanel createPanel(JDialog parent);
37 |
38 | public abstract void saveSettings();
39 | }
40 |
--------------------------------------------------------------------------------
/src/sporemodder/userinterface/syntaxpane/NumberedParagraphView.java:
--------------------------------------------------------------------------------
1 | package sporemodder.userinterface.syntaxpane;
2 |
3 | import java.awt.Graphics;
4 | import java.awt.Graphics2D;
5 | import java.awt.Rectangle;
6 | import java.awt.Toolkit;
7 | import java.util.Map;
8 |
9 | import javax.swing.text.Element;
10 | import javax.swing.text.ParagraphView;
11 | import javax.swing.text.View;
12 |
13 | public class NumberedParagraphView extends ParagraphView {
14 |
15 | private static final int NUMBERS_WIDTH = 25;
16 |
17 | private static Map, ?> desktopHints = null;
18 |
19 | public NumberedParagraphView(Element arg0) {
20 | super(arg0);
21 | short top = 0;
22 | short left = 0;
23 | short bottom = 0;
24 | short right = 0;
25 | this.setInsets(top, left, bottom, right);
26 | }
27 |
28 | @Override
29 | protected void setInsets(short top, short left, short bottom, short right) {
30 | super.setInsets(top, (short)(left + NUMBERS_WIDTH), bottom, right);
31 | }
32 |
33 | public int getPreviousLineCount() {
34 | int lineCount = 0;
35 | View parent = getParent();
36 | int count = parent.getViewCount();
37 |
38 | for (int i = 0; i < count; i++) {
39 | if (parent.getView(i) == this) {
40 | break;
41 | }
42 | else {
43 | lineCount += parent.getView(i).getViewCount();
44 | }
45 | }
46 | return lineCount;
47 | }
48 |
49 | @Override
50 | public void paintChild(Graphics g, Rectangle r, int n) {
51 | super.paintChild(g, r, n);
52 | int previousLineCount = getPreviousLineCount();
53 | int numberX = r.x - getLeftInset();
54 | int numberY = r.y + r.height - 5;
55 | if (desktopHints == null) {
56 | Toolkit tk = Toolkit.getDefaultToolkit();
57 | desktopHints = (Map, ?>) (tk.getDesktopProperty("awt.font.desktophints"));
58 | }
59 | if (desktopHints != null) {
60 | ((Graphics2D)g).addRenderingHints(desktopHints);
61 | }
62 | g.drawString(Integer.toString(previousLineCount + n + 1), numberX, numberY);
63 | }
64 | }
65 |
--------------------------------------------------------------------------------
/src/sporemodder/utilities/FilteredListModel.java:
--------------------------------------------------------------------------------
1 | package sporemodder.utilities;
2 |
3 | import java.util.ArrayList;
4 |
5 | import javax.swing.AbstractListModel;
6 | import javax.swing.ListModel;
7 | import javax.swing.event.ListDataEvent;
8 | import javax.swing.event.ListDataListener;
9 |
10 | public class FilteredListModel extends AbstractListModel {
11 | public static interface Filter {
12 | boolean accept(Object element);
13 | }
14 |
15 | private final ListModel _source;
16 | private Filter _filter;
17 | private final ArrayList _indices = new ArrayList();
18 |
19 | public FilteredListModel(ListModel source) {
20 | if (source == null)
21 | throw new IllegalArgumentException("Source is null");
22 | _source = source;
23 | _source.addListDataListener(new ListDataListener() {
24 | public void intervalRemoved(ListDataEvent e) {
25 | doFilter();
26 | }
27 |
28 | public void intervalAdded(ListDataEvent e) {
29 | doFilter();
30 | }
31 |
32 | public void contentsChanged(ListDataEvent e) {
33 | doFilter();
34 | }
35 | });
36 | }
37 |
38 | public void setFilter(Filter f) {
39 | _filter = f;
40 | doFilter();
41 | }
42 |
43 | public void doFilter() {
44 | _indices.clear();
45 |
46 | Filter f = _filter;
47 | if (f != null) {
48 | int count = _source.getSize();
49 | for (int i = 0; i < count; i++) {
50 | Object element = _source.getElementAt(i);
51 | if (f.accept(element)) {
52 | _indices.add(i);
53 | }
54 | }
55 | fireContentsChanged(this, 0, getSize() - 1);
56 | }
57 | }
58 |
59 | public int getSize() {
60 | return (_filter != null) ? _indices.size() : _source.getSize();
61 | }
62 |
63 | public T getElementAt(int index) {
64 | return (_filter != null) ? _source.getElementAt(_indices.get(index)) : _source.getElementAt(index);
65 | }
66 | }
67 |
--------------------------------------------------------------------------------
/src/sporemodder/utilities/ModAPIDebugging.java:
--------------------------------------------------------------------------------
1 | package sporemodder.utilities;
2 |
3 | public class ModAPIDebugging {
4 |
5 | // This class creates information for the 'file debugging' feature in the ModCreatorKit / ModAPI
6 |
7 | public static void addDebugInformation(DBPFPackingTask dbpfTask)
8 | }
9 |
--------------------------------------------------------------------------------
/src/sporemodder/utilities/Timer.java:
--------------------------------------------------------------------------------
1 | package sporemodder.utilities;
2 |
3 | public class Timer {
4 |
5 | // Found in http://www.javaworld.com/article/2076241/build-ci-sdlc/tweak-your-io-performance-for-faster-runtime.html
6 | // A simple "stopwatch" class with millisecond accuracy
7 | protected long startTime, endTime;
8 |
9 | public void start() { startTime = System.currentTimeMillis(); }
10 | public void stop() { endTime = System.currentTimeMillis(); }
11 | public long getTime() { return endTime - startTime; }
12 |
13 | public void reset() {
14 | startTime = 0;
15 | endTime = 0;
16 | }
17 |
18 |
19 | public static class NanoTimer extends Timer {
20 | public void start() { startTime = System.nanoTime(); }
21 | public void stop() { endTime = System.nanoTime(); }
22 | }
23 | }
24 |
--------------------------------------------------------------------------------
/src/sporemodder/utilities/names/Condition.java:
--------------------------------------------------------------------------------
1 | package sporemodder.utilities.names;
2 |
3 | import sporemodder.utilities.Hasher;
4 |
5 | public class Condition {
6 | private static enum CompareFunc
7 | {
8 | EQUAL {
9 | protected boolean compare(Object a, Object b) {
10 | return a.equals(b);
11 | }
12 | },
13 | NOT_EQUAL {
14 | protected boolean compare(Object a, Object b) {
15 | return !a.equals(b);
16 | }
17 | };
18 |
19 | protected abstract boolean compare(Object a, Object b);
20 | };
21 |
22 | private static Object object;
23 |
24 | public String left;
25 | public CompareFunc compareFunc;
26 | public Object right;
27 |
28 | public Condition(String str) {
29 | parse(str);
30 | }
31 |
32 | private boolean parse(String str) {
33 | // LEFT_IDENTIFIER compareFunc RIGHT_IDENTIFIER
34 | String[] splits = str.split(" ");
35 | if (splits.length != 3) {
36 | System.err.println("Wrong number of tokens");
37 | return false;
38 | }
39 |
40 | left = splits[0];
41 | String s = splits[2];
42 | //TODO support for strings?
43 | right = Hasher.decodeInt(s);
44 |
45 | if (splits[1].equals("==")) {
46 | compareFunc = CompareFunc.EQUAL;
47 | }
48 | else if (splits[1].equals("!=")) {
49 | compareFunc = CompareFunc.NOT_EQUAL;
50 | }
51 | else {
52 | System.err.println("Unsupported compare function");
53 | return false;
54 | }
55 |
56 | return true;
57 | }
58 |
59 | protected boolean evaluate() {
60 | if (object != null) {
61 | return compareFunc.compare(object, right);
62 | }
63 | else {
64 | return false;
65 | }
66 | }
67 |
68 | public static void setObject(Object obj) {
69 | object = obj;
70 | }
71 | }
72 |
--------------------------------------------------------------------------------
/src/sporemodder/utilities/names/NameHashPair.java:
--------------------------------------------------------------------------------
1 | package sporemodder.utilities.names;
2 |
3 | import sporemodder.utilities.Hasher;
4 |
5 | public class NameHashPair {
6 | private String name;
7 | private int hash;
8 |
9 | // it should only be used in this package
10 | NameHashPair(String name, int hash) {
11 | this.name = name;
12 | this.hash = hash;
13 | }
14 |
15 | public String getName() {
16 | return name;
17 | }
18 |
19 | public int getHash() {
20 | return hash;
21 | }
22 |
23 | @Override
24 | public String toString() {
25 | return name + ": 0x" + Hasher.fillZeroInHexString(hash);
26 | }
27 | }
28 |
--------------------------------------------------------------------------------
/xfiledialog.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/emd4600/SporeModder/142fdcf1c2472b1ceacc2168eb76446840723208/xfiledialog.dll
--------------------------------------------------------------------------------
/xfiledialog.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/emd4600/SporeModder/142fdcf1c2472b1ceacc2168eb76446840723208/xfiledialog.jar
--------------------------------------------------------------------------------
/xfiledialog64.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/emd4600/SporeModder/142fdcf1c2472b1ceacc2168eb76446840723208/xfiledialog64.dll
--------------------------------------------------------------------------------