mirror of
https://github.com/GravitLauncher/Launcher
synced 2024-11-15 03:31:15 +03:00
Удаление устаревшего ClientLauncher.title
This commit is contained in:
parent
b6ea3e0aa5
commit
b3bf194922
6 changed files with 10 additions and 26 deletions
|
@ -80,8 +80,6 @@ public static final class Params extends StreamObject {
|
||||||
@LauncherAPI
|
@LauncherAPI
|
||||||
public final String accessToken;
|
public final String accessToken;
|
||||||
@LauncherAPI
|
@LauncherAPI
|
||||||
public final String title;
|
|
||||||
@LauncherAPI
|
|
||||||
public final boolean autoEnter;
|
public final boolean autoEnter;
|
||||||
@LauncherAPI
|
@LauncherAPI
|
||||||
public final boolean fullScreen;
|
public final boolean fullScreen;
|
||||||
|
@ -101,7 +99,6 @@ public Params(byte[] launcherSign, Path assetDir, Path clientDir, PlayerProfile
|
||||||
// Client paths
|
// Client paths
|
||||||
this.assetDir = assetDir;
|
this.assetDir = assetDir;
|
||||||
this.clientDir = clientDir;
|
this.clientDir = clientDir;
|
||||||
title = ClientLauncher.title;
|
|
||||||
// Client params
|
// Client params
|
||||||
this.pp = pp;
|
this.pp = pp;
|
||||||
this.accessToken = SecurityHelper.verifyToken(accessToken);
|
this.accessToken = SecurityHelper.verifyToken(accessToken);
|
||||||
|
@ -115,7 +112,6 @@ public Params(byte[] launcherSign, Path assetDir, Path clientDir, PlayerProfile
|
||||||
@LauncherAPI
|
@LauncherAPI
|
||||||
public Params(HInput input) throws IOException {
|
public Params(HInput input) throws IOException {
|
||||||
launcherSign = input.readByteArray(-SecurityHelper.RSA_KEY_LENGTH);
|
launcherSign = input.readByteArray(-SecurityHelper.RSA_KEY_LENGTH);
|
||||||
title = input.readString(SerializeLimits.MAX_CLIENT);
|
|
||||||
// Client paths
|
// Client paths
|
||||||
assetDir = IOHelper.toPath(input.readString(0));
|
assetDir = IOHelper.toPath(input.readString(0));
|
||||||
clientDir = IOHelper.toPath(input.readString(0));
|
clientDir = IOHelper.toPath(input.readString(0));
|
||||||
|
@ -133,7 +129,6 @@ public Params(HInput input) throws IOException {
|
||||||
@Override
|
@Override
|
||||||
public void write(HOutput output) throws IOException {
|
public void write(HOutput output) throws IOException {
|
||||||
output.writeByteArray(launcherSign, -SecurityHelper.RSA_KEY_LENGTH);
|
output.writeByteArray(launcherSign, -SecurityHelper.RSA_KEY_LENGTH);
|
||||||
output.writeString(title, SerializeLimits.MAX_CLIENT);
|
|
||||||
// Client paths
|
// Client paths
|
||||||
output.writeString(assetDir.toString(), 0);
|
output.writeString(assetDir.toString(), 0);
|
||||||
output.writeString(clientDir.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[] 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 String MAGICAL_INTEL_OPTION = "-XX:HeapDumpPath=ThisTricksIntelDriversForPerformance_javaw.exe_minecraft.exe.heapdump";
|
||||||
private static final boolean isUsingWrapper = true;
|
private static final boolean isUsingWrapper = true;
|
||||||
|
|
||||||
@LauncherAPI
|
|
||||||
public static final String TITLE_PROPERTY = "launcher.title";
|
|
||||||
@SuppressWarnings("unused")
|
@SuppressWarnings("unused")
|
||||||
private static final Set<PosixFilePermission> BIN_POSIX_PERMISSIONS = Collections.unmodifiableSet(EnumSet.of(
|
private static final Set<PosixFilePermission> BIN_POSIX_PERMISSIONS = Collections.unmodifiableSet(EnumSet.of(
|
||||||
PosixFilePermission.OWNER_READ, PosixFilePermission.OWNER_WRITE, PosixFilePermission.OWNER_EXECUTE, // Owner
|
PosixFilePermission.OWNER_READ, PosixFilePermission.OWNER_WRITE, PosixFilePermission.OWNER_EXECUTE, // Owner
|
||||||
|
@ -169,8 +163,6 @@ public void write(HOutput output) throws IOException {
|
||||||
@LauncherAPI
|
@LauncherAPI
|
||||||
public static final String SKIN_URL_PROPERTY = "skinURL";
|
public static final String SKIN_URL_PROPERTY = "skinURL";
|
||||||
@LauncherAPI
|
@LauncherAPI
|
||||||
public static String title;
|
|
||||||
@LauncherAPI
|
|
||||||
public static ClientProfile profile;
|
public static ClientProfile profile;
|
||||||
@LauncherAPI
|
@LauncherAPI
|
||||||
public static final String SKIN_DIGEST_PROPERTY = "skinDigest";
|
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
|
// Used to determine from clientside is launched from launcher
|
||||||
private static final AtomicBoolean LAUNCHED = new AtomicBoolean(false);
|
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) {
|
private static void addClientArgs(Collection<String> args, ClientProfile profile, Params params) {
|
||||||
PlayerProfile pp = params.pp;
|
PlayerProfile pp = params.pp;
|
||||||
|
|
||||||
|
@ -315,7 +301,7 @@ public static Process launch(
|
||||||
try {
|
try {
|
||||||
try (ServerSocket socket = new ServerSocket()) {
|
try (ServerSocket socket = new ServerSocket()) {
|
||||||
socket.setReuseAddress(true);
|
socket.setReuseAddress(true);
|
||||||
socket.bind(new InetSocketAddress("127.0.0.1", 54983));
|
socket.bind(new InetSocketAddress(SOCKET_HOST, SOCKET_PORT));
|
||||||
Socket client = socket.accept();
|
Socket client = socket.accept();
|
||||||
try (HOutput output = new HOutput(client.getOutputStream())) {
|
try (HOutput output = new HOutput(client.getOutputStream())) {
|
||||||
params.write(output);
|
params.write(output);
|
||||||
|
@ -424,7 +410,7 @@ public static void main(String... args) throws Throwable {
|
||||||
RSAPublicKey publicKey = Launcher.getConfig().publicKey;
|
RSAPublicKey publicKey = Launcher.getConfig().publicKey;
|
||||||
try {
|
try {
|
||||||
try (Socket socket = IOHelper.newSocket()) {
|
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())) {
|
try (HInput input = new HInput(socket.getInputStream())) {
|
||||||
params = new Params(input);
|
params = new Params(input);
|
||||||
profile = new SignedObjectHolder<>(input, publicKey, ClientProfile.RO_ADAPTER);
|
profile = new SignedObjectHolder<>(input, publicKey, ClientProfile.RO_ADAPTER);
|
||||||
|
@ -448,7 +434,6 @@ public static void main(String... args) throws Throwable {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
ClientLauncher.profile = profile.object;
|
ClientLauncher.profile = profile.object;
|
||||||
title = params.title;
|
|
||||||
Launcher.modulesManager.initModules();
|
Launcher.modulesManager.initModules();
|
||||||
// Verify ClientLauncher sign and classpath
|
// Verify ClientLauncher sign and classpath
|
||||||
LogHelper.debug("Verifying 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
|
@LauncherAPI
|
||||||
public static void setProfile(ClientProfile profile) {
|
public static void setProfile(ClientProfile profile) {
|
||||||
ClientLauncher.profile = profile;
|
ClientLauncher.profile = profile;
|
||||||
ClientLauncher.title = profile.getTitle();
|
|
||||||
LogHelper.debug("New Profile name: %s", profile.getTitle());
|
LogHelper.debug("New Profile name: %s", profile.getTitle());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -67,7 +67,7 @@ public Integer getType() {
|
||||||
@Override
|
@Override
|
||||||
protected Result requestDo(HInput input, HOutput output) throws IOException {
|
protected Result requestDo(HInput input, HOutput output) throws IOException {
|
||||||
output.writeString(login, SerializeLimits.MAX_LOGIN);
|
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.writeInt(auth_id);
|
||||||
output.writeLong(JVMHelper.OS_TYPE == JVMHelper.OS.MUSTDIE ? GuardBind.avnGetHddId() : 0);
|
output.writeLong(JVMHelper.OS_TYPE == JVMHelper.OS.MUSTDIE ? GuardBind.avnGetHddId() : 0);
|
||||||
output.writeLong(JVMHelper.OS_TYPE == JVMHelper.OS.MUSTDIE ? GuardBind.avnGetCpuid() : 0);
|
output.writeLong(JVMHelper.OS_TYPE == JVMHelper.OS.MUSTDIE ? GuardBind.avnGetCpuid() : 0);
|
||||||
|
|
|
@ -38,7 +38,7 @@ public Integer getType() {
|
||||||
protected PlayerProfile requestDo(HInput input, HOutput output) throws IOException {
|
protected PlayerProfile requestDo(HInput input, HOutput output) throws IOException {
|
||||||
output.writeString(username, SerializeLimits.MAX_LOGIN);
|
output.writeString(username, SerializeLimits.MAX_LOGIN);
|
||||||
output.writeASCII(serverID, SerializeLimits.MAX_SERVERID); // 1 char for minus sign
|
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();
|
output.flush();
|
||||||
|
|
||||||
// Read response
|
// Read response
|
||||||
|
|
|
@ -36,7 +36,7 @@ public Integer getType() {
|
||||||
@Override
|
@Override
|
||||||
protected PlayerProfile requestDo(HInput input, HOutput output) throws IOException {
|
protected PlayerProfile requestDo(HInput input, HOutput output) throws IOException {
|
||||||
output.writeUUID(uuid);
|
output.writeUUID(uuid);
|
||||||
output.writeString(ClientLauncher.title, SerializeLimits.MAX_CLIENT);
|
output.writeString(ClientLauncher.profile.getTitle(), SerializeLimits.MAX_CLIENT);
|
||||||
output.flush();
|
output.flush();
|
||||||
|
|
||||||
// Return profile
|
// Return profile
|
||||||
|
|
|
@ -35,7 +35,7 @@ public Integer getType() {
|
||||||
@Override
|
@Override
|
||||||
protected PlayerProfile requestDo(HInput input, HOutput output) throws IOException {
|
protected PlayerProfile requestDo(HInput input, HOutput output) throws IOException {
|
||||||
output.writeString(username, SerializeLimits.MAX_LOGIN);
|
output.writeString(username, SerializeLimits.MAX_LOGIN);
|
||||||
output.writeString(ClientLauncher.title, SerializeLimits.MAX_CLIENT);
|
output.writeString(ClientLauncher.profile.getTitle(), SerializeLimits.MAX_CLIENT);
|
||||||
output.flush();
|
output.flush();
|
||||||
// Return profile
|
// Return profile
|
||||||
return input.readBoolean() ? new PlayerProfile(input) : null;
|
return input.readBoolean() ? new PlayerProfile(input) : null;
|
||||||
|
|
|
@ -29,9 +29,9 @@ public static void main(String[] args) throws Throwable {
|
||||||
ProfilesRequest.Result result = new ProfilesRequest(cfg).request();
|
ProfilesRequest.Result result = new ProfilesRequest(cfg).request();
|
||||||
for (SignedObjectHolder<ClientProfile> p : result.profiles) {
|
for (SignedObjectHolder<ClientProfile> p : result.profiles) {
|
||||||
LogHelper.debug("Get profile: %s", p.object.getTitle());
|
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;
|
wrapper.profile = p.object;
|
||||||
LogHelper.debug("Found profile: %s", ClientLauncher.title);
|
LogHelper.debug("Found profile: %s", ClientLauncher.profile.getTitle());
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue