Commit graph

1321 commits

Author SHA1 Message Date
Corwin 083fd43ea3
just dealloc in gc 2023-06-05 00:12:36 +01:00
Corwin 77c4741ee7
hide objects by default 2023-06-03 16:06:23 +01:00
Corwin b5704afe5e
remove usize 2023-06-01 18:52:03 +01:00
Gwilym Inzani da5aed83e3
Use bilge rather than modular-bitfield (#430)
Thought I'd give bilge a go rather than modular bitfield after reading
this blog post:
https://hecatia-elegua.github.io/blog/no-more-bit-fiddling/

- [ ] Changelog updated / no changelog update needed
2023-05-30 20:41:46 +01:00
Corwin 7e111e0327
remove unused import 2023-05-25 19:30:38 +01:00
Corwin 9c15adf6c8
only normalise the relevant blocks 2023-05-25 19:25:26 +01:00
Gwilym Inzani 903157325f Don't recalculate the hash 2023-05-23 21:20:49 +01:00
Corwin d638134d37
remove codegen-units
these were added as a workaround for rust bugs
2023-05-23 20:10:24 +01:00
Gwilym Inzani 1b27bf4613 Remove codegen-units = 1 since it won't be needed any more 2023-05-21 16:37:35 +01:00
Gwilym Inzani 958f32b177 Include macros.inc properly 2023-05-21 16:37:35 +01:00
Gwilym Inzani 78bad29f88 Add codegen-units=1 to prevent miscompiles 2023-05-21 16:37:35 +01:00
Gwilym Inzani fe23bee18b Prevent multiple include errors 2023-05-21 16:37:35 +01:00
Gwilym Inzani 5ab0176ddb Entirely remove the need for binutils 2023-05-21 16:37:34 +01:00
Corwin df696a1093
align after section 2023-05-18 12:06:30 +01:00
Corwin e1426d8ef7
correct non thumb-interwork return 2023-05-17 23:25:27 +01:00
Corwin 9f3259d770
fix alignment of thumb functions defined in assembly 2023-05-17 19:56:57 +01:00
Gwilym Inzani 644e94f8ed Use bilge rather than modular-bitfield 2023-05-17 15:01:22 +01:00
Corwin 1cbc371d3e
go through colours in order rather than randomly 2023-05-07 23:41:17 +01:00
Corwin 64308a993c
use mag squared 2023-05-07 00:47:38 +01:00
Corwin 83c511a186
neaten the letter M 2023-05-06 23:59:47 +01:00
Corwin 7ae3afab6c
add example for no_game 2023-05-06 22:54:22 +01:00
Corwin cb8b42d416
don't use the loader 2023-05-06 22:53:09 +01:00
Corwin d4314213da
use palette in no game to save on not useful aseprite file 2023-05-06 22:45:30 +01:00
Corwin f95d68187b
make dynamic sprite better 2023-05-06 22:45:05 +01:00
Corwin e8479c093b
add macro to import a palette from a sprite 2023-05-06 22:44:43 +01:00
Corwin 13f0eaf5b0
add more colours 2023-05-06 20:31:52 +01:00
Corwin 54340358bc
remove unused import 2023-05-06 19:44:08 +01:00
Corwin 1d7cc04cbf
more colours 2023-05-06 19:11:39 +01:00
Corwin 0271da6d43
add a no game 2023-05-06 18:50:35 +01:00
Corwin 400abe5b31
Release v0.15.0 2023-04-25 21:51:29 +01:00
Corwin 68e981f3c8
Objects, again, again (#402)
* A redesign of objects giving the option of a more managed and an
unmanaged system.
* Managed system features
    * Z ordering (should be efficient, based on a doubly linked list).
* More than 128 objects if some are disabled (not currently efficient).
* Unmanaged
    * Same sprite system as before.
    * You control how objects get put in to OAM with the unmanaged OAM.
    
TODO before this is mergable:
* [x] Docs pass, aim for everything to have docs as before.
* [x] Tests, some of these needs some run time testing.
* [x] Affine matrices, I'm not leaving this to die this time.
* [x] Some API redo, so the names make sense / are similar to before.

Future work:
* The Sprite loader should keep most recently used sprites around and
upon allocation of a new sprite try unloading the least recently used
sprite. (Performance wise this would be a disaster as it would be doing
dealloc and alloc in vblank, so really we want to "learn" how much
buffer we should maintain and try to get that during GC).

- [x] Changelog updated
2023-04-25 21:14:49 +01:00
Gwilym Inzani 9835f81b5f Maybe make the build faster by using the same settings for all crates 2023-04-25 20:22:44 +01:00
Gwilym Inzani 8e152f05c9 Ensure mod tests is at the end 2023-04-25 20:06:52 +01:00
Corwin 3ec9bd2610
Merge remote-tracking branch 'upstream/master' into new-objects 2023-04-23 20:44:46 +01:00
Corwin 94a8e2d4c3
add deprecation for old names 2023-04-23 20:41:42 +01:00
Gwilym Inzani 6355ac0df7
Extract agb hashmap (#418)
Pulls out the hashmap to its own crate. Allows us to use this in interop
code between agb and desktop code and also gives us the ability to run
miri on it to make sure we're not running into any crazy unsoundness
bugs.

- [x] Changelog updated / no changelog update needed
2023-04-23 19:25:33 +01:00
Corwin b75481b88e
Merge remote-tracking branch 'upstream/master' into new-objects 2023-04-23 18:56:07 +01:00
Corwin 14c7028aa0
reverse change of name 2023-04-23 18:55:23 +01:00
Gwilym Inzani d80e3f876e Extract agb hashmap to its own crate 2023-04-23 17:39:00 +01:00
Corwin da61ba78ae
remove alloc error handler 2023-04-23 12:50:15 +01:00
Corwin e26a9c2c24
Merge remote-tracking branch 'upstream/master' into new-objects 2023-04-22 00:46:41 +01:00
Corwin 7e1f996d90
correct doc test 2023-04-22 00:40:06 +01:00
Corwin 6417570a51
add docs 2023-04-21 17:14:51 +01:00
Gwilym Inzani 6575a067b5 Fix documentation compilation 2023-04-18 20:07:08 +01:00
Gwilym Inzani 293bb15c7b Don't need this any more now I'm finished debugging 2023-04-13 22:46:03 +01:00
Gwilym Inzani f53cd9b25a Write some terrible documentation 2023-04-13 22:06:06 +01:00
Gwilym Inzani eac350b391 Replace example usage with the new macro 2023-04-13 22:01:37 +01:00
Gwilym Inzani 65877b1d32 Delete this file now 2023-04-13 21:53:28 +01:00
Gwilym Inzani cb127c7924 New include_gfx macro 2023-04-13 21:53:13 +01:00
Gwilym Inzani 5f59a01c21 Use .take() rather than replace(..., None) 2023-04-12 13:49:22 +01:00
Corwin fc5ce97db4
Release v0.14.0 2023-04-11 21:28:22 +01:00
Corwin aea64e974f
change of language 2023-04-11 20:59:45 +01:00
Corwin f59e4ad322
various micro optimisations 2023-04-07 01:40:27 +01:00
Corwin 4f19d6c240
forbid slot drop and move slot on set 2023-04-06 23:34:30 +01:00
Corwin 69b1ea5e47
fix brackets 2023-04-06 21:47:21 +01:00
Corwin c608458247
start on writing docs. A long way to go... 2023-04-06 21:45:32 +01:00
Corwin c84e81299b
improve the migration 2023-04-06 21:45:32 +01:00
Corwin cdc2eed01d
unsafe arena added (may remove later) 2023-04-06 21:45:30 +01:00
Corwin e690dda0f5
add test that my ordering code is right 2023-04-06 21:45:03 +01:00
Corwin d6006c7808
rename parts of objects 2023-04-06 21:45:03 +01:00
Corwin d183b8373d
pull out where to write 2023-04-06 21:45:03 +01:00
Corwin 875d53c040
add rotation to sprite example 2023-04-06 21:45:03 +01:00
Corwin 7265576e2a
fix affine matrix copying 2023-04-06 21:45:03 +01:00
Corwin 0e9910c517
copy affine matricies at copy time 2023-04-06 21:45:03 +01:00
Corwin 354cf7addc
keep and drain affine matricies 2023-04-06 21:45:03 +01:00
Corwin 63088f2907
affine matricies! 2023-04-06 21:45:03 +01:00
Corwin 8d23af010f
remove unused import 2023-04-06 21:45:03 +01:00
Corwin 26b9a50e4e
manage sprites better 2023-04-06 21:45:03 +01:00
Corwin 63e87b046b
correctly initialise before iteration 2023-04-06 21:45:03 +01:00
Corwin e6937bbb61
be able to clear sprite 0 on drop 2023-04-06 21:45:03 +01:00
Corwin e0af614cac
correctly initialise as not visible 2023-04-06 21:45:03 +01:00
Corwin 6007b95926
deallocate palettes 2023-04-06 21:45:03 +01:00
Corwin 57f24acdf9
use drop of iterator to clear rest of objects 2023-04-06 21:45:03 +01:00
Corwin d8f0d78d4b
unsafe is unsafe 2023-04-06 21:45:03 +01:00
Corwin 82b68fc335
mark function that can be used unsafely unsafe 2023-04-06 21:45:03 +01:00
Corwin f86bf9c07a
woah there, that shouldn't be public! 2023-04-06 21:45:03 +01:00
Corwin 660adbe961
fix games 2023-04-06 21:45:00 +01:00
Corwin c03c1664cb
move static sprite loader into managed oam 2023-04-06 21:43:49 +01:00
Corwin ab082c59a1
a mad redo of how objects work 2023-04-06 21:43:49 +01:00
Corwin 686ded4377
fix doc example 2023-04-06 21:28:52 +01:00
Corwin 96a321504c
correct doc sections 2023-04-06 21:17:33 +01:00
Corwin dffda47985
resolve interrupts unsoundness 2023-04-06 21:16:13 +01:00
Corwin d3834ed2ff
allocator unsound to use in interrupt 2023-04-06 20:48:04 +01:00
Corwin 182bae100c
remove unused function 2023-04-06 19:23:55 +01:00
Corwin 46faff254f
add grow to block allocator 2023-04-06 19:23:42 +01:00
Corwin 7030d65d9f
extract mutable and staticable parts 2023-04-06 17:31:02 +01:00
Gwilym Inzani e07a080aad Reduce codegen units to 1 to ensure build works 2023-04-05 17:06:56 +01:00
Gwilym Inzani 9d621f9b6a Add shstrtab section for lld 2023-04-02 20:39:38 +01:00
Corwin bf79fc89fb
Update Rust crate bitflags to v2 (#395) 2023-03-23 23:11:42 +00:00
Corwin 8eac033650
derive some traits on bitflags 2023-03-23 22:47:04 +00:00
renovate[bot] 044261a2ff
Update Rust crate bitflags to v2 2023-03-23 22:28:28 +00:00
Gwilym Inzani 8a3660733d Add rustfmt as a component to rust-toolchain 2023-03-23 22:17:02 +00:00
Gwilym Inzani ec3e43da56 cargo fmt everywhere 2023-03-23 21:59:49 +00:00
Corwin 0127508061
fat lto to fix build :)
(not recommended as general strategy)
2023-03-23 21:40:20 +00:00
Corwin 76b3aecda0
workaround the rust issue
rust-lang/rust#108853
2023-03-23 20:47:15 +00:00
Gwilym Inzani 54311727ec Fix build errors 2023-02-24 08:55:02 +00:00
Gwilym Inzani 689bfc642f Check if the tiles passed are of the correct format 2023-02-24 08:47:45 +00:00
Gwilym Inzani c6bac34294 Make the number of colours a property of the background 2023-02-24 08:44:47 +00:00
Gwilym Kuiper 152f96e953 Consistently use 'gba 2023-02-23 21:22:53 +00:00
Gwilym Kuiper 92066f7adb Add lifetimes to timers 2023-02-23 20:46:28 +00:00
Gwilym Kuiper 2bab48b422 Add lifetimes to the mixer 2023-02-23 20:44:20 +00:00
Gwilym Kuiper 5ac408d414 Do all the video modes 2023-02-23 20:42:48 +00:00
Gwilym Kuiper ce5641f5ef Add correct lifetimes for Blend 2023-02-23 20:39:23 +00:00
Gwilym Kuiper 9757f7ed54 Add correct lifetimes to windows 2023-02-23 20:37:03 +00:00
Gwilym Kuiper 0eec7e366c Add lifetimes to ObjectController 2023-02-23 20:36:00 +00:00
Gwilym Kuiper b76e7b9bf0 Release v0.13.0 2023-01-19 20:21:09 +00:00
Gwilym Kuiper 1cd4cc6a9e Merge remote-tracking branch 'origin/master' into remove-option-to-manage-your-own-interrupts-in-the-mixer 2023-01-12 22:30:32 +00:00
Gwilym Kuiper 7525a6f572
Make missing a vblank interrupt wait less painful (#374)
If you missed a vblank, then the next call to wait_for_vblank would
pointlessly wait rather than returning immediately. Meaning if you
missed a vblank by a few cycles, you'd be waiting for the entire next
one :(.

- [x] Changelog updated / no changelog update needed
2023-01-12 22:24:30 +00:00
Gwilym Kuiper 43aebe4092
Fix volume zero and power of 2 (#375)
Fixes #371.

If the volume was zero, the calculation for leading zeros was incorrect.
So both reduce the amount of work done for 0 volume and also count the
leading zeros correctly in the fast path.

- [x] Changelog updated / no changelog update needed
2023-01-12 22:17:16 +00:00
Gwilym Kuiper 987d7b0d2c
Add missing methods for tiled1 to allow creating backgrounds (#368)
Fixes #367

Had missed implementations to actually get the backgrounds if you were
using tiled1 mode.

- [x] Changelog updated / no changelog update needed
2023-01-12 22:14:43 +00:00
Gwilym Kuiper 009de4e660 Update test to be more relevant 2023-01-12 22:02:07 +00:00
Gwilym Kuiper 8009ffea09 If volume is 0, don't actually play anything 2023-01-12 21:54:08 +00:00
Gwilym Kuiper 6ebe08e528 Fix out by 1 while calcuating leading zeros 2023-01-12 21:53:54 +00:00
Gwilym Kuiper 827afd87b9 Make wait_for_vblank syscall pub(crate) 2023-01-12 21:24:37 +00:00
Gwilym Kuiper e50540752c Make missing a vblank interrupt wait less painful 2023-01-12 21:20:54 +00:00
Gwilym Kuiper b50d6694d9 Add missing methods for tiled1 to allow creating backgrounds
Fixes #367
2023-01-09 11:27:25 +00:00
Corwin 4e6b4107cb and test that benchmarks the allocator 2023-01-06 18:23:42 +00:00
Gwilym Kuiper d57a1edbd4 Remove stray reference to after_vblank 2022-12-10 00:32:57 +00:00
Gwilym Kuiper 5a71db0c17 Move buffer management entirely to the mixer state 2022-12-10 00:28:30 +00:00
Gwilym Kuiper 93d0fe5700 Start refactoring towards needing &self in write_channels 2022-12-10 00:19:05 +00:00
Gwilym Kuiper a870a1deda Can set the asm buffer size just once 2022-12-10 00:01:08 +00:00
Gwilym Kuiper 6f2c1bc616 Don't need to do the mod3_estimate here too 2022-12-10 00:00:36 +00:00
Gwilym Kuiper c031e9b002 Put the MixerBuffer in IWRAM 2022-12-09 23:33:25 +00:00
Gwilym Kuiper 8efbf87c21 Get rid of references to manual interrupt work 2022-12-09 23:09:16 +00:00
Gwilym Kuiper 0f5ce17f75 Fix the examples and the games 2022-12-09 23:00:28 +00:00
Gwilym Kuiper 6df06211c6 Fix the examples 2022-12-09 22:34:16 +00:00
Gwilym Kuiper 390392a1d8 Rename timer -> fifo_timer 2022-12-09 22:28:32 +00:00
Gwilym Kuiper b74c5e39c0 Remove setup_interrupt_handler and after_vblank in the mixer 2022-12-09 22:27:04 +00:00
Gwilym Kuiper 3e8090e153 Fix clippy lint for inline format args 2022-12-09 20:36:09 +00:00
Gwilym Kuiper 99ce2f73d5
Textrender rework (#352)
This reworks the text rendering system so the tiles in some rendered
text can be persisted across frames. This is important for performance
in situations where you want to incrementally write to a text box for
example in a Pokemon/Phoenix Wright style dialogue system. Previously
the only way to do this was to render all the chars in the text every
frame, which is currently prohibitively slow (though this could be
potentially sped up).

In addition with this implementation it is easy to individually colour
each character, so I added the ability to do that to.

I expanded the tests to test keeping the renderer instance (which
contains the tiles) over multiple frames, and also added in some
coloured text.

If you are happy with this implementation then I will change the
examples which use text, and also add some more documentation. Thanks
for taking a look.
2022-11-21 23:14:40 +00:00
jem 77275e2718 add in asserts for palette indicies 2022-11-21 21:50:43 +00:00
Gwilym Kuiper 212fd32108 Remember to clear the renderer 2022-11-21 07:37:03 +00:00
Gwilym Kuiper 08ceef09cd Rename 'c to 'b 2022-11-21 07:30:33 +00:00
Gwilym Kuiper 9660b6df12 Fix the text_render example 2022-11-21 07:28:40 +00:00
Gwilym Kuiper 707c2bf7e7 Remove the 'b lifetime 2022-11-21 07:26:48 +00:00
jem fbcf001986 unneeded newlines 2022-11-20 23:17:49 +00:00
jem 8b23b7d54a wrong title 2022-11-20 23:16:23 +00:00
jem 31c4d47872 whitespace 2022-11-20 23:15:09 +00:00
jem 0f3182d5b8 fix examples 2022-11-20 19:35:03 +00:00
jem 75fe0532f1 add docs 2022-11-20 19:33:39 +00:00
jem e7d87b8eee fix clippy warnings 2022-11-19 15:57:38 +00:00
jem e576f0685e readd new line 2022-11-19 15:49:55 +00:00
jem 07dc80e8fa rework the text renderer 2022-11-19 15:44:29 +00:00
Gwilym Kuiper deb907b9eb Fix remaining spelling errors in agb 2022-11-17 21:16:40 +00:00
Gwilym Kuiper 45431615dc Fix spelling errors in hash_map 2022-11-17 21:15:48 +00:00
Gwilym Kuiper 7621f47644 fix spelling errors in sync 2022-11-17 21:15:23 +00:00
Gwilym Kuiper dce5f40c26 Fix spellings in sound 2022-11-17 21:14:38 +00:00
Gwilym Kuiper da0ea524d9 Fix spelling errors in save 2022-11-17 21:13:22 +00:00
Gwilym Kuiper 51a8ec4d95 xfer -> transfer 2022-11-17 21:12:18 +00:00
Gwilym Kuiper c8ff3b4359 blnd -> blend 2022-11-17 21:10:56 +00:00
Gwilym Kuiper aa29b52b6b PingPong is 2 words 2022-11-17 21:10:26 +00:00
Gwilym Kuiper 0d6e6c709c Fix spellings in object.rs 2022-11-17 21:10:11 +00:00
Gwilym Kuiper cc879a094e Fix spellings in blend.rs 2022-11-17 21:05:26 +00:00
Gwilym Kuiper 32a8b213fb disp -> display 2022-11-17 21:04:53 +00:00
Gwilym Kuiper 140442fe0b Fix spellings in affine.rs 2022-11-17 21:04:32 +00:00
Gwilym Kuiper b37ce0b9b6 Fix spelling errors in block_allocator 2022-11-17 21:03:32 +00:00
Gwilym Kuiper 55c7541386 backc is not a word 2022-11-17 21:00:51 +00:00
Corwin b7a6158873 remove feature not required in later nightlies 2022-11-09 00:11:35 +00:00
Gwilym Kuiper 6319fd3a20 Fix doc errors and warnings 2022-11-01 22:02:51 +00:00
Gwilym Kuiper 9c99f25a56 Spell left correctly 2022-11-01 21:25:39 +00:00
Gwilym Kuiper c57013aafd Add deny(missing_docs) to input 2022-11-01 21:25:38 +00:00
Gwilym Kuiper dfa70f4335 Add a bunch of docs for input 2022-11-01 21:15:47 +00:00
Corwin 2efddfc342 changes made to make new game 2022-10-31 19:31:54 +00:00
Corwin 70f22b9255 Release v0.12.2 2022-10-22 12:59:20 +01:00
Corwin 78f9fd2026 Release v0.12.1 2022-10-12 19:00:12 +01:00
Corwin ae419fb6c1 when building docs, don't use instruction set 2022-10-12 17:30:08 +01:00
Corwin a9faaffe46 reflow doc comments 2022-10-12 17:30:08 +01:00
Corwin ab4089f5f3 fix broken links 2022-10-12 17:30:08 +01:00
Corwin 82baaa70cb deny broken links 2022-10-12 17:30:08 +01:00
Corwin 886f604efe rustfmt 2022-10-12 17:30:08 +01:00
Gwilym Kuiper fc45af262b Release v0.12.0 2022-10-11 23:34:13 +01:00
Gwilym Kuiper f1fb9d5375 Remove pointless set_scroll_pos and scroll_pos from AffineBackground 2022-10-11 22:32:00 +01:00
Corwin e30e0b76e2
Merge pull request #324 from corwinkuiper/affine-matrix-background
Use the new Affine Matrix stuff in the affine background
2022-10-09 20:51:26 +01:00
Corwin ae8d2b2fa0 fix broken docs 2022-10-09 17:52:24 +01:00
Corwin 4dfa6c25a5 REMOVE UNUSED IMPORT THAT I JUST MADE 2022-10-09 17:27:07 +01:00
Corwin f6dd65ae52 fix test 2022-10-09 17:21:30 +01:00
Corwin 6d7bc75bbb remove another unused import (in the classic case of dev by CI) 2022-10-09 17:21:21 +01:00
Corwin fb08d7e208 remove unused import 2022-10-09 17:05:06 +01:00
Corwin 89107f7a4e correct (and much better) docs 2022-10-09 16:59:58 +01:00
Corwin ed1e8bcbdc use new affine stuff in map 2022-10-09 16:59:49 +01:00
Corwin c69fdd7bec switch to using fixed point numbers in gba representation 2022-10-09 11:41:31 +01:00
Corwin dcdf678126 completely remove scalar mul 2022-10-09 11:31:54 +01:00
Corwin 002d409db8 this is not valid because we don't track the lower right entry
for rotation and translation this remains as 1, but it should change for scaling
2022-10-09 00:56:34 +01:00
Corwin 963fbc8c23 should be a multiply 2022-10-09 00:53:48 +01:00
Corwin b43408e6e1 reimplement default 2022-10-09 00:50:41 +01:00
Corwin 3497f7a720 switch to using new affine matrix 2022-10-09 00:42:14 +01:00
Corwin d2f5a5333a Merge remote-tracking branch 'upstream/master' into object-controller2 2022-10-09 00:19:44 +01:00
Corwin dead6652eb fix lint 2022-10-08 23:46:54 +01:00
Corwin 96401c2833 implement multiplication by scalar 2022-10-08 23:44:22 +01:00
Corwin 9ed5ee2295 change name of function to match the name of the transformation 2022-10-08 23:41:41 +01:00
Corwin c33f99aaea add comment on what the matrix represents 2022-10-08 23:39:19 +01:00
Corwin 6927f84597 deny undocumented 2022-10-08 23:39:19 +01:00
Corwin c09c0b77f4 add docs 2022-10-08 23:39:19 +01:00
Corwin 5e8a50159e implement try from 2022-10-08 23:39:19 +01:00
Corwin d83f0ea710 from rotation accept generic fixnum 2022-10-08 23:39:19 +01:00
Corwin 99f01caea4 some fun affine matrix functions! 2022-10-08 23:39:19 +01:00
Corwin f17084d4f6 Merge remote-tracking branch 'upstream/master' into object-controller2 2022-10-08 23:36:59 +01:00
Gwilym Kuiper f921da930a Fix doc comment 2022-10-08 23:15:54 +01:00
Gwilym Kuiper a09be56319 Fix example 2022-10-08 23:08:04 +01:00
Gwilym Kuiper f5f73e89f5
Merge branch 'master' into affine 2022-10-08 23:03:42 +01:00