Skip to content

Commit

Permalink
Adding SMS to MegaDrive too
Browse files Browse the repository at this point in the history
  • Loading branch information
theypsilon authored Sep 11, 2023
1 parent 0a7d6f1 commit ac97156
Showing 1 changed file with 11 additions and 7 deletions.
18 changes: 11 additions & 7 deletions .github/download_cheats.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,16 +59,20 @@ def install_cheats(target_dir):
cheat_zips = collect_cheat_zips(page_url + '/?script=fetchcheats')

for cheat_key, cheat_platform in cheats_mapping.items():
install_cheats_platform(cheat_key, cheat_platform, page_url, cheat_zips)
if cheat_key == 'sms':
install_cheats_platform(cheat_key, 'MegaDrive', page_url, cheat_zips)

cheat_zip = next(cheat_zip for cheat_zip in cheat_zips if cheat_key in cheat_zip)
cheat_url = f'{page_url}/{cheat_zip}?script=fetchcheats'
tmp_zip = f'/tmp/{cheat_key}{cheat_platform}.zip'
cheat_folder = f'{target_dir}/Cheats/{cheat_platform}'
def install_cheats_platform(cheat_key, cheat_platform, page_url, cheat_zips):
cheat_zip = next(cheat_zip for cheat_zip in cheat_zips if cheat_key in cheat_zip)
cheat_url = f'{page_url}/{cheat_zip}?script=fetchcheats'
tmp_zip = f'/tmp/{cheat_key}{cheat_platform}.zip'
cheat_folder = f'{target_dir}/Cheats/{cheat_platform}'

print(f'cheat_keys: {cheat_key}, cheat_platform: {cheat_platform}, cheat_zip: {cheat_zip}, cheat_url: {cheat_url}', flush=True)
print(f'cheat_keys: {cheat_key}, cheat_platform: {cheat_platform}, cheat_zip: {cheat_zip}, cheat_url: {cheat_url}', flush=True)

download_file(cheat_url, tmp_zip)
unzip(tmp_zip, cheat_folder)
download_file(cheat_url, tmp_zip)
unzip(tmp_zip, cheat_folder)

def collect_cheat_zips(url):
text = fetch_text(url)
Expand Down

0 comments on commit ac97156

Please sign in to comment.