How 4sval/fmodel works
Project Type and Purpose
• Type: Single‐process desktop application built in C# with WPF (XAML + code‐behind).
• Purpose: Provide a graphical interface (Explorer) to browse, preview, convert, and “snoop” into Unreal Engine game archives, leveraging the CUE4Parse parsing engine.
File Structure
• Presentation Layer (“FModel/Views” + “FModel/ViewModels”):
– Views: XAML files define UI controls, custom controls, and the 3D “Snooper” viewport.
– ViewModels: MVVM classes mediate data binding, commands, and user interactions.
• Application Services (“FModel/Services”):
– ApplicationService: central application lifecycle manager.
– DiscordService, other external API providers.
• Core/Domain Logic:
– Creator (packages, “Base…” classes) for exporting or customizing parsed assets.
– Extensions: helper methods for CUE4Parse, collections, clipboard, etc.
– Framework: command pattern, async queue, navigation, JSON serialization (JsonNetSerializer), logging (SerilogEnricher), ImGuiController for OpenGL.
• Settings and Persistence (“FModel/Settings”):
– User directory, endpoints, versioning, custom directory settings.
– Stored in local files/config.
• External Dependencies:
– CUE4Parse (submodule) for archive parsing.
– Newtonsoft.Json for JSON.
– Serilog for logging.
– OpenGL shaders and resources under “FModel/Resources.”
README for Additional Insights
• Core parsing library: CUE4Parse (external).
• Target platforms: UE4 & UE5 archives.
• Features: Asset preview, conversion, structural exploration, 3D model inspection.
Components
a. Presentation Layer
• WPF Views (XAML) ←→ ViewModel components
• Custom Controls (TreeView, AvalonEditor, 3D viewport)
b. Application Layer
• ViewModels dispatch Commands → Framework/Services
• Command Bus (ViewModelCommand → AsyncQueue)
c. Domain/Parsing Layer
• CUE4Parse Core Library
• Creator Package: Base classes for various game data (FN, BB, MV, SB)
d. Infrastructure Layer
• JSON Serializer (JsonNetSerializer)
• Logging (SerilogEnricher)
• ImGuiController + OpenGL Renderer (Shaders, Buffers) for 3D snooping
e. Persistence Layer
• Settings Manager (EndpointSettings, DirectorySettings) → Local files
f. External APIs
• Fortnite API, Epic API, GitHub API, FModel API, Valorant API (DynamicApiEndpoint classes)
• Discord integration
Interactions & Data Flow
• User clicks UI Control → Bound Command in ViewModel → passes through Framework to Service or CUE4Parse → Domain produces asset metadata or binary → returned to ViewModel → UI updates.
• 3D Model View (“Snooper”) → ViewModel triggers RenderLoop in ImGuiController → OpenGL buffers & shaders render UModel assets.
• Settings changes in UI → SettingsViewModel → SettingsManager writes to disk.
• API calls (GitHub, Fortnite) → FRestRequest → JSON deserialized via JsonNetSerializer → ViewModel displays results.
Architectural Patterns & Design Principles
• MVVM: clear separation of Views, ViewModels, and Models/Services.
• Command Pattern: Framework/Command classes encapsulate user actions.
• Dependency Injection (lightweight, manual): Services injected into ViewModels.
• Modular layering: Presentation → Application → Domain → Infrastructure → External.