Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
260 changes: 260 additions & 0 deletions CHANGES_SUMMARY.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,260 @@
# Changes Summary for PRs

## Repository 1: love.js

**Repository:** https://github.com/Davidobot/love.js
**Branch to create:** `feat/emscripten-2.0.34-mobile-keyboard`

### Modified Files:
```
M build_lovejs.sh # Added CMake policy flag for Emscripten 2.0.34
M README.md # Updated build instructions (Emscripten 2.0.34, IDBFS patches)
M src/compat/index.html # Added mobile keyboard support
M src/compat/love.js # Applied IDBFS patches
M src/compat/love.wasm # Rebuilt with Emscripten 2.0.34
M src/game.js # Fixed deprecated Module.getMemory() API
M src/release/index.html # Added mobile keyboard support
M src/release/love.js # Applied IDBFS patches
M src/release/love.wasm # Rebuilt with Emscripten 2.0.34
M src/release/love.worker.js # Rebuilt with Emscripten 2.0.34
```

### New Files:
```
A patch_idbfs.sh # Automated IDBFS patching script
A PR_SUMMARY.md # Detailed PR description
A PR_CHECKLIST.md # PR submission checklist
A CHANGES_SUMMARY.md # This file
```

### Cleanup Files (don't commit):
```
?? build-full.log # Build log (gitignore)
```

### Key Changes:

**1. Emscripten 2.0.34 Support:**
- Line 28 in `build_lovejs.sh`: Added `-DCMAKE_POLICY_VERSION_MINIMUM=3.5`
- Line 230 in `src/game.js`: Changed `Module['getMemory']` to `Module['_malloc']`
- Rebuilt all binaries with Emscripten 2.0.34

**2. Mobile Keyboard Support:**
- Added mobile keyboard functions in both index.html templates:
- `createMobileTextInput()` - Creates invisible input element
- `window.SDL_StartTextInput()` - Called by WASM, adds touch listener
- `window.SDL_StopTextInput()` - Removes touch listener
- Touch listener focuses input synchronously during touch event (satisfies browser security)

**3. IDBFS Patches:**
- Created `patch_idbfs.sh` to automate 6 safety patches
- Patches fix undefined buffer access bugs in Emscripten 2.0.34 generated code
- Applied to both `src/compat/love.js` and `src/release/love.js`

**4. Documentation:**
- Updated README.md lines 133-159 with:
- Emscripten 2.0.34 installation instructions
- IDBFS patching requirement
- ARM64 Mac compatibility notes
- Canvas resizing limitations

---

## Repository 2: megasource (emscripten branch)

**Repository:** https://github.com/Davidobot/megasource/tree/emscripten
**Branch to create:** `feat/cmake-3.10-emscripten-2.0.34`

### Modified Files:
```
M CMakeLists.txt # cmake_minimum_required(VERSION 3.10)
M libs/freetype-2.8.1/CMakeLists.txt # cmake_minimum_required(VERSION 3.10)
M libs/libmodplug-0.8.8.4/CMakeLists.txt # cmake_minimum_required(VERSION 3.10)
M libs/libogg-1.3.2/CMakeLists.txt # cmake_minimum_required(VERSION 3.10)
M libs/libtheora-1.1.1/CMakeLists.txt # cmake_minimum_required(VERSION 3.10)
M libs/libvorbis-1.3.5/CMakeLists.txt # cmake_minimum_required(VERSION 3.10)
M libs/lua-5.1.5/CMakeLists.txt # cmake_minimum_required(VERSION 3.10)
M libs/mpg123-1.25.6/CMakeLists.txt # cmake_minimum_required(VERSION 3.10)
M libs/zlib-1.2.12/CMakeLists.txt # cmake_minimum_required(VERSION 3.10)
```

### Cleanup Files (don't commit):
```
?? *.bak # Backup files from sed (gitignore)
```

### Key Change:
All `cmake_minimum_required(VERSION 3.5)` changed to `VERSION 3.10` to support Emscripten 2.0.34

---

## Repository 3: love (emscripten branch)

**Repository:** https://github.com/Davidobot/love/tree/emscripten
**Branch to create:** `feat/mobile-keyboard-support`

### Modified Files:
```
M CMakeLists.txt # cmake_minimum_required(VERSION 3.10)
M src/modules/keyboard/sdl/Keyboard.cpp # Added Emscripten mobile keyboard hooks
```

### Key Changes:

**1. CMake Update:**
- `cmake_minimum_required(VERSION 3.5)` → `VERSION 3.10`

**2. Mobile Keyboard Hooks in Keyboard.cpp:**
```cpp
void Keyboard::setTextInput(bool enable)
{
if (enable)
{
SDL_StartTextInput();
#ifdef __EMSCRIPTEN__
EM_ASM({
if (typeof window.SDL_StartTextInput === 'function') {
window.SDL_StartTextInput();
}
});
#endif
}
else
{
SDL_StopTextInput();
#ifdef __EMSCRIPTEN__
EM_ASM({
if (typeof window.SDL_StopTextInput === 'function') {
window.SDL_StopTextInput();
}
});
#endif
}
}
```

---

## Testing Evidence

**Mobile Keyboard Working:**
- ✅ Keyboard appears when tapping input field on iOS Safari
- ✅ Keyboard appears when tapping input field on Android Chrome
- ✅ Touch listener only active when text input enabled
- ✅ Touch listener removed when text input disabled
- ✅ Typed characters forwarded to game as KeyboardEvents

**Emscripten 2.0.34 Build:**
- ✅ Builds successfully on ARM64 Mac
- ✅ Game runs without errors
- ✅ File size optimized (370KB game.data)
- ✅ IDBFS patches prevent undefined buffer errors

**Backward Compatibility:**
- ✅ Desktop browsers unaffected
- ✅ Existing games work without modification
- ✅ `love.keyboard.setTextInput()` API unchanged

---

## PR Submission Order

**Recommended order:**

1. **First:** megasource (emscripten branch)
- Simple CMake version bump
- No functional changes
- Easy to review and merge

2. **Second:** love (emscripten branch)
- Mobile keyboard C++ hooks
- Depends on megasource CMake changes
- Small, focused change

3. **Third:** love.js (main repo)
- Largest change set
- Depends on megasource and love changes
- JavaScript implementation of mobile keyboard
- Emscripten 2.0.34 upgrade
- IDBFS patches

---

## Important Notes for PR Submission

1. **Clean up .bak files** before committing:
```bash
find . -name "*.bak" -delete
```

2. **Binary files** (.wasm, .js) are large:
- May need Git LFS
- Or ask maintainer if CI should rebuild them

3. **IDBFS patches** modify generated code:
- Consider upstreaming fixes to Emscripten
- Or document as necessary workaround

4. **Test before submitting:**
- Build from clean state
- Test on actual mobile devices
- Verify all platforms still work

5. **Reference issues:**
- Look for existing issues about mobile keyboard
- Look for existing issues about ARM64 Mac builds
- Reference them in PR description

---

## Quick Start for PR Creation

### For love.js:
```bash
cd /Users/jmitch/GitHub/love.js
git checkout -b feat/emscripten-2.0.34-mobile-keyboard
git add src/ build_lovejs.sh README.md patch_idbfs.sh PR_SUMMARY.md
git commit -m "feat: Add Emscripten 2.0.34+ support and mobile keyboard

- Upgrade to Emscripten 2.0.34 for ARM64 Mac compatibility
- Add mobile keyboard support for iOS/Android browsers
- Fix deprecated Module.getMemory() API
- Add IDBFS safety patches via automated script
- Update build process for CMake 3.10+ requirement

BREAKING: Requires Emscripten 2.0.34+ for building from source
Older systems can still use Emscripten 2.0.0"
```

### For megasource:
```bash
cd /Users/jmitch/GitHub/megasource
find . -name "*.bak" -delete # Clean up backup files
git checkout -b feat/cmake-3.10-emscripten-2.0.34
git add CMakeLists.txt libs/*/CMakeLists.txt
git commit -m "chore: Update CMake minimum version to 3.10

Required for Emscripten 2.0.34+ compatibility.
Emscripten 2.0.34 requires CMake >= 3.10.

This enables ARM64 Mac builds."
```

### For love:
```bash
cd /Users/jmitch/GitHub/megasource/libs/love
rm CMakeLists.txt.bak # Clean up backup file
git checkout -b feat/mobile-keyboard-support
git add CMakeLists.txt src/modules/keyboard/sdl/Keyboard.cpp
git commit -m "feat: Add mobile keyboard support for Emscripten builds

Add JavaScript hooks when text input is enabled/disabled.
This allows love.keyboard.setTextInput(true) to trigger
mobile keyboards on iOS/Android browsers.

JavaScript implementation in love.js handles the browser
security requirement for synchronous focus during touch events.

Usage: Call love.keyboard.setTextInput(true) in your game
and the mobile keyboard will appear when user taps the canvas."
```
Loading