Skip to content
Merged
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
2 changes: 1 addition & 1 deletion gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ lwjgl3 = "3.4.3"
angle = "2026-05-09"
libjglios = "0.10"
saferalloc = "0.0.11"
native-bootstrap = "0.1.4"
native-bootstrap = "0.1.5"

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The 0.1.5 upgrade currently breaks the desktop native-extraction test suite on Linux, macOS, and Windows: the new bootstrap resolves directories differently from the paths the loader and its tests expect (for example, custom becomes custom/.jme3/jme3, and fallback cache paths are missing). Could you reconcile the new bootstrap behavior with the loader contract and get these tests green before merging?

Suggested change
native-bootstrap = "0.1.5"
native-bootstrap = "0.1.4"

nifty = "1.4.3"
spotbugs = "4.9.8"
jmeAndroidNatives = "3.10.0-xt16kb-alloc"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@

import android.opengl.GLSurfaceView;
import android.view.MotionEvent;
import android.view.View;
import com.jme3.input.InputManager;
import com.jme3.input.JoyInput;
import com.jme3.input.Joystick;
Expand Down Expand Up @@ -238,10 +239,15 @@ public long getCapturedPointerMask() {

public boolean onTouch(MotionEvent event) {
VirtualJoystick joystick = virtualJoystick;
if (joystick == null || inputHandler.getView() == null) {
View view = inputHandler.getView();
if (joystick == null || view == null) {
return false;
}

// Touch positions are view pixels; joystick hitboxes are in GUI camera units.
int width = view.getWidth();
int height = view.getHeight();
boolean hasSurface = width > 0 && height > 0;
boolean consumed = false;
int action = event.getAction() & MotionEvent.ACTION_MASK;
int pointerIndex = (event.getAction() & MotionEvent.ACTION_POINTER_INDEX_MASK)
Expand All @@ -251,21 +257,20 @@ public boolean onTouch(MotionEvent event) {
switch (action) {
case MotionEvent.ACTION_POINTER_DOWN:
case MotionEvent.ACTION_DOWN:
consumed = joystick.onPointerDown(event.getPointerId(pointerIndex),
toJmeX(event.getX(pointerIndex)), toJmeY(event.getY(pointerIndex)), time);
consumed = hasSurface && joystick.onNormalizedPointerDown(event.getPointerId(pointerIndex),
event.getX(pointerIndex) / width, 1f - event.getY(pointerIndex) / height, time);
break;
case MotionEvent.ACTION_POINTER_UP:
case MotionEvent.ACTION_UP:
consumed = joystick.onPointerUp(event.getPointerId(pointerIndex),
toJmeX(event.getX(pointerIndex)), toJmeY(event.getY(pointerIndex)), time);
consumed = joystick.onPointerUp(event.getPointerId(pointerIndex), time);
break;
case MotionEvent.ACTION_CANCEL:
consumed = joystick.onPointerCancel(time);
break;
case MotionEvent.ACTION_MOVE:
for (int i = 0; i < event.getPointerCount(); i++) {
consumed = joystick.onPointerMove(event.getPointerId(i),
toJmeX(event.getX(i)), toJmeY(event.getY(i)), time) || consumed;
for (int i = 0; hasSurface && i < event.getPointerCount(); i++) {
consumed = joystick.onNormalizedPointerMove(event.getPointerId(i),
event.getX(i) / width, 1f - event.getY(i) / height, time) || consumed;
}
break;
default:
Expand Down Expand Up @@ -305,14 +310,6 @@ public void update() {

}

private float toJmeX(float x) {
return inputHandler.touchInput.getJmeX(x);
}

private float toJmeY(float y) {
return inputHandler.touchInput.invertY(inputHandler.touchInput.getJmeY(y));
}

protected void setPhysicalJoystickAvailable(boolean available) {
physicalJoystickAvailable = available;
updateVirtualJoystickAutoVisibility();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -280,12 +280,12 @@ public void glCompileShader(int shader) {

@Override
public void glCompressedTexImage2D(int target, int level, int internalformat, int width, int height, int border, ByteBuffer data) {
GLES20.glCompressedTexImage2D(target, level, internalformat, width, height, 0, getLimitBytes(data), data);
GLES20.glCompressedTexImage2D(target, level, internalformat, width, height, 0, getRemainingBytes(data), data);
}

@Override
public void glCompressedTexSubImage2D(int target, int level, int xoffset, int yoffset, int width, int height, int format, ByteBuffer data) {
GLES20.glCompressedTexSubImage2D(target, level, xoffset, yoffset, width, height, format, getLimitBytes(data), data);
GLES20.glCompressedTexSubImage2D(target, level, xoffset, yoffset, width, height, format, getRemainingBytes(data), data);
}

@Override
Expand Down Expand Up @@ -842,13 +842,13 @@ public void glReadBuffer(int mode) {
@Override
public void glCompressedTexImage3D(int target, int level, int internalFormat, int width, int height, int depth,
int border, ByteBuffer data) {
GLES30.glCompressedTexImage3D(target, level, internalFormat, width, height, depth, border, getLimitBytes(data), data);
GLES30.glCompressedTexImage3D(target, level, internalFormat, width, height, depth, border, getRemainingBytes(data), data);
}

@Override
public void glCompressedTexSubImage3D(int target, int level, int xoffset, int yoffset, int zoffset, int width,
int height, int depth, int format, ByteBuffer data) {
GLES30.glCompressedTexSubImage3D(target, level, xoffset, yoffset, zoffset, width, height, depth, format, getLimitBytes(data), data);
GLES30.glCompressedTexSubImage3D(target, level, xoffset, yoffset, zoffset, width, height, depth, format, getRemainingBytes(data), data);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -207,6 +207,22 @@ public boolean onPointerDown(int pointerId, float x, float y, long time) {
}
}

/**
* Processes a pointer-down event in normalized surface coordinates.
*
* @param pointerId the pointer identifier
* @param x the horizontal position, relative to the left edge
* @param y the vertical position, relative to the bottom edge
* @param time the input event time
* @return true if the pointer was captured by a virtual control
*/
public boolean onNormalizedPointerDown(int pointerId, float x, float y, long time) {
synchronized (inputLock) {
return visualWidth > 0 && visualHeight > 0
&& onPointerDown(pointerId, x * visualWidth, y * visualHeight, time);
}
}

/**
* Processes a pointer-move event.
*
Expand All @@ -225,12 +241,38 @@ public boolean onPointerMove(int pointerId, float x, float y, long time) {
}
}

/**
* Processes a pointer-move event in normalized surface coordinates.
*
* @param pointerId the pointer identifier
* @param x the horizontal position, relative to the left edge
* @param y the vertical position, relative to the bottom edge
* @param time the input event time
* @return true if the pointer is captured by a virtual control
*/
public boolean onNormalizedPointerMove(int pointerId, float x, float y, long time) {
synchronized (inputLock) {
return onPointerMove(pointerId, x * visualWidth, y * visualHeight, time);
}
}

/**
* Processes a pointer-up event.
*
* @return true if the pointer was captured by a virtual control
*/
public boolean onPointerUp(int pointerId, float x, float y, long time) {
return onPointerUp(pointerId, time);
}

/**
* Releases a captured pointer regardless of where it was released.
*
* @param pointerId the pointer identifier
* @param time the input event time
* @return true if the pointer was captured by a virtual control
*/
public boolean onPointerUp(int pointerId, long time) {
synchronized (inputLock) {
Capture capture = captures.remove(pointerId);
if (capture == null) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
import java.nio.file.Paths;
import java.nio.file.StandardCopyOption;
import java.nio.file.StandardOpenOption;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.HashMap;
import java.util.HashSet;
Expand Down Expand Up @@ -309,15 +309,9 @@ public static synchronized File getExtractionFolder() {

private static List<DirectoryCandidate> getExtractionCandidates() {
configureNativeProperties();
List<DirectoryCandidate> candidates = new ArrayList<>(
NativeDirectories.candidates("jme3", NativeLibraryLoader::getOperatingSystem));
File custom = getCustomExtractionFolder();
if (custom != null) {
Path customPath = custom.toPath();
candidates.removeIf(candidate -> candidate.root().equals(customPath.toAbsolutePath().normalize()));
candidates.add(0, new DirectoryCandidate(customPath, "jme3", getOperatingSystem()));
}
return candidates;
List<Path> preferred = custom == null ? Collections.emptyList() : Collections.singletonList(custom.toPath());
return NativeDirectories.candidates("jme3", preferred, NativeLibraryLoader::getOperatingSystem);
}

private static void configureNativeProperties() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@
import java.io.IOException;
import java.io.UncheckedIOException;
import java.net.URI;
import java.nio.file.DirectoryStream;
import java.nio.file.FileSystem;
import java.nio.file.FileSystems;
import java.nio.file.Files;
Expand All @@ -46,7 +45,9 @@
import java.nio.file.attribute.AclFileAttributeView;
import java.nio.file.attribute.PosixFilePermissions;
import java.util.Collections;
import java.util.Comparator;
import java.util.Locale;
import java.util.stream.Stream;
import com.jme3.nativebootstrap.common.OperatingSystem;
import com.jme3.nativebootstrap.directories.NativeDirectories;
import static org.junit.jupiter.api.Assertions.*;
Expand Down Expand Up @@ -83,10 +84,11 @@ void refusesSharedDirectoryWithoutStickyBit() throws Exception {
() -> createDirectory(shared));
assertTrue(failure.getCause().getMessage().contains(shared.toRealPath().toString()));
} finally {
try (DirectoryStream<Path> children = Files.newDirectoryStream(shared)) {
for (Path child : children) Files.deleteIfExists(child);
try (Stream<Path> paths = Files.walk(shared)) {
for (Path path : paths.sorted(Comparator.reverseOrder()).toList()) {
Files.deleteIfExists(path);
}
}
Files.deleteIfExists(shared);
}
}

Expand Down
Loading
Loading