|I've been making an NES emulator for the ESP32.
I got it coded, but it's crashing into a reboot loop, and not easily debuggable on that platform.
So I've made a GFX driver for DirectX under Windows.
But in using it I discovered that my header-only library cannot be header-only. So I had to spend hours going through my rather lengthy library making CPP files. This was especially nasty where the truetype was concerned.
So I fire up the driver. It crashes on start. Turns out just getting the dimensions of the drawing surface (
m_psurface->GetSize()) was causing my app to crash. Bizarre.
So I dig and I dig, and I find out that GCC is using a different calling convention to return pointers to structures from static member functions than Microsoft does. They're both STDCALL declared but GCC interprets an ambiguous rule about returning structs differently than MS. MS later seems to have clarified by indicating that static members will NOT return pointers in a register. GCC does.
So now, I had to patch a system header file (d2d1.h) to explicitly return the struct pointer from the offending methods.
Anyway, now that my GFX library is now at another major revision because of adding the CPP files to it, but at least I've got it drawing to a window.
What's cool is I can run the same code on Windows as I can on the ESP32 now.
This took me most of the day, and I have no idea how I'm going to redistribute this given the modified system header file.**
**no I can't modify a second file. The interface definitions i had to modify are used all over directX, and other headers include this one, so I was stuck.
Anyway, this was probably the most hardcore coding session I've had in awhile, even though the driver itself is about 100 lines (mostly empty)
Real programmers use butterflies