Various bug fixes

- Input cursor movement seems too fast, attempt to reduce it by setting larger font size in the hidden text field.
- latestlog.txt doesn't log in 1.12+ since Log4j patch. Fixed by adding some config lines.
- Makefile: building is broken when run make from a path with space(s). Fixed by handling spaces with backslashes.
- text2speech is not overridden properly. Fixed by excluding it from download list and adding launcher.jar itself to the classpath.
- XML log output in < 1.12 since Log4j patch. Fixed by using our own configuration file.

Some more changes:
- Commented out a debug line in LWJGLX
- Fix a typo.
- JavaLauncher: use (ObjC)BOOL instead of (std)bool.
This commit is contained in:
khanhduytran0 committed 2022-01-17 08:18:06 +07:00
1 parent 50bdb73ab8
commit fbde4948d5
10 files changed
+48 -19

No files matched your search

@@ -2,16 +2,5 @@ package com.mojang.text2speech;
public class Text2Speech {
public static void main(final String[] args) {
System.setProperty("jna.library.path", "./src/natives/resources/");
final Narrator narrator = Narrator.getNarrator();
narrator.say("This is a test", false);
while (true) {
try {
Thread.sleep(100);
} catch (final InterruptedException e) {
e.printStackTrace();
}
}
}
}
@@ -65,6 +65,8 @@ public class PLaunchApp {
if (mVersion.logging != null) {
if (mVersion.logging.client.file.id.equals("client-1.12.xml")) {
configPath = Tools.DIR_BUNDLE + "/log4j-rce-patch-1.12.xml";
} else if (mVersion.logging.client.file.id.equals("client-1.7.xml")) {
configPath = Tools.DIR_BUNDLE + "/log4j-rce-patch-1.7.xml";
} else {
configPath = Tools.DIR_GAME_NEW + "/" + mVersion.logging.client.file.id;
}
@@ -150,7 +150,8 @@ public final class Tools
// URLClassLoader loader = new URLClassLoader(urlList.toArray(new URL[0]), ClassLoader.getSystemClassLoader());
PojavClassLoader loader = (PojavClassLoader) ClassLoader.getSystemClassLoader();
// add launcher.jar itself
loader.addURL(Tools.class.getProtectionDomain().getCodeSource().getLocation().toURI().toURL());
for (String s : launchClassPath.split(":")) {
if (!s.isEmpty()) {
loader.addURL(new File(s).toURI().toURL());
@@ -417,7 +418,7 @@ public final class Tools
// Support for text2speech is not planned, so skip it for now.
for (int i = 0; i < libraries.length; i++) {
DependentLibrary libItem = libraries[i];
if (libItem.name.startsWith("com.mojang.text2speech") ||
if (libItem.name.startsWith("com.mojang:text2speech") ||
libItem.name.startsWith("net.java.jinput") ||
libItem.name.startsWith("net.java.dev.jna:platform:") ||
libItem.name.startsWith("org.lwjgl") ||
@@ -178,7 +178,7 @@ public class GLFWInputImplementation implements InputImplementation {
last_event_nanos = nanos;
}
public void putKeyboardEvent(int keycode, byte state, int ch, long nanos, boolean repeat) {
System.out.println("LWJGL2: debug keyboard=" + keycode + ", state=" + state + ", repeat=" + repeat);
//System.out.println("LWJGL2: debug keyboard=" + keycode + ", state=" + state + ", repeat=" + repeat);
key_down_buffer[keycode] = state;
keyboardEvent.clear();
keyboardEvent.putInt(keycode).put(state).putInt(ch).putLong(nanos).put(repeat ? (byte)1 : (byte)0);
+1 -1
View File
@@ -2,7 +2,7 @@ SHELL := /bin/bash
.SHELLFLAGS = -ec
# Prerequisite variables
SOURCEDIR := $(shell pwd)
SOURCEDIR := $(shell printf "%q\n" "$(shell pwd)")
OUTPUTDIR := $(SOURCEDIR)/artifacts
WORKINGDIR := $(SOURCEDIR)/Natives/build
DETECTPLAT := $(shell uname -s)
+2 -2
View File
@@ -1,7 +1,7 @@
#pragma once
#include <stdbool.h>
#include <Foundation/Foundation.h>
static bool started = false;
static BOOL started = NO;
int launchJVM(int argc, char *argv[]);
+2 -2
View File
@@ -329,7 +329,7 @@ int launchJVM(int argc, char *argv[]) {
mkdir(dirname(log_path), 755);
if (!started) {
debug("[Pre-init] Staring logging STDIO as jrelog:V\n");
debug("[Pre-init] Starting logging STDIO as jrelog:V\n");
// Redirect stdio to latestlog.txt
char newname[2048];
sprintf(newname, "%s/latestlog.old.txt", homeDir);
@@ -654,7 +654,7 @@ int launchJVM(int argc, char *argv[]) {
char **targv = started ? argv : margv;
if (!started) {
started = true;
started = YES;
}
/* debug:
for (int i = 0; i < targc; i++) {
+1
View File
@@ -228,6 +228,7 @@ const void * _CGDataProviderGetBytePointerCallbackOSMESA(void *info) {
#else
self.inputView = [[TrackedTextField alloc] initWithFrame:CGRectMake(5 * 2 + 160.0, 5 * 2 + 30.0, 200.0, 30.0)];
self.inputView.backgroundColor = [UIColor colorWithWhite:0.0f alpha:0.5f];
self.inputView.font = [self.inputView.font fontWithSize:20];
inputLengthView = [[UILabel alloc] initWithFrame:CGRectMake(5 * 2 + 80.0, 5 * 2 + 30.0, 80.0, 30.0)];
inputLengthView.text = @"length=?";
@@ -1,6 +1,13 @@
<?xml version="1.0" encoding="UTF-8"?>
<Configuration status="WARN">
<Appenders>
<Console name="SysOut" target="SYSTEM_OUT">
<PatternLayout pattern="[%d{HH:mm:ss}] [%t/%level]: %msg{nolookups}%n" />
<Policies>
<TimeBasedTriggeringPolicy />
<OnStartupTriggeringPolicy />
</Policies>
</Console>
<RollingRandomAccessFile name="File" fileName="logs/latest.log" filePattern="logs/%d{yyyy-MM-dd}-%i.log.gz">
<PatternLayout pattern="[%d{HH:mm:ss}] [%t/%level]: %msg{nolookups}%n" />
<Policies>
+29
View File
@@ -0,0 +1,29 @@
<?xml version="1.0" encoding="UTF-8"?>
<Configuration status="WARN">
<Appenders>
<Console name="SysOut" target="SYSTEM_OUT">
<PatternLayout pattern="[%d{HH:mm:ss}] [%t/%level]: %msg%n" />
<Policies>
<TimeBasedTriggeringPolicy />
<OnStartupTriggeringPolicy />
</Policies>
</Console>
<RollingRandomAccessFile name="File" fileName="logs/latest.log" filePattern="logs/%d{yyyy-MM-dd}-%i.log.gz">
<PatternLayout pattern="[%d{HH:mm:ss}] [%t/%level]: %msg%n" />
<Policies>
<TimeBasedTriggeringPolicy />
<OnStartupTriggeringPolicy />
</Policies>
</RollingRandomAccessFile>
</Appenders>
<Loggers>
<Root level="info">
<filters>
<MarkerFilter marker="NETWORK_PACKETS" onMatch="DENY" onMismatch="NEUTRAL" />
<RegexFilter regex="(?s).*\$\{[^}]*\}.*" onMatch="DENY" onMismatch="NEUTRAL"/>
</filters>
<AppenderRef ref="SysOut"/>
<AppenderRef ref="File"/>
</Root>
</Loggers>
</Configuration>