gbadev
Game Boy Advance homebrew development forum
Member
Joined:
Posts: 5

Participating in the gamejam and one of my inspirations (the rainworld programmer/designer Joar Jakobsson) really encouraged making a devlog, and I remember reading that that's encouraged here. The project is super secret, but you can get sneak peeks here. Going to try my hardest to post every day.

Today I started on a rust Morse code data structure. I think you can store all the info for a Morse code sequence in just two bits, which I'm pretty proud of!

Here's my idea:

  • Two bits (e.g. 00) for a dot (one unit of time in duration plus a one unit silence)
  • Two bits (e.g 01 for a dash (three units of duration plus a 1U silence)
  • two bits (10) for a letter terminator (two extra units of silence
  • two bits (11) for a word terminator (6 extra units of silence instead of the letter terminator)

Cya tomorrow!

Member
Joined:
Posts: 5

I just realize it's a different channel that says to start a devlog in... I'll deal with that later.)

Administrator
avatar
Joined:
Posts: 53

It's ok to keep your devlog here, or I can move it for you if you want (the only difference is whether it shows up in the News section of the Portal page)

Now I'm curious if the morse code is part of a secret puzzle or like a core gameplay mechanic. (you don't have to answer!) :P

Good luck and looking forward to future updates!

Member
Joined:
Posts: 5

@exelotl Thanks! I'm fine leaving it here.

I don't mind telling that the morse code is going to be a core gameplay element. I think it's cool and have always wanted to learn it and how better than a mysterious video game? I was reading about methods for learning it and am pretty interested in the Koch method. It seems to really lend itself to gamification and might have caught on more in its day if the gameboy (or even a pc) was a thing. I'm currently figuring out how to cram the beeps and boops into the GBA and had a lot of fun pair programming with my wife Kayla who's a rust wizard and general cutie.

Dunno if I mentioned that my toolchain for the game is agbrs. I like rust a lot more than c and agbrs has lots of good tutorials I could look at if I wanted (being honest here- I'm in full goblin mode and really wish I had the patience for tutorials- it would make my life a lot easier).

Kayla helped me figure out functions for packing and unpacking the 2-bit morse segments I came up with yesterday into 8 bit chunks- since Rust doesn't have a 2-bit primitive and I was floundering. I'm glad I had help since my first solutions were much more janky (Kayla's been programming at least 10 years longer than me and lives and breathes computers so I'm really lucky)

I then wanted to be a good girl and write some tests. I was all set to run cargo test (and almost cried when I learned Rust supports tests inside your modules, and doesn't make you write a separate file for them), but the computer was nice enough to remind me I have no standard library for the GBA, and commenting out ![no_std] whenever I wanted to run tests felt like it would incur the wrath of an outer god or two. Thankfully agbrs has its own pretty slick test setup using mgba. The only problem is the tool I needed to install needed a static mgba library- something the installations available on Fedora linux don't provide as far as I'm aware (I could only find a flatpak and an appimage). So I got to compile mgba from source. After a couple hiccups it was installed and I get to find out tomorrow if I actually get to run tests.

I'm pretty new to all this, and wish I could make progress faster, but I'm having fun, and hopefully this is at least entertaining to read! I'm not sure what detail is helpful and what is extraneous, so I'd be happy to field questions or take constructive criticism.

Till next time! Good luck with your stuff!

  • Jayda
Member
Joined:
Posts: 5

Well, It's been several more hours and I only just got the beautiful, beautiful lights on my computer screen, spelling "Tests Finished Successfully". Why did it take so long? I'm just going to copy-paste the issue I filed to agbrs's github, titled mgba-test-runner compilation fails on Fedora Linux. That's right! I spent over an hour to compile mgba from source myself last night for nothing! I hadn't realized that the mgba-test-runner build was also compiling mgba from scratch, and also that the build I did last night wasn't making the static library the test runner wants. So what was broken? let's read the github issue to learn more:

mgba-test-runner compilation fails on Fedora Linux

I was getting the error: "could not find native static library mgba, perhaps an -L flag is missing?"
I could verify that the libmgba.a file was indeed being made but still couldn't be found. Passing an -L flag didn't seem possible because cargo builds to a different folder every time. I guess I could have copied the file to somewhere else and told the compiler to look there via an -L flag,, but that wouldn't help other people with the same problem and is pretty bodgy.

If you hadn't already guessed, I already figured out the problem (after much suffering and some tears):

The compile() function in agb/emulator/mgba-sys/build.rs doesn't check for libmgba.a in
/tmp/cargo-installATjYGr/release/build/mgba-sys/b1badf9e16f5cee4/out/lib64/
, which is where CMake wants to put it when running on Fedora.

The fix which worked for me was just to add the following line to the compile function:
println!("cargo:rustc-link-search=native={}/lib64", dst.display());
so it'll look in the right place.
(I just put the new line after println!("cargo:rustc-link-search=native={}/lib", dst.display());)

I could then compile by running [cargo install --path emulator/test-runner]

I'd be happy to put up a PR! I wonder if I should be trying to file a fix for mgba-sys instead or in addition though.

Pretty proud of myself for actually figuring this out without needing to ask anyone for help! We have guests coming over in 7 minutes so I guess I'll have to wait to actually continue my game code. big sigh.

Cheers!

  • Jayda