Thulinma / ndsplus

Linux support for the EMS NDS Adapter+
GNU General Public License v3.0
23 stars 4 forks source link

Pokemon Black not working. #5

Closed Me0wth closed 11 years ago

Me0wth commented 11 years ago

I cannot dump or back up my .sav for Pokemon Black.

NDS Adapter+ firmware version 304 detected. Card title: POKEMON B Card ID: IRBO Card size: 256 MiB Save: 0 KiB FLASH

It says it has 0 KiBFlash memory.

Thulinma commented 11 years ago

Hm... Strange. Can you post the output of running ndsplus with --debug while that card is inserted? Might help me to figure out what's going on here.

Me0wth commented 11 years ago

Okay here it is:

0000: 13 00 62 11 00 aa 30 01 ..b...0. NDS Adapter+ firmware version 304 detected. 0000: 50 4f 4b 45 4d 4f 4e 20 42 00 00 00 49 52 42 4f 30 31 02 00 0b 00 00 00 POKEMON B...IRBO01...... 0018: 00 00 00 00 03 40 00 00 00 40 00 00 00 48 00 02 00 40 00 02 98 f8 06 00 .....@...@...H...@...... 0030: 00 7e 2c 00 00 00 38 02 00 00 38 02 84 8f 02 00 00 0e 2f 00 10 04 00 00 .~,...8...8......./..... 0048: 00 14 2f 00 20 0f 00 00 00 3a 07 00 a0 1d 00 00 00 00 00 00 00 00 00 00 ../. ....:.............. 0060: 57 66 41 00 f8 08 18 08 00 24 2f 00 9b 8b 7e 0d a8 4e 00 02 d4 03 38 02 WfA......$/...~..N....8. 0078: 00 00 00 00 00 00 00 00 00 8e 3b 0c 00 40 00 00 b0 0f 00 00 d4 05 00 00 ..........;..@.......... 0090: 88 01 88 01 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ........................ 00a8: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ........................ 00c0: 24 ff ae 51 69 9a a2 21 3d 84 82 0a 84 e4 09 ad 11 24 8b 98 c0 81 7f 21 $..Qi..!=........$.....! 00d8: a3 52 be 19 93 09 ce 20 10 46 4a 4a f8 27 31 ec 58 c7 e8 33 82 e3 ce bf .R..... .FJJ.'1.X..3.... 00f0: 85 f4 df 94 ce 4b 09 c1 94 56 8a c0 13 72 a7 fc 9f 84 4d 73 a3 ca 9a 61 .....K...V...r....Ms...a 0108: 58 97 a3 27 fc 03 98 76 23 1d c7 61 03 04 ae 56 bf 38 84 00 40 a7 0e fd X..'...v#..a...V.8..@... 0120: ff 52 fe 03 6f 95 30 f1 97 fb c0 85 60 d6 80 25 a9 63 be 03 01 4e 38 e2 .R..o.0.......%.c...N8. 0138: f9 a2 34 ff bb 3e 03 44 78 00 90 cb 88 11 3a 94 65 c0 7c 63 87 f0 3c af ..4..>.Dx.....:.e.|c..<. 0150: d6 25 e4 8b 38 0a ac 72 21 d4 f8 07 56 cf 85 84 00 00 00 00 00 00 00 00 .%..8..r!...V........... 0168: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ........................ 0180: 81 85 89 8d 80 84 88 8c 90 94 98 9c 80 84 88 8c 90 94 98 9c 00 00 00 00 ........................ 0198: 40 37 c0 07 00 37 40 07 00 30 40 00 40 37 c0 07 00 37 40 07 0f 00 00 03 @7...7@..0@.@7...7@..... 01b0: ef ff ff ff 00 00 00 00 06 04 00 00 00 00 00 01 00 30 40 0c 00 00 00 00 .................0@..... 01c8: 00 00 40 02 24 2f 01 00 00 60 41 0c 44 04 03 03 00 00 e8 02 f8 70 04 00 ..@.$/...A.D........p.. 01e0: 00 40 00 00 00 5c fd 0b 00 30 40 0c 00 a4 05 00 00 9c fd 0b 00 0f 3c 00 .@......0@...........<. 01f8: 00 ac 39 0c 78 e0 01 00 ..9.x... Card title: POKEMON B Card ID: IRBO Card size: 256 MiB Save: 0 KiB FLASH

Thulinma commented 11 years ago

Interesting! The first line is the most important here. For my own card of pokemon black (luckily enough I have one myself, so I can compare pretty directly), this is what I'm getting:

13 00 20 40 13

While you're getting:

13 00 62 11 00

The 13 identifies the savegame chip used - referring to SRAM in this case, which means the size is stored in the last byte - which is 13 for pokemon black (1 << 13 = 512KB save size). However, for your card it's being reported as 0 - in other words, 1 byte. Obviously not correct.

I also note that the 3rd and 4th bytes are not the same for your card as they are on mine - I've never seen these values change for a specific game. Is it possible your game card is a knock-off?

Anyway - it's not impossible to read/write a gamecard if the size is not reported properly, this application simply doesn't allow it so you don't accidentally break something if the size is not specified manually correctly.

You can manually override this by hardcoding the save size in the source. Find line 385 in ndsplus.cpp:

save_size = 1 << card_status[0x04];

And change it to read:

save_size = 1 << 13;

Note that the program will only work for games with a 512KB SRAM chip when compiled this way. EEPROM games will still work, but all SRAM games will be detected as 512KB in size unless you change the code back to how it was before. Hopefully, this will allow you to read/write your pokemon save. Let me know how it goes - I can add a commandline option to override detected save sizes if this works, so you won't have to recompile in case this happens more often for some reason.

Me0wth commented 11 years ago

I doubt my card is a knock off, I bought it from Walmart here in the States. I'll give this a try and send you the feedback.

Thulinma commented 11 years ago

Alright. Maybe they changed the card's hardware at some point... Just trying to find an explanation for why yours doesn't show up like mine does. It would be interesting to see if the official Windows application reads this card... But first things first, of course ;-)

Me0wth commented 11 years ago

Alright i did what you said and this is what happened:

Card title: POKEMON B Card ID: IRBO Card size: 256 MiB Save: 8 KiB FLASH

Me0wth commented 11 years ago

Updated with debug info for the version compiled with the changed ndsplus.cpp:

0000: 13 00 62 11 00 aa 30 01 ..b...0. NDS Adapter+ firmware version 304 detected. 0000: 50 4f 4b 45 4d 4f 4e 20 42 00 00 00 49 52 42 4f 30 31 02 00 0b 00 00 00 POKEMON B...IRBO01...... 0018: 00 00 00 00 03 40 00 00 00 40 00 00 00 48 00 02 00 40 00 02 98 f8 06 00 .....@...@...H...@...... 0030: 00 7e 2c 00 00 00 38 02 00 00 38 02 84 8f 02 00 00 0e 2f 00 10 04 00 00 .~,...8...8......./..... 0048: 00 14 2f 00 20 0f 00 00 00 3a 07 00 a0 1d 00 00 00 00 00 00 00 00 00 00 ../. ....:.............. 0060: 57 66 41 00 f8 08 18 08 00 24 2f 00 9b 8b 7e 0d a8 4e 00 02 d4 03 38 02 WfA......$/...~..N....8. 0078: 00 00 00 00 00 00 00 00 00 8e 3b 0c 00 40 00 00 b0 0f 00 00 d4 05 00 00 ..........;..@.......... 0090: 88 01 88 01 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ........................ 00a8: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ........................ 00c0: 24 ff ae 51 69 9a a2 21 3d 84 82 0a 84 e4 09 ad 11 24 8b 98 c0 81 7f 21 $..Qi..!=........$.....! 00d8: a3 52 be 19 93 09 ce 20 10 46 4a 4a f8 27 31 ec 58 c7 e8 33 82 e3 ce bf .R..... .FJJ.'1.X..3.... 00f0: 85 f4 df 94 ce 4b 09 c1 94 56 8a c0 13 72 a7 fc 9f 84 4d 73 a3 ca 9a 61 .....K...V...r....Ms...a 0108: 58 97 a3 27 fc 03 98 76 23 1d c7 61 03 04 ae 56 bf 38 84 00 40 a7 0e fd X..'...v#..a...V.8..@... 0120: ff 52 fe 03 6f 95 30 f1 97 fb c0 85 60 d6 80 25 a9 63 be 03 01 4e 38 e2 .R..o.0.......%.c...N8. 0138: f9 a2 34 ff bb 3e 03 44 78 00 90 cb 88 11 3a 94 65 c0 7c 63 87 f0 3c af ..4..>.Dx.....:.e.|c..<. 0150: d6 25 e4 8b 38 0a ac 72 21 d4 f8 07 56 cf 85 84 00 00 00 00 00 00 00 00 .%..8..r!...V........... 0168: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ........................ 0180: 81 85 89 8d 80 84 88 8c 90 94 98 9c 80 84 88 8c 90 94 98 9c 00 00 00 00 ........................ 0198: 40 37 c0 07 00 37 40 07 00 30 40 00 40 37 c0 07 00 37 40 07 0f 00 00 03 @7...7@..0@.@7...7@..... 01b0: ef ff ff ff 00 00 00 00 06 04 00 00 00 00 00 01 00 30 40 0c 00 00 00 00 .................0@..... 01c8: 00 00 40 02 24 2f 01 00 00 60 41 0c 44 04 03 03 00 00 e8 02 f8 70 04 00 ..@.$/...A.D........p.. 01e0: 00 40 00 00 00 5c fd 0b 00 30 40 0c 00 a4 05 00 00 9c fd 0b 00 0f 3c 00 .@......0@...........<. 01f8: 00 ac 39 0c 78 e0 01 00 ..9.x... Card title: POKEMON B Card ID: IRBO Card size: 256 MiB Save: 8 KiB FLASH

Thulinma commented 11 years ago

Whoops, my bad. The "13" should have been "0x13". I wasn't paying attention I guess. Sorry.

Me0wth commented 11 years ago

Oh Haha thanks.

Me0wth commented 11 years ago

It worked, thanks a lot! :-)

NDS Adapter+ firmware version 304 detected. Card title: POKEMON B Card ID: IRBO Card size: 256 MiB Save: 512 KiB FLASH

Thulinma commented 11 years ago

Great! Does it read/write the savegame correctly as well, though?

Me0wth commented 11 years ago

Yes, i was able to backup, wipe, and then restore my save.

Thulinma commented 11 years ago

Great! I'll add this as a commandline option, then. :-)

Me0wth commented 11 years ago

Awesome, thanks again for all your help. :-)

Thulinma commented 11 years ago

No problem! Let me know if anything else doesn't work like it should.