Skip to content

Instantly share code, notes, and snippets.

@estelsmith
Last active March 29, 2021 11:22
Show Gist options
  • Save estelsmith/4aa0b48d2e898f6c363086161b1a5082 to your computer and use it in GitHub Desktop.
Save estelsmith/4aa0b48d2e898f6c363086161b1a5082 to your computer and use it in GitHub Desktop.
Updates the download button on emulator.games to ROM pages to link directly to the file download
// ==UserScript==
// @name emulator.games download
// @version 0.0.2
// @description Fixes the download button on emulator.games to actually download ROMs
// @author estelsmith
// @match https://emulator.games/roms/*/*/
// @grant none
// ==/UserScript==
(function($, romId) {
'use strict';
var infoUrl = '/get.php';
$(function () {
var link = document.querySelector('a#rom-link');
var buttonText = link.querySelector('.dl-text');
var deferred = $.ajax({
method: 'POST',
url: infoUrl,
dataType: 'json',
data: {
set_type: 'rom',
set_id: romId
}
});
deferred.done(function (responseData) {
if (responseData.length >= 4 && responseData[3]) {
var downloadUrl = responseData[3];
$(link).attr('href', encodeURI(downloadUrl));
$(buttonText).text('Download Now (for real)');
}
});
});
})(jQuery, set_id);
@estelsmith
Copy link
Author

estelsmith commented Mar 8, 2019

Why

Emulator.Games is a decent resource to find and download ROMs if you know how to get past their broken download system.

When trying to download ROMs from this site, you are brought to a page with the following countdown: Your Download is Starting in 30 second(s). Unfortunately, at the end of the countdown you are simply greeted with an error saying This game is unavailable.

This script updates the Download Now button to allow you to immediately download your ROM, skipping the broken download process.

How to use

Install Tampermonkey, then press the Raw button next to the emulator.games.user.js file in this Gist. Tampermonkey will prompt you to install the script.

That's it!!

When you visit a ROM page, the download link will be changed from Download Now to Download Now (for real), indicating the link has been updated.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment