mirror of
https://gitlab.com/lecarore/breakout71.git
synced 2025-04-20 04:05:06 -04:00
Build 29084606
This commit is contained in:
parent
603ebf319a
commit
6adab3d07f
9 changed files with 87 additions and 82 deletions
|
@ -27,6 +27,11 @@ Other translation are very welcome, contact me if you'd like to submit one.
|
||||||
|
|
||||||
## Done
|
## Done
|
||||||
|
|
||||||
|
|
||||||
|
## 29084571
|
||||||
|
|
||||||
|
- simpler and more readable encoding for save files
|
||||||
|
- removed check of payload signature on save file, seemed to fail because of the poor encoding of the name of the "côte d'ivoire" level
|
||||||
- automatic detection of the number of steps required for physics
|
- automatic detection of the number of steps required for physics
|
||||||
- trial runs detection fix
|
- trial runs detection fix
|
||||||
|
|
||||||
|
|
|
@ -29,8 +29,8 @@ android {
|
||||||
applicationId = "me.lecaro.breakout"
|
applicationId = "me.lecaro.breakout"
|
||||||
minSdk = 21
|
minSdk = 21
|
||||||
targetSdk = 34
|
targetSdk = 34
|
||||||
versionCode = 29084571
|
versionCode = 29084606
|
||||||
versionName = "29084571"
|
versionName = "29084606"
|
||||||
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
|
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
|
||||||
vectorDrawables {
|
vectorDrawables {
|
||||||
useSupportLibrary = true
|
useSupportLibrary = true
|
||||||
|
|
File diff suppressed because one or more lines are too long
61
dist/index.html
vendored
61
dist/index.html
vendored
File diff suppressed because one or more lines are too long
|
@ -1,5 +1,5 @@
|
||||||
// The version of the cache.
|
// The version of the cache.
|
||||||
const VERSION = "29084571";
|
const VERSION = "29084606";
|
||||||
|
|
||||||
// The name of the cache
|
// The name of the cache
|
||||||
const CACHE_NAME = `breakout-71-${VERSION}`;
|
const CACHE_NAME = `breakout-71-${VERSION}`;
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
"29084571"
|
"29084606"
|
||||||
|
|
65
src/game.ts
65
src/game.ts
|
@ -708,24 +708,16 @@ async function openSettingsMenu() {
|
||||||
text: t("settings.download_save_file"),
|
text: t("settings.download_save_file"),
|
||||||
help: t("settings.download_save_file_help"),
|
help: t("settings.download_save_file_help"),
|
||||||
async value() {
|
async value() {
|
||||||
const signedPayload = generateSaveFileContent();
|
|
||||||
|
|
||||||
const dlLink = document.createElement("a");
|
const dlLink = document.createElement("a");
|
||||||
|
const obj = {
|
||||||
|
fileType: "B71-save-file",
|
||||||
|
appVersion,
|
||||||
|
payload: generateSaveFileContent(),
|
||||||
|
};
|
||||||
|
const json = JSON.stringify(obj, null, 2);
|
||||||
dlLink.setAttribute(
|
dlLink.setAttribute(
|
||||||
"href",
|
"href",
|
||||||
"data:application/json;base64," +
|
"data:application/json;charset=utf-8," + encodeURIComponent(json),
|
||||||
btoa(
|
|
||||||
JSON.stringify({
|
|
||||||
fileType: "B71-save-file",
|
|
||||||
appVersion,
|
|
||||||
signedPayload,
|
|
||||||
key: hashCode(
|
|
||||||
"Security by obscurity, but really the game is oss so eh" +
|
|
||||||
signedPayload,
|
|
||||||
),
|
|
||||||
}),
|
|
||||||
),
|
|
||||||
);
|
);
|
||||||
|
|
||||||
dlLink.setAttribute(
|
dlLink.setAttribute(
|
||||||
|
@ -735,7 +727,7 @@ async function openSettingsMenu() {
|
||||||
.toISOString()
|
.toISOString()
|
||||||
.slice(0, 19)
|
.slice(0, 19)
|
||||||
.replace(/[^0-9]+/gi, "-") +
|
.replace(/[^0-9]+/gi, "-") +
|
||||||
".b71",
|
".json",
|
||||||
);
|
);
|
||||||
document.body.appendChild(dlLink);
|
document.body.appendChild(dlLink);
|
||||||
dlLink.click();
|
dlLink.click();
|
||||||
|
@ -772,36 +764,21 @@ async function openSettingsMenu() {
|
||||||
|
|
||||||
reader.readAsText(file);
|
reader.readAsText(file);
|
||||||
});
|
});
|
||||||
const {
|
const { fileType, signedPayload, payload } = JSON.parse(content);
|
||||||
fileType,
|
|
||||||
appVersion: fileVersion,
|
|
||||||
signedPayload,
|
|
||||||
key,
|
|
||||||
} = JSON.parse(content);
|
|
||||||
if (fileType !== "B71-save-file")
|
if (fileType !== "B71-save-file")
|
||||||
throw new Error("Not a B71 save file");
|
throw new Error("Not a B71 save file");
|
||||||
// Actually, loading a save file to an older version is pretty useful
|
if (payload) {
|
||||||
// if (fileVersion > appVersion)
|
localStorage.clear();
|
||||||
// throw new Error(
|
for (let key in payload) {
|
||||||
// "Please update your app first, this file is for version " +
|
localStorage.setItem(key, JSON.stringify(payload[key]));
|
||||||
// fileVersion +
|
}
|
||||||
// " or newer.",
|
} else if (signedPayload) {
|
||||||
// );
|
// Old file format
|
||||||
|
const localStorageContent = JSON.parse(signedPayload);
|
||||||
if (
|
localStorage.clear();
|
||||||
key !==
|
for (let key in localStorageContent) {
|
||||||
hashCode(
|
localStorage.setItem(key, localStorageContent[key]);
|
||||||
"Security by obscurity, but really the game is oss so eh" +
|
}
|
||||||
signedPayload,
|
|
||||||
)
|
|
||||||
) {
|
|
||||||
throw new Error("Key does not match content.");
|
|
||||||
}
|
|
||||||
|
|
||||||
const localStorageContent = JSON.parse(signedPayload);
|
|
||||||
localStorage.clear();
|
|
||||||
for (let key in localStorageContent) {
|
|
||||||
localStorage.setItem(key, localStorageContent[key]);
|
|
||||||
}
|
}
|
||||||
await asyncAlert({
|
await asyncAlert({
|
||||||
title: t("settings.save_file_loaded"),
|
title: t("settings.save_file_loaded"),
|
||||||
|
|
|
@ -5,8 +5,10 @@ export function generateSaveFileContent() {
|
||||||
const key = localStorage.key(i) as string;
|
const key = localStorage.key(i) as string;
|
||||||
// Avoid including recovery info in the recovery info
|
// Avoid including recovery info in the recovery info
|
||||||
if (["recovery_data"].includes(key)) continue;
|
if (["recovery_data"].includes(key)) continue;
|
||||||
const value = localStorage.getItem(key) as string;
|
try {
|
||||||
localStorageContent[key] = value;
|
const value = localStorage.getItem(key) as string;
|
||||||
|
localStorageContent[key] = JSON.parse(value);
|
||||||
|
} catch (e) {}
|
||||||
}
|
}
|
||||||
return JSON.stringify(localStorageContent);
|
return localStorageContent;
|
||||||
}
|
}
|
||||||
|
|
|
@ -80,16 +80,28 @@ migrate("remove_long_and_creative_mode_data", () => {
|
||||||
localStorage.setItem("breakout_71_runs_history", JSON.stringify(cleaned));
|
localStorage.setItem("breakout_71_runs_history", JSON.stringify(cleaned));
|
||||||
});
|
});
|
||||||
|
|
||||||
migrate("compact_runs_data", () => {
|
migrate("compact_runs_data_again", () => {
|
||||||
let runsHistory = JSON.parse(
|
let runsHistory = JSON.parse(
|
||||||
localStorage.getItem("breakout_71_runs_history") || "[]",
|
localStorage.getItem("breakout_71_runs_history") || "[]",
|
||||||
) as RunHistoryItem[];
|
) as RunHistoryItem[];
|
||||||
|
runsHistory = runsHistory.filter((r) => {
|
||||||
|
if (!r.perks) return false;
|
||||||
|
if ("mode" in r) {
|
||||||
|
if (r.mode !== "short") {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
delete r.mode;
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
});
|
||||||
runsHistory.forEach((r) => {
|
runsHistory.forEach((r) => {
|
||||||
r.runTime = Math.round(r.runTime);
|
r.runTime = Math.round(r.runTime);
|
||||||
for (let key in r.perks) {
|
if (r.perks) {
|
||||||
if (r.perks && !r.perks[key]) {
|
for (let key in r.perks) {
|
||||||
delete r.perks[key];
|
if (!r.perks[key]) {
|
||||||
|
delete r.perks[key];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if ("best_level_score" in r) {
|
if ("best_level_score" in r) {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue