Skip to content

Upgrade to rgbds 0.5.2, and use newer macro syntax #447

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

Merged
merged 2 commits into from
Sep 30, 2022

Conversation

kemenaran
Copy link
Collaborator

@kemenaran kemenaran commented Sep 13, 2022

Fixes future macro warnings on the (yet unreleased) rgbds 0.6, by using the newer macro syntax. Credits to @ShadowOne333

This PR doesn't include the "unmapped chars" warning appearing in RGBDS 0.6 for now. The warning cause should probably be fixed - but for now, it can be worked around by disabled the warning using the command line :

make ASFLAGS='--export-all -Wno-unmapped-char'

This adds support for the newer macro syntax.
Fixes warnings on rgbds 0.6
@kemenaran kemenaran force-pushed the fix-macros-for-rgbds-06 branch from 6e12147 to 1dc84e9 Compare September 13, 2022 09:14
@kemenaran kemenaran changed the title src: use newer macro syntax Upgrade to rgbds 0.5.2, and use newer macro syntax Sep 13, 2022
@kemenaran
Copy link
Collaborator Author

This PR doesn't include the "unmapped chars" warning appearing in RGBDS 0.6 for now. The warning cause should probably be fixed - but for now, it can be worked around by disabled the warning using the command line :

make ASFLAGS='--export-all -Wno-unmapped-char'

@kemenaran kemenaran requested a review from daid September 13, 2022 09:51
@ShadowOne333
Copy link

ShadowOne333 commented Sep 13, 2022

Thanks for the credit :D
I'll try to see if I can fix the unmapped-char warning fixed as well this week.
I'll post any changes here when I get to them.

I think the issue is that Link's Awakening uses direct ASCII characters for its text, and since they're unmapped in the source code, that's why rgbds keeps throwing those warnings for all the text files.

@ShadowOne333
Copy link

ShadowOne333 commented Sep 13, 2022

Seems like the only way to fix the warning about the unmapped-char is to actually map or define each character from Link's Awakening manually.
A contributor to rgbds, Rangi, suggested the following:

DEF PRINTABLE_ASCII EQUS " !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz\{|}~"
for i, STRLEN("{PRINTABLE_ASCII}")
    charmap STRSUB("{PRINTABLE_ASCII}", i + 1, 1), i + $20
endr

That would solve the warning, all that'd be needed is to properly put the corresponding characters in order.
Here's another suggested way of doing it (with \t \n \r):

DEF PRINTABLE_ASCII EQUS "\t\n\r !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz\{|}~"
for i, 1, STRLEN("{PRINTABLE_ASCII}") + 1
    charmap STRSUB("{PRINTABLE_ASCII}", i, 1), (STRSUB("{PRINTABLE_ASCII}", i, 1))
endr

It all depends on which characters LA uses from ASCII.
As to where to place this, I am not sure yet. I'm open to any suggestions.

@kemenaran
Copy link
Collaborator Author

I guess that piece of code could go into src/constants/charmaps/main.asm

I'm open to both ways: either defining all characters by hand, or using a macro with a comment like "; Explicitely define ASCII characters".

@ShadowOne333
Copy link

ShadowOne333 commented Sep 14, 2022

Mmmm I tried adding all of the ASCII table to the charmaps main.asm for each language, but I am still getting the warnings when compiling with the dialogue and credits files.

EDIT:
I think I know why the rest of the warnings are appearing.

  1. There were some missing charmaps in the F0 and G0 languages (like * and ^), those I have fixed already and also imported the ones from the English main.asm into the other languages (except japanese).
  2. The Credits use a different charmap, which seems to be specified inside src/code/credits.asm, at line 390. If there's a way to convert these to charmap format, then the warnings should pretty much be done for unmapped-char.

Here you have the modified main.asm files for all languages, only remaining unmapped-char warnings should be those from the credits for each language.

@ShadowOne333
Copy link

ShadowOne333 commented Sep 15, 2022

I found a hacky way to remove the warnings, I ended up including the charmaps files (with include inside each of the credits files for each language, and then for the French and German languages, I added 4 specific charmaps so they match properly.

Now when compiling, it shouldn't throw any errors by using the files in this zip:
charmaps.zip

I have included both the main.asm files for each language that were modified, as well as all the credits.asm files modified too.
Compiling shouldn't throw any kind of unmapped-char errors now.
If everything goes well, I think this alongside the macro changes should be good for committing.

@kemenaran
Copy link
Collaborator Author

Alright, I'll first merge this PR, and then open another one for the charmaps.

@kemenaran kemenaran merged commit 94f71f0 into main Sep 30, 2022
@kemenaran kemenaran deleted the fix-macros-for-rgbds-06 branch September 30, 2022 20:08
@tobiasvl tobiasvl mentioned this pull request Oct 12, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants