Update to fix a few issues
This commit is contained in:
parent
e2883808f4
commit
b4020a275f
9 changed files with 38 additions and 165 deletions
|
@ -29,14 +29,13 @@ class Settings {
|
|||
static final Settings Instance = Settings._();
|
||||
|
||||
bool server = true;
|
||||
bool wineInitialized = false;
|
||||
|
||||
String steamcmd_path = "";
|
||||
String game_path = "";
|
||||
String base_path = "";
|
||||
String gameServerDBFile = "";
|
||||
bool FTS = true;
|
||||
Credentials serverLoginCreds =
|
||||
Credentials(username: "admin", password: "changeMe123");
|
||||
UUID remoteLoginToken = UUID.ZERO;
|
||||
|
||||
PacketClient? client;
|
||||
|
@ -57,8 +56,8 @@ class Settings {
|
|||
tag.put("base", StringTag.valueOf(base_path));
|
||||
tag.put("dbfile", StringTag.valueOf(getWorldGameDB()));
|
||||
NbtUtils.writeBoolean(tag, "fts", FTS);
|
||||
NbtUtils.writeBoolean(tag, "wine_init", wineInitialized);
|
||||
|
||||
tag.put("server_creds", serverLoginCreds.save());
|
||||
tag.put("superuser", superuser.serialize());
|
||||
NbtUtils.writeUUID(tag, "token", NbtUUID.fromUUID(remoteLoginToken));
|
||||
|
||||
|
@ -86,8 +85,7 @@ class Settings {
|
|||
FTS = NbtUtils.readBoolean(tag, "fts"); // First Time Setup.
|
||||
// FTS should be disabled by the client when sending it back to the server in a C2SApplySettingsPacket
|
||||
|
||||
serverLoginCreds =
|
||||
Credentials.deserialize(tag.get("server_creds")!.asCompoundTag());
|
||||
superuser = User.deserialize(tag.get("superuser")!.asCompoundTag());
|
||||
|
||||
if (tag.containsKey("main")) {
|
||||
inst = SettingsEntry.deserialize(tag.get("main")!.asCompoundTag());
|
||||
|
@ -102,21 +100,13 @@ class Settings {
|
|||
var tag = await NbtIo.read("settings.dat");
|
||||
|
||||
inst = SettingsEntry.deserialize(tag.get("entry") as CompoundTag);
|
||||
serverLoginCreds = Credentials.deserialize(
|
||||
tag.get(Credentials.TAG_NAME)!.asCompoundTag());
|
||||
wineInitialized = NbtUtils.readBoolean(tag, "wine_init");
|
||||
FTS = NbtUtils.readBoolean(tag, "fts");
|
||||
} catch (E) {
|
||||
print("No existing settings file found, initializing default settings");
|
||||
inst = SettingsEntry();
|
||||
inst!.steam_creds = Credentials(
|
||||
username: "",
|
||||
password: "",
|
||||
);
|
||||
|
||||
serverLoginCreds = Credentials(
|
||||
username: "admin",
|
||||
password: "changeMe123",
|
||||
);
|
||||
superuser = User.make("admin", "changeMe123", UserLevel.Super_User);
|
||||
FTS = true;
|
||||
}
|
||||
}
|
||||
|
@ -128,8 +118,9 @@ class Settings {
|
|||
if (inst == null) return;
|
||||
CompoundTag tag = CompoundTag();
|
||||
tag.put("entry", inst!.serialize());
|
||||
tag.put(Credentials.TAG_NAME, serverLoginCreds.save());
|
||||
tag.put("superuser", superuser.serialize());
|
||||
NbtUtils.writeBoolean(tag, "fts", FTS);
|
||||
NbtUtils.writeBoolean(tag, "wine_init", wineInitialized);
|
||||
|
||||
NbtIo.write("settings.dat", tag);
|
||||
}
|
||||
|
@ -319,7 +310,6 @@ class Settings {
|
|||
|
||||
Future<void> initializeWine() async {
|
||||
await runWinetrick("win10");
|
||||
await runWinetrick("w_workaround_wine_bug-50894");
|
||||
await runWinetrick("cmd");
|
||||
await runWinetrick("vcrun2013");
|
||||
await runWinetrick("vcrun2015");
|
||||
|
@ -413,7 +403,8 @@ class Settings {
|
|||
static void Clear() {
|
||||
Instance.inst = SettingsEntry();
|
||||
Instance.subsys = StateMachine();
|
||||
Instance.serverLoginCreds = Credentials(username: "admin", password: "");
|
||||
Instance.superuser =
|
||||
User.make("admin", "changeMe123", UserLevel.Super_User);
|
||||
Instance.server = false;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue