Skip to content

Commit

Permalink
Expect to improve overall stability
Browse files Browse the repository at this point in the history
  • Loading branch information
Herysia committed Dec 22, 2022
1 parent 424fe91 commit 6b5118a
Show file tree
Hide file tree
Showing 5 changed files with 61 additions and 66 deletions.
20 changes: 10 additions & 10 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "loa-details",
"version": "1.0.1",
"version": "1.0.2",
"description": "Damage meter for Lost Ark",
"productName": "LOA Details",
"author": "Herysia, Mathicha, Eren Kara <[email protected]>",
Expand Down
103 changes: 50 additions & 53 deletions src-electron/electron-main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -230,60 +230,57 @@ function startApplication() {

mainWindow = createMainWindow(appSettings);
damageMeterWindow = createDamageMeterWindow(logParser, appSettings);
damageMeterWindow.on("ready-to-show", () => {
const xorTable = readFileSync("./meter-data/xor.bin");
const oodle_state = readFileSync("./meter-data/oodle_state.bin");
const compressor = new Decompressor(oodle_state, xorTable);
const stream = new PKTStream(compressor);
const capture = new PktCaptureAll();
capture.on("packet", (buf) => stream.read(buf));
const meterData = new MeterData();
meterData.processEnumData(
JSON.parse(readFileSync("./meter-data/databases/Enums.json", "utf-8"))
);
meterData.processNpcData(
JSON.parse(readFileSync("./meter-data/databases/Npc.json", "utf-8"))
);
meterData.processPCData(
JSON.parse(readFileSync("./meter-data/databases/PCData.json", "utf-8"))
);
meterData.processSkillData(
JSON.parse(readFileSync("./meter-data/databases/Skill.json", "utf-8"))
);
meterData.processSkillBuffData(
JSON.parse(readFileSync("./meter-data/databases/SkillBuff.json", "utf-8"))
);
meterData.processSkillBuffEffectData(
JSON.parse(
readFileSync("./meter-data/databases/SkillEffect.json", "utf-8")
)
);
const padTo2Digits = (num: number) => num.toString().padStart(2, "0");

const legacyLogger = new LegacyLogger(stream, meterData);
const date = new Date();
const filename =
"LostArk_" +
[
date.getFullYear(),
padTo2Digits(date.getMonth() + 1),
padTo2Digits(date.getDate()),
padTo2Digits(date.getHours()),
padTo2Digits(date.getMinutes()),
padTo2Digits(date.getSeconds()),
].join("-") +
".log";
const logfile = createWriteStream(path.join(mainFolder, filename), {
highWaterMark: 0,
encoding: "utf-8",
});
//TODO: write version to log?

legacyLogger.on("line", (line) => {
logParser.parseLogLine(line);
logfile?.write(line);
logfile?.write("\n");
});
const xorTable = readFileSync("./meter-data/xor.bin");
const oodle_state = readFileSync("./meter-data/oodle_state.bin");
const compressor = new Decompressor(oodle_state, xorTable);
const stream = new PKTStream(compressor);
const capture = new PktCaptureAll();
capture.on("packet", (buf) => stream.read(buf));
const meterData = new MeterData();
meterData.processEnumData(
JSON.parse(readFileSync("./meter-data/databases/Enums.json", "utf-8"))
);
meterData.processNpcData(
JSON.parse(readFileSync("./meter-data/databases/Npc.json", "utf-8"))
);
meterData.processPCData(
JSON.parse(readFileSync("./meter-data/databases/PCData.json", "utf-8"))
);
meterData.processSkillData(
JSON.parse(readFileSync("./meter-data/databases/Skill.json", "utf-8"))
);
meterData.processSkillBuffData(
JSON.parse(readFileSync("./meter-data/databases/SkillBuff.json", "utf-8"))
);
meterData.processSkillBuffEffectData(
JSON.parse(readFileSync("./meter-data/databases/SkillEffect.json", "utf-8"))
);
const padTo2Digits = (num: number) => num.toString().padStart(2, "0");

const legacyLogger = new LegacyLogger(stream, meterData);
const date = new Date();
const filename =
"LostArk_" +
[
date.getFullYear(),
padTo2Digits(date.getMonth() + 1),
padTo2Digits(date.getDate()),
padTo2Digits(date.getHours()),
padTo2Digits(date.getMinutes()),
padTo2Digits(date.getSeconds()),
].join("-") +
".log";
const logfile = createWriteStream(path.join(mainFolder, filename), {
highWaterMark: 0,
encoding: "utf-8",
});
//TODO: write version to log?

legacyLogger.on("line", (line) => {
logParser.parseLogLine(line);
logfile?.write(line);
logfile?.write("\n");
});

initializeShortcuts(appSettings);
Expand Down
1 change: 0 additions & 1 deletion src-electron/electron-windows/damage-meter-window.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ export function createDamageMeterWindow(
webPreferences: {
devTools: process.env.DEBUGGING,
contextIsolation: true,
sandbox: false,
preload: path.resolve(__dirname, process.env.QUASAR_ELECTRON_PRELOAD),
},
});
Expand Down
1 change: 0 additions & 1 deletion src-electron/electron-windows/main-window.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ export function createMainWindow(appSettings: Settings) {
webPreferences: {
devTools: process.env.DEBUGGING,
contextIsolation: true,
sandbox: false,
// More info: /quasar-cli/developing-electron-apps/electron-preload-script
preload: path.resolve(__dirname, process.env.QUASAR_ELECTRON_PRELOAD),
},
Expand Down

0 comments on commit 6b5118a

Please sign in to comment.