Commit graph

567 commits

Author SHA1 Message Date
sapir d0f6ad0112 Fix a few typos
Former-commit-id: f7bb3b0c639eff30f389a54a828de1246a27aaf0
2020-04-13 00:24:06 +03:00
sapir d218325b12 Fix some warnings
Former-commit-id: e60d535f0c9b73209109b1040f6780b10c6b1174
2020-04-13 00:24:06 +03:00
sapir 26816c6072 Remove broken but unused extern crate
Former-commit-id: 464747cd3fb13525014d102e340fbf12fd51738e
2020-04-13 00:24:06 +03:00
sapir 0a226a4d7c Move profile definition to workspace root
Former-commit-id: 2ad50e35e9250c44ed538540d245ae23f0a7f2ff
2020-04-12 22:23:45 +03:00
sapir 458ecfeede Remove missing bench
Former-commit-id: 2c95d20e06d68174e23badb0a027d2ad82fed000
2020-04-12 22:23:45 +03:00
Michel Heily 81655e6730 README Updates
Former-commit-id: 46775ea001b13cd63193c0f4dee2915aa48ae095
2020-04-11 17:18:42 +03:00
dependabot-preview[bot] 8f8ac12cc4 build(deps): bump jni from 0.14.0 to 0.16.0
Bumps [jni](https://github.com/jni-rs/jni-rs) from 0.14.0 to 0.16.0.
- [Release notes](https://github.com/jni-rs/jni-rs/releases)
- [Changelog](https://github.com/jni-rs/jni-rs/blob/master/CHANGELOG.md)
- [Commits](https://github.com/jni-rs/jni-rs/compare/v0.14.0...v0.16.0)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
Former-commit-id: 532d743050acb3f229d97326df937b2495589ef2
2020-04-11 16:54:01 +03:00
Michel Heily 110bae40d9 Update .gitignore
Former-commit-id: 9424277a42b9ec6af5da299e93765a415bc5cf6d
2020-04-11 16:34:00 +03:00
Michel Heily 810ff89ea7 FpsCounter: Use a const instead of generating a new time::Duration each tick
Former-commit-id: e0b6ec4bbc97119f6e82d1219d1406626b50e890
2020-04-11 16:29:56 +03:00
Michel Heily 884f39ca8f Refactor workspace structure
Former-commit-id: d6ab90563fa209b431661086f9ec2672bda02a96
2020-04-11 16:06:34 +03:00
Michel Heily 97fac000b0 Optimize memory accesses by inlining
The previous approach yielded a vtable call to the Bus vtable.
This approach inlines the memory mapping


Former-commit-id: 062fb58b6a5aeab3a6c12f2b878fdeb47d1b0a3a
2020-04-10 21:32:31 +03:00
Michel Heily d4dba298d3 Run cargo-update
Former-commit-id: 3dc4924a39d18723568798482a138b6939803fb7
2020-04-10 17:25:45 +03:00
Michel Heily 6db7c565b7 Android: Fix build
Former-commit-id: 719e9ea62eafb45c238f551591567005f603190d
2020-04-10 17:24:57 +03:00
Michel Heily 56c3c5ce3b Android: Fix new icon
Former-commit-id: bb88af58b1e0785ff2f3c71fdb33bb49e6b89f08
2020-04-10 17:24:22 +03:00
Michel Heily c06c05f2d9 Android: Remove old icon
Former-commit-id: da2e4780bc7a13e7f7f06326dda6e2a92182254c
2020-04-10 16:49:51 +03:00
Michel Heily 8b6d356924 Add new project icon
Derived from rusts' lovely public domain mascot, Ferris the crab!

The design is based from https://rustacean.net/assets/rustacean-flat-happy.svg


Former-commit-id: cac7eb31b5913a9a536c55f474018db0c2d7e2a8
2020-04-10 16:45:55 +03:00
Michel Heily b21cd1e3d9 Refactor project workspace and fix build
Former-commit-id: 8e264cdbc9e5290654c29e6893a121bce73c29c9
2020-04-10 00:53:41 +03:00
Michel Heily 3db61d1804 android: Add color correction shader setting
Former-commit-id: 894a0d6d6a07b16d3333739d565bba853ce13fc4
2020-04-10 00:39:28 +03:00
Michel Heily 2aa0eec95e android: Putting in work
- Landscape layout.
- Snapshot viewer is now a fragment for future re-use.
- Bugfixes
- Etc'


Former-commit-id: 34365fd143cefdc2b1bb3b68a62f62849f442fa1
2020-04-10 00:39:28 +03:00
Michel Heily 46287ca88d android: Use OpenGLES2 for rendering the screen instead of ImageView
Former-commit-id: 80d96928dabaa215d0b8812e203d65193ac85cc8
2020-04-10 00:39:28 +03:00
Michel Heily b270265694 android: Implement emulator audio playback
Former-commit-id: 5d0daee9e7616212aa184e31be360b0110b4c054
2020-04-10 00:39:28 +03:00
Michel Heily 40360f7839 jni: Add bindings for audio
Former-commit-id: 8885208102d51fdf9585a76a31f9ee50f5a5086d
2020-04-10 00:39:28 +03:00
Michel Heily e75c3289cd android: WIP snapshot manager
Former-commit-id: 7b39e4ac1ea86262a0a1ccf95639382f20801d92
2020-04-10 00:39:40 +03:00
Michel Heily fc8b066191 jni: Render directly to the java frame buffer
Former-commit-id: 1647ad7859ad4558ba9626a1ef7afe2ceb1967f4
2020-04-10 00:39:32 +03:00
Michel Heily ef70f3bafc feat/android: Add PoC android project
Former-commit-id: 48e47374f4782976d509cc52a2998786073261ea
2020-04-10 00:39:29 +03:00
Michel Heily a18ea022cd arm7tdmi: Small optimizations
Former-commit-id: 3348eae804c85f49231aa95e6436655c1a7c692f
2020-04-10 00:36:10 +03:00
Michel Heily 8f8204a52b Optimize emulator frame loop
Syncronize to number of cycles performed instead of VCOUNT when
emulating a frame


Former-commit-id: 0f9afe6a95a576dbb7a15cd1bf6bfb7d7ce02fff
2020-04-10 00:35:59 +03:00
Michel Heily ff95b67ae1 Update gdbstub crate to version 0.1.2 and run cargo-update
Former-commit-id: 2db24a3f835b817519cc544d722c58437e98011f
2020-04-07 23:57:29 +03:00
Michel Heily fb93ebb4ed feat/arm7tdmi_dispatch_table: Done!
Moved away from using lazy_static for this one since every access to a
lazy_static reference adds a runtime check, Currently using a build.rs script to generate a const table instead.

Worked out the ARM decoding issues, seems to run fine now.

Though the dynamic decoding for ARM is broken now since I had to change things in Data Processing and MSR instructions

TODO use `const fn` when it becomes stable


Former-commit-id: ba09748ff74a403c7016adcbe0ca553b591f6855
2020-04-07 02:31:13 +03:00
Michel Heily ad232227c1 Refactor ARM format names
Former-commit-id: b99e03669e2c1ccadbd13d2f06eb7127e2145f2b
2020-04-07 02:30:22 +03:00
Michel Heily a523a37d32 [WIP] Start working on arm7tdmi dispatch table.
Lookup tables are generally faster than matching in most architectures.
There is some trouble in decoding some arm data processing instructions
so this is non-default feature for now

* Crashes on armwrestler but many games seem to work


Former-commit-id: 3c06ea344ae0097947d8cd5bd05b1f882c7f743a
2020-04-07 02:30:22 +03:00
Michel Heily 8f11bebd2b fix/performance/accuracy: Reimplement sysbus stall cycle counting.
Previously I did not account for gamepak 32-bit accesses being two 16bit (NSEQ+SEQ or SEQ+SEQ) accesses,
This resulted in less cycles being accounted for, resulting in more wasted CPU cycles per frame and was a huge performance hit.

I re-implemented this with look-up-tables also to speed up the cycle
count routing `SysBus::get_cycles` and also account for 32bit gamepak memory access.


Former-commit-id: fe6a9a570c843d40e38971a2a36e6511df1b8894
2020-04-04 13:55:40 +03:00
Michel Heily c4c8163b0e optimize/timers: Get rid of the while loop in Timer::update.
Profiling with 'perf' I discovered that too much time was spent inside
Timer::update when the prescalar was 0 (frequency of 1 cycle).
This was due to the while loop I used. I optimized this loop out and
there is an appearent performance increase.

Former-commit-id: d228450625fad003f054e3161f6eeee888245cac
2020-04-04 13:43:57 +03:00
Michel Heily f0aa671674 optimize/cpu: Pass Arm/Thumb Instruction and other large structs as references.
Also, get rid of unnecessary derive Copy.

Since the ArmInstruction (and Thumb) derived from Copy, the compiler
always saves them to the stack when they are passed by value to other
functions, thus making some unwanted performance overhead.

I removed the derive Copy, and also pass them as references. This
project has a lot of "derive Copy" everywhere, and I should take note if
this is happenning elsewhere aswell.


Former-commit-id: 2f94c6050fa26c5b777244bd26706d4e6e2f0dc9
2020-03-28 16:14:59 +03:00
Michel Heily 2af9249a6c optimize/arm: Force inlining.
This functions were not inlined by the optimizer


Former-commit-id: aa02a3f5e6d33f16c298bc655c8d3a244c2ef946
2020-03-28 16:14:59 +03:00
Michel Heily d9ce1c7d8d optimize/arm: Improve arm instruction condition check.
Obviously AL(always) instructions are the most common, so prioritize checking these first.


Former-commit-id: e236f1e116dbf65757a68dda9090645d220a1cee
2020-03-28 16:14:59 +03:00
Michel Heily 414c1b0557 optimize/gpu: Optimize read_pixel_index calls inside render loops.
Former-commit-id: 763b24a151ddd3dcb69afacabcb214b26ad03052
2020-03-28 16:14:59 +03:00
Michel Heily 699b2decd2 core/gpu/bugfix: Support firing HBlank IRQs during VBlank
This commit fixes #43


Former-commit-id: 6a4367282c673a35316643e16413f9a602094d9d
2020-03-13 16:29:12 +02:00
Michel Heily 7f34e8bd08 core/gpu/bugfix: Use correct bitmask when writing to DISPSTAT
Accidently used 5 (0b0101) instead of 7 (0b0111)


Former-commit-id: f690dd3f591bef10c5dd280d46be22cd339498a2
2020-03-13 16:29:12 +02:00
Michel Heily aa0f708302 chore: Update Cargo.lock
Former-commit-id: 4f4fae3b12ab027a34cc5080dd041d5e09ce3e64
2020-02-28 15:11:02 +02:00
Michel Heily 6344744414 feat/jni: More work on JNI bindings
Former-commit-id: 125f764bd17ee9add3221cd6b64cde6edb592255
2020-02-28 15:11:02 +02:00
Michel Heily 84db854a06 chore: Make GameBoyAdvance the the bios argument as boxed slice rather then a Vec
On windows, the Vec may sit on the stack..


Former-commit-id: b8aa77858291c1b7ee6bfbfbec92646f18e819de
2020-02-28 15:11:02 +02:00
Michel Heily c4e8c71d1f sysbus: Make BoxedMemory a transparent struct
Former-commit-id: fc07876e9f73928eb2aaa6fcd4cba081a35745b9
2020-02-28 15:11:02 +02:00
Michel Heily c5b9c68d5e feat/jni: Cleanup & Improve jni bindings
- Wrap static globals with a mutex.
- Implement InputInterface

Testing this on a standalone Java Console Application (without
rendering) shows sufficiant performanse for now (AVG fps of 180 in the bios)


Former-commit-id: cfbb9abb7e91b04258c41fc20e8a22c16d797386
2020-02-28 15:11:02 +02:00
Michel Heily c68b9502fe bugfix: Fix bad write impl of DISPSTAT again.
I should really pay more attention to the docs..
The previous fix (bb843ea5) was not enough as it caused vblank,hblank
and vcount-match flags to be overwritten when they really should have
just been ignored.

This caused Dragon Ball - Advance Adevnture to fail booting


Former-commit-id: 1810e32692a0abd79f2df385c7c822debf186c79
2020-02-28 15:05:06 +02:00
Michel Heily d938767430 feat/jni: Add rustboyadvance-jni crate to export some simple JNI bindings
Former-commit-id: d4e7a622a97215a8c1b7b50bb7f08d18cb9c5716
2020-02-23 00:30:38 +02:00
Michel Heily 778274b5ae refactor: split "plat" binaries into separate crates
Former-commit-id: 73554b0128e036279f7ac895acb57d8f89cb1c96
2020-02-23 00:30:38 +02:00
Michel Heily c50ab1ecd8 feat: Add basic gdbserver feature
Initially I began implementing the gdb protocol on my own, but I then found a
nice work-in-progress crate on https://github.com/daniel5151/gdbstub
that suited my needs.


Former-commit-id: f77557cbbd8652c2ed05ac439efc1956d8e99729
2020-02-21 22:12:58 +02:00
Michel Heily 96cacb5f4c chore: Update .travis.yml
Former-commit-id: c529a4740c8d81e09a7a65648d9d2d77905e1146
2020-02-21 22:07:06 +02:00
Michel Heily b333ae7f65 rustfmt
Former-commit-id: a73535e556d1fb44e30927f0ab1f6238a8df8739
2020-02-21 14:08:08 +02:00