Skip to content

Conversation

@someone2639
Copy link
Collaborator

@someone2639 someone2639 commented Jun 16, 2025

  • Implement remaining branch instructions ✅

  • Implement COP1 instructions and syscall

  • Implement .sym format and n64sym tool from libdragon ✅

  • File/line support as a result ✅

  • Change font to something with lowercase and symbols ✅

  • Move elements around to fill the whole screen ✅

  • Arbitrary text coloring ✅

  • Simple Overview page with only what's necessary ✅

  • Implement break cache eret sync (Not sure if really necessary)

@arthurtilly
Copy link
Collaborator

can we also remove those stupid shadow instructions that appear behind the real ones. whats up with that

@gheskett
Copy link
Collaborator

can we also remove those stupid shadow instructions that appear behind the real ones. whats up with that

Probably just a meme with crash screen transparency and scrolling. Also that asymmetrical box drawing thing has been a thing for a century (though that should probably get corrected already, why is that still this broken...)

@someone2639 someone2639 changed the title Crash Screen Disasm and Map Packer Updates Crash Screen Updates Jun 17, 2025
@someone2639 someone2639 marked this pull request as ready for review June 24, 2025 01:55
@someone2639
Copy link
Collaborator Author

Ready for Review!

  • n64sym tool needs testing on other distros, since I run "/usr/bin/%s-addr2line" % $(CROSS), and I'm only 90% confident that works on everything
  • Stack Trace and symbol exporting can be disabled, though I feel like disasm is important enough to stay (that's how it was in the old crash screen); This saved at least 300KB in the rom due to not even packing the symbol table in the ROM
  • Since everything is guarded by a define, removed the if parse_map == MAP_PARSER_ADDRESS style lines and replaced them with ifdef's
  • Color support in overview soon:tm:

Copy link
Collaborator

@gheskett gheskett left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will review the shiny new denser things later (and probably gloss over the copied libdragon stuff if you can point me to which is which)

@gheskett gheskett added enhancement New feature or request cleanup Removal of useless or bloat code/features labels Jun 24, 2025
@gheskett gheskett added this to the 2.4 milestone Jun 24, 2025
@gheskett gheskett added the bug Something isn't working label Jun 24, 2025
@gheskett
Copy link
Collaborator

gheskett commented Jun 24, 2025

Also since we're touching it anyway, can we replace the HackerSM64 syscall with a proper trapping alternative? (Discuss with Falco on this probably, but even FORCE_CRASH would probably work well enough, plus that'd also remove the need of using a separate ASM file for assertions.)

@someone2639
Copy link
Collaborator Author

switching assert strategies seems like a rabbit hole since it's either a trap, break, or syscall depending on who you ask (it's even a break 0 in libultra technically)

@mpharoah
Copy link
Collaborator

The issue isn't using syscall, break, or teq $0, $0, the issue is that the crash screen is blindly trusting that memory set only in the HackerSM64 assert call is a valid pointer, and crashes if not, causing the crash screen to crash if the BREAK/SYSCALL happens from 3rd party code. Just need to validate that the pointers to the assert string have actually been set.

@someone2639
Copy link
Collaborator Author

That seems like an easy enough fix, though some time down the line (read: NOT IN THIS PR), we should come up with an ABI either here or in hackerlibultra where we can decide that e.g. break with specifically a value of 0 is a failed assert while break 6 isn't

@mpharoah
Copy link
Collaborator

Good idea. My suggestion would be SYSCALL 18995 (18995 being the 20 bits that give ASRT when base-32 encoded)

@someone2639
Copy link
Collaborator Author

Ready for another lap 🏇

Copy link
Collaborator

@gheskett gheskett left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code-wise, I think I'm good on this for now. That said, I've found some issues through playtesting:


  1. The disasm seems to have an issue in which the functions disappear upon scrolling (see screenshot below for difference after scrolling down a singular entry). Notice the first instruction was skipped, and the other function name is gone. The instructions print one fewer lines than before.
image
  1. The Puppyprint log page does not display correctly. It need to not re-render the background, and also prints bottom-up rather than top-down.
image
  1. Some of the text alignments on the assert page (and also page 0) are still off. Ideally everything is monospace.
image
  1. The crash screen seems to not be able to find audio code files (in this case, src/audio/synthesis.c). Notice also that the stack trace is incomplete and only displays two functions.
image

@someone2639
Copy link
Collaborator Author

Fixed spacing and the puppyprint visual bug. (Probably not going to fix the puppyprint log ordering, since that seems like an intentional feature, see here)

For the stack bug, I was able to get just before thread4_sound printed, but it did seem to skip that function, so I will go down the heuristic mines to investigate

@someone2639
Copy link
Collaborator Author

Ready for another lap 🏇

Copy link
Collaborator

@gheskett gheskett left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Couple things:

  1. I'm noticing the spacing is still off for some things, notably following File:
  2. The synthesis stack trace still only goes back a couple functions (assuming this is still WIP)
  3. The Puppyprint log should be displayed at the top. Puppyprint does indeed do this:
image I suppose the text printing order is a thing, but I honestly don't like how it prints newest at the top anyway, so that should be addressed Puppyprint-side. The only consideration there would be excess messages printing above the top. Fixing this would be easy if Puppyprint can't do newlines, otherwise we'd have to newline count everything ahead of time to make a determination. Probably out of scope, I won't require the ordering swap for this PR (though you're welcome to implement it if you want).

Copy link
Collaborator

@gheskett gheskett left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Okay I think I'm satisfied. The only thing I'm thinking now is that it might be a good idea to render 100% opacity on page swaps and render transparent only on the first render of the crash screen, since subsequent renders basically black out the screen already and just make text hard to read. Ideally we'd just cache the framebuffer here or something, but that's out of scope.

@github-project-automation github-project-automation bot moved this from In progress to Needs Review in 2.4 (Minor Feature Update) Nov 25, 2025
Copy link
Collaborator

@gheskett gheskett left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

DId some additional testing; the crash screen seems like it straight up does not work on console.

@github-project-automation github-project-automation bot moved this from Needs Review to In progress in 2.4 (Minor Feature Update) Nov 25, 2025

// get the start of the current frame's func
while (!ADDRENTRY_IS_FUNC(funcstart) && !ADDRENTRY_IS_INLINE(funcstart)) {
funcstart = symt_addrtab_entry(&symt, --idx);
Copy link
Collaborator

@gheskett gheskett Dec 3, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I tried bisecting the (probably) crash, turns out this line seems to be the point of failure (or really, the IO_READ macro behind this function call). Absolutely no idea what's going on here though or how to fix it, so good luck :D

NOTE: No, it's not a null pointer exception with symt, but it may be possible that the IO_READ provided address itself is invalid. Worth noting also that the crash happens on the very first call to this function within the loop...assuming it's even a crash in the first place (yielded thread?)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

blocker This MUST be resolved before the feature branch can be merged. bug Something isn't working cleanup Removal of useless or bloat code/features enhancement New feature or request

Projects

Status: In progress

Development

Successfully merging this pull request may close these issues.

Crash Screen Displays Broken Crash Function

5 participants