homegames-common 1.5.0 → 1.5.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/docker-helper.js +4 -2
- package/game-loader.js +11 -1
- package/game-session-manager.js +3 -2
- package/package.json +1 -1
package/docker-helper.js
CHANGED
|
@@ -101,7 +101,7 @@ const runGameContainer = async ({
|
|
|
101
101
|
saveDataPath,
|
|
102
102
|
assetCachePath = null,
|
|
103
103
|
imageName = 'homegames-runner',
|
|
104
|
-
memoryLimit = '
|
|
104
|
+
memoryLimit = '64m',
|
|
105
105
|
cpuLimit = '1',
|
|
106
106
|
gameEntryRelative = null,
|
|
107
107
|
noFrame = false,
|
|
@@ -148,7 +148,9 @@ const runGameContainer = async ({
|
|
|
148
148
|
if (assetCachePath) {
|
|
149
149
|
const resolved = path.resolve(assetCachePath);
|
|
150
150
|
if (!fs.existsSync(resolved)) {
|
|
151
|
-
fs.mkdirSync(resolved, { recursive: true });
|
|
151
|
+
fs.mkdirSync(resolved, { recursive: true, mode: 0o777 });
|
|
152
|
+
} else {
|
|
153
|
+
fs.chmodSync(resolved, 0o777);
|
|
152
154
|
}
|
|
153
155
|
binds.push(`${resolved}:/root/.homegames/asset-cache:rw`);
|
|
154
156
|
}
|
package/game-loader.js
CHANGED
|
@@ -32,6 +32,7 @@ const squishMap = {
|
|
|
32
32
|
'130': 'squish-130',
|
|
33
33
|
'135': 'squish-135',
|
|
34
34
|
'136': 'squish-136',
|
|
35
|
+
'138': 'squish-138',
|
|
35
36
|
};
|
|
36
37
|
|
|
37
38
|
const DEFAULT_SQUISH_VERSION = '135';
|
|
@@ -43,13 +44,22 @@ const DEFAULT_SQUISH_VERSION = '135';
|
|
|
43
44
|
const parseSquishVersion = (codePath) => {
|
|
44
45
|
const code = fs.readFileSync(codePath, 'utf-8');
|
|
45
46
|
|
|
47
|
+
console.log('aiaiaiai');
|
|
46
48
|
const { Parser } = require('acorn');
|
|
47
49
|
const parsed = Parser.parse(code, { ecmaVersion: 'latest', sourceType: 'script' });
|
|
50
|
+
console.log('balls and ass');
|
|
51
|
+
console.log(parsed);
|
|
52
|
+
console.log(parsed.body);
|
|
53
|
+
console.log(parsed.body.map(n => n.type));
|
|
54
|
+
console.log(parsed.body.filter(n => n.type === 'ClassDeclaration').superClass);
|
|
48
55
|
|
|
49
56
|
const foundGameClasses = parsed.body.filter(
|
|
50
|
-
n => n.type === 'ClassDeclaration' && n.superClass && n.superClass.name === 'Game'
|
|
57
|
+
n => n.type === 'ClassDeclaration' && n.superClass && (n.superClass.name === 'Game' || n.superClass.name === 'ViewableGame')
|
|
51
58
|
);
|
|
52
59
|
|
|
60
|
+
console.log('found game classes');
|
|
61
|
+
console.log(foundGameClasses);
|
|
62
|
+
|
|
53
63
|
if (foundGameClasses.length !== 1) {
|
|
54
64
|
throw new Error('Unable to parse squish version');
|
|
55
65
|
}
|
package/game-session-manager.js
CHANGED
|
@@ -313,6 +313,7 @@ class GameSessionManager {
|
|
|
313
313
|
try {
|
|
314
314
|
squishVersion = parseSquishVersion(gamePath);
|
|
315
315
|
} catch (err) {
|
|
316
|
+
console.log(err);
|
|
316
317
|
squishVersion = DEFAULT_SQUISH_VERSION;
|
|
317
318
|
}
|
|
318
319
|
} else if (input.versionId) {
|
|
@@ -360,11 +361,11 @@ class GameSessionManager {
|
|
|
360
361
|
}
|
|
361
362
|
}
|
|
362
363
|
}
|
|
363
|
-
|
|
364
|
+
|
|
364
365
|
const child = fork(this.childServerPath, [], {
|
|
365
366
|
env,
|
|
366
367
|
stdio: ['pipe', 'pipe', 'pipe', 'ipc'],
|
|
367
|
-
execArgv: ['--max-old-space-size=
|
|
368
|
+
execArgv: ['--max-old-space-size=64'],
|
|
368
369
|
});
|
|
369
370
|
|
|
370
371
|
child.send(JSON.stringify({
|