179 lines
4.3 KiB
Plaintext
179 lines
4.3 KiB
Plaintext
|
|
var expireInDays = 0;
|
|
var enableAD = 1;
|
|
var patLevel = 0;
|
|
var enableEA = 0;
|
|
|
|
var currentDay = '' + ~~(Date.now() / (24 * 60 * 60 * 1000));
|
|
var showBuyGamepads = true;
|
|
var showEarlyAccess = true;
|
|
var showSns = true;
|
|
var lang = navigator.language || 'unknown';
|
|
|
|
|
|
if ((lang == 'zh-CN') || (lang == 'ja')) {
|
|
enableAD = 0;
|
|
showSns = false;
|
|
}
|
|
if (lang == 'ja') {
|
|
showEarlyAccess = false;
|
|
showBuyGamepads = false;
|
|
}
|
|
|
|
if (expireInDays > 0) {
|
|
enableAD = 0;
|
|
}
|
|
|
|
|
|
|
|
$id('loading').hidden = true
|
|
$id('loadrom').hidden = false
|
|
$id('btn-choose-file').onclick = () => {
|
|
tryInitSound();
|
|
$id('rom').click();
|
|
}
|
|
|
|
|
|
if (showEarlyAccess) {
|
|
var inviteText = '';
|
|
if (expireInDays > 0) {
|
|
inviteText = 'Days available for Early Access features: ' + expireInDays + "\n";
|
|
}
|
|
if (patLevel > 0) {
|
|
inviteText = 'Thank you for your support!\n'
|
|
inviteText += 'Ad-free and Early Access features are enabled!\n';
|
|
}
|
|
var p = document.createElement('p');
|
|
p.innerText = inviteText;
|
|
$id('pro').appendChild(p);
|
|
|
|
if (patLevel <= 0) {
|
|
var div = document.createElement('div');
|
|
div.innerHTML = `<p class="link">Enter Early Access Code</p>`;
|
|
div.onclick = () => {
|
|
var code = window.prompt('Enter your Patreon Access Code: \n (You don\'t need it for the stable version)');
|
|
if (!code) {
|
|
return;
|
|
}
|
|
code = code.trim().toLowerCase();
|
|
if ((code.length != 36) && (code.length != 10)) {
|
|
alert('not a valid code');
|
|
return;
|
|
}
|
|
fetch("https://c.44670.org/k", {
|
|
method: 'POST',
|
|
body: localStorage['s'] + "," + code
|
|
}).then(res => res.text()).then(res => {
|
|
eval(res)
|
|
});
|
|
}
|
|
$id('pro').appendChild(div);
|
|
}
|
|
}
|
|
|
|
|
|
|
|
var divBuyGamepads
|
|
if (showBuyGamepads) {
|
|
$id('a-gamepad').onclick = () => {
|
|
if (!divBuyGamepads) {
|
|
divBuyGamepads = document.createElement('div');
|
|
divBuyGamepads.hidden = true
|
|
divBuyGamepads.innerHTML = `
|
|
<style>
|
|
.gamepad-item {
|
|
text-decoration: none;
|
|
display: flex;
|
|
align-items: center;
|
|
background-color: #333;
|
|
}
|
|
.gamepad-item img {
|
|
padding-right: 1em;
|
|
}
|
|
|
|
</style>
|
|
|
|
<h1>About Gamepads</h1>
|
|
<p>
|
|
After the gamepad is paired in System Settings, press <b>Select or Start</b> to connect with DS Player.
|
|
</p>
|
|
<p>
|
|
Please note that these gamepads are only tested on iOS and are not guaranteed to work in other platforms.<br>
|
|
iOS may change the accessory restrictions via software update, so we cannot guarantee that these gamepads will work in the future.<br>
|
|
This software is not affiliated with any of these gamepads vendors.<br>
|
|
</p>
|
|
<table style="background-color: #444;">
|
|
<thead>
|
|
<tr>
|
|
<th>Product</th>
|
|
<th>Notes</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
<tr><td>8Bitdo Zero 2</td><td>Switch to macOS mode by pressing A+Start.</td></tr>
|
|
<tr><td>DS 4/5</td><td>Officially supported by iOS[1].</td></tr>
|
|
</table>
|
|
<a href="#" id="a-close-gamepad">Close</a>
|
|
<br><br><br>
|
|
<p>
|
|
[1] <a href="https://support.apple.com/en-us/HT211813">https://support.apple.com/en-us/HT211813</a>
|
|
</p>
|
|
|
|
`
|
|
|
|
document.body.appendChild(divBuyGamepads);
|
|
}
|
|
$id('welcome').hidden = true;
|
|
divBuyGamepads.hidden = false;
|
|
$id('a-close-gamepad').onclick = () => {
|
|
$id('welcome').hidden = false;
|
|
divBuyGamepads.hidden = true;
|
|
}
|
|
}
|
|
}
|
|
|
|
if (showSns) {
|
|
$id('p-sns').innerHTML = `
|
|
<a href="/gba">GBA Player</a> | <a target="_blank" href="https://www.patreon.com/ds44670">Patreon</a> | <a target="_blank" href="https://discord.gg/W4UdzbRSu2">Discord</a>`
|
|
|
|
}
|
|
|
|
|
|
if (!enableEA) {
|
|
lsLayout = 0
|
|
config.scaleMode = 0
|
|
config.turbo = false
|
|
config.vkScale = 1
|
|
window.localStorage['config'] = JSON.stringify(config)
|
|
}
|
|
|
|
|
|
|
|
|
|
var VER = 'v20230106'
|
|
|
|
window.whatsNew = () => {
|
|
alert(`What's new in ` + VER + `:
|
|
- Cloud save.
|
|
- For gamepads: access menu by L+R+X+Y.
|
|
|
|
== EARLY Access ==
|
|
- XBRZ upscaling filter.
|
|
- Turbo mode(iPhone 12+ only).
|
|
- Cheat support.
|
|
- Use the device's microphone.
|
|
- Choose screen layout in landscape.
|
|
- Resize virtual keyboard.
|
|
|
|
|
|
`)
|
|
}
|
|
|
|
if ((localStorage['lastver'] || '') != VER) {
|
|
localStorage['lastver'] = VER
|
|
if (isSaveSupported) {
|
|
whatsNew()
|
|
}
|
|
}
|
|
|