-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathclacecombat2.html
More file actions
127 lines (121 loc) · 3.88 KB
/
clacecombat2.html
File metadata and controls
127 lines (121 loc) · 3.88 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
<!DOCTYPE html>
<!-- Ultimate Game Stash file-->
<!-- For the regularly updating doc go to https://docs.google.com/document/d/1_FmH3BlSBQI7FGgAQL59-ZPe8eCxs35wel6JUyVaG8Q/ -->
<head>
<script>
window.gameconfig = {
name: "Ace Combat 2 (USA)",
url: "https://cdn.jsdelivr.net/gh/bubbls/ugss@f8f6dcef21a8c9dd51e8e94fe6c61c09a23da4b9/ace%20combat%202/Ace%20Combat%202%20(USA).chd",
core: "psx",
min: 1,
max: 17,
};
</script>
<script>
function mergeFiles(fileParts, cb) {
return new Promise((resolve, reject) => {
let buffers = [];
function fetchPart(index) {
if (index >= fileParts.length) {
let mergedBlob = new Blob(buffers);
let mergedFileUrl = URL.createObjectURL(mergedBlob);
resolve(mergedFileUrl);
return;
}
fetch(fileParts[index])
.then((response) => response.arrayBuffer())
.then((data) => {
buffers.push(data);
fetchPart(index + 1);
})
.catch(reject);
cb(index);
}
fetchPart(0);
});
}
function getParts(file, start, end) {
let parts = [];
for (let i = start; i <= end; i++) {
let padded = String(i).padStart((end+"").length, '0');
parts.push(file + ".part" + padded);
}
return parts;
}
getParts("asd.js", 0, 100)
</script>
<style>
body,
html {
margin: 0;
padding: 0;
display: flex;
align-items: center;
justify-content: center;
width: 100%;
height: 100%;
background-color: #121212;
color: white;
font-family: Arial, sans-serif;
}
#game-container {
text-align: center;
width: 100%;
height: 100%;
}
#loading-progress {
font-size: 18px;
margin-top: 20px;
padding: 10px;
background: rgba(255, 255, 255, 0.1);
border-radius: 8px;
display: inline-block;
}
</style>
</head>
<body>
<div id="game-container">
<div id="game"></div>
<div id="loading-progress">Loading: 0/0</div>
<div id="first-time">First-time loading may take longer...</div>
</div>
<script>
var parts = getParts(
window.gameconfig.url,
window.gameconfig.min,
window.gameconfig.max
);
var totalParts = parts.length;
function updateLoadingProgress(loaded) {
const progressElement = document.getElementById("loading-progress");
if (loaded === 0) {
progressElement.textContent = "Loading: 0/0";
} else {
progressElement.textContent = `Loading: ${loaded}/${totalParts}`;
}
}
Promise.all([mergeFiles(parts, updateLoadingProgress)])
.then(([gameUrl]) => {
document.getElementById("loading-progress").remove();
document.getElementById("first-time").remove();
EJS_player = "#game";
EJS_core = window.gameconfig.core;
EJS_gameName = window.gameconfig.name;
EJS_color = "#0064ff";
EJS_startOnLoaded = true;
EJS_pathtodata = "https://cdn.jsdelivr.net/gh/genizy/emu@master/";
EJS_gameUrl = gameUrl;
EJS_biosUrl = "https://cdn.jsdelivr.net/gh/Abdess/retroarch_system@5f96368f6dbad5851cdb16a5041fefec4bdcd305/Sony%20-%20PlayStation/scph5501.bin";
const script = document.createElement("script");
script.src =
"https://cdn.jsdelivr.net/gh/genizy/emu@master/loader.js";
document.body.appendChild(script);
})
.catch((error) => {
console.error(error);
document.getElementById("loading-progress").textContent =
"Error loading game.";
});
</script>
</body>
</html>