Удаление устаревшего ClientLauncher.title

This commit is contained in:
Gravit 2018-09-24 18:14:20 +07:00
parent b6ea3e0aa5
commit b3bf194922
6 changed files with 10 additions and 26 deletions

View file

@ -80,8 +80,6 @@ public static final class Params extends StreamObject {
@LauncherAPI
public final String accessToken;
@LauncherAPI
public final String title;
@LauncherAPI
public final boolean autoEnter;
@LauncherAPI
public final boolean fullScreen;
@ -101,7 +99,6 @@ public Params(byte[] launcherSign, Path assetDir, Path clientDir, PlayerProfile
// Client paths
this.assetDir = assetDir;
this.clientDir = clientDir;
title = ClientLauncher.title;
// Client params
this.pp = pp;
this.accessToken = SecurityHelper.verifyToken(accessToken);
@ -115,7 +112,6 @@ public Params(byte[] launcherSign, Path assetDir, Path clientDir, PlayerProfile
@LauncherAPI
public Params(HInput input) throws IOException {
launcherSign = input.readByteArray(-SecurityHelper.RSA_KEY_LENGTH);
title = input.readString(SerializeLimits.MAX_CLIENT);
// Client paths
assetDir = IOHelper.toPath(input.readString(0));
clientDir = IOHelper.toPath(input.readString(0));
@ -133,7 +129,6 @@ public Params(HInput input) throws IOException {
@Override
public void write(HOutput output) throws IOException {
output.writeByteArray(launcherSign, -SecurityHelper.RSA_KEY_LENGTH);
output.writeString(title, SerializeLimits.MAX_CLIENT);
// Client paths
output.writeString(assetDir.toString(), 0);
output.writeString(clientDir.toString(), 0);
@ -150,11 +145,10 @@ public void write(HOutput output) throws IOException {
}
private static final String[] EMPTY_ARRAY = new String[0];
private static final String SOCKET_HOST = "127.0.0.1";
private static final int SOCKET_PORT = 87564;
private static final String MAGICAL_INTEL_OPTION = "-XX:HeapDumpPath=ThisTricksIntelDriversForPerformance_javaw.exe_minecraft.exe.heapdump";
private static final boolean isUsingWrapper = true;
@LauncherAPI
public static final String TITLE_PROPERTY = "launcher.title";
@SuppressWarnings("unused")
private static final Set<PosixFilePermission> BIN_POSIX_PERMISSIONS = Collections.unmodifiableSet(EnumSet.of(
PosixFilePermission.OWNER_READ, PosixFilePermission.OWNER_WRITE, PosixFilePermission.OWNER_EXECUTE, // Owner
@ -169,8 +163,6 @@ public void write(HOutput output) throws IOException {
@LauncherAPI
public static final String SKIN_URL_PROPERTY = "skinURL";
@LauncherAPI
public static String title;
@LauncherAPI
public static ClientProfile profile;
@LauncherAPI
public static final String SKIN_DIGEST_PROPERTY = "skinDigest";
@ -184,12 +176,6 @@ public void write(HOutput output) throws IOException {
// Used to determine from clientside is launched from launcher
private static final AtomicBoolean LAUNCHED = new AtomicBoolean(false);
static {
String title_property = System.getProperty(TITLE_PROPERTY);
if (title_property != null) title = title_property;
else title = "";
}
private static void addClientArgs(Collection<String> args, ClientProfile profile, Params params) {
PlayerProfile pp = params.pp;
@ -315,7 +301,7 @@ public static Process launch(
try {
try (ServerSocket socket = new ServerSocket()) {
socket.setReuseAddress(true);
socket.bind(new InetSocketAddress("127.0.0.1", 54983));
socket.bind(new InetSocketAddress(SOCKET_HOST, SOCKET_PORT));
Socket client = socket.accept();
try (HOutput output = new HOutput(client.getOutputStream())) {
params.write(output);
@ -424,7 +410,7 @@ public static void main(String... args) throws Throwable {
RSAPublicKey publicKey = Launcher.getConfig().publicKey;
try {
try (Socket socket = IOHelper.newSocket()) {
socket.connect(new InetSocketAddress("127.0.0.1", 54983));
socket.connect(new InetSocketAddress(SOCKET_HOST, SOCKET_PORT));
try (HInput input = new HInput(socket.getInputStream())) {
params = new Params(input);
profile = new SignedObjectHolder<>(input, publicKey, ClientProfile.RO_ADAPTER);
@ -448,7 +434,6 @@ public static void main(String... args) throws Throwable {
}
}
ClientLauncher.profile = profile.object;
title = params.title;
Launcher.modulesManager.initModules();
// Verify ClientLauncher sign and classpath
LogHelper.debug("Verifying ClientLauncher sign and classpath");
@ -509,7 +494,6 @@ private static LinkedList<Path> resolveClassPathList(Path clientDir, String... c
@LauncherAPI
public static void setProfile(ClientProfile profile) {
ClientLauncher.profile = profile;
ClientLauncher.title = profile.getTitle();
LogHelper.debug("New Profile name: %s", profile.getTitle());
}

View file

@ -67,7 +67,7 @@ public Integer getType() {
@Override
protected Result requestDo(HInput input, HOutput output) throws IOException {
output.writeString(login, SerializeLimits.MAX_LOGIN);
output.writeString(ClientLauncher.title, SerializeLimits.MAX_CLIENT);
output.writeString(ClientLauncher.profile.getTitle(), SerializeLimits.MAX_CLIENT);
output.writeInt(auth_id);
output.writeLong(JVMHelper.OS_TYPE == JVMHelper.OS.MUSTDIE ? GuardBind.avnGetHddId() : 0);
output.writeLong(JVMHelper.OS_TYPE == JVMHelper.OS.MUSTDIE ? GuardBind.avnGetCpuid() : 0);

View file

@ -38,7 +38,7 @@ public Integer getType() {
protected PlayerProfile requestDo(HInput input, HOutput output) throws IOException {
output.writeString(username, SerializeLimits.MAX_LOGIN);
output.writeASCII(serverID, SerializeLimits.MAX_SERVERID); // 1 char for minus sign
output.writeString(ClientLauncher.title, 64);
output.writeString(ClientLauncher.profile.getTitle(), SerializeLimits.MAX_CLIENT);
output.flush();
// Read response

View file

@ -36,7 +36,7 @@ public Integer getType() {
@Override
protected PlayerProfile requestDo(HInput input, HOutput output) throws IOException {
output.writeUUID(uuid);
output.writeString(ClientLauncher.title, SerializeLimits.MAX_CLIENT);
output.writeString(ClientLauncher.profile.getTitle(), SerializeLimits.MAX_CLIENT);
output.flush();
// Return profile

View file

@ -35,7 +35,7 @@ public Integer getType() {
@Override
protected PlayerProfile requestDo(HInput input, HOutput output) throws IOException {
output.writeString(username, SerializeLimits.MAX_LOGIN);
output.writeString(ClientLauncher.title, SerializeLimits.MAX_CLIENT);
output.writeString(ClientLauncher.profile.getTitle(), SerializeLimits.MAX_CLIENT);
output.flush();
// Return profile
return input.readBoolean() ? new PlayerProfile(input) : null;

View file

@ -29,9 +29,9 @@ public static void main(String[] args) throws Throwable {
ProfilesRequest.Result result = new ProfilesRequest(cfg).request();
for (SignedObjectHolder<ClientProfile> p : result.profiles) {
LogHelper.debug("Get profile: %s", p.object.getTitle());
if (p.object.getTitle().equals(ClientLauncher.title)) {
if (p.object.getTitle().equals(ClientLauncher.profile.getTitle())) {
wrapper.profile = p.object;
LogHelper.debug("Found profile: %s", ClientLauncher.title);
LogHelper.debug("Found profile: %s", ClientLauncher.profile.getTitle());
break;
}
}