[video output=day517 member=cmuratori stream_platform=twitch stream_username=handmade_hero project=code title="Inserting and Rewriting HHT Alignment Points" vod_platform=youtube id=lepbJedkolg annotator=Miblo]
[0:02][Recap and set the stage for the day][:speech]
[1:15][Demo our asset alignment point editor][:"asset system" :run :ui]
[5:32][Synchronising our asset alignment points between .hha and .hht files][:"asset system" :parsing :speech]
[10:12][Enable ParseTopLevelBlock() to insert new alignment points in an .hht and clear them from an .hha file][:"asset system" :parsing]
[38:23][Enable ParseTopLevelBlock() to retain matching alignment points and replace changed ones in an .hht file][:"asset system" :parsing]
[52:01][Enable ParseTopLevelBlock() to apply our asset alignment point changes to the .hha file][:"asset system" :parsing]
[1:00:42][Consider a more generic diffing system][:speech]
[1:03:03][Atomic file replace[ref
        site="Windows Dev Center"
        page="GetTempFileNameA function"
        url=https://docs.microsoft.com/en-us/windows/desktop/api/fileapi/nf-fileapi-gettempfilenamea]][:"file io" :"platform layer" :speech]
[1:07:33][Implement Win32AtomicReplaceFileContents()[ref
        site="Windows Dev Center"
        page="GetTempFileNameW function"
        url=https://docs.microsoft.com/en-us/windows/desktop/api/fileapi/nf-fileapi-gettempfilenamew][ref
        site="Windows Dev Center"
        page="MoveFileExW function"
        url=https://docs.microsoft.com/en-us/windows/desktop/api/winbase/nf-winbase-movefileexw][ref
        site="Windows Dev Center"
        page="WriteFile function"
        url=https://docs.microsoft.com/en-us/windows/desktop/api/fileapi/nf-fileapi-writefile][ref
        site="Windows Dev Center"
        page="CreateFileW function"
        url=https://docs.microsoft.com/en-us/windows/desktop/api/fileapi/nf-fileapi-createfilew]][:"file io" :"platform layer" :"string manipulation"]
[1:28:42][Hit an assert in ParseTopLevelBlock()][:"asset system" :"file io" :"platform layer" :run]
[1:30:00][Fix the assert in ParseTopLevelBlock() to test on the Asset->HHA.Type][:"asset system"]
[1:31:28][:Run the import, but do not see our assets][:"asset system"]
[1:33:39][Make ParseTopLevelBlock() apply default alignment points to assets][:"asset system" :parsing]
[1:36:40][Find that our assets now appear, and step through the "Import & Save" routine][:"asset system" :run]
[1:38:28][Make FindAlign() rather than ParseTopLevelBlock() apply default alignment points, to permit assets that lack alignment points][:"asset system"]
[1:42:47][Find that that didn't work][:"asset system" :run]
[1:43:00][Fix FindAlign() to apply default alignment points for an asset's ToParent connection][:"asset system"]
[1:46:47][Find that we see our assets just right, and step through our "Import & Save" routine again with full success][:"asset system" :run]
[1:49:43][Enable Win32AtomicReplaceFileContents() to delete the temporary file if the move failed[ref
        site="Windows Dev Center"
        page="DeleteFileW function"
        url=https://docs.microsoft.com/en-us/windows/desktop/api/fileapi/nf-fileapi-deletefilew]][:"asset system" :"file io" :"platform layer"]
[1:50:49][Compare our original and updated base_game.hht with Meld][:admin :"asset system" :parsing]
[1:52:03][Find the alignment points reload correctly][:"asset system" :parsing :run]
[1:52:41][Make ParseTopLevelBlock() output tabbing and newline][:"asset system" :parsing]
[1:53:36][Q&A][:speech]
[1:55:01][@pajpiart][Q: Will you make file formats for how the worlds are generated as well in the future?][:"file format"]
[1:55:48][@ejgremlin][Q: Do you think it is better to design for the top 10% of programmers, or the majority, in :language / :API design?]
[1:58:24][@kanjiowl][Q: Off-topic, but in an old stream you mentioned that you liked having all allocators (like PushSize) go through macros instead of direct function calls. What was your reasoning behind this?][:language :memory]
[1:59:23][@pajpiart][Q: Since there aren't a lot of questions: Do you think I could interest you in a pair of zircon-encrusted tweezers?]
[2:00:30][@s0imn][Q: Would you move to clang and implement custom build tooling]
[2:01:04][@garryjohanson][@handmade_hero May I ask a larger sort of off-topic question, or should I save that for tomorrow's pre stream?]
[2:01:33][@xxthebigfoxx][Q: Is there anything like :"operating system" garbage collection nowadays? My professor talked about not needing to free calls to malloc() due to something like that. I would imagine he has no idea what he is talking about, but I'm not sure either][:memory]
[2:04:55][@garryjohanson][@handmade_hero So I talked to one of the handmade debug teams and they made it sound like it would be doable to expose all debug symbols on an API level. This seems like a very powerful thing since people could build custom luggins \[sic\] on top of the debugger itself. This seems very powerful and very leveragable. Is there anything wrong with that? Is there some reason you know of Visual Studio does not expose debug information to an API? Some security vulnerability or something?[ref
    site="Windows Dev Center"
    page="Debug Interface Access SDK"
    url=https://docs.microsoft.com/en-us/visualstudio/debugger/debug-interface-access/debug-interface-access-sdk?view=vs-2017]]
[2:07:36][@x13pixels][DBGHELP.DLL[ref
    site="Windows Dev Center"
    page="DbgHelp Functions"
    url=https://docs.microsoft.com/en-us/windows/desktop/Debug/dbghelp-functions]]
[2:08:20][Close it down with a glimpse into the future and a plug of Meow the Infinite[ref
    site="Meow the Infinite"
    url=https://meowtheinfinite.com/]][:speech]
[/video]
