Commit graph

411 commits

Author SHA1 Message Date
Michel Heily 11fb9d7eda Fix panic when fs::create_dir fails for LOG_DIR when it already exists
Former-commit-id: a332a8aadc8322650beaf9ff7eead4ac162c6eec
2020-02-14 14:26:45 +02:00
Michel Heily b03fe3567e Fix all warnings during build
Ran cargo-fix to automatically fix most of the build warnings,
Cleaned up dead code, and fix the rest manually


Former-commit-id: f35faba46b40eaf9c047efb8ab1e77ffa24d41b6
2020-02-14 14:21:45 +02:00
Michel Heily 0c2da2ae46 refactor: Refactor instruction decoding to panic instead of returning a Result
flamegraph shows too much time is being spent 'unwraping' decoded
instructions


Former-commit-id: e89072e6cf648e83f87d8c01891f50474246a36b
2020-02-14 13:05:14 +02:00
Michel Heily 69aadb9d92 Fix broken tests due to recent arm7tdmi changes
Former-commit-id: e1a5ec4ce3cb4c61bf6f511babfa8da8efd7321f
2020-02-14 13:02:56 +02:00
Michel Heily 84004ddb5c windows: Add file icon to build targets
Former-commit-id: 2dae2e7818d86ddf9470afafd0404f0e7e021718
2020-02-12 22:18:58 +02:00
Michel Heily 32a20d2cbb ptimize: CPU Pipeline optimization part 3
Move reload_pipeline calls inside instructions.
This commit yeilds yet another 5% performance improvment.

The next step is to move `advance_pc` into the instructions themselves
and save the `match result` per executed instruction


Former-commit-id: 42193ffc48fda9943665e6a74e873186627a0b4a
2020-02-11 02:26:17 +02:00
Michel Heily 6beec306c2 optimize: CPU Pipeline optimization part 2
Optimize redundent pipeline stages
About 5% performance gain.

Also rustfmt..


Former-commit-id: 2f5fc95798e97eb963fea976866bbeaf637084b0
2020-02-11 02:26:17 +02:00
Michel Heily 1f79205f51 optimize: CPU Pipeline optimization part 1
In preperation for later optimization in the CPU pipeline
implementation, this commit refactors the arm/thumb exec functions to return a
CpuAction (Whether to advance the program counter or to flush the
pipeline)

Currently, a lot of host cycles are wasted in the arm7tdmi pipeline
Refill1 & Refill2 states. Optimizing these steps out would make the CPU
a bit faster.


Former-commit-id: 9be7966eaad22cceeb443fcc5823bbd945284027
2020-02-11 02:26:17 +02:00
Michel Heily 7736154b50 fix: Use flush_pipeline16 when branch exchange changes CPU to thumb mode
Former-commit-id: 6f9c01c6f7ad7be2889a18ca66f7d310fcaa7c35
2020-02-11 02:26:17 +02:00
Michel Heily c7a484fda5 Move creation of arm7tdmi core into the GameBoyAdvance
Former-commit-id: d4a43df2ea3d737cc8284b84cea0285c8818ef32
2020-02-11 02:26:17 +02:00
Michel Heily 1a46bec3f9 feat: Fix & improve debugger, Add commands to save/load the state
Former-commit-id: cfbead1ad64c8b029bf7265f7fd975014744b287
2020-02-11 02:26:17 +02:00
Michel Heily ae7bf63d3f arm7tdmi/optimize: Optimize and cleanup CPU, roughly about 10% fps improvement.
This commit removes the error handling (CpuResult<>) in order to reduce
overhead in the cpu implementation.
Also, some cleanup of warning messages.

Notice: this commit breaks '--feature debugger' for now

Former-commit-id: d4484047c3f5d509eff89cef7090aa88b07a8d17
2020-02-09 20:17:46 +02:00
Michel Heily 48eb2a4104 Bump gba-suite git submodule
Notice: This change breaks master due to failing the added tests

Former-commit-id: e3fde1c37e85a5e1e88e9fa82b1152ef1bce4493
2020-02-07 17:36:32 +02:00
Michel Heily 984cb2f0c4 chore: rust-fmt
Former-commit-id: 8bb31056864e64bcad6877f3c2c1000464cce82e
2020-02-07 17:16:52 +02:00
Michel Heily 374c429d16 optimization: Avoid bound checking twice in Cartridge::read_8
Former-commit-id: fb9db936f7d7a89b467c3c3dfd290c43b5324da6
2020-02-07 17:13:05 +02:00
dependabot-preview[bot] 3a488e4487 build(deps): bump ansi_term from 0.11.0 to 0.12.1
Bumps [ansi_term](https://github.com/ogham/rust-ansi-term) from 0.11.0 to 0.12.1.
- [Release notes](https://github.com/ogham/rust-ansi-term/releases)
- [Commits](https://github.com/ogham/rust-ansi-term/compare/v0.11.0...v0.12.1)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
Former-commit-id: 702534f36b62f34f48c13c64e0db1d195206c215
2020-02-07 17:10:21 +02:00
dependabot-preview[bot] 66d7f0f7f2 build(deps): bump zip from 0.5.3 to 0.5.4
Bumps [zip](https://github.com/mvdnes/zip-rs) from 0.5.3 to 0.5.4.
- [Release notes](https://github.com/mvdnes/zip-rs/releases)
- [Commits](https://github.com/mvdnes/zip-rs/commits)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
Former-commit-id: 2c546f001f0e53ab6936f382ba9a9a40698337dd
2020-02-07 17:10:14 +02:00
dependabot-preview[bot] 9b06928e2e build(deps): bump flexi_logger from 0.14.6 to 0.14.8
Bumps [flexi_logger](https://github.com/emabee/flexi_logger) from 0.14.6 to 0.14.8.
- [Release notes](https://github.com/emabee/flexi_logger/releases)
- [Changelog](https://github.com/emabee/flexi_logger/blob/master/CHANGELOG.md)
- [Commits](https://github.com/emabee/flexi_logger/commits)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
Former-commit-id: 638bc4021e6feabbb9f944aabb731175486609b6
2020-02-07 17:05:20 +02:00
dependabot-preview[bot] 6c879136f1 build(deps): bump colored from 1.8.0 to 1.9.2
Bumps [colored](https://github.com/mackwic/colored) from 1.8.0 to 1.9.2.
- [Release notes](https://github.com/mackwic/colored/releases)
- [Changelog](https://github.com/mackwic/colored/blob/master/CHANGELOG.md)
- [Commits](https://github.com/mackwic/colored/compare/v1.8.0...v1.9.2)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
Former-commit-id: 1b24d07dd253bedd15df2eba727118cbb01ef44b
2020-02-07 17:05:13 +02:00
dependabot-preview[bot] afa22aaa38 build(deps): bump byteorder from 1.3.2 to 1.3.4
Bumps [byteorder](https://github.com/BurntSushi/byteorder) from 1.3.2 to 1.3.4.
- [Release notes](https://github.com/BurntSushi/byteorder/releases)
- [Changelog](https://github.com/BurntSushi/byteorder/blob/master/CHANGELOG.md)
- [Commits](https://github.com/BurntSushi/byteorder/compare/1.3.2...1.3.4)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
Former-commit-id: 28acac0def9bbb220bae601d2c397ff26ee04f28
2020-02-07 17:05:00 +02:00
dependabot-preview[bot] 194b9a0b2a build(deps): bump time from 0.1.42 to 0.2.6
Bumps [time](https://github.com/time-rs/time) from 0.1.42 to 0.2.6.
- [Release notes](https://github.com/time-rs/time/releases)
- [Commits](https://github.com/time-rs/time/commits/v0.2.6)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
Former-commit-id: 9a9533684df743a5441be6ed0d0cd40633189c6b
2020-02-07 17:02:24 +02:00
dependabot-preview[bot] 9d383fa2c5 build(deps): bump num from 0.2.0 to 0.2.1
Bumps [num](https://github.com/rust-num/num) from 0.2.0 to 0.2.1.
- [Release notes](https://github.com/rust-num/num/releases)
- [Changelog](https://github.com/rust-num/num/blob/master/RELEASES.md)
- [Commits](https://github.com/rust-num/num/compare/num-0.2.0...num-0.2.1)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
Former-commit-id: ba192b84e744980c2edb3969f94b25fc0974a1bb
2020-02-07 17:01:55 +02:00
dependabot-preview[bot] 26f016182b build(deps): bump bitflags from 1.1.0 to 1.2.1
Bumps [bitflags](https://github.com/bitflags/bitflags) from 1.1.0 to 1.2.1.
- [Release notes](https://github.com/bitflags/bitflags/releases)
- [Changelog](https://github.com/bitflags/bitflags/blob/master/CHANGELOG.md)
- [Commits](https://github.com/bitflags/bitflags/compare/1.1.0...1.2.1)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
Former-commit-id: 741a46a69dddb03d423776d760c933dab4076426
2020-02-07 17:01:35 +02:00
dependabot-preview[bot] 2a9f2270da build(deps): bump rustyline from 5.0.6 to 6.0.0
Bumps [rustyline](https://github.com/kkawakam/rustyline) from 5.0.6 to 6.0.0.
- [Release notes](https://github.com/kkawakam/rustyline/releases)
- [Commits](https://github.com/kkawakam/rustyline/compare/v5.0.6...v6.0.0)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
Former-commit-id: 138a28066ed7d421ac4d6cf54b5710f45bc02c4b
2020-02-07 16:59:55 +02:00
dependabot-preview[bot] 23e0d1dfa7 build(deps): bump num-traits from 0.2.8 to 0.2.11
Bumps [num-traits](https://github.com/rust-num/num-traits) from 0.2.8 to 0.2.11.
- [Release notes](https://github.com/rust-num/num-traits/releases)
- [Changelog](https://github.com/rust-num/num-traits/blob/master/RELEASES.md)
- [Commits](https://github.com/rust-num/num-traits/compare/num-traits-0.2.8...num-traits-0.2.11)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
Former-commit-id: de2d638031688498136038e7776edc34cd60169e
2020-02-07 16:59:39 +02:00
dependabot-preview[bot] 70eaedcc77 build(deps): bump sdl2 from 0.32.2 to 0.33.0
Bumps [sdl2](https://github.com/Rust-SDL2/rust-sdl2) from 0.32.2 to 0.33.0.
- [Release notes](https://github.com/Rust-SDL2/rust-sdl2/releases)
- [Changelog](https://github.com/Rust-SDL2/rust-sdl2/blob/master/changelog.md)
- [Commits](https://github.com/Rust-SDL2/rust-sdl2/commits)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
Former-commit-id: 3a2416ac596acb7f59ac94ff375fd02c9c60b1b4
2020-02-07 16:57:39 +02:00
Michel Heily 17560eeb0c fix: Completly refactor GPU scanline composition code.
This change fixes #9 and emulates:
- Correct layer ordering
- Correct emulation of blending sfx
- Correct emulation of the object window (BIOS boot animation is now fixed)


Former-commit-id: caf46fe4b62cc54e6f2c02a8001da552f8e6b54a
2020-02-07 16:11:16 +02:00
Michel Heily 71cccf7504 Fix panic panic when loading eeprom ROMs while save file does not exist
Former-commit-id: 42bc08b6008169062c9d814a4e48e13eacb44a91
2020-02-07 16:11:16 +02:00
Michel Heily 7848cb609b fix: Make debugger step functions only step the arm7tdmi core
Former-commit-id: bc544ff5dda9db694405126b3cab963f91526a7d
2020-02-01 12:22:44 +02:00
Michel Heily 99cf07c391 chore: Replace trace exception with trace!
Former-commit-id: 0b6f2126a6861b8f31f5231b5e0cfda3df30d5d5
2020-02-01 12:21:42 +02:00
Michel Heily 15f20e88fe chore: Update launch.json
Former-commit-id: 950fba30f8e517d8e6a1bce90bcd4762b1fb7bc2
2020-02-01 11:28:56 +02:00
Michel Heily 7625feee6b chore: Cleanup eeprom.
Removed unused code and added meaningful log message to indicate eeprom size assumption due to save file size


Former-commit-id: 12fa73c197cc2c9c695ed209114b803f2255e95d
2020-02-01 11:26:56 +02:00
Michel Heily 13037f334c feat(eeprom): Implement eeprom size runtime autodetection
The Minish cap works :)


Former-commit-id: 4c04d7907bd44edaac47a9110c98fb0869d01ace
2020-01-31 18:26:16 +02:00
Michel Heily bb111f0d0b feat(save_override): Add option to override save type via commandline
Former-commit-id: c4a00744ba20baf5f68072d6b9583616f61417e8
2020-01-31 16:15:29 +02:00
Michel Heily 5fc38546ce refactor(core/cartridge): Refactor cartridge module to make it easier to configure savetypes
Former-commit-id: 2e8dd8c3f60c7de8c55bd4c38eaa0630af73c1cc
2020-01-31 16:15:29 +02:00
Michel Heily 3fb75079a2 feat(eeprom): Fix eeprom emulation timeout problem, passing the nintendo eeprom tests
Former-commit-id: 5eea390de806d03eee8c043203ae4c57d7355caa
2020-01-31 16:15:29 +02:00
Michel Heily 451be2036f feat(logger): Replace various println! with logs
Former-commit-id: c2f38f863d65c4564f4d2169e63714a2925a4d3f
2020-01-31 16:15:29 +02:00
Michel Heily 8f4e42d6d4 feat(logger): Add a logger to the project
Former-commit-id: aa0579884951857a136904b3147eaa553117e68e
2020-01-31 16:15:29 +02:00
Michel Heily 990ce40e35 feat(eeprom): Cleanup eeprom code. still not working
Former-commit-id: 5cc2b897796a35d3b3bc6c346cf275826e9f4b7c
2020-01-29 22:09:30 +02:00
Michel Heily 1f073199b3 feat(eeprom): Move cartridge into its own module
Former-commit-id: e7fd72db6e14770a0b099f4b5ce32da1fb6fa0f5
2020-01-29 21:48:38 +02:00
Michel Heily 51a79d68da feat(eeprom): Start working on Eeprom emulation
Former-commit-id: b600daa044e1bdf85fb022017517585a9aca4082
2020-01-29 20:46:22 +02:00
Michel Heily eda3d3e3e7 feat(flash): Implement Flash save type
Pokemon games now boot and save.
Fixes #7


Former-commit-id: c60cda3352cc5117c88d4aec272c4e9d2662d21d
2020-01-26 02:18:27 +02:00
Michel Heily 23a6bf1637 feat(sram): Implement SRAM save type
Tested to work on Kirby.
Fixes #8


Former-commit-id: 90aa60b901a4ef790592c34c2350a7349939d612
2020-01-26 02:06:44 +02:00
Michel Heily 70c19ea343 fix(sound): Fix amplitude and properly emulate sound bias level
Former-commit-id: 92dec2c186b9e6f34ae5ce0ee167d6f1fa7730c8
2020-01-21 01:20:28 +02:00
Michel Heily ade03121ee feat(sdl2): Support window resizing
Former-commit-id: f5e70c8a15b53eb7aded9f630e5c1fb1dce55fba
2020-01-21 01:20:23 +02:00
Michel Heily 6dbc3d5cf0 tests: Add test for the bug fixed in cca16c52fd838b34c759913a41ff28c4e04735d0 [formerly 453e7c03ab48f1bcf72cd9d4b1aae012eb08c697]
Updated gba-suite submodule


Former-commit-id: 97bccebd0a9bf60ed6da1cf3f853b98d114631af
2020-01-19 00:45:46 +02:00
Michel Heily a47cb18cda core/arm7tdmi/arm/: Fix wrong calculation of op1 in DATA_PROCESSING instruction when RN==R15
The docs state: "If a register is used to specify the shift amount the PC will be 12 bytes ahead"
I probably misread that when implementing DataProcessing instructions,
and because of that added 4 bytes to (op1+8) when shift amount was specified by a rotated immediate.

Fixes #6 (and probably tons of other bugs too!)


Former-commit-id: 129f0951a6381221314c23a468c3da8b31435a30
2020-01-18 23:46:47 +02:00
Michel Heily 1bafb9238b chore: Update Cargo.lock
Former-commit-id: 12cb3a7c0de31bdd4e8465de256d656ca0662c72
2020-01-17 16:11:43 +02:00
Michel Heily c20ac9cdf8 core: cartridge: Try to detect and print the backup type
In preparation for backup impl


Former-commit-id: 75efbbaea82ba30899787b46b8eaca834622493c
2020-01-17 16:11:43 +02:00
Michel Heily ec0e796536 core: arm7tdmi: thumb: Reduce branches in exec functions
Former-commit-id: 69493480eddee066bc4812c4c1abd6c520a00231
2020-01-17 16:11:43 +02:00