249 karma · joined July 31, 2017
theron@spiegl.dev
The APU sends all of its samples to a staging buffer, then between video frames, the Mutex for the SDL buffer is locked and the staging buffer is emptied into it. The SDL callback also locks the Mutex 60 times per second, takes evenly spaced samples from the raw data, and truncates what it consumed if it had more than it needed. Now the audio keeps perfect pace with the emulator, whether it slows to 58 FPS or goes too fast, and there's no popping and clicking. If you're curious, here are the relevant spots in the code now:
https://github.com/spieglt/nestur/blob/master/src/audio.rs https://github.com/spieglt/nestur/blob/e49921541d493b3616352...
I just beat the first Zelda dungeon last night, saving the file afterwards, and it was indeed really satisfying.
You've lost a nickel! It was a problem with my signed-offset branch function where a bad cast was allowing 0x80 (-128) to overflow. It was really fun trying to troubleshoot by hooking certain memory accesses and subroutines, but what wound up fixing it was investigating the crash of Blargg's `instr_test-v5/rom_singles/11-stack.nes`. Thank you for your help!
"a stdlib accommodating all of its usecases would be as comically huge as Python's, with all the problems that come from that."
That's a straw man. I don't want a stdlib like Python's, I want one like Go's.
Chapter 17:
The greatest of rulers is but a shadowy presence;
Next is the ruler who is loved and praised;
Next is the one who is feared;
Next is the one who is reviled.
Those lacking in trust are not trusted.
However, [the greatest rulers] are cautious and honor words.
When their task is done and work complete,
Their people all say, "This is just how we are."
Chapter 29:
Those who would gain the world and do something with it, I see that they will fail.
For the world is a spiritual vessel and one cannot put it to use.
Those who use it ruin it.
Those who grab hold of it lose it.
[...]
(Phillip J. Ivanhoe translation)
https://github.com/spieglt/fb-delete
And one to download all "Photos of you", which Facebook doesn't include when downloading your data:
"The address of a block returned by malloc or realloc in GNU systems is always a multiple of eight (or sixteen on 64-bit systems)."
I was about to say, "what if they're on a 32-bit system and so were only allocated one 8-byte block?" but then realized that since they'd requested 9 bytes, they'd be given two 8-byte blocks, or one 16-byte block on a 64-bit system. Is that right?
Works great, and I'm planning on integrating that functionality into my project which transfers files between laptops using only wireless cards, no LAN required. https://github.com/spieglt/flyingcarpet
I posted this a few months ago when it was just a command line tool, but it now has a GUI and is much more stable. Linux support still forthcoming. Please give it a try and let me know what you think. Thanks!