Changes
- Replace MGLKView with UIView + MGLLayer. Attempt to fix crash at "[MGLKView initWithFrame]". Known issue: hotbar offset is a bit wrong when scale ≠ 100% - Cleanup some unused files.
This commit is contained in:
1 parent
9f6e39a98d
commit
f571e96662
34 files changed
+52
-466
No files matched your search
@@ -1,49 +0,0 @@
|
||||
package com.oracle.dalvik;
|
||||
|
||||
import android.util.*;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
public final class VMLauncher {
|
||||
private VMLauncher() {
|
||||
}
|
||||
public static int launchJVM(boolean useJli, List<String> args) {
|
||||
System.out.print("Launch method: ");
|
||||
if (useJli) {
|
||||
System.out.println("JLI_Launch");
|
||||
return launchJVM(args.toArray(new String[0]));
|
||||
} else {
|
||||
System.out.println("JNI_JavaVM");
|
||||
args.remove(0);
|
||||
int cpPath = args.indexOf("-cp");
|
||||
// int jarPath = Arrays.asList(args).indexOf("-jar");
|
||||
if (cpPath != -1) {
|
||||
String classpath = args.remove(cpPath + 1);
|
||||
args.set(cpPath, "-Djava.class.path=" + classpath);
|
||||
|
||||
List<String> vmArgs = new ArrayList<>();
|
||||
List<String> mainArgs = new ArrayList<>();
|
||||
String mainClass = null;
|
||||
int mainClassIndex;
|
||||
for (String arg : args) {
|
||||
if (!arg.startsWith("-") && mainClass == null) {
|
||||
mainClass = arg;
|
||||
continue;
|
||||
}
|
||||
|
||||
if (mainClass == null) {
|
||||
vmArgs.add(arg);
|
||||
} else {
|
||||
mainArgs.add(arg);
|
||||
}
|
||||
}
|
||||
|
||||
return createLaunchMainJVM(vmArgs.toArray(new String[0]), mainClass, mainArgs.toArray(new String[0]));
|
||||
} else {
|
||||
throw new RuntimeException("Invalid or unsupported classpath type");
|
||||
}
|
||||
}
|
||||
}
|
||||
private static native int launchJVM(String[] args);
|
||||
private static native int createLaunchMainJVM(String[] vmArgs, String mainClass, String[] mainArgs);
|
||||
}
|
||||
@@ -1,4 +0,0 @@
|
||||
package jdpi.awt;
|
||||
|
||||
public class BorderLayout extends LayoutManager {
|
||||
}
|
||||
@@ -1,21 +0,0 @@
|
||||
package jdpi.awt;
|
||||
|
||||
import org.lwjgl.glfw.GLFW;
|
||||
|
||||
public class Canvas extends Component {
|
||||
|
||||
public void setPreferredSize(Dimension dim) {
|
||||
}
|
||||
|
||||
public Graphics getGraphics() {
|
||||
return null;
|
||||
}
|
||||
|
||||
public int getWidth() {
|
||||
return GLFW.mGLFWWindowWidth;
|
||||
}
|
||||
|
||||
public int getHeight() {
|
||||
return GLFW.mGLFWWindowHeight;
|
||||
}
|
||||
}
|
||||
@@ -1,27 +0,0 @@
|
||||
package jdpi.awt;
|
||||
|
||||
public class Color extends java.awt.Color {
|
||||
public Color(int r, int g, int b) {
|
||||
super(r, g, b);
|
||||
}
|
||||
|
||||
public Color(int r, int g, int b, int a) {
|
||||
super(r, g, b, a);
|
||||
}
|
||||
|
||||
public Color(int rgb) {
|
||||
super(rgb);
|
||||
}
|
||||
|
||||
public Color(int rgba, boolean hasalpha) {
|
||||
super(rgba, hasalpha);
|
||||
}
|
||||
|
||||
public Color(float r, float g, float b) {
|
||||
super(r, g, b);
|
||||
}
|
||||
|
||||
public Color(float r, float g, float b, float a) {
|
||||
super(r, g, b, a);
|
||||
}
|
||||
}
|
||||
@@ -1,18 +0,0 @@
|
||||
package jdpi.awt;
|
||||
|
||||
import org.lwjgl.glfw.GLFW;
|
||||
|
||||
public class Component {
|
||||
//setPreferredSize
|
||||
|
||||
public int getWidth() {
|
||||
return GLFW.mGLFWWindowWidth;
|
||||
}
|
||||
|
||||
public int getHeight() {
|
||||
return GLFW.mGLFWWindowHeight;
|
||||
}
|
||||
|
||||
public void setVisible(boolean visible) {
|
||||
}
|
||||
}
|
||||
@@ -1,9 +0,0 @@
|
||||
package jdpi.awt;
|
||||
|
||||
public class Container extends Component {
|
||||
public void add(Component component, Object something) {
|
||||
}
|
||||
|
||||
public void setLayout(LayoutManager mgr) {
|
||||
}
|
||||
}
|
||||
@@ -1,15 +0,0 @@
|
||||
package jdpi.awt;
|
||||
|
||||
public class Dimension extends java.awt.Dimension {
|
||||
public Dimension() {
|
||||
this(0, 0);
|
||||
}
|
||||
|
||||
public Dimension(Dimension d) {
|
||||
this(d.width, d.height);
|
||||
}
|
||||
|
||||
public Dimension(int width, int height) {
|
||||
super(width, height);
|
||||
}
|
||||
}
|
||||
@@ -1,7 +0,0 @@
|
||||
package jdpi.awt;
|
||||
|
||||
public class Frame extends Window {
|
||||
public Frame(String title) {
|
||||
super(title);
|
||||
}
|
||||
}
|
||||
@@ -1,32 +0,0 @@
|
||||
package jdpi.awt;
|
||||
|
||||
import jdpi.awt.image.*;
|
||||
|
||||
public class Graphics {
|
||||
protected java.awt.Graphics2D g2d;
|
||||
|
||||
public Graphics(java.awt.Graphics2D g2d) {
|
||||
this.g2d = g2d;
|
||||
}
|
||||
|
||||
public void setColor(Color color) {
|
||||
g2d.setColor(color);
|
||||
}
|
||||
|
||||
public void fillRect(int x, int y, int width, int height) {
|
||||
g2d.fillRect(x, y, width, height);
|
||||
}
|
||||
|
||||
public void drawString(String s, int x, int y) {
|
||||
g2d.drawString(s, x, y);
|
||||
}
|
||||
|
||||
public void dispose() {
|
||||
g2d.dispose();
|
||||
}
|
||||
|
||||
public boolean drawImage(Image image, int x, int y, ImageObserver observer) {
|
||||
if (!(image instanceof BufferedImage)) return true;
|
||||
return g2d.drawImage(((BufferedImage) image).getBaseImage(), x, y, ImageObserverWrapper.wrap(observer));
|
||||
}
|
||||
}
|
||||
@@ -1,7 +0,0 @@
|
||||
package jdpi.awt;
|
||||
|
||||
public class Graphics2D extends Graphics {
|
||||
public Graphics2D(java.awt.Graphics2D g2d) {
|
||||
super(g2d);
|
||||
}
|
||||
}
|
||||
@@ -1,6 +0,0 @@
|
||||
package jdpi.awt;
|
||||
public class GraphicsEnvironment {
|
||||
public static boolean isHeadless() {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -1,5 +0,0 @@
|
||||
package jdpi.awt;
|
||||
|
||||
public abstract class Image {
|
||||
|
||||
}
|
||||
@@ -1,4 +0,0 @@
|
||||
package jdpi.awt;
|
||||
|
||||
public class LayoutManager {
|
||||
}
|
||||
@@ -1,17 +0,0 @@
|
||||
package jdpi.awt;
|
||||
|
||||
import jdpi.awt.event.*;
|
||||
|
||||
public class Window extends Container {
|
||||
public Window(String title) {
|
||||
}
|
||||
|
||||
public void addWindowListener(WindowListener listener) {
|
||||
}
|
||||
|
||||
public void pack() {
|
||||
}
|
||||
|
||||
public void setLocationRelativeTo(Component comp) {
|
||||
}
|
||||
}
|
||||
@@ -1,4 +0,0 @@
|
||||
package jdpi.awt.event;
|
||||
|
||||
public class WindowAdapter implements WindowListener {
|
||||
}
|
||||
@@ -1,4 +0,0 @@
|
||||
package jdpi.awt.event;
|
||||
|
||||
public interface WindowListener {
|
||||
}
|
||||
@@ -1,47 +0,0 @@
|
||||
package jdpi.awt.image;
|
||||
|
||||
import jdpi.awt.*;
|
||||
import jdpi.awt.Image;
|
||||
|
||||
public class BufferedImage extends Image {
|
||||
private java.awt.image.BufferedImage mImg;
|
||||
public BufferedImage(int width, int height, int imageType) {
|
||||
this(new java.awt.image.BufferedImage(width, height, imageType));
|
||||
}
|
||||
|
||||
public BufferedImage(java.awt.image.BufferedImage img) {
|
||||
mImg = img;
|
||||
}
|
||||
|
||||
public Graphics getGraphics() {
|
||||
return new Graphics2D((java.awt.Graphics2D) mImg.getGraphics());
|
||||
}
|
||||
|
||||
public Graphics2D createGraphics() {
|
||||
return new Graphics2D(mImg.createGraphics());
|
||||
}
|
||||
|
||||
public int getWidth() {
|
||||
return mImg.getWidth();
|
||||
}
|
||||
|
||||
public int getHeight() {
|
||||
return mImg.getHeight();
|
||||
}
|
||||
|
||||
public int[] getRGB(int startX, int startY, int w, int h, int[] rgbArray, int offset, int scansize) {
|
||||
return mImg.getRGB(startX, startY, w, h, rgbArray, offset, scansize);
|
||||
}
|
||||
|
||||
public void setRGB(int startX, int startY, int w, int h, int[] rgbArray, int offset, int scansize) {
|
||||
mImg.setRGB(startX, startY, w, h, rgbArray, offset, scansize);
|
||||
}
|
||||
|
||||
public WritableRaster getRaster() {
|
||||
return new WritableRaster(this);
|
||||
}
|
||||
|
||||
public java.awt.image.BufferedImage getBaseImage() {
|
||||
return mImg;
|
||||
}
|
||||
}
|
||||
@@ -1,5 +0,0 @@
|
||||
package jdpi.awt.image;
|
||||
|
||||
public class DataBuffer {
|
||||
|
||||
}
|
||||
@@ -1,11 +0,0 @@
|
||||
package jdpi.awt.image;
|
||||
|
||||
public class DataBufferInt extends DataBuffer {
|
||||
private int[] array;
|
||||
public DataBufferInt(int[] array, int size) {
|
||||
this.array = array;
|
||||
}
|
||||
public int[] getData() {
|
||||
return array;
|
||||
}
|
||||
}
|
||||
@@ -1,7 +0,0 @@
|
||||
package jdpi.awt.image;
|
||||
|
||||
import jdpi.awt.Image;
|
||||
|
||||
public interface ImageObserver extends java.awt.image.ImageObserver {
|
||||
public boolean imageUpdate(Image img, int infoflags, int x, int y, int width, int height);
|
||||
}
|
||||
@@ -1,18 +0,0 @@
|
||||
package jdpi.awt.image;
|
||||
|
||||
import jdpi.awt.Image;
|
||||
|
||||
public class ImageObserverWrapper {
|
||||
public static java.awt.image.ImageObserver wrap(final ImageObserver observer) {
|
||||
return new java.awt.image.ImageObserver() {
|
||||
@Override
|
||||
public boolean imageUpdate(java.awt.Image img, int infoflags, int x, int y, int width, int height) {
|
||||
if (img instanceof java.awt.image.BufferedImage) {
|
||||
return observer.imageUpdate(new BufferedImage((java.awt.image.BufferedImage) img), infoflags, x, y, width, height);
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
@@ -1,4 +0,0 @@
|
||||
package jdpi.awt.image;
|
||||
|
||||
public interface RenderedImage {
|
||||
}
|
||||
@@ -1,13 +0,0 @@
|
||||
package jdpi.awt.image;
|
||||
|
||||
public class WritableRaster {
|
||||
private BufferedImage image;
|
||||
public WritableRaster(BufferedImage image) {
|
||||
this.image = image;
|
||||
}
|
||||
public DataBuffer getDataBuffer() {
|
||||
int[] theBuf = new int[image.getWidth() * image.getHeight()];
|
||||
image.getRGB(0, 0, image.getWidth(), image.getHeight(), theBuf, 0, image.getWidth());
|
||||
return new DataBufferInt(theBuf, theBuf.length);
|
||||
}
|
||||
}
|
||||
@@ -1,32 +0,0 @@
|
||||
package jdpi.imageio;
|
||||
|
||||
import java.io.*;
|
||||
import java.net.URL;
|
||||
|
||||
import jdpi.awt.*;
|
||||
import jdpi.awt.image.*;
|
||||
|
||||
public class ImageIO {
|
||||
public static void setUseCache(boolean set) {
|
||||
}
|
||||
|
||||
public static BufferedImage read(InputStream is) throws IOException {
|
||||
return new BufferedImage(javax.imageio.ImageIO.read(is));
|
||||
}
|
||||
|
||||
public static BufferedImage read(File input) throws IOException {
|
||||
return read(new FileInputStream(input));
|
||||
}
|
||||
|
||||
public static BufferedImage read(URL input) throws IOException {
|
||||
InputStream is = input.openStream();
|
||||
BufferedImage img = read(is);
|
||||
is.close();
|
||||
return img;
|
||||
}
|
||||
|
||||
public static boolean write(RenderedImage im, String formatName, File output) {
|
||||
System.out.println("ImageIO.write stub " + output);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -126,6 +126,8 @@ public class PLaunchApp {
|
||||
|
||||
for (final DependentLibrary libItem : mVersion.libraries) {
|
||||
if (
|
||||
// Support for text2speech is not planned, so skip it for now.
|
||||
libItem.name.startsWith("com.mojang.text2speech") ||
|
||||
libItem.name.startsWith("net.java.jinput") ||
|
||||
libItem.name.startsWith("org.lwjgl")
|
||||
) { // Black list
|
||||
@@ -159,9 +161,9 @@ public class PLaunchApp {
|
||||
}
|
||||
|
||||
currProgress++;
|
||||
UIKit.updateProgressSafe(currProgress / maxProgress, "Downloading " + mcver + ".jar");
|
||||
File minecraftMainFile = new File(minecraftMainJar);
|
||||
if (!minecraftMainFile.exists() || minecraftMainFile.length() == 0l) {
|
||||
UIKit.updateProgressSafe(currProgress / maxProgress, "Downloading " + mcver + ".jar");
|
||||
Tools.downloadFile(mVersion.downloads.values().toArray(new MinecraftClientInfo[0])[0].url, minecraftMainJar);
|
||||
}
|
||||
|
||||
@@ -194,11 +196,10 @@ public class PLaunchApp {
|
||||
File objectsDir = new File(outputDir, "objects");
|
||||
for (JAssetInfo asset : assetsObjects.values()) {
|
||||
executor.execute(() -> {
|
||||
mIsAssetsProcessing &= !UIKit.updateProgressSafe(currProgress / maxProgress, "Downloading " + assetsObjects.keySet().toArray(new String[0])[downloaded]);
|
||||
|
||||
try {
|
||||
if(!assets.map_to_resources) downloadAsset(asset, objectsDir);
|
||||
else downloadAssetMapped(asset,(assetsObjects.keySet().toArray(new String[0])[downloaded]),outputDir);
|
||||
String assetName = assetsObjects.keySet().toArray(new String[0])[downloaded];
|
||||
if(!assets.map_to_resources) downloadAsset(assetName, asset, objectsDir);
|
||||
else downloadAssetMapped(assetName, asset, outputDir);
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
mIsAssetsProcessing = false;
|
||||
@@ -233,17 +234,19 @@ public class PLaunchApp {
|
||||
return Tools.GLOBAL_GSON.fromJson(Tools.read(output.getAbsolutePath()), JAssets.class);
|
||||
}
|
||||
|
||||
public static void downloadAsset(JAssetInfo asset, File objectsDir) throws IOException {
|
||||
public static void downloadAsset(String assetName, JAssetInfo asset, File objectsDir) throws IOException {
|
||||
String assetPath = asset.hash.substring(0, 2) + "/" + asset.hash;
|
||||
File outFile = new File(objectsDir, assetPath);
|
||||
if (!outFile.exists()) {
|
||||
UIKit.updateProgressSafe(currProgress / maxProgress, "Downloading " + assetName);
|
||||
DownloadUtils.downloadFile(MINECRAFT_RES + assetPath, outFile);
|
||||
}
|
||||
}
|
||||
public static void downloadAssetMapped(JAssetInfo asset, String assetName, File resDir) throws IOException {
|
||||
public static void downloadAssetMapped(String assetName, JAssetInfo asset, File resDir) throws IOException {
|
||||
String assetPath = asset.hash.substring(0, 2) + "/" + asset.hash;
|
||||
File outFile = new File(resDir,"/"+assetName);
|
||||
if (!outFile.exists()) {
|
||||
UIKit.updateProgressSafe(currProgress / maxProgress, "Downloading " + assetName);
|
||||
DownloadUtils.downloadFile(MINECRAFT_RES + assetPath, outFile);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -145,9 +145,9 @@ public class UIKit {
|
||||
updateMCGuiScale(guiScale);
|
||||
}
|
||||
|
||||
public static boolean updateProgressSafe(final float progress, final String message) {
|
||||
public static void updateProgressSafe(final float progress, final String message) {
|
||||
System.out.println(message);
|
||||
return updateProgress(progress, ((int) (progress * 100)) + "% - " + message);
|
||||
updateProgress(progress, ((int) (progress * 100)) + "% - " + message);
|
||||
}
|
||||
|
||||
static {
|
||||
@@ -164,7 +164,7 @@ public class UIKit {
|
||||
private static native void updateMCGuiScale(int scale);
|
||||
|
||||
// Update progress
|
||||
public static native boolean updateProgress(float progress, String message);
|
||||
public static native void updateProgress(float progress, String message);
|
||||
|
||||
// Start SurfaceViewController
|
||||
public static native void launchMinecraftSurface(boolean isUseStackQueueBool);
|
||||
|
||||
@@ -2,8 +2,6 @@ package net.kdt.pojavlaunch.utils;
|
||||
|
||||
import android.util.*;
|
||||
|
||||
import com.oracle.dalvik.*;
|
||||
|
||||
import java.io.*;
|
||||
import java.util.*;
|
||||
|
||||
|
||||
Reference in new issue
Block a user