Skip to content

Commit

Permalink
Merge branch 'master' of https://github.com/Universal-Team/pkmn-chest
Browse files Browse the repository at this point in the history
…into Universal-Team-master
  • Loading branch information
SNBeast committed May 30, 2022
2 parents 106ee5e + 52765cc commit 3eedbbf
Show file tree
Hide file tree
Showing 32 changed files with 631 additions and 223 deletions.
17 changes: 12 additions & 5 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,8 @@ on:

jobs:
build:
runs-on: ubuntu-latest
container: devkitpro/devkitarm
name: Build with Docker using devkitARM
runs-on: macos-latest
name: Build pkmn-chest
outputs:
commit_tag: ${{ steps.build.outputs.commit_tag }}
commit_hash: ${{ steps.build.outputs.commit_hash }}
Expand All @@ -31,15 +30,23 @@ jobs:
submodules: recursive
- name: Install tools
run: |
curl -L https://github.com/Universal-Team/bmp2ds/releases/download/v1.0.0/bmp2ds-linux -o bmp2ds
curl -L https://github.com/Universal-Team/bmp2ds/releases/download/v1.0.0/bmp2ds-macos -o bmp2ds
chmod +x bmp2ds
mv bmp2ds /usr/local/bin
curl -LO https://github.com/devkitPro/pacman/releases/latest/download/devkitpro-pacman-installer.pkg
sudo installer -pkg devkitpro-pacman-installer.pkg -target /
sudo dkp-pacman -Sy
sudo dkp-pacman -S nds-dev --noconfirm
- name: Build
id: build
run: |
export DEVKITPRO=/opt/devkitpro
export DEVKITARM=$DEVKITPRO/devkitARM
make all dsi
sudo mv tools-linux/make_cia /usr/local/bin
sudo mv tools-osx/make_cia /usr/local/bin
make cia
mkdir -p ~/artifacts
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ arm9/$(TARGET).elf:
$(TARGET).nds : graphics sound lang $(NITRO_FILES) arm9/$(TARGET).elf
ndstool -c $(TARGET).nds -9 arm9/$(TARGET).elf \
-b1 icon.bmp "$(GAME_TITLE);$(GAME_SUBTITLE1)" $(_ADDFILES) \
-g \#\#\#\# 00 "HOMEBREW" 87 -z 80040000 -u 00030004 -a 00000138
-g \#\#\#\# 00 "HOMEBREW" 87 -z 80040000 -a 00000138

#---------------------------------------------------------------------------------
$(TARGET).dsi : arm9/$(TARGET).elf
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ If you'd like to help translate pkmn-chest to a language that isn't yet supporte
- [Pk11](https://github.com/Epicpkmn11): Main developer
### Translators
- [antoine62](https://github.com/antoine62): French
- [Chips](https://github.com/Ch1p5): Portuguese, some Spanish and French
- [5antos](https://github.com/5antos): Portuguese, some Spanish and French
- [cimo95](https://github.com/cimo95): Indonesian
- [David Pires](https://github.com/DavidPires): Portuguese
- [edo9300](https://github.com/edo9300): Italian
Expand Down
2 changes: 1 addition & 1 deletion arm9/include/PKSMCORE_CONFIG.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@
#define _PKSMCORE_GETLINE_FUNC __getline
#define _PKSMCORE_DISABLE_THREAD_SAFETY

#define _PKSMCORE_EXTRA_LANGUAGES BRH, IND, LIT, POL, POR, RUS, HUN
#define _PKSMCORE_EXTRA_LANGUAGES BRH, IND, LIT, POL, POR, RUS, HUN, RON, TUR

#endif
2 changes: 1 addition & 1 deletion arm9/source/graphics/graphics.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ void loadFont() {
fclose(file);
}

questionMark = getCharIndex('?');
questionMark = getCharIndex(u'');
}

Image loadImage(const std::string &path) {
Expand Down
2 changes: 1 addition & 1 deletion arm9/source/loading.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ void loadLoadingLogo(void) {
logo = loadImage("/graphics/icon.gfx");

extern bool useTwlCfg;
extern u8* twlCfgAddr;
extern u8 *twlCfgAddr;
int birthMonth = (useTwlCfg ? twlCfgAddr[0x46] : PersonalData->birthMonth);
int birthDay = (useTwlCfg ? twlCfgAddr[0x47] : PersonalData->birthDay);
Date today = Date::today();
Expand Down
17 changes: 8 additions & 9 deletions arm9/source/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,20 +17,19 @@

#include <fat.h>

bool useTwlCfg = false;
u32* twlCfgPointer = (u32*)0x02FFFDFC;
u8* twlCfgAddr = (u8*)0;
bool useTwlCfg = false;
u32 *twlCfgPointer = (u32 *)0x02FFFDFC;
u8 *twlCfgAddr = (u8 *)0;

extern std::vector<std::string> songs;

void init(int argc, char **argv) {
if (dsiFeatures()) {
if (*twlCfgPointer < 0x02000000 || *twlCfgPointer >= 0x03000000) {
if(dsiFeatures()) {
if(*twlCfgPointer < 0x02000000 || *twlCfgPointer >= 0x03000000) {
*twlCfgPointer = 0x02000400;
}
twlCfgAddr = (u8*)*twlCfgPointer;
useTwlCfg = ((twlCfgAddr[0] & 0x0F) && (twlCfgAddr[1] == 0) && (twlCfgAddr[2] == 0) &&
(twlCfgAddr[4] == 0));
twlCfgAddr = (u8 *)*twlCfgPointer;
useTwlCfg = ((twlCfgAddr[0] != 0) && (twlCfgAddr[1] == 0) && (twlCfgAddr[2] == 0) && (twlCfgAddr[4] == 0));
}
initGraphics();
keysSetRepeat(25, 5);
Expand Down Expand Up @@ -152,7 +151,7 @@ int main(int argc, char **argv) {
if(!loadSave(argv[i])) {
continue;
}
foundInArgv = true;
foundInArgv = true;
currentSaveBox = save->currentBox();
currentBankBox = 0;
// Decrypt the box data
Expand Down
7 changes: 3 additions & 4 deletions arm9/source/menus/aMenu.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -480,12 +480,11 @@ int aMenu(int pkmX, int pkmY, std::vector<Label> &buttons, int buttonMode) {
u8 buffer[size];
fread(buffer, 1, sizeof(buffer), in);
if(topScreen)
Banks::bank->pkm(
*save->emptyPkm()->getPKM(gen, buffer, size), currentBankBox, pkmPos(pkmX, pkmY));
Banks::bank->pkm(*pksm::PKX::getPKM(gen, buffer, size), currentBankBox, pkmPos(pkmX, pkmY));
else if(inParty)
save->pkm(*save->transfer(*save->emptyPkm()->getPKM(gen, buffer, size)), pkmPos(pkmX, pkmY));
save->pkm(*save->transfer(*pksm::PKX::getPKM(gen, buffer, size)), pkmPos(pkmX, pkmY));
else
save->pkm(*save->transfer(*save->emptyPkm()->getPKM(gen, buffer, size)),
save->pkm(*save->transfer(*pksm::PKX::getPKM(gen, buffer, size)),
currentSaveBox,
pkmPos(pkmX, pkmY),
false);
Expand Down
16 changes: 10 additions & 6 deletions arm9/source/menus/configMenu.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@

#define getChestFile() (Config::getString("chestFile") == "" ? "pkmn-chest_1" : Config::getString("chestFile"))

std::vector<Label> textCP1Labels{
std::vector<Label> textCP1Labels = {
{4, 16, "chestFile"}, // Chest file
{4, 32, "chestSize"}, // Chest size
{4, 48, "language"}, // Language
Expand All @@ -30,7 +30,7 @@ std::vector<Label> textCP1Labels{
{4, 144, "theme"}, // Theme
};

std::vector<Label> textChestFile{
std::vector<Label> textChestFile = {
{12, 32, "new"}, // New
{12, 48, "rename"}, // Rename
{12, 64, "delete"}, // Delete
Expand All @@ -42,33 +42,37 @@ std::vector<std::string> songs = {

std::vector<std::string> optionsText;

const std::vector<std::string> langNames = {"Bruh",
const std::vector<std::string> langNames = {"Bahasa Indonesia",
"Bruh",
"Deutsch",
"English",
"Español",
"Français",
"Bahasa Indonesia",
"Italiano",
"Lietuvių",
"Magyar",
"Polski",
"Português",
"Română",
"Türkçe",
"Русский",
"中文 (简体)",
"中文 (繁體)",
"日本語",
"한국어"};
const std::vector<pksm::Language> guiLangs = {pksm::Language::BRH,
const std::vector<pksm::Language> guiLangs = {pksm::Language::IND,
pksm::Language::BRH,
pksm::Language::GER,
pksm::Language::ENG,
pksm::Language::SPA,
pksm::Language::FRE,
pksm::Language::IND,
pksm::Language::ITA,
pksm::Language::LIT,
pksm::Language::HUN,
pksm::Language::POL,
pksm::Language::POR,
pksm::Language::RON,
pksm::Language::TUR,
pksm::Language::RUS,
pksm::Language::CHS,
pksm::Language::CHT,
Expand Down
4 changes: 2 additions & 2 deletions arm9/source/menus/filter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -101,8 +101,8 @@ void selectMoves(std::shared_ptr<pksm::PKFilter> filter) {
} else if(column == 1) {
filter->move(selection,
selectItem(filter->move(selection),
save->availableMoves(),
i18n::rawMoves(Config::getLang("lang"))));
save->availableMoves(),
i18n::rawMoves(Config::getLang("lang"))));
} else if(column == 2) {
filter->moveInversed(selection, !filter->moveInversed(selection));
}
Expand Down
75 changes: 60 additions & 15 deletions arm9/source/menus/misc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,11 @@ struct Text {
};

std::vector<std::string> statsLabels = {
"hp", "attack", "defense", "spAtk", "spDef", "speed", "base", "iv", "ev", "total"};
"hp", "attack", "defense", "spAtk", "spDef", "speed", "base", "iv", "ev", "total"
};
std::vector<std::string> originLabels = {
"metLevel", "metYear", "metMonth", "metDay", "metLocation", "originGame", "fatefulEncounter"};
"metLevel", "metYear", "metMonth", "metDay", "metLocation", "originGame", "fatefulEncounter", "egg"
};

static constexpr pksm::Stat statOrder[] = {
pksm::Stat::HP, pksm::Stat::ATK, pksm::Stat::DEF, pksm::Stat::SPATK, pksm::Stat::SPDEF, pksm::Stat::SPD};
Expand Down Expand Up @@ -356,10 +358,17 @@ void selectMoves(pksm::PKX &pkm) {
drawImageDMA(0, 0, listBg, false, false);
drawRectangle(0, 0, 256, 192, CLEAR, false, true);
printText(i18n::localize(Config::getLang("lang"), "moves"), 4, 0, false, true);
printText(i18n::localize(Config::getLang("lang"), "pp"), 100, 0, false, true);
printText(i18n::localize(Config::getLang("lang"), "ppUps"), 152, 0, false, true);
printText(i18n::localize(Config::getLang("lang"), "ppMax"), 204, 0, false, true);

// Print moves
for(int i = 0; i < 4; i++) {
printText(i18n::move(Config::getLang("lang"), pkm.move(i)), 4, 16 + (i * 16), false, true);

printText(std::to_string(pkm.PP(i)), 100, 16 + (i * 16), false, true);
printText(std::to_string(pkm.PPUp(i)), 152, 16 + (i * 16), false, true);
printText(std::to_string(pkm.maxPP(i)), 204, 16 + (i * 16), false, true);
}

// Set arrow position
Expand All @@ -368,7 +377,7 @@ void selectMoves(pksm::PKX &pkm) {
updateOam();

bool optionSelected = false;
int held, pressed, selection = 0;
int held, pressed, selection = 0, column = 0;
touchPosition touch;
while(1) {
do {
Expand All @@ -385,9 +394,11 @@ void selectMoves(pksm::PKX &pkm) {
if(selection < 3)
selection++;
} else if(held & KEY_LEFT) {
selection = 0;
if(column > 0)
column--;
} else if(held & KEY_RIGHT) {
selection = 3;
if(column < 2)
column++;
} else if(pressed & KEY_A) {
Sound::play(Sound::click);
optionSelected = true;
Expand All @@ -398,8 +409,8 @@ void selectMoves(pksm::PKX &pkm) {
} else if(pressed & KEY_TOUCH) {
touchRead(&touch);
for(unsigned i = 0; i < 4; i++) {
if(touch.px >= 4 && touch.px <= 4 + getTextWidth(i18n::move(Config::getLang("lang"), pkm.move(i))) &&
touch.py >= 16 + (i * 16) && touch.py <= 16 + ((i + 1) * 16)) {
if(touch.py >= 16 + (i * 16) && touch.py <= 16 + ((i + 1) * 16)) {
column = touch.px < 100 ? 0 : (touch.px < 152 ? 1 : 2);
selection = i;
optionSelected = true;
break;
Expand All @@ -409,25 +420,51 @@ void selectMoves(pksm::PKX &pkm) {

if(optionSelected) {
optionSelected = false;
pkm.move(
selection,
selectItem(pkm.move(selection), save->availableMoves(), i18n::rawMoves(Config::getLang("lang"))));

if(column == 0) {
pkm.move(
selection,
selectItem(pkm.move(selection), save->availableMoves(), i18n::rawMoves(Config::getLang("lang"))));
} else if(column == 1) {
int i = Input::getInt(pkm.maxPP(selection));
if(i != -1)
pkm.PP(selection, i);
} else if(column == 2) {
int i = Input::getInt(3);
if(i != -1)
pkm.PPUp(selection, i);
}

// Clear screen
drawImageDMA(0, 0, listBg, false, false);
drawRectangle(0, 0, 256, 192, CLEAR, false, true);
printText(i18n::localize(Config::getLang("lang"), "moves"), 4, 0, false, true);
printText(i18n::localize(Config::getLang("lang"), "pp"), 100, 0, false, true);
printText(i18n::localize(Config::getLang("lang"), "ppUps"), 152, 0, false, true);
printText(i18n::localize(Config::getLang("lang"), "ppMax"), 204, 0, false, true);

// Print moves
for(int i = 0; i < 4; i++) {
printText(i18n::move(Config::getLang("lang"), pkm.move(i)), 4, 16 + (i * 16), false, true);

printText(std::to_string(pkm.PP(i)), 100, 16 + (i * 16), false, true);
printText(std::to_string(pkm.PPUp(i)), 152, 16 + (i * 16), false, true);
printText(std::to_string(pkm.maxPP(i)), 204, 16 + (i * 16), false, true);
}
}

setSpritePosition(arrowID,
false,
4 + getTextWidth(i18n::move(Config::getLang("lang"), pkm.move(selection))),
(selection * 16) + 10);
if(column == 0) {
setSpritePosition(arrowID,
false,
4 + getTextWidth(i18n::move(Config::getLang("lang"), pkm.move(selection))),
(selection * 16) + 10);
} else if(column == 1) {
setSpritePosition(
arrowID, false, 100 + getTextWidth(std::to_string(pkm.PP(selection))), (selection * 16) + 10);
} else if(column == 2) {
setSpritePosition(
arrowID, false, 152 + getTextWidth(std::to_string(pkm.PPUp(selection))), (selection * 16) + 10);
}
updateOam();
}
}
Expand Down Expand Up @@ -799,6 +836,7 @@ void drawOriginPage(const pksm::PKX &pkm, std::vector<std::string> &varText) {
i18n::game(Config::getLang("lang"), pkm.version()),
pkm.fatefulEncounter() ? i18n::localize(Config::getLang("lang"), "yes")
: i18n::localize(Config::getLang("lang"), "no"),
pkm.egg() ? i18n::localize(Config::getLang("lang"), "yes") : i18n::localize(Config::getLang("lang"), "no"),
};
printText(i18n::localize(Config::getLang("lang"), "origin"), 4, 0, false, true);
for(unsigned i = 0; i < originLabels.size(); i++) {
Expand Down Expand Up @@ -844,7 +882,7 @@ void selectOrigin(pksm::PKX &pkm) {
touchPosition touch;
touchRead(&touch);
for(unsigned i = 0; i < originLabels.size(); i++) {
if(touch.py > 4 + (i * 20) && touch.py < 4 + (i + 1) * 20) {
if(touch.py > 16 + (i * 16) && touch.py < 16 + (i + 1) * 16) {
selection = i;
optionSelected = true;
}
Expand Down Expand Up @@ -894,6 +932,8 @@ void selectOrigin(pksm::PKX &pkm) {
metDate.day(30);
}

metDate.month(num);

pkm.metDate(metDate);
}
break;
Expand Down Expand Up @@ -958,6 +998,11 @@ void selectOrigin(pksm::PKX &pkm) {
}
case 6: { // Fateful encounter
pkm.fatefulEncounter(!pkm.fatefulEncounter());
break;
}
case 7: { // Egg
pkm.egg(!pkm.egg());
break;
}
}
drawOriginPage(pkm, varText);
Expand Down
6 changes: 2 additions & 4 deletions arm9/source/menus/summary.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -164,9 +164,7 @@ void drawSummaryPage(const pksm::PKX &pkm, bool background) {
drawRectangle(0, 0, 256, 192, 0, false, true);

// Print Pokémon name
// const std::string &name = pkm.nicknamed() ? pkm.nickname() : i18n::species(Config::getLang("lang"), pkm.species());
const std::string &name = pkm.nickname();
if(pkm.language() != Config::getLang("lang"))
const std::string &name = pkm.nickname() != "" ? pkm.nickname() : i18n::species(Config::getLang("lang"), pkm.species());
printTextTintedMaxW(name, 65, 1, (pkm.gender() ? (pkm.gender() == pksm::Gender::Female ? TextColor::red : TextColor::gray) : TextColor::blue), 165, 8, false, true);

// Draw/clear shiny star
Expand Down Expand Up @@ -496,7 +494,7 @@ const pksm::PKX &showPokemonSummary(pksm::PKX &pkm) {
textC1[selection].y - 6);
} else if(column == 2 && selection == 0) { // 1, 2, & 3 behave the same after selection 0
setSpritePosition(arrowID, false,
165 + getTextWidthMaxW(pkm.nickname(), 65),
165 + getTextWidthMaxW(pkm.nickname() != "" ? pkm.nickname() : i18n::species(Config::getLang("lang"), pkm.species()), 65),
2);
} else if(column == 3 && selection == 0) {
setSpritePosition(arrowID, false, 233 + 16, 2);
Expand Down
2 changes: 1 addition & 1 deletion arm9/source/utils/config.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ nlohmann::json configJson;

pksm::Language sysLang() {
extern bool useTwlCfg;
extern u8* twlCfgAddr;
extern u8 *twlCfgAddr;
switch(useTwlCfg ? twlCfgAddr[6] : PersonalData->language) {
case 0:
return pksm::Language::JPN;
Expand Down
Binary file modified nitrofiles/graphics/font.nftr
Binary file not shown.
Loading

0 comments on commit 3eedbbf

Please sign in to comment.