Skip to content

Implement game launcher with crash analysis and backup improvements#6

Open
Luke1505 wants to merge 3 commits intomainfrom
claude/add-minecraft-launch-feature-3u96B
Open

Implement game launcher with crash analysis and backup improvements#6
Luke1505 wants to merge 3 commits intomainfrom
claude/add-minecraft-launch-feature-3u96B

Conversation

@Luke1505
Copy link
Collaborator

Summary

This PR re-implements the game launcher functionality that was previously removed, adds crash log analysis capabilities, improves backup management, and introduces update checking for mods. The launcher now supports multiple launcher types (Prism, MultiMC, Modrinth, Vanilla) with automatic authentication and Java detection.

Key Changes

Game Launcher (LaunchService)

  • New LaunchService class that handles Minecraft game launching with:
    • Multi-launcher support (Prism Launcher, MultiMC, Modrinth, Vanilla)
    • Automatic authentication reading from launcher data directories
    • Smart Java detection (launcher-bundled, JAVA_HOME, system PATH, common installation paths)
    • Version JSON resolution and classpath building
    • JVM argument expansion with variable substitution
    • Process management with event emission for game logs
    • Support for both modern (1.13+) and legacy argument formats

Game Console UI

  • New GameConsole component for real-time game output monitoring
  • Log filtering by type (stdout/stderr/system)
  • Auto-scroll with manual scroll detection
  • Log download functionality
  • Clear logs button

Crash Analysis

  • New CrashAnalyzer component for analyzing crash logs
  • Drag-and-drop file upload
  • Integration with installed mods for better error detection
  • Identifies problematic mods and provides recommendations

Backup Improvements

  • Enhanced backup creation to include multiple config directories:
    • config/ (main configuration folder)
    • kubejs/ (KubeJS scripts)
    • defaultconfigs/ (default configurations)
  • Backup naming now supports custom names via optional parameter
  • Backup restoration now extracts to instance root to preserve directory structure
  • New backup rename functionality via backup:rename IPC handler

Update Checking

  • New UpdateCheckerService for checking mod updates
  • New updateStore for managing update state
  • Batch checking with rate-limit awareness
  • Integration with Modrinth API for latest version detection
  • Background update checks when instances are loaded

Configuration & Settings

  • HOCON parser for parsing Human-Optimized Config Object Notation files
  • Config presets in ConfigEditor for saving/loading configuration snapshots
  • Reset to defaults functionality for config files
  • JVM memory settings in Settings UI (max/min memory configuration)

UI Enhancements

  • Header updates with game launch/stop buttons
  • Launch state indicators showing running instances
  • Error display for launch failures
  • Recent instances on landing page now support direct launch
  • Smart Search improvements with type filtering and modified-only filter
  • Sidebar collapse functionality for better space management
  • Update indicators in mod list items

IPC Handlers

  • game:launch - Launch a game instance
  • game:kill - Stop a running game
  • game:isRunning - Check if instance is running
  • game:getRunning - Get all running instances
  • game:log - Event for game log output
  • backup:rename - Rename a backup
  • analyzeCrashLog - Analyze crash log files

Implementation Details

  • LaunchService extends EventEmitter for log streaming
  • Process management uses static Map to track running instances
  • Authentication is best-effort with offline fallback
  • Java version detection reads from release file in JRE root
  • Classpath building handles both JAR files and native libraries
  • Variable substitution supports Minecraft launcher variables (auth_player_name, assets_root, etc.)
  • Game processes are detached to allow MCED to close without terminating Minecraft

https://claude.ai/code/session_01G1cMMQeJbAj2BYdK1pP8LC

Implements a complete launch-from-MCED feature allowing users to start
Minecraft directly without switching to their launcher.

Key changes:
- New LaunchService.ts: direct Java launch with per-launcher support
  (Modrinth, Prism/MultiMC, CurseForge, vanilla fallback)
- Auth tokens read from launcher storage (Prism accounts.json,
  Modrinth app.db, vanilla launcher_accounts.json); offline fallback
- Java detection: launcher-bundled → JAVA_HOME → PATH → common paths
- Version JSON + classpath resolution per launcher type
- Cross-platform classpath separator fix (: on Linux/Mac, ; on Windows)
- 4 IPC handlers: game:launch, game:kill, game:isRunning, game:getRunning
- Preload API: launchGame, killGame, isGameRunning, getRunningGames
- Header.tsx: Play/Stop button with 3s running-state poll
- App.tsx landing page: Play button overlay on recent instance cards
- LandingPage.tsx: onLaunchInstance prop + Play button overlay

https://claude.ai/code/session_01G1cMMQeJbAj2BYdK1pP8LC
- Stream stdout/stderr from the Minecraft process to the renderer via
  IPC (LaunchService emits 'log' events → mainWindow.webContents.send)
- Add onGameLog / removeGameLogListener to preload contextBridge API
- New GameConsole component: scrollable log view with color-coded
  stdout (green), stderr (red), system (yellow) lines, timestamps,
  clear + download actions, auto-scroll with manual override
- Header: ℹ info icon next to Play button shows tooltip warning that
  the instance must be launched in the original launcher at least once
  before using MCED launch (with offline-fallback note)
- Header: Terminal button appears once game output arrives, opens the
  GameConsole modal

https://claude.ai/code/session_01G1cMMQeJbAj2BYdK1pP8LC
## Backup System (ZIP-based)
- backup:create now zips config/, kubejs/ and defaultconfigs/ with proper folder structure so restores work correctly and KubeJS scripts no longer appear as loose files in the backup dir
- backup:restore extracts to instance root so all folders are restored
- Added missing backup:rename IPC handler

## Game Launcher
- JVM heap memory (max/min) is now configurable in Settings (Game Launch section)
- Added jvmMaxMemory/jvmMinMemory to settingsStore (defaults: 4096/1024 MB)
- LaunchService, IPC handler and preload all updated to pass -Xmx/-Xms from settings

## UI/UX
- Sidebar collapse button: click the chevron on the sidebar edge to collapse/expand the mod list
- SmartSearch filter pills: filter results by type (boolean/integer/float/string/enum/array) or "Changed only"
- "Recently Changed" widget on landing page shows last 5 modified settings with mod name

## Config Editor
- Reset to Defaults button: resets all settings in current config to their defaultValue
- Presets: save/load named config presets via localStorage, accessible from toolbar dropdown

## New Format Support
- HOCON parser added (HoconParser.ts) for .conf files used by older Forge mods
- ConfigService.ts updated to detect .conf files as cfg format

## Mod Update Checker
- UpdateCheckerService checks Modrinth for newer mod versions in the background after instance loads
- updateStore (Zustand) caches results; update badges appear in ModListItem

## Crash Log Analyzer
- New CrashAnalyzer.tsx component: drag & drop crash log .txt/.log
- IPC handler crash:analyze extracts main cause, error patterns and mentioned mod IDs
- Button in Header to open analyzer

## Modpack Export (.mrpack)
- IPC handler export:modpack creates mrpack ZIP with modrinth.index.json manifest + config/ and kubejs/ as overrides
- Export button in Header with prompt for pack name

https://claude.ai/code/session_01G1cMMQeJbAj2BYdK1pP8LC
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants