Compare commits

..
Author SHA1 Message Date
Mathias-Boulay 70047f32e1 fix(glsurface): avoid negative size 2025-01-25 20:37:37 +01:00
2 changed files with 10 additions and 11 deletions

No files matched your search

@@ -239,7 +239,7 @@ public class MinecraftGLSurface extends View implements GrabListener {
CallbackBridge.sendCursorPos(CallbackBridge.mouseX, CallbackBridge.mouseY);
return true;
case MotionEvent.ACTION_SCROLL:
CallbackBridge.sendScroll((double) event.getAxisValue(MotionEvent.AXIS_HSCROLL), (double) event.getAxisValue(MotionEvent.AXIS_VSCROLL));
CallbackBridge.sendScroll(event.getAxisValue(MotionEvent.AXIS_HSCROLL), event.getAxisValue(MotionEvent.AXIS_VSCROLL));
return true;
case MotionEvent.ACTION_BUTTON_PRESS:
return sendMouseButtonUnconverted(event.getActionButton(),true);
@@ -338,8 +338,14 @@ public class MinecraftGLSurface extends View implements GrabListener {
// Use the width and height of the View instead of display dimensions to avoid
// getting squiched/stretched due to inconsistencies between the layout and
// screen dimensions.
windowWidth = Tools.getDisplayFriendlyRes(getWidth(), LauncherPreferences.PREF_SCALE_FACTOR);
windowHeight = Tools.getDisplayFriendlyRes(getHeight(), LauncherPreferences.PREF_SCALE_FACTOR);
int newWidth = Tools.getDisplayFriendlyRes(getWidth(), LauncherPreferences.PREF_SCALE_FACTOR);
int newHeight = Tools.getDisplayFriendlyRes(getHeight(), LauncherPreferences.PREF_SCALE_FACTOR);
if (newHeight < 1 || newWidth < 1) {
Log.e("MGLSurface", String.format("Impossible resolution : %dx%d", newWidth, newHeight));
return;
}
windowWidth = newWidth;
windowHeight = newHeight;
if(mSurface == null){
Log.w("MGLSurface", "Attempt to refresh size on null surface");
return;
@@ -21,14 +21,7 @@ public class ModpackInstaller {
public static ModLoader installModpack(ModDetail modDetail, int selectedVersion, InstallFunction installFunction) throws IOException {
String versionUrl = modDetail.versionUrls[selectedVersion];
String versionHash = modDetail.versionHashes[selectedVersion];
String modpackName = (modDetail.title.toLowerCase(Locale.ROOT) + " " + modDetail.versionNames[selectedVersion])
.trim().replaceAll("[\\\\/:*?\"<>| \\t\\n]", "_" );
if (versionHash != null) {
modpackName += "_" + versionHash;
}
if (modpackName.length() > 255){
modpackName = modpackName.substring(0,255);
}
String modpackName = modDetail.title.toLowerCase(Locale.ROOT).trim().replace(" ", "_" );
// Build a new minecraft instance, folder first