- Notifications
You must be signed in to change notification settings - Fork 66
WIP: embed media files #1842
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
base: master
Are you sure you want to change the base?
WIP: embed media files #1842
Conversation
00ab6d9 to 5fc5d6a Compare | So it now loads the whole file. For a funny reason, it works because since the |
b27df22 to 40b1ecb Compare | It almost works but…
|
40b1ecb to c8e0525 Compare
Now fixed, there was a source beautifier stripping |
Don't drop it. Add an option to specify text or binary mode. |
| Hmm, right now there is something corrupting something, the engine is slow, and the console has some things printed everyframe, actually it prints some |
c8e0525 to 5c2c579 Compare
I added an option. |
ac60360 to d0ab552 Compare | I now should have filtered out the builtin pak name from the list of required paks sent to clients. I still don't know from where comes that weird bug slowing down the engine and polluting the console… |
d0ab552 to 85df417 Compare | So I stop there for now, for people around, don't hesitate to look at it, especially for tracking bugs! 😁️ |
| Hmm, in #71 you said we "don't have to think about some generic dpk embedding mechanism", but it looks like you have implemented precisely that. I was thinking we would avoid that and just use the byte arrays generated by the existing embed mechanism directly where needed. For example if we wanted the "bigchars" image, we could add that to the builtin images: create a |
Yes, life is funny. 😄 I started wiring the VFS to test the loading of files, because in fact it's also a good way to make sure the path is exposed and that all the decoding functions are used. For example the PNG image has to be decoded by PNG, etc. I don't mind the implementation, what I wanted to do there is to plumb the actual file embedding, which seems to now work. I don't know how to properly make those files usable once they are embedded, and that's a task anyone can pick up. |
85df417 to a899a33 Compare | Another thing funny is that I tried to create the smallest My “smaller file” is using such format: signed 16-bit mono 8000 Hz, likely one sample only. |
| Ok, I had to keep enough samples, something like 0.3ms, the file now weights 90 bytes instead of 20KB, here is the generated file: const unsigned char sound_null_wav[] = { 0x52,0x49,0x46,0x46,0x52,0x00,0x00,0x00,0x57,0x41,0x56,0x45,0x66,0x6d,0x74, 0x20,0x10,0x00,0x00,0x00,0x01,0x00,0x01,0x00,0x40,0x1f,0x00,0x00,0x80,0x3e, 0x00,0x00,0x02,0x00,0x10,0x00,0x64,0x61,0x74,0x61,0x2e,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,};Edit: I also made sure it was truly zeroed. |
6db7782 to 866ce06 Compare | I FOUND THE BUG, IT WORKS. The bug was that I forgot to set |
|
| One can actually run a custom dll game code without any dpk by doing: ./daemonded -set fs_basepak '*daemon' -set vm.cgame.type 3 -set vm.sgame.type 3 |
| The annoying downside of embedding a pak in the engine is that, unless I'm wrong, files from a builtin pak are loaded from that builtin pak, i.e. copied in memory. So you get the file taking twice the amount of memory: first in the executable itself, and then as a loaded file. |
866ce06 to 14a6cb9 Compare dba95b9 to b61e6ba Compare b61e6ba to 24ad3e1 Compare | This code may probably be useless because we have solutions to embed all the files we have if I'm right, but I'm using this as a test bed for #1849: Because this code is much more complex than the GLSL embedding code and also embeds non-text files, so it's very good to test for the robustness of the design and catch pitfalls. |
0c7b1f6 to 035784c Compare
Work in progress: embed media files from
daemon_src.dpkdir.I deeply reworked the GLSL include generator to make it reusable, I also renamed
DaemonBuildInfo.cmakeasDaemonGeneratedSource.cmakeand put everything about generating sources there, and revamped it a lot.It doesn't work yet because:
0, but thesound.wavfile contains some bytes like that and this is valid.engine.shaderfile gets parsed.