Skip to content

Commit e8be925

Browse files
committed
e
1 parent 0bf5cb5 commit e8be925

12 files changed

+2270
-93
lines changed

docs/New_GitHub_Release_System.md

Lines changed: 221 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,221 @@
1+
# New GitHub Release Update System
2+
3+
## Overview
4+
The Mixtape Engine now features a comprehensive GitHub-based update system that replaces the old version-checking system. This new system provides users with full control over which releases to install and gives developers powerful tools for creating and managing releases directly from the engine.
5+
6+
## Features
7+
8+
### For Users
9+
10+
#### Release Selection (F6 or Ctrl+U)
11+
- **Access**: Available from Main Menu with `F6` or `Ctrl+U`
12+
- **Functionality**:
13+
- Displays all available GitHub releases in a scrollable list
14+
- Shows release information including version, date, changelog, and file sizes
15+
- Allows selection of any release to install (not just the latest)
16+
- Automatically detects platform-compatible files
17+
- Provides detailed release notes and asset information
18+
19+
#### Automatic Update Checking
20+
- When the engine detects a newer version is available, it now redirects to the Release Selection screen instead of forcing an immediate update
21+
- Users can choose to update or continue with their current version
22+
- No more forced updates - complete user control
23+
24+
### For Developers (Live Reload Mode Only)
25+
26+
#### Developer Release Tool (F5 in Live Reload)
27+
- **Access**: Only available when engine is launched with `-livereload` flag
28+
- **Authentication**: Secure GitHub token storage with XOR encryption
29+
- **Features**:
30+
- GitHub authentication with personal access tokens
31+
- Repository access verification
32+
- User information display
33+
- Release creation capability
34+
- Asset packaging and upload tools
35+
36+
## Usage Guide
37+
38+
### Installing Updates (Users)
39+
40+
1. **Automatic Prompt**: When a new version is detected, you'll be taken to the Release Selection screen
41+
2. **Manual Access**: Press `F6` or `Ctrl+U` from the Main Menu
42+
3. **Browse Releases**: Use UP/DOWN arrows to navigate through available releases
43+
4. **View Details**: Each release shows:
44+
- Version number and stability (Stable/Pre-release)
45+
- Release date
46+
- Changelog/description
47+
- Available download files and sizes
48+
5. **Install**: Press ENTER to install the selected release
49+
6. **Cancel**: Press ESCAPE to return to the main menu
50+
51+
### Creating Releases (Developers)
52+
53+
1. **Launch in Live Reload**: Start engine with `-livereload` flag
54+
2. **Access Dev Tools**: Press `F5` from Main Menu
55+
3. **Authenticate**:
56+
- Select "Authenticate with GitHub"
57+
- Enter your GitHub Personal Access Token
58+
- Token requires `repo` scope for full functionality
59+
4. **Create Release**:
60+
- Select "Create Release"
61+
- Fill in version, title, description
62+
- Mark as pre-release if needed
63+
5. **Upload Assets**:
64+
- Select "Package and Upload"
65+
- Engine will create zip file excluding mods folder
66+
- Upload directly to the created release
67+
68+
## Technical Details
69+
70+
### File Structure
71+
```
72+
source/backend/GitHubAPI.hx - GitHub API integration
73+
source/states/ReleaseSelectionState.hx - Release selection UI
74+
source/states/DevReleaseToolState.hx - Developer tools
75+
source/substates/TokenInputSubstate.hx - Token input interface
76+
source/states/UpdateState.hx - Modified update downloader
77+
```
78+
79+
### GitHub API Integration
80+
- **Authentication**: Personal Access Tokens with secure local storage
81+
- **Release Management**: Full CRUD operations for releases
82+
- **Asset Handling**: Upload and download of release assets
83+
- **Repository Access**: Verification of push permissions
84+
- **Error Handling**: Comprehensive error handling and user feedback
85+
86+
### Security Features
87+
- Token encryption using XOR cipher for basic protection
88+
- No tokens stored in plain text
89+
- Token validation before storage
90+
- Repository permission verification
91+
- Secure cleanup on authentication clear
92+
93+
### Platform Support
94+
- Automatic platform detection (Windows, macOS, Linux, Android)
95+
- Platform-specific asset filtering
96+
- Cross-platform compatible packaging
97+
- Universal download support
98+
99+
## API Reference
100+
101+
### GitHubAPI Class Methods
102+
103+
#### Public Release Access
104+
- `getPublicReleases(callback, errorCallback)` - Fetch all public releases
105+
- `getPlatformAssets(release)` - Filter assets for current platform
106+
- `formatFileSize(bytes)` - Human-readable file size formatting
107+
- `formatDate(dateString)` - User-friendly date formatting
108+
109+
#### Authentication
110+
- `setAuthToken(token)` - Set and save authentication token
111+
- `loadAuthToken()` - Load saved token from disk
112+
- `clearAuth()` - Clear authentication and delete saved token
113+
- `validateToken(token, callback)` - Verify token validity
114+
- `isAuthenticated()` - Check current authentication status
115+
116+
#### Authenticated Operations
117+
- `getUserInfo(callback, errorCallback)` - Get authenticated user information
118+
- `hasRepoAccess(callback, errorCallback)` - Verify repository permissions
119+
- `createRelease(releaseData, callback, errorCallback)` - Create new release
120+
- `uploadReleaseAsset(releaseId, filePath, fileName, contentType, progressCallback, callback, errorCallback)` - Upload files to release
121+
122+
## Configuration
123+
124+
### Client Preferences
125+
- `ClientPrefs.data.checkForUpdates` - Enable/disable automatic update checking
126+
- Engine respects existing update preferences
127+
128+
### Build Flags
129+
No additional build flags required - works with existing engine configuration.
130+
131+
## Migration from Old System
132+
133+
### What Changed
134+
- `OutdatedState` replaced with `ReleaseSelectionState`
135+
- Version-based updates replaced with user-selected releases
136+
- Added developer tools for release management
137+
- Enhanced update UI with detailed release information
138+
139+
### Backwards Compatibility
140+
- Existing update preferences are respected
141+
- Version checking still works but redirects to new system
142+
- No breaking changes to existing workflows
143+
144+
## Troubleshooting
145+
146+
### Common Issues
147+
148+
#### "Not Authenticated" Error
149+
- Ensure you have a valid GitHub Personal Access Token
150+
- Verify token has `repo` scope
151+
- Check internet connection
152+
153+
#### "No Repository Access" Warning
154+
- Token user must have push access to the repository
155+
- Contact repository maintainer for access
156+
- Verify token permissions
157+
158+
#### "No Compatible Files" Error
159+
- Release may not have files for your platform
160+
- Check release assets manually on GitHub
161+
- Contact developer for platform-specific builds
162+
163+
#### Download Failures
164+
- Check internet connection
165+
- Verify GitHub API rate limits
166+
- Try again after a few minutes
167+
168+
### Debug Information
169+
- Enable debug logging in engine
170+
- Check console output for detailed error messages
171+
- Review GitHub API responses in network tools
172+
173+
## Best Practices
174+
175+
### For Users
176+
- Always backup your mods before updating
177+
- Read release notes before installing
178+
- Use stable releases for important projects
179+
- Test pre-releases in separate environments
180+
181+
### For Developers
182+
- Always test releases before publishing
183+
- Include comprehensive changelogs
184+
- Tag versions consistently
185+
- Exclude unnecessary files from releases
186+
- Test on multiple platforms before release
187+
188+
## Security Considerations
189+
190+
### Token Management
191+
- Keep Personal Access Tokens secure
192+
- Use tokens with minimal required permissions
193+
- Rotate tokens regularly
194+
- Never share tokens publicly
195+
196+
### Release Verification
197+
- Verify release authenticity
198+
- Check checksums when available
199+
- Only download from official repository
200+
- Be cautious with pre-release versions
201+
202+
## Future Enhancements
203+
204+
### Planned Features
205+
- Automatic checksumming for release verification
206+
- Incremental updates for smaller downloads
207+
- Release signing and verification
208+
- Advanced filtering and search options
209+
- Release scheduling and automation
210+
- Multi-repository support
211+
- Rollback functionality
212+
- Update history and changelogs
213+
214+
### Developer Tools Expansion
215+
- Automated building and packaging
216+
- CI/CD integration
217+
- Release template system
218+
- Bulk asset management
219+
- Release analytics and statistics
220+
221+
This new system provides a much more flexible and powerful update mechanism while maintaining ease of use for end users and providing powerful tools for developers.

docs/PERFORMANCE_OPTIMIZATION_GUIDE.md

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ private function keyPressed(key:Int, player:Int = -1)
5151
if (endingSong) continue;
5252
5353
var note:Note = null;
54-
54+
5555
// Optimize script callback - only call if scripts exist and return early if stopped
5656
if (luaArray.length > 0 || hscriptArray.length > 0) {
5757
var ret:Dynamic = callOnScripts("onFieldInput", [field, key, hitNotes]);
@@ -94,7 +94,7 @@ private function keyPressed(key:Int, player:Int = -1)
9494
9595
// Restore conductor position ONCE
9696
Conductor.songPosition = lastTime;
97-
97+
9898
// Final script callback - only if scripts exist
9999
if (luaArray.length > 0 || hscriptArray.length > 0) {
100100
callOnScripts('onKeyPress', [key]);
@@ -117,17 +117,17 @@ private function keysCheck():Void
117117
var holdArray = _cachedHoldArray;
118118
var pressArray = _cachedPressArray;
119119
var releaseArray = _cachedReleaseArray;
120-
120+
121121
// Clear and resize arrays efficiently
122122
holdArray.splice(0, holdArray.length);
123123
pressArray.splice(0, pressArray.length);
124124
releaseArray.splice(0, releaseArray.length);
125-
125+
126126
var keyArrayLength = keysArray[mania].length;
127127
holdArray.resize(keyArrayLength);
128128
pressArray.resize(keyArrayLength);
129129
releaseArray.resize(keyArrayLength);
130-
130+
131131
// Use direct indexing instead of push
132132
for (i in 0...keyArrayLength) {
133133
var key = keysArray[mania][i];
@@ -154,7 +154,7 @@ private function keysCheck():Void
154154
break;
155155
}
156156
}
157-
157+
158158
if (!hasHoldInput && !endingSong) {
159159
playerDance();
160160
}
@@ -177,7 +177,7 @@ private function keysCheck():Void
177177
// Existing alternative input system code...
178178
var parsedHoldArray:Array<Bool> = parseKeys();
179179
pressedGameplayKeys = parsedHoldArray;
180-
180+
181181
if (startedCountdown && !boyfriend.stunned && generatedMusic) {
182182
notes.forEachAlive(function(daNote:Note) {
183183
if (parsedHoldArray.contains(true) && !endingSong) {
@@ -276,7 +276,7 @@ override function destroy() {
276276
legacyLuaArray = [];
277277
legacyLuaArray = null;
278278
}
279-
279+
280280
if (FunkinLua.customFunctions != null) {
281281
FunkinLua.customFunctions.clear();
282282
}
@@ -335,7 +335,7 @@ override function destroy() {
335335
}
336336
337337
// Reset audio properties
338-
#if FLX_PITCH
338+
#if FLX_PITCH
339339
if (FlxG.sound.music != null) {
340340
FlxG.sound.music.pitch = 1;
341341
}
@@ -372,15 +372,15 @@ override function destroy() {
372372
moveStrumSections = null;
373373
variables = null;
374374
keysArray = null;
375-
375+
376376
// Reset state variables
377377
mania = 3;
378378
instance = null;
379379
endingSong = true;
380380
381381
// Call parent destroy LAST
382382
super.destroy();
383-
383+
384384
// Force garbage collection hint
385385
#if cpp
386386
cpp.vm.Gc.run(true);
@@ -456,7 +456,7 @@ public function callOnScripts(funcName:String, args:Array<Dynamic> = null):Dynam
456456
if (!hasLuaScripts && !hasHScripts) {
457457
return LuaUtils.Function_Continue; // Early exit if no scripts
458458
}
459-
459+
460460
// Rest of callOnScripts implementation...
461461
}
462462
```
@@ -484,13 +484,13 @@ private function updateMemoryMonitor(elapsed:Float):Void {
484484
lastMemoryCheck += elapsed;
485485
if (lastMemoryCheck >= 1.0) { // Check every second
486486
lastMemoryCheck = 0;
487-
487+
488488
#if cpp
489489
var memUsage = cpp.vm.Gc.memInfo64(cpp.vm.Gc.MEM_INFO_USAGE);
490490
var memReserved = cpp.vm.Gc.memInfo64(cpp.vm.Gc.MEM_INFO_RESERVED);
491-
491+
492492
memoryMonitor.text = 'Memory: ${Math.round(memUsage / 1024 / 1024)}MB / ${Math.round(memReserved / 1024 / 1024)}MB';
493-
493+
494494
// Warning if memory usage is high
495495
if (memUsage > 500 * 1024 * 1024) { // 500MB warning
496496
memoryMonitor.color = FlxColor.RED;
@@ -521,4 +521,4 @@ After implementing these changes:
521521
4. Verify script callbacks still work correctly
522522
5. Test both pooled and non-pooled note systems
523523

524-
These optimizations should significantly reduce input lag and prevent memory accumulation during extended play sessions.
524+
These optimizations should significantly reduce input lag and prevent memory accumulation during extended play sessions.

0 commit comments

Comments
 (0)