aboutsummaryrefslogtreecommitdiff
path: root/source/nds/entry.cpp
AgeCommit message (Collapse)Author
2013-02-03Synchronise the controller status more spread out inside a rendered frame:Nebuleon Fumika
* before rendering a background; * before rendering sprites; * while rendering more than 128 samples of audio at once ("Prefer fluid video"); * after every 16 scanlines of CPU execution instead of every 1; * while waiting for an audio buffer to become available; * while killing time between frames with fast-forward disabled. Controller presses and releases are now combined in a DS button bitfield using a shorter 32-bit algorithm. See entry.cpp:NDSSFCAccumulateJoypad and #define ACCUMULATE_JOYPAD in the source. This is still not suitable for playing platformers frame-perfectly, but it's much better than half a second of latency to press or release a button, and one still needs to press buttons a bit more than just light taps. I'd say 50 milliseconds is the latency now. Platformers requiring more precision can be played with frameskip 0. DMA does not require double-buffered displaying, so synchronise the controller more often by disabling double-buffered displaying again.
2013-02-03Faking out the sound synchronisation with a buffer of silence wasn't necessary.Nebuleon Fumika
2013-02-03Write back the data cache before using DMA to draw emulated frames.Nebuleon Fumika
2013-02-03Force waiting for a screen to be transferred (update mode 1) because ↵Nebuleon Fumika
otherwise the next screen can go into DMA. Use channel 1 instead of channel 5, which must be busy for some reason.
2013-02-03Fix a name clash between Snes9x's dma.h and the DS2 dma.h by renaming the ↵Nebuleon Fumika
DS2 dma.h to ds2_dma.h. Add preliminary support for drawing emulated screens with DS2 DMA.
2013-02-03Make it easier to change the "high" and "low" CPU frequencies, as well as to ↵Nebuleon Fumika
switch to the user's chosen frequency for the game. Conflicts: source/nds/ds2_main.c source/nds/entry.cpp source/nds/gui.c
2013-02-02Fix an oddity in the sound when returning from a global mute. Fixes music ↵Nebuleon Fumika
loading in Super Mario World.
2013-02-02Correct overzealous detection of buffer overruns. It was making the sound ↵Nebuleon Fumika
crackle constantly, like a record player. Most audible with earphones.
2013-02-01Add an option that controls which element should be more fluid, per game: ↵Nebuleon Fumika
video or audio. This makes most games playable, but the player can choose to get fluid audio instead of fluid video in sound-test modes or games with epic soundtracks.
2013-02-01While killing time between frames, process audio instead of doing nothing. ↵Nebuleon Fumika
Also correctly fill the buffer with silence when returning from pause. This reduces or eliminates crackling. The emulator kills time in two circumstances: * In automatic frameskip mode, without fast forwarding, the emulator kills time if it rendered a frame early. * In manual frameskip mode, without fast forwarding, the emulator kills time to wait for the next rendered frame.
2013-02-01Make the audio timing more precise.Nebuleon Fumika
* Fake out the buffer timing by sending a buffer full of silence when returning from pause. Reduces crackling introduced by the next point. * Send buffers only once every 23.22 milliseconds, not up to four buffers at once (92.88 milliseconds) and randomly thereafter. Reduces note-length jumpiness. * Audio may have trouble catching up if external jitter reaches 11.61 milliseconds. That happens if Mode 7 images or filtered modes take a long time to render, or if chips take a long time to execute.
2013-02-01Hook fast-forward into Settings.TurboSkipFrames.Nebuleon Fumika
2013-02-01When starting CATSFC, assume the backlights are both on, so don't delay 100 ↵Nebuleon Fumika
milliseconds and set both backlights to on.
2013-01-26Turn off the lower screen's backlight when returning from suspend during ↵Nebuleon Fumika
emulation.
2013-01-22Add three hotkeys: temporary fast-forward, sound toggle and return to menu. ↵Nebuleon Fumika
These hotkeys can be overridden per game so that the global version of the hotkey can be ignored. * Language file fixups related to \n (newlines). * Pictochat fixups: shorten START and SELECT to ST and SEL. Should still be recognisable.
2013-01-19Remove unneeded volatility, enabling more optimisations. Sound volatility is ↵Nebuleon Fumika
#define'd away, GUI volatility is simply removed.
2013-01-19Prepare code to ask for a hotkey. Prepare a temporary fast-forward switch.Nebuleon Fumika
2013-01-18Return to CPU level 0 after emitting sound if we're delaying for early frames.Nebuleon Fumika
2013-01-18Revert "Reinstate timer-interrupt audio."Nebuleon Fumika
This reverts commit 944d9a729455de435c3d200752308ceedf250196. Conflicts: source/nds/entry.cpp
2013-01-18Fix multiple compiler warnings: forward declaration, implicit declaration, ↵Nebuleon Fumika
unused variable, variable used uninitialised, unused function (when not used anywhere else with a #define).
2013-01-18Remove some unused functions. Raise the CPU frequency for sound mixing if ↵Nebuleon Fumika
auto frameskip is delaying because it's early.
2013-01-17Reinstate timer-interrupt audio.Nebuleon Fumika
This reverts commit 0d048d05ee50625f15d5235d362df6ee71903fc5.
2013-01-13Revert timer-interrupt audio, but not optimisations done since then. Get the ↵Nebuleon Fumika
controller status every scanline again.
2013-01-12Stop using the deprecated function S9xMixSamplesO and use S9xMixSamples instead.Nebuleon Fumika
Wrap the offset into the audio buffer less often.
2013-01-12Remove 2 extraneous delays. The 100-millisecond delays before ↵Nebuleon Fumika
ds2_setBacklight() MUST STAY, however, otherwise the emulator can crash with the bottom backlight off if a touch is recognised twice in a row. That happens with some broken styluses, so it's not unexpected.
2013-01-12Fix a buffer overflow in audio handling code that corrupted memory used to ↵Nebuleon Fumika
carry the state of the GUI.
2013-01-11Stop constantly testing for 16-bit and stereo in sound handlers. Define ↵Nebuleon Fumika
FOREVER_16_BIT_SOUND and FOREVER_STEREO and use them throughout the code. This is essentially commit 6b36e79013d4c9273a96a9783a2bccdb516f174a, but for sound instead of graphics.
2013-01-11Fix the interrupts glitching sound. Put the sound back at 22050 Hz.Nebuleon Fumika
2013-01-11Reinstate some delays needed by the code to avoid crashing, and actually ↵Nebuleon Fumika
explain in code comments why they're needed. I know ds2_setBacklight(unsigned int) needs a delay before it, otherwise if done too close to another call, it crashes. This partially reverts commit 8951fdff1aada126257e07699ea6f132cb8d2e65.
2013-01-09Attempt to fix the crashing with sound interrupts, part 2: Stop the timer ↵Nebuleon Fumika
before the menu, and restart it after it ends.
2013-01-08Try fixing a crash in the sound interrupt.Nebuleon Fumika
2013-01-08Configurable interrupt interval for the sound timer. Right now, only 22050 ↵Nebuleon Fumika
Hz audio at 2000-microsecond intervals works.
2013-01-08GLORIOUS interrupt-based sound playback. Now, the note-length-hopping ↵Nebuleon Fumika
problem isn't as apparent anymore, and automatic frame skipping doesn't go to 8 FPS all the time in Super Mario World. Thank the deities! Reverses the auto frameskip synchronisation from commit dac11c74ac112728016e51625ac9f2a727152ddd, because that doesn't play well with interrupts.
2013-01-07Require auto_equivalent_skip to be greater than 0 before decrementing it if ↵Nebuleon Fumika
the code is drawing a frame early in automatic frame skip mode. Otherwise, overflow occurs, and we skip 4 billion images.
2013-01-07Revert "Add a bit that tolerates 1/16 latency per frame in automatic ↵Nebuleon Fumika
frameskip mode." This reverts commit d9b6322caafcbd355848a32acd8b8c0fa1746264.
2013-01-07Add a bit that tolerates 1/16 latency per frame in automatic frameskip mode.Nebuleon Fumika
Remove old automatic frameskip code.
2013-01-07Smooth out the automatic frame skipping such that it doesn't go from 1 FPS ↵Nebuleon Fumika
to 8 FPS right away and constantly. The equivalent frame skip will be 2, 3, 5 or 8 most of the time, depending on the game, and will vary a bit depending on rendering demands. For example, the frame skipping in Super Mario World is 3 on the map and in graphically simple levels, and 5 in complex levels.
2013-01-07Fix an off-by-one in the manual frameskip code. It would raise the sound ↵Nebuleon Fumika
speed by 25% if frame skip 3 (Show 1 in 4) rendered a frame early. Optimise the controller code. I don't expect to allow remapping any time soon, because the DS has buttons for every single SNES controller button and nothing more.
2013-01-07Add support for user-selected and automatic frame skipping. Add support for ↵Nebuleon Fumika
PAL timings (20 ms per frame). User-selected frameskip causes slowdowns if the game runs slower than the resulting frame rate, but synchronises correctly if the game runs faster. Automatic frame skipping is still the default. It now only skips up to 8 frames, but in some games still skips that entire 8 frames. What's needed is an algorithm that averages frame latencies over a few seconds and skips while the latency is LOWER than the average.
2013-01-05Sync ALL bits of the joypad again. This may make controls a bit slower to ↵Nebuleon Fumika
parse, but is required by Super Mario All-Stars at least.
2013-01-02Sleep when the lid is closed AND emulation is running. I don't know to what ↵Nebuleon Fumika
extent this will save on battery usage, though I do set the DSTWO's CPU to the lowest frequency while it sleeps.
2013-01-02Make Display Mode 4 an antialiased whole-screen mode.Nebuleon Fumika
* source/nds/displaymodes.cpp: Rewritten, assigned copyright to myself (GPLv2). * CATSFC/system/language.msg: Changed the English and French text for display modes.
2012-12-28Keep the audio processing unit (APU) enabled even when the user disabled the ↵Nebuleon Fumika
audio for a game. This allows some games that synchronise on the APU's actions to continue working.
2012-12-27Accidentally committed the previous revision with sound functions emptied.Nebuleon Fumika
2012-12-27Speed up rendering by an unknown amount.Nebuleon Fumika
gfx.cpp, others: Avoid always checking for Settings.SixteenBit if FOREVER_16_BIT is defined. port.h: Define FOREVER_16_BIT below PIXEL_FORMAT.
2012-12-26Add the update methods for the upper and lower screen into defines.Nebuleon Fumika
2012-12-26Smoother sound. Raise the sound sampling frequency to 48000 Hz.Nebuleon Fumika
2012-12-26Universally use update method 2 for the lower screen and 0 for the upper ↵Nebuleon Fumika
screen. Method 1 causes problems after about 15 minutes; despite the double-buffering, screen updates start to tear in the middle consistently.
2012-12-22Preliminary Snes9x-based cheat code support. Not tested, because the file ↵Nebuleon Fumika
selection interface freezes when it gets to the folder containing Mightymo's cheat files, whereas it did not do this before with the converted Mightymo cheats. (335 files -> 679, though.)
2012-12-21Eliminate the latency of button press recognition, which was bad enough to ↵Nebuleon Fumika
lose keys entirely sometimes, and could otherwise delay a button press or release by 200 ms. This was the entire reason I created the fork, and I finally did it! It syncs the controls every scanline of a frame, which costs about 60,000 MIPS instructions per frame to deal with. Luckily, the processor runs at 396 MHz, which means the cost of checking the controls is 1% of the CPU's power.