mirror of
https://github.com/isledecomp/isle.pizza.git
synced 2026-01-10 18:21:15 +00:00
Add Widescreen Backgrounds extension
This commit is contained in:
parent
300af0a71f
commit
65fb5a46cb
33
app.js
33
app.js
@ -33,6 +33,7 @@ document.addEventListener('DOMContentLoaded', function () {
|
|||||||
const afGroup = afSelect.closest('.form-group');
|
const afGroup = afSelect.closest('.form-group');
|
||||||
const rendererSelect = document.getElementById('renderer-select');
|
const rendererSelect = document.getElementById('renderer-select');
|
||||||
const hdTextures = document.getElementById('check-hd-textures');
|
const hdTextures = document.getElementById('check-hd-textures');
|
||||||
|
const widescreenBgs = document.getElementById('check-widescreen-bgs');
|
||||||
|
|
||||||
// --- Sound Toggle ---
|
// --- Sound Toggle ---
|
||||||
function updateSoundEmojiState() {
|
function updateSoundEmojiState() {
|
||||||
@ -212,12 +213,22 @@ document.addEventListener('DOMContentLoaded', function () {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (hdTextures) {
|
if (hdTextures || widescreenBgs) {
|
||||||
iniContent += "[extensions]\n";
|
iniContent += "[extensions]\n";
|
||||||
|
}
|
||||||
|
|
||||||
|
if (hdTextures) {
|
||||||
value = hdTextures.checked ? 'YES' : 'NO';
|
value = hdTextures.checked ? 'YES' : 'NO';
|
||||||
iniContent += `${hdTextures.name}=${value}\n`;
|
iniContent += `${hdTextures.name}=${value}\n`;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
siFiles = getSiFiles();
|
||||||
|
if (siFiles.length > 0) {
|
||||||
|
iniContent += `SI Loader=YES\n`;
|
||||||
|
iniContent += "[si loader]\n";
|
||||||
|
iniContent += `files=${siFiles.join(',')}\n`;
|
||||||
|
}
|
||||||
|
|
||||||
const workerCode = `
|
const workerCode = `
|
||||||
self.onmessage = async (e) => {
|
self.onmessage = async (e) => {
|
||||||
if (e.data.action === 'save') {
|
if (e.data.action === 'save') {
|
||||||
@ -292,6 +303,11 @@ document.addEventListener('DOMContentLoaded', function () {
|
|||||||
applyConfigToForm(config) {
|
applyConfigToForm(config) {
|
||||||
const elements = this.form.elements;
|
const elements = this.form.elements;
|
||||||
for (const key in config) {
|
for (const key in config) {
|
||||||
|
if (key == "files") {
|
||||||
|
elements["Widescreen Backgrounds"].checked = config[key].includes("widescreen.si");
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
const element = elements[key];
|
const element = elements[key];
|
||||||
if (!element) continue;
|
if (!element) continue;
|
||||||
|
|
||||||
@ -473,6 +489,10 @@ document.addEventListener('DOMContentLoaded', function () {
|
|||||||
checkInitialCacheStatus();
|
checkInitialCacheStatus();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
widescreenBgs.addEventListener('change', () => {
|
||||||
|
checkInitialCacheStatus();
|
||||||
|
});
|
||||||
|
|
||||||
rendererSelect.addEventListener('change', () => {
|
rendererSelect.addEventListener('change', () => {
|
||||||
showOrHideGraphicsOptions();
|
showOrHideGraphicsOptions();
|
||||||
});
|
});
|
||||||
@ -491,12 +511,21 @@ document.addEventListener('DOMContentLoaded', function () {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function getSiFiles() {
|
||||||
|
siFiles = [];
|
||||||
|
if (widescreenBgs && widescreenBgs.checked) {
|
||||||
|
siFiles.push('/LEGO/extra/widescreen.si');
|
||||||
|
}
|
||||||
|
return siFiles;
|
||||||
|
}
|
||||||
|
|
||||||
function checkInitialCacheStatus() {
|
function checkInitialCacheStatus() {
|
||||||
if (navigator.serviceWorker.controller) {
|
if (navigator.serviceWorker.controller) {
|
||||||
navigator.serviceWorker.controller.postMessage({
|
navigator.serviceWorker.controller.postMessage({
|
||||||
action: 'check_cache_status',
|
action: 'check_cache_status',
|
||||||
language: languageSelect.value,
|
language: languageSelect.value,
|
||||||
hdTextures: hdTextures.checked
|
hdTextures: hdTextures.checked,
|
||||||
|
siFiles: getSiFiles(),
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
11
index.html
11
index.html
@ -426,6 +426,10 @@
|
|||||||
<span class="tooltip-content">
|
<span class="tooltip-content">
|
||||||
<strong>HD Textures:</strong> Enhance the game's visuals with
|
<strong>HD Textures:</strong> Enhance the game's visuals with
|
||||||
high-definition textures. An extra 25MB download is
|
high-definition textures. An extra 25MB download is
|
||||||
|
required when this is enabled.<br><br>
|
||||||
|
<strong>Widescreen Backgrounds (work-in-progress):</strong> Adapts the game's background art
|
||||||
|
for modern widescreen monitors, eliminating unwanted 3D backgrounds on the
|
||||||
|
sides of the screen. An extra 1MB download is
|
||||||
required when this is enabled.
|
required when this is enabled.
|
||||||
</span>
|
</span>
|
||||||
</span>
|
</span>
|
||||||
@ -438,6 +442,13 @@
|
|||||||
HD Textures
|
HD Textures
|
||||||
</label>
|
</label>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="option-item">
|
||||||
|
<input type="checkbox" id="check-widescreen-bgs" name="Widescreen Backgrounds"
|
||||||
|
data-not-ini="true">
|
||||||
|
<label for="check-widescreen-bgs">
|
||||||
|
Widescreen Backgrounds
|
||||||
|
</label>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@ -91,7 +91,7 @@ async function uninstallLanguagePack(language, client) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
async function checkCacheStatus(language, hdTextures, client) {
|
async function checkCacheStatus(language, hdTextures, siFiles, client) {
|
||||||
const cacheName = getLanguageCacheName(language);
|
const cacheName = getLanguageCacheName(language);
|
||||||
const cache = await caches.open(cacheName);
|
const cache = await caches.open(cacheName);
|
||||||
const requests = await cache.keys();
|
const requests = await cache.keys();
|
||||||
@ -100,6 +100,9 @@ async function checkCacheStatus(language, hdTextures, client) {
|
|||||||
if (hdTextures) {
|
if (hdTextures) {
|
||||||
requiredFiles = requiredFiles.concat(textureFiles);
|
requiredFiles = requiredFiles.concat(textureFiles);
|
||||||
}
|
}
|
||||||
|
if (siFiles.length > 0) {
|
||||||
|
requiredFiles = requiredFiles.concat(siFiles);
|
||||||
|
}
|
||||||
const missingFiles = requiredFiles.filter(file => !cachedUrls.includes(file));
|
const missingFiles = requiredFiles.filter(file => !cachedUrls.includes(file));
|
||||||
|
|
||||||
client.postMessage({
|
client.postMessage({
|
||||||
@ -131,7 +134,7 @@ self.addEventListener('message', (event) => {
|
|||||||
uninstallLanguagePack(event.data.language, event.source);
|
uninstallLanguagePack(event.data.language, event.source);
|
||||||
break;
|
break;
|
||||||
case 'check_cache_status':
|
case 'check_cache_status':
|
||||||
checkCacheStatus(event.data.language, event.data.hdTextures, event.source);
|
checkCacheStatus(event.data.language, event.data.hdTextures, event.data.siFiles, event.source);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
9
sw.js
9
sw.js
@ -10,7 +10,7 @@ const { Strategy } = workbox.strategies;
|
|||||||
const { CacheableResponsePlugin } = workbox.cacheableResponse;
|
const { CacheableResponsePlugin } = workbox.cacheableResponse;
|
||||||
const { RangeRequestsPlugin } = workbox.rangeRequests;
|
const { RangeRequestsPlugin } = workbox.rangeRequests;
|
||||||
|
|
||||||
precacheAndRoute([{"revision":"a342ad33195eed2c0745b4f27c874451","url":"index.html"},{"revision":"013ceb7d67293d532e979dde0347f3af","url":"cancel_off.webp"},{"revision":"bfc1563be018d82685716c6130529129","url":"cancel_on.webp"},{"revision":"d282c260fd35522036936bb6faf8ad21","url":"cdspin.gif"},{"revision":"3d820bf72b19bd4e437a61e75f317b83","url":"configure_off.webp"},{"revision":"e2c0c5e6aa1f7703c385a433a2d2a519","url":"configure_on.webp"},{"revision":"88e1e81c930d8e6c24dfdc7af274e812","url":"favicon.png"},{"revision":"d16b293eca457e2fb1e7ef2caca8c904","url":"favicon.svg"},{"revision":"d2b9c2e128ef1e5e4265c603b0bc3305","url":"free_stuff_off.webp"},{"revision":"cbc6a6779897f932c3a3c8dceb329804","url":"free_stuff_on.webp"},{"revision":"05fba4ef1884cbbd6afe09ea3325efc0","url":"install_off.webp"},{"revision":"11247e92082ba3d978a2e3785b0acf51","url":"install_on.webp"},{"revision":"d23ea8243c18eb217ef08fe607097824","url":"island.webp"},{"revision":"c3314e6daf2056902c27b7ccbb237e9b","url":"isle.js"},{"revision":"0c7a24202bd246027d3fc600b647f00e","url":"isle.wasm"},{"revision":"6d4248f1a08c218943e582673179b7be","url":"poster.pdf"},{"revision":"a6fcac24a24996545c039a1755af33ea","url":"read_me_off.webp"},{"revision":"aae783d064996b4322e23b092d97ea4a","url":"read_me_on.webp"},{"revision":"766a9e6e6d890f24cef252e81753b29d","url":"run_game_off.webp"},{"revision":"70208e00e9ea641e4c98699f74100db3","url":"run_game_on.webp"},{"revision":"0a65c71d9983c9bb1bc6a5f405fd6fd9","url":"shark.webp"},{"revision":"88c1fd032e6fc16814690712a26c1ede","url":"uninstall_off.webp"},{"revision":"0118a4aca04c5fb0a525bf00b001844e","url":"uninstall_on.webp"},{"revision":"874db5446269fce0d688061532d7a48b","url":"app.js"},{"revision":"942885226607afc2faf4e4c99e166ed9","url":"style.css"},{"revision":"060210979e13e305510de6285e085db1","url":"manifest.json"},{"revision":"4f0172bc7007d34cebf681cc233ab57f","url":"install.webp"},{"revision":"6a70d35dadf51d2ec6e38a6202d7fb0b","url":"install.mp3"},{"revision":"eac041a0b8835bfea706d997b0b7b224","url":"downloader.js"}]);
|
precacheAndRoute([{"revision":"9543d844d0c63edf114f4b20bda17755","url":"index.html"},{"revision":"013ceb7d67293d532e979dde0347f3af","url":"cancel_off.webp"},{"revision":"bfc1563be018d82685716c6130529129","url":"cancel_on.webp"},{"revision":"d282c260fd35522036936bb6faf8ad21","url":"cdspin.gif"},{"revision":"3d820bf72b19bd4e437a61e75f317b83","url":"configure_off.webp"},{"revision":"e2c0c5e6aa1f7703c385a433a2d2a519","url":"configure_on.webp"},{"revision":"88e1e81c930d8e6c24dfdc7af274e812","url":"favicon.png"},{"revision":"d16b293eca457e2fb1e7ef2caca8c904","url":"favicon.svg"},{"revision":"d2b9c2e128ef1e5e4265c603b0bc3305","url":"free_stuff_off.webp"},{"revision":"cbc6a6779897f932c3a3c8dceb329804","url":"free_stuff_on.webp"},{"revision":"05fba4ef1884cbbd6afe09ea3325efc0","url":"install_off.webp"},{"revision":"11247e92082ba3d978a2e3785b0acf51","url":"install_on.webp"},{"revision":"d23ea8243c18eb217ef08fe607097824","url":"island.webp"},{"revision":"67c99852cbd60bccd6d12f2d101fb34c","url":"isle.js"},{"revision":"1dccb6f053644ceb5a4ec730174bf70d","url":"isle.wasm"},{"revision":"6d4248f1a08c218943e582673179b7be","url":"poster.pdf"},{"revision":"a6fcac24a24996545c039a1755af33ea","url":"read_me_off.webp"},{"revision":"aae783d064996b4322e23b092d97ea4a","url":"read_me_on.webp"},{"revision":"766a9e6e6d890f24cef252e81753b29d","url":"run_game_off.webp"},{"revision":"70208e00e9ea641e4c98699f74100db3","url":"run_game_on.webp"},{"revision":"0a65c71d9983c9bb1bc6a5f405fd6fd9","url":"shark.webp"},{"revision":"88c1fd032e6fc16814690712a26c1ede","url":"uninstall_off.webp"},{"revision":"0118a4aca04c5fb0a525bf00b001844e","url":"uninstall_on.webp"},{"revision":"bb300718068544d5464574079dd76404","url":"app.js"},{"revision":"942885226607afc2faf4e4c99e166ed9","url":"style.css"},{"revision":"060210979e13e305510de6285e085db1","url":"manifest.json"},{"revision":"4f0172bc7007d34cebf681cc233ab57f","url":"install.webp"},{"revision":"6a70d35dadf51d2ec6e38a6202d7fb0b","url":"install.mp3"},{"revision":"eac041a0b8835bfea706d997b0b7b224","url":"downloader.js"}]);
|
||||||
|
|
||||||
const gameFiles = [
|
const gameFiles = [
|
||||||
"/LEGO/Scripts/CREDITS.SI", "/LEGO/Scripts/INTRO.SI", "/LEGO/Scripts/NOCD.SI", "/LEGO/Scripts/SNDANIM.SI",
|
"/LEGO/Scripts/CREDITS.SI", "/LEGO/Scripts/INTRO.SI", "/LEGO/Scripts/NOCD.SI", "/LEGO/Scripts/SNDANIM.SI",
|
||||||
@ -91,7 +91,7 @@ async function uninstallLanguagePack(language, client) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
async function checkCacheStatus(language, hdTextures, client) {
|
async function checkCacheStatus(language, hdTextures, siFiles, client) {
|
||||||
const cacheName = getLanguageCacheName(language);
|
const cacheName = getLanguageCacheName(language);
|
||||||
const cache = await caches.open(cacheName);
|
const cache = await caches.open(cacheName);
|
||||||
const requests = await cache.keys();
|
const requests = await cache.keys();
|
||||||
@ -100,6 +100,9 @@ async function checkCacheStatus(language, hdTextures, client) {
|
|||||||
if (hdTextures) {
|
if (hdTextures) {
|
||||||
requiredFiles = requiredFiles.concat(textureFiles);
|
requiredFiles = requiredFiles.concat(textureFiles);
|
||||||
}
|
}
|
||||||
|
if (siFiles.length > 0) {
|
||||||
|
requiredFiles = requiredFiles.concat(siFiles);
|
||||||
|
}
|
||||||
const missingFiles = requiredFiles.filter(file => !cachedUrls.includes(file));
|
const missingFiles = requiredFiles.filter(file => !cachedUrls.includes(file));
|
||||||
|
|
||||||
client.postMessage({
|
client.postMessage({
|
||||||
@ -131,7 +134,7 @@ self.addEventListener('message', (event) => {
|
|||||||
uninstallLanguagePack(event.data.language, event.source);
|
uninstallLanguagePack(event.data.language, event.source);
|
||||||
break;
|
break;
|
||||||
case 'check_cache_status':
|
case 'check_cache_status':
|
||||||
checkCacheStatus(event.data.language, event.data.hdTextures, event.source);
|
checkCacheStatus(event.data.language, event.data.hdTextures, event.data.siFiles, event.source);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user