cinera_handmade.network/cmuratori/hero/code/code148.hmml

33 lines
3.0 KiB
Plaintext

[video member=cmuratori stream_platform=twitch stream_username=handmade_hero project=code title="Writing the Asset File Header" vod_platform=youtube id=UNXHK8O-B_g annotator=ZedZull annotator=Miblo annotator=debiatan]
[00:00:38][Recap and plan for the day]
[00:02:27][Bug determining when sounds finish playing]
[00:10:28][Rearchitecting the mixing loop to avoid this sort of bug. Removing a secondary variable to avoid having to keep it in sync]
[00:12:16][On the importance of assertions]
[00:13:41][Write assertions to catch the kind of errors that you tend to make]
[00:15:36][Back to the test asset builder]
[00:21:01][Trick to avoid modifying lots of code to reflect the change of a variable from object to pointer]
[00:26:03][Data that we want to include in the asset file]
[00:27:52][Pragma-packing the file format structures]
[00:28:45][The hha header and its magic value]
[00:33:44][Overview of the structure of the asset file]
[00:38:40][Using offsets and counts to access asset content]
[00:44:40][Writing the header from the test asset builder]
[00:46:06][Two ways of computing the offsets of tags, asset types, and assets]
[00:50:56][Streaming files mini-rant (extended in the first question of the Q&A)]
[00:52:51][Writing out the arrays]
[00:58:42][Stepping through the code]
[01:06:05][Hex editing the resulting file]
[01:07:35][Q&A]
[01:08:02][@gasto5][Why is a position for a stream a bad idea?]
[01:17:00][@insofaras][Are you concerned that "trusting" the file format could have security concerns, e.g. someone could say they've made some modded assets, and give out a specially crafted .hha file that runs arbitrary code?]
[01:21:09][@snovind92][What is the main difference between using asserts in your code and writing separate test functions/programs that check your results, and when do you choose one over the other?]
[01:23:42][@noxy_key][Will multiple threads pose any problems to reading the assets file?]
[01:24:11][@flyingsand][If C++ had introspection, would this be a a place where you would use it? e.g. to introspect the types you want to include in the asset pack]
[01:26:16][@revolvable][Are there any specific times your streams start and end?]
[01:27:17][@cubercaleb][Why not just read the entire file in as a string and parse it as you please, then do the same for writing]
[01:30:43][@psuedonym73][Another option is to memory-map the file and then do as you will. Although that may not work on older consoles]
[01:33:19][@davechat][Do the mollyrocket artists ever interact with the asset packer or is it automated somehow. E.g. if they immediately want to preview how their artwork looks in game]
[01:33:56][@gasto5][I was taught to use exceptions because it does not convolute the code with error checking code]
[01:35:25][@pseudonym73][(clarification to question at 1:30:43) When I said "memory-mapped file", I meant it as an alternative to fread(), not as an alternative to streamed loading. Using fread() actually copies all data twice: buffer cache into FILE* buffer, then buffer into final destination. Copying from a memory-mapped file means only one copy]
[/video]