Skip to content

Commit

Permalink
search bar added
Browse files Browse the repository at this point in the history
  • Loading branch information
TrapjawwS committed Apr 22, 2024
1 parent ab70afd commit a88f9bb
Show file tree
Hide file tree
Showing 2 changed files with 245 additions and 0 deletions.
223 changes: 223 additions & 0 deletions index copy.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,223 @@
<html>
<head>

<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/select2/4.0.0/js/select2.full.min.js"></script>

<style>
@import url(https://cdnjs.cloudflare.com/ajax/libs/select2/4.0.0/css/select2.min.css);
</style>

<script>
$(function () {
$("select").select2();
});
</script>

<style>
.game1 {
width: 100%;
height: 100%;
position: absolute;
top: 0;
left: 0;
overflow: hidden;
}

#game2 {
width: 100%;
height: 100%;
position: relative;
top: 0;
left: 0;
overflow: hidden;
}
</style>

<script src="https://raw.githack.com/TrapjawwS/funnyemulatorjs/main/script.js"></script>

<script>

function HMR3_getURL(){
var HMR3_formID = document.getElementById("HMR3_dropdown");
var HMR3_optionValue = HMR3_formID.value;
var HMR3_optionText = HMR3_formID.options[HMR3_formID.selectedIndex].text;
HMR3_runGame(HMR3_optionValue,HMR3_optionText);
}

function HMR3_runGame(HMR3_optionValue,HMR3_optionText){

if (HMR3_optionValue === "customlink") {
var customurl = prompt("Enter your url. (If you don't know how to get the url, upload your rom to github, copy the url for the raw file, and put it through githack)")
HMR3_optionValue = customurl
}

if (HMR3_optionValue === "moreroms") {
prompt("Here's a bunch of pokemon roms. https://visualboyadvance.org/pokemon-rom-hacks Just reload this tab and select the custom url option to learn what to do because I am not adding all those roms 💀 (ignore the input thing i couldnt figure out how to do a regular alert :[ )");
}

EJS_player = "#game";
EJS_core = "gba";
EJS_startOnLoaded = true;
EJS_gameUrl = HMR3_optionValue;
EJS_pathtodata = "https://cdn.jsdelivr.net/gh/ethanaobrien/emulatorjs@main/data/";
/*var HMR3__emulatorJSscript = "<script src=\"https://cdn.jsdelivr.net/gh/ethanaobrien/emulatorjs@main/data/loader.js\"></"+"script>";
//document.getElementById("HMR_emulatorJS").innerHTML = HMR3__emulatorJSscript;
//alert(document.getElementById("HMR_emulatorJS").innerHTML);
}
function HMR3_loader(){*/
(async function() {
const folderPath = (path) => path.substring(0, path.length - path.split('/').pop().length);
let scriptPath = (typeof window.EJS_pathtodata === "string") ? window.EJS_pathtodata : folderPath((new URL(document.currentScript.src)).pathname);
if (!scriptPath.endsWith('/')) scriptPath+='/';
//console.log(scriptPath);
function loadScript(file) {
return new Promise(function (resolve, reject) {
let script = document.createElement('script');
script.src = function() {
if ('undefined' != typeof EJS_paths && typeof EJS_paths[file] === 'string') {
return EJS_paths[file];
} else {
return scriptPath+file;
}
}();
script.onload = resolve;
document.head.appendChild(script);
})
}
function loadStyle(file) {
return new Promise(function(resolve, reject) {
let css = document.createElement('link');
css.rel = 'stylesheet';
css.href = function() {
if ('undefined' != typeof EJS_paths && typeof EJS_paths[file] === 'string') {
return EJS_paths[file];
} else {
return scriptPath+file;
}
}();
css.onload = resolve;
document.head.appendChild(css);
})
}

if (('undefined' != typeof EJS_DEBUG_XX && true === EJS_DEBUG_XX)) {
await loadScript('emulator.js');
await loadScript('nipplejs.js');
await loadScript('shaders.js');
await loadScript('storage.js');
await loadScript('gamepad.js');
await loadScript('GameManager.js');
await loadScript('socket.io.min.js');
await loadStyle('emulator.css');
} else {
await loadScript('emulator.min.js');
await loadStyle('emulator.min.css');

}
const config = {};
config.gameUrl = window.EJS_gameUrl;
config.dataPath = scriptPath;
config.system = window.EJS_core;
config.biosUrl = window.EJS_biosUrl;
config.gameName = window.EJS_gameName;
config.color = window.EJS_color;
config.adUrl = window.EJS_AdUrl;
config.adMode = window.EJS_AdMode;
config.adTimer = window.EJS_AdTimer;
config.adSize = window.EJS_AdSize;
config.alignStartButton = window.EJS_alignStartButton;
config.VirtualGamepadSettings = window.EJS_VirtualGamepadSettings;
config.buttonOpts = window.EJS_Buttons;
config.volume = window.EJS_volume;
config.defaultControllers = window.EJS_defaultControls;
config.startOnLoad = window.EJS_startOnLoaded;
config.fullscreenOnLoad = window.EJS_fullscreenOnLoaded;
config.filePaths = window.EJS_paths;
config.loadState = window.EJS_loadStateURL;
config.cacheLimit = window.EJS_CacheLimit;
config.cheats = window.EJS_cheats;
config.defaultOptions = window.EJS_defaultOptions;
config.gamePatchUrl = window.EJS_gamePatchUrl;
config.gameParentUrl = window.EJS_gameParentUrl;
config.netplayUrl = window.EJS_netplayServer;
config.gameId = window.EJS_gameID;
config.backgroundImg = window.EJS_backgroundImage;
config.backgroundBlur = window.EJS_backgroundBlur;
config.backgroundColor = window.EJS_backgroundColor;
config.controlScheme = window.EJS_controlScheme;
config.threads = window.EJS_threads;
config.disableCue = window.EJS_disableCue;

if (typeof window.EJS_language === "string" && window.EJS_language !== "en-US") {
try {
let path;
if ('undefined' != typeof EJS_paths && typeof EJS_paths[window.EJS_language] === 'string') {
path = EJS_paths[window.EJS_language];
} else {
path = scriptPath+"localization/"+window.EJS_language+".json";
}
config.language = window.EJS_language;
config.langJson = JSON.parse(await (await fetch(path)).text());
} catch(e) {
config.langJson = {};
}
}

window.EJS_emulator = new EmulatorJS(EJS_player, config);
window.EJS_adBlocked = (url, del) => window.EJS_emulator.adBlocked(url, del);
if (typeof window.EJS_ready === "function") {
window.EJS_emulator.on("ready", window.EJS_ready);
}
if (typeof window.EJS_onGameStart === "function") {
window.EJS_emulator.on("start", window.EJS_onGameStart);
}
if (typeof window.EJS_onLoadState === "function") {
window.EJS_emulator.on("load", window.EJS_onLoadState);
}
if (typeof window.EJS_onSaveState === "function") {
window.EJS_emulator.on("save", window.EJS_onSaveState);
}
})();
}

</script>
</head>

<body>
<strong>If you're trying to load another game, you have to reload the tab. For some reason, the second time you load it the core gets stuck at 99%</strong>
<form id="HMR3_form">
<select id="HMR3_dropdown">
</select>
<a href="#" onclick="HMR3_getURL();">Run</a>
</form>

<p id="gamecount"></p>

<div id="HMR_emulatorJS"></div>

<div class="game">
<div id="game"></div>
</div>

<script>
//function HMR3_writeOptions(){
var HMR3_dropdownString = "";

for (i=0;i<HMR3_optionText.length;i++){
HMR3_dropdownString += "<option value=\"" + HMR3_optionValue[i] + "\">" + HMR3_optionText[i] + "</option>";
}

//console.log(HMR3_dropdownString);
document.getElementById("HMR3_dropdown").innerHTML = HMR3_dropdownString;
//}
</script>

<script>
console.log(HMR3_optionText.length)
document.getElementById("gamecount").innerHTML = "Total game count: " + HMR3_optionText.length;
</script>
</body>

</html>
22 changes: 22 additions & 0 deletions test.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@


<script src="https://raw.githack.com/TrapjawwS/funnyemulatorjs/main/script.js"></script>


<form id="HMR3_form">
<select id="HMR3_dropdown">
</select>
</form>

<script>
//function HMR3_writeOptions(){
var HMR3_dropdownString = "";

for (i=0;i<HMR3_optionText.length;i++){
HMR3_dropdownString += "<option value=\"" + HMR3_optionValue[i] + "\">" + HMR3_optionText[i] + "</option>";
}

//console.log(HMR3_dropdownString);
document.getElementById("HMR3_dropdown").innerHTML = HMR3_dropdownString;
//}
</script>

0 comments on commit a88f9bb

Please sign in to comment.