1
0
Fork 0
mirror of https://github.com/ninjamuffin99/Funkin.git synced 2025-01-14 16:47:46 +00:00

Bugfix/chart editor fixins (#222)

* Rewrite crash log file to contain more information

* Detect host platform.

* Suppress shouldHandleCursor spam

* Fix bug where previous song's vocals are kept on new songs

* Fix an issue where note snapping could go negative.

---------

Co-authored-by: Cameron Taylor <cameron.taylor.ninja@gmail.com>
This commit is contained in:
Eric 2023-11-20 11:26:58 -05:00 committed by GitHub
parent 55779630f4
commit a1da5a5758
4 changed files with 80 additions and 10 deletions

View file

@ -1982,14 +1982,14 @@ class ChartEditorState extends HaxeUIState
addUIClickListener('playbarEnd', _ -> playbarButtonPressed = 'playbarEnd');
// Cycle note snap quant.
addUIClickListener('playbarNoteSnap', function(_) {
noteSnapQuantIndex++;
if (noteSnapQuantIndex >= SNAP_QUANTS.length) noteSnapQuantIndex = 0;
});
addUIRightClickListener('playbarNoteSnap', function(_) {
noteSnapQuantIndex--;
if (noteSnapQuantIndex < 0) noteSnapQuantIndex = SNAP_QUANTS.length - 1;
});
addUIClickListener('playbarNoteSnap', function(_) {
noteSnapQuantIndex++;
if (noteSnapQuantIndex >= SNAP_QUANTS.length) noteSnapQuantIndex = 0;
});
// Add functionality to the menu items.
@ -2079,8 +2079,14 @@ class ChartEditorState extends HaxeUIState
addUIClickListener('menubarItemPlaytestFull', _ -> testSongInPlayState(false));
addUIClickListener('menubarItemPlaytestMinimal', _ -> testSongInPlayState(true));
addUIClickListener('menuBarItemNoteSnapDecrease', _ -> noteSnapQuantIndex--);
addUIClickListener('menuBarItemNoteSnapIncrease', _ -> noteSnapQuantIndex++);
addUIClickListener('menuBarItemNoteSnapDecrease', _ -> {
noteSnapQuantIndex--;
if (noteSnapQuantIndex < 0) noteSnapQuantIndex = SNAP_QUANTS.length - 1;
});
addUIClickListener('menuBarItemNoteSnapIncrease', _ -> {
noteSnapQuantIndex++;
if (noteSnapQuantIndex >= SNAP_QUANTS.length) noteSnapQuantIndex = 0;
});
addUIChangeListener('menuBarItemInputStyleNone', function(event:UIEvent) {
currentLiveInputStyle = None;
@ -2898,11 +2904,13 @@ class ChartEditorState extends HaxeUIState
if (FlxG.keys.justPressed.LEFT && !FlxG.keys.pressed.CONTROL)
{
noteSnapQuantIndex--;
if (noteSnapQuantIndex < 0) noteSnapQuantIndex = SNAP_QUANTS.length - 1;
}
if (FlxG.keys.justPressed.RIGHT && !FlxG.keys.pressed.CONTROL)
{
noteSnapQuantIndex++;
if (noteSnapQuantIndex >= SNAP_QUANTS.length) noteSnapQuantIndex = 0;
}
}
}
@ -2922,7 +2930,7 @@ class ChartEditorState extends HaxeUIState
|| (dragTargetNote != null || dragTargetEvent != null);
var eventColumn:Int = (STRUMLINE_SIZE * 2 + 1) - 1;
trace('shouldHandleCursor: $shouldHandleCursor');
// trace('shouldHandleCursor: $shouldHandleCursor');
if (shouldHandleCursor)
{
@ -3811,7 +3819,7 @@ class ChartEditorState extends HaxeUIState
&& playbarSongRemaining.value != songRemainingString) playbarSongRemaining.value = songRemainingString;
if (playbarNoteSnap == null) playbarNoteSnap = findComponent('playbarNoteSnap', Label);
if (playbarNoteSnap != null && playbarNoteSnap.value != '1/${noteSnapQuant}') playbarNoteSnap.value = '1/${noteSnapQuant}';
if (playbarNoteSnap != null) playbarNoteSnap.text = '1/${noteSnapQuant}';
}
function handlePlayhead():Void

View file

@ -875,7 +875,7 @@ class ChartEditorDialogHandler
if (dialogNoVocals == null) throw 'Could not locate dialogNoVocals button in Upload Vocals dialog';
dialogNoVocals.onClick = function(_event) {
// Dismiss
state.stopExistingVocals();
state.wipeVocalData();
dialog.hideDialog(DialogButton.APPLY);
};

View file

@ -23,4 +23,39 @@ class PlatformUtil
return false;
#end
}
/**
* Detects and returns the current host platform.
* Always returns `HTML5` on web, regardless of the computer running that browser.
* Returns `null` if the platform could not be detected.
*/
public static function detectHostPlatform():Null<HostPlatform>
{
#if html5
return HTML5;
#else
switch (Sys.systemName())
{
case ~/window/i.match(_) => true:
return WINDOWS;
case ~/linux/i.match(_) => true:
return LINUX;
case ~/mac/i.match(_) => true:
return MAC;
default:
return null;
}
#end
}
}
/**
* Represents a host platform.
*/
enum HostPlatform
{
WINDOWS;
LINUX;
MAC;
HTML5;
}

View file

@ -84,7 +84,34 @@ class CrashHandler
{
FileUtil.createDirIfNotExists(LOG_FOLDER);
sys.io.File.saveContent('$LOG_FOLDER/crash${critical ? '-critical' : ''}-${DateUtil.generateTimestamp()}.log', message);
sys.io.File.saveContent('$LOG_FOLDER/crash${critical ? '-critical' : ''}-${DateUtil.generateTimestamp()}.log', buildCrashReport(message));
}
static function buildCrashReport(message:String):String
{
var fullContents:String = '=====================\n';
fullContents += ' Funkin Crash Report\n';
fullContents += '=====================\n';
fullContents += '\n';
fullContents += 'Generated by: ${Constants.GENERATED_BY}\n';
fullContents += 'System timestamp: ${DateUtil.generateTimestamp()}\n';
var driverInfo = FlxG?.stage?.context3D?.driverInfo ?? 'N/A';
fullContents += 'Driver info: ${driverInfo}\n';
fullContents += 'Platform: ${Sys.systemName()}\n';
fullContents += '\n';
fullContents += '=====================\n';
fullContents += '\n';
fullContents += message;
fullContents += '\n';
return fullContents;
}
#end