Skip to content

Commit

Permalink
First release
Browse files Browse the repository at this point in the history
  • Loading branch information
SandeMC committed Jun 13, 2024
1 parent 7d1d717 commit 11eaa74
Show file tree
Hide file tree
Showing 3 changed files with 63 additions and 0 deletions.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
# kh-savefileconverter.github.io
A simple savefile converter that can convert EGS savefiles for Kingdom Hearts to Steam and vice-versa

Initial draft and code done by ChatGPT because this was just a "what if lol" idea
39 changes: 39 additions & 0 deletions copyHexOffsets.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
function copyHexOffsets() {
const fileInput1 = document.getElementById('file1').files[0];
const fileInput2 = document.getElementById('file2').files[0];

if (!fileInput1 || !fileInput2) {
alert("Please select two files.");
return;
}

const reader1 = new FileReader();
const reader2 = new FileReader();

reader1.onload = function (e1) {
const arrayBuffer1 = e1.target.result;
const uint8Array1 = new Uint8Array(arrayBuffer1);

reader2.onload = function (e2) {
const arrayBuffer2 = e2.target.result;
const uint8Array2 = new Uint8Array(arrayBuffer2);

// Copy offsets from 00000000 to 00000150
for (let i = 0; i <= 0x150; i++) {
uint8Array1[i] = uint8Array2[i];
}

// Create new file
const blob1 = new Blob([uint8Array1], { type: 'application/octet-stream' });

const downloadLink1 = document.getElementById('download1');
downloadLink1.href = URL.createObjectURL(blob1);
downloadLink1.download = fileInput2.name;
downloadLink1.style.display = 'block';
};

reader2.readAsArrayBuffer(fileInput2);
};

reader1.readAsArrayBuffer(fileInput1);
}
22 changes: 22 additions & 0 deletions index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Kingdom Hearts 1.5+2.5 + DDD Savefile Converter</title>
</head>
<body>
<h1>Kingdom Hearts 1.5+2.5 + DDD Savefile Converter</h1>
<h2>To use this tool, you first must create an empty savefile to convert to (so an empty KHIIFM_WW.png if you want to convert to Steam or an empty KHIIFM.png if you want to convert to Epic Games)
<h3>Convert from (put your original savefile here):</h3>
<input type="file" id="file1" accept=".png">
<h3>Convert to (put your empty savefile you want to play with here):</h3>
<input type="file" id="file2" accept=".png">
<br><br>
<button onclick="copyHexOffsets()">Convert</button>
<br><br>
<a id="download1" style="display: none;">Download converted savefile</a>

<script src="copyHexOffsets.js"></script>
</body>
</html>

0 comments on commit 11eaa74

Please sign in to comment.