Skip to content
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

Locale Emulation: Bug in hex integer parser #1375

Closed
Lizardon1 opened this issue Feb 22, 2020 · 1 comment
Closed

Locale Emulation: Bug in hex integer parser #1375

Lizardon1 opened this issue Feb 22, 2020 · 1 comment
Labels

Comments

@Lizardon1
Copy link

In function loadTitleLocaleConfig of patcher.c this code doesn’t seem to work as intended:

        if     (buf[11] >= '0' && buf[11] <= '9') *stateId += buf[11] - '0';
        else if(buf[11] >= 'a' && buf[11] <= 'f') *stateId += buf[11] - 'a';
        else if(buf[11] >= 'A' && buf[11] <= 'F') *stateId += buf[11] - 'A';

Input of "2E" gets parsed to 0x24 instead of 0x2E.

I have no dev environment set up, but I think this would fix it:

        if     (buf[11] >= '0' && buf[11] <= '9') *stateId += buf[11] - '0';
        else if(buf[11] >= 'a' && buf[11] <= 'f') *stateId += buf[11] - 'a' + 10;
        else if(buf[11] >= 'A' && buf[11] <= 'F') *stateId += buf[11] - 'A' + 10;

Same with buf[10] of course.

@TuxSH
Copy link
Member

TuxSH commented Apr 15, 2020

Thanks for the report, I'll fix it

@TuxSH TuxSH added the bug label Apr 15, 2020
@TuxSH TuxSH closed this as completed in 55d5121 Apr 15, 2020
TuxSH added a commit that referenced this issue Apr 24, 2020
Sahlo97 pushed a commit to Sahlo97/Luma3DS that referenced this issue Dec 9, 2021
Sahlo97 pushed a commit to Sahlo97/Luma3DS that referenced this issue Dec 9, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants