-
Notifications
You must be signed in to change notification settings - Fork 596
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Use debug macros even in N64-only code #2298
base: main
Are you sure you want to change the base?
Conversation
3e476a5
to
ba13f43
Compare
ba13f43
to
5366c7f
Compare
src/code/code_n64dd_800AD410.c
Outdated
DmaMgr_RequestSync(_n64ddSegmentStart, (uintptr_t)_n64ddSegmentRomStart, | ||
_n64ddSegmentRomEnd - _n64ddSegmentRomStart); | ||
DMA_REQUEST_SYNC(_n64ddSegmentStart, (uintptr_t)_n64ddSegmentRomStart, | ||
_n64ddSegmentRomEnd - _n64ddSegmentRomStart, "../code_n64dd_800AD410.c", 0); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think I'd be more comfortable with something like
_n64ddSegmentRomEnd - _n64ddSegmentRomStart, "../code_n64dd_800AD410.c", 0); | |
_n64ddSegmentRomEnd - _n64ddSegmentRomStart, UNK_FILE_NAME, UNK_LINE_NUMBER); |
just so it's completely unambiguous to any reader who isn't in the loop that these are fake, in that we can't know what they originally were. These macros could then expand to __FILE__, __LINE__
or just to __FILE__, 0
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Alright, I've created UNK_FILE
(and turns out UNK_LINE
already exists). I don't think the macros should expand to __FILE__
and __LINE__
, it seems weird to mix in decomp filenames and line numbers in with the originals. Instead I think it would be better to have versions of the debug macros that put in the real __FILE__
and __LINE__
everywhere if you wanted this for debugging (as @Dragorn421 has suggested before)
After #2296 building N64 ROMs with debug features will be supported, so it would be nice to use e.g. DMA_REQUEST_SYNC instead of DmaMgr_RequestSync everywhere so things are consistent. For the filename, I used whatever filename the existing debug macros used (except for code_n64dd_800AD410.c which we don't know). For unknown file names or line numbers, I used macros
UNK_FILE
andUNK_LINE
which expand to"<unknown>"
and0
respectively.