From d2022fcb2196972e61506343b9c30290caa7a318 Mon Sep 17 00:00:00 2001 From: cassidoxa Date: Thu, 31 Aug 2023 00:09:29 -0400 Subject: [PATCH] Fix permalink heart color patching Update ROM --- app/Rom.php | 4 +-- composer.json | 4 +-- composer.lock | 54 ++++++++++++++-------------- package-lock.json | 48 +++++++++++++++++++++++++ resources/js/rom.js | 86 +++++++++++++++++++++++++++++++-------------- 5 files changed, 139 insertions(+), 57 deletions(-) diff --git a/app/Rom.php b/app/Rom.php index bf3983b7a..3dc46de90 100644 --- a/app/Rom.php +++ b/app/Rom.php @@ -13,8 +13,8 @@ */ class Rom { - const BUILD = '2023-08-22'; - const HASH = 'bdb7e2398eab6003577307763fd40128'; + const BUILD = '2023-08-30'; + const HASH = '69f5f851d43590d3e84208e3820abdc7'; const SIZE = 2097152; private $tmp_file; diff --git a/composer.json b/composer.json index ab1ecb21f..7bf861801 100644 --- a/composer.json +++ b/composer.json @@ -49,7 +49,7 @@ "source": { "url": "https://github.com/KatDevsGames/z3randomizer", "type": "git", - "reference": "4c98268d812e7546e247b79aac8f2df077c9e209" + "reference": "29176fa1946150784705f34d5b7641f81eda1dd0" } } }, @@ -83,7 +83,7 @@ "source": { "url": "https://github.com/cassidoxa/ALttPEntranceRandomizer", "type": "git", - "reference": "408e9c2fc6400ddfcbdbd5c701782a3e64f79adb" + "reference": "eeba10fd8b9ca0f10e943a1bbe25505b67cf6064" } } } diff --git a/composer.lock b/composer.lock index cf5d8e017..6412530eb 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "2418db105a122617db7c2b91bef239e2", + "content-hash": "13c477382fa3e82764437abf38af1609", "packages": [ { "name": "aws/aws-crt-php", @@ -62,16 +62,16 @@ }, { "name": "aws/aws-sdk-php", - "version": "3.279.9", + "version": "3.280.0", "source": { "type": "git", "url": "https://github.com/aws/aws-sdk-php.git", - "reference": "cbf446e410c04a405192cc0d018f29a91fe36375" + "reference": "bf4f3079bc59af44a752677cfbcd43f7953c4343" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/aws/aws-sdk-php/zipball/cbf446e410c04a405192cc0d018f29a91fe36375", - "reference": "cbf446e410c04a405192cc0d018f29a91fe36375", + "url": "https://api.github.com/repos/aws/aws-sdk-php/zipball/bf4f3079bc59af44a752677cfbcd43f7953c4343", + "reference": "bf4f3079bc59af44a752677cfbcd43f7953c4343", "shasum": "" }, "require": { @@ -151,9 +151,9 @@ "support": { "forum": "https://forums.aws.amazon.com/forum.jspa?forumID=80", "issues": "https://github.com/aws/aws-sdk-php/issues", - "source": "https://github.com/aws/aws-sdk-php/tree/3.279.9" + "source": "https://github.com/aws/aws-sdk-php/tree/3.280.0" }, - "time": "2023-08-29T18:11:18+00:00" + "time": "2023-08-30T18:19:33+00:00" }, { "name": "brick/math", @@ -2385,16 +2385,16 @@ }, { "name": "league/commonmark", - "version": "2.4.0", + "version": "2.4.1", "source": { "type": "git", "url": "https://github.com/thephpleague/commonmark.git", - "reference": "d44a24690f16b8c1808bf13b1bd54ae4c63ea048" + "reference": "3669d6d5f7a47a93c08ddff335e6d945481a1dd5" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/thephpleague/commonmark/zipball/d44a24690f16b8c1808bf13b1bd54ae4c63ea048", - "reference": "d44a24690f16b8c1808bf13b1bd54ae4c63ea048", + "url": "https://api.github.com/repos/thephpleague/commonmark/zipball/3669d6d5f7a47a93c08ddff335e6d945481a1dd5", + "reference": "3669d6d5f7a47a93c08ddff335e6d945481a1dd5", "shasum": "" }, "require": { @@ -2487,7 +2487,7 @@ "type": "tidelift" } ], - "time": "2023-03-24T15:16:10+00:00" + "time": "2023-08-30T16:55:00+00:00" }, { "name": "league/config", @@ -2985,20 +2985,20 @@ }, { "name": "league/uri", - "version": "7.1.0", + "version": "7.2.1", "source": { "type": "git", "url": "https://github.com/thephpleague/uri.git", - "reference": "c0bf6dfa86b7804fe870b3f3d9c653e35a2c9e3e" + "reference": "8b644f8ff80352530bbc0ea467d5b5a89b60d832" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/thephpleague/uri/zipball/c0bf6dfa86b7804fe870b3f3d9c653e35a2c9e3e", - "reference": "c0bf6dfa86b7804fe870b3f3d9c653e35a2c9e3e", + "url": "https://api.github.com/repos/thephpleague/uri/zipball/8b644f8ff80352530bbc0ea467d5b5a89b60d832", + "reference": "8b644f8ff80352530bbc0ea467d5b5a89b60d832", "shasum": "" }, "require": { - "league/uri-interfaces": "^7.1", + "league/uri-interfaces": "^7.2", "php": "^8.1" }, "conflict": { @@ -3063,7 +3063,7 @@ "docs": "https://uri.thephpleague.com", "forum": "https://thephpleague.slack.com", "issues": "https://github.com/thephpleague/uri-src/issues", - "source": "https://github.com/thephpleague/uri/tree/7.1.0" + "source": "https://github.com/thephpleague/uri/tree/7.2.1" }, "funding": [ { @@ -3071,20 +3071,20 @@ "type": "github" } ], - "time": "2023-08-21T20:15:03+00:00" + "time": "2023-08-30T21:06:57+00:00" }, { "name": "league/uri-interfaces", - "version": "7.1.0", + "version": "7.2.0", "source": { "type": "git", "url": "https://github.com/thephpleague/uri-interfaces.git", - "reference": "c3ea9306c67c9a1a72312705e8adfcb9cf167310" + "reference": "43fa071050fcba89aefb5d4789a4a5a73874c44b" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/thephpleague/uri-interfaces/zipball/c3ea9306c67c9a1a72312705e8adfcb9cf167310", - "reference": "c3ea9306c67c9a1a72312705e8adfcb9cf167310", + "url": "https://api.github.com/repos/thephpleague/uri-interfaces/zipball/43fa071050fcba89aefb5d4789a4a5a73874c44b", + "reference": "43fa071050fcba89aefb5d4789a4a5a73874c44b", "shasum": "" }, "require": { @@ -3147,7 +3147,7 @@ "docs": "https://uri.thephpleague.com", "forum": "https://thephpleague.slack.com", "issues": "https://github.com/thephpleague/uri-src/issues", - "source": "https://github.com/thephpleague/uri-interfaces/tree/7.1.0" + "source": "https://github.com/thephpleague/uri-interfaces/tree/7.2.0" }, "funding": [ { @@ -3155,7 +3155,7 @@ "type": "github" } ], - "time": "2023-08-21T20:15:03+00:00" + "time": "2023-08-30T19:43:38+00:00" }, { "name": "monolog/monolog", @@ -8453,7 +8453,7 @@ "source": { "type": "git", "url": "https://github.com/cassidoxa/ALttPEntranceRandomizer", - "reference": "408e9c2fc6400ddfcbdbd5c701782a3e64f79adb" + "reference": "eeba10fd8b9ca0f10e943a1bbe25505b67cf6064" }, "type": "library" }, @@ -8463,7 +8463,7 @@ "source": { "type": "git", "url": "https://github.com/KatDevsGames/z3randomizer", - "reference": "4c98268d812e7546e247b79aac8f2df077c9e209" + "reference": "90c8e95f9b3351326884863edd8ce901f7b04276" }, "type": "library" } diff --git a/package-lock.json b/package-lock.json index 58b14cf52..703f8ab1f 100644 --- a/package-lock.json +++ b/package-lock.json @@ -3191,6 +3191,16 @@ "node": ">=0.10.0" } }, + "node_modules/bindings": { + "version": "1.5.0", + "resolved": "https://registry.npmjs.org/bindings/-/bindings-1.5.0.tgz", + "integrity": "sha512-p2q/t/mhvuOj/UeLlV6566GD/guowlr0hHxClI0W9m7MWYkL1F0hLo+0Aexs9HSPCtR1SXQ0TD3MMKrXZajbiQ==", + "dev": true, + "optional": true, + "dependencies": { + "file-uri-to-path": "1.0.0" + } + }, "node_modules/bluebird": { "version": "3.7.0", "dev": true, @@ -6033,6 +6043,13 @@ "node": ">=6" } }, + "node_modules/file-uri-to-path": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/file-uri-to-path/-/file-uri-to-path-1.0.0.tgz", + "integrity": "sha512-0Zt+s3L7Vf1biwWZ29aARiVYLx7iMGnEUl9x33fbB/j3jR81u/O2LbqK+Bm1CDSNDKVtJ/YjwY7TUd5SkeLQLw==", + "dev": true, + "optional": true + }, "node_modules/filesize": { "version": "3.6.1", "dev": true, @@ -8426,6 +8443,13 @@ "dev": true, "license": "ISC" }, + "node_modules/nan": { + "version": "2.17.0", + "resolved": "https://registry.npmjs.org/nan/-/nan-2.17.0.tgz", + "integrity": "sha512-2ZTgtl0nJsO0KQCjEpxcIr5D+Yv90plTitZt9JBfQvVJDS5seMl3FOvsh3+9CoYWXf/1l5OaZzzF6nDm4cagaQ==", + "dev": true, + "optional": true + }, "node_modules/nanomatch": { "version": "1.2.13", "dev": true, @@ -16501,6 +16525,16 @@ "version": "1.13.1", "dev": true }, + "bindings": { + "version": "1.5.0", + "resolved": "https://registry.npmjs.org/bindings/-/bindings-1.5.0.tgz", + "integrity": "sha512-p2q/t/mhvuOj/UeLlV6566GD/guowlr0hHxClI0W9m7MWYkL1F0hLo+0Aexs9HSPCtR1SXQ0TD3MMKrXZajbiQ==", + "dev": true, + "optional": true, + "requires": { + "file-uri-to-path": "1.0.0" + } + }, "bluebird": { "version": "3.7.0", "dev": true @@ -18546,6 +18580,13 @@ "version": "10.11.0", "dev": true }, + "file-uri-to-path": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/file-uri-to-path/-/file-uri-to-path-1.0.0.tgz", + "integrity": "sha512-0Zt+s3L7Vf1biwWZ29aARiVYLx7iMGnEUl9x33fbB/j3jR81u/O2LbqK+Bm1CDSNDKVtJ/YjwY7TUd5SkeLQLw==", + "dev": true, + "optional": true + }, "filesize": { "version": "3.6.1", "dev": true @@ -20186,6 +20227,13 @@ "version": "0.0.8", "dev": true }, + "nan": { + "version": "2.17.0", + "resolved": "https://registry.npmjs.org/nan/-/nan-2.17.0.tgz", + "integrity": "sha512-2ZTgtl0nJsO0KQCjEpxcIr5D+Yv90plTitZt9JBfQvVJDS5seMl3FOvsh3+9CoYWXf/1l5OaZzzF6nDm4cagaQ==", + "dev": true, + "optional": true + }, "nanomatch": { "version": "1.2.13", "dev": true, diff --git a/resources/js/rom.js b/resources/js/rom.js index d89fc43ed..880d9c786 100644 --- a/resources/js/rom.js +++ b/resources/js/rom.js @@ -355,37 +355,71 @@ export default class ROM { setHeartColor(color_on) { return new Promise(resolve => { - let byte = 0x24; - let file_byte = 0x05; - if (color_on === "random") { - const colorOptions = ["blue", "green", "yellow", "red"]; - color_on = colorOptions[Math.floor(Math.random() * colorOptions.length)]; - }; - - switch (color_on) { - case "blue": - byte = 0x01; - - break; - case "green": - byte = 0x02; - - break; - case "yellow": - byte = 0x03; + // Check ROM major version or for vanilla 0xFF value + let version = new Uint8Array(this.arrayBuffer)[0x7FE2]; + if (version <= 0x03 || version == 0xFF) { + let byte = 0x24; + let file_byte = 0x05; + + if (color_on === "random") { + const colorOptions = ["blue", "green", "yellow", "red"]; + color_on = colorOptions[Math.floor(Math.random() * colorOptions.length)]; + }; + + switch (color_on) { + case "blue": + byte = 0x2c; + file_byte = 0x0d; + break; + case "green": + byte = 0x3c; + file_byte = 0x19; + break; + case "yellow": + byte = 0x28; + file_byte = 0x09; + break; + case "red": + default: + // do nothing + } - break; - case "red": - byte = 0x00; + this.write(0x6fa1e, byte); + this.write(0x6fa20, byte); + this.write(0x6fa22, byte); + this.write(0x6fa24, byte); + this.write(0x6fa26, byte); + this.write(0x6fa28, byte); + this.write(0x6fa2a, byte); + this.write(0x6fa2c, byte); + this.write(0x6fa2e, byte); + this.write(0x6fa30, byte); + this.write(0x65561, file_byte); + } else { + if (color_on === "random") { + const colorOptions = ["blue", "green", "yellow", "red"]; + color_on = colorOptions[Math.floor(Math.random() * colorOptions.length)]; + }; + let byte = 0x00; + + switch (color_on) { + case "blue": + byte = 0x01; + break; + case "green": + byte = 0x02; + break; + case "yellow": + byte = 0x03; + break; + case "red": + default: + } - break; - default: - // do nothing + this.write(0x187020, byte); } - this.write(0x187020, byte); - resolve(this); }); }