Rename json files to .parkpatch using scenario hash

This commit is contained in:
Tulio Leao 2024-02-25 11:56:48 -03:00
parent 8c56982613
commit f50c8cce4b
59 changed files with 264 additions and 14 deletions

View file

@ -1,4 +1,6 @@
{
"scenario_name": "Three Monkeys Park",
"sha256": "0153987dbf8e1ec665205d7b39aeb4b88cf1f24dcadba61cf352ee22a919fcdb",
"land_ownership": {
"owned": {
"coordinates": [

View file

@ -1,4 +1,6 @@
{
"scenario_name": "Rotting Heights",
"sha256": "0844655d058e2f4cb3a8ead6c2a44d0c1b6512a36f36f2c2cbb3a7f313c1ad63",
"land_ownership": {
"owned": {
"coordinates": [

View file

@ -1,4 +1,6 @@
{
"scenario_name": "Utopia Park",
"sha256": "0dcee4815ded0995d5b2b675e409eb2d37814194e4c8cea8ce1dbff5b1e9d91b",
"land_ownership": {
"available": {
"coordinates": [

View file

@ -1,4 +1,6 @@
{
"scenario_name": "Haunted Harbour",
"sha256": "102a1c52853e77b6efd448a44572a862fa440615b4ea9ae5d7fb31c48c96aac9",
"land_ownership": {
"available": {
"coordinates": [

View file

@ -1,4 +1,6 @@
{
"scenario_name": "Nevermore Park",
"sha256": "1286934695bee6bee94d9111ad4fd52bf61eab501837422c831d427e2f254eda",
"land_ownership": {
"owned": {
"coordinates": [

View file

@ -1,4 +1,6 @@
{
"scenario_name": "Australasia - Fun at the Beach",
"sha256": "1340eefc16e867a39eb597febabf12a9207146615fb419de20f486e2f06242de",
"land_ownership": {
"unowned": {
"coordinates": [

View file

@ -1,4 +1,6 @@
{
"scenario_name": "South America - Inca Lost City",
"sha256": "13e81f23ab1a7051b5465e4a7bb214b4188f2264d499f8f7e106372c3a984331",
"land_ownership": {
"unowned": {
"coordinates": [

View file

@ -1,4 +1,6 @@
{
"scenario_name": "Antarctic - Ecological Salvage",
"sha256": "17f0c69511d88f3cbc00eaf4aea5ccc9002c2c1dedd5f7387a7256cb943d8cde",
"land_ownership": {
"unowned": {
"coordinates": [

View file

@ -1,4 +1,6 @@
{
"scenario_name": "Europe - European Cultural Festival",
"sha256": "1c3ea4505f2341a76c55ca51e51034b649467def4002b7ee1825324355c51406",
"land_ownership": {
"owned": {
"coordinates": [

View file

@ -1,4 +1,6 @@
{
"scenario_name": "Six Flags over Texas",
"sha256": "229cf5777d1b90034f3b711eed45c4d6ab9a368a466fd4db758a1eac21632a35",
"land_ownership": {
"construction_rights_owned": {
"cannot_downgrade": true,

View file

@ -1,4 +1,6 @@
{
"scenario_name": "Africa - Oasis",
"sha256": "2696a059c2c1b23c60cbfcc293fd29cfec45d7e3da7f3b38bc2b52aff834fd34",
"land_ownership": {
"unowned": {
"coordinates": [

View file

@ -1,4 +1,6 @@
{
"scenario_name": "Dynamite Dunes",
"sha256": "287e87db95f51dd1594b7568bbdd22cadece87749216d2f65a6ff3b506018eb3",
"land_ownership": {
"available": {
"coordinates": [

View file

@ -1,4 +1,6 @@
{
"scenario_name": "Pleasure Island",
"sha256": "32cce5dcb86cf9e7f5b061ee49e737dbb845b46da54792d7b7f33b7a11b0bca1",
"land_ownership": {
"construction_rights_owned": {
"coordinates": [

View file

@ -1,4 +1,6 @@
{
"scenario_name": "Prehistoric - Stone Age",
"sha256": "33bac63d13aa7513ac8536d865cbc6fa4a2189c79e3943869e6380072e71bce7",
"land_ownership": {
"available": {
"cannot_downgrade": true,

View file

@ -1,4 +1,6 @@
{
"scenario_name": "Mel's World",
"sha256": "3767ef3e2a8524e16cebe29e18148499dd8c91abe049e5f39011037ba41a8065",
"land_ownership": {
"owned": {
"coordinates": [

View file

@ -1,4 +1,6 @@
{
"scenario_name": "Six Flags Great Adventure",
"sha256": "37d31a4f272f58bacc97b16743dc6bd3d6fa778a0a944d788b4ed9ab20839030",
"land_ownership": {
"unowned": {
"coordinates": [

View file

@ -1,4 +1,6 @@
{
"scenario_name": "Crazy Castle",
"sha256": "3a2ca59166d8a0286feb8404ead68e0d83b47026b7e4015852b770e3fd4bf125",
"land_ownership": {
"available": {
"coordinates": [

View file

@ -1,4 +1,6 @@
{
"scenario_name": "Prehistoric - Jurassic Safari",
"sha256": "4ec6b381faf6b576f38c59a16ee441b9ed680e4bb38a9320e58e65dfd3f12c94",
"land_ownership": {
"construction_rights_owned": {
"cannot_downgrade": true,

View file

@ -1,4 +1,6 @@
{
"scenario_name": "Alton Towers",
"sha256": "5c95a4ec28579851972547dce4f4f1ca4bb241808baacf33e57c3076d6a40a69",
"land_ownership": {
"available": {
"coordinates": [

View file

@ -1,4 +1,6 @@
{
"scenario_name": "Blackpool Pleasure Beach",
"sha256": "608cd8a781cde0ae3604fc291f027f14354396700bc5f22292e3de0272f6fe05",
"land_ownership": {
"owned": {
"coordinates": [

View file

@ -1,4 +1,6 @@
{
"scenario_name": "Woodworm Park",
"sha256": "66ab5d1e8412c94cd6bfa40a664167df7df651d67b90da2a612108212ebc98d3",
"land_ownership": {
"owned": {
"coordinates": [

View file

@ -1,4 +1,6 @@
{
"scenario_name": "Coaster Canyon",
"sha256": "68a69f3c7db661430ce94e23caba7e31d14e822ea13f4ad32e5455c3c26354fa",
"land_ownership": {
"owned": {
"coordinates": [

View file

@ -1,4 +1,6 @@
{
"scenario_name": "North America - Grand Canyon",
"sha256": "6ce84b809471ba539d94d4198832b848b47d81316f5c8cc1297d8328299b4c52",
"land_ownership": {
"available": {
"cannot_downgrade": true,

View file

@ -1,4 +1,6 @@
{
"scenario_name": "katie's dreamland - s4",
"sha256": "73d0921f1d49388ffb4deb300c6ebb3920564410c2239580a7d1145fa54c2d4a",
"land_ownership": {
"available": {
"coordinates": [

View file

@ -1,4 +1,6 @@
{
"scenario_name": "Build your own Six Flags Magic Mountain",
"sha256": "7ffdb448eccc8e24026e820f5e1d5649459b5ee5d469afdaa73e87d31475f2b0",
"land_ownership": {
"available": {
"cannot_downgrade": true,

View file

@ -1,4 +1,6 @@
{
"scenario_name": "Pacific Pyramids",
"sha256": "80099be793f965c67ac0106109308e61dbb1d229a52b9797e468aa279c97fee0",
"land_ownership": {
"available": {
"coordinates": [

View file

@ -1,4 +1,6 @@
{
"scenario_name": "Asia - Japanese Coastal Reclaim",
"sha256": "810829891e1bafa33b9ccc6c296bcfb1fc86b6d812c1fea28899b5e47c048628",
"land_ownership": {
"owned": {
"coordinates": [

View file

@ -1,4 +1,6 @@
{
"scenario_name": "Pokey Park",
"sha256": "815b6f6b626cf178c02cc0e4c75b71bb100cc52a503129d9d5c03c6264e733b8",
"land_ownership": {
"available": {
"coordinates": [

View file

@ -1,4 +1,6 @@
{
"scenario_name": "Dark Age - Robin Hood",
"sha256": "825134aad8365e12efba50b58f67e96b729640e6ff4007dfe5dffe99c167531f",
"land_ownership": {
"available": {
"cannot_downgrade": true,

View file

@ -1,4 +1,6 @@
{
"scenario_name": "Trinity Islands",
"sha256": "829abd64d95a646e6a1462b1465588e434e0b1b42d9857308687b7986b558a57",
"land_ownership": {
"construction_rights_owned": {
"coordinates": [

View file

@ -1,4 +1,6 @@
{
"scenario_name": "Urban Park",
"sha256": "835ec8bdba3dc4086906126907c022cf42fa0f9cd6ee06221f36aac526ac4ec4",
"land_ownership": {
"owned": {
"coordinates": [

View file

@ -1,4 +1,6 @@
{
"scenario_name": "Leafy Lake",
"sha256": "83bd798a9755acf3ba8b9fe1ccad5dee3816a5d595ca53ff566882c357dcf733",
"land_ownership": {
"available": {
"coordinates": [

View file

@ -1,4 +1,6 @@
{
"scenario_name": "Australasia - Ayers Rock",
"sha256": "8cd8484dd39c03485cdbd490509e19b252478810fb1fbce55582a2e22f9b69f6",
"tiles": {
"type": "track",
"operations": [

View file

@ -1,4 +1,6 @@
{
"scenario_name": "Grand Glacier",
"sha256": "92f4b50037a2f85d3fb05ce6a07e27d73c6e61ab2cb5f8b00f5c2f98e95b356c",
"land_ownership": {
"owned": {
"coordinates": [

View file

@ -1,4 +1,6 @@
{
"scenario_name": "Dark Age - Castle",
"sha256": "9c8b7cf36bddc9e354b270b3027f74cd802d2fe4d22df954db797890a3ca81e8",
"land_ownership": {
"owned": {
"coordinates": [

View file

@ -1,4 +1,6 @@
{
"scenario_name": "Great Wall of China Tourism Enhancement",
"sha256": "e72d720a27ad13d07bb017b8f6da1b73c77fee00f648c65e3f593c8a60f0e236",
"land_ownership": {
"owned": {
"coordinates": [

View file

@ -1,4 +1,6 @@
{
"scenario_name": "WW Africa - Oasis",
"sha256": "2696a059c2c1b23c60cbfcc293fd29cfec45d7e3da7f3b38bc2b52aff834fd34",
"land_ownership": {
"unowned": {
"coordinates": [

View file

@ -1,4 +1,6 @@
{
"scenario_name": "WW Asia - Japanese Coastal Reclaim",
"sha256": "810829891e1bafa33b9ccc6c296bcfb1fc86b6d812c1fea28899b5e47c048628",
"land_ownership": {
"owned": {
"coordinates": [

View file

@ -1,4 +1,6 @@
{
"scenario_name": "N America - Extreme Hawaiian Island",
"sha256": "aaad3e787741a253bd8dcb866c67ea50d78489bec0a5f9b01778362b9905b715",
"land_ownership": {
"owned": {
"coordinates": [

View file

@ -1,4 +1,6 @@
{
"scenario_name": "White Water Park",
"sha256": "ba94426ecde1d6b375f566b155573e8a1471dcf62c651bafcb751f04f542cd5c",
"land_ownership": {
"construction_rights_owned": {
"coordinates": [

View file

@ -1,4 +1,6 @@
{
"scenario_name": "Extreme Heights",
"sha256": "c2153130813a127e67355662e385025936a427b8628bbc129cc7fc20b9ac49af",
"land_ownership": {
"owned": {
"coordinates": [

View file

@ -1,4 +1,6 @@
{
"scenario_name": "Europe - Renovation",
"sha256": "c4fa992e3d54c89d3932614e903daad0f955fc3f848021de437d5ff03ab11941",
"land_ownership": {
"owned": {
"coordinates": [

View file

@ -1,4 +1,6 @@
{
"scenario_name": "Six Flags Magic Mountain",
"sha256": "c82272a1e966e54863b3b90ba4c90e37ed8ef8b99253d284bb7cc56f9590d97a",
"land_ownership": {
"available": {
"cannot_downgrade": true,

View file

@ -1,4 +1,6 @@
{
"scenario_name": "Six Flags Holland",
"sha256": "d0553271f6fe9ff7bb6a5e7e5735c553340dfcdfb103d5ff3e332d4841938ddd",
"land_ownership": {
"available": {
"cannot_downgrade": true,

View file

@ -1,4 +1,6 @@
{
"scenario_name": "Rock 'n' Roll - Rock 'n' Roll",
"sha256": "d48bbfe4833347dfbf5befe63eb3795df3bce36cdc9152048ee7851e36d45ad9",
"land_ownership": {
"available": {
"cannot_downgrade": true,

View file

@ -1,4 +1,6 @@
{
"scenario_name": "Ghost Town",
"sha256": "db352d3dcf74b8a1931963c4e07e8c23802227bb1d31d8c57b97c3239a382f5e",
"land_ownership": {
"owned": {
"coordinates": [

View file

@ -1,4 +1,6 @@
{
"scenario_name": "Roaring Twenties - Schneider Cup",
"sha256": "e57112f58a7710d3e80242e867fb65d720e0cd3b67bebfd6b7df8b404fc7ea2b",
"land_ownership": {
"construction_rights_available": {
"cannot_downgrade": true,

View file

@ -1,4 +1,6 @@
{
"scenario_name": "Fort Anachronism",
"sha256": "e93677fc42c8b657fddb3c92bfeebcda868c7dd2d2a352f719302778a1c676bd",
"land_ownership": {
"available": {
"coordinates": [

View file

@ -1,4 +1,6 @@
{
"scenario_name": "Mythological - Cradle of Civilization",
"sha256": "ef0c0202510d84cf4f1ad198ae43b6bc00d5af2d664c60cdb38de632ea25db51",
"land_ownership": {
"available": {
"cannot_downgrade": true,

View file

@ -1,4 +1,6 @@
{
"scenario_name": "Asia - Maharaja Palace",
"sha256": "f4b1675c8ccb31d422c1b7b8bd5336b2bfefa94d702aeae1859ea95ecda2c29d",
"land_ownership": {
"available": {
"cannot_downgrade": true,

View file

@ -1,4 +1,6 @@
{
"scenario_name": "Infernal Views",
"sha256": "fcc15f9c9b42bdd4aa8761c3a6df17c1293aa616780bc4aadd348d191e275112",
"water": [
{
"height": 96,

View file

@ -1,4 +1,6 @@
{
"scenario_name": "Mystic Mountain",
"sha256": "fd4c6ee6c27a3831564a67b5edf8fafe7b0ad309e5abb82bff822eecf5548343",
"land_ownership": {
"available": {
"coordinates": [

View file

@ -1,4 +1,6 @@
{
"scenario_name": "Mythological - Animatronic Film Set",
"sha256": "ff52987c70ea89deb5c1b8445b7a689c8b83e22b5aef18bb4bbd07375b27f47e",
"land_ownership": {
"construction_rights_owned": {
"cannot_downgrade": true,

View file

@ -1,4 +1,6 @@
{
"scenario_name": "katie's dreamland",
"sha256": "73d0921f1d49388ffb4deb300c6ebb3920564410c2239580a7d1145fa54c2d4a",
"land_ownership": {
"construction_rights_owned": {
"coordinates": [

View file

@ -0,0 +1,107 @@
// This file serves no purpose other than documenting what are the scenarios with patches applied and their hashes
// RCT2 Scenario names to hashes
'Africa - Oasis': ['2696a05',
'2696a059c2c1b23c60cbfcc293fd29cfec45d7e3da7f3b38bc2b52aff834fd34'],
'Antarctic - Ecological Salvage': ['17f0c69',
'17f0c69511d88f3cbc00eaf4aea5ccc9002c2c1dedd5f7387a7256cb943d8cde'],
'Asia - Great Wall of China Tourism Enhancement': ['e72d720',
'e72d720a27ad13d07bb017b8f6da1b73c77fee00f648c65e3f593c8a60f0e236'],
'Asia - Japanese Coastal Reclaim': ['8108298',
'810829891e1bafa33b9ccc6c296bcfb1fc86b6d812c1fea28899b5e47c048628'],
'Asia - Maharaja Palace': ['f4b1675',
'f4b1675c8ccb31d422c1b7b8bd5336b2bfefa94d702aeae1859ea95ecda2c29d'],
'Australasia - Ayers Rock': ['8cd8484',
'8cd8484dd39c03485cdbd490509e19b252478810fb1fbce55582a2e22f9b69f6'],
'Australasia - Fun at the Beach': ['1340eef',
'1340eefc16e867a39eb597febabf12a9207146615fb419de20f486e2f06242de'],
'Build your own Six Flags Magic Mountain': ['7ffdb44',
'7ffdb448eccc8e24026e820f5e1d5649459b5ee5d469afdaa73e87d31475f2b0'],
'Crazy Castle': ['3a2ca59',
'3a2ca59166d8a0286feb8404ead68e0d83b47026b7e4015852b770e3fd4bf125'],
'Dark Age - Castle': ['9c8b7cf',
'9c8b7cf36bddc9e354b270b3027f74cd802d2fe4d22df954db797890a3ca81e8'],
'Dark Age - Robin Hood': ['825134a',
'825134aad8365e12efba50b58f67e96b729640e6ff4007dfe5dffe99c167531f'],
'Europe - European Cultural Festival': ['1c3ea45',
'1c3ea4505f2341a76c55ca51e51034b649467def4002b7ee1825324355c51406'],
'Europe - Renovation': ['c4fa992',
'c4fa992e3d54c89d3932614e903daad0f955fc3f848021de437d5ff03ab11941'],
'Extreme Heights': ['c215313',
'c2153130813a127e67355662e385025936a427b8628bbc129cc7fc20b9ac49af'],
'Ghost Town': ['db352d3',
'db352d3dcf74b8a1931963c4e07e8c23802227bb1d31d8c57b97c3239a382f5e'],
'Infernal Views': ['fcc15f9',
'fcc15f9c9b42bdd4aa8761c3a6df17c1293aa616780bc4aadd348d191e275112'],
'Mythological - Animatronic Film Set': ['ff52987',
'ff52987c70ea89deb5c1b8445b7a689c8b83e22b5aef18bb4bbd07375b27f47e'],
'Mythological - Cradle of Civilization': ['ef0c020',
'ef0c0202510d84cf4f1ad198ae43b6bc00d5af2d664c60cdb38de632ea25db51'],
'N America - Extreme Hawaiian Island': ['aaad3e7',
'aaad3e787741a253bd8dcb866c67ea50d78489bec0a5f9b01778362b9905b715'],
'North America - Grand Canyon': ['6ce84b8',
'6ce84b809471ba539d94d4198832b848b47d81316f5c8cc1297d8328299b4c52'],
'Prehistoric - Jurassic Safari': ['4ec6b38',
'4ec6b381faf6b576f38c59a16ee441b9ed680e4bb38a9320e58e65dfd3f12c94'],
'Prehistoric - Stone Age': ['33bac63',
'33bac63d13aa7513ac8536d865cbc6fa4a2189c79e3943869e6380072e71bce7'],
'Roaring Twenties - Schneider Cup': ['e57112f',
'e57112f58a7710d3e80242e867fb65d720e0cd3b67bebfd6b7df8b404fc7ea2b'],
"Rock 'n' Roll - Rock 'n' Roll": ['d48bbfe',
'd48bbfe4833347dfbf5befe63eb3795df3bce36cdc9152048ee7851e36d45ad9'],
'Six Flags Great Adventure': ['37d31a4',
'37d31a4f272f58bacc97b16743dc6bd3d6fa778a0a944d788b4ed9ab20839030'],
'Six Flags Holland': ['d055327',
'd0553271f6fe9ff7bb6a5e7e5735c553340dfcdfb103d5ff3e332d4841938ddd'],
'Six Flags Magic Mountain': ['c82272a',
'c82272a1e966e54863b3b90ba4c90e37ed8ef8b99253d284bb7cc56f9590d97a'],
'Six Flags over Texas': ['229cf57',
'229cf5777d1b90034f3b711eed45c4d6ab9a368a466fd4db758a1eac21632a35'],
'South America - Inca Lost City': ['13e81f2',
'13e81f23ab1a7051b5465e4a7bb214b4188f2264d499f8f7e106372c3a984331'],
// RCT1 Scenario names to hashes
'Alton Towers': ['5c95a4e',
'5c95a4ec28579851972547dce4f4f1ca4bb241808baacf33e57c3076d6a40a69'],
'Blackpool Pleasure Beach': ['608cd8a',
'608cd8a781cde0ae3604fc291f027f14354396700bc5f22292e3de0272f6fe05'],
'Coaster Canyon': ['68a69f3',
'68a69f3c7db661430ce94e23caba7e31d14e822ea13f4ad32e5455c3c26354fa'],
'Dynamite Dunes': ['287e87d',
'287e87db95f51dd1594b7568bbdd22cadece87749216d2f65a6ff3b506018eb3'],
'Fort Anachronism': ['e93677f',
'e93677fc42c8b657fddb3c92bfeebcda868c7dd2d2a352f719302778a1c676bd'],
'Grand Glacier': ['92f4b50',
'92f4b50037a2f85d3fb05ce6a07e27d73c6e61ab2cb5f8b00f5c2f98e95b356c'],
'Haunted Harbour': ['102a1c5',
'102a1c52853e77b6efd448a44572a862fa440615b4ea9ae5d7fb31c48c96aac9'],
'katie's dreamland': ['73d0921',
'73d0921f1d49388ffb4deb300c6ebb3920564410c2239580a7d1145fa54c2d4a'],
'Leafy Lake': ['83bd798',
'83bd798a9755acf3ba8b9fe1ccad5dee3816a5d595ca53ff566882c357dcf733'],
'Mel's World': ['3767ef3',
'3767ef3e2a8524e16cebe29e18148499dd8c91abe049e5f39011037ba41a8065'],
'Mystic Mountain': ['fd4c6ee',
'fd4c6ee6c27a3831564a67b5edf8fafe7b0ad309e5abb82bff822eecf5548343'],
'Nevermore Park': ['1286934',
'1286934695bee6bee94d9111ad4fd52bf61eab501837422c831d427e2f254eda'],
'Pacific Pyramids': ['80099be',
'80099be793f965c67ac0106109308e61dbb1d229a52b9797e468aa279c97fee0'],
'Pleasure Island': ['32cce5d',
'32cce5dcb86cf9e7f5b061ee49e737dbb845b46da54792d7b7f33b7a11b0bca1'],
'Pokey Park': ['815b6f6',
'815b6f6b626cf178c02cc0e4c75b71bb100cc52a503129d9d5c03c6264e733b8'],
'Rotting Heights': ['0844655',
'0844655d058e2f4cb3a8ead6c2a44d0c1b6512a36f36f2c2cbb3a7f313c1ad63'],
'Three Monkeys Park': ['0153987',
'0153987dbf8e1ec665205d7b39aeb4b88cf1f24dcadba61cf352ee22a919fcdb'],
'Trinity Islands': ['829abd6',
'829abd64d95a646e6a1462b1465588e434e0b1b42d9857308687b7986b558a57'],
'Urban Park': ['835ec8b',
'835ec8bdba3dc4086906126907c022cf42fa0f9cd6ee06221f36aac526ac4ec4'],
'Utopia Park': ['0dcee48',
'0dcee4815ded0995d5b2b675e409eb2d37814194e4c8cea8ce1dbff5b1e9d91b'],
'Woodworm Park': ['66ab5d1',
'66ab5d1e8412c94cd6bfa40a664167df7df651d67b90da2a612108212ebc98d3'],
'White Water Park': ['ba94426',
'ba94426ecde1d6b375f566b155573e8a1471dcf62c651bafcb751f04f542cd5c']

View file

@ -194,8 +194,7 @@ namespace OpenRCT2::RCT1
ImportSavedView();
// TODO: investigate why Katie's Dreamland.s4 and .sea have different patches
// TODO: s4 patch system is broken since .s4 files do not use scenario name, but rather slot
RCT12::FetchAndApplyScenarioPatch(_s4.ScenarioName, _isScenario);
RCT12::FetchAndApplyScenarioPatch(_s4Path, _isScenario);
FixNextGuestNumber(gameState);
CountBlockSections();
SetDefaultNames();

View file

@ -12,6 +12,7 @@
#include "../Context.h"
#include "../Game.h"
#include "../PlatformEnvironment.h"
#include "../core/Crypt.h"
#include "../core/File.h"
#include "../core/Guard.hpp"
#include "../core/Json.hpp"
@ -29,6 +30,9 @@
#include <iostream>
// Generic keys
static const std::string s_scenarioNameKey = "scenario_name";
static const std::string s_fullSHAKey = "sha256";
static const std::string s_coordinatesKey = "coordinates";
// Land Ownership Keys
@ -377,22 +381,58 @@ static void ApplyRideFixes(const json_t& scenarioPatch)
}
}
static u8string GetPatchFileName(u8string_view scenarioName)
static u8string getScenarioSHA256(u8string_view scenarioPath)
{
auto env = OpenRCT2::GetContext()->GetPlatformEnvironment();
std::cout << "Scenario path is: " << scenarioPath << std::endl;
auto scenarioData = File::ReadAllBytes(scenarioPath);
auto scenarioHash = Crypt::SHA256(scenarioData.data(), scenarioData.size());
std::cout << "ScenarioHash is: " << String::StringFromHex(scenarioHash) << std::endl;
return String::StringFromHex(scenarioHash);
}
static u8string GetPatchFileName(u8string_view scenarioHash)
{
auto env = OpenRCT2::GetContext()->GetPlatformEnvironment();
auto scenarioPatches = env->GetDirectoryPath(OpenRCT2::DIRBASE::OPENRCT2, OpenRCT2::DIRID::SCENARIO_PATCHES);
auto scenarioPatchFile = Path::WithExtension(Path::GetFileNameWithoutExtension(scenarioName), ".json");
auto scenarioPatchFile = Path::WithExtension(scenarioHash.substr(0, 7), ".parkpatch");
return Path::Combine(scenarioPatches, scenarioPatchFile);
}
void RCT12::FetchAndApplyScenarioPatch(u8string_view scenarioName, bool isScenario)
static bool ValidateSHA256(const json_t& scenarioPatch, u8string_view scenarioHash)
{
auto patchPath = GetPatchFileName(scenarioName);
std::cout << "Path is: " << patchPath << std::endl;
// TODO: Check if case sensitive, some scenario names have all lowercase variations
if (!scenarioPatch.contains(s_scenarioNameKey))
{
Guard::Assert(0, "All .parkpatch files should contain the name of the original scenario");
return false;
}
if (!scenarioPatch.contains(s_fullSHAKey))
{
Guard::Assert(0, "All .parkpatch files should contain the sha256 of the original scenario");
return false;
}
auto scenarioName = Json::GetString(scenarioPatch[s_scenarioNameKey]);
auto scenarioSHA = Json::GetString(scenarioPatch[s_fullSHAKey]);
std::cout << "Validating Scenario '" << scenarioName << "' with SHA256 '" << scenarioSHA << "'" << std::endl;
return scenarioSHA == scenarioHash;
}
void RCT12::FetchAndApplyScenarioPatch(u8string_view scenarioPath, bool isScenario)
{
auto scenarioSHA = getScenarioSHA256(scenarioPath);
auto patchPath = GetPatchFileName(scenarioSHA);
std::cout << "Patch is: " << patchPath << " full SHA" << scenarioSHA << std::endl;
if (File::Exists(patchPath))
{
auto scenarioPatch = Json::ReadFromFile(patchPath);
if (!ValidateSHA256(scenarioPatch, scenarioSHA))
{
Guard::Assert(0, "Invalid full SHA256. Check for shortened SHA collision");
return;
}
// TODO: Land ownership is applied even when loading saved scenario. Should it?
ApplyLandOwnershipFixes(scenarioPatch);
if (isScenario)

View file

@ -13,5 +13,5 @@
namespace RCT12
{
void FetchAndApplyScenarioPatch(u8string_view scenarioName, bool isScenario);
void FetchAndApplyScenarioPatch(u8string_view scenarioPath, bool isScenario);
}

View file

@ -506,11 +506,7 @@ namespace OpenRCT2::RCT2
gameState.Park.Name = GetUserString(_s6.ParkName);
// Checking _s6.ScenarioFilename is generally more reliable as it survives renaming.
// However, some WW/TT scenarios have this incorrectly set to "Six Flags Magic Mountain.SC6",
// so for those cases (as well as for SFMM proper, well have to check the filename.
RCT12::FetchAndApplyScenarioPatch(
_s6.ScenarioFilename != gScenarioFileName ? gScenarioFileName : _s6.ScenarioFilename, _isScenario);
RCT12::FetchAndApplyScenarioPatch(_s6Path, _isScenario);
ResearchDetermineFirstOfType();
UpdateConsolidatedPatrolAreas();