Commit graph

511 commits

Author SHA1 Message Date
Michel Heily 97101d7bc1 core: dma: Delay DMA by 3 cycles
Former-commit-id: 06426b01a3e9e9084c97cd8f3a3de3b3c2b207e6
Former-commit-id: 2dee7bc2a2a3a3e69c7afa878f2d03208f330752
2020-10-17 06:36:02 -07:00
Michel Heily 0de8a60006 core: Start working on a scheduler
A more robust cycle aware event scheduling, to easily implement serial-io, dmg audio channels and improve accuracy.
This brings a slight performance hit :/

I also ran dos2unix on some of the files :D


Former-commit-id: 62f4ba33e3a083b7976d6512ba6f5720ec493aa0
Former-commit-id: a4b3a92cd1eb156bbe9fd0ef77fbb0e7a45660cb
2020-10-17 06:36:02 -07:00
Michel Heily b68c73819a Fix cfg_if dependency
Former-commit-id: 5b9f830edcda0fad9321a26f74a5e85ec1b7b104
Former-commit-id: dd77520fae5c74c92921779a20870da38b607924
2020-10-14 21:11:00 +03:00
Michel Heily dc7cd24e8d [perf] Refactor&Optimize inner core::arm7tdmi APIs.
Avoid passing ArmInstruction struct to handlers, as accesses to its fields can result in memory operations.


Former-commit-id: 6ea1719e36a0fefa1b30bdae4d6e8ab4dbf3af1a
Former-commit-id: e5855b8258f98d3f4c0819f3aec2fd0f47fef545
2020-10-10 11:08:26 -07:00
Michel Heily bf601404fa Optimize cartridge Bus reads
The `if let Some(gpio) = &self.gpio` causes a memory read of `self.gpio` for every Bus::read/write_16.
It is better to reverse the order since `is_gpio_access` does not generate and memory reads and thus less costly.


Former-commit-id: bcce7d9c3a2b159a7f6b291d7b08ccf9c4d0db14
Former-commit-id: 69c12db503c9e612faa7cd8a57f6d862694c8370
2020-10-10 11:08:26 -07:00
sapir 8dee829e26 Avoid repeated background index sort
Former-commit-id: 5c7aab3a416cc1cfd9cbd6033457b111fe409d98
Former-commit-id: 0594872c527f57bfd77d0afd9635eed3b88f9be8
2020-10-10 11:08:26 -07:00
sapir 9d08ac13e6 Move backdrop color read out of compose_pixel
Former-commit-id: 20d5d8a35b5e7fa0ca46bea297b1b554ba98948d
Former-commit-id: f50dbe6b529fef91f5cf5a0a808d93b878f2adff
2020-10-10 11:08:26 -07:00
Michel Heily 529c9752c4 fix: Ignore top 4 bits of DMA addresses
Former-commit-id: 3a5e691ca617803ef61f7a534c70d1cf04f36cb9
Former-commit-id: 289fad7340cbb18c51ecccd43e44682b37c78a1a
2020-10-03 21:58:32 +03:00
Michel Heily 1ab22f2b52 Fix access violation for DebugRead in Gpu
Former-commit-id: 25d2da276a50f662dafb4634c7b3fb4ebcf239f4
Former-commit-id: 4134896128ef3c7ddd8bbd2804d8d1edc46c7a6c
2020-10-03 21:58:32 +03:00
Michel Heily 91c3b5321a platform/android: Add menu options to capture a screenshot as the library preview image
Former-commit-id: 59d0858d93cb2681bb3e4230c44858a2fe28f208
Former-commit-id: 41b094d2f7971c3ef9e53234bd0c65e56ef99e20
2020-10-01 01:56:32 +03:00
Michel Heily d1bf01d562 platform/android: Add option to import/export save files
Also some typos and reformatting parts of the code


Former-commit-id: 0f1de44fab44a09c49d08421a3c2032123d3023b
Former-commit-id: 810b6b1bce1f7feeee7c33bec5ff16915367db17
2020-10-01 01:56:32 +03:00
Michel Heily 3c6628138c platform: Minor fixes and adjustments from previous commit
Former-commit-id: b8e8f73c8202f93e4bb2a575ee3d1b3083ddabb1
Former-commit-id: 355c634b4da8fbea1d228da8fc95e37012237bbd
2020-09-30 00:47:30 +03:00
Michel Heily ba2eff82ac platform/android: Big re-write of native interface
Mainly convert mainloop and audio thread into native code for
performance increase. (Calling into JNI every frame was costy)

The code was cleaned up quite a bit, but I may have introduced new bugs
in this process :<


Former-commit-id: fdbc21b5ab39f3d2e36647fd1177dc9a84a16980
Former-commit-id: ac765dbee8c994e1b69cc694846511837c2685b9
2020-09-30 00:27:00 +03:00
Michel Heily 08a7cd966a core: add "no_video_interface" feature
Former-commit-id: 0b1462e3ef1ab65c37e2c0fce54bc7f5c2f9f2b5
Former-commit-id: 7b837be4dcb477b048f0118c4ab30f97eb445363
2020-09-30 00:10:47 +03:00
Michel Heily e25268f4d8 core: bump ringbuf to 0.2.2
Former-commit-id: a39789277cbc62b55ac4896a1dcee0a08eaa91c5
Former-commit-id: d9c94a5f42a11e59c816c1d756c5a2ea4e4dcad7
2020-09-30 00:09:54 +03:00
Michel Heily 554edd62b0 core: Properly set SharedInterruptFlags pointer for all interrupt generating devices when restoring state.
Serde doesn't like Rc that much :(

Fixes #142


Former-commit-id: e1e8a96b4867e351d103fb7d92d71b0434e8fc31
Former-commit-id: 28366bbb36b3e93b574f397b103a483844fd8131
2020-09-27 15:44:17 +03:00
Tibor Nagy 4050dcdf2f core: Add error handling to cartridge header parsing
Former-commit-id: 4e65ccd597bc082f259788f0870287254e852a2f
Former-commit-id: ebb62516936dc0f27dc9761aeb6bb6faa8ec58b5
2020-05-30 15:35:12 +03:00
Michel Heily 1b1b855702 core/gpu: Impl bitmap mode 5 and properly handle wraparound for bitmap modes.
resolves #90


Former-commit-id: 633580870e2d44d95a8b53b6311232f0fad48bd9
Former-commit-id: aa2ba32116900f635f12f9dcc9d29344367711eb
2020-05-30 14:32:03 +03:00
Michel Heily 90e492d81a core/sysbus: Get rid of memory_map! macro
While saving code re-use, it won't allow flexibility for special casing
specific size bus accesses which are much needed in order to emulate
open-bus and bios reads


Former-commit-id: 952a30a130612d61b3f5047b1f1c3cbda9bd58a8
Former-commit-id: ad3a25c012853399591d79f4f1a4423ea9e6645e
2020-05-30 13:44:37 +03:00
Michel Heily 24f6ad61c1 Add DebugRead trait
Former-commit-id: 4c9339dc0f2057152dcb6faccd78f058bc58676f
Former-commit-id: 7bf052ace6b5b12eca3c74f64f4d61d4ae6ac18e
2020-05-30 13:44:27 +03:00
Michel Heily b888fc0c95 Move BoxedMemory to core::util
Former-commit-id: 99a04859982f39f0062c781d9f61b2a55f8e5c10
Former-commit-id: 1ae7808c64116347410b52770edf132f3beec817
2020-05-30 13:44:00 +03:00
Michel Heily 6e39780b43 util: Add WeakPointer helper for passing around raw pointers
Former-commit-id: eaab1057cf7bf8132ba7b59f6c5315e873064c30
Former-commit-id: 94f947733463b528dd3775d2bc6f55adebc36a2d
2020-05-30 13:43:49 +03:00
Michel Heily 879374a9b0 Refactor dir rustboyadvance-core -> core
Former-commit-id: 5af970f6d56d321472f2b91885e41ca113390986
Former-commit-id: 748e222a36362eb5ac8909068c32f2d3f98ca536
2020-05-30 13:43:37 +03:00
Michel Heily f65e22cc41 core/gpu: Fix bitmap mode displaying invalid sprites
fixes #107


Former-commit-id: 4b307c80f0519a5034dad1188d285cb44a2c8eeb
Former-commit-id: 8879aababad1aef0690adb0a88cdeb36368c024a
2020-05-30 13:41:10 +03:00
Michel Heily dc59d7f71f core/gpu: Optimize VRAM accesses all over the place
Former-commit-id: a14fc75968c5ce6016acc88fe2cc24eaac8b305b
Former-commit-id: 41f3142ea586c981cd5ccc7eb5a69f49bdcc591d
2020-05-30 13:13:25 +03:00
Michel Heily 71074c9c87 core/gpu: Implement forced blanking
fixes #102


Former-commit-id: 8d0557a63121eab20f7299d75c4c7e577d5f5612
Former-commit-id: 668c728b5ebd6103bf9d15115cb3912ea8c6f4b6
2020-05-26 18:06:02 +03:00
Michel Heily 441f5ad906 Refactor IRQ signaling
Use Rc<Cell> instead of passing `&mut irqs` all around.

The runtime impact is two additional size_t's per each holder of the
shared pointer.


Former-commit-id: afd3188c31608ebcf062256a7ad51575dbc90d8b
Former-commit-id: 22e0e01953968cee592b5408677e557059669c31
2020-05-26 01:49:25 +03:00
Michel Heily 63cbf9bccf chore: Update Cargo.lock
Former-commit-id: 4cf345e1f2ea09577889552a6644cb53b5900e25
Former-commit-id: b460b1f567643cc85fef0bfe815abb842c2dc0f0
2020-05-26 01:49:16 +03:00
Michel Heily c131e73ce1 Support controll remove/add events for SDL2 frontend
Former-commit-id: b0e97f9c9b3f0b32140f1425159088270be6a433
Former-commit-id: b158c5c4ac491561f33f71d2bcd5cf069d55b343
2020-05-23 11:45:25 +03:00
Michel Heily 91515b6b10 core/gpu: Ignore top bit when reading colors from the palette
According to CowBite, the top bit is supposed to be ignored.

fixes #99


Former-commit-id: 28a43311726f9ce5ef26c77687fedecc33b286e0
Former-commit-id: df0b025ed6d51e36bcffd4c91250858167b42f40
2020-05-23 01:55:40 +03:00
Michel Heily f84e425d24 core: Make gpio optional
Former-commit-id: 2efe3a5486d76b2be0fc99abbe2e1ea14b21d180
Former-commit-id: b2ce408e12913a050354258b3e6f3c5e0714183d
2020-05-21 23:18:20 +03:00
Michel Heily 3839b8eb02 core: Finish up RTC!
Pokemon Emerald no longer has the "Battery ran dry" message, and RTC
functions work.


Former-commit-id: b05115af9797b9d754e20d98b1dbd5dac5389518
Former-commit-id: b10a70ec02d0b8775e1e39e9d64b41860d3b1274
2020-05-21 23:18:20 +03:00
Michel Heily 58c9d10360 debugger: Fix/Improve Continue command
Former-commit-id: 8f64618a51c1805ccf5db0da9a2d0a2335928588
Former-commit-id: 180721c6aa6b7fe32a3afb23c01c048bcd9aa878
2020-05-21 23:18:20 +03:00
Michel Heily bccb31c142 Remove 'reqwest' dependency from sdl2 frontend
It was useless and lengthened the build time


Former-commit-id: 44b9c836d9b75142ef4bdb3602ede3f87b03f08f
Former-commit-id: 4c737704103654673366a7a83bf9b7614df40416
2020-05-21 23:18:20 +03:00
Michel Heily e1ec96f9e4 Use elf-support feature in sdl2 frontend
Former-commit-id: 70d1718ae5a18b8ffe7d03fd2a251479224a41ac
Former-commit-id: 54ec2c969dca62644b28bd936e2a03b3786efc52
2020-05-21 23:18:20 +03:00
Michel Heily a99a1499fd Add game specific overrides file (like vba-over.ini)
Former-commit-id: c5084bd191fcc91d9caa5f2c0f89a9803706d0b2
Former-commit-id: a80f747b6199679c74a25505a7893afe4b3b05e1
2020-05-21 23:18:20 +03:00
Michel Heily 8e1ba1117c core: More RTC work
Former-commit-id: be2955b08d65c547d206d637ae499dbad892a87a
Former-commit-id: 19f0e4e6f9c598c35fb8172d93a1519f921eb27f
2020-05-21 23:18:20 +03:00
Michel Heily 304ac31c02 core: Start working on RTC
Former-commit-id: cb23bbade323883509347fce26f78f2cf43d8788
Former-commit-id: d01bef5267429a7d76a50dbc7c185f0513af00ec
2020-05-21 23:18:20 +03:00
Michel Heily d2f4b55f21 core/gpu: Remove irrelevant comment
Former-commit-id: d1c8efd0aefe18dbb71dc8417e09d65019f3d3c2
Former-commit-id: a9b97120e5ae524d1b9fdc9c6296477ff014f938
2020-05-20 22:38:25 +03:00
Michel Heily 9607b16e4f core/gpu: Add a test for the gpu state machine.
This test also caught a bug where hblank flag from the last
vblank-hblank would linger on the next HDraw.


Former-commit-id: b8916badc4bd874d9493229299150f6b2f00f5ed
Former-commit-id: 8ada7ccf3e65e7272d9bb828101520f1589cb4c4
2020-05-20 22:35:53 +03:00
Michel Heily b60ad3114c core: Decouple SysBus from Gpu and re-implement Gpu::update
Former-commit-id: 6ca6989192f0925f4d2eb0e5029a2bcf66869ee9
Former-commit-id: 562d89f627a9e3a9153a7a0db6830fd9b5875967
2020-05-20 21:23:44 +03:00
Michel Heily 96b1e0d844 core/gpu: Remove panic when ObjMode is "Forbidden"
Former-commit-id: 90380761357fa7df0769cb487980a405ae2e8265
Former-commit-id: 1cddcb9030b03f3da35a98d56c7a21a6b8eb7530
2020-05-20 21:23:43 +03:00
Michel Heily f6d7b9ff4d chore: Run cargo-update
Former-commit-id: 2bd04b90ec8001e227b08c9ed23aa0d75263d4f3
Former-commit-id: bd54ccd9373ef1346bb8f18ab923ecfc10365e24
2020-05-20 20:04:47 +03:00
Michel Heily 564f1dcb39 bugfix: Properly handle VCOUNT interrupt edge case for line 227.
fixes #97


Former-commit-id: 6e1cd347e82edfd6eca2b89e6e2a86e68e39d580
Former-commit-id: e9aeb8cc4dd503cfb3da4552e5618de5e982039b
2020-05-20 19:54:27 +03:00
Michel Heily 948bac03a2 Fix copy-paste bug from previous commit
Former-commit-id: 849acd1852bbe3126a6dde0f21c9754b364e24cb
Former-commit-id: 31e837d620cb0858aec4ddf3c133c254bbc1f1b7
2020-05-19 19:30:35 +03:00
Michel Heily 309ae2f795 core: Handle 8bit writes to video memory
fixes #96


Former-commit-id: efdb6c0af0ef6ee2a74042b8725306103703fcfe
Former-commit-id: 1f0e7f7135649ab13c4adcb72bc5e9b432a4905f
2020-05-18 21:11:49 +03:00
Michel Heily 63bf7d6dbb core: Remove unused strust
Former-commit-id: 5ac298c8f300062b91f3321d7b125b4c2132530a
Former-commit-id: 7d1cc81d56a9d8d8d04097c43e48f3fb6e6f8d86
2020-05-18 21:11:20 +03:00
Tibor Nagy db3be711ae core: Clamp BLDY to 0..16
As per the GBATEK docs. Fixes the fadeout animations in Ice Age.

Former-commit-id: 0bc54ab594ba19347a4b6d1b681ccf37da4d7910
Former-commit-id: 33b732e7f990c312bf92bcc21797df35b3d2ce56
2020-05-18 11:26:14 +03:00
Michel Heily 9bb39fe135 Fix gba-suite arm test #530
Fixes edge-case in STMDA with empty rlist


Former-commit-id: 5f43fa19e0faad7d27d022480d856ab0c52f1d56
Former-commit-id: 8e2392e1dd34fb161aa1b2c3445272f06f432316
2020-05-15 16:25:27 +03:00
Michel Heily 4e6735bb5c Fix gba-suite arm test #207
Arm Data-Processing instruction was not initializign
`self.bs_carry_out` before activating the barrel-shifter.

Current ARM7 is too much spaghetti for me to handle anymore, maybe time
for some refactoring.


Former-commit-id: b21fe75496ccd89611fc56f5f00e885532c5ff20
Former-commit-id: 5b11f640d306ebc2afb95d76a3dd3e1530a87c36
2020-05-15 16:25:27 +03:00