Repository navigation
Development
This comprehensive guide covers building HG Engine Editor from source, contributing to the project, and extending its functionality. Whether you're fixing bugs, adding features, or customizing the application, this guide provides the information you need.
- Operating System: Windows 10 version 2004 (19041) or newer
- Development Environment: Visual Studio 2022
- .NET SDK: .NET 8.0 SDK or newer
- Windows SDK: Latest Windows SDK (10.0.26100.0 or newer)
- Git: For source code management
Install these workloads in Visual Studio 2022:
- Universal Windows Platform (UWP) development
- .NET desktop development
- Desktop development with C++ (for Windows App SDK)
- MSVC v143 build tools
- Windows App SDK: Latest version for runtime
- MSIX Packaging Tool: For package creation
- Windows Application Packaging Project: For store distribution
# Clone the repository
git clone https://github.com/your-repo/HG Engine Editor.git
cd HG Engine Editor
# Open the solution
start HG Engine Editor.slnHG Engine Editor supports multiple target platforms:
- x86: 32-bit Windows applications
- x64: 64-bit Windows applications
- ARM64: ARM-based Windows devices
-
Open Solution: Double-click
HG Engine Editor.sln -
Select Configuration:
- Debug: Development builds with debugging symbols
- Release: Optimized production builds
- Choose Platform: x86, x64, or ARM64
- Build: Project → Build Solution (Ctrl+Shift+B)
For distribution:
-
Create Package:
- Right-click project → Publish → Create App Packages
- Choose MSIX or MSIX Bundle
- Select target platforms
-
Signing:
- Use test certificate for development
- Use code signing certificate for distribution
For development and testing:
- Install Windows App SDK Runtime
- Set as Startup Project: Right-click HG Engine Editor project
- Run: F5 or Debug → Start Debugging
HG Engine Editor/
├── HG Engine Editor/ # Main application project
│ ├── App.xaml/cs # Application entry point
│ ├── MainWindow.xaml/cs # Main window and navigation
│ ├── Pages/ # UI pages
│ │ ├── StartPage.xaml/cs # Project selection
│ │ ├── SpeciesListPage.xaml/cs # Pokemon list
│ │ ├── SpeciesDetailPage.xaml/cs # Pokemon editor
│ │ └── TrainersPage.xaml/cs # Trainer editor
│ ├── Data/ # Data parsing and management
│ │ ├── HGParsers.cs # Main data parsing logic
│ │ └── HGSerializers.cs # Data serialization
│ ├── Services/ # Application services
│ │ ├── FileWatcher.cs # File monitoring
│ │ └── ChangeLog.cs # Change tracking
│ ├── Properties/ # Application properties
│ └── Assets/ # Application assets
├── HG Engine Editor.Package/ # Packaging project
└── docs/ # Documentation
- HGParsers.cs: Core parsing logic for HG Engine data files
- HGSerializers.cs: Data writing and modification logic
- FileWatcher.cs: Monitors project files for external changes
- ChangeLog.cs: Tracks file modifications and creates backups
- StartPage: Project selection and configuration
- SpeciesListPage: Pokemon species browser
- SpeciesDetailPage: Comprehensive Pokemon editor
- TrainersPage: Trainer party management
HG Engine Editor uses the CommunityToolkit.Mvvm library for clean separation of concerns:
- Models: Data structures representing Pokemon, trainers, etc.
- ViewModels: UI logic and data binding
- Views: XAML UI definitions with code-behind
Services are registered and resolved through the MVVM toolkit:
// Service registration
private void ConfigureServices()
{
// Register services here
}-
Update Data Model:
public class SpeciesOverview { // Add new property public string NewField { get; set; } }
-
Extend Parser:
// In HGParsers.cs var newField = Regex.Match(block, @"newfield\s+(?<v>[A-Z0-9_]+)"); if (newField.Success) { overview.NewField = newField.Groups["v"].Value; }
-
Update UI:
<!-- In SpeciesDetailPage.xaml --> <TextBox Text="{Binding NewField}" Header="New Field" />
-
Add Serialization:
// In HGSerializers.cs writer.WriteLine($" newfield {speciesData.NewField}");
-
Define Constants:
// Add to evolution method enums EVO_NEW_METHOD = 99
-
Update Parser:
// In HGParsers.cs evolution parsing case "EVO_NEW_METHOD": // Handle new evolution logic break;
-
Extend UI:
- Add new evolution method to dropdown
- Add parameter fields as needed
-
Define Flag Constants:
// Add to AI flag definitions AI_FLAG_NEW_BEHAVIOR = 1 << 15
-
Update UI:
<CheckBox Content="New Behavior" IsChecked="{Binding IsNewBehaviorEnabled}" />
-
Implement Logic:
// In trainer data handling if (newBehaviorEnabled) { aiFlags |= AI_FLAG_NEW_BEHAVIOR; }
// Example test structure
[TestClass]
public class DataParsingTests
{
[TestMethod]
public void TestSpeciesParsing()
{
// Test species data parsing
}
[TestMethod]
public void TestEvolutionParsing()
{
// Test evolution data parsing
}
}- Data File Parsing: Test with various HG Engine project structures
- File Modification: Verify changes are written correctly
-
Backup Creation: Ensure
.bakfiles are created properly - Error Handling: Test behavior with malformed data
- Navigation: Test page transitions and data loading
- Data Binding: Verify UI updates with data changes
- Validation: Test input validation and error display
- Performance: Monitor loading times and memory usage
-
Configure Package:
<!-- In Package.appxmanifest --> <Identity Name="HG Engine Editor" Publisher="CN=YourPublisher" Version="1.0.0.0" />
-
Build Package:
- Project → Publish → Create App Packages
- Choose distribution method
- Configure signing certificate
-
Test Package:
- Install locally for testing
- Verify functionality in packaged environment
-
Partner Center:
- Register as Microsoft developer
- Create app submission
- Upload MSIX bundle
-
Store Requirements:
- Valid code signing certificate
- Complete app metadata
- Screenshots and descriptions
- Language: C# 10.0+ with nullable reference types
- Naming: PascalCase for classes, camelCase for variables
- Formatting: Use Visual Studio's default formatting
- Documentation: XML documentation comments for public APIs
- Fork Repository: Create your own fork
-
Create Branch:
git checkout -b feature/your-feature - Make Changes: Implement your feature or fix
- Write Tests: Add tests for new functionality
-
Commit:
git commit -m "Description of changes" -
Push:
git push origin feature/your-feature - Pull Request: Create PR with detailed description
- Title: Clear, descriptive title
- Description: Detailed explanation of changes
- Tests: Include tests for new features
- Documentation: Update docs for significant changes
- Breaking Changes: Clearly marked and explained
- Automated Checks: CI/CD pipeline runs tests and builds
- Peer Review: At least one maintainer review required
- Testing: Manual testing of significant changes
- Approval: Maintainers approve and merge
// Add debug output to parsers
Debug.WriteLine($"Parsing species: {speciesName}");
Debug.WriteLine($"Block content: {block}");// In XAML
<TextBox Text="{Binding Path=PropertyName, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
IsEnabled="{Binding CanEditProperty}" />// Add logging to file operations
try
{
// File operation
Logger.Log($"Successfully wrote {filePath}");
}
catch (Exception ex)
{
Logger.Error($"Failed to write {filePath}: {ex.Message}");
}- Memory Usage: Monitor for memory leaks in data loading
- File I/O: Profile file reading/writing operations
- UI Responsiveness: Check for blocking operations on UI thread
-
Enable Remote Debugging:
- Install remote debugging tools on target machine
- Configure firewall and network settings
-
Attach Debugger:
- Debug → Attach to Process
- Select remote connection
- Choose HG Engine Editor process
- Enhanced Evolution Editor: Full GUI for evolution configuration
- Move Editor: Comprehensive move data editing
- Item Editor: Item data management
- Ability Editor: Ability configuration interface
- Batch Operations: Bulk editing capabilities
- Export/Import: Data exchange with other tools
- Plugin System: Extensible architecture for custom editors
- Database Backend: Optional database storage for large projects
- Cloud Integration: Project synchronization and backup
- Multi-language Support: Localization for different languages
Areas needing contribution:
- Additional Data Types: Support for new HG Engine features
- UI Enhancements: Improved user experience and accessibility
- Documentation: Comprehensive user guides and tutorials
- Testing: Expanded test coverage and automated testing
- Performance: Optimization for large projects
- WinUI 3 Documentation: Microsoft official documentation
- CommunityToolkit.Mvvm: MVVM toolkit documentation
- HG Engine Documentation: ROM hacking resources
- C# Best Practices: Language and framework guidelines
-
Visual Studio Extensions:
- XAML Styler: Code formatting
- CodeMaid: Code organization
- ReSharper: Code analysis and refactoring
-
Debugging Tools:
- WinDbg: Advanced debugging
- Process Monitor: System call monitoring
- Performance Profiler: Performance analysis
- GitHub Discussions: Community questions and answers
- Discord Servers: Real-time development chat
- ROM Hacking Forums: Domain-specific knowledge
- Microsoft Developer Community: Platform-specific help
Happy developing! 🎮 This guide should provide everything you need to contribute to HG Engine Editor and extend its capabilities for the ROM hacking community.