You're a true lifesaver for making this tool, saved me lots of time and frustration! Thank you!
I'm glad I can help :p
I'm skeptical as to the need for a dedicated GUI for this, frankly.
[[email protected] ~/Documents/Projects/pkmn-macro]? python
Python 3.4.2 (default, Jan 12 2015, 11:38:40)
[GCC 4.9.2 20141224 (prerelease)] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import codecs, pokemon
>>> codecs.register(pokemon.getregentry)
>>> "Hello, Pokécommunity!".encode("pokemon")
b'\xc2\xd9\xe0\xe0\xe3\xb8\x00\xca\xe3\xdf\x1b\xd7\xe3\xe1\xe1\xe9\xe2\xdd\xe8\xed\xab'
Here. It's in the public domain. It's not the best mapping in the world, but it's not my fault - the encoding Gamefreak used doesn't map cleanly onto Unicode. For example, Unicode has separate codepoints for apostrophe (U+0027) and closing single quote (U+2019), but Gamefreak use 0xB4 as both. I didn't want my codec to be non-bijective, so I don't encode U+0027 as 0xB4, which leads to behaviour that may look odd.
>>> "RIVAL's NAME?".encode("pokemon") # U+0027 APOSTROPHE
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/home/thomas/Documents/Projects/pkmn-macro/pokemon.py", line 8, in encode
return codecs.charmap_encode(input, errors, encoding_dict)
UnicodeEncodeError: 'charmap' codec can't encode character '\x27' in position 5: character maps to <undefined>
>>> "RIVAL’s NAME?".encode("pokemon") # U+2019 RIGHT SINGLE QUOTATION MARK
b'\xcc\xc3\xd0\xbb\xc6\xb4\xe7\x00\xc8\xbb\xc7\xbf\xac'
>>> import unicodedata
>>> unicodedata.name("'")
'APOSTROPHE'
>>> unicodedata.name("’")
'RIGHT SINGLE QUOTATION MARK'
I also haven't added support for 0x53 through 0x59, because I'm not sure what the correct thing to do is. Use the private-use area? Decode e.g. 0x53 as U+1D3E U+1D0B?
The encoding of 0xFC through 0xFF is arbitrary and frankly not very good.
Let me be blunt, the GUI is important because it simply makes work
easier. Compare to what you made, my tool is easier to use right? You don't need to type lots of codes to make it work, just hit convert and your done! That alone save a lot of time. And it is less confusing compared to what you show. Let's take the example you gave:
Yours: "Hello, Pokécommunity!".encode("pokemon")
b'\xc2\xd9\xe0\xe0\xe3\xb8\x00\xca\xe3\xdf\x1b\xd7\xe3\xe1\xe1\xe9\xe2\xdd\xe8\xed\xab'
-> With this, you still need to remove the apostrophes, backslashes and the 'x' char to be inserted in the ROM, and that alone consumes a LOT of time. What if it is a whole lot of sentence?
Mine: Just type "Hello, Pokécommunity!" on the text field, hit convert and you get
C2 D9 E0 E0 E3 B8 00 CA E3 DF 1B D7 E3 E1 E1 E9 E2 DD E8 ED AB, hit copy, paste on the ROM, done. Easy right?
Anyway, I know this can be done on Python this way, but I wanted to make more conventional one. Good luck on yours bro.