Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

repak.js produces nothing #32

Open
Elijahg opened this issue Nov 12, 2017 · 6 comments
Open

repak.js produces nothing #32

Elijahg opened this issue Nov 12, 2017 · 6 comments

Comments

@Elijahg
Copy link

Elijahg commented Nov 12, 2017

After a fair bit of fiddling, I've managed to get repak.js to run. Unfortunately when running it on quakejs/base/baseq3/ it produces no files, despite outputting

info: writing ~/assets/baseq3/pak100.pk3

Is it somehow broken? I'm trying to run the full game instead of the demo, and simply replacing pak0.pk3 with the full version results in it getting overwritten on server startup. Presumably this is because it doesn't match the content server?

I have tried running it with the demo pak0.pk3 and the full pak0.pk3 to no avail.
I'm calling it with

node bin/repak.js --src ~/quakejs/base/baseq3/ --dest ~/assets

Thanks for any help

@onny
Copy link

onny commented May 4, 2020

Hey thanks for asking. I'm getting this error when I try to run repak.js:

node bin/repak.js --src base/baseq3/ --dest assets
internal/modules/cjs/loader.js:638
    throw err;
    ^

Error: Cannot find module './build/Release/shell'
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:636:15)
    at Function.Module._load (internal/modules/cjs/loader.js:562:25)
    at Module.require (internal/modules/cjs/loader.js:692:17)
    at require (internal/modules/cjs/helpers.js:25:18)
    at Object.<anonymous> (/home/onny/quakejs/node_modules/execSync/index.js:30:11)
    at Module._compile (internal/modules/cjs/loader.js:778:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:789:10)
    at Module.load (internal/modules/cjs/loader.js:653:32)
    at tryModuleLoad (internal/modules/cjs/loader.js:593:12)
    at Function.Module._load (internal/modules/cjs/loader.js:585:3)

How did you solve this issue?

@onny
Copy link

onny commented May 4, 2020

Okay I fixed that by replacing execSync with require('child_process').execSync in repack.js. But now same issue as above. The assets folder is empty :(

@onny
Copy link

onny commented May 4, 2020

@briancullinan

@thedankay
Copy link

@Elijahg @onny you probably need to run node bin/repak.js --src base --dest assets instead

@ghost
Copy link

ghost commented Aug 22, 2020

There isn't a lot of magic to this repacking stuff. But there are some critical bugs. The quakejs-files repo is imported for repack and there is an underlying buffer that reads the files. I've had trouble with the buffer, and some files names. If there is an error it crashes with very little error handling. I've rewritten this script and there were still missing files in the graph. Some games include a .dat file, the fonts are hard coded to TGA so those don't convert. I've tried to resolve some of these errors with engine code too. Some mods check the pk3 checksum to make sure people installed the mod correctly. That won't work of its been repacked. Edawn and excessive+ and a few others I have found check the pk3 files.

I was able to load the mods by hacking the assembly code in vm.c. if you would like me to run the conversion on any mods or files I will give it a shot and maybe after doing that a few times, we can find a better solution to relying on these faulty repack scripts.

@wolkenschieber
Copy link

wolkenschieber commented Sep 16, 2023

Also tried to get repak working, but without success. I've patched my way through, but now I'm stuck at an TypeError: Cannot read property 'forEach' of null.

Here's the full log:

> [content pack 8/8] RUN mkdir -p /repacked     && node bin/repak.js --src /assets --dest /repacked:
0.263 info:    loading config file from /quakejs/bin/repak-config.json..
0.265 info:    extracting pak /assets/baseq3/pak1.pk3
0.277 info:    extracting pak /assets/baseq3/pak2.pk3
0.395 info:    extracting pak /assets/baseq3/pak3.pk3
0.404 info:    extracting pak /assets/baseq3/pak4.pk3
0.561 info:    extracting pak /assets/baseq3/pak5.pk3
0.565 info:    extracting pak /assets/baseq3/pak6.pk3
0.691 info:    extracting pak /assets/baseq3/pak7.pk3
0.700 info:    extracting pak /assets/baseq3/pak8.pk3
1.002 info:    extracting pak /assets/missionpack/pak1.pk3
1.014 info:    extracting pak /assets/missionpack/pak2.pk3
1.026 info:    extracting pak /assets/missionpack/pak3.pk3
1.068 /quakejs/bin/repak.js:354
1.068   mapVerts.forEach(function (mapV) {
1.068            ^
1.068 
1.068 TypeError: Cannot read property 'forEach' of null
1.068     at /quakejs/bin/repak.js:354:11
1.068     at Array.forEach (<anonymous>)
1.068     at Object.<anonymous> (/quakejs/bin/repak.js:350:10)
1.068     at Module._compile (internal/modules/cjs/loader.js:999:30)
1.068     at Object.Module._extensions..js (internal/modules/cjs/loader.js:1027:10)
1.068     at Module.load (internal/modules/cjs/loader.js:863:32)
1.068     at Function.Module._load (internal/modules/cjs/loader.js:708:14)
1.068     at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:60:12)
1.068     at internal/main/run_main_module.js:17:47

The packing is done within a Dockerfile:

FROM alpine/git:latest AS clone

RUN git clone --branch master https://github.com/inolen/quakejs.git /quakejs


FROM node:12-bullseye AS pack

ARG DEBIAN_FRONTEND=noninteractive
ENV TZ=Europe/Berlin

RUN apt-get update \
    && apt-get install unzip

COPY --from=clone /quakejs /quakejs
COPY ./include/assets /assets
WORKDIR /quakejs

RUN npm install
RUN sed -i "s/var execSync = require('execSync').exec;/var execSync = require('child_process').execSync;/g" bin/repak.js \
    && sed -i "s/os.tmpDir();/os.tmpdir();/g" node_modules/temp/lib/temp.js
RUN mkdir -p /repacked \
    && node bin/repak.js --src /assets --dest /repacked 


FROM node:20-bullseye-slim AS run

COPY --from=clone /quakejs /quakejs
COPY --from=pack /repacked /quakejs/assets
WORKDIR /quakejs

EXPOSE 8080

CMD ["node", "bin/content.js"]

I'm giving up here, but maybe this helps somebody facing the same issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants