Commit graph

512 commits

Author SHA1 Message Date
Michel Heily ec0e796536 core: arm7tdmi: thumb: Reduce branches in exec functions
Former-commit-id: 69493480eddee066bc4812c4c1abd6c520a00231
2020-01-17 16:11:43 +02:00
Michel Heily 40de6bf893 core: arm7tdmi: Align PC according to current ISA state
Former-commit-id: 049f01247f3fcc429f07e1761ceed25e749ce77e
2020-01-17 16:11:43 +02:00
Michel Heily 9cc293fb02 fix(tests): Fix all arm tests
Former-commit-id: a3138584636cc34115207dc6a7b52cf175da187a
2020-01-17 13:10:26 +02:00
Michel Heily 70c72bec2f fix(tests): Fix thumb t230
THUMB 15: Base in rlist


Former-commit-id: 2516b67308e2605414f691009ce000adafda1f49
2020-01-17 13:07:26 +02:00
Michel Heily 5b90223717 fix(tests): Fix thumb t225
THUMB 14: Push / pop do not align base


Former-commit-id: e8f511387edf5bd2f3991558f7757f997d0289c7
2020-01-17 13:04:14 +02:00
Michel Heily da7f66890d build: Update .travis.yml with apt dependencies
Former-commit-id: 0ae6f48d08aba10425f6ceeac9384068ab496bcf
2020-01-17 12:54:30 +02:00
Michel Heily 4cb7abee52 cartridge: Refactor to deal with out of bounds read
Former-commit-id: ab0a4368f7e5120cf7059fb34687a5a9c1ea21cd
2020-01-17 01:39:25 +02:00
Michel Heily 8755013ec6 tests: Wrap gba-suite by jsmolka
Former-commit-id: 511f08470520c712b3b5a5bd9e33ac590939c315
2020-01-17 01:33:21 +02:00
Michel Heily 1d7035b600 core: arm7tdmi: Comment out old tests for now
Former-commit-id: 01bfe52e513de9decb1a20e2e1d501b564f981b5
2020-01-17 01:15:51 +02:00
Michel Heily dc1cd84225 feat/savestates: Implement savestates for plat/sdl2
Former-commit-id: e61193e0c9a937dd3b4b7e7e748d9a9b1e170e44
2020-01-16 20:18:32 +02:00
Michel Heily f4460b2740 feat/savestates: Implement save/load state API for GameBoyAdvance
Using serde & bincode encoding


Former-commit-id: f5e4c599497f6bdf3096fa99f8b2d6ce89278ef7
2020-01-16 20:18:32 +02:00
Michel Heily 16142ee99d core: gba: Move VideoInterface & AudioInterface to GameBoyAdvance
In preparation for savestates, this is needed to avoid (de)serializing Rc<RefCell>'s


Former-commit-id: c6dfe189d4f6104fc4b1b567529ec50714a2d74e
2020-01-16 19:56:05 +02:00
Michel Heily 236dd601a9 core: gpu: Use Vec<> instead of fix size arrays
Resorting to this since big arrays tend to overflow the stack on windows


Former-commit-id: e792a9c844d8f87075ee02323cf0a58d083e9f63
2020-01-16 19:53:09 +02:00
Michel Heily 87999122da feat/savestates: Add write_bin_file util function
Former-commit-id: 88e12df1d8a88ad97756e943b4b959f73bb99c35
2020-01-16 19:49:43 +02:00
Michel Heily d887602266 feat/savestates: Add serde and bincode traits to the project
Former-commit-id: b4699586bba03b8fcfc718ea08363a7067d31e20
2020-01-16 19:49:13 +02:00
Michel Heily 0e0f1764e8 fix: Set BG2/3 affine parametersr to default on bios skip
Former-commit-id: e6e3016f85230af3aa495b120a3d3abb385ba463
2020-01-16 19:47:05 +02:00
Michel Heily d97d07774f core: gpu: Implement rotation/scale background rendering
Displaying sbb_aff.gba and rsbin demos correctly.

Problems in mode7:
* Incorrect first scanline in m7_demo.gba
* Mariokart scaling is off


Former-commit-id: 27655a7a3cde0e9cdabd727a6ec9c99270a99b35
2020-01-16 19:46:36 +02:00
Michel Heily 12ebcf44a2 refactor: Make debugger into a cargo feature
Former-commit-id: 50f28963d5f7c7b04a0ecd4be82ddd61bd59a39b
2020-01-13 01:11:58 +02:00
Michel Heily f6142f2c5a Update new icon
Preperation for renaming of the project..


Former-commit-id: c4466793633f3c37dbbad70bf6a012994e0fc750
2020-01-13 00:45:58 +02:00
Michel Heily 2cd8dc1f75 docs: Add license badge
Former-commit-id: f4b7902a9a83be93173d0c1d9387692b14481754
2020-01-12 02:08:19 +02:00
Michel Heily a00800ea8d docs: update README.md
Former-commit-id: 5d729faa3f30a88402fd58810375ebe624e8277d
2020-01-12 02:04:44 +02:00
Michel Heily 49a3bc6fd0 feat: Add temporary project icon
Former-commit-id: 05da47f328f076045f4b27f521c72e03648ede77
2020-01-12 01:30:35 +02:00
Michel Heily 4a73d80ace docs: Remove outdated gifs
Former-commit-id: 4a220d546deea05993509fd8dd9e157564c7a1e5
2020-01-12 01:29:14 +02:00
Michel Heily 1c63fcd9b3 feat: plat/sdl: Support file drag events to load new roms
Former-commit-id: daeb01577ec79c23c26e2f3f6c923e46cc09d4bc
2020-01-11 17:36:12 +02:00
Michel Heily e50f82d496 plat: sdl2: optimization: Create texture ahead of time instead per frame
Former-commit-id: b3673b49f60713474af76efbe316a30133e12dec
2020-01-11 16:12:54 +02:00
Michel Heily c6feb5d500 core: Optimizing GameBoyAdvance::frame
Profiling GameBoyAdvance::frame shows that it spends way too much time idleing
on SoundController::update & Gpu::step waiting for the cycle count to
reach to the next event, Consuming cpu time for the Arm7tdmi core.

This commit changes the implementation of the main loop functions so
that the CPU will run as many cycles as possible and the peripherals
will only be updated when needed.
The is a performance improvement of roughly 50% in fps in some games!


Former-commit-id: 937e097f958423934c70b7face6b6b02926b7a51
2020-01-11 16:12:54 +02:00
Michel Heily 36cf4e62ce core: arm7tdmi: optimization: split flush_pipeline to arm and thumb
Reduces an if check


Former-commit-id: 4380c54f86238ef8818356f4593f59277f055fa6
2020-01-11 16:12:54 +02:00
Michel Heily 0872ff650a sound: Comment out spamming printlns for now
TODO - replace when decent logging module is in place


Former-commit-id: bfcfe07a0506aa9b4f2fa4e33863afdb74f6783c
2020-01-11 16:12:54 +02:00
Michel Heily 05f1085410 core: sound: sound chip optimization
Compute sampling rate and cycles per cycles ahead of time


Former-commit-id: 2959cadd693ff08a69251d642583cc984c040fc2
2020-01-11 16:12:54 +02:00
Michel Heily 71a4837d25 core: Reduce overhead in Bus interface
Former-commit-id: 1b3b00825d0b6aec0223445a1f00408397efca56
2020-01-11 16:12:05 +02:00
Michel Heily 1de287713a core: sysbus: Boxed memory optimization
Former-commit-id: d845ceadcef463b2d66f5fb3cee2b6fbc752c286
2020-01-03 00:58:35 +02:00
Michel Heily 1a5903c09c plat: minifb: Remove junk code
Former-commit-id: ca265f5824a2b0014b81fc0d7ecd18f2bbdc18b0
2019-12-30 00:28:32 +02:00
Michel Heily ab731679ef core: gba: Get rid of usesless RcRefcells in main object
Former-commit-id: 55beb34c529a8c8f19d0dffcef33584fb4c97e7a
2019-12-29 23:44:34 +02:00
Michel Heily 467cd9728a plat: sdl2: Keep the video subsystem in the main scope
Former-commit-id: 36b7c3478f4396b7d6dc2e234a0790ae3b3eba45
2019-12-29 23:44:34 +02:00
Michel Heily 3687161b98 Make the debugger into an optional build option.
This module is written purely and always breaks when changes are being
made into the 'core' module, so as long as I don't use it, I don't feel
like maintaining it.


Former-commit-id: f5b18ba54a27d22e8a195dd0912ec9c8f29fa830
2019-12-29 23:44:34 +02:00
Michel Heily b00fbfb38c gpu: refactor: Big refactor preparations
1) Decouple SysBus from Gpu
2) Split Gpu rendering function into separate modules
3) Cleanup


Former-commit-id: 0435ad1c9c1de72ed50769fabfea7c5f33b670e0
2019-12-29 23:44:34 +02:00
Michel Heily 885bce2aa4 gpu: refactor: Give the Gpu a handle to the video device.
Use it to render to the screen instead of doing it in the outer Gba


Former-commit-id: ea1ed5f4d7b00d1542ce1130f96ccb1bdb87cb3e
2019-12-29 21:32:53 +02:00
Michel Heily 118beeb4b7 gpu: refactor: Move Rgb15 to its own module
Former-commit-id: d83748802435594573255171ae888efd6f406ad3
2019-12-29 21:32:53 +02:00
Michel Heily 615515fcea gpu: bugfix: Fix objects with priority 3 not being rendered
This was apparent in Dragon Ball Z - Legacy of Goku II, where the save
point sprites were not rendered at all.


Former-commit-id: 156356ebe2f2a4879602019a1fe2c18fe2b8a395
2019-12-28 21:14:21 +02:00
Michel Heily b22388252b gpu: Cleanup #1
Former-commit-id: a40fca25eae76afb4d581d8da1404a5d52c9efab
2019-12-28 21:13:44 +02:00
Michel Heily b13c3026c8 gpu: Refactor Gpu::current_scanline -> Gpu::vcount
Former-commit-id: fe17235bd7e953195e6348e4670bf0520a78270a
2019-12-28 20:25:27 +02:00
Michel Heily cc4f328691 timers: Fix wrong irq number
Timers were triggering DMA interrupts, wonder why.. ><


Former-commit-id: 4fd2781a4bf71d0c0ebc1badae003d76a781ee75
2019-12-28 17:03:59 +02:00
Michel Heily d8545dd8cd sdl2: Use callbacks with ring buffer instead of audio queue.
Better latencies, and also fast-forward (aka Turbo mode) sounds normal
this way.


Former-commit-id: d1075087e847c765a871157a7973c897575ef4d7
2019-12-28 17:03:59 +02:00
Michel Heily cb54f4d1a3 cosmetic: Notify vblank/hblank DMA inside of Gpu
Former-commit-id: de53e1ed3e2c1df19ef878c4b84893b92ee46064
2019-12-27 16:31:18 +02:00
Michel Heily 445835eac8 Update Cargo.lock
Former-commit-id: e88adeb5cdf40bf3a4fe1e19b22af590518de180
2019-12-27 16:30:09 +02:00
Michel Heily 5acd7ddd71 Solve the sound clicking issue in Kirby!
The symptom of the problem was in the form of a rythmic click sound popping in the left channel.

Diving deep into Kirby's binary, I found out that channel B and channel
A are playing too different pcm buffers simultationsly: A is enabled for
the right channel and B is enabled for the left.

I found out that the game's sound driver was using VCOUNT in order to syncornize the audio,
but in some occassions the fifo DMA was not disabled in time, causing the DMA to
fill the fifo in additional 16 bytes of garbage residing next to channel
B's pcmBuffer.

After a thorough check-up of the GPU state machine, I find out that I
stay in VBLANK for 1 line too long, and that's what caused the audio
buffer to de-sync with the gpu emulation.

This commit fixes this issue.


Former-commit-id: e0f20bd01b8abf62da486e2501cff197a9a22763
2019-12-27 15:28:06 +02:00
Michel Heily a01e3ed9cd Make sdl2 run as default for "cargo run"
Former-commit-id: 11c411582fa10e8391d1a9ce528e876b3da7cb22
2019-12-27 13:12:03 +02:00
Michel Heily c9e80f4f60 Remove dead code
Former-commit-id: 5d5768ca6b73060197d9bacda61cba4c03804ad0
2019-12-27 12:41:36 +02:00
Michel Heily c2ac3c5a10 Improve DMA code
Former-commit-id: 8fdb6195ceb323aebd8a26da98fe286d89ef8363
2019-12-27 12:37:32 +02:00
Michel Heily b026ad4ed3 Add simple resampling using cosine interpolation, seems to work~ish.
Still have clicks & delays in my audio output.


Former-commit-id: 46707fc773d8083fbba1ec614e3e0a3e53866b98
2019-12-23 01:37:45 +02:00