Skip to content

Commit

Permalink
Revert "1.0.4"
Browse files Browse the repository at this point in the history
This reverts commit a233599.
  • Loading branch information
Sato-Isolated committed Aug 10, 2024
1 parent a233599 commit e95862c
Show file tree
Hide file tree
Showing 4 changed files with 90 additions and 212 deletions.
141 changes: 71 additions & 70 deletions gameSaveSerializer.js
Original file line number Diff line number Diff line change
@@ -1,74 +1,75 @@
export const GameSaveSerializer = {
serialize(save) {
const json = JSON.stringify(save, this.jsonConverter);
return this.encodeText(json, "savefile");
},
jsonConverter(key, value) {
if (value === Infinity) {
return "Infinity";
}
if (value instanceof Set) {
return Array.from(value.keys());
}
return value;
},
deserialize(data) {
if (typeof data !== "string") return undefined;
try {
const json = this.decodeText(data, "savefile");
return JSON.parse(json, (k, v) => ((v === Infinity) ? "Infinity" : v));
} catch (e) {
return undefined;
}
},
encoder: new TextEncoder(),
decoder: new TextDecoder(),
startingString: {
savefile: "AntimatterDimensionsSavefileFormat",
"automator script": "AntimatterDimensionsAutomatorScriptFormat",
"automator data": "AntimatterDimensionsAutomatorDataFormat",
"glyph filter": "AntimatterDimensionsGlyphFilterFormat",
},
endingString: {
savefile: "EndOfSavefile",
"automator script": "EndOfAutomatorScript",
"automator data": "EndOfAutomatorData",
"glyph filter": "EndOfGlyphFilter",
},
version: "AAB",
steps: [
{ encode: x => GameSaveSerializer.encoder.encode(x), decode: x => GameSaveSerializer.decoder.decode(x) },
{ encode: x => pako.deflate(x), decode: x => pako.inflate(x) },
{
encode: x => Array.from(x).map(i => String.fromCharCode(i)).join(""),
decode: x => Uint8Array.from(Array.from(x).map(i => i.charCodeAt(0)))
serialize(save) {
const json = JSON.stringify(save, this.jsonConverter);
return this.encodeText(json, "savefile");
},
{ encode: x => btoa(x), decode: x => atob(x) },
{
encode: x => x.replace(/=+$/gu, "").replace(/0/gu, "0a").replace(/\+/gu, "0b").replace(/\//gu, "0c"),
decode: x => x.replace(/0b/gu, "+").replace(/0c/gu, "/").replace(/0a/gu, "0")
jsonConverter(key, value) {
if (value === Infinity) {
return "Infinity";
}
if (value instanceof Set) {
return Array.from(value.keys());
}
return value;
},
{
encode: (x, type) => x + GameSaveSerializer.endingString[type],
decode: (x, type) => x.slice(0, x.length - GameSaveSerializer.endingString[type].length),
condition: version => version >= "AAB"
}
],
getSteps(type, version) {
return this.steps.filter(i => (!i.condition) || i.condition(version)).concat({
encode: x => `${GameSaveSerializer.startingString[type] + GameSaveSerializer.version}${x}`,
decode: x => x.slice(GameSaveSerializer.startingString[type].length + 3)
});
},
encodeText(text, type) {
return this.getSteps(type, this.version).reduce((x, step) => step.encode(x, type), text);
},
decodeText(text, type) {
if (text.startsWith(this.startingString[type])) {
const len = this.startingString[type].length;
const version = text.slice(len, len + 3);
return this.getSteps(type, version).reduceRight((x, step) => step.decode(x, type), text);
deserialize(data) {
if (typeof data !== "string") return undefined;
try {
const json = this.decodeText(data, "savefile");
return JSON.parse(json, (k, v) => ((v === Infinity) ? "Infinity" : v));
} catch (e) {
return undefined;
}
},
encoder: new TextEncoder(),
decoder: new TextDecoder(),
startingString: {
savefile: "AntimatterDimensionsSavefileFormat",
"automator script": "AntimatterDimensionsAutomatorScriptFormat",
"automator data": "AntimatterDimensionsAutomatorDataFormat",
"glyph filter": "AntimatterDimensionsGlyphFilterFormat",
},
endingString: {
savefile: "EndOfSavefile",
"automator script": "EndOfAutomatorScript",
"automator data": "EndOfAutomatorData",
"glyph filter": "EndOfGlyphFilter",
},
version: "AAB",
steps: [
{ encode: x => GameSaveSerializer.encoder.encode(x), decode: x => GameSaveSerializer.decoder.decode(x) },
{ encode: x => pako.deflate(x), decode: x => pako.inflate(x) },
{
encode: x => Array.from(x).map(i => String.fromCharCode(i)).join(""),
decode: x => Uint8Array.from(Array.from(x).map(i => i.charCodeAt(0)))
},
{ encode: x => btoa(x), decode: x => atob(x) },
{
encode: x => x.replace(/=+$/gu, "").replace(/0/gu, "0a").replace(/\+/gu, "0b").replace(/\//gu, "0c"),
decode: x => x.replace(/0b/gu, "+").replace(/0c/gu, "/").replace(/0a/gu, "0")
},
{
encode: (x, type) => x + GameSaveSerializer.endingString[type],
decode: (x, type) => x.slice(0, x.length - GameSaveSerializer.endingString[type].length),
condition: version => version >= "AAB"
}
],
getSteps(type, version) {
return this.steps.filter(i => (!i.condition) || i.condition(version)).concat({
encode: x => `${GameSaveSerializer.startingString[type] + GameSaveSerializer.version}${x}`,
decode: x => x.slice(GameSaveSerializer.startingString[type].length + 3)
});
},
encodeText(text, type) {
return this.getSteps(type, this.version).reduce((x, step) => step.encode(x, type), text);
},
decodeText(text, type) {
if (text.startsWith(this.startingString[type])) {
const len = this.startingString[type].length;
const version = text.slice(len, len + 3);
return this.getSteps(type, version).reduceRight((x, step) => step.decode(x, type), text);
}
return atob(text);
}
return atob(text);
}
};
};

40 changes: 6 additions & 34 deletions index.html
Original file line number Diff line number Diff line change
@@ -1,43 +1,17 @@
<!DOCTYPE html>
<html lang="en">

<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="description" content="Antimatter Dimensions Save Editor - A tool for modifying your game saves.">
<meta name="keywords" content="Antimatter Dimensions, Save Editor, Game, Tool">
<meta name="author" content="Sato-Isolated">
<title>Antimatter Dimensions Save Editor</title>
<title>Antimatter Dimension Save Editor</title>
<link rel="stylesheet" href="styles.css">
<link href="https://cdn.jsdelivr.net/npm/[email protected]/dist/jsoneditor.min.css" rel="stylesheet" type="text/css">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.4/css/all.min.css">
</head>

<body class="dark-mode">
<div class="github-link">
<a href="https://github.com/Sato-Isolated/Antimatter-Dimensions-Save-Editor" target="_blank">
<i class="fab fa-github"></i> Contribute on GitHub
</a>
</div>

<div class="github-stats">
<h3><i class="fab fa-github"></i> GitHub Stats</h3>
<div class="github-badges">
<div class="github-badge">
<span id="githubStars">0</span> <i class="fas fa-star"></i>
</div>
<div class="github-badge">
<span id="githubForks">0</span> <i class="fas fa-code-branch"></i>
</div>
<div class="github-badge">
<span id="githubIssues">0</span> <i class="fas fa-exclamation-circle"></i>
</div>
</div>
</div>

<div class="container">
<div class="editor-section">
<h1>Antimatter Dimensions Save Editor</h1>
<h1>Antimatter Dimension Save Editor</h1>
<div>
<textarea id="input" placeholder="Paste your encrypted game save here"></textarea>
<button id="pasteButton"><i class="fas fa-paste"></i> Paste</button>
Expand All @@ -48,24 +22,22 @@ <h1>Antimatter Dimensions Save Editor</h1>
<button id="encryptButton"><i class="fas fa-lock"></i> Encrypt</button>
<button id="copyButton"><i class="fas fa-copy"></i> Copy</button>
<textarea id="output" placeholder="Your encrypted game save will appear here"></textarea>
</div>

</div>
<button id="toggleTheme"><i class="fas fa-sun"></i></button>
</div>
<div class="changelog-section">
<h2>Changelog</h2>
<ul id="changelogList">
<li><strong>v1.0.4</strong> — Added GitHub integration and updated meta tags for better SEO.</li>
<li><strong>v1.0.3</strong> — Added paste and copy buttons for convenience.</li>
<li><strong>v1.0.2</strong> — Added dark theme.</li>
<li><strong>v1.0.1</strong> — Implemented save editor functionality.</li>
<li><strong>v1.0.0</strong> — Initial release of the save editor.</li>
</ul>
</div>
</div>

<script src="https://cdnjs.cloudflare.com/ajax/libs/pako/2.1.0/pako.min.js"></script>
<script src="./pako.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/jsoneditor.min.js"></script>
<script type="module" src="script.js"></script>
</body>

</html>
</html>
2 changes: 2 additions & 0 deletions pako.min.js

Large diffs are not rendered by default.

119 changes: 11 additions & 108 deletions styles.css
Original file line number Diff line number Diff line change
@@ -1,17 +1,11 @@
:root {
--background-color: #f4f4f9;
/* Very light, neutral background */
--text-color: #333333;
/* Text in dark gray */
--primary-color: #007BFF;
/* Bright blue for buttons */
--background-color: #f4f4f9; /* Fond très clair et neutre */
--text-color: #333333; /* Texte en gris foncé */
--primary-color: #007BFF; /* Bleu vif pour les boutons */
--primary-dark-color: #0056b3;
--secondary-background-color: #ffffff;
/* White for secondary elements */
--secondary-border-color: #dddddd;
/* Light grey for borders */
--highlight-color: #007BFF;
/* Bright blue for important elements */
--secondary-background-color: #ffffff; /* Blanc pour les éléments secondaires */
--secondary-border-color: #dddddd; /* Gris clair pour les bordures */
--highlight-color: #007BFF; /* Bleu vif pour les éléments importants */
}

body.dark-mode {
Expand Down Expand Up @@ -45,8 +39,7 @@ body {
padding: 20px;
margin-bottom: 20px;
border-radius: 10px;
box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
/* Light shade */
box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1); /* Ombre légère */
width: 100%;
border: 1px solid var(--secondary-border-color);
}
Expand Down Expand Up @@ -74,13 +67,11 @@ button {
font-size: 18px;
cursor: pointer;
background: linear-gradient(45deg, var(--primary-dark-color), var(--primary-color));
color: #ffffff;
/* White text on buttons for contrast */
color: #ffffff; /* Texte en blanc sur les boutons pour le contraste */
border: none;
border-radius: 6px;
transition: background 0.3s ease, transform 0.2s ease;
box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
/* Light shade */
box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1); /* Ombre légère */
display: inline-flex;
align-items: center;
justify-content: center;
Expand Down Expand Up @@ -121,8 +112,7 @@ button i {
color: var(--text-color);
padding: 15px;
border-radius: 15px;
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
/* Light shade */
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1); /* Ombre légère */
z-index: 1000;
font-size: 0.9em;
border: 1px solid var(--secondary-border-color);
Expand All @@ -132,8 +122,7 @@ button i {
.changelog-section h2 {
font-size: 1.2em;
margin-top: 0;
color: var(--highlight-color);
/* Use highlight color */
color: var(--highlight-color); /* Utiliser la couleur de surbrillance */
text-transform: uppercase;
font-weight: bold;
letter-spacing: 1px;
Expand All @@ -154,89 +143,3 @@ button i {
.changelog-section ul li::before {
display: none;
}

.github-link {
position: fixed;
bottom: 20px;
right: 20px;
background-color: var(--secondary-background-color);
color: var(--text-color);
padding: 15px;
border-radius: 8px;
box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
font-size: 1em;
z-index: 1000;
width: 220px;
text-align: center;
border: 1px solid var(--secondary-border-color);
}

.github-link a {
color: var(--highlight-color);
text-decoration: none;
font-weight: bold;
}

.github-link a:hover {
text-decoration: underline;
}

.github-stats {
position: fixed;
bottom: 80px;
right: 20px;
background-color: var(--secondary-background-color);
color: var(--text-color);
padding: 15px;
border-radius: 12px;
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
font-size: 1em;
z-index: 1000;
width: 220px;
text-align: center;
border: 1px solid var(--secondary-border-color);
}

.github-stats h3 {
margin-top: 0;
font-size: 1.2em;
color: var(--highlight-color);
text-transform: uppercase;
}

.github-badges {
display: flex;
justify-content: space-around;
margin-top: 10px;
}

.github-badge {
background-color: #28a745;
color: #fff;
padding: 5px 10px;
border-radius: 20px;
font-size: 1em;
display: flex;
align-items: center;
justify-content: center;
}

.github-badge:nth-child(2) {
background-color: #007bff;
}

.github-badge:nth-child(3) {
background-color: #ffc107;
}

.github-badge i {
margin-left: 5px;
}

.github-cta {
position: fixed;
bottom: 20px;
right: 20px;
width: 220px;
text-align: center;
}

0 comments on commit e95862c

Please sign in to comment.