looks like we're live hello everyone and welcome to yet another recreational programming session with mista a-zozin let's make a little bit of an announcement and officially start the stream
@christianskjerning44542 ай бұрын
most stable medium in this universe
@delibellus2 ай бұрын
someone will get those words tattooed someday
@tc403902 ай бұрын
You missed the best part, "So let's do red circle, live on, uh, twitch and what are we doing today on twitch at dot, uh, television website?" :D
@simonesasso83792 ай бұрын
"as usual"
@cheebadigga4092Ай бұрын
striem* :D
@glowiak34302 ай бұрын
"Can your stinky JavaScript do that!?" I love that quote
@gorenbk2 ай бұрын
JavaScript is quite fragrant if I say so myself.
@clubpenguinfan19282 ай бұрын
me on my 5th birthday: looks like we're five
@prosto_evrey57932 ай бұрын
Bees be like: “Looks like we’re hive”
@azergante82682 ай бұрын
AFAIK there are 3 advantages to the #embed directive: 1. ease of use 2. standard way to do things 3. performance: apparently the compiler does not like to parse huge-ass arrays of hex and it’s much faster to just dump the bytes from one file to another
@aredrih67232 ай бұрын
A huge array of bytes is at least 4 char per bytes (2 for prefix, 1 or 2 for value, 1 for comma). Tsoding generated format has 6 char/byte (+ new line and indent). Also not having to run a C parser on the embedded file and just doing a "dumb" copy on the byte can only be faster.
@Highwind_2 ай бұрын
9:00 Gimp can export images to C and it generates a .c file that is exactly this, I never tought it could have an use XD
@azergante82682 ай бұрын
Thanks for the content! would be curious to see you debloat android dev & explore phone sensors, cameras and all that cool stuff
@aredrih67232 ай бұрын
I think the reason J.Blow had to export whether the data should be freed in case of a fallback to the filesystem. For instance, say we try to load the resources from the filesystem by default but if it's not found load from the executable. (Or the opposite?) Then, you can't just rely on macro as zome resources will get freed and other not.
@TsodingDaily2 ай бұрын
Oh shi! That's a good idea! Maybe I should implement some sort of fallback too...
@HaMMeR336612 ай бұрын
I remember doing all this diskloading+embedding as prep for a jam game made in Go, without the embed of newer versions which then solved the usecase where, if the binary data is code, LSPs freak out and get incredibly slow really fast and slow down the compile as well. I even tried finished a hotreload whenever a png was modified on disk to reflect that in game. I also stopped using filenames directly and generated an autocomplete enum of all filepaths in the project folder, but that just made things more difficult without much payoff; for a jam where I'm the only programmer at least. It always turns out to be a bit more confusing for comfort, but seeing you breeze though it just feels so nice to watch.
@nikev2 ай бұрын
Always a good time watching your sessions. I laugh so hard at the JavaScript padding 😂
@StefanvanAalst2 ай бұрын
The Bundle solution allows for modding as well: if folder/file use that other wise what is internally bundled
@blackhaze38562 ай бұрын
Finally a secure place to hide nsfw content
@johnsonogbu8697Ай бұрын
I love you, bro. You're my inspiration.
@berndeckenfels2 ай бұрын
It looks like there is a callback for your loader, Raylib has you covered (I admire how quickly can Analyse api but often you miss details)
@azergante82682 ай бұрын
You should be able to hot reload resources in bundled mode too if you regenerate the `resources` and the `bundle` arrays. Another way could be to embed the resources in the shared library.
@flewwasse2 ай бұрын
I have not watched the video yet but that LoadFromMemory probably could also be useful for loading thing made by the same program, like render and bake an image and use it as an icon or similar. I love commenting it is my hobby.
@SlinkyD2 ай бұрын
Yes, very useful.
@berndeckenfels2 ай бұрын
1:31:10 the advantage of the bool flag is you can mix both nodes (but you can also do that with your free, you just check if the pointer is inside the static area and then skip the free)
@ryonagana2 ай бұрын
this was very common in DOS era a game with only one .exe with all data embed on it or a game with multiple .exe and the main .exe is just a loader of them
@lonecoder_croАй бұрын
😂 that javascript line was Awsome
@taba19502 ай бұрын
I think it would be cool to use the bundled resources as a fallback do you can have your cake and eat it too.
@apenaswellignton2 ай бұрын
pog
@glowiak34302 ай бұрын
Windows NTFS actually allows you to insert any data in an "alternative page" of a file, that does not change content of the base page, and no one knows except the one who made this.
@desertfish742 ай бұрын
Not entirely true, you can inspect files to list the alternate streams they may have in them.
@berndeckenfels2 ай бұрын
That’s however not a good vehicle for distributing files, ftp client or browser download might lose the ADS. Btw: Dir can show them, so it’s not well hidden :)
@berndeckenfels2 ай бұрын
Would be cool if the linker can just load a raw segment data, so you don’t need the c-generation or #embed
@ElPikacupacabraАй бұрын
It's possible, both with a linker script and with objcopy. There's a stack overflow question on this
@mhamdmarch87092 ай бұрын
Sounds exciting
@arisweedler47032 ай бұрын
So many problems would be solved if you could release a filesystem instead of a file. Then you could ship something that was … containing … everything, instead of just a regular file. Or we can all go to pre-docker days and enjoy watching a nice recreational coding session 😁😁. Not sure how containers serving GUI applications work - I’m sure it wouldn’t be that complicated once you know. But sheeeesh just having some C code is nice and ezpz
@fu8862 ай бұрын
docker/containers/chroot bundles?
@AyariMakrem2 ай бұрын
Is it possible to combine the 2 mode in one? I mean if you don't find the ressources into file system then you load it from the bundle.
@ezzobir2 ай бұрын
Thank you so much very usefull video. Do you use evil mode in your emacs?
@chomik38732 ай бұрын
no he doesn't
@Momoyon2 ай бұрын
What does it do?
@blackbeard34492 ай бұрын
@@Momoyonit enables vim like keybinding in enacs
@EnLopXf2 ай бұрын
Hiding malware inside executable
@anon_y_mousse2 ай бұрын
The flexibility that it will provide in embedding data files is why I'm so excited for #embed, but unfortunately I still can't update to a C23 compiler that supports it. As it stands now I have a program that I wrote to generate a header for any data files I want to include in the binary. I took some inspiration from Microsoft in that regard, but like your solution, mine is also cross platform. However, there is one tiny quibble with your method of alternating between hot reloading and not. I include the files internally regardless of build type, but I also provide the files externally so that they can be swapped by the user as an extra customization. If they delete the resource folder, my program can just regenerate it in a standard user folder location, ~/.cache/ for instance. That's probably the reason that Jonathan Blow uses a boolean flag, although in my case the resource data is all within a specific location and I can just check if the pointer to the resource comes from the binary or from the heap and no need for a flag.
@aadishm47932 ай бұрын
Maybe rewriting the project in rust and baking the resources will reduce the binary size. SIGNIFICANTLY
@GeorgeSukFuk2 ай бұрын
Are you being serious
@eeriemyxi2 ай бұрын
why are these rustlings everywhere these days
@homepunks90402 ай бұрын
is there any way i can join your discord?
@sholesy2 ай бұрын
I feel like I gained 10^10000 brain cells watching each of your videos 😅. Thanks tsoding ❤
@hubstrangers34502 ай бұрын
Thank you, ~ wanted to know, the binary data that most scientific communities generate(LHC etc), could easily converted to C code......take that assumption is correct
@user-ji6ip7ou8d2 ай бұрын
I wonder why he's mostly not freeing the memory he allocates. I haven't really seen him calling the "free" function. Why? Is it because the OS you use does it when the program stops?
@Person18732 ай бұрын
You don't need free unless you malloc. Also IIRC he uses an arena allocator which means he just free's the arena at the end of the program.
@berndeckenfels2 ай бұрын
He does when needed 1:20:53
@jimshtepa54232 ай бұрын
around 4:35 - In C language, does the outcome of the build process depend on the specific file you designate as the target in the build command, or does it also depend on the location from which the build command is executed?
@anon_y_mousse2 ай бұрын
Depends on a few factors. If you're using a makefile, then that'll generally dictate where files get placed, either explicitly or implicitly if you have multiple arranged in multiple folders. If you're just issuing the command to gcc, then it's where you're issuing it from plus any extra pathing you include. Such as: `gcc -o bin/foo.o foo.c` would place foo.o in the ./bin/ folder.
@jimshtepa54232 ай бұрын
I see. I just noticed he navigated to the empty folder and ran the build command although the folder he was running the command from was empty @@anon_y_mousse
@StefanvanAalst2 ай бұрын
The bundler seems overcomplicated (I'm a noob). Why not use a counter and a mod to print end line after 20 prints? Only one for loop needed
@blackbeard34492 ай бұрын
I believe both is functionally equivalent. I think he did it because it was the first thing that came to his mind.
@Roconx2 ай бұрын
That would work fine, but it would also make it a bit slower by checking whether it is multiple of 20 in every iteration of the loop.
@berndeckenfels2 ай бұрын
@@Roconxmight still be faster since it’s only a single loop with one terminating condition. And surely faster to type
@NyanCoder2 ай бұрын
Indentation size 5. You evil
@digitaltrolling2 ай бұрын
А что у тебя за операционная система? Или дистрибутив, если это Линукс.
@softgodez2 ай бұрын
Это дебиан с i3wm как я помню
@leastexpected31152 ай бұрын
У него debian. Насчёт настольного окружения я не знаю
@kala-telo2 ай бұрын
Debian Linux with i3
@softgodez2 ай бұрын
@@leastexpected3115i3wm
@digitaltrolling2 ай бұрын
Спасибо
@glowiak34302 ай бұрын
There actually exists a raylib binding for javascript...
@bhavyakukkar2 ай бұрын
js bindings that run on node? he is trying to implement raylib logic in js so that wasm code can directly use native js functions instead of emscripten-compiled raylib C functions
@glowiak34302 ай бұрын
@@bhavyakukkar For some reason there exists a "node-raylib" binding, that basically allows you to write desktop raylib applications in JS. Looking at its github page, many people use it. Absurd.
@coath2 ай бұрын
have you ever done a sober stream bro?!
@Klemens1022 ай бұрын
Is he not sober?
@marcsfeh2 ай бұрын
what's sad about #embed is that you can literally implement this feature with 20 lines of python to pre process the file ISO committee is where all good ideas go to die :(
@danielsan9019982 ай бұрын
what's nice about #embed is that it can directly include it without having to use the lexer and parser to process it as code, reducing the overhead and without having to depend on an external tool or an extra build step.
@TurtleKwitty2 ай бұрын
@@danielsan901998 tsoding did it this way but theres no reason he couldnt have done it with the linker instead to just lump in the binary blobs; less easy to develop on stream though
@replikvltyoutube37272 ай бұрын
Well bundling data with executable and hiding said data are different things. I expected to see something like that but with like encrypted files or something..
@noname-gh5rs2 ай бұрын
16:30 I guess start here
@rogo73302 ай бұрын
Ah yeah, the cross-platform way to ship resources with you application: files
@amigaworkbench7202 ай бұрын
Zip exe with password?
@bertacchius2 ай бұрын
First.
@mithrandirek18132 ай бұрын
I would use `ld -r -b binary -o foo.bar.o foo.bar` to convert the binary into an object file, which has symbols for data start, end and size. This cuts out the need of generating and parsing a C file
@esepecesito2 ай бұрын
I have posted that many times, but my comments keep dissapearing... anyway, a nice way to embedd data.