├── test ├── HaroohiePals.Gui.Test │ └── Usings.cs ├── HaroohiePals.NitroKart.NUnitTests │ ├── Usings.cs │ └── HaroohiePals.NitroKart.NUnitTest.csproj ├── HaroohiePals.Actions.Test │ └── Usings.cs ├── HaroohiePals.MarioKart.Test │ ├── Usings.cs │ └── HaroohiePals.MarioKart.Test.csproj ├── HaroohiePals.MarioKartToolbox.Test │ └── Usings.cs ├── HaroohiePals.NitroKart.Actions.Test │ ├── Usings.cs │ └── HaroohiePals.NitroKart.Actions.Test.csproj ├── HaroohiePals.Nitro.NitroSystem.Test │ ├── Assets │ │ ├── ermii.nsbmd │ │ ├── imd │ │ │ ├── cube.nsbmd │ │ │ ├── tex │ │ │ │ ├── pal.nsbtx │ │ │ │ ├── cube_nopow2.nsbtx │ │ │ │ ├── pal_nomerge.nsbtx │ │ │ │ └── tex_combined.nsbtx │ │ │ └── mat │ │ │ │ ├── cube_wire.nsbmd │ │ │ │ ├── cube_no1dot.nsbmd │ │ │ │ ├── cube_nofarclip.nsbmd │ │ │ │ ├── cube_shininess.nsbmd │ │ │ │ ├── cube_nodepthdecal.nsbmd │ │ │ │ └── cube_noxludepth.nsbmd │ │ ├── course_model.nsbmd │ │ ├── course_model.nsbtx │ │ └── ita │ │ │ ├── animtest.nsbta │ │ │ ├── dgc_sky.nsbta │ │ │ ├── BlackHole.nsbta │ │ │ ├── desert_gc.nsbta │ │ │ ├── patapata_gc.nsbta │ │ │ └── animtest_aligned.nsbta │ └── G3d │ │ └── Binary │ │ ├── NsbtxTest.cs │ │ ├── NsbmdTest.cs │ │ └── NsbtaTest.cs ├── HaroohiePals.IO.Test │ ├── IOUtilTests.cs │ └── HaroohiePals.IO.Test.csproj └── HaroohiePals.Nitro.Test │ └── Card │ └── KeyTransformTest.cs ├── docs └── assets │ └── img │ ├── icon.png │ ├── nkm_2d_view.png │ ├── nkm_3d_view.png │ └── nkm_camera_preview.png ├── src ├── HaroohiePals.MarioKart │ ├── MapData │ │ ├── IMapData.cs │ │ ├── IRoutePoint.cs │ │ ├── IPoint.cs │ │ ├── IRotatedPoint.cs │ │ ├── IMapDataCollection.cs │ │ ├── IMapDataEntry.cs │ │ ├── WeakMapDataReference.cs │ │ └── UnresolvedBinaryMapDataReference.cs │ └── HaroohiePals.MarioKart.csproj ├── HaroohiePals.NitroKart │ ├── Rom │ │ ├── FileToAddInfo.cs │ │ ├── ReadOverlayFilesResult.cs │ │ ├── MkdsRomProject.cs │ │ └── NdsRomInfo.cs │ ├── Race │ │ ├── CameraMode.cs │ │ ├── RaceConfig.cs │ │ ├── CameraParams.cs │ │ ├── RaceMode.cs │ │ └── RaceDisplayMode.cs │ ├── MapObj │ │ ├── Common │ │ │ ├── ItemboxQuestionAnimationFrame.cs │ │ │ ├── ItemboxBoxAnimationFrame.cs │ │ │ ├── ItemboxShadowType.cs │ │ │ └── ItemboxLogicPart.cs │ │ ├── IMkdsMapObjDatabase.cs │ │ ├── MkdsMapObjInfo.cs │ │ ├── Obstacles │ │ │ └── KoopaBlockLogicPart.cs │ │ ├── Enemies │ │ │ ├── TrafficLogicPart.cs │ │ │ └── TrafficParams.cs │ │ └── MapObjAttribute.cs │ ├── MapData │ │ ├── MkdsCameIntroCamera.cs │ │ ├── MkdsMapObjectGroup.cs │ │ ├── MkdsAreaType.cs │ │ ├── MkdsAreaShapeType.cs │ │ ├── MkdsCameraType.cs │ │ ├── Binary │ │ │ ├── NkmdEpat.cs │ │ │ ├── NkmdIpat.cs │ │ │ └── NkmdIpatEpatEntry.cs │ │ └── Intermediate │ │ │ └── Sections │ │ │ └── MobjSettings │ │ │ ├── CowSettings.cs │ │ │ ├── MoveTreeSettings.cs │ │ │ ├── KoopaBlockSettings.cs │ │ │ ├── GearSettings.cs │ │ │ ├── FlipperSettings.cs │ │ │ ├── DossunSettings.cs │ │ │ ├── SnowmanSettings.cs │ │ │ ├── MoveItemboxSettings.cs │ │ │ └── SanboSettings.cs │ ├── Course │ │ ├── MkdsFolderCourse.cs │ │ └── IMkdsCourse.cs │ └── MkdsContext.cs ├── HaroohiePals.Gui │ ├── ImGuiIconGlyph.cs │ ├── Resources │ │ ├── Icons │ │ │ ├── Redo_16x.png │ │ │ ├── Undo_16x.png │ │ │ ├── Folder_16x.png │ │ │ ├── Document_16x.png │ │ │ ├── ExportFile_16x.png │ │ │ ├── ImportFile_16x.png │ │ │ └── VSO_RecycleBin_16x.png │ │ └── Fonts │ │ │ ├── fa-solid-900.ttf │ │ │ └── Roboto-Regular.ttf │ ├── View │ │ ├── Modal │ │ │ ├── MessageModalButtonsType.cs │ │ │ ├── IModalService.cs │ │ │ └── ModalService.cs │ │ ├── IView.cs │ │ ├── ImSequencer │ │ │ ├── ImSequencerCustomDraw.cs │ │ │ └── ImSequencerOptions.cs │ │ ├── UpdateArgs.cs │ │ ├── PropertyGrid │ │ │ ├── IPropertyEditor.cs │ │ │ ├── PropertyGridFlags.cs │ │ │ ├── PropertyEditorContext.cs │ │ │ ├── PropertyInfoEqualityComparer.cs │ │ │ └── PropertyGridItem.cs │ │ ├── Toolbar │ │ │ └── ToolbarItem.cs │ │ ├── WindowContentView.cs │ │ ├── Tree │ │ │ └── TreeNode.cs │ │ ├── DockSpaceView.cs │ │ └── Menu │ │ │ └── MenuUtil.cs │ ├── ImGuiFont.cs │ ├── Util.cs │ ├── ImRect.cs │ ├── ImGuiGameWindowSettings.cs │ └── Win32Util.cs ├── HaroohiePals.Gui.Viewport │ ├── ImGuizmoMode.cs │ ├── SelectionHandle.cs │ ├── ImGuizmoConfirmAction.cs │ ├── GizmoTool.cs │ ├── GizmoRotateScaleMode.cs │ ├── Projection │ │ ├── IProjection.cs │ │ └── PerspectiveProjection.cs │ ├── IViewportCollision.cs │ ├── Framebuffers │ │ ├── IPickableFramebufferProvider.cs │ │ └── IGLFramebufferProvider.cs │ ├── Resources │ │ └── Shaders │ │ │ ├── idBlit.vert │ │ │ └── idBlit.frag │ ├── ImGuizmoMoveType.cs │ ├── ViewportKeyBindings.cs │ ├── PickingResult.cs │ ├── RenderGroupScenePerspective.cs │ ├── ImGuizmoOperation.cs │ ├── RenderGroupSceneTopDown.cs │ └── ViewportScene.cs ├── HaroohiePals.IO │ ├── Endianness.cs │ ├── Reference │ │ ├── IRestorableReference.cs │ │ ├── IReferenceSerializer.cs │ │ ├── IReferenceResolver.cs │ │ ├── IReferenceResolverCollection.cs │ │ ├── IReferenceSerializerCollection.cs │ │ ├── ReferenceResolveException.cs │ │ ├── IReferenceableExtensions.cs │ │ ├── ReferenceSerializationException.cs │ │ ├── RestorableReference.cs │ │ └── ReferenceHolder.cs │ ├── Serialization │ │ ├── Fx16Attribute.cs │ │ ├── Fx32Attribute.cs │ │ ├── IgnoreAttribute.cs │ │ ├── ConstantAttribute.cs │ │ ├── ChunkSizeAttribute.cs │ │ ├── AlignAttribute.cs │ │ ├── FieldAlignmentAttribute.cs │ │ ├── ArraySizeAttribute.cs │ │ ├── TypeAttribute.cs │ │ └── ReferenceAttribute.cs │ ├── Archive │ │ ├── ArcFile.cs │ │ ├── IReadOnlyArchive.cs │ │ └── ArcEntry.cs │ ├── HaroohiePals.IO.csproj │ └── Compression │ │ └── ICompressionAlgorithm.cs ├── HaroohiePals.Validation │ ├── ErrorLevel.cs │ ├── IValidator.cs │ ├── IValidationRule.cs │ ├── UnfixableValidationErrorException.cs │ ├── HaroohiePals.Validation.csproj │ └── Validator.cs ├── HaroohiePals.MarioKartToolbox │ ├── Resources │ │ ├── Icons │ │ │ ├── main.ico │ │ │ ├── main.png │ │ │ ├── main128.png │ │ │ ├── main32.png │ │ │ ├── Model3D_16x.png │ │ │ ├── ImageStack_16x.png │ │ │ └── TrafficCone_16x.png │ │ └── Shaders │ │ │ ├── fogPass.vert │ │ │ ├── kclOctreeCube.frag │ │ │ ├── kclPrism.vert │ │ │ └── kclOctreeCube.vert │ ├── Application │ │ ├── Settings │ │ │ ├── GameSettings.cs │ │ │ ├── CourseEditorSettings.cs │ │ │ ├── AppearanceSettings.cs │ │ │ ├── DiscordSettings.cs │ │ │ ├── KeyBindingSettings.cs │ │ │ ├── IApplicationSettingsService.cs │ │ │ ├── ApplicationSettings.cs │ │ │ ├── ShortcutKeyBindingSettings.cs │ │ │ ├── ViewportSettings.cs │ │ │ ├── ViewportKeyBindingSettings.cs │ │ │ └── ViewportColorSettings.cs │ │ ├── Discord │ │ │ ├── RichPresenceApplicationState.cs │ │ │ └── IApplicationDiscordRichPresenceService.cs │ │ └── Clipboard │ │ │ ├── IMapDataClipboard.cs │ │ │ ├── IMapDataClipboardSerializer.cs │ │ │ ├── ListMapDataClipboard.cs │ │ │ ├── Json │ │ │ ├── UnresolvedWeakJsonMapDataReference.cs │ │ │ └── UnresolvedWeakJsonReference.cs │ │ │ └── MapDataClipboardSerializationResult.cs │ ├── AssemblyInfo.cs │ ├── Gui │ │ ├── ViewModel │ │ │ ├── RomExplorer │ │ │ │ └── RomExplorerRomType.cs │ │ │ └── CourseEditor │ │ │ │ ├── CourseEditorRequestableAction.cs │ │ │ │ ├── ArchiveTreeViewPaneViewModel.cs │ │ │ │ └── MapDataGeneratorSettings.cs │ │ └── View │ │ │ ├── CourseEditor │ │ │ ├── CameraPreviewMode.cs │ │ │ ├── CameraPreviewViewportMode.cs │ │ │ ├── CameraPreviewSettings.cs │ │ │ ├── MapDataTreeNode.cs │ │ │ └── ICourseEditorViewFactory.cs │ │ │ ├── RomExplorer │ │ │ └── MkdsCourseListViewItem.cs │ │ │ ├── PropertyGrid │ │ │ └── MapDataReferenceEditMode.cs │ │ │ └── Main │ │ │ └── IMainWindowFactory.cs │ ├── KCollision │ │ ├── MkdsCollisionLightId.cs │ │ ├── MkdsColTypeInfo.cs │ │ ├── MkdsCollisionVariant.cs │ │ ├── MkdsKclPrism.cs │ │ └── MkdsCollisionType.cs │ ├── OpenGL │ │ ├── RenderGroups │ │ │ ├── MapData │ │ │ │ └── IColoredRenderGroup.cs │ │ │ ├── PlaneGridRenderGroup.cs │ │ │ └── KCollision │ │ │ │ └── KclViewerContext.cs │ │ └── Renderers │ │ │ └── IRendererFactory.cs │ └── Infrastructure │ │ └── Discord │ │ └── IDiscordRichPresenceService.cs ├── HaroohiePals.Nitro │ ├── Fs │ │ ├── NameTableEntryType.cs │ │ ├── DirectoryTableEntry.cs │ │ └── FatEntry.cs │ ├── Card │ │ ├── NdsRomOverlayTableEntryFlags.cs │ │ ├── NdsRomNitroFooter.cs │ │ └── NdsBannerHeader.cs │ ├── EndianBinaryReaderExtensions.cs │ ├── HaroohiePals.Nitro.csproj │ ├── BinaryBlockHeader.cs │ ├── EndianBinaryWriterExtensions.cs │ ├── G3 │ │ └── NitroVertexData.cs │ └── Gx │ │ └── Enums.cs ├── HaroohiePals.Actions │ ├── IAction.cs │ ├── IAtomicActionBuilder.cs │ ├── HaroohiePals.Actions.csproj │ ├── BatchAction.cs │ └── SetArrayItemAction.cs ├── HaroohiePals.Graphics3d │ ├── TextureFilterMode.cs │ ├── TextureWrapMode.cs │ ├── HaroohiePals.Graphics3d.csproj │ └── Texture.cs ├── HaroohiePals.Core │ ├── HaroohiePals.Core.csproj │ └── ComponentModel │ │ ├── PrettyArrayTypeConverter.cs │ │ └── NestedAttribute.cs ├── HaroohiePals.Graphics3d.OpenGL.Renderers │ ├── Resources │ │ ├── Models │ │ │ ├── arrow.png │ │ │ ├── test.png │ │ │ ├── boxText.png │ │ │ ├── uvgrid.png │ │ │ └── quad.obj │ │ └── Shaders │ │ │ └── line.frag │ ├── ArrowRenderer.cs │ ├── CircleRenderer.cs │ ├── BoxRenderer.cs │ ├── DotRenderer.cs │ ├── VertexData.cs │ ├── InstancedPointGlData.cs │ └── RendererUtil.cs ├── HaroohiePals.Nitro.NitroSystem │ ├── G3d │ │ ├── Animation │ │ │ ├── AnimationStep.cs │ │ │ ├── VisibilityAnimationResult.cs │ │ │ ├── JointAnimationResultFlag.cs │ │ │ ├── MaterialAnimationResultFlag.cs │ │ │ ├── AnimationStepExtensions.cs │ │ │ └── JointAnimationResult.cs │ │ ├── SbcCallbackTiming.cs │ │ ├── G3dConfig.cs │ │ ├── Binary │ │ │ ├── Animation │ │ │ │ ├── JointAnimation │ │ │ │ │ ├── G3dJointAnimationFlags.cs │ │ │ │ │ └── Nsbca.cs │ │ │ │ ├── TextureSrtAnimation │ │ │ │ │ └── G3dTextureSrtAnimationFlags.cs │ │ │ │ ├── G3dAnimation.cs │ │ │ │ └── TexturePatternAnimation │ │ │ │ │ ├── TexturePatternFrameValue.cs │ │ │ │ │ └── Nsbtp.cs │ │ │ ├── Model │ │ │ │ ├── G3dShapeFlags.cs │ │ │ │ ├── PaletteDictionaryData.cs │ │ │ │ ├── G3dMaterialFlags.cs │ │ │ │ ├── G3dEnvelopeMatrices.cs │ │ │ │ ├── PaletteToMaterialDictionaryData.cs │ │ │ │ ├── TextureToMaterialDictionaryData.cs │ │ │ │ ├── TextureDictionaryData.cs │ │ │ │ └── G3dPaletteInfo.cs │ │ │ ├── OffsetDictionaryData.cs │ │ │ ├── G3dDictionaryPatriciaTreeNode.cs │ │ │ ├── G3dDictionaryEntry.cs │ │ │ └── IG3dDictionaryData.cs │ │ ├── G3dRenderObjectFlag.cs │ │ ├── MaterialTextureInfo.cs │ │ ├── SbcCommand.cs │ │ ├── G3dRenderStateFlag.cs │ │ └── Intermediate │ │ │ └── Model │ │ │ ├── ImdBoxTest.cs │ │ │ ├── ImdOutputInfo.cs │ │ │ └── ImdTexPalette.cs │ ├── Snd │ │ └── Player │ │ │ ├── WaveArcLink.cs │ │ │ ├── Work.cs │ │ │ └── SharedWork.cs │ ├── HaroohiePals.Nitro.NitroSystem.csproj │ └── G2d │ │ └── Intermediate │ │ ├── Extr.cs │ │ ├── Link.cs │ │ └── Cmnt.cs ├── HaroohiePals.Graphics │ ├── Svg │ │ └── SvgColor.cs │ ├── Origin.cs │ ├── HaroohiePals.Graphics.csproj │ └── Rgba8Bitmap.cs ├── HaroohiePals.MarioKartToolbox.CommandLineInterface │ ├── Properties │ │ └── launchSettings.json │ ├── Program.cs │ └── HaroohiePals.MarioKartToolbox.CommandLineInterface.csproj ├── HaroohiePals.Math │ ├── Transform.cs │ └── HaroohiePals.Mathematics.csproj ├── HaroohiePals.Sound │ └── HaroohiePals.Sound.csproj ├── HaroohiePals.NitroKart.Validation │ ├── Course │ │ ├── IMkdsCourseValidatorFactory.cs │ │ ├── MkdsRequiredMapObjFileValidationError.cs │ │ └── MkdsCourseMapDataValidationRule.cs │ ├── MapData │ │ ├── IMkdsMapDataValidatorFactory.cs │ │ ├── Sections │ │ │ ├── MobjSettings │ │ │ │ ├── MkdsMobjSettingsValidationError.cs │ │ │ │ └── IMkdsMobjSettingsValidationRule.cs │ │ │ ├── MkdsPointWifiCoordOutOfRangeValidationError.cs │ │ │ ├── MkdsMapDataEntryValidationRule.cs │ │ │ ├── MkdsCheckPointValidationRule.cs │ │ │ ├── MkdsCannonPointValidationRule.cs │ │ │ ├── MkdsEnemyPointValidationRule.cs │ │ │ ├── MkdsItemPointValidationRule.cs │ │ │ ├── MkdsAreaValidationRule.cs │ │ │ ├── MkdsMapObjectTimeTrialVisibleValidationError.cs │ │ │ ├── MkdsCameraValidationRule.cs │ │ │ ├── MkdsRespawnPointValidationRule.cs │ │ │ └── MkdsPointWifiCoordOutOfRangeValidationRule.cs │ │ └── MkdsMapDataValidatorFactory.cs │ └── HaroohiePals.NitroKart.Validation.csproj ├── HaroohiePals.KclViewer │ ├── Program.cs │ └── Files │ │ ├── kclOctreeCube.frag │ │ ├── kclPrism.vert │ │ └── kclOctreeCube.vert ├── HaroohiePals.KCollision │ ├── Formats │ │ ├── Mk7Kcl.cs │ │ ├── SmgKcl.cs │ │ ├── MkwiiKcl.cs │ │ ├── Sm3dlKcl.cs │ │ ├── FloatKclPrism.cs │ │ ├── Fx32KclPrism.cs │ │ └── Sm64dsKclPrism.cs │ └── HaroohiePals.KCollision.csproj ├── HaroohiePals.Graphics3d.OpenGL │ ├── GLVertexAttribIAttribute.cs │ ├── GLVertexAttribAttribute.cs │ └── HaroohiePals.Graphics3d.OpenGL.csproj ├── HaroohiePals.NitroKart.Extensions │ └── HaroohiePals.NitroKart.Extensions.csproj ├── HaroohiePals.Nitro.JNLib.Spl │ ├── FloatHelper.cs │ ├── HaroohiePals.Nitro.JNLib.Spl.csproj │ └── Emitter │ │ ├── FieldGravityParams.cs │ │ ├── FieldRandomParams.cs │ │ ├── FieldMagnetParams.cs │ │ └── FieldConvergenceParams.cs ├── HaroohiePals.MarioKart.Actions │ └── HaroohiePals.MarioKart.Actions.csproj ├── HaroohiePals.Nitro.G3.OpenGL │ └── HaroohiePals.Nitro.G3.OpenGL.csproj ├── HaroohiePals.MarioKart.Validation │ ├── HaroohiePals.MarioKart.Validation.csproj │ └── MapData │ │ └── RequiredMapDataEntryReferenceValidationError.cs ├── HaroohiePals.Nitro.NitroSystem.G3d.OpenGL │ ├── GLG3dModelManager.cs │ └── GLG3dModelShader.cs └── HaroohiePals.NitroKart.Actions │ ├── HaroohiePals.NitroKart.Actions.csproj │ └── SetMkdsCourseCollisionAction.cs └── .github └── workflows └── dotnet-build-test.yml /test/HaroohiePals.Gui.Test/Usings.cs: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /test/HaroohiePals.NitroKart.NUnitTests/Usings.cs: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /test/HaroohiePals.Actions.Test/Usings.cs: -------------------------------------------------------------------------------- 1 | global using Xunit; -------------------------------------------------------------------------------- /test/HaroohiePals.MarioKart.Test/Usings.cs: -------------------------------------------------------------------------------- 1 | global using NUnit.Framework; -------------------------------------------------------------------------------- /test/HaroohiePals.MarioKartToolbox.Test/Usings.cs: -------------------------------------------------------------------------------- 1 | global using NUnit.Framework; -------------------------------------------------------------------------------- /test/HaroohiePals.NitroKart.Actions.Test/Usings.cs: -------------------------------------------------------------------------------- 1 | global using NUnit.Framework; -------------------------------------------------------------------------------- /docs/assets/img/icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HaroohiePals/MarioKartToolbox/HEAD/docs/assets/img/icon.png -------------------------------------------------------------------------------- /docs/assets/img/nkm_2d_view.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HaroohiePals/MarioKartToolbox/HEAD/docs/assets/img/nkm_2d_view.png -------------------------------------------------------------------------------- /docs/assets/img/nkm_3d_view.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HaroohiePals/MarioKartToolbox/HEAD/docs/assets/img/nkm_3d_view.png -------------------------------------------------------------------------------- /docs/assets/img/nkm_camera_preview.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HaroohiePals/MarioKartToolbox/HEAD/docs/assets/img/nkm_camera_preview.png -------------------------------------------------------------------------------- /src/HaroohiePals.MarioKart/MapData/IMapData.cs: -------------------------------------------------------------------------------- 1 | namespace HaroohiePals.MarioKart.MapData; 2 | 3 | public interface IMapData 4 | { 5 | } 6 | -------------------------------------------------------------------------------- /src/HaroohiePals.NitroKart/Rom/FileToAddInfo.cs: -------------------------------------------------------------------------------- 1 | namespace HaroohiePals.NitroKart.Rom; 2 | 3 | record FileToAddInfo(string Name, byte[] Data); -------------------------------------------------------------------------------- /src/HaroohiePals.Gui/ImGuiIconGlyph.cs: -------------------------------------------------------------------------------- 1 | namespace HaroohiePals.Gui; 2 | 3 | public sealed record ImGuiIconGlyph(byte[] ImageBytes, char CodePoint, int Size); -------------------------------------------------------------------------------- /src/HaroohiePals.Gui.Viewport/ImGuizmoMode.cs: -------------------------------------------------------------------------------- 1 | namespace HaroohiePals.Gui.Viewport; 2 | 3 | public enum ImGuizmoMode 4 | { 5 | Local, 6 | World 7 | }; 8 | -------------------------------------------------------------------------------- /src/HaroohiePals.Gui/Resources/Icons/Redo_16x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HaroohiePals/MarioKartToolbox/HEAD/src/HaroohiePals.Gui/Resources/Icons/Redo_16x.png -------------------------------------------------------------------------------- /src/HaroohiePals.Gui/Resources/Icons/Undo_16x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HaroohiePals/MarioKartToolbox/HEAD/src/HaroohiePals.Gui/Resources/Icons/Undo_16x.png -------------------------------------------------------------------------------- /src/HaroohiePals.Gui/Resources/Icons/Folder_16x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HaroohiePals/MarioKartToolbox/HEAD/src/HaroohiePals.Gui/Resources/Icons/Folder_16x.png -------------------------------------------------------------------------------- /src/HaroohiePals.Gui.Viewport/SelectionHandle.cs: -------------------------------------------------------------------------------- 1 | namespace HaroohiePals.Gui.Viewport 2 | { 3 | public record SelectionHandle(object Object, int SubIndex = -1); 4 | } 5 | -------------------------------------------------------------------------------- /src/HaroohiePals.Gui/Resources/Fonts/fa-solid-900.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HaroohiePals/MarioKartToolbox/HEAD/src/HaroohiePals.Gui/Resources/Fonts/fa-solid-900.ttf -------------------------------------------------------------------------------- /src/HaroohiePals.Gui/Resources/Icons/Document_16x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HaroohiePals/MarioKartToolbox/HEAD/src/HaroohiePals.Gui/Resources/Icons/Document_16x.png -------------------------------------------------------------------------------- /src/HaroohiePals.IO/Endianness.cs: -------------------------------------------------------------------------------- 1 | namespace HaroohiePals.IO 2 | { 3 | public enum Endianness 4 | { 5 | BigEndian, 6 | LittleEndian 7 | } 8 | } -------------------------------------------------------------------------------- /src/HaroohiePals.Validation/ErrorLevel.cs: -------------------------------------------------------------------------------- 1 | namespace HaroohiePals.Validation; 2 | 3 | public enum ErrorLevel 4 | { 5 | Warning, 6 | Error, 7 | Fatal 8 | } 9 | -------------------------------------------------------------------------------- /src/HaroohiePals.Gui/Resources/Fonts/Roboto-Regular.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HaroohiePals/MarioKartToolbox/HEAD/src/HaroohiePals.Gui/Resources/Fonts/Roboto-Regular.ttf -------------------------------------------------------------------------------- /src/HaroohiePals.Gui/Resources/Icons/ExportFile_16x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HaroohiePals/MarioKartToolbox/HEAD/src/HaroohiePals.Gui/Resources/Icons/ExportFile_16x.png -------------------------------------------------------------------------------- /src/HaroohiePals.Gui/Resources/Icons/ImportFile_16x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HaroohiePals/MarioKartToolbox/HEAD/src/HaroohiePals.Gui/Resources/Icons/ImportFile_16x.png -------------------------------------------------------------------------------- /src/HaroohiePals.Gui/Resources/Icons/VSO_RecycleBin_16x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HaroohiePals/MarioKartToolbox/HEAD/src/HaroohiePals.Gui/Resources/Icons/VSO_RecycleBin_16x.png -------------------------------------------------------------------------------- /src/HaroohiePals.MarioKartToolbox/Resources/Icons/main.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HaroohiePals/MarioKartToolbox/HEAD/src/HaroohiePals.MarioKartToolbox/Resources/Icons/main.ico -------------------------------------------------------------------------------- /src/HaroohiePals.MarioKartToolbox/Resources/Icons/main.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HaroohiePals/MarioKartToolbox/HEAD/src/HaroohiePals.MarioKartToolbox/Resources/Icons/main.png -------------------------------------------------------------------------------- /src/HaroohiePals.NitroKart/Race/CameraMode.cs: -------------------------------------------------------------------------------- 1 | namespace HaroohiePals.NitroKart.Race; 2 | 3 | public enum CameraMode 4 | { 5 | Normal, 6 | DoubleTop, 7 | DoubleBottom 8 | } -------------------------------------------------------------------------------- /test/HaroohiePals.Nitro.NitroSystem.Test/Assets/ermii.nsbmd: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HaroohiePals/MarioKartToolbox/HEAD/test/HaroohiePals.Nitro.NitroSystem.Test/Assets/ermii.nsbmd -------------------------------------------------------------------------------- /src/HaroohiePals.Gui.Viewport/ImGuizmoConfirmAction.cs: -------------------------------------------------------------------------------- 1 | namespace HaroohiePals.Gui.Viewport; 2 | 3 | public enum ImGuizmoConfirmAction 4 | { 5 | MouseUp, 6 | MouseClickOrEnter 7 | } -------------------------------------------------------------------------------- /src/HaroohiePals.IO/Reference/IRestorableReference.cs: -------------------------------------------------------------------------------- 1 | namespace HaroohiePals.IO.Reference; 2 | 3 | public interface IRestorableReference 4 | { 5 | public void Restore(); 6 | } 7 | -------------------------------------------------------------------------------- /src/HaroohiePals.MarioKart/MapData/IRoutePoint.cs: -------------------------------------------------------------------------------- 1 | namespace HaroohiePals.MarioKart.MapData; 2 | 3 | public interface IRoutePoint : IPoint 4 | { 5 | double Radius { get; set; } 6 | } -------------------------------------------------------------------------------- /src/HaroohiePals.MarioKartToolbox/Resources/Icons/main128.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HaroohiePals/MarioKartToolbox/HEAD/src/HaroohiePals.MarioKartToolbox/Resources/Icons/main128.png -------------------------------------------------------------------------------- /src/HaroohiePals.MarioKartToolbox/Resources/Icons/main32.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HaroohiePals/MarioKartToolbox/HEAD/src/HaroohiePals.MarioKartToolbox/Resources/Icons/main32.png -------------------------------------------------------------------------------- /src/HaroohiePals.NitroKart/Race/RaceConfig.cs: -------------------------------------------------------------------------------- 1 | namespace HaroohiePals.NitroKart.Race; 2 | 3 | public record RaceConfig(int DriverCount, RaceMode Mode, RaceDisplayMode DisplayMode); 4 | -------------------------------------------------------------------------------- /src/HaroohiePals.Nitro/Fs/NameTableEntryType.cs: -------------------------------------------------------------------------------- 1 | namespace HaroohiePals.Nitro.Fs; 2 | 3 | public enum NameTableEntryType 4 | { 5 | EndOfDirectory, 6 | File, 7 | Directory 8 | } 9 | -------------------------------------------------------------------------------- /src/HaroohiePals.NitroKart/MapObj/Common/ItemboxQuestionAnimationFrame.cs: -------------------------------------------------------------------------------- 1 | namespace HaroohiePals.NitroKart.MapObj.Common; 2 | 3 | record ItemboxQuestionAnimationFrame(double Sin, double Cos); -------------------------------------------------------------------------------- /test/HaroohiePals.Nitro.NitroSystem.Test/Assets/imd/cube.nsbmd: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HaroohiePals/MarioKartToolbox/HEAD/test/HaroohiePals.Nitro.NitroSystem.Test/Assets/imd/cube.nsbmd -------------------------------------------------------------------------------- /src/HaroohiePals.Actions/IAction.cs: -------------------------------------------------------------------------------- 1 | namespace HaroohiePals.Actions; 2 | 3 | public interface IAction 4 | { 5 | bool IsCreateDelete { get; } 6 | void Undo(); 7 | void Do(); 8 | } 9 | -------------------------------------------------------------------------------- /src/HaroohiePals.Graphics3d/TextureFilterMode.cs: -------------------------------------------------------------------------------- 1 | namespace HaroohiePals.Graphics3d 2 | { 3 | public enum TextureFilterMode 4 | { 5 | Nearest, 6 | Linear 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /src/HaroohiePals.MarioKartToolbox/Resources/Icons/Model3D_16x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HaroohiePals/MarioKartToolbox/HEAD/src/HaroohiePals.MarioKartToolbox/Resources/Icons/Model3D_16x.png -------------------------------------------------------------------------------- /src/HaroohiePals.NitroKart/Race/CameraParams.cs: -------------------------------------------------------------------------------- 1 | namespace HaroohiePals.NitroKart.Race; 2 | 3 | internal record struct CameraParams(double Distance, double Elevation, double MaxTargetElevation); 4 | -------------------------------------------------------------------------------- /test/HaroohiePals.Nitro.NitroSystem.Test/Assets/course_model.nsbmd: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HaroohiePals/MarioKartToolbox/HEAD/test/HaroohiePals.Nitro.NitroSystem.Test/Assets/course_model.nsbmd -------------------------------------------------------------------------------- /test/HaroohiePals.Nitro.NitroSystem.Test/Assets/course_model.nsbtx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HaroohiePals/MarioKartToolbox/HEAD/test/HaroohiePals.Nitro.NitroSystem.Test/Assets/course_model.nsbtx -------------------------------------------------------------------------------- /test/HaroohiePals.Nitro.NitroSystem.Test/Assets/imd/tex/pal.nsbtx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HaroohiePals/MarioKartToolbox/HEAD/test/HaroohiePals.Nitro.NitroSystem.Test/Assets/imd/tex/pal.nsbtx -------------------------------------------------------------------------------- /test/HaroohiePals.Nitro.NitroSystem.Test/Assets/ita/animtest.nsbta: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HaroohiePals/MarioKartToolbox/HEAD/test/HaroohiePals.Nitro.NitroSystem.Test/Assets/ita/animtest.nsbta -------------------------------------------------------------------------------- /test/HaroohiePals.Nitro.NitroSystem.Test/Assets/ita/dgc_sky.nsbta: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HaroohiePals/MarioKartToolbox/HEAD/test/HaroohiePals.Nitro.NitroSystem.Test/Assets/ita/dgc_sky.nsbta -------------------------------------------------------------------------------- /src/HaroohiePals.MarioKartToolbox/Resources/Icons/ImageStack_16x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HaroohiePals/MarioKartToolbox/HEAD/src/HaroohiePals.MarioKartToolbox/Resources/Icons/ImageStack_16x.png -------------------------------------------------------------------------------- /src/HaroohiePals.MarioKartToolbox/Resources/Icons/TrafficCone_16x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HaroohiePals/MarioKartToolbox/HEAD/src/HaroohiePals.MarioKartToolbox/Resources/Icons/TrafficCone_16x.png -------------------------------------------------------------------------------- /test/HaroohiePals.Nitro.NitroSystem.Test/Assets/ita/BlackHole.nsbta: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HaroohiePals/MarioKartToolbox/HEAD/test/HaroohiePals.Nitro.NitroSystem.Test/Assets/ita/BlackHole.nsbta -------------------------------------------------------------------------------- /test/HaroohiePals.Nitro.NitroSystem.Test/Assets/ita/desert_gc.nsbta: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HaroohiePals/MarioKartToolbox/HEAD/test/HaroohiePals.Nitro.NitroSystem.Test/Assets/ita/desert_gc.nsbta -------------------------------------------------------------------------------- /test/HaroohiePals.Nitro.NitroSystem.Test/Assets/ita/patapata_gc.nsbta: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HaroohiePals/MarioKartToolbox/HEAD/test/HaroohiePals.Nitro.NitroSystem.Test/Assets/ita/patapata_gc.nsbta -------------------------------------------------------------------------------- /src/HaroohiePals.Core/HaroohiePals.Core.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | net8.0 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /src/HaroohiePals.Graphics3d.OpenGL.Renderers/Resources/Models/arrow.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HaroohiePals/MarioKartToolbox/HEAD/src/HaroohiePals.Graphics3d.OpenGL.Renderers/Resources/Models/arrow.png -------------------------------------------------------------------------------- /src/HaroohiePals.Graphics3d.OpenGL.Renderers/Resources/Models/test.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HaroohiePals/MarioKartToolbox/HEAD/src/HaroohiePals.Graphics3d.OpenGL.Renderers/Resources/Models/test.png -------------------------------------------------------------------------------- /src/HaroohiePals.Gui/View/Modal/MessageModalButtonsType.cs: -------------------------------------------------------------------------------- 1 | namespace HaroohiePals.Gui.View.Modal; 2 | 3 | public enum MessageModalButtonsType 4 | { 5 | None = 0, 6 | Ok = 1, 7 | YesNo = 2 8 | } -------------------------------------------------------------------------------- /src/HaroohiePals.MarioKart/MapData/IPoint.cs: -------------------------------------------------------------------------------- 1 | using OpenTK.Mathematics; 2 | 3 | namespace HaroohiePals.MarioKart.MapData; 4 | 5 | public interface IPoint 6 | { 7 | Vector3d Position { get; set; } 8 | } -------------------------------------------------------------------------------- /test/HaroohiePals.Nitro.NitroSystem.Test/Assets/imd/mat/cube_wire.nsbmd: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HaroohiePals/MarioKartToolbox/HEAD/test/HaroohiePals.Nitro.NitroSystem.Test/Assets/imd/mat/cube_wire.nsbmd -------------------------------------------------------------------------------- /src/HaroohiePals.Graphics3d.OpenGL.Renderers/Resources/Models/boxText.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HaroohiePals/MarioKartToolbox/HEAD/src/HaroohiePals.Graphics3d.OpenGL.Renderers/Resources/Models/boxText.png -------------------------------------------------------------------------------- /src/HaroohiePals.Graphics3d.OpenGL.Renderers/Resources/Models/uvgrid.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HaroohiePals/MarioKartToolbox/HEAD/src/HaroohiePals.Graphics3d.OpenGL.Renderers/Resources/Models/uvgrid.png -------------------------------------------------------------------------------- /src/HaroohiePals.Gui.Viewport/GizmoTool.cs: -------------------------------------------------------------------------------- 1 | namespace HaroohiePals.Gui.Viewport; 2 | 3 | public enum GizmoTool 4 | { 5 | Pointer, 6 | Translate, 7 | Rotate, 8 | Scale, 9 | Draw 10 | } -------------------------------------------------------------------------------- /src/HaroohiePals.Gui/View/IView.cs: -------------------------------------------------------------------------------- 1 | using OpenTK.Windowing.Common; 2 | 3 | namespace HaroohiePals.Gui.View; 4 | 5 | public interface IView 6 | { 7 | bool Draw(); 8 | void Update(UpdateArgs args) { } 9 | } -------------------------------------------------------------------------------- /src/HaroohiePals.NitroKart/MapData/MkdsCameIntroCamera.cs: -------------------------------------------------------------------------------- 1 | namespace HaroohiePals.NitroKart.MapData; 2 | 3 | public enum MkdsCameIntroCamera : byte 4 | { 5 | No = 0, 6 | Top = 1, 7 | Bottom = 2 8 | } -------------------------------------------------------------------------------- /test/HaroohiePals.Nitro.NitroSystem.Test/Assets/imd/mat/cube_no1dot.nsbmd: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HaroohiePals/MarioKartToolbox/HEAD/test/HaroohiePals.Nitro.NitroSystem.Test/Assets/imd/mat/cube_no1dot.nsbmd -------------------------------------------------------------------------------- /test/HaroohiePals.Nitro.NitroSystem.Test/Assets/imd/tex/cube_nopow2.nsbtx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HaroohiePals/MarioKartToolbox/HEAD/test/HaroohiePals.Nitro.NitroSystem.Test/Assets/imd/tex/cube_nopow2.nsbtx -------------------------------------------------------------------------------- /test/HaroohiePals.Nitro.NitroSystem.Test/Assets/imd/tex/pal_nomerge.nsbtx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HaroohiePals/MarioKartToolbox/HEAD/test/HaroohiePals.Nitro.NitroSystem.Test/Assets/imd/tex/pal_nomerge.nsbtx -------------------------------------------------------------------------------- /test/HaroohiePals.Nitro.NitroSystem.Test/Assets/imd/tex/tex_combined.nsbtx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HaroohiePals/MarioKartToolbox/HEAD/test/HaroohiePals.Nitro.NitroSystem.Test/Assets/imd/tex/tex_combined.nsbtx -------------------------------------------------------------------------------- /test/HaroohiePals.Nitro.NitroSystem.Test/Assets/ita/animtest_aligned.nsbta: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HaroohiePals/MarioKartToolbox/HEAD/test/HaroohiePals.Nitro.NitroSystem.Test/Assets/ita/animtest_aligned.nsbta -------------------------------------------------------------------------------- /test/HaroohiePals.Nitro.NitroSystem.Test/Assets/imd/mat/cube_nofarclip.nsbmd: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HaroohiePals/MarioKartToolbox/HEAD/test/HaroohiePals.Nitro.NitroSystem.Test/Assets/imd/mat/cube_nofarclip.nsbmd -------------------------------------------------------------------------------- /test/HaroohiePals.Nitro.NitroSystem.Test/Assets/imd/mat/cube_shininess.nsbmd: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HaroohiePals/MarioKartToolbox/HEAD/test/HaroohiePals.Nitro.NitroSystem.Test/Assets/imd/mat/cube_shininess.nsbmd -------------------------------------------------------------------------------- /test/HaroohiePals.Nitro.NitroSystem.Test/Assets/imd/mat/cube_nodepthdecal.nsbmd: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HaroohiePals/MarioKartToolbox/HEAD/test/HaroohiePals.Nitro.NitroSystem.Test/Assets/imd/mat/cube_nodepthdecal.nsbmd -------------------------------------------------------------------------------- /test/HaroohiePals.Nitro.NitroSystem.Test/Assets/imd/mat/cube_noxludepth.nsbmd: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HaroohiePals/MarioKartToolbox/HEAD/test/HaroohiePals.Nitro.NitroSystem.Test/Assets/imd/mat/cube_noxludepth.nsbmd -------------------------------------------------------------------------------- /src/HaroohiePals.Graphics3d/TextureWrapMode.cs: -------------------------------------------------------------------------------- 1 | namespace HaroohiePals.Graphics3d 2 | { 3 | public enum TextureWrapMode 4 | { 5 | Clamp, 6 | Repeat, 7 | MirroredRepeat 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /src/HaroohiePals.Gui.Viewport/GizmoRotateScaleMode.cs: -------------------------------------------------------------------------------- 1 | namespace HaroohiePals.Gui.Viewport; 2 | 3 | public enum GizmoRotateScaleMode 4 | { 5 | IndividualOrigins, 6 | MedianPoint, 7 | MedianPointTranslateOnly 8 | } -------------------------------------------------------------------------------- /src/HaroohiePals.MarioKart/MapData/IRotatedPoint.cs: -------------------------------------------------------------------------------- 1 | using OpenTK.Mathematics; 2 | 3 | namespace HaroohiePals.MarioKart.MapData; 4 | 5 | public interface IRotatedPoint : IPoint 6 | { 7 | Vector3d Rotation { get; set; } 8 | } -------------------------------------------------------------------------------- /src/HaroohiePals.MarioKartToolbox/Application/Settings/GameSettings.cs: -------------------------------------------------------------------------------- 1 | namespace HaroohiePals.MarioKartToolbox.Application.Settings; 2 | 3 | record struct GameSettings() 4 | { 5 | public string Language = "English"; 6 | } -------------------------------------------------------------------------------- /src/HaroohiePals.MarioKartToolbox/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Runtime.CompilerServices; 2 | 3 | [assembly: InternalsVisibleTo("HaroohiePals.MarioKartToolbox.Test")] 4 | [assembly: InternalsVisibleTo("DynamicProxyGenAssembly2")] -------------------------------------------------------------------------------- /src/HaroohiePals.MarioKartToolbox/Gui/ViewModel/RomExplorer/RomExplorerRomType.cs: -------------------------------------------------------------------------------- 1 | namespace HaroohiePals.MarioKartToolbox.Gui.ViewModel.RomExplorer; 2 | 3 | enum RomExplorerRomType 4 | { 5 | NdsRom, 6 | DiskRom 7 | } -------------------------------------------------------------------------------- /src/HaroohiePals.Nitro.NitroSystem/G3d/Animation/AnimationStep.cs: -------------------------------------------------------------------------------- 1 | namespace HaroohiePals.Nitro.NitroSystem.G3d.Animation; 2 | 3 | public enum AnimationStep 4 | { 5 | Step1 = 0, 6 | Step2 = 1, 7 | Step4 = 2 8 | } 9 | -------------------------------------------------------------------------------- /src/HaroohiePals.Actions/IAtomicActionBuilder.cs: -------------------------------------------------------------------------------- 1 | namespace HaroohiePals.Actions; 2 | 3 | public interface IAtomicActionBuilder 4 | { 5 | void Cancel(); 6 | void Commit(); 7 | IAtomicActionBuilder Do(IAction action); 8 | } -------------------------------------------------------------------------------- /src/HaroohiePals.NitroKart/MapObj/Common/ItemboxBoxAnimationFrame.cs: -------------------------------------------------------------------------------- 1 | namespace HaroohiePals.NitroKart.MapObj.Common; 2 | 3 | record ItemboxBoxAnimationFrame(double Sin, double Cos, double ScaleY, double FieldC, double Field10); 4 | -------------------------------------------------------------------------------- /src/HaroohiePals.MarioKartToolbox/Gui/View/CourseEditor/CameraPreviewMode.cs: -------------------------------------------------------------------------------- 1 | namespace HaroohiePals.MarioKartToolbox.Gui.View.CourseEditor; 2 | 3 | enum CameraPreviewMode 4 | { 5 | Edit, 6 | AnimReplay, 7 | AnimIntro 8 | } -------------------------------------------------------------------------------- /src/HaroohiePals.MarioKartToolbox/Gui/View/RomExplorer/MkdsCourseListViewItem.cs: -------------------------------------------------------------------------------- 1 | namespace HaroohiePals.MarioKartToolbox.Gui.View.RomExplorer; 2 | 3 | record MkdsCourseListViewItem(string Name, string Path, string FileName, string Type); -------------------------------------------------------------------------------- /src/HaroohiePals.Graphics/Svg/SvgColor.cs: -------------------------------------------------------------------------------- 1 | namespace HaroohiePals.Graphics.Svg 2 | { 3 | public static class SvgColor 4 | { 5 | public static string FromRgb(byte r, byte g, byte b) => $"rgb({r},{g},{b})"; 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /src/HaroohiePals.IO/Reference/IReferenceSerializer.cs: -------------------------------------------------------------------------------- 1 | namespace HaroohiePals.IO.Reference; 2 | 3 | public interface IReferenceSerializer where TRef : IReferenceable 4 | { 5 | TId Serialize(Reference reference); 6 | } -------------------------------------------------------------------------------- /src/HaroohiePals.NitroKart/Race/RaceMode.cs: -------------------------------------------------------------------------------- 1 | namespace HaroohiePals.NitroKart.Race; 2 | 3 | public enum RaceMode 4 | { 5 | GrandPrix, 6 | TimeAttack, 7 | MiniGame, 8 | Versus, 9 | MissionRun, 10 | Net 11 | } -------------------------------------------------------------------------------- /src/HaroohiePals.MarioKartToolbox/Gui/View/CourseEditor/CameraPreviewViewportMode.cs: -------------------------------------------------------------------------------- 1 | namespace HaroohiePals.MarioKartToolbox.Gui.View.CourseEditor; 2 | 3 | enum CameraPreviewViewportMode 4 | { 5 | SingleScreen, 6 | DualScreen 7 | } 8 | -------------------------------------------------------------------------------- /src/HaroohiePals.Gui.Viewport/Projection/IProjection.cs: -------------------------------------------------------------------------------- 1 | using OpenTK.Mathematics; 2 | 3 | namespace HaroohiePals.Gui.Viewport.Projection; 4 | 5 | public interface IProjection 6 | { 7 | Matrix4 GetProjectionMatrix(ViewportContext context); 8 | } -------------------------------------------------------------------------------- /src/HaroohiePals.Gui/View/ImSequencer/ImSequencerCustomDraw.cs: -------------------------------------------------------------------------------- 1 | namespace HaroohiePals.Gui.View.ImSequencer; 2 | 3 | record struct ImSequencerCustomDraw(int Index, ImRect CustomRect, ImRect LegendRect, ImRect ClippingRect, ImRect LegendClippingRect); -------------------------------------------------------------------------------- /src/HaroohiePals.MarioKartToolbox/Application/Settings/CourseEditorSettings.cs: -------------------------------------------------------------------------------- 1 | namespace HaroohiePals.MarioKartToolbox.Application.Settings; 2 | 3 | record struct CourseEditorSettings() 4 | { 5 | public bool AutoFixInvalidNkmReferences = true; 6 | } -------------------------------------------------------------------------------- /src/HaroohiePals.Nitro.NitroSystem/G3d/SbcCallbackTiming.cs: -------------------------------------------------------------------------------- 1 | namespace HaroohiePals.Nitro.NitroSystem.G3d; 2 | 3 | public enum SbcCallbackTiming 4 | { 5 | None = 0, 6 | TimingA = 1, 7 | TimingB = 2, 8 | TimingC = 3 9 | } 10 | -------------------------------------------------------------------------------- /src/HaroohiePals.Validation/IValidator.cs: -------------------------------------------------------------------------------- 1 | namespace HaroohiePals.Validation; 2 | 3 | public interface IValidator 4 | { 5 | List> Rules { get; set; } 6 | IReadOnlyList Validate(TObj obj); 7 | } 8 | -------------------------------------------------------------------------------- /src/HaroohiePals.Graphics3d.OpenGL.Renderers/ArrowRenderer.cs: -------------------------------------------------------------------------------- 1 | namespace HaroohiePals.Graphics3d.OpenGL.Renderers; 2 | 3 | public class ArrowRenderer : DotRenderer 4 | { 5 | public ArrowRenderer() : base(50f, Resources.Models.ArrowTexture) { } 6 | } 7 | -------------------------------------------------------------------------------- /src/HaroohiePals.Gui/View/UpdateArgs.cs: -------------------------------------------------------------------------------- 1 | namespace HaroohiePals.Gui.View; 2 | 3 | /// 4 | /// View update arguments 5 | /// 6 | /// Seconds elapsed since the last frame 7 | public record UpdateArgs(double Time); -------------------------------------------------------------------------------- /src/HaroohiePals.MarioKartToolbox/KCollision/MkdsCollisionLightId.cs: -------------------------------------------------------------------------------- 1 | namespace HaroohiePals.MarioKartToolbox.KCollision; 2 | 3 | public enum MkdsCollisionLightId : int 4 | { 5 | Light0, 6 | Light1, 7 | Light2, 8 | Light3 9 | } 10 | -------------------------------------------------------------------------------- /src/HaroohiePals.Nitro.NitroSystem/Snd/Player/WaveArcLink.cs: -------------------------------------------------------------------------------- 1 | namespace HaroohiePals.Nitro.NitroSystem.Snd.Player 2 | { 3 | internal class WaveArcLink 4 | { 5 | public Swar WaveArc; 6 | public WaveArcLink Next; 7 | } 8 | } -------------------------------------------------------------------------------- /src/HaroohiePals.Nitro/Card/NdsRomOverlayTableEntryFlags.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace HaroohiePals.Nitro.Card; 4 | 5 | [Flags] 6 | public enum NdsRomOverlayTableEntryFlags : byte 7 | { 8 | Compressed = 1, 9 | AuthenticationCode = 2 10 | } -------------------------------------------------------------------------------- /src/HaroohiePals.MarioKartToolbox/Application/Settings/AppearanceSettings.cs: -------------------------------------------------------------------------------- 1 | namespace HaroohiePals.MarioKartToolbox.Application.Settings; 2 | 3 | record struct AppearanceSettings() 4 | { 5 | public string Theme = "Dark"; 6 | public float UiScale = 1f; 7 | } -------------------------------------------------------------------------------- /src/HaroohiePals.MarioKartToolbox/Gui/View/PropertyGrid/MapDataReferenceEditMode.cs: -------------------------------------------------------------------------------- 1 | namespace HaroohiePals.MarioKartToolbox.Gui.View.PropertyGrid; 2 | 3 | internal enum MapDataReferenceEditMode 4 | { 5 | None, 6 | Clear, 7 | UpdateAdd, 8 | Pick 9 | } -------------------------------------------------------------------------------- /src/HaroohiePals.MarioKartToolbox/OpenGL/RenderGroups/MapData/IColoredRenderGroup.cs: -------------------------------------------------------------------------------- 1 | using System.Drawing; 2 | 3 | namespace HaroohiePals.MarioKartToolbox.OpenGL.RenderGroups.MapData; 4 | 5 | interface IColoredRenderGroup 6 | { 7 | Color Color { get; set; } 8 | } -------------------------------------------------------------------------------- /src/HaroohiePals.NitroKart/MapData/MkdsMapObjectGroup.cs: -------------------------------------------------------------------------------- 1 | namespace HaroohiePals.NitroKart.MapData; 2 | 3 | public enum MkdsMapObjectGroup : ushort 4 | { 5 | Ambient, 6 | Common, 7 | Obstacle, 8 | Scenery, 9 | Enemy, 10 | Boss 11 | } -------------------------------------------------------------------------------- /src/HaroohiePals.Gui.Viewport/IViewportCollision.cs: -------------------------------------------------------------------------------- 1 | using OpenTK.Mathematics; 2 | 3 | namespace HaroohiePals.Gui.Viewport; 4 | 5 | public interface IViewportCollision 6 | { 7 | bool FindIntersection(Vector3d start, Vector3d end, out Vector3d intersection); 8 | } 9 | -------------------------------------------------------------------------------- /src/HaroohiePals.MarioKartToolbox/Gui/ViewModel/CourseEditor/CourseEditorRequestableAction.cs: -------------------------------------------------------------------------------- 1 | namespace HaroohiePals.MarioKartToolbox.Gui.ViewModel.CourseEditor; 2 | 3 | enum CourseEditorRequestableAction 4 | { 5 | None, 6 | Insert, 7 | SelectAll 8 | } 9 | -------------------------------------------------------------------------------- /src/HaroohiePals.IO/Reference/IReferenceResolver.cs: -------------------------------------------------------------------------------- 1 | namespace HaroohiePals.IO.Reference; 2 | 3 | public interface IReferenceResolver where T : IReferenceable 4 | { 5 | Reference Resolve(Reference reference, Reference.RemoveReferenceFunc removeFunc); 6 | } -------------------------------------------------------------------------------- /src/HaroohiePals.MarioKartToolbox/KCollision/MkdsColTypeInfo.cs: -------------------------------------------------------------------------------- 1 | namespace HaroohiePals.MarioKartToolbox.KCollision; 2 | 3 | public record MkdsColTypeInfo(MkdsCollisionType Type, bool IsFloor, bool IsWall, bool IgnoreDrivers, 4 | bool IgnoreItems, string[] Variants); 5 | -------------------------------------------------------------------------------- /src/HaroohiePals.NitroKart/MapData/MkdsAreaType.cs: -------------------------------------------------------------------------------- 1 | namespace HaroohiePals.NitroKart.MapData; 2 | 3 | public enum MkdsAreaType : byte 4 | { 5 | Type0, 6 | Camera, 7 | MissionEnd, 8 | ClipArea, 9 | EnemyRecalculation, 10 | MissionRivalPass 11 | } -------------------------------------------------------------------------------- /src/HaroohiePals.NitroKart/Race/RaceDisplayMode.cs: -------------------------------------------------------------------------------- 1 | namespace HaroohiePals.NitroKart.Race; 2 | 3 | public enum RaceDisplayMode 4 | { 5 | Default, 6 | Title, 7 | Replay, 8 | CourseIntro, 9 | MgIntro, 10 | Award, 11 | StaffRoll 12 | } 13 | -------------------------------------------------------------------------------- /src/HaroohiePals.NitroKart/Rom/ReadOverlayFilesResult.cs: -------------------------------------------------------------------------------- 1 | using HaroohiePals.Nitro.Fs; 2 | using System.Collections.Generic; 3 | 4 | namespace HaroohiePals.NitroKart.Rom; 5 | 6 | record ReadOverlayFilesResult(IReadOnlyList FatEntries, IReadOnlyList FileData); -------------------------------------------------------------------------------- /src/HaroohiePals.Graphics3d.OpenGL.Renderers/CircleRenderer.cs: -------------------------------------------------------------------------------- 1 | namespace HaroohiePals.Graphics3d.OpenGL.Renderers; 2 | 3 | public class CircleRenderer() : MeshRenderer(Resources.Models.QuadObj, null, Resources.Shaders.CircleVertex, 4 | Resources.Shaders.CircleFragment, true, true); -------------------------------------------------------------------------------- /src/HaroohiePals.MarioKartToolbox/Application/Discord/RichPresenceApplicationState.cs: -------------------------------------------------------------------------------- 1 | namespace HaroohiePals.MarioKartToolbox.Application.Discord; 2 | 3 | enum RichPresenceApplicationState 4 | { 5 | Idle, 6 | CourseEditor, 7 | CharacterKartEditor, 8 | RomExplorer 9 | } -------------------------------------------------------------------------------- /src/HaroohiePals.Nitro.NitroSystem/G3d/G3dConfig.cs: -------------------------------------------------------------------------------- 1 | namespace HaroohiePals.Nitro.NitroSystem.G3d; 2 | 3 | public static class G3dConfig 4 | { 5 | public const int MaxJointCount = 64; 6 | public const int MaxMaterialCount = 64; 7 | public const int MaxShpCount = 64; 8 | } 9 | -------------------------------------------------------------------------------- /src/HaroohiePals.Actions/HaroohiePals.Actions.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | net8.0 5 | enable 6 | disable 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /src/HaroohiePals.IO/Reference/IReferenceResolverCollection.cs: -------------------------------------------------------------------------------- 1 | namespace HaroohiePals.IO.Reference; 2 | 3 | public interface IReferenceResolverCollection 4 | { 5 | Reference Resolve(Reference reference, Reference.RemoveReferenceFunc removeFunc) 6 | where T : IReferenceable; 7 | } -------------------------------------------------------------------------------- /src/HaroohiePals.NitroKart/MapData/MkdsAreaShapeType.cs: -------------------------------------------------------------------------------- 1 | using System.Xml.Serialization; 2 | 3 | namespace HaroohiePals.NitroKart.MapData; 4 | 5 | public enum MkdsAreaShapeType : byte 6 | { 7 | [XmlEnum("box")] 8 | Box = 0, 9 | 10 | [XmlEnum("cylinder")] 11 | Cylinder = 1 12 | } -------------------------------------------------------------------------------- /src/HaroohiePals.MarioKartToolbox.CommandLineInterface/Properties/launchSettings.json: -------------------------------------------------------------------------------- 1 | { 2 | "profiles": { 3 | "HaroohiePals.MarioKartToolbox.CommandLineInterface": { 4 | "commandName": "Project", 5 | "commandLineArgs": "create testfiles/rom.nds romproj -o testfiles/proj" 6 | } 7 | } 8 | } -------------------------------------------------------------------------------- /src/HaroohiePals.Validation/IValidationRule.cs: -------------------------------------------------------------------------------- 1 | namespace HaroohiePals.Validation; 2 | 3 | public interface IValidationRule 4 | { 5 | string Name { get; } 6 | } 7 | 8 | public interface IValidationRule : IValidationRule 9 | { 10 | IReadOnlyList Validate(TObj obj); 11 | } -------------------------------------------------------------------------------- /src/HaroohiePals.Validation/UnfixableValidationErrorException.cs: -------------------------------------------------------------------------------- 1 | namespace HaroohiePals.Validation; 2 | 3 | public class UnfixableValidationErrorException : Exception 4 | { 5 | public UnfixableValidationErrorException() : base("This validation error doesn't provide a fix.") 6 | { 7 | 8 | } 9 | } -------------------------------------------------------------------------------- /src/HaroohiePals.MarioKartToolbox/Application/Settings/DiscordSettings.cs: -------------------------------------------------------------------------------- 1 | namespace HaroohiePals.MarioKartToolbox.Application.Settings; 2 | 3 | record struct DiscordSettings() 4 | { 5 | public bool EnableRichPresence = true; 6 | public bool ShowRomTitle = true; 7 | public bool ShowCourseName = true; 8 | } -------------------------------------------------------------------------------- /src/HaroohiePals.Gui.Viewport/Framebuffers/IPickableFramebufferProvider.cs: -------------------------------------------------------------------------------- 1 | namespace HaroohiePals.Gui.Viewport.Framebuffers; 2 | 3 | public interface IPickableFramebufferProvider : IGLFramebufferProvider 4 | { 5 | uint GetPickingId(int x, int y); 6 | uint[] GetPickingIds(int x, int y, int width, int height); 7 | } -------------------------------------------------------------------------------- /src/HaroohiePals.MarioKart/MapData/IMapDataCollection.cs: -------------------------------------------------------------------------------- 1 | using HaroohiePals.IO.Reference; 2 | using System.Collections; 3 | 4 | namespace HaroohiePals.MarioKart.MapData; 5 | 6 | public interface IMapDataCollection : IEnumerable 7 | { 8 | void ResolveReferences(IReferenceResolverCollection resolverCollection); 9 | } -------------------------------------------------------------------------------- /src/HaroohiePals.Math/Transform.cs: -------------------------------------------------------------------------------- 1 | using OpenTK.Mathematics; 2 | 3 | namespace HaroohiePals.Mathematics; 4 | 5 | public record struct Transform(Vector3d Translation, Vector3d Rotation, Vector3d Scale) 6 | { 7 | public static readonly Transform Identity = new(Vector3d.Zero, Vector3d.Zero, Vector3d.One); 8 | } 9 | -------------------------------------------------------------------------------- /src/HaroohiePals.Gui.Viewport/Framebuffers/IGLFramebufferProvider.cs: -------------------------------------------------------------------------------- 1 | using HaroohiePals.Graphics3d.OpenGL; 2 | 3 | namespace HaroohiePals.Gui.Viewport.Framebuffers; 4 | 5 | public interface IGLFramebufferProvider : IDisposable 6 | { 7 | void BeginRendering(int width, int height); 8 | GLTexture EndRendering(); 9 | } -------------------------------------------------------------------------------- /src/HaroohiePals.Gui/View/PropertyGrid/IPropertyEditor.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | 3 | namespace HaroohiePals.Gui.View.PropertyGrid; 4 | 5 | public interface IPropertyEditor 6 | { 7 | bool IsEditorForProperty(PropertyInfo propertyInfo); 8 | 9 | bool Draw(string label, PropertyEditorContext context); 10 | } -------------------------------------------------------------------------------- /src/HaroohiePals.Nitro.NitroSystem/G3d/Animation/VisibilityAnimationResult.cs: -------------------------------------------------------------------------------- 1 | namespace HaroohiePals.Nitro.NitroSystem.G3d.Animation; 2 | 3 | public sealed class VisibilityAnimationResult 4 | { 5 | public bool IsVisible; 6 | 7 | public void Clear() 8 | { 9 | IsVisible = false; 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /src/HaroohiePals.Graphics/Origin.cs: -------------------------------------------------------------------------------- 1 | namespace HaroohiePals.Graphics 2 | { 3 | public enum XOrigin 4 | { 5 | Left = 0, 6 | Center = 1, 7 | Right = 2 8 | } 9 | 10 | public enum YOrigin 11 | { 12 | Top = 0, 13 | Center = 1, 14 | Bottom = 2 15 | } 16 | } -------------------------------------------------------------------------------- /src/HaroohiePals.IO/Serialization/Fx16Attribute.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace HaroohiePals.IO.Serialization 4 | { 5 | [AttributeUsage(AttributeTargets.Field, Inherited = true, AllowMultiple = false)] 6 | public sealed class Fx16Attribute : Attribute 7 | { 8 | public Fx16Attribute() { } 9 | } 10 | } -------------------------------------------------------------------------------- /src/HaroohiePals.IO/Serialization/Fx32Attribute.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace HaroohiePals.IO.Serialization 4 | { 5 | [AttributeUsage(AttributeTargets.Field, Inherited = true, AllowMultiple = false)] 6 | public sealed class Fx32Attribute : Attribute 7 | { 8 | public Fx32Attribute() { } 9 | } 10 | } -------------------------------------------------------------------------------- /src/HaroohiePals.MarioKartToolbox/Application/Discord/IApplicationDiscordRichPresenceService.cs: -------------------------------------------------------------------------------- 1 | namespace HaroohiePals.MarioKartToolbox.Application.Discord; 2 | 3 | interface IApplicationDiscordRichPresenceService 4 | { 5 | void SetGameName(string gameName); 6 | void SetApplicationState(RichPresenceApplicationState state); 7 | } -------------------------------------------------------------------------------- /src/HaroohiePals.IO/Serialization/IgnoreAttribute.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace HaroohiePals.IO.Serialization 4 | { 5 | [AttributeUsage(AttributeTargets.Field, Inherited = true, AllowMultiple = false)] 6 | public sealed class IgnoreAttribute : Attribute 7 | { 8 | public IgnoreAttribute() { } 9 | } 10 | } -------------------------------------------------------------------------------- /src/HaroohiePals.MarioKart/MapData/IMapDataEntry.cs: -------------------------------------------------------------------------------- 1 | using HaroohiePals.IO.Reference; 2 | 3 | namespace HaroohiePals.MarioKart.MapData; 4 | 5 | public interface IMapDataEntry 6 | { 7 | void ResolveReferences(IReferenceResolverCollection resolverCollection); 8 | void ReleaseReferences(); 9 | IMapDataEntry Clone(); 10 | } -------------------------------------------------------------------------------- /src/HaroohiePals.MarioKartToolbox/KCollision/MkdsCollisionVariant.cs: -------------------------------------------------------------------------------- 1 | namespace HaroohiePals.MarioKartToolbox.KCollision; 2 | 3 | public enum MkdsCollisionVariant : int 4 | { 5 | Variant0, 6 | Variant1, 7 | Variant2, 8 | Variant3, 9 | Variant4, 10 | Variant5, 11 | Variant6, 12 | Variant7 13 | } 14 | -------------------------------------------------------------------------------- /src/HaroohiePals.Sound/HaroohiePals.Sound.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | net8.0 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /src/HaroohiePals.Nitro.NitroSystem/G3d/Binary/Animation/JointAnimation/G3dJointAnimationFlags.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace HaroohiePals.Nitro.NitroSystem.G3d.Binary.Animation.JointAnimation; 4 | 5 | [Flags] 6 | public enum G3dJointAnimationFlags 7 | { 8 | Interpolation = 0x01, 9 | EndToStartInterpolation = 0x02 10 | } 11 | -------------------------------------------------------------------------------- /src/HaroohiePals.NitroKart.Validation/Course/IMkdsCourseValidatorFactory.cs: -------------------------------------------------------------------------------- 1 | using HaroohiePals.NitroKart.Course; 2 | using HaroohiePals.Validation; 3 | 4 | namespace HaroohiePals.NitroKart.Validation.Course; 5 | 6 | public interface IMkdsCourseValidatorFactory 7 | { 8 | IValidator CreateMkdsCourseValidator(); 9 | } 10 | -------------------------------------------------------------------------------- /src/HaroohiePals.Gui/ImGuiFont.cs: -------------------------------------------------------------------------------- 1 | namespace HaroohiePals.Gui; 2 | 3 | public sealed record ImGuiFont(byte[] Data, float Size) 4 | { 5 | public static readonly ImGuiFont Default = new ImGuiFont(Resources.Fonts.Roboto_Regular, 15f); 6 | public static readonly ImGuiFont DefaultIconFont = new ImGuiFont(Resources.Fonts.fa_solid_900, 16f); 7 | } 8 | -------------------------------------------------------------------------------- /src/HaroohiePals.NitroKart/MapObj/IMkdsMapObjDatabase.cs: -------------------------------------------------------------------------------- 1 | using HaroohiePals.NitroKart.MapData; 2 | using System.Collections.Generic; 3 | 4 | namespace HaroohiePals.NitroKart.MapObj; 5 | 6 | public interface IMkdsMapObjDatabase 7 | { 8 | IReadOnlyList GetAll(); 9 | MkdsMapObjInfo GetById(MkdsMapObjectId id); 10 | } 11 | -------------------------------------------------------------------------------- /src/HaroohiePals.Graphics3d/HaroohiePals.Graphics3d.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | net8.0 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /src/HaroohiePals.Nitro.NitroSystem/G3d/Binary/Model/G3dShapeFlags.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace HaroohiePals.Nitro.NitroSystem.G3d.Binary.Model; 4 | 5 | [Flags] 6 | public enum G3dShapeFlags : uint 7 | { 8 | UseNormal = 0x00000001, 9 | UseColor = 0x00000002, 10 | UseTexCoord = 0x00000004, 11 | UseRestoreMtx = 0x00000008 12 | }; -------------------------------------------------------------------------------- /src/HaroohiePals.MarioKartToolbox/Application/Settings/KeyBindingSettings.cs: -------------------------------------------------------------------------------- 1 | namespace HaroohiePals.MarioKartToolbox.Application.Settings; 2 | 3 | record struct KeyBindingSettings() 4 | { 5 | public ShortcutKeyBindingSettings Shortcuts = new(); 6 | public ViewportKeyBindingSettings Viewport = new(); 7 | public GizmoKeyBindingSettings Gizmo = new(); 8 | } -------------------------------------------------------------------------------- /src/HaroohiePals.NitroKart.Validation/MapData/IMkdsMapDataValidatorFactory.cs: -------------------------------------------------------------------------------- 1 | using HaroohiePals.NitroKart.MapData.Intermediate; 2 | using HaroohiePals.Validation; 3 | 4 | namespace HaroohiePals.NitroKart.Validation.MapData; 5 | 6 | public interface IMkdsMapDataValidatorFactory 7 | { 8 | IValidator CreateMkdsMapDataValidator(); 9 | } 10 | -------------------------------------------------------------------------------- /src/HaroohiePals.NitroKart/MapObj/Common/ItemboxShadowType.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace HaroohiePals.NitroKart.MapObj.Common; 8 | 9 | public enum ItemboxShadowType : short 10 | { 11 | Shadow2d, 12 | Shadow3d, 13 | None 14 | } -------------------------------------------------------------------------------- /src/HaroohiePals.IO/Archive/ArcFile.cs: -------------------------------------------------------------------------------- 1 | namespace HaroohiePals.IO.Archive 2 | { 3 | public class ArcFile : ArcEntry 4 | { 5 | public ArcFile(string name, ArcDirectory parent, byte[] data) 6 | : base(name, parent) 7 | { 8 | Data = data; 9 | } 10 | 11 | public byte[] Data { get; set; } 12 | } 13 | } -------------------------------------------------------------------------------- /src/HaroohiePals.Nitro.NitroSystem/G3d/Binary/Animation/TextureSrtAnimation/G3dTextureSrtAnimationFlags.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace HaroohiePals.Nitro.NitroSystem.G3d.Binary.Animation.TextureSrtAnimation; 4 | 5 | [Flags] 6 | public enum G3dTextureSrtAnimationFlags : byte 7 | { 8 | Interpolation = 0x01, 9 | EndToStartInterpolation = 0x02 10 | } 11 | -------------------------------------------------------------------------------- /src/HaroohiePals.Gui/View/PropertyGrid/PropertyGridFlags.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace HaroohiePals.Gui.View.PropertyGrid; 4 | 5 | [Flags] 6 | public enum PropertyGridFlags : int 7 | { 8 | None = 0, 9 | ShowCategories = 1, 10 | SortProperty = 2, 11 | SortPropertyDescending = 4, 12 | SortCategory = 8, 13 | SortCategoryDescending = 16, 14 | } -------------------------------------------------------------------------------- /src/HaroohiePals.KclViewer/Program.cs: -------------------------------------------------------------------------------- 1 | using HaroohiePals.Gui.View.Modal; 2 | using HaroohiePals.KclViewer.Gui; 3 | 4 | namespace HaroohiePals.KclViewer; 5 | 6 | static class Program 7 | { 8 | private static void Main(string[] args) 9 | { 10 | var modalService = new ModalService(); 11 | new KclViewerWindow(modalService).Run(); 12 | } 13 | } -------------------------------------------------------------------------------- /src/HaroohiePals.NitroKart/MapObj/MkdsMapObjInfo.cs: -------------------------------------------------------------------------------- 1 | using HaroohiePals.NitroKart.MapData; 2 | 3 | namespace HaroohiePals.NitroKart.MapObj; 4 | 5 | public record MkdsMapObjInfo(MkdsMapObjectId Id, string Name, string Description, string[] RequiredFiles, bool IsTimeTrialVisible = true, bool IsPathRequired = false) 6 | { 7 | public override string ToString() => $"{Name}"; 8 | } -------------------------------------------------------------------------------- /src/HaroohiePals.Gui.Viewport/Resources/Shaders/idBlit.vert: -------------------------------------------------------------------------------- 1 | #version 330 core 2 | 3 | uniform mat4 projMtxScreenQuad; 4 | uniform vec2 viewportSize; 5 | 6 | layout(location = 0) in vec2 aPos; 7 | 8 | out vec2 texCoord; 9 | 10 | void main() 11 | { 12 | gl_Position = projMtxScreenQuad * vec4(aPos * viewportSize, 0, 1); 13 | texCoord = vec2(aPos.x, 1.0 - aPos.y); 14 | } -------------------------------------------------------------------------------- /src/HaroohiePals.NitroKart/Rom/MkdsRomProject.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace HaroohiePals.NitroKart.Rom; 8 | 9 | public class MkdsRomProject 10 | { 11 | public string Name { get; set; } 12 | public NdsRomInfo RomInfo { get; set; } = new(); 13 | } 14 | -------------------------------------------------------------------------------- /src/HaroohiePals.MarioKartToolbox/Resources/Shaders/fogPass.vert: -------------------------------------------------------------------------------- 1 | #version 330 core 2 | 3 | uniform mat4 projMtxScreenQuad; 4 | uniform vec2 viewportSize; 5 | 6 | layout(location = 0) in vec2 aPos; 7 | 8 | out vec2 texCoord; 9 | 10 | void main() 11 | { 12 | gl_Position = projMtxScreenQuad * vec4(aPos * viewportSize, 0, 1); 13 | texCoord = vec2(aPos.x, 1.0 - aPos.y); 14 | } -------------------------------------------------------------------------------- /src/HaroohiePals.Nitro.NitroSystem/G3d/G3dRenderObjectFlag.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace HaroohiePals.Nitro.NitroSystem.G3d; 4 | 5 | [Flags] 6 | public enum G3dRenderObjectFlag 7 | { 8 | Record = 0x00000001, 9 | NoGeCmd = 0x00000002, 10 | SkipSbcDraw = 0x00000004, 11 | SkipSbcMtxCalc = 0x00000008, 12 | HintObsolete = 0x00000010 13 | }; 14 | -------------------------------------------------------------------------------- /src/HaroohiePals.Graphics3d.OpenGL.Renderers/BoxRenderer.cs: -------------------------------------------------------------------------------- 1 | namespace HaroohiePals.Graphics3d.OpenGL.Renderers; 2 | 3 | public class BoxRenderer(bool gpuFixWorkaround = false) : MeshRenderer(Resources.Models.CubeObj, 4 | Resources.Models.BoxTexture, 5 | Resources.Shaders.BoxVertex, 6 | gpuFixWorkaround ? Resources.Shaders.BoxIntelFragment : Resources.Shaders.BoxFragment, 7 | false); -------------------------------------------------------------------------------- /src/HaroohiePals.MarioKart/MapData/WeakMapDataReference.cs: -------------------------------------------------------------------------------- 1 | using HaroohiePals.IO.Reference; 2 | 3 | namespace HaroohiePals.MarioKart.MapData; 4 | 5 | public class WeakMapDataReference : Reference 6 | where T : IReferenceable, IMapDataEntry 7 | { 8 | public override bool IsResolved => false; 9 | 10 | public WeakMapDataReference(T target) : base(target, null) { } 11 | } -------------------------------------------------------------------------------- /src/HaroohiePals.MarioKartToolbox/Infrastructure/Discord/IDiscordRichPresenceService.cs: -------------------------------------------------------------------------------- 1 | namespace HaroohiePals.MarioKartToolbox.Infrastructure.Discord; 2 | 3 | interface IDiscordRichPresenceService 4 | { 5 | bool IsEnabled { get; } 6 | 7 | void EnableRichPresence(); 8 | void DisableRichPresence(); 9 | void SetDetails(string details); 10 | void SetState(string state); 11 | } -------------------------------------------------------------------------------- /src/HaroohiePals.Nitro.NitroSystem/G3d/MaterialTextureInfo.cs: -------------------------------------------------------------------------------- 1 | using HaroohiePals.Graphics3d; 2 | using HaroohiePals.Nitro.G3; 3 | 4 | namespace HaroohiePals.Nitro.NitroSystem.G3d; 5 | 6 | public sealed class MaterialTextureInfo 7 | { 8 | public double MagW; 9 | public double MagH; 10 | 11 | public GxTexImageParam TexImageParam; 12 | 13 | public Texture Texture; 14 | } 15 | -------------------------------------------------------------------------------- /src/HaroohiePals.NitroKart/Course/MkdsFolderCourse.cs: -------------------------------------------------------------------------------- 1 | using HaroohiePals.IO.Archive; 2 | 3 | namespace HaroohiePals.NitroKart.Course; 4 | 5 | public class MkdsFolderCourse : MkdsBinaryCourse 6 | { 7 | public MkdsFolderCourse(string mainPath, string texPath, string courseMapPath) 8 | : base(new DiskArchive(mainPath), texPath == null ? null : new DiskArchive(texPath), courseMapPath) { } 9 | } -------------------------------------------------------------------------------- /src/HaroohiePals.KCollision/Formats/Mk7Kcl.cs: -------------------------------------------------------------------------------- 1 | using HaroohiePals.IO; 2 | 3 | namespace HaroohiePals.KCollision.Formats 4 | { 5 | public class Mk7Kcl : FloatKartKcl 6 | { 7 | public Mk7Kcl(byte[] data) 8 | : this(new MemoryStream(data, false)) { } 9 | 10 | public Mk7Kcl(Stream stream) 11 | : base(stream, Endianness.LittleEndian) { } 12 | } 13 | } -------------------------------------------------------------------------------- /src/HaroohiePals.KCollision/Formats/SmgKcl.cs: -------------------------------------------------------------------------------- 1 | using HaroohiePals.IO; 2 | 3 | namespace HaroohiePals.KCollision.Formats 4 | { 5 | public class SmgKcl : FloatPlatformerKcl 6 | { 7 | public SmgKcl(byte[] data) 8 | : this(new MemoryStream(data, false)) { } 9 | 10 | public SmgKcl(Stream stream) 11 | : base(stream, Endianness.BigEndian) { } 12 | } 13 | } -------------------------------------------------------------------------------- /src/HaroohiePals.Nitro.NitroSystem/G3d/Animation/JointAnimationResultFlag.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace HaroohiePals.Nitro.NitroSystem.G3d.Animation; 4 | 5 | [Flags] 6 | public enum JointAnimationResultFlag 7 | { 8 | ScaleOne = 0x01, 9 | RotationZero = 0x02, 10 | TranslationZero = 0x04, 11 | ScaleEx0One = 0x08, 12 | ScaleEx1One = 0x10, 13 | MayaSsc = 0x20 14 | } 15 | -------------------------------------------------------------------------------- /src/HaroohiePals.NitroKart/MapObj/Common/ItemboxLogicPart.cs: -------------------------------------------------------------------------------- 1 | namespace HaroohiePals.NitroKart.MapObj.Common; 2 | 3 | class ItemboxLogicPart : LogicPart 4 | { 5 | public ItemboxLogicPart(MkdsContext context) 6 | : base(context, LogicPartType.Type0) 7 | { 8 | } 9 | 10 | protected override void Update(Itembox instance) 11 | => instance.Update(); 12 | } 13 | -------------------------------------------------------------------------------- /src/HaroohiePals.Gui/View/ImSequencer/ImSequencerOptions.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace HaroohiePals.Gui.View.ImSequencer; 4 | 5 | [Flags] 6 | public enum ImSequencerOptions 7 | { 8 | EditNone = 0, 9 | EditStartEnd = 1 << 1, 10 | ChangeFrame = 1 << 3, 11 | Add = 1 << 4, 12 | Delete = 1 << 5, 13 | CopyPaste = 1 << 6, 14 | EditAll = EditStartEnd | ChangeFrame 15 | } 16 | -------------------------------------------------------------------------------- /src/HaroohiePals.KCollision/Formats/MkwiiKcl.cs: -------------------------------------------------------------------------------- 1 | using HaroohiePals.IO; 2 | 3 | namespace HaroohiePals.KCollision.Formats 4 | { 5 | public class MkwiiKcl : FloatKartKcl 6 | { 7 | public MkwiiKcl(byte[] data) 8 | : this(new MemoryStream(data, false)) { } 9 | 10 | public MkwiiKcl(Stream stream) 11 | : base(stream, Endianness.BigEndian) { } 12 | } 13 | } -------------------------------------------------------------------------------- /src/HaroohiePals.NitroKart/MapObj/Obstacles/KoopaBlockLogicPart.cs: -------------------------------------------------------------------------------- 1 | namespace HaroohiePals.NitroKart.MapObj.Obstacles; 2 | 3 | sealed class KoopaBlockLogicPart : LogicPart 4 | { 5 | public KoopaBlockLogicPart(MkdsContext context) 6 | : base(context, LogicPartType.Type0) { } 7 | 8 | protected override void Update(KoopaBlock instance) 9 | => instance.Update(); 10 | } 11 | -------------------------------------------------------------------------------- /src/HaroohiePals.Gui/View/PropertyGrid/PropertyEditorContext.cs: -------------------------------------------------------------------------------- 1 | using HaroohiePals.Actions; 2 | using System.Collections.Generic; 3 | 4 | namespace HaroohiePals.Gui.View.PropertyGrid; 5 | 6 | public class PropertyEditorContext 7 | { 8 | public PropertyGridView Widget; 9 | public PropertyGridItem Property; 10 | public List TempActions; 11 | public bool ApplyEdits = false; 12 | } 13 | -------------------------------------------------------------------------------- /src/HaroohiePals.KCollision/Formats/Sm3dlKcl.cs: -------------------------------------------------------------------------------- 1 | using HaroohiePals.IO; 2 | 3 | namespace HaroohiePals.KCollision.Formats 4 | { 5 | public class Sm3dlKcl : FloatPlatformerKcl 6 | { 7 | public Sm3dlKcl(byte[] data) 8 | : this(new MemoryStream(data, false)) { } 9 | 10 | public Sm3dlKcl(Stream stream) 11 | : base(stream, Endianness.LittleEndian) { } 12 | } 13 | } -------------------------------------------------------------------------------- /src/HaroohiePals.NitroKart/MapData/MkdsCameraType.cs: -------------------------------------------------------------------------------- 1 | namespace HaroohiePals.NitroKart.MapData; 2 | 3 | public enum MkdsCameraType : ushort 4 | { 5 | FixedLookAtDriver = 0, 6 | RouteLookAtDriver = 1, 7 | FixedLookAtTargets = 2, 8 | RouteLookAtTargets = 3, 9 | IntroBottomPlaceholder = 4, 10 | FollowDriverA = 5, 11 | FollowDriverB = 6, 12 | IntroMg = 7, 13 | MrFinish = 8 14 | } -------------------------------------------------------------------------------- /src/HaroohiePals.Gui.Viewport/ImGuizmoMoveType.cs: -------------------------------------------------------------------------------- 1 | namespace HaroohiePals.Gui.Viewport; 2 | 3 | enum ImGuizmoMoveType : int 4 | { 5 | None, 6 | MoveX, 7 | MoveY, 8 | MoveZ, 9 | MoveYZ, 10 | MoveZX, 11 | MoveXY, 12 | MoveScreen, 13 | RotateX, 14 | RotateY, 15 | RotateZ, 16 | RotateScreen, 17 | ScaleX, 18 | ScaleY, 19 | ScaleZ, 20 | ScaleXYZ 21 | } 22 | -------------------------------------------------------------------------------- /src/HaroohiePals.Gui/View/Modal/IModalService.cs: -------------------------------------------------------------------------------- 1 | #nullable enable 2 | 3 | using System.Collections.Generic; 4 | 5 | namespace HaroohiePals.Gui.View.Modal; 6 | 7 | public interface IModalService 8 | { 9 | bool IsAnyModalOpen { get; } 10 | void ShowModal(ModalView modal); 11 | void HideModal(ModalView modal); 12 | IReadOnlyCollection GetAllModals(); 13 | void Cleanup(); 14 | } 15 | -------------------------------------------------------------------------------- /src/HaroohiePals.MarioKartToolbox/Application/Clipboard/IMapDataClipboard.cs: -------------------------------------------------------------------------------- 1 | #nullable enable 2 | using HaroohiePals.MarioKart.MapData; 3 | using System.Collections.Generic; 4 | 5 | namespace HaroohiePals.MarioKartToolbox.Application.Clipboard; 6 | 7 | interface IMapDataClipboard 8 | { 9 | void SetContents(IEnumerable entries); 10 | IReadOnlyCollection GetContents(); 11 | } -------------------------------------------------------------------------------- /src/HaroohiePals.Gui.Viewport/Resources/Shaders/idBlit.frag: -------------------------------------------------------------------------------- 1 | #version 400 core 2 | 3 | uniform usampler2DMS idBufferTex; 4 | uniform vec2 viewportSize; 5 | 6 | in vec2 texCoord; 7 | 8 | out uvec4 outPickingId; 9 | 10 | void main() 11 | { 12 | ivec2 intTexCoord = ivec2(int(viewportSize.x * texCoord.x), int(viewportSize.y * texCoord.y)); 13 | 14 | outPickingId = texelFetch(idBufferTex, intTexCoord, 0); 15 | } -------------------------------------------------------------------------------- /src/HaroohiePals.Validation/HaroohiePals.Validation.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | net8.0 5 | enable 6 | enable 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /src/HaroohiePals.Graphics3d.OpenGL/GLVertexAttribIAttribute.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace HaroohiePals.Graphics3d.OpenGL 4 | { 5 | [AttributeUsage(AttributeTargets.Field)] 6 | public sealed class GLVertexAttribIAttribute : Attribute 7 | { 8 | public readonly int Index; 9 | 10 | public GLVertexAttribIAttribute(int index) 11 | { 12 | Index = index; 13 | } 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /src/HaroohiePals.Graphics/HaroohiePals.Graphics.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | net8.0 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /src/HaroohiePals.Nitro.NitroSystem/G3d/Animation/MaterialAnimationResultFlag.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace HaroohiePals.Nitro.NitroSystem.G3d.Animation; 4 | 5 | [Flags] 6 | public enum MaterialAnimationResultFlag 7 | { 8 | TextureMatrixScaleOne = 0x01, 9 | TextureMatrixRotationZero = 0x02, 10 | TextureMatrixTranslationZero = 0x04, 11 | TextureMatrixSet = 0x08, 12 | TextureMatrixMult = 0x10, 13 | Wireframe = 0x20 14 | }; 15 | -------------------------------------------------------------------------------- /src/HaroohiePals.IO/Reference/IReferenceSerializerCollection.cs: -------------------------------------------------------------------------------- 1 | namespace HaroohiePals.IO.Reference; 2 | 3 | public interface IReferenceSerializerCollection 4 | { 5 | TId Serialize(Reference reference) 6 | where TRef : IReferenceable; 7 | 8 | TId SerializeOrDefault(Reference reference, TId defaultValue) 9 | where TRef : IReferenceable; 10 | 11 | bool CanSerialize(); 12 | } -------------------------------------------------------------------------------- /src/HaroohiePals.IO/Serialization/ConstantAttribute.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace HaroohiePals.IO.Serialization 4 | { 5 | [AttributeUsage(AttributeTargets.Field, Inherited = true, AllowMultiple = false)] 6 | public sealed class ConstantAttribute : Attribute 7 | { 8 | public object Value { get; } 9 | 10 | public ConstantAttribute(object value) 11 | { 12 | Value = value; 13 | } 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /src/HaroohiePals.Math/HaroohiePals.Mathematics.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | net8.0 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /src/HaroohiePals.NitroKart.Extensions/HaroohiePals.NitroKart.Extensions.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | net8.0 5 | enable 6 | disable 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /src/HaroohiePals.Gui/View/Toolbar/ToolbarItem.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace HaroohiePals.Gui.View.Toolbar; 4 | 5 | public class ToolbarItem 6 | { 7 | public ToolbarItem(char icon, string label, Action action) 8 | { 9 | Icon = icon; 10 | Label = label; 11 | Action = action; 12 | } 13 | 14 | public char Icon; 15 | public string Label; 16 | public Action Action; 17 | public bool Enabled = true; 18 | } 19 | -------------------------------------------------------------------------------- /src/HaroohiePals.IO/Serialization/ChunkSizeAttribute.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace HaroohiePals.IO.Serialization 4 | { 5 | [AttributeUsage(AttributeTargets.Field, Inherited = true, AllowMultiple = false)] 6 | public sealed class ChunkSizeAttribute : Attribute 7 | { 8 | public int Difference { get; } 9 | 10 | public ChunkSizeAttribute(int difference = 0) 11 | { 12 | Difference = difference; 13 | } 14 | } 15 | } -------------------------------------------------------------------------------- /src/HaroohiePals.MarioKartToolbox/Application/Settings/IApplicationSettingsService.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace HaroohiePals.MarioKartToolbox.Application.Settings; 4 | 5 | interface IApplicationSettingsService 6 | { 7 | public delegate void SetDelegate(ref ApplicationSettings settings); 8 | 9 | event EventHandler ApplicationSettingsChanged; 10 | 11 | ref readonly ApplicationSettings Settings { get; } 12 | 13 | void Set(SetDelegate setFunc); 14 | } -------------------------------------------------------------------------------- /src/HaroohiePals.NitroKart/MapData/Binary/NkmdEpat.cs: -------------------------------------------------------------------------------- 1 | using HaroohiePals.IO; 2 | 3 | namespace HaroohiePals.NitroKart.MapData.Binary 4 | { 5 | public class NkmdEpat : NkmdSection 6 | { 7 | public const uint EPATSignature = 0x54415045; 8 | 9 | public NkmdEpat() 10 | : base(EPATSignature, true) { } 11 | 12 | public NkmdEpat(EndianBinaryReaderEx er) 13 | : base(er, EPATSignature, true) { } 14 | } 15 | } -------------------------------------------------------------------------------- /src/HaroohiePals.NitroKart/MapData/Binary/NkmdIpat.cs: -------------------------------------------------------------------------------- 1 | using HaroohiePals.IO; 2 | 3 | namespace HaroohiePals.NitroKart.MapData.Binary 4 | { 5 | public class NkmdIpat : NkmdSection 6 | { 7 | public const uint IPATSignature = 0x54415049; 8 | 9 | public NkmdIpat() 10 | : base(IPATSignature, true) { } 11 | 12 | public NkmdIpat(EndianBinaryReaderEx er) 13 | : base(er, IPATSignature, true) { } 14 | } 15 | } -------------------------------------------------------------------------------- /src/HaroohiePals.Core/ComponentModel/PrettyArrayTypeConverter.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.ComponentModel; 3 | using System.Globalization; 4 | 5 | namespace HaroohiePals.Core.ComponentModel 6 | { 7 | public class PrettyArrayTypeConverter : ArrayConverter 8 | { 9 | public override object ConvertTo( 10 | ITypeDescriptorContext context, CultureInfo culture, object value, Type destType) 11 | { 12 | return ""; 13 | } 14 | } 15 | } -------------------------------------------------------------------------------- /src/HaroohiePals.Core/ComponentModel/NestedAttribute.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace HaroohiePals.Core.ComponentModel 4 | { 5 | public enum NestType 6 | { 7 | None, 8 | Nested, 9 | Category 10 | } 11 | 12 | public class NestedAttribute : Attribute 13 | { 14 | public NestedAttribute(NestType type) 15 | { 16 | NestType = type; 17 | } 18 | 19 | public NestType NestType { get; set; } 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /src/HaroohiePals.Nitro.NitroSystem/G3d/Binary/Animation/G3dAnimation.cs: -------------------------------------------------------------------------------- 1 | using HaroohiePals.Nitro.NitroSystem.G3d.Animation; 2 | using HaroohiePals.Nitro.NitroSystem.G3d.Binary.Model; 3 | 4 | namespace HaroohiePals.Nitro.NitroSystem.G3d.Binary; 5 | 6 | public abstract class G3dAnimation 7 | { 8 | public G3dAnimationHeader Header; 9 | public ushort NrFrames; 10 | 11 | public abstract void InitializeAnimationObject(G3dAnimationObject animationObject, G3dModel model); 12 | } 13 | -------------------------------------------------------------------------------- /src/HaroohiePals.MarioKartToolbox/Application/Settings/ApplicationSettings.cs: -------------------------------------------------------------------------------- 1 | namespace HaroohiePals.MarioKartToolbox.Application.Settings; 2 | 3 | record struct ApplicationSettings() 4 | { 5 | public DiscordSettings Discord = new(); 6 | public GameSettings Game = new(); 7 | public AppearanceSettings Appearance = new(); 8 | public ViewportSettings Viewport = new(); 9 | public KeyBindingSettings KeyBindings = new(); 10 | public CourseEditorSettings CourseEditor = new(); 11 | } -------------------------------------------------------------------------------- /src/HaroohiePals.MarioKartToolbox/OpenGL/Renderers/IRendererFactory.cs: -------------------------------------------------------------------------------- 1 | using HaroohiePals.Graphics3d.OpenGL.Renderers; 2 | 3 | namespace HaroohiePals.MarioKartToolbox.OpenGL.Renderers; 4 | 5 | interface IRendererFactory 6 | { 7 | MeshRenderer CreateCircleRenderer(); 8 | MeshRenderer CreateBoxRenderer(); 9 | MeshRenderer CreateBoxAreaRenderer(bool render2d); 10 | MeshRenderer CreateCylinderAreaRenderer(bool render2d); 11 | MeshRenderer CreateKartRenderer(bool render2d); 12 | } -------------------------------------------------------------------------------- /src/HaroohiePals.Nitro.JNLib.Spl/FloatHelper.cs: -------------------------------------------------------------------------------- 1 | namespace HaroohiePals.Nitro.JNLib.Spl 2 | { 3 | internal static class FloatHelper 4 | { 5 | public static byte ToByte(double x, string fieldName = "") 6 | { 7 | int result = (int)System.Math.Round(x * 256); 8 | if (result < 0 || result >= 256) 9 | throw new Exception($"{fieldName} out of range (0 <= x <= 0.99609375)"); 10 | return (byte)result; 11 | } 12 | } 13 | } -------------------------------------------------------------------------------- /src/HaroohiePals.Graphics3d.OpenGL.Renderers/Resources/Models/quad.obj: -------------------------------------------------------------------------------- 1 | # Blender 3.1.0 2 | # www.blender.org 3 | mtllib quad.mtl 4 | o Cube.001 5 | v 1.000000 -0.000000 -1.000000 6 | v -1.000000 -0.000000 -1.000000 7 | v 1.000000 -0.000000 1.000000 8 | v -1.000000 -0.000000 1.000000 9 | vn -0.0000 1.0000 -0.0000 10 | vt 1.000000 1.000000 11 | vt 0.000000 1.000000 12 | vt 1.000000 0.000000 13 | vt 0.000000 0.000000 14 | s 0 15 | usemtl Material.001 16 | f 3/3/1 1/1/1 2/2/1 17 | f 3/3/1 2/2/1 4/4/1 18 | -------------------------------------------------------------------------------- /src/HaroohiePals.Gui/Util.cs: -------------------------------------------------------------------------------- 1 | using OpenTK.Graphics.OpenGL4; 2 | using System.Diagnostics; 3 | 4 | namespace HaroohiePals.Gui 5 | { 6 | internal static class Util 7 | { 8 | [Conditional("DEBUG")] 9 | public static void CheckGLError(string title) 10 | { 11 | var error = GL.GetError(); 12 | if (error != ErrorCode.NoError) 13 | { 14 | Debug.Print($"{title}: {error}"); 15 | } 16 | } 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /src/HaroohiePals.KclViewer/Files/kclOctreeCube.frag: -------------------------------------------------------------------------------- 1 | #version 400 core 2 | 3 | layout (location = 0) out vec4 FragColor; 4 | layout (location = 1) out uvec4 outPickingId; 5 | 6 | in vec4 vertexColor; 7 | flat in uint pickingId; 8 | 9 | void main() 10 | { 11 | FragColor = vertexColor; 12 | 13 | outPickingId.r = pickingId & 0xFFu; 14 | outPickingId.g = (pickingId >> 8) & 0xFFu; 15 | outPickingId.b = (pickingId >> 16) & 0xFFu; 16 | outPickingId.a = (pickingId >> 24) & 0xFFu; 17 | } -------------------------------------------------------------------------------- /src/HaroohiePals.NitroKart.Validation/Course/MkdsRequiredMapObjFileValidationError.cs: -------------------------------------------------------------------------------- 1 | using HaroohiePals.Validation; 2 | 3 | namespace HaroohiePals.NitroKart.Validation.Course; 4 | 5 | public class MkdsRequiredMapObjFileValidationError : ValidationError 6 | { 7 | public MkdsRequiredMapObjFileValidationError(IValidationRule rule, string fileName, object source) 8 | : base(rule, ErrorLevel.Error, $"Missing Required MapObj File: {fileName}", source, false) 9 | { 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /src/HaroohiePals.IO/Serialization/AlignAttribute.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace HaroohiePals.IO.Serialization 4 | { 5 | [AttributeUsage(AttributeTargets.Field | AttributeTargets.Class | AttributeTargets.Struct, Inherited = true, AllowMultiple = false)] 6 | public sealed class AlignAttribute : Attribute 7 | { 8 | public int Alignment { get; } 9 | 10 | public AlignAttribute(int alignment) 11 | { 12 | Alignment = alignment; 13 | } 14 | } 15 | } -------------------------------------------------------------------------------- /src/HaroohiePals.KCollision/HaroohiePals.KCollision.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | net8.0 5 | enable 6 | disable 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /src/HaroohiePals.Nitro.NitroSystem/G3d/Binary/Model/PaletteDictionaryData.cs: -------------------------------------------------------------------------------- 1 | using HaroohiePals.IO; 2 | 3 | namespace HaroohiePals.Nitro.NitroSystem.G3d.Binary.Model; 4 | 5 | public sealed class PaletteDictionaryData : IG3dDictionaryData 6 | { 7 | public static ushort DataSize => 4; 8 | 9 | public void Read(EndianBinaryReaderEx er) => er.ReadObject(this); 10 | public void Write(EndianBinaryWriterEx er) => er.WriteObject(this); 11 | 12 | public ushort Offset; 13 | public ushort Flags; 14 | } -------------------------------------------------------------------------------- /src/HaroohiePals.MarioKart/HaroohiePals.MarioKart.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | net8.0 5 | enable 6 | disable 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /src/HaroohiePals.MarioKart/MapData/UnresolvedBinaryMapDataReference.cs: -------------------------------------------------------------------------------- 1 | using HaroohiePals.IO.Reference; 2 | 3 | namespace HaroohiePals.MarioKart.MapData; 4 | 5 | public class UnresolvedBinaryMapDataReference : Reference 6 | where T : IReferenceable, IMapDataEntry 7 | { 8 | public override bool IsResolved => false; 9 | 10 | public int UnresolvedId { get; } 11 | 12 | public UnresolvedBinaryMapDataReference(int unresolvedId) 13 | { 14 | UnresolvedId = unresolvedId; 15 | } 16 | } -------------------------------------------------------------------------------- /src/HaroohiePals.MarioKartToolbox/Resources/Shaders/kclOctreeCube.frag: -------------------------------------------------------------------------------- 1 | #version 400 core 2 | 3 | layout (location = 0) out vec4 FragColor; 4 | layout (location = 1) out uvec4 outPickingId; 5 | 6 | in vec4 vertexColor; 7 | flat in uint pickingId; 8 | 9 | void main() 10 | { 11 | FragColor = vertexColor; 12 | 13 | outPickingId.r = pickingId & 0xFFu; 14 | outPickingId.g = (pickingId >> 8) & 0xFFu; 15 | outPickingId.b = (pickingId >> 16) & 0xFFu; 16 | outPickingId.a = (pickingId >> 24) & 0xFFu; 17 | } -------------------------------------------------------------------------------- /src/HaroohiePals.Nitro.NitroSystem/G3d/Animation/AnimationStepExtensions.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace HaroohiePals.Nitro.NitroSystem.G3d.Animation; 4 | 5 | public static class AnimationStepExtensions 6 | { 7 | public static int GetStepSize(this AnimationStep step) => step switch 8 | { 9 | AnimationStep.Step1 => 1, 10 | AnimationStep.Step2 => 2, 11 | AnimationStep.Step4 => 4, 12 | _ => throw new ArgumentOutOfRangeException(nameof(step), step, null) 13 | }; 14 | } 15 | -------------------------------------------------------------------------------- /src/HaroohiePals.Nitro.NitroSystem/G3d/Binary/Animation/TexturePatternAnimation/TexturePatternFrameValue.cs: -------------------------------------------------------------------------------- 1 | using HaroohiePals.IO; 2 | 3 | namespace HaroohiePals.Nitro.NitroSystem.G3d.Binary.Animation.TexturePatternAnimation; 4 | 5 | public sealed class TexturePatternFrameValue 6 | { 7 | public TexturePatternFrameValue(EndianBinaryReaderEx er) 8 | { 9 | er.ReadObject(this); 10 | } 11 | 12 | public ushort FrameNumber; 13 | public byte TextureIndex; 14 | public byte PaletteIndex; 15 | } -------------------------------------------------------------------------------- /src/HaroohiePals.Nitro.NitroSystem/G3d/SbcCommand.cs: -------------------------------------------------------------------------------- 1 | namespace HaroohiePals.Nitro.NitroSystem.G3d; 2 | 3 | public enum SbcCommand : byte 4 | { 5 | Nop = 0x00, 6 | Return = 0x01, 7 | Node = 0x02, 8 | Matrix = 0x03, 9 | Material = 0x04, 10 | Shape = 0x05, 11 | NodeDescription = 0x06, 12 | Billboard = 0x07, 13 | BillboardY = 0x08, 14 | NodeMix = 0x09, 15 | CallDisplayList = 0x0A, 16 | PosScale = 0x0B, 17 | EnvironmentMap = 0x0C, 18 | ProjectionMap = 0x0D 19 | } 20 | -------------------------------------------------------------------------------- /src/HaroohiePals.Nitro/Fs/DirectoryTableEntry.cs: -------------------------------------------------------------------------------- 1 | using HaroohiePals.IO; 2 | 3 | namespace HaroohiePals.Nitro.Fs; 4 | 5 | public sealed class DirectoryTableEntry 6 | { 7 | public DirectoryTableEntry() { } 8 | 9 | public DirectoryTableEntry(EndianBinaryReaderEx er) 10 | => er.ReadObject(this); 11 | 12 | public void Write(EndianBinaryWriterEx er) 13 | => er.WriteObject(this); 14 | 15 | public uint EntryStart; 16 | public ushort EntryFileId; 17 | public ushort ParentId; 18 | } -------------------------------------------------------------------------------- /src/HaroohiePals.MarioKartToolbox/KCollision/MkdsKclPrism.cs: -------------------------------------------------------------------------------- 1 | using HaroohiePals.KCollision; 2 | 3 | namespace HaroohiePals.MarioKartToolbox.KCollision; 4 | 5 | public class MkdsKclPrism : MkdsKclAttributeAdapter 6 | { 7 | private KclPrism _prism; 8 | 9 | public MkdsKclPrism(KclPrism prism) 10 | { 11 | _prism = prism; 12 | } 13 | 14 | public override MkdsKclPrismAttribute Attribute 15 | { 16 | get => _prism.Attribute; 17 | set => _prism.Attribute = value; 18 | } 19 | } -------------------------------------------------------------------------------- /src/HaroohiePals.NitroKart.Validation/MapData/Sections/MobjSettings/MkdsMobjSettingsValidationError.cs: -------------------------------------------------------------------------------- 1 | using HaroohiePals.Validation; 2 | 3 | namespace HaroohiePals.NitroKart.Validation.MapData.Sections.MobjSettings; 4 | 5 | internal class MkdsMobjSettingsValidationError : ValidationError 6 | { 7 | public MkdsMobjSettingsValidationError(IValidationRule rule, string message, object source) 8 | : base(rule, ErrorLevel.Error, $"Invalid MapObj Setting: {message}", source, false) 9 | { 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /src/HaroohiePals.Gui/View/WindowContentView.cs: -------------------------------------------------------------------------------- 1 | using HaroohiePals.Gui.View.Menu; 2 | using System.Collections.Generic; 3 | 4 | namespace HaroohiePals.Gui.View; 5 | 6 | public abstract class WindowContentView : IView 7 | { 8 | /// 9 | /// Menu entries to merge on top of the base menu entries 10 | /// 11 | public virtual IReadOnlyCollection MenuItems => new List(); 12 | 13 | public abstract bool Draw(); 14 | public virtual void Update(UpdateArgs args) { } 15 | } -------------------------------------------------------------------------------- /src/HaroohiePals.Nitro/Card/NdsRomNitroFooter.cs: -------------------------------------------------------------------------------- 1 | using HaroohiePals.IO; 2 | using System; 3 | 4 | namespace HaroohiePals.Nitro.Card; 5 | 6 | [Serializable] 7 | public sealed class NdsRomNitroFooter 8 | { 9 | public NdsRomNitroFooter() { } 10 | 11 | public NdsRomNitroFooter(EndianBinaryReaderEx er) => er.ReadObject(this); 12 | public void Write(EndianBinaryWriterEx er) => er.WriteObject(this); 13 | 14 | public uint NitroCode; 15 | public uint ModuleParamsOffset; 16 | public uint Unknown; 17 | } 18 | -------------------------------------------------------------------------------- /src/HaroohiePals.Nitro/EndianBinaryReaderExtensions.cs: -------------------------------------------------------------------------------- 1 | using HaroohiePals.IO; 2 | using OpenTK.Mathematics; 3 | 4 | namespace HaroohiePals.Nitro 5 | { 6 | public static class EndianBinaryReaderExtensions 7 | { 8 | public static Vector3d ReadVecFx16(this EndianBinaryReader er) 9 | => new(er.ReadFx16(), er.ReadFx16(), er.ReadFx16()); 10 | 11 | public static Vector3d ReadVecFx32(this EndianBinaryReader er) 12 | => new(er.ReadFx32(), er.ReadFx32(), er.ReadFx32()); 13 | } 14 | } -------------------------------------------------------------------------------- /src/HaroohiePals.Validation/Validator.cs: -------------------------------------------------------------------------------- 1 | namespace HaroohiePals.Validation; 2 | 3 | public class Validator : IValidator 4 | { 5 | public List> Rules { get; set; } = new List>(); 6 | 7 | public IReadOnlyList Validate(TObj obj) 8 | { 9 | var errors = new List(); 10 | 11 | foreach (var rule in Rules) 12 | errors.AddRange(rule.Validate(obj)); 13 | 14 | return errors; 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /src/HaroohiePals.NitroKart.Validation/MapData/Sections/MobjSettings/IMkdsMobjSettingsValidationRule.cs: -------------------------------------------------------------------------------- 1 | using HaroohiePals.NitroKart.MapData.Intermediate.Sections; 2 | using HaroohiePals.NitroKart.MapData.Intermediate.Sections.MobjSettings; 3 | using HaroohiePals.Validation; 4 | 5 | namespace HaroohiePals.NitroKart.Validation.MapData.Sections.MobjSettings; 6 | 7 | internal interface IMkdsMobjSettingsValidationRule : IValidationRule<(MkdsMapObject, TSettings)> 8 | where TSettings : MkdsMobjSettings 9 | { 10 | } 11 | -------------------------------------------------------------------------------- /src/HaroohiePals.Gui/ImRect.cs: -------------------------------------------------------------------------------- 1 | using System.Numerics; 2 | 3 | namespace HaroohiePals.Gui; 4 | 5 | public struct ImRect 6 | { 7 | public ImRect(Vector2 min, Vector2 max) 8 | { 9 | Min = min; 10 | Max = max; 11 | } 12 | 13 | public Vector2 Min; 14 | public Vector2 Max; 15 | 16 | public bool Contains(Vector2 p) => p.X >= Min.X && p.Y >= Min.Y && p.X < Max.X && p.Y < Max.Y; 17 | public void Expand(float amount) { Min.X -= amount; Min.Y -= amount; Max.X += amount; Max.Y += amount; } 18 | } 19 | -------------------------------------------------------------------------------- /src/HaroohiePals.Nitro.NitroSystem/HaroohiePals.Nitro.NitroSystem.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | net8.0 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /src/HaroohiePals.NitroKart/MapData/Intermediate/Sections/MobjSettings/CowSettings.cs: -------------------------------------------------------------------------------- 1 | namespace HaroohiePals.NitroKart.MapData.Intermediate.Sections.MobjSettings 2 | { 3 | public class CowSettings : MkdsMobjSettings 4 | { 5 | public CowSettings() { } 6 | 7 | public CowSettings(MkdsMobjSettings settings) 8 | : base(settings) { } 9 | 10 | public short NsbtpFrame 11 | { 12 | get => Settings[0]; 13 | set => Settings[0] = value; 14 | } 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /test/HaroohiePals.IO.Test/IOUtilTests.cs: -------------------------------------------------------------------------------- 1 | using NUnit.Framework; 2 | 3 | namespace HaroohiePals.IO.Test; 4 | 5 | class IOUtilTests 6 | { 7 | [Test] 8 | public void IOUtil_ReadS16Le_ReadsValues() 9 | { 10 | // Arrange 11 | var testArray = new byte[] { 0xAA, 0xBB, 0x01, 0x00, 0x00, 0x01 }; 12 | 13 | // Act 14 | var readData = IOUtil.ReadS16Le(testArray, 0, 3); 15 | 16 | // Assert 17 | Assert.That(readData, Is.EqualTo(new short[] { -17494, 0x0001, 0x0100 })); 18 | } 19 | } -------------------------------------------------------------------------------- /src/HaroohiePals.NitroKart/MapObj/Enemies/TrafficLogicPart.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace HaroohiePals.NitroKart.MapObj.Enemies; 8 | 9 | class TrafficLogicPart : LogicPart 10 | { 11 | public TrafficLogicPart(MkdsContext context) 12 | : base(context, LogicPartType.Type0) 13 | { 14 | } 15 | 16 | protected override void Update(Traffic instance) 17 | => instance.Update(); 18 | } 19 | -------------------------------------------------------------------------------- /src/HaroohiePals.IO/Reference/ReferenceResolveException.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace HaroohiePals.IO.Reference; 4 | 5 | /// 6 | /// Exception thrown when reference resolving fails. 7 | /// 8 | public class ReferenceResolveException : Exception 9 | { 10 | public ReferenceResolveException() { } 11 | 12 | public ReferenceResolveException(string message) 13 | : base(message) { } 14 | 15 | public ReferenceResolveException(string message, Exception inner) 16 | : base(message, inner) { } 17 | } -------------------------------------------------------------------------------- /src/HaroohiePals.Nitro.NitroSystem/G3d/Binary/OffsetDictionaryData.cs: -------------------------------------------------------------------------------- 1 | using HaroohiePals.IO; 2 | 3 | namespace HaroohiePals.Nitro.NitroSystem.G3d.Binary; 4 | 5 | public class OffsetDictionaryData : IG3dDictionaryData 6 | { 7 | public static ushort DataSize => 4; 8 | 9 | public void Read(EndianBinaryReaderEx reader) 10 | { 11 | Offset = reader.Read(); 12 | } 13 | 14 | public void Write(EndianBinaryWriterEx writer) 15 | { 16 | writer.Write(Offset); 17 | } 18 | 19 | public uint Offset; 20 | } -------------------------------------------------------------------------------- /src/HaroohiePals.Graphics3d.OpenGL/GLVertexAttribAttribute.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace HaroohiePals.Graphics3d.OpenGL 4 | { 5 | [AttributeUsage(AttributeTargets.Field)] 6 | public sealed class GLVertexAttribAttribute : Attribute 7 | { 8 | public readonly int Index; 9 | public readonly bool Normalized; 10 | 11 | public GLVertexAttribAttribute(int index, bool normalized = false) 12 | { 13 | Index = index; 14 | Normalized = normalized; 15 | } 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /src/HaroohiePals.NitroKart/MapData/Intermediate/Sections/MobjSettings/MoveTreeSettings.cs: -------------------------------------------------------------------------------- 1 | namespace HaroohiePals.NitroKart.MapData.Intermediate.Sections.MobjSettings 2 | { 3 | public class MoveTreeSettings : MkdsMobjSettings 4 | { 5 | public MoveTreeSettings() { } 6 | 7 | public MoveTreeSettings(MkdsMobjSettings settings) 8 | : base(settings) { } 9 | 10 | public short PathSpeed 11 | { 12 | get => Settings[0]; 13 | set => Settings[0] = value; 14 | } 15 | } 16 | } -------------------------------------------------------------------------------- /src/HaroohiePals.NitroKart/MapData/Intermediate/Sections/MobjSettings/KoopaBlockSettings.cs: -------------------------------------------------------------------------------- 1 | namespace HaroohiePals.NitroKart.MapData.Intermediate.Sections.MobjSettings 2 | { 3 | public class KoopaBlockSettings : MkdsMobjSettings 4 | { 5 | public KoopaBlockSettings() { } 6 | 7 | public KoopaBlockSettings(MkdsMobjSettings settings) 8 | : base(settings) { } 9 | 10 | public short PathSpeed 11 | { 12 | get => Settings[0]; 13 | set => Settings[0] = value; 14 | } 15 | } 16 | } -------------------------------------------------------------------------------- /test/HaroohiePals.Nitro.NitroSystem.Test/G3d/Binary/NsbtxTest.cs: -------------------------------------------------------------------------------- 1 | using HaroohiePals.Nitro.NitroSystem.G3d.Binary.Model; 2 | using System.IO; 3 | using Xunit; 4 | 5 | namespace HaroohiePals.Nitro.NitroSystem.Test.G3d.Binary 6 | { 7 | public class NsbtxTest 8 | { 9 | [Fact] 10 | public void ReadWriteTest() 11 | { 12 | var input = File.ReadAllBytes("Assets/course_model.nsbtx"); 13 | var nsbtx = new Nsbtx(input); 14 | Assert.Equal(input, nsbtx.Write()); 15 | } 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /src/HaroohiePals.IO/Reference/IReferenceableExtensions.cs: -------------------------------------------------------------------------------- 1 | namespace HaroohiePals.IO.Reference; 2 | 3 | public static class IReferenceableExtensions 4 | { 5 | public static Reference GetReference(this IReferenceable referenceable, 6 | Reference.RemoveReferenceFunc removeFunc) where T : IReferenceable 7 | => referenceable.GetReference(removeFunc); 8 | 9 | public static void ReleaseAllReferences(this IReferenceable referenceable) where T : IReferenceable 10 | => referenceable.ReleaseAllReferences(); 11 | } -------------------------------------------------------------------------------- /src/HaroohiePals.NitroKart/MapData/Intermediate/Sections/MobjSettings/GearSettings.cs: -------------------------------------------------------------------------------- 1 | namespace HaroohiePals.NitroKart.MapData.Intermediate.Sections.MobjSettings 2 | { 3 | public class GearSettings : RotatingCylinderSettings 4 | { 5 | public GearSettings() { } 6 | 7 | public GearSettings(MkdsMobjSettings settings) 8 | : base(settings) { } 9 | 10 | public bool IsBlack 11 | { 12 | get => Settings[5] != 0; 13 | set => Settings[5] = (short)(value ? 1 : 0); 14 | } 15 | } 16 | } -------------------------------------------------------------------------------- /src/HaroohiePals.Graphics3d.OpenGL/HaroohiePals.Graphics3d.OpenGL.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | net8.0 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /src/HaroohiePals.NitroKart/MapData/Intermediate/Sections/MobjSettings/FlipperSettings.cs: -------------------------------------------------------------------------------- 1 | namespace HaroohiePals.NitroKart.MapData.Intermediate.Sections.MobjSettings 2 | { 3 | public class FlipperSettings : MkdsMobjSettings 4 | { 5 | public FlipperSettings() { } 6 | 7 | public FlipperSettings(MkdsMobjSettings settings) 8 | : base(settings) { } 9 | 10 | public bool IsMirrored 11 | { 12 | get => Settings[0] != 0; 13 | set => Settings[0] = (short) (value ? 1 : 0); 14 | } 15 | } 16 | } -------------------------------------------------------------------------------- /src/HaroohiePals.MarioKartToolbox/Application/Clipboard/IMapDataClipboardSerializer.cs: -------------------------------------------------------------------------------- 1 | #nullable enable 2 | using HaroohiePals.MarioKart.MapData; 3 | using System.Collections.Generic; 4 | 5 | namespace HaroohiePals.MarioKartToolbox.Application.Clipboard; 6 | 7 | interface IMapDataClipboardSerializer 8 | { 9 | MapDataClipboardSerializationResult Serialize(IEnumerable entries); 10 | 11 | IReadOnlyCollection Deserialize(string clipboardString, 12 | MapDataClipboardSerializationResult? lastClipboardSerializationResult); 13 | } -------------------------------------------------------------------------------- /src/HaroohiePals.IO/Reference/ReferenceSerializationException.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace HaroohiePals.IO.Reference; 4 | 5 | /// 6 | /// Exception thrown when reference serialization fails. 7 | /// 8 | public class ReferenceSerializationException : Exception 9 | { 10 | public ReferenceSerializationException() { } 11 | 12 | public ReferenceSerializationException(string message) 13 | : base(message) { } 14 | 15 | public ReferenceSerializationException(string message, Exception inner) 16 | : base(message, inner) { } 17 | } -------------------------------------------------------------------------------- /src/HaroohiePals.Graphics3d.OpenGL.Renderers/Resources/Shaders/line.frag: -------------------------------------------------------------------------------- 1 | #version 400 core 2 | 3 | layout (location = 0) out vec4 fragColor; 4 | layout (location = 1) out uvec4 outPickingId; 5 | layout (location = 2) out uint outFogBit; 6 | 7 | uniform uint uPickingId; 8 | uniform vec4 uColor; 9 | 10 | void main() 11 | { 12 | fragColor = uColor; 13 | 14 | outPickingId.r = uPickingId & 0xFFu; 15 | outPickingId.g = (uPickingId >> 8) & 0xFFu; 16 | outPickingId.b = (uPickingId >> 16) & 0xFFu; 17 | outPickingId.a = (uPickingId >> 24) & 0xFFu; 18 | 19 | outFogBit = 0; 20 | } 21 | -------------------------------------------------------------------------------- /src/HaroohiePals.Nitro.NitroSystem/G3d/Binary/G3dDictionaryPatriciaTreeNode.cs: -------------------------------------------------------------------------------- 1 | using HaroohiePals.IO; 2 | 3 | namespace HaroohiePals.Nitro.NitroSystem.G3d.Binary; 4 | 5 | public sealed class G3dDictionaryPatriciaTreeNode 6 | { 7 | public G3dDictionaryPatriciaTreeNode() { } 8 | public G3dDictionaryPatriciaTreeNode(EndianBinaryReaderEx er) => er.ReadObject(this); 9 | public void Write(EndianBinaryWriterEx er) => er.WriteObject(this); 10 | 11 | public byte ReferenceBit; 12 | public byte LeftNodeIndex; 13 | public byte RightNodeIndex; 14 | public byte EntryIndex; 15 | } 16 | -------------------------------------------------------------------------------- /src/HaroohiePals.Gui/View/Tree/TreeNode.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | 4 | namespace HaroohiePals.Gui.View.Tree; 5 | 6 | public class TreeNode 7 | { 8 | public TreeNode(string label, bool isLeaf) 9 | { 10 | Label = label; 11 | IsLeaf = isLeaf; 12 | } 13 | 14 | public bool IsLeaf { get; set; } 15 | public bool DefaultOpen { get; set; } 16 | public string Label { get; set; } 17 | public object Data { get; set; } 18 | public List Children { get; } = new(); 19 | 20 | public Action Activate { get; set; } 21 | } -------------------------------------------------------------------------------- /src/HaroohiePals.Nitro/Fs/FatEntry.cs: -------------------------------------------------------------------------------- 1 | using HaroohiePals.IO; 2 | 3 | namespace HaroohiePals.Nitro.Fs; 4 | 5 | public sealed class FatEntry 6 | { 7 | public FatEntry(uint offset, uint size) 8 | { 9 | FileTop = offset; 10 | FileBottom = offset + size; 11 | } 12 | 13 | public FatEntry(EndianBinaryReaderEx er) 14 | => er.ReadObject(this); 15 | 16 | public void Write(EndianBinaryWriterEx er) 17 | => er.WriteObject(this); 18 | 19 | public uint FileTop; 20 | public uint FileBottom; 21 | 22 | public uint FileSize => FileBottom - FileTop; 23 | } -------------------------------------------------------------------------------- /src/HaroohiePals.Nitro.NitroSystem/G3d/G3dRenderStateFlag.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace HaroohiePals.Nitro.NitroSystem.G3d; 4 | 5 | [Flags] 6 | public enum G3dRenderStateFlag 7 | { 8 | NodeVisible = 0x00000001, 9 | MaterialTransparent = 0x00000002, 10 | CurrentNodeValid = 0x00000004, 11 | CurrentMaterialValid = 0x00000008, 12 | CurrentNodeDescriptionValid = 0x00000010, 13 | Return = 0x00000020, 14 | Skip = 0x00000040, 15 | 16 | OptRecord = 0x00000080, 17 | OptNoGeCmd = 0x00000100, 18 | OptSkipSbcDraw = 0x00000200, 19 | OptSkipSbcMtxCalc = 0x00000400 20 | } 21 | -------------------------------------------------------------------------------- /src/HaroohiePals.Gui.Viewport/ViewportKeyBindings.cs: -------------------------------------------------------------------------------- 1 | using HaroohiePals.Gui.Input; 2 | using ImGuiNET; 3 | 4 | namespace HaroohiePals.Gui.Viewport 5 | { 6 | public class ViewportKeyBindings 7 | { 8 | public KeyBinding Forward = new KeyBinding(ImGuiKey.W); 9 | public KeyBinding Left = new KeyBinding(ImGuiKey.A); 10 | public KeyBinding Backward = new KeyBinding(ImGuiKey.S); 11 | public KeyBinding Right = new KeyBinding(ImGuiKey.D); 12 | public KeyBinding Up = new KeyBinding(ImGuiKey.Q); 13 | public KeyBinding Down = new KeyBinding(ImGuiKey.E); 14 | } 15 | } -------------------------------------------------------------------------------- /src/HaroohiePals.IO/Archive/IReadOnlyArchive.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.IO; 4 | 5 | namespace HaroohiePals.IO.Archive 6 | { 7 | public interface IReadOnlyArchive 8 | { 9 | IEnumerable EnumerateFiles(string path, bool fullPath); 10 | IEnumerable EnumerateDirectories(string path, bool fullPath); 11 | 12 | bool ExistsFile(string path); 13 | bool ExistsDirectory(string path); 14 | 15 | ReadOnlySpan GetFileDataSpan(string path); 16 | Stream OpenFileReadStream(string path); 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /src/HaroohiePals.Gui/ImGuiGameWindowSettings.cs: -------------------------------------------------------------------------------- 1 | #nullable enable 2 | 3 | using OpenTK.Mathematics; 4 | using System.Collections.Generic; 5 | 6 | namespace HaroohiePals.Gui; 7 | 8 | public sealed record ImGuiGameWindowSettings( 9 | string Title, 10 | Vector2i Size, 11 | float UiScale, 12 | IReadOnlyCollection IconGlyphs, 13 | IReadOnlyCollection Fonts, 14 | ImGuiFont? IconFont = null) 15 | { 16 | public static readonly ImGuiGameWindowSettings Default = new("ImGui App", 17 | new(800, 600), 1f, [], [ImGuiFont.Default], ImGuiFont.DefaultIconFont); 18 | } -------------------------------------------------------------------------------- /src/HaroohiePals.Graphics3d/Texture.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace HaroohiePals.Graphics3d 4 | { 5 | public abstract class Texture : IDisposable 6 | { 7 | public abstract void Use(); 8 | public abstract void SetWrapMode(TextureWrapMode wrapS, TextureWrapMode wrapT); 9 | public abstract void SetFilterMode(TextureFilterMode minFilter, TextureFilterMode magFilter); 10 | 11 | protected abstract void Dispose(bool disposing); 12 | 13 | public void Dispose() 14 | { 15 | Dispose(true); 16 | GC.SuppressFinalize(this); 17 | } 18 | } 19 | } -------------------------------------------------------------------------------- /src/HaroohiePals.MarioKart.Actions/HaroohiePals.MarioKart.Actions.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | net8.0 5 | enable 6 | disable 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /src/HaroohiePals.Nitro.G3.OpenGL/HaroohiePals.Nitro.G3.OpenGL.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | net8.0 5 | True 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /src/HaroohiePals.Gui/View/DockSpaceView.cs: -------------------------------------------------------------------------------- 1 | #nullable enable 2 | 3 | using ImGuiNET; 4 | using System.Numerics; 5 | 6 | namespace HaroohiePals.Gui.View; 7 | 8 | public class DockSpaceView : IView 9 | { 10 | public bool IsOverViewport { get; set; } = true; 11 | public Vector2 Size { get; set; } = new(0); 12 | 13 | public bool Draw() 14 | { 15 | if (IsOverViewport) 16 | { 17 | ImGui.DockSpaceOverViewport(); 18 | } 19 | else 20 | { 21 | ImGui.DockSpace(ImGui.GetID(GetHashCode()), Size); 22 | } 23 | 24 | return true; 25 | } 26 | } -------------------------------------------------------------------------------- /src/HaroohiePals.Nitro.NitroSystem/G3d/Intermediate/Model/ImdBoxTest.cs: -------------------------------------------------------------------------------- 1 | using OpenTK.Mathematics; 2 | using System.Xml; 3 | 4 | namespace HaroohiePals.Nitro.NitroSystem.G3d.Intermediate.Model; 5 | 6 | public class ImdBoxTest 7 | { 8 | public ImdBoxTest(XmlElement element) 9 | { 10 | PosScale = IntermediateUtil.GetIntAttribute(element, "pos_scale"); 11 | Xyz = IntermediateUtil.GetVec3Attribute(element, "xyz"); 12 | Whd = IntermediateUtil.GetVec3Attribute(element, "whd"); 13 | } 14 | 15 | public int PosScale; 16 | public Vector3d Xyz; 17 | public Vector3d Whd; 18 | } -------------------------------------------------------------------------------- /src/HaroohiePals.Nitro.NitroSystem/G2d/Intermediate/Extr.cs: -------------------------------------------------------------------------------- 1 | using HaroohiePals.IO; 2 | 3 | namespace HaroohiePals.Nitro.NitroSystem.G2d.Intermediate 4 | { 5 | public class Extr 6 | { 7 | public const uint ExtrBlockType = 0x52545845; 8 | 9 | public Extr(EndianBinaryReaderEx er) 10 | { 11 | BlockType = er.ReadSignature(ExtrBlockType); 12 | BlockSize = er.Read(); 13 | ExtraData = er.Read((int)BlockSize - 8); 14 | } 15 | 16 | public uint BlockType; 17 | public uint BlockSize; 18 | public byte[] ExtraData; 19 | } 20 | } -------------------------------------------------------------------------------- /src/HaroohiePals.IO/Serialization/FieldAlignmentAttribute.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace HaroohiePals.IO.Serialization 4 | { 5 | public enum FieldAlignment 6 | { 7 | Packed, 8 | FieldSize 9 | } 10 | 11 | [AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct, Inherited = true, AllowMultiple = false)] 12 | public sealed class FieldAlignmentAttribute : Attribute 13 | { 14 | public FieldAlignment Alignment { get; } 15 | 16 | public FieldAlignmentAttribute(FieldAlignment alignment) 17 | { 18 | Alignment = alignment; 19 | } 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /src/HaroohiePals.Nitro.JNLib.Spl/HaroohiePals.Nitro.JNLib.Spl.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | net8.0 5 | enable 6 | disable 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | -------------------------------------------------------------------------------- /src/HaroohiePals.Nitro.NitroSystem/G3d/Binary/Model/G3dMaterialFlags.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace HaroohiePals.Nitro.NitroSystem.G3d.Binary.Model; 4 | 5 | [Flags] 6 | public enum G3dMaterialFlags : ushort 7 | { 8 | TexMtxUse = 0x0001, 9 | TexMtxScaleOne = 0x0002, 10 | TexMtxRotZero = 0x0004, 11 | TexMtxTransZero = 0x0008, 12 | OrigWHSame = 0x0010, 13 | Wireframe = 0x0020, 14 | Diffuse = 0x0040, 15 | Ambient = 0x0080, 16 | VtxColor = 0x0100, 17 | Specular = 0x0200, 18 | Emission = 0x0400, 19 | Shininess = 0x0800, 20 | TexPlttBase = 0x1000, 21 | EffectMtx = 0x2000, 22 | }; 23 | -------------------------------------------------------------------------------- /test/HaroohiePals.Nitro.NitroSystem.Test/G3d/Binary/NsbmdTest.cs: -------------------------------------------------------------------------------- 1 | using HaroohiePals.Nitro.NitroSystem.G3d.Binary.Model; 2 | using System.IO; 3 | using Xunit; 4 | 5 | namespace HaroohiePals.Nitro.NitroSystem.Test.G3d.Binary 6 | { 7 | public class NsbmdTest 8 | { 9 | [Theory] 10 | [InlineData("Assets/course_model.nsbmd")] 11 | [InlineData("Assets/ermii.nsbmd")] 12 | public void ReadWriteTest(string path) 13 | { 14 | var input = File.ReadAllBytes(path); 15 | var nsbmd = new Nsbmd(input); 16 | Assert.Equal(input, nsbmd.Write()); 17 | } 18 | } 19 | } -------------------------------------------------------------------------------- /src/HaroohiePals.MarioKartToolbox/Application/Clipboard/ListMapDataClipboard.cs: -------------------------------------------------------------------------------- 1 | using HaroohiePals.MarioKart.MapData; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | 5 | namespace HaroohiePals.MarioKartToolbox.Application.Clipboard; 6 | 7 | class ListMapDataClipboard : IMapDataClipboard 8 | { 9 | private List _entries = new(); 10 | 11 | public IReadOnlyCollection GetContents() => _entries.Select(x => x.Clone()).ToList(); 12 | 13 | public void SetContents(IEnumerable entries) 14 | { 15 | _entries = entries.Select(x => x.Clone()).ToList(); 16 | } 17 | } -------------------------------------------------------------------------------- /src/HaroohiePals.Gui/View/PropertyGrid/PropertyInfoEqualityComparer.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using System.Diagnostics.CodeAnalysis; 3 | using System.Reflection; 4 | 5 | namespace HaroohiePals.Gui.View.PropertyGrid; 6 | 7 | public class PropertyInfoEqualityComparer : IEqualityComparer 8 | { 9 | public bool Equals(PropertyInfo x, PropertyInfo y) 10 | { 11 | return x.Name == y.Name && x.PropertyType == y.PropertyType; 12 | } 13 | 14 | public int GetHashCode([DisallowNull] PropertyInfo obj) 15 | { 16 | return obj.Name.GetHashCode() ^ obj.PropertyType.GetHashCode(); 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /src/HaroohiePals.Nitro/HaroohiePals.Nitro.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | net8.0 5 | True 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /src/HaroohiePals.MarioKartToolbox/Application/Clipboard/Json/UnresolvedWeakJsonMapDataReference.cs: -------------------------------------------------------------------------------- 1 | #nullable enable 2 | using HaroohiePals.IO.Reference; 3 | using HaroohiePals.MarioKart.MapData; 4 | 5 | namespace HaroohiePals.MarioKartToolbox.Application.Clipboard.Json; 6 | 7 | class UnresolvedWeakJsonMapDataReference : UnresolvedWeakJsonReference 8 | where T : IReferenceable, IMapDataEntry 9 | { 10 | public UnresolvedWeakJsonMapDataReference(int index) 11 | : base(index) { } 12 | 13 | public override Reference ToWeakMapDataReference(T target) 14 | { 15 | return new WeakMapDataReference(target); 16 | } 17 | } -------------------------------------------------------------------------------- /src/HaroohiePals.MarioKart.Validation/HaroohiePals.MarioKart.Validation.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | net8.0 5 | enable 6 | enable 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /src/HaroohiePals.Gui.Viewport/PickingResult.cs: -------------------------------------------------------------------------------- 1 | namespace HaroohiePals.Gui.Viewport; 2 | 3 | public record struct PickingResult(int GroupId, int Index, int SubIndex) 4 | { 5 | public static readonly PickingResult Invalid = new(0xFF - 1, 0x7FFFF, 0x1E); 6 | 7 | //Subtract 1 from the Group ID to get the original value back. 8 | //This is done to fix an issue where Alpha = 0 pixels would be discarded on some GPUs 9 | public PickingResult(uint pickingId) 10 | : this((int)(pickingId >> 24 & 0xFF) - 1, (int)(pickingId & 0x7FFFF), (int)(pickingId >> 19 & 0x1F) - 1) { } 11 | 12 | public readonly bool IsInvalid => GroupId == Invalid.GroupId; 13 | } 14 | -------------------------------------------------------------------------------- /src/HaroohiePals.IO/Serialization/ArraySizeAttribute.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace HaroohiePals.IO.Serialization 4 | { 5 | [AttributeUsage(AttributeTargets.Field, Inherited = true, AllowMultiple = false)] 6 | public sealed class ArraySizeAttribute : Attribute 7 | { 8 | public int FixedSize { get; } 9 | public string SizeField { get; } 10 | 11 | public ArraySizeAttribute(int fixedSize) 12 | { 13 | FixedSize = fixedSize; 14 | } 15 | 16 | public ArraySizeAttribute(string sizeField) 17 | { 18 | FixedSize = -1; 19 | SizeField = sizeField; 20 | } 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /src/HaroohiePals.Nitro.NitroSystem/G2d/Intermediate/Link.cs: -------------------------------------------------------------------------------- 1 | using HaroohiePals.IO; 2 | using System.Text; 3 | 4 | namespace HaroohiePals.Nitro.NitroSystem.G2d.Intermediate 5 | { 6 | public class Link 7 | { 8 | public const uint LinkBlockType = 0x4B4E494C; 9 | 10 | public Link(EndianBinaryReaderEx er) 11 | { 12 | BlockType = er.ReadSignature(LinkBlockType); 13 | BlockSize = er.Read(); 14 | FileName = er.ReadString(Encoding.ASCII, (int)BlockSize - 8).TrimEnd('\0'); 15 | } 16 | 17 | public uint BlockType; 18 | public uint BlockSize; 19 | public string FileName; 20 | } 21 | } -------------------------------------------------------------------------------- /src/HaroohiePals.Nitro/BinaryBlockHeader.cs: -------------------------------------------------------------------------------- 1 | using HaroohiePals.IO; 2 | 3 | namespace HaroohiePals.Nitro 4 | { 5 | public class BinaryBlockHeader 6 | { 7 | public BinaryBlockHeader(uint signature) 8 | { 9 | Kind = signature; 10 | } 11 | 12 | public BinaryBlockHeader(EndianBinaryReader er) 13 | { 14 | Kind = er.Read(); 15 | Size = er.Read(); 16 | } 17 | 18 | public void Write(EndianBinaryWriterEx er) 19 | { 20 | er.Write(Kind); 21 | er.Write(Size); 22 | } 23 | 24 | public uint Kind; 25 | public uint Size; 26 | } 27 | } -------------------------------------------------------------------------------- /src/HaroohiePals.IO/Archive/ArcEntry.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace HaroohiePals.IO.Archive 4 | { 5 | public abstract class ArcEntry 6 | { 7 | protected ArcEntry(string name, ArcDirectory parent) 8 | { 9 | Name = name; 10 | Parent = parent; 11 | if (Parent != null && Parent.ExistsName(Name)) 12 | throw new Exception("Name already exists"); 13 | } 14 | 15 | public string Name { get; private set; } 16 | public ArcDirectory Parent { get; private set; } 17 | 18 | public string FullPath => Parent == null ? "/" : (Parent?.FullPath.TrimEnd('/') + "/" + Name); 19 | } 20 | } -------------------------------------------------------------------------------- /src/HaroohiePals.MarioKartToolbox.CommandLineInterface/Program.cs: -------------------------------------------------------------------------------- 1 | using HaroohiePals.MarioKartToolbox.CommandLineInterface.Commands; 2 | using System.CommandLine; 3 | 4 | namespace HaroohiePals.MarioKartToolbox.CommandLineInterface; 5 | 6 | class Program 7 | { 8 | private const string ROOT_COMMAND_DESCRIPTION = "Mario Kart Toolbox"; 9 | 10 | static async Task Main(string[] args) 11 | { 12 | var rootCommand = new RootCommand(ROOT_COMMAND_DESCRIPTION); 13 | 14 | rootCommand.AddCommand(new CreateMkdsRomProjectCommand()); 15 | rootCommand.AddCommand(new BuildMkdsRomCommand()); 16 | 17 | return await rootCommand.InvokeAsync(args); 18 | } 19 | } -------------------------------------------------------------------------------- /src/HaroohiePals.Nitro.NitroSystem/G2d/Intermediate/Cmnt.cs: -------------------------------------------------------------------------------- 1 | using HaroohiePals.IO; 2 | using System.Text; 3 | 4 | namespace HaroohiePals.Nitro.NitroSystem.G2d.Intermediate 5 | { 6 | public class Cmnt 7 | { 8 | public const uint CmntBlockType = 0x544E4D43; 9 | 10 | public Cmnt(EndianBinaryReaderEx er) 11 | { 12 | BlockType = er.ReadSignature(CmntBlockType); 13 | BlockSize = er.Read(); 14 | CommentData = er.ReadString(Encoding.ASCII, (int)BlockSize - 8).TrimEnd('\0'); 15 | } 16 | 17 | public uint BlockType; 18 | public uint BlockSize; 19 | public string CommentData; 20 | } 21 | } -------------------------------------------------------------------------------- /src/HaroohiePals.NitroKart/MkdsContext.cs: -------------------------------------------------------------------------------- 1 | using HaroohiePals.Nitro.NitroSystem.G3d; 2 | using HaroohiePals.NitroKart.Course; 3 | using HaroohiePals.NitroKart.MapObj; 4 | 5 | namespace HaroohiePals.NitroKart 6 | { 7 | public class MkdsContext 8 | { 9 | public readonly G3dModelManager ModelManager; 10 | public readonly RenderContext RenderContext; 11 | 12 | public IMkdsCourse Course; 13 | public MObjState MObjState; 14 | 15 | public MkdsContext(G3dModelManager modelManager, RenderContext renderContext) 16 | { 17 | ModelManager = modelManager; 18 | RenderContext = renderContext; 19 | } 20 | } 21 | } -------------------------------------------------------------------------------- /src/HaroohiePals.MarioKartToolbox/Application/Clipboard/Json/UnresolvedWeakJsonReference.cs: -------------------------------------------------------------------------------- 1 | #nullable enable 2 | using HaroohiePals.IO.Reference; 3 | using System; 4 | 5 | namespace HaroohiePals.MarioKartToolbox.Application.Clipboard.Json; 6 | 7 | abstract class UnresolvedWeakJsonReference : Reference 8 | where T : IReferenceable 9 | { 10 | public override bool IsResolved => false; 11 | 12 | public int Index { get; } 13 | 14 | public UnresolvedWeakJsonReference(int index) 15 | { 16 | Index = index; 17 | } 18 | 19 | public virtual Reference ToWeakMapDataReference(T target) 20 | { 21 | throw new NotSupportedException(); 22 | } 23 | } -------------------------------------------------------------------------------- /src/HaroohiePals.Gui/View/PropertyGrid/PropertyGridItem.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Reflection; 3 | 4 | namespace HaroohiePals.Gui.View.PropertyGrid; 5 | 6 | public class PropertyGridItem 7 | { 8 | public string Name { get; set; } 9 | public string DisplayName { get; set; } 10 | public string Description { get; set; } 11 | public string Category { get; set; } 12 | public bool IsReadOnly { get; set; } = false; 13 | public Type Type { get; set; } 14 | public PropertyInfo PropertyInfo { get; set; } 15 | public object[] SourceObjects { get; set; } 16 | public PropertyGridView NestedPropertyGridView { get; set; } 17 | public IPropertyEditor Editor { get; set; } 18 | } 19 | -------------------------------------------------------------------------------- /src/HaroohiePals.IO/Serialization/TypeAttribute.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace HaroohiePals.IO.Serialization 4 | { 5 | public enum FieldType 6 | { 7 | U8, 8 | S8, 9 | U16, 10 | S16, 11 | U32, 12 | S32, 13 | U64, 14 | S64, 15 | Fx16, 16 | Fx32, 17 | Float, 18 | Double 19 | } 20 | 21 | [AttributeUsage(AttributeTargets.Field, Inherited = true, AllowMultiple = false)] 22 | public class TypeAttribute : Attribute 23 | { 24 | public FieldType Type { get; } 25 | 26 | public TypeAttribute(FieldType type) 27 | { 28 | Type = type; 29 | } 30 | } 31 | } -------------------------------------------------------------------------------- /src/HaroohiePals.Nitro.NitroSystem/G3d/Binary/G3dDictionaryEntry.cs: -------------------------------------------------------------------------------- 1 | #nullable enable 2 | 3 | namespace HaroohiePals.Nitro.NitroSystem.G3d.Binary; 4 | 5 | /// 6 | /// Record representing an entry of a , consisting 7 | /// of a and of type . 8 | /// 9 | /// The type of the data in the dictionary. 10 | /// The name of the entry. 11 | /// The data of the entry. 12 | public sealed record G3dDictionaryEntry(string Name, TData Data) 13 | where TData : notnull, IG3dDictionaryData, new(); 14 | -------------------------------------------------------------------------------- /src/HaroohiePals.Nitro/EndianBinaryWriterExtensions.cs: -------------------------------------------------------------------------------- 1 | using HaroohiePals.IO; 2 | using OpenTK.Mathematics; 3 | 4 | namespace HaroohiePals.Nitro 5 | { 6 | public static class EndianBinaryWriterExtensions 7 | { 8 | public static void WriteVecFx16(this EndianBinaryWriter er, in Vector3d value) 9 | { 10 | er.WriteFx16(value.X); 11 | er.WriteFx16(value.Y); 12 | er.WriteFx16(value.Z); 13 | } 14 | 15 | public static void WriteVecFx32(this EndianBinaryWriter er, in Vector3d value) 16 | { 17 | er.WriteFx32(value.X); 18 | er.WriteFx32(value.Y); 19 | er.WriteFx32(value.Z); 20 | } 21 | } 22 | } -------------------------------------------------------------------------------- /src/HaroohiePals.NitroKart.Validation/MapData/Sections/MkdsPointWifiCoordOutOfRangeValidationError.cs: -------------------------------------------------------------------------------- 1 | using HaroohiePals.MarioKart.MapData; 2 | using HaroohiePals.Validation; 3 | using System; 4 | using System.Collections.Generic; 5 | using System.Linq; 6 | using System.Text; 7 | using System.Threading.Tasks; 8 | 9 | namespace HaroohiePals.NitroKart.Validation.MapData.Sections; 10 | 11 | internal class MkdsPointWifiCoordOutOfRangeValidationError : ValidationError 12 | { 13 | public MkdsPointWifiCoordOutOfRangeValidationError(IValidationRule rule, IPoint source) 14 | : base(rule, ErrorLevel.Warning, "Point out of range for a Wi-Fi race (-4096, 4096)", source, false) 15 | { 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /src/HaroohiePals.Nitro.NitroSystem.G3d.OpenGL/GLG3dModelManager.cs: -------------------------------------------------------------------------------- 1 | using HaroohiePals.Graphics; 2 | using HaroohiePals.Graphics3d; 3 | using HaroohiePals.Graphics3d.OpenGL; 4 | using HaroohiePals.Nitro.G3; 5 | using HaroohiePals.Nitro.G3.OpenGL; 6 | using System; 7 | 8 | namespace HaroohiePals.Nitro.NitroSystem.G3d.OpenGL 9 | { 10 | public class GLG3dModelManager : G3dModelManager 11 | { 12 | public override DisplayListBuffer CreateDisplayListBuffer(ReadOnlySpan dl) 13 | => new GLDisplayListBuffer(dl); 14 | 15 | public override Texture CreateTexture(Rgba8Bitmap bitmap) 16 | => new GLTexture(bitmap, TextureWrapMode.Repeat, TextureWrapMode.Repeat); 17 | } 18 | } -------------------------------------------------------------------------------- /src/HaroohiePals.Nitro.JNLib.Spl/Emitter/FieldGravityParams.cs: -------------------------------------------------------------------------------- 1 | using HaroohiePals.IO; 2 | using OpenTK.Mathematics; 3 | 4 | namespace HaroohiePals.Nitro.JNLib.Spl.Emitter 5 | { 6 | public class FieldGravityParams 7 | { 8 | public FieldGravityParams() 9 | { 10 | } 11 | 12 | public FieldGravityParams(EndianBinaryReader reader) 13 | { 14 | Gravity = reader.ReadVecFx16(); 15 | reader.Read(); 16 | } 17 | 18 | public void Write(EndianBinaryWriterEx ew) 19 | { 20 | ew.WriteVecFx16(Gravity); 21 | ew.Write((ushort)0); 22 | } 23 | 24 | public Vector3d Gravity { get; set; } 25 | } 26 | } -------------------------------------------------------------------------------- /src/HaroohiePals.NitroKart/MapData/Intermediate/Sections/MobjSettings/DossunSettings.cs: -------------------------------------------------------------------------------- 1 | namespace HaroohiePals.NitroKart.MapData.Intermediate.Sections.MobjSettings 2 | { 3 | public class DossunSettings : MkdsMobjSettings 4 | { 5 | public DossunSettings() { } 6 | 7 | public DossunSettings(MkdsMobjSettings settings) 8 | : base(settings) { } 9 | 10 | public bool MoveHorizontal 11 | { 12 | get => Settings[0] != 0; 13 | set => Settings[0] = (short) (value ? 1 : 0); 14 | } 15 | 16 | public short InitialPathPoint 17 | { 18 | get => Settings[1]; 19 | set => Settings[1] = value; 20 | } 21 | } 22 | } -------------------------------------------------------------------------------- /src/HaroohiePals.NitroKart.Validation/MapData/Sections/MkdsMapDataEntryValidationRule.cs: -------------------------------------------------------------------------------- 1 | using HaroohiePals.MarioKart.MapData; 2 | using HaroohiePals.MarioKart.Validation.MapData; 3 | using HaroohiePals.NitroKart.MapData.Intermediate; 4 | using HaroohiePals.NitroKart.MapData.Intermediate.Sections.MobjSettings; 5 | using HaroohiePals.NitroKart.MapData.Intermediate.Sections; 6 | using HaroohiePals.NitroKart.Validation.MapData.Sections.MobjSettings; 7 | using HaroohiePals.Validation; 8 | 9 | namespace HaroohiePals.NitroKart.Validation.MapData.Sections; 10 | 11 | internal abstract class MkdsMapDataEntryValidationRule : MapDataEntryValidationRule 12 | where TEntry : IMapDataEntry 13 | { 14 | 15 | } 16 | -------------------------------------------------------------------------------- /src/HaroohiePals.MarioKartToolbox/Application/Settings/ShortcutKeyBindingSettings.cs: -------------------------------------------------------------------------------- 1 | using HaroohiePals.Gui.Input; 2 | using ImGuiNET; 3 | 4 | namespace HaroohiePals.MarioKartToolbox.Application.Settings; 5 | 6 | record struct ShortcutKeyBindingSettings() 7 | { 8 | public KeyBinding Undo = new(ImGuiKey.Z, true); 9 | public KeyBinding Redo = new(ImGuiKey.Y, true); 10 | 11 | public KeyBinding Copy = new(ImGuiKey.C, true); 12 | public KeyBinding Cut = new(ImGuiKey.X, true); 13 | public KeyBinding Paste = new(ImGuiKey.V, true); 14 | 15 | public KeyBinding Insert = new(ImGuiKey.I, true); 16 | public KeyBinding Delete = new(ImGuiKey.Delete); 17 | 18 | public KeyBinding SelectAll = new(ImGuiKey.A, true); 19 | } -------------------------------------------------------------------------------- /src/HaroohiePals.Nitro.NitroSystem/G3d/Animation/JointAnimationResult.cs: -------------------------------------------------------------------------------- 1 | using OpenTK.Mathematics; 2 | 3 | namespace HaroohiePals.Nitro.NitroSystem.G3d.Animation; 4 | 5 | public sealed class JointAnimationResult 6 | { 7 | public JointAnimationResultFlag Flag; 8 | public Vector3d Scale; 9 | public Vector3d ScaleEx0; 10 | public Vector3d ScaleEx1; 11 | public Matrix3d Rotation; 12 | public Vector3d Translation; 13 | 14 | public void Clear() 15 | { 16 | Flag = 0; 17 | Scale = Vector3d.Zero; 18 | ScaleEx0 = Vector3d.Zero; 19 | ScaleEx1 = Vector3d.Zero; 20 | Rotation = new Matrix3d(0, 0, 0, 0, 0, 0, 0, 0, 0); 21 | Translation = Vector3d.Zero; 22 | } 23 | } -------------------------------------------------------------------------------- /src/HaroohiePals.MarioKartToolbox/OpenGL/RenderGroups/PlaneGridRenderGroup.cs: -------------------------------------------------------------------------------- 1 | using HaroohiePals.Graphics3d.OpenGL.Renderers; 2 | using HaroohiePals.Gui.Viewport; 3 | using System; 4 | 5 | namespace HaroohiePals.MarioKartToolbox.OpenGL.RenderGroups; 6 | 7 | class PlaneGridRenderGroup : RenderGroup, IDisposable 8 | { 9 | private readonly GridRenderer _gridRenderer = new(); 10 | 11 | public override void Render(ViewportContext context) 12 | { 13 | _gridRenderer.PickingId = ViewportContext.InvalidPickingId; 14 | _gridRenderer.Render(context.ViewMatrix, context.ProjectionMatrix, context.TranslucentPass); 15 | } 16 | public void Dispose() 17 | { 18 | _gridRenderer.Dispose(); 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /src/HaroohiePals.Nitro/Card/NdsBannerHeader.cs: -------------------------------------------------------------------------------- 1 | using HaroohiePals.IO; 2 | using HaroohiePals.IO.Serialization; 3 | using System; 4 | using System.Xml.Serialization; 5 | 6 | namespace HaroohiePals.Nitro.Card; 7 | 8 | [Serializable] 9 | public sealed class NdsBannerHeader 10 | { 11 | public byte Version; 12 | public byte ReservedA; 13 | 14 | [XmlIgnore] 15 | public ushort CRC16_v1; 16 | 17 | [ArraySize(28)] 18 | public byte[] ReservedB; 19 | 20 | public NdsBannerHeader() { } 21 | 22 | public NdsBannerHeader(EndianBinaryReaderEx er) 23 | { 24 | er.ReadObject(this); 25 | } 26 | 27 | public void Write(EndianBinaryWriterEx er) 28 | { 29 | er.WriteObject(this); 30 | } 31 | } -------------------------------------------------------------------------------- /src/HaroohiePals.IO/HaroohiePals.IO.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | net8.0 5 | 6 | 7 | 8 | true 9 | 10 | 11 | 12 | true 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | -------------------------------------------------------------------------------- /src/HaroohiePals.Nitro.NitroSystem/G3d/Intermediate/Model/ImdOutputInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Xml; 2 | 3 | namespace HaroohiePals.Nitro.NitroSystem.G3d.Intermediate.Model; 4 | 5 | public class ImdOutputInfo 6 | { 7 | public ImdOutputInfo(XmlElement element) 8 | { 9 | VertexSize = IntermediateUtil.GetIntAttribute(element, "vertex_size"); 10 | PolygonSize = IntermediateUtil.GetIntAttribute(element, "polygon_size"); 11 | TriangleSize = IntermediateUtil.GetIntAttribute(element, "triangle_size"); 12 | QuadSize = IntermediateUtil.GetIntAttribute(element, "quad_size"); 13 | } 14 | 15 | public int VertexSize; 16 | public int PolygonSize; 17 | public int TriangleSize; 18 | public int QuadSize; 19 | } -------------------------------------------------------------------------------- /test/HaroohiePals.Nitro.Test/Card/KeyTransformTest.cs: -------------------------------------------------------------------------------- 1 | using HaroohiePals.Nitro.Card; 2 | using System.Security.Cryptography; 3 | using Xunit; 4 | 5 | namespace HaroohiePals.Nitro.Test.Card 6 | { 7 | public class KeyTransformTest 8 | { 9 | [Fact] 10 | public void NtrRomTableTransformTest() 11 | { 12 | var table = KeyTransform.TransformTable(0x45434D41, 2, 8, Keys.NtrBlowfishTable); 13 | Assert.Equal( 14 | new byte[] 15 | { 16 | 0xD7, 0x21, 0x5D, 0xED, 0xE5, 0xA9, 0xBF, 0x97, 0xFC, 0x75, 0x33, 0x8B, 0x03, 0x7A, 0x68, 0x1F, 17 | 0x15, 0x8C, 0x3B, 0xBC 18 | }, SHA1.HashData(table)); 19 | } 20 | } 21 | } -------------------------------------------------------------------------------- /src/HaroohiePals.Graphics3d.OpenGL.Renderers/DotRenderer.cs: -------------------------------------------------------------------------------- 1 | using HaroohiePals.Graphics3d.OpenGL.Renderers.Resources; 2 | using OpenTK.Graphics.OpenGL4; 3 | 4 | namespace HaroohiePals.Graphics3d.OpenGL.Renderers; 5 | 6 | public class DotRenderer(float size = 8f, byte[] texData = null) 7 | : InstancedPointRenderer(new GLShader(Shaders.DotVertex, Shaders.DotFragment), true, true, new VertexData[1], 8 | texData) 9 | { 10 | protected override void RenderInstanced(int instanceCount) 11 | { 12 | GL.PointSize(size); 13 | GL.PointParameter(PointParameterName.PointSpriteCoordOrigin, (int)PointSpriteCoordOriginParameter.UpperLeft); 14 | GL.DrawArraysInstanced(PrimitiveType.Points, 0, 1, instanceCount); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /src/HaroohiePals.NitroKart.Actions/HaroohiePals.NitroKart.Actions.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | net8.0 5 | enable 6 | disable 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /src/HaroohiePals.NitroKart/Rom/NdsRomInfo.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace HaroohiePals.NitroKart.Rom; 8 | 9 | public class NdsRomInfo 10 | { 11 | public string FsRootPath { get; set; } 12 | public string HeaderPath { get; set; } 13 | public string BannerPath { get; set; } 14 | public string RsaSignaturePath { get; set; } 15 | public string Arm9Path { get; set; } 16 | public string Arm9OvtPath { get; set; } 17 | public string[] Arm9OverlaysPaths { get; set; } 18 | public string Arm7Path { get; set; } 19 | public string Arm7OvtPath { get; set; } 20 | public string[] Arm7OverlaysPaths { get; set; } 21 | } 22 | -------------------------------------------------------------------------------- /src/HaroohiePals.Nitro.NitroSystem/G3d/Binary/Model/G3dEnvelopeMatrices.cs: -------------------------------------------------------------------------------- 1 | using HaroohiePals.IO; 2 | 3 | namespace HaroohiePals.Nitro.NitroSystem.G3d.Binary.Model; 4 | 5 | public sealed class G3dEnvelopeMatrices 6 | { 7 | public G3dEnvelopeMatrices() { } 8 | 9 | public G3dEnvelopeMatrices(EndianBinaryReaderEx er, int nodeCount) 10 | { 11 | Envelopes = new G3dEnvelope[nodeCount]; 12 | for (int i = 0; i < nodeCount; i++) 13 | { 14 | Envelopes[i] = new G3dEnvelope(er); 15 | } 16 | } 17 | 18 | public void Write(EndianBinaryWriterEx er) 19 | { 20 | foreach (var e in Envelopes) 21 | { 22 | e.Write(er); 23 | } 24 | } 25 | 26 | public G3dEnvelope[] Envelopes; 27 | } 28 | -------------------------------------------------------------------------------- /src/HaroohiePals.Gui.Viewport/Projection/PerspectiveProjection.cs: -------------------------------------------------------------------------------- 1 | using OpenTK.Mathematics; 2 | 3 | namespace HaroohiePals.Gui.Viewport.Projection; 4 | 5 | public sealed class PerspectiveProjection : IProjection 6 | { 7 | public float Fov { get; set; } 8 | public float Near { get; set; } 9 | public float Far { get; set; } 10 | 11 | public PerspectiveProjection(float fov, float near, float far) 12 | { 13 | Fov = fov; 14 | Near = near; 15 | Far = far; 16 | } 17 | 18 | public Matrix4 GetProjectionMatrix(ViewportContext context) 19 | { 20 | return Matrix4.CreatePerspectiveFieldOfView(MathHelper.DegreesToRadians(Fov), 21 | context.ViewportSize.X / (float)context.ViewportSize.Y, Near, Far); 22 | } 23 | } -------------------------------------------------------------------------------- /src/HaroohiePals.NitroKart/MapObj/Enemies/TrafficParams.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace HaroohiePals.NitroKart.MapObj.Enemies; 8 | 9 | record TrafficParams(double Field0, double Field4, double Field8, double FieldC, double Field10, double Field14, 10 | double Field18, double Field1C, ushort Field2C, ushort Field30) 11 | { 12 | public static TrafficParams Car = new TrafficParams(12, 20, 21, 19, 12.3, 4.2, 11, 1, 0x190, 0x1AE); 13 | public static TrafficParams Truck = new TrafficParams(13, 40, 33, 28, 13.6, 4.7, 20, 1.2, 0x18F, 0x1AD); 14 | public static TrafficParams Bus = new TrafficParams(21, 55, 55, 55, 22.2, 7.5, 31, 2, 0x18E, 0x1AC); 15 | } 16 | -------------------------------------------------------------------------------- /src/HaroohiePals.MarioKartToolbox/Application/Settings/ViewportSettings.cs: -------------------------------------------------------------------------------- 1 | using HaroohiePals.MarioKartToolbox.Gui.Viewport; 2 | using System.Collections.Generic; 3 | 4 | namespace HaroohiePals.MarioKartToolbox.Application.Settings; 5 | 6 | record struct ViewportSettings() 7 | { 8 | public IReadOnlyDictionary> VisibleEntities = 10 | new Dictionary>(); 12 | 13 | public bool IntelRenderWorkaround = false; 14 | public bool ShowToolCameraHint = true; 15 | 16 | public ViewportColorSettings Colors = new(); 17 | } -------------------------------------------------------------------------------- /src/HaroohiePals.NitroKart.Validation/MapData/Sections/MkdsCheckPointValidationRule.cs: -------------------------------------------------------------------------------- 1 | using HaroohiePals.NitroKart.MapData.Intermediate; 2 | using HaroohiePals.NitroKart.MapData.Intermediate.Sections; 3 | using HaroohiePals.Validation; 4 | 5 | namespace HaroohiePals.NitroKart.Validation.MapData.Sections; 6 | 7 | internal class MkdsCheckPointValidationRule : MkdsMapDataEntryValidationRule 8 | { 9 | public override string Name => "Checkpoint"; 10 | 11 | protected override IReadOnlyList Validate(MkdsMapData mapData, MkdsCheckPoint entry) 12 | { 13 | var errors = new List(); 14 | 15 | ValidateReference(errors, entry, () => entry.Respawn, isRequired: true); 16 | 17 | return errors; 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /src/HaroohiePals.MarioKartToolbox/Application/Clipboard/MapDataClipboardSerializationResult.cs: -------------------------------------------------------------------------------- 1 | #nullable enable 2 | using HaroohiePals.MarioKart.MapData; 3 | using System.Collections.Generic; 4 | 5 | namespace HaroohiePals.MarioKartToolbox.Application.Clipboard; 6 | 7 | class MapDataClipboardSerializationResult 8 | { 9 | public string ClipboardString { get; } 10 | 11 | public string UniqueId { get; } 12 | 13 | public IReadOnlyDictionary LocalMapping { get; } 14 | 15 | public MapDataClipboardSerializationResult(string clipboardString, string uniqueId, IReadOnlyDictionary localMapping) 16 | { 17 | ClipboardString = clipboardString; 18 | UniqueId = uniqueId; 19 | LocalMapping = localMapping; 20 | } 21 | } -------------------------------------------------------------------------------- /src/HaroohiePals.NitroKart.Validation/MapData/Sections/MkdsCannonPointValidationRule.cs: -------------------------------------------------------------------------------- 1 | using HaroohiePals.NitroKart.MapData.Intermediate; 2 | using HaroohiePals.NitroKart.MapData.Intermediate.Sections; 3 | using HaroohiePals.Validation; 4 | 5 | namespace HaroohiePals.NitroKart.Validation.MapData.Sections; 6 | 7 | internal class MkdsCannonPointValidationRule : MkdsMapDataEntryValidationRule 8 | { 9 | public override string Name => "CannonPoint"; 10 | 11 | protected override IReadOnlyList Validate(MkdsMapData mapData, MkdsCannonPoint entry) 12 | { 13 | var errors = new List(); 14 | 15 | ValidateReference(errors, entry, () => entry.MgEnemyPoint, isRequired: false); 16 | 17 | return errors; 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /src/HaroohiePals.Actions/BatchAction.cs: -------------------------------------------------------------------------------- 1 | namespace HaroohiePals.Actions; 2 | 3 | public class BatchAction : IAction 4 | { 5 | private readonly IAction[] _actions; 6 | 7 | public bool IsCreateDelete { get; } 8 | 9 | public BatchAction(IEnumerable actions) 10 | { 11 | _actions = actions.ToArray(); 12 | IsCreateDelete = _actions.Any(x => x.IsCreateDelete); 13 | } 14 | 15 | public void Do() 16 | { 17 | foreach (var x in _actions) 18 | x.Do(); 19 | } 20 | 21 | public void Undo() 22 | { 23 | for (int i = _actions.Length - 1; i >= 0; i--) 24 | _actions[i].Undo(); 25 | } 26 | 27 | public override string ToString() => "{ " + string.Join(", ", _actions.Select(a => a.ToString())) + " }"; 28 | } -------------------------------------------------------------------------------- /src/HaroohiePals.KclViewer/Files/kclPrism.vert: -------------------------------------------------------------------------------- 1 | #version 400 core 2 | 3 | layout (location = 0) in vec3 aPosition; 4 | layout (location = 1) in vec4 aColor; 5 | layout (location = 2) in uint aPickingId; 6 | layout (location = 3) in uint aCornerIdx; 7 | 8 | out vec4 vertexColor; 9 | sample out vec3 barycentric; 10 | flat out uint pickingId; 11 | 12 | uniform mat4 model; 13 | uniform mat4 view; 14 | uniform mat4 projection; 15 | 16 | void main() 17 | { 18 | gl_Position = projection * view * model * vec4(aPosition, 1.0); 19 | vertexColor = aColor; 20 | 21 | if (aCornerIdx == 0) 22 | barycentric = vec3(1, 0, 0); 23 | else if (aCornerIdx == 1) 24 | barycentric = vec3(0, 1, 0); 25 | else 26 | barycentric = vec3(0, 0, 1); 27 | 28 | pickingId = aPickingId; 29 | } -------------------------------------------------------------------------------- /src/HaroohiePals.MarioKartToolbox/OpenGL/RenderGroups/KCollision/KclViewerContext.cs: -------------------------------------------------------------------------------- 1 | using HaroohiePals.KCollision.Formats; 2 | using HaroohiePals.MarioKartToolbox.KCollision; 3 | using HaroohiePals.Mathematics; 4 | using System.Linq; 5 | 6 | namespace HaroohiePals.MarioKartToolbox.OpenGL.RenderGroups.KCollision; 7 | 8 | internal sealed class KclViewerContext 9 | { 10 | public MkdsKcl Collision { get; } 11 | 12 | public Triangle[] Triangles { get; } 13 | 14 | public MkdsKclPrism[] PrismData { get; } 15 | 16 | public KclViewerContext(MkdsKcl collision) 17 | { 18 | Collision = collision; 19 | Triangles = collision.PrismData.Select(p => p.ToTriangle(Collision)).ToArray(); 20 | PrismData = collision.PrismData.Select(x => new MkdsKclPrism(x)).ToArray(); 21 | } 22 | } -------------------------------------------------------------------------------- /src/HaroohiePals.MarioKartToolbox/Gui/View/CourseEditor/CameraPreviewSettings.cs: -------------------------------------------------------------------------------- 1 | namespace HaroohiePals.MarioKartToolbox.Gui.View.CourseEditor; 2 | 3 | class CameraPreviewSettings 4 | { 5 | public CameraPreviewViewportMode ViewportMode = CameraPreviewViewportMode.DualScreen; 6 | public CameraPreviewMode Mode = CameraPreviewMode.AnimIntro; 7 | 8 | public bool UseScreenGap = true; 9 | public bool UseNativeResolution = false; 10 | 11 | public bool ReplaySimulateCountdown = true; 12 | public bool ReplayMoveDriver = true; 13 | public float ReplayDriverMoveSpeed = 5f; 14 | public bool ReplayApplyDriverPosOnKtp2 = false; 15 | 16 | public bool EditSecondTarget = false; 17 | public bool EditKeepOriginalTargetDistance = false; 18 | public float EditTargetDistance = 1500f; 19 | } -------------------------------------------------------------------------------- /src/HaroohiePals.MarioKartToolbox/Resources/Shaders/kclPrism.vert: -------------------------------------------------------------------------------- 1 | #version 400 core 2 | 3 | layout (location = 0) in vec3 aPosition; 4 | layout (location = 1) in vec4 aColor; 5 | layout (location = 2) in uint aPickingId; 6 | layout (location = 3) in uint aCornerIdx; 7 | 8 | out vec4 vertexColor; 9 | sample out vec3 barycentric; 10 | flat out uint pickingId; 11 | 12 | uniform mat4 model; 13 | uniform mat4 view; 14 | uniform mat4 projection; 15 | 16 | void main() 17 | { 18 | gl_Position = projection * view * model * vec4(aPosition, 1.0); 19 | vertexColor = aColor; 20 | 21 | if (aCornerIdx == 0) 22 | barycentric = vec3(1, 0, 0); 23 | else if (aCornerIdx == 1) 24 | barycentric = vec3(0, 1, 0); 25 | else 26 | barycentric = vec3(0, 0, 1); 27 | 28 | pickingId = aPickingId; 29 | } -------------------------------------------------------------------------------- /src/HaroohiePals.NitroKart.Validation/MapData/Sections/MkdsEnemyPointValidationRule.cs: -------------------------------------------------------------------------------- 1 | using HaroohiePals.NitroKart.MapData.Intermediate; 2 | using HaroohiePals.NitroKart.MapData.Intermediate.Sections; 3 | using HaroohiePals.Validation; 4 | 5 | namespace HaroohiePals.NitroKart.Validation.MapData.Sections; 6 | 7 | internal class MkdsEnemyPointValidationRule : MkdsMapDataEntryValidationRule 8 | { 9 | public override string Name => "Enemy Point"; 10 | 11 | protected override IReadOnlyList Validate(MkdsMapData mapData, MkdsEnemyPoint entry) 12 | { 13 | var errors = new List(); 14 | 15 | var rule = new MkdsPointWifiCoordOutOfRangeValidationRule(Name); 16 | errors.AddRange(rule.Validate(entry)); 17 | 18 | return errors; 19 | } 20 | } -------------------------------------------------------------------------------- /src/HaroohiePals.Actions/SetArrayItemAction.cs: -------------------------------------------------------------------------------- 1 | namespace HaroohiePals.Actions; 2 | 3 | public sealed class SetArrayItemAction : IAction 4 | { 5 | private readonly Array _source; 6 | private readonly int _index; 7 | private readonly object _newValue; 8 | private readonly object _oldValue; 9 | 10 | public bool IsCreateDelete => false; 11 | 12 | public SetArrayItemAction(Array source, int index, object value) 13 | { 14 | _source = source; 15 | _index = index; 16 | _newValue = value; 17 | _oldValue = _source.GetValue(index); 18 | } 19 | 20 | public void Do() => _source.SetValue(_newValue, _index); 21 | public void Undo() => _source.SetValue(_oldValue, _index); 22 | public override string ToString() => $"{_source}[{_index}] => {_newValue}"; 23 | } -------------------------------------------------------------------------------- /src/HaroohiePals.NitroKart.Validation/MapData/MkdsMapDataValidatorFactory.cs: -------------------------------------------------------------------------------- 1 | using HaroohiePals.NitroKart.MapData.Intermediate; 2 | using HaroohiePals.NitroKart.MapObj; 3 | using HaroohiePals.Validation; 4 | 5 | namespace HaroohiePals.NitroKart.Validation.MapData; 6 | 7 | public class MkdsMapDataValidatorFactory : IMkdsMapDataValidatorFactory 8 | { 9 | private readonly IMkdsMapObjDatabase _mobjDatabase; 10 | 11 | public MkdsMapDataValidatorFactory(IMkdsMapObjDatabase mobjDatabase) 12 | { 13 | _mobjDatabase = mobjDatabase; 14 | } 15 | 16 | public IValidator CreateMkdsMapDataValidator() 17 | { 18 | var validator = new Validator(); 19 | validator.Rules.Add(new MkdsMapDataValidationRule(_mobjDatabase)); 20 | return validator; 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /src/HaroohiePals.NitroKart.Validation/MapData/Sections/MkdsItemPointValidationRule.cs: -------------------------------------------------------------------------------- 1 | using HaroohiePals.NitroKart.MapData.Intermediate; 2 | using HaroohiePals.NitroKart.MapData.Intermediate.Sections; 3 | using HaroohiePals.Validation; 4 | 5 | namespace HaroohiePals.NitroKart.Validation.MapData.Sections; 6 | 7 | internal class MkdsItemPointValidationRule : MkdsMapDataEntryValidationRule 8 | { 9 | public override string Name => "Item Point"; 10 | 11 | protected override IReadOnlyList Validate(MkdsMapData mapData, MkdsItemPoint entry) 12 | { 13 | var errors = new List(); 14 | 15 | var rule = new MkdsPointWifiCoordOutOfRangeValidationRule(Name); 16 | errors.AddRange(rule.Validate(entry)); 17 | 18 | return errors; 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /src/HaroohiePals.NitroKart/MapData/Intermediate/Sections/MobjSettings/SnowmanSettings.cs: -------------------------------------------------------------------------------- 1 | using System.ComponentModel; 2 | 3 | namespace HaroohiePals.NitroKart.MapData.Intermediate.Sections.MobjSettings 4 | { 5 | public class SnowmanSettings : MkdsMobjSettings 6 | { 7 | public SnowmanSettings() { } 8 | 9 | public SnowmanSettings(MkdsMobjSettings settings) 10 | : base(settings) { } 11 | 12 | [Description( 13 | "Setting this to true will disable resurrection of the snowman.\n" + 14 | "This behavior seems to have been meant for missions, but isn't used in the game.")] 15 | public bool DontResurrect 16 | { 17 | get => Settings[0] > 0; 18 | set => Settings[0] = (short)(value ? 1 : 0); 19 | } 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /src/HaroohiePals.Gui.Viewport/RenderGroupScenePerspective.cs: -------------------------------------------------------------------------------- 1 | using HaroohiePals.Gui.Viewport.Framebuffers; 2 | using HaroohiePals.Gui.Viewport.Projection; 3 | 4 | namespace HaroohiePals.Gui.Viewport; 5 | 6 | public class RenderGroupScenePerspective : RenderGroupScene 7 | { 8 | public PerspectiveProjection Projection { get; } = new(60, 0.25f * 16f, 1600f * 16f); 9 | 10 | public RenderGroupScenePerspective(IGLFramebufferProvider framebufferProvider) 11 | : base(framebufferProvider) { } 12 | 13 | public override void Render(ViewportContext context) 14 | { 15 | context.ProjectionMatrix = Projection.GetProjectionMatrix(context); 16 | 17 | base.Render(context); 18 | } 19 | 20 | public override void FrameSelection(ViewportContext context) 21 | { 22 | // none 23 | } 24 | } -------------------------------------------------------------------------------- /src/HaroohiePals.NitroKart.Actions/SetMkdsCourseCollisionAction.cs: -------------------------------------------------------------------------------- 1 | using HaroohiePals.Actions; 2 | using HaroohiePals.KCollision.Formats; 3 | using HaroohiePals.NitroKart.Course; 4 | 5 | namespace HaroohiePals.NitroKart.Actions; 6 | 7 | public class SetMkdsCourseCollisionAction : IAction 8 | { 9 | private IMkdsCourse _course; 10 | private MkdsKcl _oldCollision; 11 | private MkdsKcl _newCollision; 12 | 13 | public bool IsCreateDelete { get; } 14 | 15 | public SetMkdsCourseCollisionAction(IMkdsCourse course, MkdsKcl newCollision) 16 | { 17 | _course = course; 18 | 19 | _oldCollision = _course.Collision; 20 | _newCollision = newCollision; 21 | } 22 | 23 | public void Do() => _course.Collision = _newCollision; 24 | public void Undo() => _course.Collision = _oldCollision; 25 | } -------------------------------------------------------------------------------- /src/HaroohiePals.KclViewer/Files/kclOctreeCube.vert: -------------------------------------------------------------------------------- 1 | #version 400 core 2 | 3 | layout (location = 0) in vec3 aPosition; 4 | layout (location = 1) in vec3 aMinPos; 5 | layout (location = 2) in float aSize; 6 | layout (location = 3) in uint aPickingId; 7 | 8 | out vec4 vertexColor; 9 | flat out uint pickingId; 10 | 11 | uniform mat4 model; 12 | uniform mat4 view; 13 | uniform mat4 projection; 14 | 15 | uniform uint pickingGroupId; 16 | uniform uint hoverId; 17 | 18 | uniform vec4 normalColor; 19 | uniform vec4 hoverColor; 20 | 21 | void main() 22 | { 23 | gl_Position = projection * view * model * vec4(aMinPos + aPosition * aSize, 1.0); 24 | 25 | if (aPickingId == hoverId) 26 | vertexColor = hoverColor; 27 | else 28 | vertexColor = normalColor; 29 | 30 | pickingId = aPickingId | (pickingGroupId << 24); 31 | } -------------------------------------------------------------------------------- /src/HaroohiePals.MarioKartToolbox/Gui/ViewModel/CourseEditor/ArchiveTreeViewPaneViewModel.cs: -------------------------------------------------------------------------------- 1 | using HaroohiePals.IO.Archive; 2 | using NativeFileDialogs.Net; 3 | using System.IO; 4 | 5 | namespace HaroohiePals.MarioKartToolbox.Gui.ViewModel.CourseEditor; 6 | 7 | class ArchiveTreeViewPaneViewModel 8 | { 9 | public Archive Archive { get; } 10 | 11 | public ArchiveTreeViewPaneViewModel(Archive archive) 12 | { 13 | Archive = archive; 14 | } 15 | 16 | public void Export(string path) 17 | { 18 | var result = Nfd.SaveDialog(out string outPath, defaultName: path); 19 | 20 | if (result == NfdStatus.Ok) 21 | { 22 | using (var stream = File.Create(outPath)) 23 | { 24 | stream.Write(Archive.GetFileDataSpan(path)); 25 | } 26 | } 27 | } 28 | } -------------------------------------------------------------------------------- /src/HaroohiePals.Nitro.JNLib.Spl/Emitter/FieldRandomParams.cs: -------------------------------------------------------------------------------- 1 | using HaroohiePals.IO; 2 | using OpenTK.Mathematics; 3 | using System.Xml.Serialization; 4 | 5 | namespace HaroohiePals.Nitro.JNLib.Spl.Emitter 6 | { 7 | public class FieldRandomParams 8 | { 9 | public FieldRandomParams() 10 | { 11 | } 12 | 13 | public FieldRandomParams(EndianBinaryReader reader) 14 | { 15 | Strength = reader.ReadVecFx16(); 16 | Interval = reader.Read(); 17 | } 18 | 19 | public void Write(EndianBinaryWriterEx ew) 20 | { 21 | ew.WriteVecFx16(Strength); 22 | ew.Write(Interval); 23 | } 24 | 25 | public Vector3d Strength { get; set; } 26 | 27 | [XmlAttribute] 28 | public ushort Interval { get; set; } 29 | } 30 | } -------------------------------------------------------------------------------- /src/HaroohiePals.Nitro/G3/NitroVertexData.cs: -------------------------------------------------------------------------------- 1 | using OpenTK.Mathematics; 2 | using System.Runtime.InteropServices; 3 | 4 | namespace HaroohiePals.Nitro.G3; 5 | 6 | [StructLayout(LayoutKind.Sequential)] 7 | public struct NitroVertexData 8 | { 9 | public const uint MtxIdMask = 0x1F; 10 | public const uint CurMtxId = 0x1F; 11 | public const uint HasNormalFlag = 1 << 5; 12 | 13 | public const int PosIdx = 0; 14 | public const int NrmClrIdx = 1; 15 | public const int TexCoordIdx = 2; 16 | public const int MtxIdIdx = 3; 17 | 18 | public Vector3 Position; 19 | public Vector3 NormalOrColor; 20 | public Vector2 TexCoord; 21 | public uint MtxId; 22 | 23 | public static int Size => Marshal.SizeOf(); 24 | 25 | public override string ToString() => $"{Position}"; 26 | } -------------------------------------------------------------------------------- /src/HaroohiePals.Graphics3d.OpenGL.Renderers/VertexData.cs: -------------------------------------------------------------------------------- 1 | using OpenTK.Mathematics; 2 | using System.Runtime.InteropServices; 3 | 4 | namespace HaroohiePals.Graphics3d.OpenGL.Renderers; 5 | 6 | [StructLayout(LayoutKind.Sequential)] 7 | public struct VertexData 8 | { 9 | public const uint MtxIdMask = 0x1F; 10 | public const uint CurMtxId = 0x1F; 11 | public const uint HasNormalFlag = 1 << 5; 12 | 13 | public const int PosIdx = 0; 14 | public const int NrmClrIdx = 1; 15 | public const int TexCoordIdx = 2; 16 | public const int MtxIdIdx = 3; 17 | 18 | public Vector3 Position; 19 | public Vector3 NormalOrColor; 20 | public Vector2 TexCoord; 21 | public uint MtxId; 22 | 23 | public static int Size => Marshal.SizeOf(); 24 | 25 | public override string ToString() => $"{Position}"; 26 | } 27 | -------------------------------------------------------------------------------- /src/HaroohiePals.Graphics3d.OpenGL.Renderers/InstancedPointGlData.cs: -------------------------------------------------------------------------------- 1 | using OpenTK.Mathematics; 2 | using System.Runtime.InteropServices; 3 | 4 | namespace HaroohiePals.Graphics3d.OpenGL.Renderers; 5 | 6 | struct InstancedPointGlData 7 | { 8 | [GLVertexAttrib(0)] 9 | public Matrix4 Transform; 10 | 11 | [GLVertexAttrib(4)] 12 | public Vector3 Color; 13 | 14 | [GLVertexAttribI(5)] 15 | public uint PickingId; 16 | 17 | [GLVertexAttribI(6)] 18 | public uint UseTexture; 19 | 20 | [GLVertexAttribI(7)] 21 | public uint Hover; 22 | 23 | [GLVertexAttribI(8)] 24 | public uint Highlight; 25 | 26 | [GLVertexAttrib(9)] 27 | public float TexCoordAngle; 28 | 29 | public static int Size => Marshal.SizeOf(); 30 | 31 | public override string ToString() => $"{Transform.Row3.Xyz}"; 32 | } -------------------------------------------------------------------------------- /src/HaroohiePals.MarioKartToolbox/Resources/Shaders/kclOctreeCube.vert: -------------------------------------------------------------------------------- 1 | #version 400 core 2 | 3 | layout (location = 0) in vec3 aPosition; 4 | layout (location = 1) in vec3 aMinPos; 5 | layout (location = 2) in float aSize; 6 | layout (location = 3) in uint aPickingId; 7 | 8 | out vec4 vertexColor; 9 | flat out uint pickingId; 10 | 11 | uniform mat4 model; 12 | uniform mat4 view; 13 | uniform mat4 projection; 14 | 15 | uniform uint pickingGroupId; 16 | uniform uint hoverId; 17 | 18 | uniform vec4 normalColor; 19 | uniform vec4 hoverColor; 20 | 21 | void main() 22 | { 23 | gl_Position = projection * view * model * vec4(aMinPos + aPosition * aSize, 1.0); 24 | 25 | if (aPickingId == hoverId) 26 | vertexColor = hoverColor; 27 | else 28 | vertexColor = normalColor; 29 | 30 | pickingId = aPickingId | (pickingGroupId << 24); 31 | } -------------------------------------------------------------------------------- /src/HaroohiePals.Gui/Win32Util.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Runtime.InteropServices; 3 | 4 | namespace HaroohiePals.Gui; 5 | 6 | static class Win32Util 7 | { 8 | private const int DWMWA_USE_IMMERSIVE_DARK_MODE = 20; 9 | 10 | [DllImport("dwmapi.dll", CharSet = CharSet.Unicode, ExactSpelling = true)] 11 | public static extern void DwmSetWindowAttribute(IntPtr hWnd, int dwAttribute); 12 | 13 | [DllImport("uxtheme.dll", EntryPoint = "#132", CharSet = CharSet.Unicode)] 14 | public static extern bool ShouldAppUseDarkMode(); 15 | 16 | [DllImport("uxtheme.dll", EntryPoint = "#138", CharSet = CharSet.Unicode)] 17 | public static extern bool ShouldSystemUseDarkMode(); 18 | 19 | public static void ApplyImmersiveDarkModeOnWindow(IntPtr hWnd) 20 | => DwmSetWindowAttribute(hWnd, DWMWA_USE_IMMERSIVE_DARK_MODE); 21 | 22 | } 23 | -------------------------------------------------------------------------------- /src/HaroohiePals.MarioKart.Validation/MapData/RequiredMapDataEntryReferenceValidationError.cs: -------------------------------------------------------------------------------- 1 | using HaroohiePals.IO.Reference; 2 | using HaroohiePals.MarioKart.MapData; 3 | using HaroohiePals.Validation; 4 | using System.Linq.Expressions; 5 | 6 | namespace HaroohiePals.NitroKart.Validation.MapData.Sections; 7 | 8 | public class RequiredMapDataEntryReferenceValidationError : ValidationError 9 | where TRef : IReferenceable, IMapDataEntry 10 | { 11 | public RequiredMapDataEntryReferenceValidationError(IValidationRule rule, IMapDataEntry source, Expression?>> propertyExpression) 12 | : base(rule, ErrorLevel.Error, $"Required reference: ", source, false) 13 | { 14 | if (propertyExpression.Body is MemberExpression memberExpression) 15 | Message += memberExpression.Member.Name; 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /src/HaroohiePals.MarioKartToolbox/Gui/View/CourseEditor/MapDataTreeNode.cs: -------------------------------------------------------------------------------- 1 | using HaroohiePals.Gui.View.Tree; 2 | using HaroohiePals.MarioKart.MapData; 3 | 4 | namespace HaroohiePals.MarioKartToolbox.Gui.View.CourseEditor; 5 | 6 | class MapDataTreeNode : TreeNode 7 | { 8 | public MapDataTreeNode(string uniqueId, string icon, string label, bool isLeaf) : base(label, isLeaf) 9 | { 10 | UniqueId = uniqueId; 11 | Icon = icon; 12 | } 13 | 14 | public string UniqueId; 15 | public string Icon; 16 | public int Index; 17 | 18 | public MapDataTreeNode Parent; 19 | 20 | public bool Visible = true; 21 | public bool ShowVisibilityButton = true; 22 | public bool ShowItemCount = false; 23 | public bool CanShowContextMenu = true; 24 | public bool CanDrag = false; 25 | 26 | public IMapDataCollection Collection; 27 | } -------------------------------------------------------------------------------- /src/HaroohiePals.Nitro.NitroSystem/Snd/Player/Work.cs: -------------------------------------------------------------------------------- 1 | namespace HaroohiePals.Nitro.NitroSystem.Snd.Player 2 | { 3 | public class Work 4 | { 5 | public ExChannel[] Channels { get; } = new ExChannel[16]; 6 | public Player[] Players { get; } = new Player[16]; 7 | public Track[] Tracks { get; } = new Track[32]; 8 | 9 | private DSSoundContext _context; 10 | 11 | public Work(DSSoundContext context) 12 | { 13 | _context = context; 14 | for (int i = 0; i < 16; i++) 15 | { 16 | Channels[i] = new ExChannel(context); 17 | Players[i] = new Player(context); 18 | } 19 | 20 | for (int i = 0; i < 32; i++) 21 | { 22 | Tracks[i] = new Track(context); 23 | } 24 | } 25 | } 26 | } -------------------------------------------------------------------------------- /src/HaroohiePals.MarioKartToolbox/KCollision/MkdsCollisionType.cs: -------------------------------------------------------------------------------- 1 | namespace HaroohiePals.MarioKartToolbox.KCollision; 2 | 3 | //Move this to nitro kart lib later 4 | 5 | public enum MkdsCollisionType : int 6 | { 7 | Road, 8 | SlipperyRoad, 9 | WeakOffRoad, 10 | OffRoad, 11 | SoundTrigger, 12 | HeavyOffRoad, 13 | SlipperyRoad2, 14 | BoostPad, 15 | Wall, 16 | InvisibleWall, //ignored by cameras and items 17 | OutOfBounds, 18 | FallBoundary, 19 | JumpPad, 20 | RoadNoDrivers, //for out of bounds areas unreachable by drivers, but where items might drop 21 | WallNoDrivers, 22 | CannonActivator, 23 | EdgeWall, 24 | FallsWater, 25 | BoostPadMinSpeed, //forces a minimum speed to ensure certain jumps can be made 26 | Loop, 27 | SpecialRoad, 28 | Wall3, 29 | ForceRecalculateRoute 30 | } 31 | -------------------------------------------------------------------------------- /src/HaroohiePals.NitroKart/MapObj/MapObjAttribute.cs: -------------------------------------------------------------------------------- 1 | using HaroohiePals.NitroKart.MapData; 2 | using System; 3 | 4 | namespace HaroohiePals.NitroKart.MapObj 5 | { 6 | [AttributeUsage(AttributeTargets.Class, Inherited = false, AllowMultiple = true)] 7 | public sealed class MapObjAttribute : Attribute 8 | { 9 | public readonly MkdsMapObjectId Id; 10 | public readonly Type[] RenderPartTypes; 11 | public readonly Type LogicPartType; 12 | public readonly object Arg; 13 | 14 | public MapObjAttribute(MkdsMapObjectId id, Type[] renderPartTypes, Type logicPartType = null, object arg = null) 15 | { 16 | Id = id; 17 | RenderPartTypes = renderPartTypes; 18 | LogicPartType = logicPartType; 19 | Arg = arg; 20 | } 21 | } 22 | } -------------------------------------------------------------------------------- /src/HaroohiePals.MarioKartToolbox/Application/Settings/ViewportKeyBindingSettings.cs: -------------------------------------------------------------------------------- 1 | using HaroohiePals.Gui.Input; 2 | using HaroohiePals.Gui.Viewport; 3 | using ImGuiNET; 4 | 5 | namespace HaroohiePals.MarioKartToolbox.Application.Settings; 6 | 7 | record struct ViewportKeyBindingSettings() 8 | { 9 | public KeyBinding Forward = new(ImGuiKey.W); 10 | public KeyBinding Left = new(ImGuiKey.A); 11 | public KeyBinding Backward = new(ImGuiKey.S); 12 | public KeyBinding Right = new(ImGuiKey.D); 13 | public KeyBinding Up = new(ImGuiKey.Q); 14 | public KeyBinding Down = new(ImGuiKey.E); 15 | 16 | public readonly ViewportKeyBindings ToViewportKeyBindings() => new() 17 | { 18 | Forward = Forward, 19 | Left = Left, 20 | Backward = Backward, 21 | Right = Right, 22 | Up = Up, 23 | Down = Down 24 | }; 25 | } -------------------------------------------------------------------------------- /src/HaroohiePals.IO/Reference/RestorableReference.cs: -------------------------------------------------------------------------------- 1 | namespace HaroohiePals.IO.Reference; 2 | 3 | public class RestorableReference : IRestorableReference where TRef : IReferenceable 4 | { 5 | private TRef _item { get; set; } 6 | private object _target { get; set; } 7 | private string _propertyName { get; set; } 8 | 9 | public RestorableReference(TRef item, object target, string propertyName) 10 | { 11 | _item = item; 12 | _target = target; 13 | _propertyName = propertyName; 14 | } 15 | 16 | public void Restore() 17 | { 18 | var property = _target.GetType().GetProperty(_propertyName); 19 | 20 | var newReference = _item?.GetReference((x) => 21 | { 22 | property.SetValue(_target, null); 23 | }); 24 | 25 | property.SetValue(_target, newReference); 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /src/HaroohiePals.Gui/View/Menu/MenuUtil.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using System.Linq; 3 | 4 | namespace HaroohiePals.Gui.View.Menu; 5 | 6 | public static class MenuUtil 7 | { 8 | public static IReadOnlyList Merge(this IReadOnlyCollection first, IReadOnlyCollection other) 9 | { 10 | var merged = new List(); 11 | 12 | foreach (var itemA in first) 13 | { 14 | var cloned = itemA.Clone(); 15 | merged.Add(cloned); 16 | var itemB = other.FirstOrDefault(x => x.Text == itemA.Text); 17 | if (itemB != null) 18 | { 19 | if (cloned.Items == null) 20 | cloned.Items = new(); 21 | cloned.Items.AddRange(itemB.Clone().Items); 22 | } 23 | } 24 | 25 | return merged; 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /src/HaroohiePals.MarioKartToolbox/Gui/View/Main/IMainWindowFactory.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using HaroohiePals.Gui.View.Modal; 3 | using HaroohiePals.MarioKartToolbox.Gui.View.CourseEditor; 4 | using HaroohiePals.MarioKartToolbox.Gui.View.RomExplorer; 5 | using HaroohiePals.NitroKart.Course; 6 | 7 | namespace HaroohiePals.MarioKartToolbox.Gui.View.Main; 8 | 9 | interface IMainWindowFactory 10 | { 11 | CourseEditorContentView CreateCourseEditorView(IMkdsCourse course); 12 | RomExplorerContentView CreateRomExplorerContentView(string fileName); 13 | ModalView CreatePreferencesModal(); 14 | ModalView CreateAboutModal(); 15 | ModalView CreateRomProjectModal(Action onCreateProject); 16 | NitroKartCourseProjectModalView CreateNitroKartCourseProjectModal(); 17 | ModalView CreateObsoleteNkprojWarningModalView(); 18 | ModalView CreateNdsRomWarningModalView(); 19 | } -------------------------------------------------------------------------------- /src/HaroohiePals.NitroKart.Validation/Course/MkdsCourseMapDataValidationRule.cs: -------------------------------------------------------------------------------- 1 | using HaroohiePals.NitroKart.Course; 2 | using HaroohiePals.NitroKart.MapData.Intermediate; 3 | using HaroohiePals.Validation; 4 | 5 | namespace HaroohiePals.NitroKart.Validation.Course; 6 | 7 | public class MkdsCourseMapDataValidationRule : IValidationRule 8 | { 9 | private readonly IValidator _mapDataValidator; 10 | 11 | public string Name => "Map Data"; 12 | 13 | public MkdsCourseMapDataValidationRule(IValidator mapDataValidator) 14 | { 15 | _mapDataValidator = mapDataValidator; 16 | } 17 | 18 | public IReadOnlyList Validate(IMkdsCourse obj) 19 | { 20 | var errors = new List(); 21 | errors.AddRange(_mapDataValidator.Validate(obj.MapData)); 22 | return errors; 23 | } 24 | } -------------------------------------------------------------------------------- /src/HaroohiePals.NitroKart.Validation/HaroohiePals.NitroKart.Validation.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | net8.0 5 | enable 6 | enable 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /src/HaroohiePals.NitroKart/Course/IMkdsCourse.cs: -------------------------------------------------------------------------------- 1 | using HaroohiePals.KCollision.Formats; 2 | using HaroohiePals.NitroKart.MapData.Intermediate; 3 | 4 | namespace HaroohiePals.NitroKart.Course; 5 | 6 | public interface IMkdsCourse 7 | { 8 | MkdsMapData MapData { get; } 9 | MkdsKcl Collision { get; set; } 10 | 11 | bool Save(); 12 | 13 | T GetMainFileOrDefault(string path, T defaultValue = default); 14 | T GetTexFileOrDefault(string path, T defaultValue = default); 15 | 16 | //void SetMainFileData(string path, byte[] data); 17 | //void SetTexFileData(string path, byte[] data); 18 | 19 | bool ExistsMainFile(string path); 20 | bool ExistsTexFile(string path); 21 | 22 | public delegate void CourseFileUpdatedEventHandler(bool isTex, string path); 23 | 24 | event CourseFileUpdatedEventHandler CourseFileUpdated { add { } remove { } } 25 | } 26 | -------------------------------------------------------------------------------- /test/HaroohiePals.IO.Test/HaroohiePals.IO.Test.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | net8.0 5 | 6 | false 7 | 8 | 9 | 10 | 11 | 12 | runtime; build; native; contentfiles; analyzers; buildtransitive 13 | all 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | -------------------------------------------------------------------------------- /src/HaroohiePals.IO/Serialization/ReferenceAttribute.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace HaroohiePals.IO.Serialization 4 | { 5 | public enum ReferenceType 6 | { 7 | Absolute, 8 | ChunkRelative, 9 | FieldRelative 10 | } 11 | 12 | [AttributeUsage(AttributeTargets.Field, Inherited = true, AllowMultiple = false)] 13 | public sealed class ReferenceAttribute : Attribute 14 | { 15 | public ReferenceType Type { get; } 16 | public FieldType PointerFieldType { get; } 17 | public int Offset { get; } 18 | 19 | public ReferenceAttribute(ReferenceType type, FieldType pointerFieldType = FieldType.U32, int offset = 0) 20 | { 21 | Type = type; 22 | PointerFieldType = pointerFieldType; 23 | Offset = offset; 24 | } 25 | } 26 | } -------------------------------------------------------------------------------- /src/HaroohiePals.Nitro/Gx/Enums.cs: -------------------------------------------------------------------------------- 1 | using System.ComponentModel; 2 | 3 | namespace HaroohiePals.Nitro.Gx 4 | { 5 | public enum ImageFormat : uint 6 | { 7 | [Description("None")] 8 | None = 0, 9 | 10 | [Description("A3I5")] 11 | A3I5 = 1, 12 | 13 | [Description("Palette 4")] 14 | Pltt4 = 2, 15 | 16 | [Description("Palette 16")] 17 | Pltt16 = 3, 18 | 19 | [Description("Palette 256")] 20 | Pltt256 = 4, 21 | 22 | [Description("4x4")] 23 | Comp4x4 = 5, 24 | 25 | [Description("A5I3")] 26 | A5I3 = 6, 27 | 28 | [Description("Direct")] 29 | Direct = 7 30 | } 31 | 32 | public enum CharFormat : uint 33 | { 34 | Char, 35 | Bmp 36 | } 37 | 38 | public enum MapFormat : uint 39 | { 40 | Text, 41 | Affine 42 | } 43 | } -------------------------------------------------------------------------------- /src/HaroohiePals.IO/Reference/ReferenceHolder.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using System.ComponentModel; 3 | using System.Linq; 4 | 5 | namespace HaroohiePals.IO.Reference; 6 | 7 | [Browsable(false)] 8 | public class ReferenceHolder where T : IReferenceable 9 | { 10 | private readonly HashSet> _references = new(); 11 | 12 | [Browsable(false)] 13 | public bool HasReferences => _references.Count > 0; 14 | 15 | public void RegisterReference(Reference reference) 16 | { 17 | _references.Add(reference); 18 | } 19 | 20 | public void ReleaseReference(Reference reference) 21 | { 22 | reference.InvokeRemove(); 23 | _references.Remove(reference); 24 | } 25 | 26 | public void ReleaseAllReferences() 27 | { 28 | while(_references.Count > 0) 29 | ReleaseReference(_references.First()); 30 | } 31 | } -------------------------------------------------------------------------------- /src/HaroohiePals.Nitro.NitroSystem/G3d/Binary/Model/PaletteToMaterialDictionaryData.cs: -------------------------------------------------------------------------------- 1 | using HaroohiePals.IO; 2 | 3 | namespace HaroohiePals.Nitro.NitroSystem.G3d.Binary.Model; 4 | 5 | public sealed class PaletteToMaterialDictionaryData : IG3dDictionaryData 6 | { 7 | public static ushort DataSize => 4; 8 | 9 | public void Read(EndianBinaryReaderEx er) 10 | { 11 | uint flags = er.Read(); 12 | Offset = (ushort)(flags & 0xFFFF); 13 | MaterialCount = (byte)(flags >> 16 & 0x7F); 14 | Bound = (byte)(flags >> 24 & 0xFF); 15 | } 16 | 17 | public void Write(EndianBinaryWriterEx er) 18 | { 19 | er.Write((uint)((Bound & 0xFF) << 24 | (MaterialCount & 0xFF) << 16 | (Offset & 0xFFFF) << 0)); 20 | } 21 | 22 | public ushort Offset; 23 | public byte MaterialCount; 24 | public byte Bound; 25 | 26 | public byte[] Materials; 27 | } 28 | -------------------------------------------------------------------------------- /src/HaroohiePals.Gui.Viewport/ImGuizmoOperation.cs: -------------------------------------------------------------------------------- 1 | namespace HaroohiePals.Gui.Viewport; 2 | 3 | [Flags] 4 | enum ImGuizmoOperation : uint 5 | { 6 | TranslateX = (1u << 0), 7 | TranslateY = (1u << 1), 8 | TranslateZ = (1u << 2), 9 | RotateX = (1u << 3), 10 | RotateY = (1u << 4), 11 | RotateZ = (1u << 5), 12 | RotateScreen = (1u << 6), 13 | ScaleX = (1u << 7), 14 | ScaleY = (1u << 8), 15 | ScaleZ = (1u << 9), 16 | Bounds = (1u << 10), 17 | ScaleXUniversal = (1u << 11), 18 | ScaleYUniversal = (1u << 12), 19 | ScaleZUniversal = (1u << 13), 20 | 21 | Translate = TranslateX | TranslateY | TranslateZ, 22 | Rotate = RotateX | RotateY | RotateZ | RotateScreen, 23 | Scale = ScaleX | ScaleY | ScaleZ, 24 | ScaleUniversal = ScaleXUniversal | ScaleYUniversal | ScaleZUniversal, // universal 25 | Universal = Translate | Rotate | ScaleUniversal 26 | }; 27 | -------------------------------------------------------------------------------- /src/HaroohiePals.MarioKartToolbox/Gui/View/CourseEditor/ICourseEditorViewFactory.cs: -------------------------------------------------------------------------------- 1 | using HaroohiePals.Gui.View; 2 | using HaroohiePals.IO.Archive; 3 | using HaroohiePals.MarioKartToolbox.Gui.ViewModel.CourseEditor; 4 | 5 | namespace HaroohiePals.MarioKartToolbox.Gui.View.CourseEditor; 6 | 7 | interface ICourseEditorViewFactory 8 | { 9 | IView CreateArchiveTreeView(Archive archive); 10 | PropertyGridPaneView CreatePropertyGridPaneView(ICourseEditorContext context); 11 | IView CreateMapDataExplorerView(ICourseEditorContext context); 12 | IView CreateTopDownViewportView(ICourseEditorContext context); 13 | PerspectiveViewportView CreatePerspectiveViewportView(ICourseEditorContext context); 14 | IView CreateCameraPreviewView(ICourseEditorContext context); 15 | IView CreateValidationPaneView(ICourseEditorContext context); 16 | IView CreateTimelinePaneView(ICourseEditorContext context); 17 | } -------------------------------------------------------------------------------- /src/HaroohiePals.NitroKart/MapData/Intermediate/Sections/MobjSettings/MoveItemboxSettings.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.ComponentModel; 4 | using System.Linq; 5 | using System.Text; 6 | using System.Threading.Tasks; 7 | 8 | namespace HaroohiePals.NitroKart.MapData.Intermediate.Sections.MobjSettings; 9 | 10 | public class MoveItemboxSettings : ItemboxSettings 11 | { 12 | public MoveItemboxSettings() { } 13 | 14 | public MoveItemboxSettings(MkdsMobjSettings settings) 15 | : base(settings) { } 16 | 17 | [DisplayName("Base Path Speed")] 18 | public short BasePathSpeed 19 | { 20 | get => Settings[0]; 21 | set => Settings[0] = value; 22 | } 23 | 24 | [DisplayName("Initial Path Point")] 25 | public short InitialPathPoint 26 | { 27 | get => Settings[4]; 28 | set => Settings[4] = value; 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /src/HaroohiePals.MarioKartToolbox/Gui/ViewModel/CourseEditor/MapDataGeneratorSettings.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace HaroohiePals.MarioKartToolbox.Gui.ViewModel.CourseEditor; 4 | 5 | enum MapDataGeneratorSourceType 6 | { 7 | EnemyPath, 8 | ItemPath 9 | } 10 | 11 | [Flags] 12 | enum MapDataGeneratorFlags 13 | { 14 | GenerateEnemyPath = 1, 15 | GenerateItemPath = 2, 16 | GenerateCheckPoint = 4, 17 | GenerateRespawn = 8, 18 | 19 | UpdateRespawnReferences = 16, 20 | UpdateCheckPointReferences = 32 21 | } 22 | 23 | struct MapDataGeneratorSettings 24 | { 25 | public MapDataGeneratorSourceType SourceType; 26 | public MapDataGeneratorFlags Flags; 27 | 28 | public int RespawnPointSkip; 29 | public bool RespawnPointKeepPathBoundaries; 30 | 31 | public double CheckPointWidth; 32 | public int CheckPointPointSkip; 33 | public bool CheckPointKeepPathBoundaries; 34 | } -------------------------------------------------------------------------------- /src/HaroohiePals.Nitro.NitroSystem/G3d/Binary/Model/TextureToMaterialDictionaryData.cs: -------------------------------------------------------------------------------- 1 | using HaroohiePals.IO; 2 | 3 | namespace HaroohiePals.Nitro.NitroSystem.G3d.Binary.Model; 4 | 5 | public sealed class TextureToMaterialDictionaryData : IG3dDictionaryData 6 | { 7 | public static ushort DataSize => 4; 8 | 9 | public void Read(EndianBinaryReaderEx reader) 10 | { 11 | uint flags = reader.Read(); 12 | Offset = (ushort)(flags & 0xFFFF); 13 | MaterialCount = (byte)(flags >> 16 & 0x7F); 14 | Bound = (byte)(flags >> 24 & 0xFF); 15 | } 16 | 17 | public void Write(EndianBinaryWriterEx writer) 18 | { 19 | writer.Write((uint)((Bound & 0xFF) << 24 | (MaterialCount & 0xFF) << 16 | (Offset & 0xFFFF) << 0)); 20 | } 21 | 22 | public ushort Offset; 23 | public byte MaterialCount; 24 | public byte Bound; 25 | 26 | public byte[] Materials; 27 | } 28 | -------------------------------------------------------------------------------- /src/HaroohiePals.IO/Compression/ICompressionAlgorithm.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace HaroohiePals.IO.Compression; 4 | 5 | /// 6 | /// Interface for compression algorithms. 7 | /// 8 | public interface ICompressionAlgorithm 9 | { 10 | /// 11 | /// Compresses the given . 12 | /// 13 | /// A span containing the source data. 14 | /// A byte array containing the compressed data. 15 | byte[] Compress(ReadOnlySpan sourceData); 16 | 17 | /// 18 | /// Decompresses the given . 19 | /// 20 | /// A span containing the compressed data. 21 | /// A byte array containing the decompressed data. 22 | byte[] Decompress(ReadOnlySpan compressedData); 23 | } 24 | -------------------------------------------------------------------------------- /src/HaroohiePals.Nitro.JNLib.Spl/Emitter/FieldMagnetParams.cs: -------------------------------------------------------------------------------- 1 | using HaroohiePals.IO; 2 | using OpenTK.Mathematics; 3 | using System.Xml.Serialization; 4 | 5 | namespace HaroohiePals.Nitro.JNLib.Spl.Emitter 6 | { 7 | public class FieldMagnetParams 8 | { 9 | public FieldMagnetParams() 10 | { 11 | } 12 | 13 | public FieldMagnetParams(EndianBinaryReader reader) 14 | { 15 | MagnetPos = reader.ReadVecFx32(); 16 | MagnetPower = reader.ReadFx16(); 17 | reader.Read(); 18 | } 19 | 20 | public void Write(EndianBinaryWriterEx ew) 21 | { 22 | ew.WriteVecFx32(MagnetPos); 23 | ew.WriteFx16(MagnetPower); 24 | ew.Write((ushort)0); 25 | } 26 | 27 | public Vector3d MagnetPos { get; set; } 28 | 29 | [XmlAttribute] 30 | public double MagnetPower { get; set; } 31 | } 32 | } -------------------------------------------------------------------------------- /src/HaroohiePals.NitroKart.Validation/MapData/Sections/MkdsAreaValidationRule.cs: -------------------------------------------------------------------------------- 1 | using HaroohiePals.NitroKart.MapData.Intermediate; 2 | using HaroohiePals.NitroKart.MapData.Intermediate.Sections; 3 | using HaroohiePals.Validation; 4 | 5 | namespace HaroohiePals.NitroKart.Validation.MapData.Sections; 6 | 7 | internal class MkdsAreaValidationRule : MkdsMapDataEntryValidationRule 8 | { 9 | public override string Name => "Area"; 10 | 11 | protected override IReadOnlyList Validate(MkdsMapData mapData, MkdsArea entry) 12 | { 13 | var errors = new List(); 14 | 15 | ValidateReference(errors, entry, () => entry.EnemyPoint, isRequired: false); 16 | ValidateReference(errors, entry, () => entry.MgEnemyPoint, isRequired: false); 17 | ValidateReference(errors, entry, () => entry.Camera, isRequired: false); 18 | 19 | return errors; 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /src/HaroohiePals.Graphics3d.OpenGL.Renderers/RendererUtil.cs: -------------------------------------------------------------------------------- 1 | using OpenTK.Mathematics; 2 | 3 | namespace HaroohiePals.Graphics3d.OpenGL.Renderers; 4 | 5 | internal static class RendererUtil 6 | { 7 | public static VertexData[] GetVertexDataFromObj(byte[] objData) 8 | { 9 | var box = new Obj(objData); 10 | var vertices = new VertexData[box.Faces.Count * 3]; 11 | int idx = 0; 12 | foreach (var face in box.Faces) 13 | { 14 | for (int i = 0; i < 3; i++) 15 | { 16 | var pos = box.Vertices[face.VertexIndices[i]]; 17 | var tex = box.TexCoords[face.TexCoordIndices[i]]; 18 | vertices[idx++] = new VertexData 19 | { 20 | Position = (Vector3)pos, 21 | TexCoord = (Vector2)tex 22 | }; 23 | } 24 | } 25 | return vertices; 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /src/HaroohiePals.NitroKart/MapData/Intermediate/Sections/MobjSettings/SanboSettings.cs: -------------------------------------------------------------------------------- 1 | using System.ComponentModel; 2 | 3 | namespace HaroohiePals.NitroKart.MapData.Intermediate.Sections.MobjSettings 4 | { 5 | public class SanboSettings : MkdsMobjSettings 6 | { 7 | public SanboSettings() { } 8 | 9 | public SanboSettings(MkdsMobjSettings settings) 10 | : base(settings) { } 11 | 12 | public short PathSpeed 13 | { 14 | get => Settings[0]; 15 | set => Settings[0] = value; 16 | } 17 | 18 | [Description( 19 | "Setting this to true will disable resurrection of the Sanbo after a delay.\n" + 20 | "This behavior is meant to be used for missions.")] 21 | public bool DontResurrect 22 | { 23 | get => Settings[1] != 0; 24 | set => Settings[1] = (short) (value ? 1 : 0); 25 | } 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /src/HaroohiePals.Nitro.NitroSystem.G3d.OpenGL/GLG3dModelShader.cs: -------------------------------------------------------------------------------- 1 | using HaroohiePals.Graphics3d.OpenGL; 2 | using HaroohiePals.Nitro.G3.OpenGL; 3 | using HaroohiePals.Nitro.NitroSystem.G3d.OpenGL.Resources; 4 | using OpenTK.Graphics.OpenGL4; 5 | using OpenTK.Mathematics; 6 | 7 | namespace HaroohiePals.Nitro.NitroSystem.G3d.OpenGL; 8 | 9 | public class GLG3dModelShader : GLShader 10 | { 11 | public GLG3dModelShader() : base(Shaders.G3dModelVertex, Shaders.G3dModelFragment) { } 12 | public GLGeStateUniformBuffer GetUniformBuffer() => new GLGeStateUniformBuffer(GL.GetUniformBlockIndex(Handle, "uboData")); 13 | 14 | public void SetViewMatrix(Matrix4 view) => SetMatrix4("view", view); 15 | public void SetModelMatrix(Matrix4 model) => SetMatrix4("model", model); 16 | public void SetProjectionMatrix(Matrix4 projection) => SetMatrix4("projection", projection); 17 | public void SetPickingId(uint pickingId) => SetUint("pickingId", pickingId); 18 | } 19 | -------------------------------------------------------------------------------- /src/HaroohiePals.Nitro.NitroSystem/G3d/Binary/Animation/JointAnimation/Nsbca.cs: -------------------------------------------------------------------------------- 1 | using HaroohiePals.IO; 2 | using System.IO; 3 | 4 | namespace HaroohiePals.Nitro.NitroSystem.G3d.Binary.Animation.JointAnimation; 5 | 6 | public sealed class Nsbca 7 | { 8 | public const uint Bca0Signature = 0x30414342; 9 | 10 | public Nsbca(byte[] data) 11 | : this(new MemoryStream(data, false)) { } 12 | 13 | public Nsbca(Stream stream) 14 | { 15 | using (var er = new EndianBinaryReaderEx(stream, Endianness.LittleEndian)) 16 | { 17 | Header = new G3dFileHeader(er, Bca0Signature); 18 | if (Header.NrBlocks > 0) 19 | { 20 | er.BaseStream.Position = Header.BlockOffsets[0]; 21 | JointAnimationSet = new G3dJointAnimationSet(er); 22 | } 23 | } 24 | } 25 | 26 | public G3dFileHeader Header; 27 | 28 | public G3dJointAnimationSet JointAnimationSet; 29 | } 30 | -------------------------------------------------------------------------------- /test/HaroohiePals.NitroKart.NUnitTests/HaroohiePals.NitroKart.NUnitTest.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | net8.0 5 | enable 6 | enable 7 | 8 | false 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | -------------------------------------------------------------------------------- /src/HaroohiePals.KCollision/Formats/FloatKclPrism.cs: -------------------------------------------------------------------------------- 1 | using HaroohiePals.IO; 2 | 3 | namespace HaroohiePals.KCollision.Formats 4 | { 5 | public class FloatKclPrism : KclPrism 6 | { 7 | public FloatKclPrism(EndianBinaryReaderEx er) 8 | { 9 | Height = er.Read(); 10 | PosIdx = er.Read(); 11 | FNrmIdx = er.Read(); 12 | ENrm1Idx = er.Read(); 13 | ENrm2Idx = er.Read(); 14 | ENrm3Idx = er.Read(); 15 | Attribute = er.Read(); 16 | } 17 | 18 | public override void Write(EndianBinaryWriterEx er) 19 | { 20 | er.Write((float)Height); 21 | er.Write(PosIdx); 22 | er.Write(FNrmIdx); 23 | er.Write(ENrm1Idx); 24 | er.Write(ENrm2Idx); 25 | er.Write(ENrm3Idx); 26 | er.Write(Attribute); 27 | } 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /src/HaroohiePals.Nitro.NitroSystem/Snd/Player/SharedWork.cs: -------------------------------------------------------------------------------- 1 | namespace HaroohiePals.Nitro.NitroSystem.Snd.Player 2 | { 3 | public class SharedWork 4 | { 5 | public uint FinishCommandTag; 6 | public uint PlayerStatus; 7 | 8 | public ushort ChannelStatus; 9 | 10 | //public ushort CaptureStatus; 11 | public short[][] LocalVariables { get; private set; } 12 | public uint[] TickCounters { get; private set; } 13 | public short[] GlobalVariables { get; private set; } 14 | 15 | private DSSoundContext _context; 16 | 17 | public SharedWork(DSSoundContext context) 18 | { 19 | _context = context; 20 | LocalVariables = new short[16][]; 21 | TickCounters = new uint[16]; 22 | GlobalVariables = new short[16]; 23 | for (int i = 0; i < 16; i++) 24 | LocalVariables[i] = new short[16]; 25 | } 26 | } 27 | } -------------------------------------------------------------------------------- /src/HaroohiePals.NitroKart.Validation/MapData/Sections/MkdsMapObjectTimeTrialVisibleValidationError.cs: -------------------------------------------------------------------------------- 1 | using HaroohiePals.Actions; 2 | using HaroohiePals.NitroKart.MapData.Intermediate.Sections; 3 | using HaroohiePals.Validation; 4 | 5 | namespace HaroohiePals.NitroKart.Validation.MapData.Sections; 6 | 7 | class MkdsMapObjectTimeTrialVisibleValidationError : ValidationError 8 | { 9 | private readonly bool _isTimeTrialVisible; 10 | private readonly MkdsMapObject _entry; 11 | 12 | public MkdsMapObjectTimeTrialVisibleValidationError(IValidationRule rule, MkdsMapObject source, bool isTimeTrialVisible) 13 | : base(rule, ErrorLevel.Warning, $"The TT Visible Flag should be {(isTimeTrialVisible ? "checked" : "unchecked")}", source, true) 14 | { 15 | _isTimeTrialVisible = isTimeTrialVisible; 16 | _entry = source; 17 | } 18 | 19 | protected override IAction Fix() => _entry.SetPropertyAction(x => x.TTVisible, _isTimeTrialVisible); 20 | } 21 | -------------------------------------------------------------------------------- /src/HaroohiePals.Gui.Viewport/RenderGroupSceneTopDown.cs: -------------------------------------------------------------------------------- 1 | using HaroohiePals.Gui.Viewport.Framebuffers; 2 | using HaroohiePals.Gui.Viewport.Projection; 3 | using OpenTK.Mathematics; 4 | 5 | namespace HaroohiePals.Gui.Viewport; 6 | 7 | public class RenderGroupSceneTopDown : RenderGroupScene 8 | { 9 | public OrthographicProjection OrthographicProjection { get; } = 10 | new(8192, Vector2.Zero, 8192, -16384); 11 | 12 | public RenderGroupSceneTopDown(IGLFramebufferProvider framebufferProvider) 13 | : base(framebufferProvider) { } 14 | 15 | public override void Render(ViewportContext context) 16 | { 17 | context.ProjectionMatrix = OrthographicProjection.GetProjectionMatrix(context); 18 | context.ViewMatrix = Matrix4.CreateRotationX(MathHelper.DegreesToRadians(-90)); 19 | 20 | base.Render(context); 21 | } 22 | 23 | public override void FrameSelection(ViewportContext context) 24 | { 25 | //todo 26 | } 27 | } -------------------------------------------------------------------------------- /src/HaroohiePals.Nitro.JNLib.Spl/Emitter/FieldConvergenceParams.cs: -------------------------------------------------------------------------------- 1 | using HaroohiePals.IO; 2 | using OpenTK.Mathematics; 3 | using System.Xml.Serialization; 4 | 5 | namespace HaroohiePals.Nitro.JNLib.Spl.Emitter 6 | { 7 | public class FieldConvergenceParams 8 | { 9 | public FieldConvergenceParams() 10 | { 11 | } 12 | 13 | public FieldConvergenceParams(EndianBinaryReader reader) 14 | { 15 | ConvergencePos = reader.ReadVecFx32(); 16 | ConvergenceRatio = reader.ReadFx16(); 17 | reader.Read(); 18 | } 19 | 20 | public void Write(EndianBinaryWriterEx ew) 21 | { 22 | ew.WriteVecFx32(ConvergencePos); 23 | ew.WriteFx16(ConvergenceRatio); 24 | ew.Write((ushort)0); 25 | } 26 | 27 | public Vector3d ConvergencePos { get; set; } 28 | 29 | [XmlAttribute] 30 | public double ConvergenceRatio { get; set; } 31 | } 32 | } -------------------------------------------------------------------------------- /src/HaroohiePals.Nitro.NitroSystem/G3d/Binary/Model/TextureDictionaryData.cs: -------------------------------------------------------------------------------- 1 | using HaroohiePals.IO; 2 | using HaroohiePals.IO.Serialization; 3 | using HaroohiePals.Nitro.G3; 4 | using System; 5 | 6 | namespace HaroohiePals.Nitro.NitroSystem.G3d.Binary.Model; 7 | 8 | public sealed class TextureDictionaryData : IG3dDictionaryData 9 | { 10 | public static ushort DataSize => 8; 11 | 12 | public const uint ParamExOrigWMask = 0x000007ff; 13 | public const uint ParamExOrigHMask = 0x003ff800; 14 | public const uint ParamExWHSameMask = 0x80000000; 15 | 16 | public const int ParamExOrigWShift = 0; 17 | public const int ParamExOrigHShift = 11; 18 | public const int ParamExWHSameShift = 31; 19 | 20 | public void Read(EndianBinaryReaderEx er) => er.ReadObject(this); 21 | public void Write(EndianBinaryWriterEx er) => er.WriteObject(this); 22 | 23 | [Type(FieldType.U32)] 24 | public GxTexImageParam TexImageParam; 25 | 26 | public uint ExtraParam; 27 | } -------------------------------------------------------------------------------- /src/HaroohiePals.NitroKart.Validation/MapData/Sections/MkdsCameraValidationRule.cs: -------------------------------------------------------------------------------- 1 | using HaroohiePals.NitroKart.MapData; 2 | using HaroohiePals.NitroKart.MapData.Intermediate; 3 | using HaroohiePals.NitroKart.MapData.Intermediate.Sections; 4 | using HaroohiePals.Validation; 5 | 6 | namespace HaroohiePals.NitroKart.Validation.MapData.Sections; 7 | 8 | internal class MkdsCameraValidationRule : MkdsMapDataEntryValidationRule 9 | { 10 | public override string Name => "Camera"; 11 | 12 | protected override IReadOnlyList Validate(MkdsMapData mapData, MkdsCamera entry) 13 | { 14 | var errors = new List(); 15 | 16 | ValidateReference(errors, entry, () => entry.Path, isRequired: 17 | entry.Type is MkdsCameraType.RouteLookAtDriver or MkdsCameraType.RouteLookAtTargets); 18 | ValidateReference(errors, entry, () => entry.NextCamera, isRequired: false); 19 | 20 | return errors; 21 | } 22 | 23 | } 24 | -------------------------------------------------------------------------------- /.github/workflows/dotnet-build-test.yml: -------------------------------------------------------------------------------- 1 | # This workflow will build a .NET project 2 | # For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-net 3 | 4 | name: Build and Test 5 | 6 | on: 7 | push: 8 | branches: 9 | - 'main' 10 | - 'develop' 11 | - 'feature/*' 12 | - 'upgrade/*' 13 | pull_request: 14 | branches: 15 | - 'main' 16 | - 'develop' 17 | - 'feature/*' 18 | 19 | jobs: 20 | build: 21 | 22 | runs-on: ubuntu-latest 23 | 24 | steps: 25 | - uses: actions/checkout@v3 26 | - name: Setup .NET 27 | uses: actions/setup-dotnet@v3 28 | with: 29 | dotnet-version: 8.0.x 30 | - name: Restore dependencies 31 | run: dotnet restore 32 | - name: Build 33 | run: dotnet build --no-restore 34 | - name: Test 35 | run: dotnet test --filter 'FullyQualifiedName!~HaroohiePals.NitroKart.Test' --no-build --verbosity normal -------------------------------------------------------------------------------- /test/HaroohiePals.MarioKart.Test/HaroohiePals.MarioKart.Test.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | net8.0 5 | enable 6 | enable 7 | 8 | false 9 | true 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | -------------------------------------------------------------------------------- /src/HaroohiePals.Graphics/Rgba8Bitmap.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace HaroohiePals.Graphics 4 | { 5 | public class Rgba8Bitmap 6 | { 7 | public int Width { get; } 8 | public int Height { get; } 9 | public uint[] Pixels { get; } 10 | 11 | public Rgba8Bitmap(int width, int height) 12 | { 13 | Width = width; 14 | Height = height; 15 | 16 | Pixels = new uint[width * height]; 17 | } 18 | 19 | public Rgba8Bitmap(int width, int height, uint[] data) 20 | { 21 | Width = width; 22 | Height = height; 23 | 24 | Pixels = new uint[width * height]; 25 | Array.Copy(data, Pixels, Pixels.Length); 26 | } 27 | 28 | public uint this[int x, int y] 29 | { 30 | get => Pixels[y * Width + x]; 31 | set => Pixels[y * Width + x] = value; 32 | } 33 | 34 | //todo: add utils here perhaps 35 | } 36 | } -------------------------------------------------------------------------------- /src/HaroohiePals.NitroKart.Validation/MapData/Sections/MkdsRespawnPointValidationRule.cs: -------------------------------------------------------------------------------- 1 | using HaroohiePals.NitroKart.MapData.Intermediate; 2 | using HaroohiePals.NitroKart.MapData.Intermediate.Sections; 3 | using HaroohiePals.Validation; 4 | 5 | namespace HaroohiePals.NitroKart.Validation.MapData.Sections; 6 | 7 | internal class MkdsRespawnPointValidationRule : MkdsMapDataEntryValidationRule 8 | { 9 | public override string Name => "Respawn"; 10 | 11 | protected override IReadOnlyList Validate(MkdsMapData mapData, MkdsRespawnPoint entry) 12 | { 13 | var errors = new List(); 14 | 15 | ValidateReference(errors, entry, () => entry.ItemPoint, isRequired: !mapData.IsMgStage); 16 | ValidateReference(errors, entry, () => entry.EnemyPoint, isRequired: !mapData.IsMgStage); 17 | ValidateReference(errors, entry, () => entry.MgEnemyPoint, isRequired: mapData.IsMgStage); 18 | 19 | return errors; 20 | } 21 | } -------------------------------------------------------------------------------- /src/HaroohiePals.KCollision/Formats/Fx32KclPrism.cs: -------------------------------------------------------------------------------- 1 | using HaroohiePals.IO; 2 | 3 | namespace HaroohiePals.KCollision.Formats 4 | { 5 | public class Fx32KclPrism : KclPrism 6 | { 7 | public Fx32KclPrism() { } 8 | 9 | public Fx32KclPrism(EndianBinaryReaderEx er) 10 | { 11 | Height = er.ReadFx32(); 12 | PosIdx = er.Read(); 13 | FNrmIdx = er.Read(); 14 | ENrm1Idx = er.Read(); 15 | ENrm2Idx = er.Read(); 16 | ENrm3Idx = er.Read(); 17 | Attribute = er.Read(); 18 | } 19 | 20 | public override void Write(EndianBinaryWriterEx er) 21 | { 22 | er.WriteFx32(Height); 23 | er.Write(PosIdx); 24 | er.Write(FNrmIdx); 25 | er.Write(ENrm1Idx); 26 | er.Write(ENrm2Idx); 27 | er.Write(ENrm3Idx); 28 | er.Write(Attribute); 29 | } 30 | } 31 | } -------------------------------------------------------------------------------- /src/HaroohiePals.KCollision/Formats/Sm64dsKclPrism.cs: -------------------------------------------------------------------------------- 1 | using HaroohiePals.IO; 2 | 3 | namespace HaroohiePals.KCollision.Formats 4 | { 5 | public class Sm64dsKclPrism : KclPrism 6 | { 7 | public Sm64dsKclPrism(EndianBinaryReaderEx er) 8 | { 9 | Height = er.Read() / 65536.0; 10 | PosIdx = er.Read(); 11 | FNrmIdx = er.Read(); 12 | ENrm1Idx = er.Read(); 13 | ENrm2Idx = er.Read(); 14 | ENrm3Idx = er.Read(); 15 | Attribute = er.Read(); 16 | } 17 | 18 | public override void Write(EndianBinaryWriterEx er) 19 | { 20 | er.Write((int)System.Math.Round(Height * 65536.0)); 21 | er.Write(PosIdx); 22 | er.Write(FNrmIdx); 23 | er.Write(ENrm1Idx); 24 | er.Write(ENrm2Idx); 25 | er.Write(ENrm3Idx); 26 | er.Write(Attribute); 27 | } 28 | } 29 | } -------------------------------------------------------------------------------- /src/HaroohiePals.NitroKart.Validation/MapData/Sections/MkdsPointWifiCoordOutOfRangeValidationRule.cs: -------------------------------------------------------------------------------- 1 | using HaroohiePals.MarioKart.MapData; 2 | using HaroohiePals.Validation; 3 | 4 | namespace HaroohiePals.NitroKart.Validation.MapData.Sections; 5 | 6 | internal class MkdsPointWifiCoordOutOfRangeValidationRule : IValidationRule 7 | { 8 | private readonly string _parentRuleName = string.Empty; 9 | public string Name => _parentRuleName; 10 | 11 | public MkdsPointWifiCoordOutOfRangeValidationRule(string parentRuleName) 12 | { 13 | _parentRuleName = parentRuleName; 14 | } 15 | 16 | public IReadOnlyList Validate(IPoint obj) 17 | { 18 | var errors = new List(); 19 | 20 | if (Math.Abs(obj.Position.X) > 4096.0 || Math.Abs(obj.Position.Y) > 4096.0 || Math.Abs(obj.Position.Z) > 4096.0) 21 | errors.Add(new MkdsPointWifiCoordOutOfRangeValidationError(this, obj)); 22 | 23 | return errors; 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /src/HaroohiePals.Gui.Viewport/ViewportScene.cs: -------------------------------------------------------------------------------- 1 | using HaroohiePals.Gui.Viewport.Framebuffers; 2 | 3 | namespace HaroohiePals.Gui.Viewport; 4 | 5 | public abstract class ViewportScene : IDisposable 6 | { 7 | public IGLFramebufferProvider FramebufferProvider { get; } 8 | 9 | protected ViewportScene(IGLFramebufferProvider framebufferProvider) 10 | { 11 | FramebufferProvider = framebufferProvider; 12 | } 13 | 14 | public virtual void Update(ViewportContext context, float deltaTime) { } 15 | public abstract void Render(ViewportContext context); 16 | public virtual void RenderPostProcessing(ViewportContext context) { } 17 | 18 | protected virtual void Dispose(bool disposing) 19 | { 20 | if (disposing) 21 | { 22 | FramebufferProvider.Dispose(); 23 | } 24 | } 25 | 26 | public void Dispose() 27 | { 28 | Dispose(true); 29 | GC.SuppressFinalize(this); 30 | } 31 | 32 | ~ViewportScene() => Dispose(false); 33 | } -------------------------------------------------------------------------------- /src/HaroohiePals.Nitro.NitroSystem/G3d/Intermediate/Model/ImdTexPalette.cs: -------------------------------------------------------------------------------- 1 | using HaroohiePals.Graphics; 2 | using System; 3 | using System.Globalization; 4 | using System.Linq; 5 | using System.Xml; 6 | 7 | namespace HaroohiePals.Nitro.NitroSystem.G3d.Intermediate.Model; 8 | 9 | public class ImdTexPalette 10 | { 11 | public ImdTexPalette(XmlElement element) 12 | { 13 | Index = IntermediateUtil.GetIntAttribute(element, "index"); 14 | Name = IntermediateUtil.GetStringAttribute(element, "name"); 15 | ColorSize = IntermediateUtil.GetIntAttribute(element, "color_size"); 16 | 17 | Colors = IntermediateUtil.GetInnerTextParts(element) 18 | .Select(v => (Rgb555)ushort.Parse(v, NumberStyles.HexNumber)) 19 | .ToArray(); 20 | if (Colors.Length != ColorSize) 21 | throw new Exception(); 22 | } 23 | 24 | public int Index; 25 | public string Name; 26 | public int ColorSize; 27 | 28 | public Rgb555[] Colors; 29 | } -------------------------------------------------------------------------------- /src/HaroohiePals.NitroKart/MapData/Binary/NkmdIpatEpatEntry.cs: -------------------------------------------------------------------------------- 1 | using HaroohiePals.IO; 2 | using HaroohiePals.IO.Serialization; 3 | 4 | namespace HaroohiePals.NitroKart.MapData.Binary 5 | { 6 | public class NkmdIpatEpatEntry : NkmdSectionEntry 7 | { 8 | public NkmdIpatEpatEntry() 9 | { 10 | Next = new byte[] { 0xFF, 0xFF, 0xFF }; 11 | Previous = new byte[] { 0xFF, 0xFF, 0xFF }; 12 | } 13 | 14 | public NkmdIpatEpatEntry(EndianBinaryReaderEx er) 15 | { 16 | er.ReadObject(this); 17 | er.ReadPadding(4); 18 | } 19 | 20 | public override void Write(EndianBinaryWriterEx er) 21 | { 22 | er.WriteObject(this); 23 | er.WritePadding(4); 24 | } 25 | 26 | public short StartIndex; 27 | public short Length; 28 | 29 | [ArraySize(3)] 30 | public byte[] Next; 31 | 32 | [ArraySize(3)] 33 | public byte[] Previous; 34 | } 35 | } -------------------------------------------------------------------------------- /src/HaroohiePals.Gui/View/Modal/ModalService.cs: -------------------------------------------------------------------------------- 1 | #nullable enable 2 | 3 | using System.Collections.Generic; 4 | using System.Linq; 5 | 6 | namespace HaroohiePals.Gui.View.Modal; 7 | 8 | public class ModalService : IModalService 9 | { 10 | private readonly List _modalViews = []; 11 | 12 | public bool IsAnyModalOpen => _modalViews.Any(x => x.IsOpen); 13 | 14 | public IReadOnlyCollection GetAllModals() => _modalViews; 15 | 16 | public void HideModal(ModalView modal) 17 | { 18 | modal.Close(); 19 | } 20 | 21 | public void ShowModal(ModalView modal) 22 | { 23 | if (!_modalViews.Contains(modal)) 24 | _modalViews.Add(modal); 25 | 26 | modal.Open(); 27 | } 28 | 29 | public void Cleanup() 30 | { 31 | var closedModals = _modalViews.Where(x => x is { IsOpen: false, IsOpening: false }).ToList(); 32 | foreach (var modal in closedModals) 33 | _modalViews.Remove(modal); 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /src/HaroohiePals.Nitro.NitroSystem/G3d/Binary/Animation/TexturePatternAnimation/Nsbtp.cs: -------------------------------------------------------------------------------- 1 | using HaroohiePals.IO; 2 | using System.IO; 3 | 4 | namespace HaroohiePals.Nitro.NitroSystem.G3d.Binary.Animation.TexturePatternAnimation; 5 | 6 | public sealed class Nsbtp 7 | { 8 | public const uint Btp0Signature = 0x30505442; 9 | 10 | public Nsbtp(byte[] data) 11 | : this(new MemoryStream(data, false)) { } 12 | 13 | public Nsbtp(Stream stream) 14 | { 15 | using (var er = new EndianBinaryReaderEx(stream, Endianness.LittleEndian)) 16 | { 17 | Header = new G3dFileHeader(er, Btp0Signature); 18 | if (Header.NrBlocks > 0) 19 | { 20 | er.BaseStream.Position = Header.BlockOffsets[0]; 21 | TexturePatternAnimationSet = new G3dTexturePatternAnimationSet(er); 22 | } 23 | } 24 | } 25 | 26 | public G3dFileHeader Header; 27 | 28 | public G3dTexturePatternAnimationSet TexturePatternAnimationSet; 29 | } 30 | -------------------------------------------------------------------------------- /src/HaroohiePals.MarioKartToolbox/Application/Settings/ViewportColorSettings.cs: -------------------------------------------------------------------------------- 1 | using System.Drawing; 2 | 3 | namespace HaroohiePals.MarioKartToolbox.Application.Settings; 4 | 5 | record struct ViewportColorSettings() 6 | { 7 | public Color MapObjects = Color.Red; 8 | public Color Paths = Color.FromArgb(0, 0, 171); 9 | public Color StartPoints = Color.FromArgb(32, 32, 32); 10 | public Color RespawnPoints = Color.Orange; 11 | public Color KartPoint2D = Color.FromArgb(0, 230, 255); 12 | public Color CannonPoints = Color.FromArgb(255, 0, 128); 13 | public Color KartPointMission = Color.MediumPurple; 14 | public Color EnemyPaths = Color.FromArgb(0, 204, 0); 15 | public Color MgEnemyPaths = Color.FromArgb(0, 204, 0); 16 | public Color ItemPaths = Color.FromArgb(204, 153, 0); 17 | public Color CheckPoint = Color.Blue; 18 | public Color KeyCheckPoint = Color.FromArgb(135, 206, 235); 19 | public Color Areas = Color.CornflowerBlue; 20 | public Color Cameras = Color.BurlyWood; 21 | } -------------------------------------------------------------------------------- /src/HaroohiePals.Nitro.NitroSystem/G3d/Binary/IG3dDictionaryData.cs: -------------------------------------------------------------------------------- 1 | using HaroohiePals.IO; 2 | using System; 3 | 4 | namespace HaroohiePals.Nitro.NitroSystem.G3d.Binary; 5 | 6 | /// 7 | /// Interface for the data of a . 8 | /// 9 | public interface IG3dDictionaryData 10 | { 11 | /// 12 | /// Size of this dictionary data in bytes. 13 | /// 14 | static abstract ushort DataSize { get; } 15 | 16 | /// 17 | /// Reads the data using the given . 18 | /// 19 | /// The reader to read the data with. 20 | void Read(EndianBinaryReaderEx reader); 21 | 22 | /// 23 | /// Writes the data using the given . 24 | /// 25 | /// The writer to write the data with. 26 | void Write(EndianBinaryWriterEx writer) 27 | => throw new NotImplementedException(); 28 | } 29 | -------------------------------------------------------------------------------- /test/HaroohiePals.NitroKart.Actions.Test/HaroohiePals.NitroKart.Actions.Test.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | net8.0 5 | enable 6 | enable 7 | 8 | false 9 | true 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | -------------------------------------------------------------------------------- /test/HaroohiePals.Nitro.NitroSystem.Test/G3d/Binary/NsbtaTest.cs: -------------------------------------------------------------------------------- 1 | using HaroohiePals.Nitro.NitroSystem.G3d.Binary.Animation.TextureSrtAnimation; 2 | using System.IO; 3 | using Xunit; 4 | 5 | namespace HaroohiePals.Nitro.NitroSystem.Test.G3d.Binary 6 | { 7 | public class NsbtaTest 8 | { 9 | [Theory] 10 | [InlineData("Assets/ita/BlackHole.nsbta")] 11 | [InlineData("Assets/ita/desert_gc.nsbta")] 12 | [InlineData("Assets/ita/dgc_sky.nsbta")] 13 | [InlineData("Assets/ita/patapata_gc.nsbta")] 14 | //[InlineData("Assets/ita/animtest_aligned.nsbta")] 15 | public void ReadWriteTest(string path) 16 | { 17 | var input = File.ReadAllBytes(path); 18 | var nsbta = new Nsbta(input); 19 | var rewritten = nsbta.Write(); 20 | 21 | File.WriteAllBytes("Assets/original.nsbta", input); 22 | File.WriteAllBytes("Assets/rewritten.nsbta", rewritten); 23 | 24 | Assert.Equal(input, rewritten); 25 | } 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /src/HaroohiePals.MarioKartToolbox.CommandLineInterface/HaroohiePals.MarioKartToolbox.CommandLineInterface.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Exe 5 | net8.0 6 | enable 7 | enable 8 | 2.0.0 9 | MarioKartToolboxCli 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /src/HaroohiePals.Nitro.NitroSystem/G3d/Binary/Model/G3dPaletteInfo.cs: -------------------------------------------------------------------------------- 1 | using HaroohiePals.IO; 2 | using HaroohiePals.IO.Serialization; 3 | 4 | namespace HaroohiePals.Nitro.NitroSystem.G3d.Binary.Model; 5 | 6 | [FieldAlignment(FieldAlignment.FieldSize)] 7 | public sealed class G3dPaletteInfo 8 | { 9 | public G3dPaletteInfo() { } 10 | 11 | public G3dPaletteInfo(EndianBinaryReaderEx er) 12 | { 13 | er.ReadObject(this); 14 | 15 | long curPos = er.JumpRelative(PaletteDataOffset); 16 | PaletteData = er.Read(PaletteDataSize << 3); 17 | 18 | er.BaseStream.Position = curPos; 19 | } 20 | 21 | public void Write(EndianBinaryWriterEx er) 22 | { 23 | PaletteDataSize = (ushort)((PaletteData.Length + 7) >> 3); 24 | er.WriteObject(this); 25 | } 26 | 27 | public uint VramKey; 28 | public ushort PaletteDataSize; 29 | public ushort Flag; 30 | public ushort DictionaryOffset; 31 | 32 | public uint PaletteDataOffset; 33 | 34 | [Ignore] 35 | public byte[] PaletteData; 36 | } --------------------------------------------------------------------------------