Commit Graph

87 Commits

Author SHA1 Message Date
sinamas
644441168c refactoring.
git-svn-id: https://gambatte.svn.sourceforge.net/svnroot/gambatte@256 9dfb2916-2d38-0410-aef4-c5fe6c9ffc24
2011-08-25 17:35:27 +00:00
sinamas
3233abfabc refactoring.
git-svn-id: https://gambatte.svn.sourceforge.net/svnroot/gambatte@255 9dfb2916-2d38-0410-aef4-c5fe6c9ffc24
2011-08-18 19:48:16 +00:00
sinamas
962dc11503 refactoring.
git-svn-id: https://gambatte.svn.sourceforge.net/svnroot/gambatte@254 9dfb2916-2d38-0410-aef4-c5fe6c9ffc24
2011-08-18 18:15:49 +00:00
sinamas
e1470f5279 - libgambatte: *
- tons of re (cgb _and_ dmg).

$ ./run_tests.sh
...
Ran 2755 tests.
0 failures.



git-svn-id: https://gambatte.svn.sourceforge.net/svnroot/gambatte@246 9dfb2916-2d38-0410-aef4-c5fe6c9ffc24
2011-07-23 17:02:32 +00:00
sinamas
3ee82abe80 - Optimize save state thumbnail generation.
git-svn-id: https://gambatte.svn.sourceforge.net/svnroot/gambatte@243 9dfb2916-2d38-0410-aef4-c5fe6c9ffc24
2010-04-04 16:17:40 +00:00
sinamas
9588aef11c - Better (simpler and makes sense) hypothesis for mode3 sprite cycles.
git-svn-id: https://gambatte.svn.sourceforge.net/svnroot/gambatte@240 9dfb2916-2d38-0410-aef4-c5fe6c9ffc24
2010-03-26 20:20:10 +00:00
sinamas
a42f267354 - Document libgambatte better.
- Document resampling framework better.
- Use a single constant for setting number of resampler channels rather 
than two.
- thread-safety -> thread safety


git-svn-id: https://gambatte.svn.sourceforge.net/svnroot/gambatte@239 9dfb2916-2d38-0410-aef4-c5fe6c9ffc24
2010-02-04 00:14:08 +00:00
sinamas
350533a224 - Redesign Qt multimedia framework to use a worker thread for MediaSource updates. This was a ton of work, but should make underruns a lot less likely. The majority of
underruns are caused by video I/O blocking (even when not syncing to vblank). It also means that vsync blocking is a non-issue. Lots of thread-safety considerations had to 
be done. Lots of tools developed to deal with new problems. Things redesigned to be asynchronous to avoid blocking the worker thread. New interfaces developed to give 
clients access to these things without too much pain, as clients need to deal with thread-safety issues, and be able to do things asynchronously to avoid blocking and 
unnecessary synchronization. Things developed and then scrapped as I changed my mind. Lots of thinking and testing to ensure video smoothness.
- Make configuration of the multimedia framework way more flexible, by adding methods for configuring video and sound, rather than forcing the use of the SoundDialog or 
VideoDialog. Thus clients can make their own GUI for such things.
- Pass raw input events to MediaSources so that clients will not have to use the InputDialog with its Button system.
- Split BlitterWidget blitting into three methods: blit, draw, and sync, such that blitting is supposedly a fast pixel copy or buffer swap, while draw prepares for 
presentation, and sync presents the completed video frame ASAP. Blit needs to be fast to avoid blocking the worker thread to avoid underruns.
- Allow heavy MediaSource video work to be skipped when frames are skipped.
- Do some work in parallel on SMP systems.
- Adjust low audio buffer detection to make it more robust.
- Move variance calculation to the user of estimations, because the variance calculated by estimators is not well defined anyway.
- Add support for adjustable fast-forward speed.
- Fast-forward now outputs audio, by skipping entire segments of audio when skipping frames.
- Adjust blitters to conform to the new threaded model.
- Direct3DBlitter: Apparently vertices point to the center of pixels. Subtract 0.5 from vertex coordinates.
- DirectDrawBlitter: Sleep more when far from vblank.
- QGLBlitter: Get rid of makeCurrent calls, because they apparently block and can be slow and don't seem to be needed anyway. They also seem to cause instability with some 
drivers.
- XvBlitter: Double buffer to delay updates to sync time.
- X11Blitter: Double buffer when not scaling to delay updates to sync time.
- QPainterBlitter: Double buffer when not scaling to delay updates to sync time.
- SdlBlitter: Delay updates to sync time.
- AlsaEngine: Set max periods to 16 to work around stupid ALSA plugins and drivers that advertise smaller period sizes than properly supported. ALSA always picks the 
maximum number of periods allowed, which means it picks the smallest period size allowed for a given buffer size.
- QPainterBlitter: Don't disable updates when not paused, because this breaks macx.
- Support pause on focus out.
- Add MiscDialog to allow user configuration of fast-forward speed and focus policy.
- Separate sync to refresh rate logic from sync to vblank logic.
- Sync to refresh rate menu option.
- Use semi-bilinear filtering rather than bilinear filtering for soft-scaling blitters.
- MakeSincKernel: Consider rounding effects when computing absolute gain.
- MakeSincKernel: Use a function pointer rather than a template argument to reduce code bloat.
- Reorder sinc kernel phases.
- PolyPhaseConvoluter: Simplify some calculations.
- Replace Hamming and Blackman windowed sincs with Kaiser windowed sinc of appropriate betas, because they require a lower number of taps to achieve the same specs.
- Use rounding shifts in resamplers for higher precision and performance.
- libgambatte: Update returns on video frame completion rather than using a callback for notification.
- libgambatte: Move video filters and color conversion out of the library.
- libgambatte: Get rid of unnecessarily complex VideoBlitter interface.
- libgambatte: Use bit flags rather bools for input state.
- Change some parameters to constants in 2xsai and hqx video filters.
- Probably other stuff I've forgotten about.



git-svn-id: https://gambatte.svn.sourceforge.net/svnroot/gambatte@234 9dfb2916-2d38-0410-aef4-c5fe6c9ffc24
2010-02-02 21:30:46 +00:00
sinamas
e2e5adcdc7 - Use MinKeeper to schedule Memory::events.
- Remove old incEndtime function since it's not worth the maintenance 
overhead.


git-svn-id: https://gambatte.svn.sourceforge.net/svnroot/gambatte@228 9dfb2916-2d38-0410-aef4-c5fe6c9ffc24
2009-04-15 02:20:57 +00:00
sinamas
da5bc2b964 - Add data structure that efficiently keeps track of the minimum of a
small, fixed set of variables, using templates to autogenerate 
efficient, unrolled functions that update the binary tree for each 
variable. It also efficiently supports priorities among variables when 
their values are equal, and can give variables that change the most 
frequently a better spot in the tree if the number of variables isn't a 
power of 2. Will be used for event scheduling.


git-svn-id: https://gambatte.svn.sourceforge.net/svnroot/gambatte@227 9dfb2916-2d38-0410-aef4-c5fe6c9ffc24
2009-04-15 02:18:34 +00:00
sinamas
a9ab1bea78 - Lyc0irq on display enable.
git-svn-id: https://gambatte.svn.sourceforge.net/svnroot/gambatte@226 9dfb2916-2d38-0410-aef4-c5fe6c9ffc24
2009-03-23 21:25:14 +00:00
sinamas
692b98eb12 - Make sure to reset passed pointers when deleted. Fixes potential crash when loadin ROM during OAM busy.
git-svn-id: https://gambatte.svn.sourceforge.net/svnroot/gambatte@223 9dfb2916-2d38-0410-aef4-c5fe6c9ffc24
2009-01-10 19:22:59 +00:00
sinamas
cbf173e0a8 Fix mbc2 not getting a rambank
git-svn-id: https://gambatte.svn.sourceforge.net/svnroot/gambatte@203 9dfb2916-2d38-0410-aef4-c5fe6c9ffc24
2008-11-03 20:42:50 +00:00
sinamas
7a939e1522 Fix HqXx pitch.
git-svn-id: https://gambatte.svn.sourceforge.net/svnroot/gambatte@202 9dfb2916-2d38-0410-aef4-c5fe6c9ffc24
2008-11-01 07:38:24 +00:00
sinamas
03ca427b8d Lower opacity OSD text.
git-svn-id: https://gambatte.svn.sourceforge.net/svnroot/gambatte@197 9dfb2916-2d38-0410-aef4-c5fe6c9ffc24
2008-10-26 15:11:07 +00:00
sinamas
7fb056af35 Actually add the hq3x code mentioned in previous commit.
git-svn-id: https://gambatte.svn.sourceforge.net/svnroot/gambatte@196 9dfb2916-2d38-0410-aef4-c5fe6c9ffc24
2008-10-26 13:35:29 +00:00
sinamas
7d6b0db817 Add adapted and optimized hq3x.
Revert to big f'ing switch hq2x code, as there's less duplication now. Also optimized interpolation functions further. No idea how I missed that initially.


git-svn-id: https://gambatte.svn.sourceforge.net/svnroot/gambatte@195 9dfb2916-2d38-0410-aef4-c5fe6c9ffc24
2008-10-26 13:34:13 +00:00
sinamas
bda7eaf108 saner ly write behaviour
git-svn-id: https://gambatte.svn.sourceforge.net/svnroot/gambatte@194 9dfb2916-2d38-0410-aef4-c5fe6c9ffc24
2008-10-26 13:21:06 +00:00
sinamas
12d33eca65 Append "_dmg" to save base name when forcing DMG mode, to avoid corrupting CGB save files and vice versa.
git-svn-id: https://gambatte.svn.sourceforge.net/svnroot/gambatte@193 9dfb2916-2d38-0410-aef4-c5fe6c9ffc24
2008-10-26 06:23:42 +00:00
sinamas
1f6c8dc2d4 Tile loading and tile rendering can seemingly get out of sync when modifying scx at a critical time. Another pessimation with little gain in the name of accuracy.
Use a look-up table to do tile byte merging.


git-svn-id: https://gambatte.svn.sourceforge.net/svnroot/gambatte@192 9dfb2916-2d38-0410-aef4-c5fe6c9ffc24
2008-10-26 05:44:56 +00:00
sinamas
ec9199c334 no sprites or sprite mapping busy cycles on first line after display enable. slight cleanup. small oam accessibility correction.
git-svn-id: https://gambatte.svn.sourceforge.net/svnroot/gambatte@191 9dfb2916-2d38-0410-aef4-c5fe6c9ffc24
2008-10-25 10:41:53 +00:00
sinamas
5fc35493a6 revert DMG window display while bg disabled change
git-svn-id: https://gambatte.svn.sourceforge.net/svnroot/gambatte@190 9dfb2916-2d38-0410-aef4-c5fe6c9ffc24
2008-10-24 08:43:19 +00:00
sinamas
bdba031382 No rambanks for ROMs that don't request any.
Route invalid rombank addresses in non-power-of-2 number of rombanks cases to disabled area assuming ceiled power of 2 address bus.
DMG window display disregards bg enable bit.


git-svn-id: https://gambatte.svn.sourceforge.net/svnroot/gambatte@189 9dfb2916-2d38-0410-aef4-c5fe6c9ffc24
2008-10-24 08:19:15 +00:00
sinamas
b061b5db6c Add "force DMG mode" option.
git-svn-id: https://gambatte.svn.sourceforge.net/svnroot/gambatte@188 9dfb2916-2d38-0410-aef4-c5fe6c9ffc24
2008-10-24 05:09:37 +00:00
sinamas
5bbabdcfdd - Real-time, sophisticated resampling framework with several performance/quality profiles for dynamically generated windowed sinc and CIC chains based on analysis of
fourier transforms and optimal cost equations. Fast 2-tap linear as a low quality alternative.
- libgambatte: Use deltas and a running sum to decrease buffer writes in sound emulation sample generation.
- libgambatte: Rearrange sound emulation event loop to optimize for high-frequency event units.
- libgambatte: Initialize palette arrays to avoid valgrind noise.
- Don't do resampling in libgambatte. Update API to reflect this.
- Move non-emulation common code to a common directory to avoid duplication.
- Update front-ends to new libgambatte API.
- Utilize resampling framework in front-ends. Selectable resamplers.
- Improved adaptive sleep class that estimates oversleep.
- Gambatte SDL: Estimate actual output sample rate in terms of OS timers and derive frame rate from it.
- Gambatte SDL: Move AudioData and RingBuffer classes to separate files.
- Gambatte SDL: Make underruns slightly less painful, by resetting buffer positions.
- Gambatte Qt: Update AudioEngine to support sample rate estimation in terms of OS timers.
- Gambatte Qt: Implement sample rate estimation in ALSA and OSS audio engines.
- Gambatte Qt: AlsaEngine: Revert to using snd_pcm_avail_update for buffer status since snd_pcm_delay may consider external latencies.
- Gambatte Qt: AlsaEngine: Use snd_pcm_hw_params_set_buffer_time_near. Don't request a particular number of periods per buffer.
- Gambatte Qt: AlsaEngine: Use hw as default custom device string, rather than hw:0,0.
- Gambatte Qt: OssEngine: Don't trust GETOSPACE fragment info.
- Gambatte Qt: Estimate optimal frame rate based on sample rate estimations.
- Gambatte Qt: Extend BlitterWidget to support estimation of vsynced frame rate in terms of OS timers.
- Gambatte Qt: Implement vsync frame rate estimation in QGlBlitter, Direct3DBlitter and DirectDrawBlitter.
- Gambatte Qt: Use a combination of OS timer sample rate estimation and vsync frame rate estimation to derive resampling ratio for no-frame-duplication vsync.
- Gambatte Qt: Change API to reflect MediaSources not being responsible for resampling.
- Gambatte Qt: Make sure to parent PaletteDialog list model, so it gets deleted properly.
- Various refactoring, small changes and stuff I forgot.


git-svn-id: https://gambatte.svn.sourceforge.net/svnroot/gambatte@165 9dfb2916-2d38-0410-aef4-c5fe6c9ffc24
2008-10-13 21:08:08 +00:00
sinamas
6aff6b2cbd Fix LY display disable regression
git-svn-id: https://gambatte.svn.sourceforge.net/svnroot/gambatte@164 9dfb2916-2d38-0410-aef4-c5fe6c9ffc24
2008-10-01 10:26:05 +00:00
sinamas
378db29118 Correct unhalttime when resetting counters. Fixes perodic infinite halt issue in Kirby's Star Stacker and probably other games.
git-svn-id: https://gambatte.svn.sourceforge.net/svnroot/gambatte@163 9dfb2916-2d38-0410-aef4-c5fe6c9ffc24
2008-07-16 21:27:11 +00:00
sinamas
dd884dd74f Fix GCC 4.3 warnings about people getting confused by operator precedence by adding parentheses.
git-svn-id: https://gambatte.svn.sourceforge.net/svnroot/gambatte@159 9dfb2916-2d38-0410-aef4-c5fe6c9ffc24
2008-07-11 20:56:40 +00:00
sinamas
3f386309ea Fix potential problem with rgb32ToUyvy cache init values on 16-bit systems
git-svn-id: https://gambatte.svn.sourceforge.net/svnroot/gambatte@158 9dfb2916-2d38-0410-aef4-c5fe6c9ffc24
2008-07-09 01:38:26 +00:00
sinamas
d96388dd8e Fix wrong pitch passed to filter if color conversion is needed.
git-svn-id: https://gambatte.svn.sourceforge.net/svnroot/gambatte@157 9dfb2916-2d38-0410-aef4-c5fe6c9ffc24
2008-07-09 01:36:21 +00:00
sinamas
3b3a1a6d59 fix gcc-4.3 compilation
avoid signed overflow in constant (which is both undefined and likely to cause problems on architectures where sizeof(long) != sizeof(int)) in rgb2yuv code.


git-svn-id: https://gambatte.svn.sourceforge.net/svnroot/gambatte@156 9dfb2916-2d38-0410-aef4-c5fe6c9ffc24
2008-07-07 16:27:47 +00:00
sinamas
53ff519f87 std::ifstream construction missing binary flag
git-svn-id: https://gambatte.svn.sourceforge.net/svnroot/gambatte@155 9dfb2916-2d38-0410-aef4-c5fe6c9ffc24
2008-07-07 00:37:12 +00:00
sinamas
e984450f7b missing includes
missing virtual destructor


git-svn-id: https://gambatte.svn.sourceforge.net/svnroot/gambatte@146 9dfb2916-2d38-0410-aef4-c5fe6c9ffc24
2008-05-20 11:21:03 +00:00
sinamas
a55d12f145 add save state actions to GUI menu
clean up GUI menu creation code
move GUI recent files to submenu
move state 0 OSD pos to rightmost to match kbd layout
state 1 default on ROM load
support external save state files
add number key slot selection shortcuts


git-svn-id: https://gambatte.svn.sourceforge.net/svnroot/gambatte@145 9dfb2916-2d38-0410-aef4-c5fe6c9ffc24
2008-05-20 07:59:18 +00:00
sinamas
b86280ae0a utilize templates for more flexible osd text printing
use grey osd text with black outline for save/load state messages


git-svn-id: https://gambatte.svn.sourceforge.net/svnroot/gambatte@144 9dfb2916-2d38-0410-aef4-c5fe6c9ffc24
2008-05-19 16:21:40 +00:00
sinamas
6c84775d0e add bitmap font rendering with font based on Bitstream Vera Sans
osd state n saved/loaded text
empty state osd thumbs marked with "Empty" text
adjust thumbnail interpolation weighing slightly


git-svn-id: https://gambatte.svn.sourceforge.net/svnroot/gambatte@143 9dfb2916-2d38-0410-aef4-c5fe6c9ffc24
2008-05-05 23:20:34 +00:00
sinamas
686e286d6a save state selection
save state osd preview snapshots
fix a few potential security holes when loading invalid state
get rid of some undefined behaviour in statesaver
always draw in rgb32, color convert afterwards, too bad for maemo/16-bit
depth users
get rid of silly c string stuff


git-svn-id: https://gambatte.svn.sourceforge.net/svnroot/gambatte@142 9dfb2916-2d38-0410-aef4-c5fe6c9ffc24
2008-05-05 01:07:25 +00:00
sinamas
b5e5dc54df fix silly initstate ifreg regression
git-svn-id: https://gambatte.svn.sourceforge.net/svnroot/gambatte@136 9dfb2916-2d38-0410-aef4-c5fe6c9ffc24
2008-03-18 10:25:23 +00:00
sinamas
8c83879e7f save savedata before loading state
git-svn-id: https://gambatte.svn.sourceforge.net/svnroot/gambatte@129 9dfb2916-2d38-0410-aef4-c5fe6c9ffc24
2008-03-04 06:07:32 +00:00
sinamas
8a07c109f3 save state infrastructure,
clean up video timing code,
use save state for initialization and reset,
do color conversion outside filters, fast rgb32ToUyvy,
add overlooked oamdma event,
adjust subcycle irq timing (shouldn't affect anything),
various refactoring


git-svn-id: https://gambatte.svn.sourceforge.net/svnroot/gambatte@126 9dfb2916-2d38-0410-aef4-c5fe6c9ffc24
2008-03-03 11:59:46 +00:00
sinamas
b0a08bd380 Decouple Qt GUI from gambatte.
Lots of cleanups, flexibility added, setting of various properties, frame time,
aspect ratio, button events, video sources, sample rates, pauseOnDialogExec, custom menus etc.
Document some interfaces.
Support for setting approximate sound buffer latency.
Use rational math for 100% exact timers (even though the actual system timers are unlikely to be accurate).
Add fast-forward to input settings.
Scalebuffer dstpitch aware.
timeGetTime() fallback for win32
Store full screen mode values/text rather than less reliable indexes.
Repaint on xvblitter port changes to avoid color key not getting repainted.
stuff I forgot


git-svn-id: https://gambatte.svn.sourceforge.net/svnroot/gambatte@120 9dfb2916-2d38-0410-aef4-c5fe6c9ffc24
2008-02-12 12:59:18 +00:00
sinamas
f3a6c902ff preoffset mem pointers. get rid of unused memory.
git-svn-id: https://gambatte.svn.sourceforge.net/svnroot/gambatte@119 9dfb2916-2d38-0410-aef4-c5fe6c9ffc24
2008-01-31 11:36:04 +00:00
sinamas
d7e9f01a3f various oamdma accuracy. oamdma bus conflicts with cpu, ppu, cgbdma. rewritten memory read/write methods. accurate timing of ppu sprite mapping reads. fix recent cgb sprite cycles sorting slip up.
git-svn-id: https://gambatte.svn.sourceforge.net/svnroot/gambatte@118 9dfb2916-2d38-0410-aef4-c5fe6c9ffc24
2008-01-31 07:43:54 +00:00
sinamas
695fd65c9d 0xFEA0-0xFEFF not writable when OAM isn't. unusable ioram bits fixes. dmg ioram startup state fixes.
git-svn-id: https://gambatte.svn.sourceforge.net/svnroot/gambatte@115 9dfb2916-2d38-0410-aef4-c5fe6c9ffc24
2008-01-10 04:47:59 +00:00
sinamas
fd8836c6ae cgb dma from various areas results in 0xFF being written.
git-svn-id: https://gambatte.svn.sourceforge.net/svnroot/gambatte@114 9dfb2916-2d38-0410-aef4-c5fe6c9ffc24
2008-01-09 01:08:46 +00:00
sinamas
8b1a6d8e7d wx affects sprite m3 cycles. cache m3 cycles, related refactoring. readjust cgb dma cycles to previously changed m3 timing. clean up goofy lyc calculation.
git-svn-id: https://gambatte.svn.sourceforge.net/svnroot/gambatte@113 9dfb2916-2d38-0410-aef4-c5fe6c9ffc24
2008-01-08 05:02:29 +00:00
sinamas
0efb5148f3 int width deps. Gambatte namespace
git-svn-id: https://gambatte.svn.sourceforge.net/svnroot/gambatte@112 9dfb2916-2d38-0410-aef4-c5fe6c9ffc24
2007-12-25 19:32:18 +00:00
sinamas
0aa93707ce more type width dependency fixes
git-svn-id: https://gambatte.svn.sourceforge.net/svnroot/gambatte@111 9dfb2916-2d38-0410-aef4-c5fe6c9ffc24
2007-11-28 16:57:26 +00:00
sinamas
546de53beb less int > 16-bits assumptions
git-svn-id: https://gambatte.svn.sourceforge.net/svnroot/gambatte@110 9dfb2916-2d38-0410-aef4-c5fe6c9ffc24
2007-11-27 05:01:13 +00:00
sinamas
9ee4396f64 fix broken volume on/off event notification
git-svn-id: https://gambatte.svn.sourceforge.net/svnroot/gambatte@106 9dfb2916-2d38-0410-aef4-c5fe6c9ffc24
2007-11-18 13:10:36 +00:00