[video output=day508 member=cmuratori stream_platform=twitch stream_username=handmade_hero project=code title="Fixing the Remaining GitHub Issues" vod_platform=youtube id=iySIodVWS_s annotator=Miblo]
[0:00][Recap and set the stage for the bonus stream][:speech]
[1:58][Close "Segfault in handmade_brain.cpp:277" issue[ref
    site=GitHub
    page="HandmadeHero / cpp / Segfault in handmade_brain.cpp:277"
    url=https://github.com/HandmadeHero/cpp/issues/49]][:admin]
[3:40][Addressing the "Trouble with NVIDIA Optimus" issue,[ref
    site=GitHub
    page="HandmadeHero / cpp / Trouble with NVIDIA Optimus"
    url=https://github.com/HandmadeHero/cpp/issues/51] with a few words on power efficiency][:research]
[12:03][Check out win32_handmade.exe in Dependencies][:admin]
[13:57][Check out the export table of win32_handmade_opengl.dll in Dependencies][:admin]
[15:59][Export the NvOptimusEnablement and AmdPowerXpressRequestHighPerformance symbols]
[16:58][Check out the new export table of win32_handmade.exe in Dependencies][:admin]
[18:17][Close that issue[ref
    site=GitHub
    page="HandmadeHero / cpp / Trouble with NVIDIA Optimus"
    url=https://github.com/HandmadeHero/cpp/issues/51]][:admin]
[19:14][Addressing the "Linux updates" issue[ref
    site=GitHub
    page="HandmadeHero / cpp / Linux updates"
    url=https://github.com/HandmadeHero/cpp/issues/65]][:"platform layer" :research]
[19:59][Rename various struct members so they don't clash with system definitions of Linux][:"platform layer"]
[21:31][Understanding Linux's mmap() in contrast to Windows' VirtualFree()[ref
    site="Windows Dev Center"
    page="VirtualFree function"
    url=https://msdn.microsoft.com/en-us/library/windows/desktop/aa366892.aspx]][:memory :speech]
[26:02][Delete the :"file io" function pointers from platform_api and remove Win32ResizeDIBSection()][:memory :"platform layer"]
[33:11][Try to :run the game, crash in OpenGLEndFrame() and investigate why][:hardware :rendering]
[34:59][Temporarily disable the window-moving case in Win32MainWindowCallback()][:"window management"]
[35:18][Find that the game runs, but cannot be resized][:"window management" :run]
[35:36][Investigate why we cannot resize our window[ref
    site="Windows Dev Center"
    page="Window Styles"
    url=https://docs.microsoft.com/en-us/windows/desktop/winmsg/window-styles]][:"window management" :research]
[37:32][Find that we can resize after all, but that our cursor remains as the regular pointer][:run :"window management"]
[38:31][Make Win32MainWindowCallback() use the "resize" cursor][:"window management"]
[39:05][Find that we now get the resizing cursor[ref
    site=Wikipedia
    page="Controlled flight into terrain"
    url=https://en.wikipedia.org/wiki/Controlled_flight_into_terrain]][:"window management" :run]
[41:49][Enable aspect-ratio preserving resize in Win32MainWindowCallback()][:"window management" :rendering]
[43:42][Find that our aspect-ratio preserving resize works fine][:"window management" :rendering :run]
[44:07][Replace win32_window_dimension with a v2u, and delete win32_offscreen_buffer]
[45:23][Ensure that platform_memory_block contains a Size][:memory :"platform layer" :research]
[47:04][Close that issue[ref
    site=GitHub
    page="HandmadeHero / cpp / Linux updates"
    url=https://github.com/HandmadeHero/cpp/issues/65]][:admin :memory :"platform layer"]
[48:05][Addressing the "Window fullscreen bug" issue[ref
    site=GitHub
    page="HandmadeHero / cpp / Window fullscreen bug"
    url=https://github.com/HandmadeHero/cpp/issues/70]][:"window management" :research]
[48:23][Try out window movement keys to find that "minimise" breaks CreatFramebuffer()][:run :"window management"]
[49:53][Try unsuccessfully to reproduce the bug from the issue[ref
    site=GitHub
    page="HandmadeHero / cpp / Window fullscreen bug"
    url=https://github.com/HandmadeHero/cpp/issues/70]][:"window management" :run]
[51:05][Check out our :"window management" code][:research]
[53:44][Enable Win32MainWindowCallback() to handle resizing to encompass the entire screen][:"window management"]
[59:38][Find that fullscreening does not work][:run :"window management"]
[1:00:22][Step in to Win32MainWindowCallback() in the BecomingFullscreen case[ref
    site="Windows Dev Center"
    page="SetWindowLongA function"
    url=https://docs.microsoft.com/en-us/windows/desktop/api/winuser/nf-winuser-setwindowlonga]][:run :"window management"]
[1:03:23][Make ToggleFullscreen() disable WS_OVERLAPPEDWINDOW in the window's style][:"window management"]
[1:06:46][Try to snoop our window messages in Spy++][:run :"window management"]
[1:08:56][Add Spy++ 64-bit to MSVC[ref
    site="Visual Studio Docs"
    page="Introducing Spy++"
    url=https://docs.microsoft.com/en-us/visualstudio/debugger/introducing-spy-increment]][:admin]
[1:10:07][Snoop our window messages in Spy++][:run :"window management"]
[1:14:36][Enable Win32MainWindowCallback() handle WM_WINDOWPOSCHANGED messages][:"window management"]
[1:16:42][Find that our :"window management" works better][:run]
[1:17:24][Prevent ToggleFullscreen() from disabling WS_OVERLAPPEDWINDOW in the window's style][:"window management"]
[1:17:51][Find that the :"window management" magically works][:run]
[1:20:14][Prepare to close that issue[ref
    site=GitHub
    page="HandmadeHero / cpp / Window fullscreen bug"
    url=https://github.com/HandmadeHero/cpp/issues/70]][:admin]
[1:21:30][Investigate why our window width and height are getting zeroed out][:research :"window management"]
[1:25:05][Make BeginUIFrame() only use the DrawRegion, renaming WindowWidth and WindowHeight in game_render_commands to OSWindowWidth and OSWindowHeight][:rendering :ui :"window management"]
[1:29:53][Find that our :UI is now correctly aligned][:run :"window management"]
[1:30:20][Trigger our "minimise" bug to find that we are :rendering directly to the window resolution requested of us][:run :"window management"]
[1:32:55][Make BeginUIFrame() and OpenGLBeginFrame() use the renderer's width and height, renaming DrawRegion in game_render_commands to OSDrawRegion][:rendering :ui :"window management"]
[1:41:41][Find that we have fixed our "minimise" bug][:rendering :run :"window management"]
[1:45:12][Close that issue[ref
    site=GitHub
    page="HandmadeHero / cpp / Window fullscreen bug"
    url=https://github.com/HandmadeHero/cpp/issues/70]][:admin :"window management"]
[1:45:24][Check the "Fog is broken" issue in-game[ref
    site=GitHub
    page="HandmadeHero / cpp / Fog is broken!"
    url=https://github.com/HandmadeHero/cpp/issues/78]][:camera :run]
[1:47:30][Introduce AddSnake() and related functions for CreateDungeon() to call][:"entity system" :"procedural generation"]
[1:53:58][Hit our assertion in RecursiveOpenTileSearch()][:"entity system" :"procedural generation" :run]
[1:58:14][Try placing the snake in the hero's bedroom][:"entity system" :"procedural generation"]
[1:58:32][See the snake just fine][:"entity system" :"procedural generation" :run]
[1:59:16][Make AddSnake() elevate the body and brighten the light][:"entity system" :"procedural generation"]
[1:59:54][Check out our snake][:"entity system" :"procedural generation" :run]
[2:01:07][Fix AddEntity() to use non-temporary :memory, and make CreateDungeon() call AddSnake() again][:"entity system"]
[2:04:19][Find our snake in the dungeon, but see that the :lighting down there is not correctly fogged][:"entity system" :run]
[2:05:41][Investigate the fog's alpha computation in CompileZBiasProgram()][:hardware :lighting :rendering :research]
[2:10:26][Make CompileZBiasProgram() compute the :lighting before the fogging][:hardware :rendering]
[2:14:09][Find that the fogging now fogs to black][:hardware :lighting :rendering :run]
[2:14:50][Scrutinise the fogging in CompileZBiasProgram()][:hardware :lighting :rendering :research]
[2:17:17][Make CompileZBiasProgram() compute SurfaceReflect at the end][:hardware :lighting :rendering]
[2:18:36][Find that the fogging now works correctly][:hardware :lighting :rendering :run]
[2:20:31][Close that issue[ref
    site=GitHub
    page="HandmadeHero / cpp / Fog is broken!"
    url=https://github.com/HandmadeHero/cpp/issues/78]][:admin :hardware :lighting :rendering]
[2:21:14][Q&A][:speech]
[2:21:26][Investigate twitching][:admin]
[2:24:08][Call it a day][:speech]
[/video]
