This commit is contained in:
Tungstend 2023-02-20 23:19:20 +08:00
commit 1cabadcc7c
5 changed files with 130 additions and 6 deletions

View File

@ -0,0 +1,96 @@
invertYMouse:false
mouseSensitivity:0.5
fov:0.0
gamma:0.5070422
saturation:0.0
renderDistance:2
guiScale:0
particles:1
bobView:false
anaglyph3d:false
advancedOpengl:false
maxFps:260
fboEnable:true
difficulty:2
fancyGraphics:false
ao:0
clouds:true
resourcePacks:[]
lastServer:
lang:zh_CN
chatVisibility:0
chatColors:true
chatLinks:true
chatLinksPrompt:true
chatOpacity:1.0
snooperEnabled:true
fullscreen:false
enableVsync:false
hideServerAddress:false
advancedItemTooltips:false
pauseOnLostFocus:true
showCape:true
touchscreen:false
overrideWidth:0
overrideHeight:0
heldItemTooltips:true
chatHeightFocused:1.0
chatHeightUnfocused:0.44366196
chatScale:1.0
chatWidth:1.0
showInventoryAchievementHint:false
mipmapLevels:0
anisotropicFiltering:1
streamBytesPerPixel:0.5
streamMicVolume:1.0
streamSystemVolume:1.0
streamKbps:0.5412844
streamFps:0.31690142
streamCompression:1
streamSendMetadata:true
streamPreferredServer:
streamChatEnabled:0
streamChatUserFilter:0
streamMicToggleBehavior:0
forceUnicodeFont:false
key_key.attack:-100
key_key.use:-99
key_key.forward:17
key_key.left:30
key_key.back:31
key_key.right:32
key_key.jump:57
key_key.sneak:42
key_key.drop:16
key_key.inventory:18
key_key.chat:20
key_key.playerlist:15
key_key.pickItem:-98
key_key.command:53
key_key.screenshot:60
key_key.togglePerspective:63
key_key.smoothCamera:0
key_key.sprint:29
key_key.streamStartStop:64
key_key.streamPauseUnpause:65
key_key.streamCommercial:0
key_key.streamToggleMic:0
key_key.fullscreen:87
key_key.hotbar.1:2
key_key.hotbar.2:3
key_key.hotbar.3:4
key_key.hotbar.4:5
key_key.hotbar.5:6
key_key.hotbar.6:7
key_key.hotbar.7:8
key_key.hotbar.8:9
key_key.hotbar.9:10
soundCategory_master:1.0
soundCategory_music:1.0
soundCategory_record:1.0
soundCategory_weather:1.0
soundCategory_block:1.0
soundCategory_hostile:1.0
soundCategory_neutral:1.0
soundCategory_player:1.0
soundCategory_ambient:1.0

View File

@ -0,0 +1,2 @@
nameserver 8.8.8.8
nameserver 8.8.4.4

View File

@ -248,6 +248,7 @@ public class RuntimeFragment extends FCLFragment implements View.OnClickListener
try {
RuntimeUtils.installJava(getContext(), FCLPath.JAVA_17_PATH, "app_runtime/java/jre17");
java17 = true;
RuntimeUtils.copyAssets(getContext(),"resolv.conf",FCLPath.JAVA_17_PATH+"/resolv.conf");
} catch (IOException e) {
e.printStackTrace();
}

View File

@ -3,6 +3,7 @@ package com.tungsten.fcl.game;
import android.content.Context;
import com.tungsten.fcl.R;
import com.tungsten.fcl.util.RuntimeUtils;
import com.tungsten.fclauncher.FCLPath;
import com.tungsten.fclauncher.bridge.FCLBridge;
import com.tungsten.fclcore.auth.AuthInfo;
@ -14,7 +15,10 @@ import com.tungsten.fclcore.util.Logging;
import com.tungsten.fclcore.util.io.FileUtils;
import com.tungsten.fcllibrary.component.LocaleUtils;
import java.io.BufferedReader;
import java.io.File;
import java.io.FileReader;
import java.io.FileWriter;
import java.io.IOException;
import java.util.Locale;
import java.util.Map;
@ -54,15 +58,35 @@ public final class FCLGameLauncher extends DefaultLauncher {
if (findFiles(configFolder, "options.txt"))
return;
try {
// TODO: Dirty implementation here
if (LocaleUtils.getSystemLocale().getDisplayName().equals(Locale.CHINA.getDisplayName())) {
FileUtils.writeText(optionsFile, "lang:zh_CN\nforceUnicodeFont:true\nfullscreen:false\n");
} else {
FileUtils.writeText(optionsFile, "fullscreen:false\n");
}
RuntimeUtils.copyAssets(context,"options.txt",optionsFile.getAbsolutePath());
} catch (IOException e) {
Logging.LOG.log(Level.WARNING, "Unable to generate options.txt", e);
}
// TODO: Dirty implementation here
if (!LocaleUtils.getSystemLocale().getDisplayName().equals(Locale.CHINA.getDisplayName())){
String str="";
try(BufferedReader bfr=new BufferedReader(new FileReader(optionsFile))){
String line;
while ((line= bfr.readLine())!=null){
if (line.contains("lang:")){
str+="lang:en_us\n";
} else {
str+=line+"\n";
}
}
}catch (Exception e){
Logging.LOG.log(Level.WARNING, "Unable to read options.txt.", e);
}
if(!"".equals(str)) {
try(FileWriter fw=new FileWriter(optionsFile)) {
fw.write(str);
}catch (IOException e){
Logging.LOG.log(Level.WARNING, "Unable to write options.txt.", e);
}
}
}
}
private boolean findFiles(File folder, String fileName) {

View File

@ -208,6 +208,7 @@ public class DefaultLauncher extends Launcher {
res.addDefault("-Dawt.toolkit=", "net.java.openjdk.cacio.ctc.CTCToolkit");
res.addDefault("-Djava.awt.graphicsenv=", "net.java.openjdk.cacio.ctc.CTCGraphicsEnvironment");
} else {
res.addDefault("-Dext.net.resolvPath=",FCLPath.JAVA_17_PATH+"/resolv.conf");
res.addDefault("-Dawt.toolkit=", "com.github.caciocavallosilano.cacio.ctc.CTCToolkit");
res.addDefault("-Djava.awt.graphicsenv=", "com.github.caciocavallosilano.cacio.ctc.CTCGraphicsEnvironment");
res.addDefault("-Djava.system.class.loader=", "com.github.caciocavallosilano.cacio.ctc.CTCPreloadClassLoader");