solosky / pixl.js

An emulator for Amiibo!
GNU General Public License v2.0
575 stars 110 forks source link

Optimize memory consumption of language supports #194

Closed fishybow closed 8 months ago

fishybow commented 8 months ago

While exploring locally, I discovered that adding more languages (and the corresponding translations) would cause the Chameleon app to crash, especially when the tag type is set to Mifare 4k.

I cannot be certain of the cause, but my suspicion is that the crashes were due to out of memory. As it stands right now, all translation strings are loaded into memory because they are statistically compiled into the executable.

Action Items

solosky commented 8 months ago

HI @fishybow, you are correct, the language const should be put into text section but somehow the linker put them into text section, see screen bellow. image

solosky commented 8 months ago

Thank your information, I have fixed this issue in #7355f93 All language string now puts into the text section, no memory is consumed. It's a simple and tidy solutions for this issue.

image

solosky commented 8 months ago

Hi @fishybow , regarding the crash when enter Chameleon app, I think I have fixed that issue in commit https://github.com/solosky/pixl.js/commit/01d2c975c7f6156e143491a0fa93a0a14745c3b6, can you have a try the latest develop firmware and confirm the issue still did exist or not? (You can download develop firmware in Github Actions tab).

The issue seems not related with the language files. Anyway, the current language translations still can compile into final firmware, because a language file only occupied 0x294 bytes in flash, that's still acceptable.

fishybow commented 8 months ago

Great thanks for the reply. Marking this as resolved.