Skip to content

Commit

Permalink
chore: hkrpg 2.7.0
Browse files Browse the repository at this point in the history
  • Loading branch information
3Shain committed Dec 4, 2024
1 parent d07ac5f commit bac23d0
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 46 deletions.
2 changes: 1 addition & 1 deletion src/clients/mhy/hkrpg/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ import { VoicePackNames } from "../launcher-info";
import createPatchOff from "./config/patch-off";
import { getLatestAdvInfo, getLatestVersionInfo } from "../hyp-connect";

const CURRENT_SUPPORTED_VERSION = "2.6.0";
const CURRENT_SUPPORTED_VERSION = "2.7.0";

export async function createHKRPGChannelClient({
server,
Expand Down
55 changes: 10 additions & 45 deletions src/clients/mhy/unity.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,53 +32,18 @@ export async function getGameVersion2019(gameDataDir: string) {
if (index == -1) {
throw new Error("pattern not found"); //FIXME
} else {
let str = "";
let offset = 0;
try {
for (let i = 0; i < 3; i++) {
for (;;) {
const w = view[index + 0x40 + offset];
if (w - 48 == -2) {
// dot
str += ".";
offset++;
break;
} else if (w - 48 >= 0 && w - 48 < 10) {
// decimal
str += String.fromCharCode(w);
offset++;
continue;
} else if (i == 2) {
return str;
} else {
throw new Error("Falied to parse version");
}
}
}
} catch {
// second attempt
for (let i = 0; i < 3; i++) {
for (;;) {
const w = view[index + 0x35 + offset];
if (w - 48 == -2) {
// dot
str += ".";
offset++;
break;
} else if (w - 48 >= 0 && w - 48 < 10) {
// decimal
str += String.fromCharCode(w);
offset++;
continue;
} else if (i == 2) {
return str;
} else {
throw new Error("Falied to parse version");
}
}
for (let j = index; j < index + 0x80; j++) {
if (view[j] == 0x2e && view[j + 2] == 0x2e) {
return (
String.fromCharCode(view[j - 1]) +
"." +
String.fromCharCode(view[j + 1]) +
"." +
String.fromCharCode(view[j + 3])
);
}
}
throw new Error("Assertation: unreachable");
throw new Error("Falied to parse version");
}
}

Expand Down

0 comments on commit bac23d0

Please sign in to comment.