Commit graph

391 commits

Author SHA1 Message Date
Matthew Berry
04c635410f [ci] rev actions/checkout to latest major and drop ubuntu 18.04 support 2023-12-09 14:46:08 -08:00
Matthew Berry
c9aa7acfc6 save type doesn't need to check with a regular expression 2023-12-03 13:08:17 -08:00
Matthew Berry
19113be832 Don't allocate an iterator on the heap unnecessarily 2023-01-18 09:14:28 -08:00
Matthew Berry
b73bad6ae2 add cpu usage meter under experimental settings 2022-12-12 21:32:10 -08:00
Matthew Berry
51a9de443a support additional instructions for waitloop skipping
Adds support for MultipleLoadStore, LoadStoreImmediateOffset, and
MoveShiftedRegister. This allows waitloop skipping to work in Spiderman
the Movie, bringing in-game fps from 280 to 375 and title screen fps
from 450 to 700.

This change also disallows instructions that branch from participating
in waitloop skipping. I don't expect this to affect anything, but I
figure it's better to be overly cautious.
2022-12-04 18:26:09 -08:00
Matthew Berry
f6d88f82fa Add a first attempt at waitloop skipping
This change introduces a first attempt at waitloop detection and
skipping. Games like Pokemon Emerald and Kirby Nightmare in Dreamland
don't properly halt the CPU when waiting for an event like VBLANK, and
instead just burn the CPU in a loop.

This change specifically focuses on those games. Other games likely use
more instructions than I added support for here, and other games likely
also may use a waitloop technique that this approach can't prove to be
free of side-effects. Further changes will add support for more
instructions, but I don't expect to add support for games that wait in a
more complicated way. (This emulator is for my own enjoyment, after all,
and it supports the games I want to play :p)

Prior to this change, Pokemon Ruby saw ~430 fps on my M2 MacBook Air,
while Pokemon Emerald and Kirby both saw ~290 fps. With this change, all
games now see ~430 fps, including Ruby which didn't see any regression.
For this reason, I've enabled waitloop skipping by default.

In subsequent changes, I plan to add support for more instructions, add
proper configuration in the UI (enable/disable, set instruction limit,
etc), as well as potentially add a CPU meter to better visualize the
impact of this change.
2022-12-03 11:48:33 -08:00
Matthew Berry
591c8b41c3 each_with_address -> each_with_index (fix bad refactor) 2022-12-03 10:40:08 -08:00
Matthew Berry
120abb5261 use a different Slice constructor for luts 2022-11-18 17:13:03 -08:00
Matthew Berry
37dcb6fcca remove use of arrays in gb joypad 2022-11-11 09:04:59 -08:00
Matthew Berry
8c2e1e9691 type alias refactor should not have touched method names 2022-11-10 08:54:58 -08:00
Matthew Berry
69c671730b updated usage of enable bits 2022-10-30 18:42:40 -07:00
Matthew Berry
d864b27e35 turn off slice bounds checking in release mode
This change removes bounds checking for Slices, which represents most
indexable storage in the emulator. Removing these checks makes the
emulator less safe, without a doubt. However, it amounts a roughly 5%
improvement in the games tested. Most of the checks today occur in
fixed-length arrays where the index cannot be out of bounds, so I'm
chosing to make this tradeoff.
2022-10-30 13:56:11 -07:00
Matthew Berry
e0ef57d9e6 prefer Slice to Array in most cases
This change updates most uses of Array to Slice in order to avoid an
extra object on the heap and an extra reference to follow when indexing
into these objects. This amounts to a roughly 5% performance improvement
in the games tested.

This change also updates the GBC palette writing code to not allocate
new arrays when new palettes are written.
2022-10-30 13:47:22 -07:00
Matthew Berry
1523742e12 tighten address type restrictions from int to uint32 2022-10-30 11:30:36 -07:00
Matthew Berry
afcd4b667e various minor changes suggested by ameba 2022-10-28 16:59:46 -07:00
Matthew Berry
eafe5455f6 remove unused variables 2022-10-28 16:46:39 -07:00
Matthew Berry
30f6597676 patch up additional registers that don't read open bus
this makes all mgba suite io tests pass
2022-10-27 09:10:37 -07:00
Matthew Berry
2fe794edba add hints to bios selection 2022-10-22 12:53:02 -07:00
Matthew Berry
e37ca13dd5 update bios.bin to the version that doesn't corrupt the audio 2022-10-22 12:14:03 -07:00
Matthew Berry
83bb9d29e3 the start to a proper config editor 2022-10-06 23:51:18 -07:00
Matthew Berry
5e9720f9b0 remove erroneous conditional block 2022-10-04 22:35:07 -07:00
Matthew Berry
5383a1b57b minor file dialog refactor 2022-10-01 18:37:36 -07:00
Matthew Berry
e79d8528a9 properly ignore libcimgui.dylib 2022-09-28 17:37:31 -07:00
Matthew Berry
b052a6d130 move to imgui 1.88 and utilize new crystal-imgui semantics 2022-09-28 17:37:11 -07:00
Matthew Berry
4551104192 hide cursor when ui times out 2022-09-25 01:02:32 -07:00
Matthew Berry
8704417243 clear bus cycle counter before running scheduler 2022-09-25 00:06:13 -07:00
Matthew Berry
432bfb962c move register methods below fields 2022-09-11 17:42:18 -07:00
Matthew Berry
242cedcb63 bump required compiler version to 1.5.1
This compiler version contains a patch allowing the ImGui bindings to work on macOS
2022-09-09 08:41:38 -07:00
Matthew Berry
e5cbf18eaf remove dead code 2022-09-02 17:59:03 -07:00
Matthew Berry
cd97745c09 stop printing for lack of stop mode 2022-09-02 17:56:02 -07:00
Matthew Berry
7543c401a8 remove console debugger 2022-09-02 17:32:23 -07:00
Matthew Berry
be65ef2703 super minor flash code change 2022-08-31 18:27:39 -07:00
Matthew Berry
c2af1e50ca flip order all bitfield registers for recent update
i updated the bitfield library to order fields low to high, which more closely resembles other languages as well as gba documentation
2022-08-31 18:27:35 -07:00
Matthew Berry
7001db8c90 update mmio from chained conditionals to case statement 2022-08-21 15:47:11 -07:00
Matthew Berry
e36b633522 support open bus for io registers 2022-08-19 21:50:12 -07:00
Matthew Berry
004ff2c197 bump BitField library to 0.1.5 and make DMAXCNT_H reads respect
read/write-only bits
2022-08-17 17:11:18 -07:00
Matthew Berry
73712b10ba make io register byte accesses respect non-writable bits (FIX SUPERSTAR SAGA)
The fact that this fixes Supestar Saga is both happy and sad for me. I spent so
much time trying to fix that game before, but I didn't even mean to fix it this
time. Either way, it works now. Finally.
2022-08-17 17:06:57 -07:00
Matthew Berry
7c45654b16 update dma unmapped reads 2022-08-16 14:18:42 -07:00
Matthew Berry
4505072049 update default soundbias value 2022-08-16 14:17:56 -07:00
Matthew Berry
01cb35398c removed to_s reg implementations since they exist by default now 2022-08-16 14:17:30 -07:00
Matthew Berry
a353dce7f3 rewrite blending routine to match all tonc bld_demo cases
minor perf regression in emerald title screen (~205fps -> ~200fps)
2022-08-11 22:24:36 -07:00
Matthew Berry
4cfd5b6fa7 add event types where they were missing 2022-08-10 10:07:07 -07:00
Matthew Berry
2024c9f1bf bump to latest bitfields version 2022-08-05 17:27:08 -07:00
Matthew Berry
b663bf2f6c bump imgui to v1.87 2022-07-31 10:43:11 -07:00
Matthew Berry
6ae942943d bump imgui backends shard to version that supports m1 macs 2022-07-18 20:00:06 -07:00
Matthew Berry
94ba13b024 ci: add macos 12, add ubuntu 22.04/18.04
Currently macos-latest maps to macos-11 and ubuntu-latest maps to
ubuntu-20.04
2022-07-18 17:55:26 -07:00
Matthew Berry
6b3f2e8415 minor sprite render refactoring for readability 2022-07-18 17:48:48 -07:00
Matthew Berry
6604a4800e GBA RTC implemented :)
Works in RTC test roms, Pokemon Emerald, and Sennen Kazoku
2022-07-16 17:58:02 -07:00
Matthew Berry
5f6a3310a1 rename methods and paths of audio classes to increase gb/gba similarity
maybe this will help merge them someday
2022-07-14 19:48:05 -07:00
Matthew Berry
dfdd319ca9 rename value to other in SoundChannel#=== 2022-07-13 19:05:59 -07:00