Upload via GUI (25 Dateien)
This commit is contained in:
+34
-2
@@ -150,6 +150,36 @@ async function prepareLibraries(vj, sharedDir, nativesDir, onProgress) {
|
||||
return classpath;
|
||||
}
|
||||
|
||||
function classpathArtifactKey(filePath, sharedDir) {
|
||||
const libDir = path.join(sharedDir, 'libraries');
|
||||
const rel = path.relative(libDir, filePath);
|
||||
if (rel.startsWith('..') || path.isAbsolute(rel)) return path.normalize(filePath).toLowerCase();
|
||||
|
||||
const parts = rel.split(path.sep);
|
||||
if (parts.length < 4) return rel.replace(/\\/g, '/').toLowerCase();
|
||||
|
||||
const fileName = parts[parts.length - 1];
|
||||
const version = parts[parts.length - 2];
|
||||
const artifact = parts[parts.length - 3];
|
||||
const group = parts.slice(0, -3).join('/').toLowerCase();
|
||||
const base = fileName.replace(/\.[^.]+$/, '');
|
||||
const prefix = `${artifact}-${version}`;
|
||||
const classifier = base.startsWith(prefix + '-') ? base.slice(prefix.length + 1).toLowerCase() : '';
|
||||
return `${group}:${artifact.toLowerCase()}:${classifier}`;
|
||||
}
|
||||
|
||||
function dedupeClasspath(classpath, sharedDir) {
|
||||
const seen = new Set();
|
||||
const out = [];
|
||||
for (const filePath of classpath) {
|
||||
const key = classpathArtifactKey(filePath, sharedDir);
|
||||
if (seen.has(key)) continue;
|
||||
seen.add(key);
|
||||
out.push(filePath);
|
||||
}
|
||||
return out;
|
||||
}
|
||||
|
||||
// entpackt eine Natives-JAR (ZIP) nach nativesDir (ohne externe Abhängigkeit)
|
||||
async function extractNatives(jarPath, nativesDir, extractRule) {
|
||||
ensureDir(nativesDir);
|
||||
@@ -407,6 +437,8 @@ async function prepareAndLaunch(opts, onProgress) {
|
||||
effectiveVj = mergeLoader(vj, fvj);
|
||||
}
|
||||
|
||||
const finalClasspath = dedupeClasspath(classpath, opts.sharedDir);
|
||||
|
||||
// Ohne Login: alles vorbereitet, aber kein Start (kein Crack-Bypass)
|
||||
if (!opts.auth) {
|
||||
return {
|
||||
@@ -425,7 +457,7 @@ async function prepareAndLaunch(opts, onProgress) {
|
||||
gameDir: opts.gameDir,
|
||||
sharedDir: opts.sharedDir,
|
||||
nativesDir,
|
||||
classpath,
|
||||
classpath: finalClasspath,
|
||||
minMemMb: opts.minMemMb || 2048,
|
||||
maxMemMb: opts.maxMemMb || 4096,
|
||||
extraArgs: opts.extraArgs || '',
|
||||
@@ -475,5 +507,5 @@ async function prepareAndLaunch(opts, onProgress) {
|
||||
|
||||
module.exports = {
|
||||
prepareAndLaunch, getVersionJson, buildArgs, pickJava, rulesAllow, prepareLibraries, prepareAssets,
|
||||
downloadIfNeeded, extractNatives,
|
||||
downloadIfNeeded, extractNatives, mergeLoader, dedupeClasspath, classpathArtifactKey,
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user