Fixing a problem with japanese characters

This commit is contained in:
TuxSH 2015-11-29 20:03:26 +01:00
parent ddfdb1178a
commit a741c92ddf
13 changed files with 61 additions and 27 deletions

View File

@ -1,3 +1,6 @@
###PkmGCTools v1.2.3:
Fixing a problem with japanese characters.
###PkmGCTools v1.2.2:
Few changes this week:
* The PID of a Pokémon can now be displayed either in hexadecimal or in decimal (default: hexadecimal).

View File

@ -49,6 +49,8 @@ public:
virtual Pokemon* clone(void) const = 0;
virtual Pokemon* create(void) const = 0;
void updateNamesLanguage(void);
static u16 calculateStat(size_t statIndex, PokemonSpeciesIndex species, PokemonNatureIndex natureIndex, u8 level, u8 IV, u8 EV);
static void calculateStats(PokemonSpeciesIndex species, PokemonNatureIndex natureIndex, u8 level, const u8 IVs[6], const u8 EVs[6], u16 outStats[6]);
static u8 calculateLevelFromExp(PokemonSpeciesIndex species, u32 experience);

View File

@ -22,7 +22,7 @@
#include <boost/config/warning_disable.hpp>
#include <boost/config.hpp>
#define LIBPKMGC_VERSION 1002002
#define LIBPKMGC_VERSION 1002003
#define LIBPKMGC_VERSION_MAJOR ((LIBPKMGC_VERSION / 1000000) % 1000)
#define LIBPKMGC_VERSION_MINOR ((LIBPKMGC_VERSION / 1000) % 1000)
#define LIBPKMGC_VERSION_BUILD (LIBPKMGC_VERSION % 1000)

View File

@ -24,6 +24,11 @@ namespace LibPkmGC {
namespace Base {
void Pokemon::updateNamesLanguage(void) {
OTName->setCharset(version.language == Japanese);
name->setCharset(version.language == Japanese);
}
u16 Pokemon::calculateStat(size_t statIndex, PokemonSpeciesIndex species, PokemonNatureIndex natureIndex, u8 level, u8 IV, u8 EV){
static const u16 n[3] = { 110, 100, 90 };
@ -251,6 +256,10 @@ void Pokemon::swap(Pokemon& other) {
SW(ballCaughtWith);
SW(levelMet);
SW(OTGender);
SW(version);
updateNamesLanguage();
other.updateNamesLanguage();
if (OTName->isGBA() == other.OTName->isGBA())
SW(OTName);
else {
@ -275,7 +284,7 @@ void Pokemon::swap(Pokemon& other) {
SW(PID);
SW(GCUnk);
SW(version);
SW(partyData);
@ -301,6 +310,8 @@ void Pokemon::swap(Pokemon& other) {
bool i1 = isMarkedAsInvalid(), i2 = other.isMarkedAsInvalid();
setInvalidPokemonFlag(i2); setInvalidPokemonFlag(i1);
}
void Pokemon::copyNonVirtual(Pokemon const& other) {
@ -345,6 +356,7 @@ Pokemon & Pokemon::operator=(Pokemon const & other){
if (this != &other) {
Base::DataStruct::operator=(other);
copyNonVirtual(other);
updateNamesLanguage();
*OTName = *(other.OTName);
*name = *(other.name);
setEggFlag(other.isEgg());

View File

@ -112,6 +112,8 @@ void Pokemon::loadFields(void) {
normalizepokerus();
normalizeStatus();
updateNamesLanguage();
}
void Pokemon::save(void) {
@ -130,9 +132,13 @@ void Pokemon::save(void) {
SV_FIELD_E_MAX(u8, OTGender, 0x10, Gender, Female);
SV_FIELD(u16, SID, 0x14);
SV_FIELD(u16, TID, 0x16);
updateNamesLanguage();
OTName->save(data + 0x18, 10);
name->save(data + 0x2e, 10);
name->save(data + 0x44, 10);
SV_FIELD_MAX(u32, experience, 0x5c, getSpeciesExpTable(species)[100]);
if (partyData.level > 100) partyData.level = 100;

View File

@ -393,7 +393,7 @@ inline chartable_t initJapCharTable(void) {
tbl.insert(charset_t(0xAB, 0xFF01));
tbl.insert(charset_t(0xAC, 0xFF1F));
tbl.insert(charset_t(0xAD, 0x3002));
tbl.insert(charset_t(0xAE, 0xFF0D));
tbl.insert(charset_t(0xAE, 0x30FC));
tbl.insert(charset_t(0xAF, 0x30FB));
tbl.insert(charset_t(0xB0, 0x2025));
tbl.insert(charset_t(0xB1, 0x300E));

View File

@ -53,6 +53,7 @@ Pokemon::Pokemon(Pokemon const& other) : Base::Pokemon(other) {
setEggFlag(other.isEgg());
setSecondAbilityFlag(other.hasSecondAbility());
setInvalidPokemonFlag(other.isMarkedAsInvalid());
updateNamesLanguage();
}
void Pokemon::swap(Pokemon& other) {
Base::Pokemon::swap(other);
@ -294,6 +295,9 @@ void Pokemon::loadFields(void) {
normalizeStatus();
if (!checkChecksum(false)) setInvalidPokemonFlag(true);
updateNamesLanguage();
}
@ -318,6 +322,7 @@ void Pokemon::save(void) {
version.save(lg, gm);
normalizepokerus();
updateNamesLanguage();
name->save(data + 8, 10);
OTName->save(data + 20, 7);

View File

@ -124,6 +124,7 @@ void Pokemon::loadFields(void) {
pkmFlags[LIBPKMGC_GC_SECOND_ABILITY_FLAG] = isSecondAbilityDefined() && pkmFlags[LIBPKMGC_GC_SECOND_ABILITY_FLAG];
normalizepokerus();
normalizeStatus();
updateNamesLanguage();
}
@ -171,6 +172,10 @@ void Pokemon::save(void) {
SV_FIELD(u32, st, 0x2c);
SV_FIELD_B(u8, obedient, 0x30);
SV_FIELD(u8, encounterType, 0x33);
version.save(data + 0x34);
updateNamesLanguage();
OTName->save(data + 0x38, 10);
name->save(data + 0x4e, 10);
name->save(data + 0x64, 10);
@ -191,7 +196,6 @@ void Pokemon::save(void) {
SV_FIELD(u16, shadowPkmID, 0xba);
version.save(data + 0x34);
for (size_t i = 0; i < 4; ++i)
moves[i].save(data + 0x80 + 4 * i);

View File

@ -19,7 +19,7 @@
#ifndef _PKMGCSAVEEDITOR_GLOBALS_H
#define _PKMGCSAVEEDITOR_GLOBALS_H
#define PKMGCSAVEEDITOR_VERSION 1002002
#define PKMGCSAVEEDITOR_VERSION 1002003
#define PKMGCSAVEEDITOR_VERSION_MAJOR ((PKMGCSAVEEDITOR_VERSION / 1000000) % 1000)
#define PKMGCSAVEEDITOR_VERSION_MINOR ((PKMGCSAVEEDITOR_VERSION / 1000) % 1000)
#define PKMGCSAVEEDITOR_VERSION_BUILD (PKMGCSAVEEDITOR_VERSION % 1000)

View File

@ -643,12 +643,14 @@ void PokemonUI::saveChanges(void){
pkm->ballCaughtWith = ballCaughtWithFld->currentItemIndex();
pkm->obedient = obedientFld->isChecked();
pkm->version = versionFld->info();
pkm->updateNamesLanguage();
OTField->trainerName(pkm->OTName);
pkm->TID = OTField->TID();
pkm->SID = OTField->SID();
pkm->OTGender = OTField->trainerGender();
pkm->version = versionFld->info();
pkm->partyData.currentHP = currentHPFld->unsignedValue();
for (size_t i = 0; i < 6; ++i) {

View File

@ -888,17 +888,17 @@ Pokémon caught in XD always have this field checked</source>
<translation>Bänder</translation>
</message>
<message>
<location filename="../src/GCUIs/PokemonUI.cpp" line="688"/>
<location filename="../src/GCUIs/PokemonUI.cpp" line="690"/>
<source>Genderless</source>
<translation>Geschlechtslos</translation>
</message>
<message>
<location filename="../src/GCUIs/PokemonUI.cpp" line="704"/>
<location filename="../src/GCUIs/PokemonUI.cpp" line="706"/>
<source>Unown form: </source>
<translation>Icognito-Form:</translation>
</message>
<message>
<location filename="../src/GCUIs/PokemonUI.cpp" line="709"/>
<location filename="../src/GCUIs/PokemonUI.cpp" line="711"/>
<source>will evolve into: </source>
<translation>entwickelt sich zu:</translation>
</message>
@ -913,22 +913,22 @@ Pokémon caught in XD always have this field checked</source>
<translation>Als ungültiges Pokémon markiert</translation>
</message>
<message>
<location filename="../src/GCUIs/PokemonUI.cpp" line="950"/>
<location filename="../src/GCUIs/PokemonUI.cpp" line="952"/>
<source>Location caught (see &lt;a href=&apos;http://bulbapedia.bulbagarden.net/wiki/List_of_locations_by_index_number_(Generation_III)&apos;&gt;here&lt;/a&gt;)</source>
<translation>Fangort (Details &lt;a href=&apos;http://bulbapedia.bulbagarden.net/wiki/List_of_locations_by_index_number_(Generation_III)&apos;&gt;hier&lt;/a&gt;)</translation>
</message>
<message>
<location filename="../src/GCUIs/PokemonUI.cpp" line="952"/>
<location filename="../src/GCUIs/PokemonUI.cpp" line="954"/>
<source>Location caught (see &lt;a href=&apos;http://bulbapedia.bulbagarden.net/wiki/List_of_locations_by_index_number_(GCN)&apos;&gt;here&lt;/a&gt;)</source>
<translation>Fangort (Details &lt;a href=&apos;http://bulbapedia.bulbagarden.net/wiki/List_of_locations_by_index_number_(GCN)&apos;&gt;hier&lt;/a&gt;)</translation>
</message>
<message>
<location filename="../src/GCUIs/PokemonUI.cpp" line="957"/>
<location filename="../src/GCUIs/PokemonUI.cpp" line="959"/>
<source>Warning</source>
<translation>Warnung</translation>
</message>
<message>
<location filename="../src/GCUIs/PokemonUI.cpp" line="957"/>
<location filename="../src/GCUIs/PokemonUI.cpp" line="959"/>
<source>The version info you specified is invalid. The game will therefore consider this Pokémon invalid.</source>
<translation>Die angegebene Spielversion ist nicht gültig. Das Spiel wird dieses Pokémon daher für ungültig halten.</translation>
</message>

View File

@ -883,17 +883,17 @@ Pokémon caught in XD always have this field checked</translation>
<translation>Ribbons</translation>
</message>
<message>
<location filename="../src/GCUIs/PokemonUI.cpp" line="688"/>
<location filename="../src/GCUIs/PokemonUI.cpp" line="690"/>
<source>Genderless</source>
<translation>Genderless</translation>
</message>
<message>
<location filename="../src/GCUIs/PokemonUI.cpp" line="704"/>
<location filename="../src/GCUIs/PokemonUI.cpp" line="706"/>
<source>Unown form: </source>
<translation>Unown form: </translation>
</message>
<message>
<location filename="../src/GCUIs/PokemonUI.cpp" line="709"/>
<location filename="../src/GCUIs/PokemonUI.cpp" line="711"/>
<source>will evolve into: </source>
<translation>will evolve into: </translation>
</message>
@ -908,22 +908,22 @@ Pokémon caught in XD always have this field checked</translation>
<translation>&quot;Invalid Pokémon&quot; flag set</translation>
</message>
<message>
<location filename="../src/GCUIs/PokemonUI.cpp" line="950"/>
<location filename="../src/GCUIs/PokemonUI.cpp" line="952"/>
<source>Location caught (see &lt;a href=&apos;http://bulbapedia.bulbagarden.net/wiki/List_of_locations_by_index_number_(Generation_III)&apos;&gt;here&lt;/a&gt;)</source>
<translation>Location caught (see &lt;a href=&apos;http://bulbapedia.bulbagarden.net/wiki/List_of_locations_by_index_number_(Generation_III)&apos;&gt;here&lt;/a&gt;)</translation>
</message>
<message>
<location filename="../src/GCUIs/PokemonUI.cpp" line="952"/>
<location filename="../src/GCUIs/PokemonUI.cpp" line="954"/>
<source>Location caught (see &lt;a href=&apos;http://bulbapedia.bulbagarden.net/wiki/List_of_locations_by_index_number_(GCN)&apos;&gt;here&lt;/a&gt;)</source>
<translation>Location caught (see &lt;a href=&apos;http://bulbapedia.bulbagarden.net/wiki/List_of_locations_by_index_number_(GCN)&apos;&gt;here&lt;/a&gt;)</translation>
</message>
<message>
<location filename="../src/GCUIs/PokemonUI.cpp" line="957"/>
<location filename="../src/GCUIs/PokemonUI.cpp" line="959"/>
<source>Warning</source>
<translation>Warning</translation>
</message>
<message>
<location filename="../src/GCUIs/PokemonUI.cpp" line="957"/>
<location filename="../src/GCUIs/PokemonUI.cpp" line="959"/>
<source>The version info you specified is invalid. The game will therefore consider this Pokémon invalid.</source>
<translation>The version info you specified is invalid. The game will therefore consider this Pokémon invalid.</translation>
</message>

View File

@ -883,17 +883,17 @@ Les Pokémon attrapés dans XD ont toujours cette case cochée</translation>
<translation>Rubans</translation>
</message>
<message>
<location filename="../src/GCUIs/PokemonUI.cpp" line="688"/>
<location filename="../src/GCUIs/PokemonUI.cpp" line="690"/>
<source>Genderless</source>
<translation>Asexué</translation>
</message>
<message>
<location filename="../src/GCUIs/PokemonUI.cpp" line="704"/>
<location filename="../src/GCUIs/PokemonUI.cpp" line="706"/>
<source>Unown form: </source>
<translation>Forme Zarbi : </translation>
</message>
<message>
<location filename="../src/GCUIs/PokemonUI.cpp" line="709"/>
<location filename="../src/GCUIs/PokemonUI.cpp" line="711"/>
<source>will evolve into: </source>
<translation>évoluera en : </translation>
</message>
@ -908,22 +908,22 @@ Les Pokémon attrapés dans XD ont toujours cette case cochée</translation>
<translation>Drapeau &quot;Pokémon invalide&quot; activé</translation>
</message>
<message>
<location filename="../src/GCUIs/PokemonUI.cpp" line="950"/>
<location filename="../src/GCUIs/PokemonUI.cpp" line="952"/>
<source>Location caught (see &lt;a href=&apos;http://bulbapedia.bulbagarden.net/wiki/List_of_locations_by_index_number_(Generation_III)&apos;&gt;here&lt;/a&gt;)</source>
<translation>Lieu de capture (cf. &lt;a href=&apos;http://bulbapedia.bulbagarden.net/wiki/List_of_locations_by_index_number_(Generation_III)&apos;&gt;Bulbapedia&lt;/a&gt;)</translation>
</message>
<message>
<location filename="../src/GCUIs/PokemonUI.cpp" line="952"/>
<location filename="../src/GCUIs/PokemonUI.cpp" line="954"/>
<source>Location caught (see &lt;a href=&apos;http://bulbapedia.bulbagarden.net/wiki/List_of_locations_by_index_number_(GCN)&apos;&gt;here&lt;/a&gt;)</source>
<translation>Lieu de capture (cf. &lt;a href=&apos;http://bulbapedia.bulbagarden.net/wiki/List_of_locations_by_index_number_(GCN)&apos;&gt;Bulbapedia&lt;/a&gt;)</translation>
</message>
<message>
<location filename="../src/GCUIs/PokemonUI.cpp" line="957"/>
<location filename="../src/GCUIs/PokemonUI.cpp" line="959"/>
<source>Warning</source>
<translation>Avertissement</translation>
</message>
<message>
<location filename="../src/GCUIs/PokemonUI.cpp" line="957"/>
<location filename="../src/GCUIs/PokemonUI.cpp" line="959"/>
<source>The version info you specified is invalid. The game will therefore consider this Pokémon invalid.</source>
<translation>Les informations sur la version du jeu que vous avez entrées sont invalides. Le jeu considérera de ce fait ce Pokémon invalide.</translation>
</message>