kbembedded / Flipper-Zero-Game-Boy-Pokemon-Trading

Pokemon trade from Flipper Zero to Game Boy for Generation I & II games (Pokemon Red, Blue, Yellow, Gold, Silver, and Crystal)
MIT License
316 stars 18 forks source link

Adjust Pokémon level before trade? #8

Closed LuxStatera closed 11 months ago

LuxStatera commented 1 year ago

I noticed all the traded Pokémon have maxed out levels. This is awesome but unfortunately makes them unusable if you are starting the game over again. Pokémon won't listen to you if their level is too high and you don't have enough badges. Is there a way to edit their level before trading them?

EstebanFuentealba commented 1 year ago

Yes, it is possible to edit all of the data for a Pokémon (level, attacks, names, etc.) by editing the "pokemon_data.h" file. I have provided the hexadecimal values for each data field that needs to be edited. Additionally, you can refer to https://bulbapedia.bulbagarden.net/wiki/Pok%C3%A9mon_data_structure_(Generation_I) for more information on the data structure. https://github.com/EstebanFuentealba/Flipper-Zero-Game-Boy-Pokemon-Trading/blob/04e0332ff4b2dbd448232238102774a38445c5ce/pokemon_data.h#L14-L20

For example, the default level for a Pokémon is 74. When converted to hexadecimal, it becomes 0x4A. This is where you can make changes and experiment.

You can use a decimal to hexadecimal converter like https://www.rapidtables.com/convert/number/decimal-to-hex.html to help you with the conversion.

EstebanFuentealba commented 1 year ago

To edit names you can refer to this dictionary.

https://github.com/EstebanFuentealba/Flipper-Zero-Game-Boy-Pokemon-Trading/blob/04e0332ff4b2dbd448232238102774a38445c5ce/pokemon_data.h#L9-L10

' ' = "0x7F",
'A' = "0x80",
'B' = "0x81",
'C' = "0x82",
'D' = "0x83",
'E' = "0x84",
'F' = "0x85",
'G' = "0x86",
'H' = "0x87",
'I' = "0x88",
'J' = "0x89",
'K' = "0x8A",
'L' = "0x8B",
'M' = "0x8C",
'N' = "0x8D",
'O' = "0x8E",
'P' = "0x8F",
'Q' = "0x90",
'R' = "0x91",
'S' = "0x92",
'T' = "0x93",
'U' = "0x94",
'V' = "0x95",
'W' = "0x96",
'X' = "0x97",
'Y' = "0x98",
'Z' = "0x99",
'a' = "0xA0",
'b' = "0xA1",
'c' = "0xA2",
'd' = "0xA3",
'e' = "0xA4",
'f' = "0xA5",
'g' = "0xA6",
'h' = "0xA7",
'i' = "0xA8",
'j' = "0xA9",
'k' = "0xAA",
'l' = "0xAB",
'm' = "0xAC",
'n' = "0xAD",
'o' = "0xAE",
'p' = "0xAF",
'q' = "0xB0",
'r' = "0xB1",
's' = "0xB2",
't' = "0xB3",
'u' = "0xB4",
'v' = "0xB5",
'w' = "0xB6",
'x' = "0xB7",
'y' = "0xB8",
'z' = "0xB9",
'-' = "0xE3",
'?' = "0xE6",
'!' = "0xE7",
'.' = "0xE8",
',' = "0xF4",
'0' = "0xF6",
'1' = "0xF7",
'2' = "0xF8",
'3' = "0xF9",
'4' = "0xFA",
'5' = "0xFB",
'6' = "0xFC",
'7' = "0xFD",
'8' = "0xFE",
'9' = "0xFF"
EstebanFuentealba commented 1 year ago

You can use this dictionaries as a reference.

Type

"Normal" = "0x00",
"Fighting" = "0x01",
"Flying" = "0x02",
"Poison" = "0x03",
"Ground" = "0x04",
"Rock" = "0x05",
"Bug" = "0x07",
"Ghost" = "0x08",
"Fire" = "0x14",
"Water" = "0x15",
"Grass" = "0x16",
"Electric" = "0x17",
"Psychic" = "0x18",
"Ice" = "0x19",
"Dragon" = "0x1A"

Status

"None" = "0x00",
"Asleep" = "0x04",
"Poisoned" = "0x08",
"Burned" = "0x10",
"Frozen" = "0x20",
"Paralyzed" = "0x40"

Moves

"Nothing" = "0x00",
"Pound" = "0x01",
"Karate Chop" = "0x02",
"Double Slap" = "0x03",
"Comet Punch" = "0x04",
"Mega Punch" = "0x05",
"Pay Day" = "0x06",
"Fire Punch" = "0x07",
"Ice Punch" = "0x08",
"Thunder Punch " = "0x09",
"Gust" = "0x10",
"Wing Attack" = "0x11",
"Whirlwind" = "0x12",
"Fly" = "0x13",
"Bind" = "0x14",
"Slam" = "0x15",
"Vine Whip" = "0x16",
"Stomp" = "0x17",
"Double Kick" = "0x18",
"Mega KIck" = "0x19",
"Jump KIck" = "0x1A",
"RollingKick" = "0x1B",
"Sand Attack" = "0x1C",
"Headbutt" = "0x1D",
"Horn Attack" = "0x1E",
"Fury Attack" = "0x1F",
"Horn Drill" = "0x20",
"Tackle" = "0x21",
"Bodyslam" = "0x22",
"Wrap" = "0x23",
"Take Down " = "0x24",
"Trash" = "0x25",
"Double Edge" = "0x26",
"Tail Whip" = "0x27",
"Poison Sting" = "0x28",
"Twin Needle" = "0x29",
"Pin Missle" = "0x2A",
"Leer" = "0x2B",
"Bite" = "0x2C",
"Growl" = "0x2D",
"Roar" = "0x2E",
"SuperSonic" = "0x2F",
"Sonic Boom" = "0x30",
"Disable" = "0x32",
"Acid" = "0x33",
"Ember" = "0x34",
"FlameThrower" = "0x35",
"Mist" = "0x36",
"Water Gun" = "0x37",
"Hydro Pump" = "0x38",
"Surf" = "0x39",
"Ice Beam" = "0x3A",
"Blizzard" = "0x3B",
"PsyBeam" = "0x3C",
"Bubble Beam" = "0x3D",
"Aurora Beam" = "0x3E",
"Hyper Beam" = "0x3F",
"Peck" = "0x40",
"Drill Peck" = "0x41",
"Submission" = "0x42",
"Low Kick" = "0x43",
"Counter" = "0x44",
"Sesmic Toss" = "0x45",
"Strength" = "0x46",
"Absorb" = "0x47",
"Mega Drain" = "0x48",
"Leech Seed" = "0x49",
"Growth" = "0x4A",
"Razor Wind" = "0x4B",
"Solar Beam" = "0x4C",
"Poison Powder" = "0x4D",
"Stun Spore" = "0x4E",
"Sleep Powder" = "0x4F",
"Petal Dance" = "0x50",
"String Shot" = "0x51",
"Dragon Rage" = "0x52",
"Fire Spin" = "0x53",
"ThunderShock" = "0x54",
"ThunderBolt" = "0x55",
"ThunderWave" = "0x56",
"Thunder" = "0x57",
"Rock Throw" = "0x58",
"EarthQuake" = "0x59",
"Fissure" = "0x5A",
"Dig" = "0x5B",
"Toxic" = "0x5C",
"Confusion" = "0x5D",
"Psychic" = "0x5E",
"Hypnosis" = "0x5F",
"Meditate" = "0x60",
"Agility" = "0x61",
"Quick Attack" = "0x62",
"Rage" = "0x63",
"Teleport" = "0x64",
"Night Shade" = "0x65",
"Mimic" = "0x66",
"Screech" = "0x67",
"Double Team" = "0x68",
"Recover" = "0x69",
"Harden" = "0x6A",
"Minimized" = "0x6B",
"Smoke Screen" = "0x6C",
"Confuse Ray" = "0x6D",
"WithDraw" = "0x6E",
"Defence Curl" = "0x6F",
"Barrier" = "0x70",
"Light screen" = "0x71",
"Haze" = "0x72",
"Reflect" = "0x73",
"Focus" = "0x74",
"Bide" = "0x75",
"Metronome" = "0x76",
"Mirror Move" = "0x77",
"Self Destruct" = "0x78",
"Egg Bomb" = "0x79",
"Lick" = "0x7A",
"Smog" = "0x7B",
"Sludge" = "0x7C",
"Bone Club" = "0x7D",
"Fire Blast" = "0x7E",
"Waterfall" = "0x7F",
"Clamp" = "0x80",
"Swift" = "0x81",
"Skull Bash" = "0x82",
"Spike Cannon" = "0x83",
"Constrict" = "0x84",
"Amnesia" = "0x85",
"Kinesis" = "0x86",
"Softboiled" = "0x87",
"Hi-Jump Kick" = "0x88",
"Glare" = "0x89",
"Dream Eater" = "0x8A",
"Poison Gas" = "0x8B",
"Barrage" = "0x8C",
"Leech Life" = "0x8D",
"Lovely Kiss" = "0x8E",
"Sky Attack" = "0x8F",
"Transform" = "0x90",
"Bubble" = "0x91",
"Dizzy Punch" = "0x92",
"Spore" = "0x93",
"Flash" = "0x94",
"Psywave" = "0x95",
"Splash" = "0x96",
"Acid Armor" = "0x97",
"Crabhammer" = "0x98",
"Explosion" = "0x99",
"Fury Swipe" = "0x9A",
"Bonemerang" = "0x9B",
"Rest" = "0x9C",
"Rock Slide" = "0x9D",
"Hyper Fang" = "0x9E",
"Sharpen" = "0x9F",
"Conversion" = "0xA0",
"Tri Attack" = "0xA1",
"Super Fang" = "0xA2",
"Slash" = "0xA3",
"Substitute" = "0xA4",
"Struggle" = "0xA5"

Item

"Master Ball" = "0x01",
"Ultra Ball" = "0x02",
"BrightPowder" = "0x03",
"Great Ball" = "0x04",
"Poké Ball" = "0x05",
"Bicycle" = "0x06",
"Moon Stone" = "0x08",
"Antidote" = "0x09",
"Burn Heal" = "0x0A",
"Ice Heal" = "0x0B",
"Awakening" = "0x0C",
"Parlyz Heal" = "0x0D",
"Full Restore" = "0x0E",
"Max Potion" = "0x0F",
"Hyper Potion" = "0x10",
"Super Potion" = "0x11",
"Potion" = "0x12",
"Escape Rope" = "0x13",
"Repel" = "0x14",
"Max Elixer" = "0x15",
"Fire Stone" = "0x16",
"Thunder Stone" = "0x17",
"Water Stone" = "0x18",
"HP Up" = "0x1A",
"Protein" = "0x1B",
"Iron" = "0x1C",
"Carbos" = "0x1D",
"Lucky Punch" = "0x1E",
"Calcium" = "0x1F",
"Rare Candy" = "0x20",
"X Accuracy" = "0x21",
"Leaf Stone" = "0x22",
"Metal Powder" = "0x23",
"Nugget" = "0x24",
"Poké Doll" = "0x25",
"Full Heal" = "0x26",
"Revive" = "0x27",
"Max Revive" = "0x28",
"Guard Spec." = "0x29",
"Super Repel" = "0x2A",
"Max Repel" = "0x2B",
"Dire Hit" = "0x2C",
"Fresh Water" = "0x2E",
"Soda Pop" = "0x2F",
"Lemonade" = "0x30",
"X Attack" = "0x31",
"X Defend" = "0x33",
"X Speed" = "0x34",
"X Special" = "0x35",
"Coin Case" = "0x36",
"Itemfinder" = "0x37",
"Exp Share" = "0x39",
"Old Rod" = "0x3A",
"Good Rod" = "0x3B",
"Silver Leaf" = "0x3C",
"Super Rod" = "0x3D",
"PP Up" = "0x3E",
"Ether" = "0x3F",
"Max Ether" = "0x40",
"Elixer" = "0x41",
"Red Scale" = "0x42",
"SecretPotion" = "0x43",
"S.S. Ticket" = "0x44",
"Mystery Egg" = "0x45",
"Clear Bell*" = "0x46",
"Silver Wing" = "0x47",
"Moomoo Milk" = "0x48",
"Quick Claw" = "0x49",
"PSNCureBerry" = "0x4A",
"Gold Leaf" = "0x4B",
"Soft Sand" = "0x4C",
"Sharp Beak" = "0x4D",
"PRZCureBerry" = "0x4E",
"Burnt Berry" = "0x4F",
"Ice Berry" = "0x50",
"Poison Barb" = "0x51",
"King's Rock" = "0x52",
"Bitter Berry" = "0x53",
"Mint Berry" = "0x54",
"Red Apricorn" = "0x55",
"TinyMushroom" = "0x56",
"Big Mushroom" = "0x57",
"SilverPowder" = "0x58",
"Blu Apricorn" = "0x59",
"Amulet Coin" = "0x5B",
"Ylw Apricorn" = "0x5C",
"Grn Apricorn" = "0x5D",
"Cleanse Tag" = "0x5E",
"Mystic Water" = "0x5F",
"TwistedSpoon" = "0x60",
"Wht Apricorn" = "0x61",
"Black Belt" = "0x62",
"Blk Apricorn" = "0x63",
"Pnk Apricorn" = "0x65",
"BlackGlasses" = "0x66",
"SlowpokeTail" = "0x67",
"Pink Bow" = "0x68",
"Stick" = "0x69",
"Smoke Ball" = "0x6A",
"NeverMeltIce" = "0x6B",
"Magnet" = "0x6C",
"MiracleBerry" = "0x6D",
"Pearl" = "0x6E",
"Big Pearl" = "0x6F",
"Everstone" = "0x70",
"Spell Tag" = "0x71",
"RageCandyBar" = "0x72",
"GS Ball*" = "0x73",
"Blue Card*" = "0x74",
"Miracle Seed" = "0x75",
"Thick Club" = "0x76",
"Focus Band" = "0x77",
"EnergyPowder" = "0x79",
"Energy Root" = "0x7A",
"Heal Powder" = "0x7B",
"Revival Herb" = "0x7C",
"Hard Stone" = "0x7D",
"Lucky Egg" = "0x7E",
"Card Key" = "0x7F",
"Machine Part" = "0x80",
"Egg Ticket*" = "0x81",
"Lost Item" = "0x82",
"Stardust" = "0x83",
"Star Piece" = "0x84",
"Basement Key" = "0x85",
"Pass" = "0x86",
"Charcoal" = "0x8A",
"Berry Juice" = "0x8B",
"Scope Lens" = "0x8C",
"Metal Coat" = "0x8F",
"Dragon Fang" = "0x90",
"Leftovers" = "0x92",
"MysteryBerry" = "0x96",
"Dragon Scale" = "0x97",
"Berserk Gene" = "0x98",
"Sacred Ash" = "0x9C",
"Heavy Ball" = "0x9D",
"Flower Mail" = "0x9E",
"Level Ball" = "0x9F",
"Lure Ball" = "0xA0",
"Fast Ball" = "0xA1",
"Light Ball" = "0xA3",
"Friend Ball" = "0xA4",
"Moon Ball" = "0xA5",
"Love Ball" = "0xA6",
"Normal Box" = "0xA7",
"Gorgeous Box" = "0xA8",
"Sun Stone" = "0xA9",
"Polkadot Bow" = "0xAA",
"Up-Grade" = "0xAC",
"Berry" = "0xAD",
"Gold Berry" = "0xAE",
"SquirtBottle" = "0xAF",
"Park Ball" = "0xB1",
"Rainbow Wing" = "0xB2",
"Brick Piece" = "0xB4",
"Surf Mail" = "0xB5",
"Litebluemail" = "0xB6",
"Portraitmail" = "0xB7",
"Lovely Mail" = "0xB8",
"Eon Mail" = "0xB9",
"Morph Mail" = "0xBA",
"Bluesky Mail" = "0xBB",
"Music Mail" = "0xBC",
"Mirage Mail" = "0xBD",
"TM01" = "0xBF",
"TM02" = "0xC0",
"TM03" = "0xC1",
"TM04" = "0xC2",
"TM05" = "0xC4",
"TM06" = "0xC5",
"TM07" = "0xC6",
"TM08" = "0xC7",
"TM09" = "0xC8",
"TM10" = "0xC9",
"TM11" = "0xCA",
"TM12" = "0xCB",
"TM13" = "0xCC",
"TM14" = "0xCD",
"TM15" = "0xCE",
"TM16" = "0xCF",
"TM17" = "0xD0",
"TM18" = "0xD1",
"TM19" = "0xD2",
"TM20" = "0xD3",
"TM21" = "0xD4",
"TM22" = "0xD5",
"TM23" = "0xD6",
"TM24" = "0xD7",
"TM25" = "0xD8",
"TM26" = "0xD9",
"TM27" = "0xDA",
"TM28" = "0xDB",
"TM29" = "0xDD",
"TM30" = "0xDE",
"TM31" = "0xDF",
"TM32" = "0xE0",
"TM33" = "0xE1",
"TM34" = "0xE2",
"TM35" = "0xE3",
"TM36" = "0xE4",
"TM37" = "0xE5",
"TM38" = "0xE6",
"TM39" = "0xE7",
"TM40" = "0xE8",
"TM41" = "0xE9",
"TM42" = "0xEA",
"TM43" = "0xEB",
"TM44" = "0xEC",
"TM45" = "0xED",
"TM46" = "0xEE",
"TM47" = "0xEF",
"TM48" = "0xF0",
"TM49" = "0xF1",
"TM50" = "0xF2",
"HM01" = "0xF3",
"HM02" = "0xF4",
"HM03" = "0xF5",
"HM04" = "0xF6",
"HM05" = "0xF7",
"HM06" = "0xF8",
"HM07" = "0xF9",
"HM08" = "0xFA",
"HM09" = "0xFB",
"HM10" = "0xFC",
"HM11" = "0xFD",
"HM12" = "0xFE"
EstebanFuentealba commented 1 year ago

I hope the information is helpful, and if you can send a PR with the functionality, it would be great.

LuxStatera commented 1 year ago

Thank you so much for the information! Unfortunately I'm not able to make sense of it. I see in the pokemon_data.h there is some code under the TRAINER NAME that I thought might spell out Flipper or the Trainer ID number. I tried to use that to test out if I could match the code to the info you provided but I can't seem to find the matching info or maybe that code is something else. I am still a bit unfamiliar with GitHub and not sure what a PR is used for. My apologies I'm a total beginner.. Once I understand it then I would like to type out each Pokémon with their own moves and stats to submit. Maybe the app could be adjusted so the traded Pokémon get the same Trainer code as the cartridge so there won't be any issues with not having the correct badges for the high levels

LuxStatera commented 1 year ago

After looking over it a bit more I realized the TRAINER NAME does spell out Flipper. For some reason I was looking at the capitalized letters which was why they were not matching up. My bad. I changed the TRAINER NAME to the same one I created in my new save file on my cartridge. I will test to see if that allows the traded Pokemon to listen without badges. The pokemon_data.h file has only Mew listed with 4 different attacks that all traded Pokemon will also have but I noticed that their type is different for each one. Where is it getting that data if it is not listed in the pokemon_data.h file? I can add all 151 with custom attacks and specs once I understand it a little more

LuxStatera commented 1 year ago

After changing the name to the same one on my cartridge I made the trade and battled a wild Pokemon but it wouldn't listen. Most likely it has to do with the ID number but I don't see how to change that. The only levels listed in the pokemon_data.h file are in the "6 pokemon" section but after changing all of them to the hexadecimal equivalent of 15 it still showed the default 74 after a trade. I am unclear as to what the 6 pokemon, 6 trainer names, and 6 nicknames sections are for

LuxStatera commented 1 year ago

I've made changes to pokemon_data.h and regenerated the .fap but nothing changes with the traded Pokémon besides trainer name. How do I edit the individual Pokémon? In the pokemon_data.h file there is a section with only "MEW" but I'm not seeing where that fits in because the edits aren't recognized

R4g3D commented 1 year ago

I should have looked here while I was working on the code 😂 I manually scrapped a lot of the data you had here already 🤦🏻

@EstebanFuentealba you can close this issue since it's now part of the app.