Homebrew [WIP] PHBank - Pokémon Homebrew Bank

VaiCorinthians

Well-Known Member
Member
Joined
Oct 7, 2014
Messages
461
Trophies
0
Age
39
Location
GB
XP
474
Country
Papua New Guinea
In current pokemon info, could show the nature and moves to distinguish a pokemon from another same?
 

Attachments

  • phbank.jpg
    phbank.jpg
    38.1 KB · Views: 268

supercarotte

Well-Known Member
Member
Joined
May 21, 2015
Messages
691
Trophies
0
Age
31
XP
960
Country
France

suloku

Well-Known Member
Member
Joined
Apr 28, 2008
Messages
883
Trophies
1
XP
883
Country
Latest github changes will allow to access ALL the data in the pk6 file, and Gocario already stated he wants to make some kind of full info view for pokemon in single selection mode.

The hard work for the bank is already done from my point of view, what "remains" are many many tweaks and enhancements, which well, will take hard work when grouped, and well, a graphical UI will be hard work too.
Maybe gocario has another perspective, I don't know how he'd want the final product to be, but if he wants to also replicate official bank filters, tables, etc... that'd take a fair amount of work too.
 

Gocario

GBAFail'd
OP
Member
Joined
Sep 5, 2015
Messages
640
Trophies
0
Location
Bourg Palette
XP
804
Country
France
In current pokemon info, could show the nature and moves to distinguish a pokemon from another same?
Supercarotte is right, it prompts IDs of moves.
I really want to implement a drawn top screen to display the informations.
Latest github changes will allow to access ALL the data in the pk6 file, and Gocario already stated he wants to make some kind of full info view for pokemon in single selection mode.

The hard work for the bank is already done from my point of view, what "remains" are many many tweaks and enhancements, which well, will take hard work when grouped, and well, a graphical UI will be hard work too.
Maybe gocario has another perspective, I don't know how he'd want the final product to be, but if he wants to also replicate official bank filters, tables, etc... that'd take a fair amount of work too.
I'm not sure the last commit works well. :D I added binaries as attachment for thoses who can make their own test.
Erf... filters... I have to think about it.
I really want to work on a decent top screen GUI.
I have to work on the romFS to use game ressources directly, but... there there.
And the Celebi... maybe? :3

Attachment: The binaries of next release, aka Wololo.
 

Attachments

  • PHBank.rar
    373.1 KB · Views: 116

Gocario

GBAFail'd
OP
Member
Joined
Sep 5, 2015
Messages
640
Trophies
0
Location
Bourg Palette
XP
804
Country
France
What's the exact problem?
When loading the game I got eggs (probably bad) in my PC.
I changed the order of function calls. I didn't get that problem again.
But I don't sure it works like it should.

Btw, I read your message, it was interesting. Ideas are good I am really loving them, but I don't know what answer! :c
 

suloku

Well-Known Member
Member
Joined
Apr 28, 2008
Messages
883
Trophies
1
XP
883
Country
When loading the game I got eggs (probably bad) in my PC.
I changed the order of function calls. I didn't get that problem again.
But I don't sure it works like it should.
I saw that commit, I'll check and see if I can find a reason why function call order produces that behaviour and if that really fixed it. I've become quite familiar with the pk6 structure from all the pokemon link testing.

Btw, I read your message, it was interesting. Ideas are good I am really loving them, but I don't know what answer! :c
As long as you like them, we'll work it out at some point, I'm glad you like it. I'm just finishing documenting how pokemon link data works. Well, I aactually finished, but I found strange behaviour with eggs and setting the majority of its data to FF, and I'd like to know if this is supposed to happen or what, but at a practical level it really doesn't matter.
 
Last edited by suloku,

suloku

Well-Known Member
Member
Joined
Apr 28, 2008
Messages
883
Trophies
1
XP
883
Country
Great news about sftdlin! I'd go for a whatever fixed space font that looks fine.

Also, I've been checking the source and noticed something in pokédex data: for pokemon X/Y there's extra pokédex data, it works like this:

If the pokemon is region VI, the owned flag is set.
If the pokemon is region < VI, the foreign flag is set.

The foreign flags are apparently stored here (taken from PKHex code):
Array.Copy(foreigndata, 0, sav, Main.SaveGame.PokeDex + 0x64C, 0x52);

But I think you are aware of this since you only update Dex for ORAS...

Also, why do you call this in movePkm?
if (!srcBanked && dstBanked && !isPkmEmpty(dst))
convertPkmTrainer(dst);

If I correctly understand, you are adding the trainer data when moving INTO the bank, convertPkmTrainer will do nothing since if the handler is 0x00 the save's trainer is OT, and if it is 0x01 the save's trainer name will be the same as notOT name.

I'm gonna try to reproduce the order problem with the eggs and see if I can find the reason why, it happened prior to this commit right?: https://github.com/gocario/PHBank/commit/22fde0deeb21b4add9a82b7c1eaec5252a3a142e

EDIT:

I forgot to mention the following: I think pokemon data should only be modified prior to writing. This can be done in the following way:

- Rename ismodified to ismoved
- When the pokemon is moved from save to bank or viceversa toogle the ismoved bool.
- Prior to saving, iterate trough all pokemon slots in savegame and if the ismoved bool is set to 1, update trainer information, then add the pokedex entries.

This way pokemon that were in the bank at boot, were moved to save, then returned to bank in the same session remain untouched.

Reason why this should be done: say someone trades me a pokemon to my Y game and I teach it "return" (a move which attack's power is based on friendship) and max its friendship. Then I store it in bank. If by any mistake I enter the bank with my OR, then move it to OR boxes, notice that and return it to the bank, trainer information will already be that of OR (also, OR would have the pokedex entry for that pokemon even if I didn't want to transfer it to OR).
Same could be said for affection/friendship based evolutions.

Also, this is what official bank does. In fact official bank rewrittes all boxes (and updates pokedex entries) even if no modifications are made (if you save, of course)
 
Last edited by suloku,

Gocario

GBAFail'd
OP
Member
Joined
Sep 5, 2015
Messages
640
Trophies
0
Location
Bourg Palette
XP
804
Country
France
Great news about sftdlin! I'd go for a whatever fixed space font that looks fine.

Also, I've been checking the source and noticed something in pokédex data: for pokemon X/Y there's extra pokédex data, it works like this:

If the pokemon is region VI, the owned flag is set.
If the pokemon is region < VI, the foreign flag is set.

The foreign flags are apparently stored here (taken from PKHex code):
Array.Copy(foreigndata, 0, sav, Main.SaveGame.PokeDex + 0x64C, 0x52);

But I think you are aware of this since you only update Dex for ORAS...

Also, why do you call this in movePkm?
if (!srcBanked && dstBanked && !isPkmEmpty(dst))
convertPkmTrainer(dst);

If I correctly understand, you are adding the trainer data when moving INTO the bank, convertPkmTrainer will do nothing since if the handler is 0x00 the save's trainer is OT, and if it is 0x01 the save's trainer name will be the same as notOT name.

I'm gonna try to reproduce the order problem with the eggs and see if I can find the reason why, it happened prior to this commit right?: https://github.com/gocario/PHBank/commit/22fde0deeb21b4add9a82b7c1eaec5252a3a142e

EDIT:

I forgot to mention the following: I think pokemon data should only be modified prior to writing. This can be done in the following way:

- Rename ismodified to ismoved
- When the pokemon is moved from save to bank or viceversa toogle the ismoved bool.
- Prior to saving, iterate trough all pokemon slots in savegame and if the ismoved bool is set to 1, update trainer information, then add the pokedex entries.

This way pokemon that were in the bank at boot, were moved to save, then returned to bank in the same session remain untouched.

Reason why this should be done: say someone trades me a pokemon to my Y game and I teach it "return" (a move which attack's power is based on friendship) and max its friendship. Then I store it in bank. If by any mistake I enter the bank with my OR, then move it to OR boxes, notice that and return it to the bank, trainer information will already be that of OR (also, OR would have the pokedex entry for that pokemon even if I didn't want to transfer it to OR).
Same could be said for affection/friendship based evolutions.

Also, this is what official bank does. In fact official bank rewrittes all boxes (and updates pokedex entries) even if no modifications are made (if you save, of course)

X/Y is strange!
I'm not gonna work on XY-dex now.

I don't know, it seemed good once modified. D:

Your edit: You're right, I'll change it!
 
Last edited by Gocario,

suloku

Well-Known Member
Member
Joined
Apr 28, 2008
Messages
883
Trophies
1
XP
883
Country
X/Y is strange!
I'm not gonna work on XY-dex now.
OK, didn't know it had different structure.

Also, what about that function call?
Code:
    if (srcBanked && !dstBanked && !isPkmEmpty(src))
        convertPkmTrainer(src);
    if (!srcBanked && dstBanked && !isPkmEmpty(dst)) //<-- This one
        convertPkmTrainer(dst);
 
  • Like
Reactions: Margen67

Gocario

GBAFail'd
OP
Member
Joined
Sep 5, 2015
Messages
640
Trophies
0
Location
Bourg Palette
XP
804
Country
France
OK, didn't know it had different structure.

Also, what about that function call?
Code:
    if (srcBanked && !dstBanked && !isPkmEmpty(src))
        convertPkmTrainer(src);
    if (!srcBanked && dstBanked && !isPkmEmpty(dst)) //<-- This one
        convertPkmTrainer(dst);

I had firstly the idea that when moved, the src and dst are always pointing to their previous pkm_t.
I don't know, it seemed good once modified. D:

I changed it, but I want to keep the isModified boolean, it could be useful, maybe.

I did this small changes:
Code:
typedef struct pkm_t
{
    ek6_t* ek6 = NULL; // Pointer to MainBuffer
    pk6_t* pk6 = NULL; // Pointer to OwnBuffer
    bool moved : 1;
    bool modified : 1;
    unsigned : 0;
 
    u8* species;
    u8* item;
    bool isShiny;
    u16 speciesID;
    u16 itemID;
    // T O D O !!

    pkm_t() : moved {false}, modified {false} {}
} pkm_t;
Code:
void PKBank::movePkm(pkm_t* src, pkm_t* dst)
{
    pkm_t tmp;
    tmp.pk6 = dst->pk6;
    dst->pk6 = src->pk6;
    src->pk6 = tmp.pk6;

    src->moved = true;
    dst->moved = true;

    loadPkmPk6(src);
    loadPkmPk6(dst);
}
Code:
void PKBank::savePkmPk6(pkm_t* pkm)
{
    if (!pkm || !pkm->pk6) return;

    if (pkm->moved)
    {
        convertPkmTrainer(pkm);
        Pokemon::computeChecksum(pkm);
    }
}
 
  • Like
Reactions: Margen67

Gocario

GBAFail'd
OP
Member
Joined
Sep 5, 2015
Messages
640
Trophies
0
Location
Bourg Palette
XP
804
Country
France
What do you think about that:
51324b6c86.png

I have only the PC webcam, since I am at school... :c

EDIT: For the next post, I think the isPkmEmpty shall be after the data reloading.
Code:
void PKBank::movePkm(pkm_t* src, pkm_t* dst)
{
    pkm_t tmp;
    tmp.pk6 = dst->pk6;
    dst->pk6 = src->pk6;
    src->pk6 = tmp.pk6;

    loadPkmPk6(src);
    loadPkmPk6(dst);
   
    if (!isPkmEmpty(src))
        src->moved = true;
    if (!isPkmEmpty(dst))
        dst->moved = true;
}
 
Last edited by Gocario,
  • Like
Reactions: Margen67

suloku

Well-Known Member
Member
Joined
Apr 28, 2008
Messages
883
Trophies
1
XP
883
Country
@Gocario great!

Btw, the bad eggs problems was due to setting notOT trainer information to an empty pokemon slot, I've just confirmed that theory.
You solved it without noticing when you fixed the empty slots bug by adding an empty slot check.

But I think you just reintroduced it, since you are tagging empty slots as moved, so notOT trainer data will be written to them.

I suggest this:
Code:
voidPKBank::movePkm(pkm_t* src,pkm_t* dst){
   pkm_t tmp;
   tmp.pk6 = dst->pk6;
   dst->pk6 = src->pk6;
   src->pk6 = tmp.pk6;

   if(!isPkmEmpty(src))
      src->moved =true;
   if(!isPkmEmpty(dst))
      dst->moved =true;

      loadPkmPk6(src);
      loadPkmPk6(dst);
}

It's funny though, pkHex does more checks than the actual game since it correctly detects those bad eggs as empty slots.

EDIT: about picture: looking great! Are you asking about the font used though? Is that pokemon GB font?

BTW, did you just introduce a db for all species base stats to calculate the pokemon stats?
 
Last edited by suloku,
  • Like
Reactions: Margen67

Gocario

GBAFail'd
OP
Member
Joined
Sep 5, 2015
Messages
640
Trophies
0
Location
Bourg Palette
XP
804
Country
France
EDIT: about picture: looking great! Are you asking about the font used though? Is that pokemon GB font?

BTW, did you just introduce a db for all species base stats to calculate the pokemon stats?

I use the Pokemon GB font sent by @Baoulettes.
I use it like this:
Code:
sftd_draw_text(font, x+1, y+1, RGBA8(0x00, 0x00, 0x00, 0xFF), 8, buffer);
sftd_draw_text(font, x, y, RGBA8(0xFF, 0xFF, 0xFF, 0xFF), 8, buffer);
A shadow is drawn black with a shift of 1px bot, and 1px right.
The text is drawn white on the shadow.

I'll implement another function to use multiple colored text/shadow.

Infact... The screenshot is showing static variables.
But the program could read some text data:
Code:
        static uint8_t* abilities(uint32_t ability);
        static uint8_t* items(uint32_t item);
        static uint8_t* moves(uint32_t move);
        static uint8_t* natures(uint32_t nature);
        static uint8_t* species(uint32_t species);

PS: I edited the previous post.
 
  • Like
Reactions: Margen67

suloku

Well-Known Member
Member
Joined
Apr 28, 2008
Messages
883
Trophies
1
XP
883
Country
I don't know how to place things...
f9891f6319.png
This looks like the status screen on XY, what's the problem?
Put the pokemon sprite next to species for example.

Additional information should go in a separate page, but maybe the upper right part of the screen could hold some useful but hiddne information, like TID/SID, current handler friendship, affection, fullness, type of pokeball it is in (I guess this could be shown with the pokeball icon, but the actual name in an extended info page would be great, I don't identify all pokeball icons).

Most people would want IV and EV to be shown right away, that could go next to each stat:
Code:
STAT    Value     IV     EV
______________________
HP        150       27    235
Attack...
Hidden power is also useful(I think it depends on IV)?

Also markings, blue pentagon, pokerus status, shiny star... (but I guess you already plan for that.

Contest stats could go at a different page with ribbons.

Unless you are saving that space to show a full pokemon image (I don't think that's necessary, but if you can load it from romfs...but XY/ORAS use 3d models...)
 
  • Like
Reactions: Margen67

Gocario

GBAFail'd
OP
Member
Joined
Sep 5, 2015
Messages
640
Trophies
0
Location
Bourg Palette
XP
804
Country
France
I'll display the Pokémon icon sprite in the right if I add an image.
Even the Pokébank isn't loading the Pokémon real sprite, to not render the 3d model.
I would prefer the current trainer data over the sprite, since you can use the bottom screen for that.

Hidden powers are like that: http://bulbapedia.bulbagarden.net/wiki/Hidden_Power_(move)/Calculation#Type_2

Are people really doing contest storage?!

------

Guys, I need your help.
I am looking for someone, who can take good in-game screenshot.
I need this screen:
img_1069-e1429895148823.jpg

It'll be even better if the Pokémon has the shiny icon, kalos born, and pokérus cured.
Thanks!
 
  • Like
Reactions: Margen67

Site & Scene News

Popular threads in this forum

General chit-chat
Help Users
  • Xdqwerty @ Xdqwerty:
    or something
  • K3Nv2 @ K3Nv2:
    At least send one active gift card and make the rest bs
  • K3Nv2 @ K3Nv2:
    I use to Google scratched off gift card images and send them to scammer it's funny
    +2
  • BigOnYa @ BigOnYa:
    I give a Nieghbor couple years ago a Xmas card w a $25 McDonald's gift card, and this past Xmas they give us a Xmas card w that same gift card inside, I know it was the same card, cause they name was on it, but scratched out. Guess they don't like McDonald's. Lol
  • K3Nv2 @ K3Nv2:
    They used half and gave it back
    +2
  • Xdqwerty @ Xdqwerty:
    @BigOnYa, I had an idea for a thread on the retro games forum about old games and crt/scanlines filters and stuff but idk how to express the body text or idk
    +1
  • Xdqwerty @ Xdqwerty:
    dunno if you undestand what I mean
  • BigOnYa @ BigOnYa:
    The Simpson's already did that...
  • K3Nv2 @ K3Nv2:
    I have an idea for a new lord of the rings series
  • BigOnYa @ BigOnYa:
    Simpson's did it...
  • K3Nv2 @ K3Nv2:
    Elon as frodo
    +1
  • BigOnYa @ BigOnYa:
    The Twitter/X hat determines your fate. (oh wait, wrong movie)
  • K3Nv2 @ K3Nv2:
    You must never wear the blue check mark
    +1
  • BigOnYa @ BigOnYa:
    I wonder how many Broncos fans cellphones Kelsy's brother will smash today.
  • DragonMals @ DragonMals:
    he's
  • Faust03 @ Faust03:
    twitter is a very toxic website
  • K3Nv2 @ K3Nv2:
    Nuh uh
  • DragonMals @ DragonMals:
    An underrated opinion: While Bluesky as a platform is better than Twitter, Bluesky's userbase won't be better than Twitter as people are saying because everyone from the non-bootleg site are moving to the bootleg one expecting for themselves to change with their attitude, but that never works like that.
  • DragonMals @ DragonMals:
    I will say though: Bluesky as a micro-blogging site? Needs a bit more oomph and I would officially like it better than Twiter. Can't even post gifs on that site, like what the fuck?
  • K3Nv2 @ K3Nv2:
    Diarrhea is toxic
  • BigOnYa @ BigOnYa:
    Can you post milfs though?
  • K3Nv2 @ K3Nv2:
    Gilfs
    +2
    K3Nv2 @ K3Nv2: Gilfs +2