Skip to content

Commit 0a18344

Browse files
aradanmnclaude
andcommitted
Merge main (rev2 changes) into rev3-dynamic-splitscreen
Merges all rev2 improvements into the v3.0 dynamic splitscreen branch: From rev2 (main): - cleanup-minecraft-splitscreen.sh: Complete uninstaller script - Smart Steam Deck controller handling (OLED detection, virtual controllers) - Architecture-aware AppImage downloads (x86_64/ARM64) - Improved timeout handling in prompts - TMPDIR environment variable support - Enhanced logging with log_debug function - Flatpak --system flag for remote selection - Various bug fixes across all modules Merged into rev3: - Dynamic splitscreen mode (players join/leave mid-session) - Controller hotplug detection - Automatic window repositioning - Desktop notifications Conflict resolutions: - Version headers: Keep 3.0.0, merge changelogs - launcher_script_generator.sh: Integrate rev2 fixes (TMPDIR, log_debug, promptControllerMode) into rev3 dynamic mode structure - CLAUDE.md/README.md: Include both Issue #5 (DONE) and Issue #6 (TODO) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2 parents 94534a9 + dc8562d commit 0a18344

18 files changed

Lines changed: 1335 additions & 157 deletions

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
!README.md
77
!CLAUDE.md
88
!install-minecraft-splitscreen.sh
9+
!cleanup-minecraft-splitscreen.sh
910
!minecraftSplitscreen.sh
1011
!add-to-steam.py
1112
!accounts.json

CLAUDE.md

Lines changed: 181 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ After successful setup, PrismLauncher files are cleaned up, leaving only PollyMC
2323
```
2424
/
2525
├── install-minecraft-splitscreen.sh # Main entry point (386 lines)
26+
├── cleanup-minecraft-splitscreen.sh # Uninstaller script (removes all components)
2627
├── add-to-steam.py # Python script for Steam integration
2728
├── accounts.json # Pre-configured offline accounts (P1-P4)
2829
├── token.enc # Encrypted CurseForge API token
@@ -134,6 +135,35 @@ All modules use this header format:
134135
# - function1()
135136
```
136137

138+
### Versioning Convention (IMPORTANT)
139+
140+
**When modifying any module file, you MUST update its version number and changelog.**
141+
142+
Version format: `Major.Minor.Patch` (e.g., `2.1.0`)
143+
144+
| Component | When to Increment | Example |
145+
|-----------|-------------------|---------|
146+
| **Major** | Breaking changes, complete rewrites, new major release | 1.x.x → 2.0.0 |
147+
| **Minor** | New features, significant improvements | 2.0.x → 2.1.0 |
148+
| **Patch** | Bug fixes, small changes | 2.1.0 → 2.1.1 |
149+
150+
**Version history:**
151+
- `1.x.x` = Original flyingEwok era
152+
- `2.x.x` = aradanmn fork (current)
153+
- `3.x.x` = Reserved for future major release (e.g., dynamic splitscreen)
154+
155+
**Update checklist when modifying a file:**
156+
1. Increment `@version` tag appropriately
157+
2. Update `@date` to current date
158+
3. Add changelog entry with version, date, and description:
159+
```bash
160+
# @changelog
161+
# 2.1.1 (2026-01-31) - Fix: Description of the bug fix
162+
# 2.1.0 (2026-01-30) - Added new feature X
163+
```
164+
165+
**Global version:** `SCRIPT_VERSION` in `version_info.sh` should match the highest module version for releases.
166+
137167
### Print Functions (from utilities.sh)
138168

139169
```bash
@@ -285,6 +315,7 @@ The installer generates `minecraftSplitscreen.sh` at runtime with:
285315
| File | Lines | Purpose |
286316
|------|-------|---------|
287317
| `install-minecraft-splitscreen.sh` | ~386 | Entry point, module loader |
318+
| `cleanup-minecraft-splitscreen.sh` | ~490 | Uninstaller (removes all components) |
288319
| `modules/path_configuration.sh` | ~600+ | Path management (CRITICAL) |
289320
| `modules/mod_management.sh` | ~1900 | Mod compatibility (largest) |
290321
| `modules/main_workflow.sh` | ~1300 | Main orchestration |
@@ -304,6 +335,59 @@ The installer generates `minecraftSplitscreen.sh` at runtime with:
304335
9. **System Integration** - Steam, desktop shortcuts
305336
10. **Completion Report** - Summary with paths and usage
306337

338+
## Cleanup Script
339+
340+
The `cleanup-minecraft-splitscreen.sh` script removes all components installed by the installer:
341+
342+
```bash
343+
# Preview what would be removed (dry-run mode)
344+
./cleanup-minecraft-splitscreen.sh --dry-run
345+
346+
# Clean everything except Java (default)
347+
./cleanup-minecraft-splitscreen.sh
348+
349+
# Clean everything including Java, no prompts
350+
./cleanup-minecraft-splitscreen.sh --remove-java --force
351+
352+
# Remote cleanup via SSH
353+
ssh deck@steamdeck './cleanup-minecraft-splitscreen.sh --force'
354+
```
355+
356+
**What it removes:**
357+
- PollyMC data and AppImage (`~/.local/share/PollyMC`)
358+
- PollyMC Flatpak data (`~/.var/app/org.fn2006.PollyMC`)
359+
- PrismLauncher data and AppImage (`~/.local/share/PrismLauncher`)
360+
- PrismLauncher Flatpak data (`~/.var/app/org.prismlauncher.PrismLauncher`)
361+
- Flatpak applications (PollyMC, PrismLauncher)
362+
- Desktop shortcuts and app menu entries
363+
- Installer logs (`~/.local/share/MinecraftSplitscreen`)
364+
365+
**What it preserves by default:**
366+
- Java installations (`~/.local/jdk/`) - use `--remove-java` to delete
367+
368+
**Note:** Steam shortcuts (non-Steam games) must be removed manually in Steam.
369+
370+
## Known Issues
371+
372+
### SSH + curl | bash Causes Script Crash
373+
374+
**Problem:** When running the installer via `curl | bash` over SSH, the script crashes at interactive prompts (exit code 139/SIGSEGV).
375+
376+
**Root Cause:** The `prompt_user` function tries to read from `/dev/tty` for `curl | bash` compatibility, but this fails in certain SSH configurations.
377+
378+
**Workaround:** Download the script first, then run it directly:
379+
380+
```bash
381+
# Instead of: curl -fsSL URL | bash
382+
383+
# Do this:
384+
curl -fsSL https://raw.githubusercontent.com/aradanmn/MinecraftSplitscreenSteamdeck/main/install-minecraft-splitscreen.sh -o /tmp/install.sh
385+
chmod +x /tmp/install.sh
386+
INSTALLER_SOURCE_URL=https://raw.githubusercontent.com/aradanmn/MinecraftSplitscreenSteamdeck/main/install-minecraft-splitscreen.sh /tmp/install.sh
387+
```
388+
389+
**Status:** Affects remote SSH testing. Local execution works fine.
390+
307391
## TODO Items (from README)
308392

309393
1. Steam Deck controller handling without system-wide disable
@@ -329,15 +413,37 @@ The installer generates `minecraftSplitscreen.sh` at runtime with:
329413

330414
---
331415

332-
### Issue #2: Steam Deck Virtual Controller Detection (MEDIUM PRIORITY)
333-
**Problem:** When launching on Steam Deck without external controllers, the script detects the Steam virtual controller, filters it out, and then stops because no "real" controllers remain.
416+
### Issue #2: Steam Deck Controller Issues (MEDIUM PRIORITY)
417+
418+
**Problem A: No Controllers Detected**
419+
When launching on Steam Deck without external controllers, the script detects the Steam virtual controller, filters it out, and then stops because no "real" controllers remain.
420+
421+
**Problem B: Double Button Presses in Desktop Mode**
422+
When Steam is running in Desktop Mode, the Steam Deck's physical controls AND Steam's virtual controller BOTH send input to the game, causing every button press to register twice.
423+
424+
**Root Cause:** Steam Input creates virtual controller devices that mirror physical inputs. In Desktop Mode with Steam running:
425+
- Physical controller → `/dev/input/js0` → game
426+
- Steam virtual controller → `/dev/input/js1` → game (duplicate!)
334427

335-
**Current State:** The launcher script correctly filters Steam virtual controllers but doesn't handle the case where that's the ONLY controller available.
428+
**Current State:** The launcher script tries to filter Steam virtual controllers but:
429+
1. Doesn't handle when virtual controller is the ONLY option
430+
2. Doesn't prevent double-input when both physical AND virtual are active
336431

337-
**Solution:** Modify controller detection logic to:
338-
- If on Steam Deck AND only Steam virtual controller detected AND no external controllers → allow using Steam Deck as Player 1
339-
- Provide a fallback "keyboard only" mode or prompt user
340-
- Consider: Steam Deck's built-in controls should count as 1 player
432+
**Solution Approaches:**
433+
434+
*For Problem A (no controllers):*
435+
- If on Steam Deck AND only Steam virtual controller detected → allow using it as Player 1
436+
- Provide "keyboard only" fallback mode
437+
438+
*For Problem B (double presses):*
439+
1. **User-side fix:** Disable Steam Input per-game in Steam properties
440+
2. **Script-side detection:** Warn user when both physical and virtual detected
441+
3. **Script-side fix:** Before launching, advise user to either:
442+
- Launch from Game Mode (Steam handles this correctly there)
443+
- Disable Steam Input for Minecraft in Steam settings
444+
- Close Steam before launching (if not using Steam integration)
445+
446+
**Controllable Mod Note:** The Controllable mod has device selection settings. Users may be able to manually select only the physical controller there. Worth documenting.
341447

342448
**Files to modify:** `modules/launcher_script_generator.sh` (the generated script template)
343449

@@ -412,12 +518,78 @@ The installer generates `minecraftSplitscreen.sh` at runtime with:
412518

413519
---
414520

521+
### Issue #6: Detect Previous Installation (MEDIUM PRIORITY)
522+
**Problem:** When users run the installer multiple times, it starts fresh each time without recognizing existing installations. Users may want to update mods, change Minecraft version, or modify their setup without full reinstallation.
523+
524+
**Desired Behavior:**
525+
- Detect if splitscreen instances already exist (check for `latestUpdate-1` through `latestUpdate-4`)
526+
- Detect existing launcher script (`minecraftSplitscreen.sh`)
527+
- If previous installation found, prompt user with options:
528+
1. **Update** - Keep same Minecraft version, update mods to latest compatible
529+
2. **Change Version** - Select new Minecraft version, reinstall mods
530+
3. **Reconfigure** - Change mod selection (add/remove mods)
531+
4. **Fresh Install** - Delete existing and start over
532+
5. **Cancel** - Exit without changes
533+
534+
**Detection Method: Config File**
535+
Save installation config to: `~/.local/share/MinecraftSplitscreen/install-config.json`
536+
537+
```json
538+
{
539+
"version": "3.0.0",
540+
"installed_at": "2026-01-31T19:18:01Z",
541+
"updated_at": "2026-01-31T19:18:01Z",
542+
"minecraft_version": "1.21.4",
543+
"fabric_version": "0.16.10",
544+
"launcher": {
545+
"type": "pollymc",
546+
"install_type": "flatpak",
547+
"data_dir": "/home/deck/.var/app/org.fn2006.PollyMC/data/PollyMC"
548+
},
549+
"mods": {
550+
"selected": ["fabric-api", "controllable", "worldhost", "cloth-config"],
551+
"versions": {
552+
"fabric-api": "0.92.1",
553+
"controllable": "1.2.3"
554+
}
555+
},
556+
"instances": ["latestUpdate-1", "latestUpdate-2", "latestUpdate-3", "latestUpdate-4"],
557+
"options": {
558+
"steam_integration": true,
559+
"desktop_shortcut": true,
560+
"dynamic_mode_available": true
561+
}
562+
}
563+
```
564+
565+
**Benefits:**
566+
- Single file to check for previous installation
567+
- Contains all selections without parsing instance files
568+
- Easy to read/write with `jq`
569+
- Version field allows migration if format changes
570+
- `updated_at` tracks when last modified
571+
572+
**Files to modify:**
573+
- `modules/main_workflow.sh` - Add detection at start of `run_installation()`
574+
- `modules/utilities.sh` - Add `detect_existing_installation()` and `save_install_config()` functions
575+
- Potentially new module: `modules/update_management.sh` for update logic
576+
577+
**Considerations:**
578+
- Preserve user's Microsoft account if they added one
579+
- Preserve any custom JVM arguments
580+
- Handle partial installations gracefully (config exists but instances missing)
581+
- Log what was detected and what action was taken
582+
- Use `jq` for JSON parsing (already a dependency)
583+
584+
---
585+
415586
### Implementation Order
416587
1.**Issue #3 (Logging)** - DONE. All print_* functions auto-log.
417588
2.**Issue #1 (User Input)** - DONE. All modules refactored to use `prompt_user()` and `prompt_yes_no()`.
418589
3.**Issue #5 (Dynamic Splitscreen)** - DONE. Players can join/leave mid-session.
419-
4.**Issue #2 (Controller Detection)** - Improves Steam Deck UX
420-
5.**Issue #4 (Versioning)** - Can wait until Minecraft actually releases new format
590+
4.**Issue #6 (Previous Installation Detection)** - Improves repeat user experience
591+
5.**Issue #2 (Controller Detection)** - Improves Steam Deck UX
592+
6.**Issue #4 (Versioning)** - Can wait until Minecraft actually releases new format
421593

422594
## Useful Debugging
423595

0 commit comments

Comments
 (0)