Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug Report] Unable to transfer japanese pokemon from gen III to european gen IV. #87

Open
1 of 3 tasks
sergiotarxz opened this issue Apr 20, 2024 · 2 comments
Open
1 of 3 tasks
Labels
bug Something isn't working

Comments

@sergiotarxz
Copy link

sergiotarxz commented Apr 20, 2024

Describe the bug
Cannot transfer japanese pokemons from gen III to an european gen IV game. std::bad_alloc

Console (please complete the following information):

  • DS/DSi/3DS using a Flashcard
  • DSi (Using SD card)
  • 3DS (Using SD card)
  • Version [e.g. v0.1]

Additional context
Add any other context about the problem here.

@sergiotarxz sergiotarxz added the bug Something isn't working label Apr 20, 2024
@sergiotarxz sergiotarxz changed the title [Bug Report] [Bug Report] Unable to transfer japanese pokemon from gen III to european gen IV. Apr 20, 2024
@sergiotarxz
Copy link
Author

I got a stacktrace:

#0  0x0210b418 in __cxa_throw ()
#1  0x0210ba9c in operator new(unsigned int) ()
#2  0x0201d1ac in std::__new_allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >::allocate (this=<optimized out>, 
    __n=<optimized out>) at /opt/devkitpro/devkitARM/arm-none-eabi/include/c++/13.2.0/bits/new_allocator.h:147
#3  std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >::allocate (__n=<optimized out>, this=<optimized out>)
    at /opt/devkitpro/devkitARM/arm-none-eabi/include/c++/13.2.0/bits/allocator.h:198
#4  std::allocator_traits<std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > >::allocate (__n=<optimized out>, __a=...)
    at /opt/devkitpro/devkitARM/arm-none-eabi/include/c++/13.2.0/bits/alloc_traits.h:482
#5  std::_Vector_base<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > >::_M_allocate (this=<optimized out>, __n=<optimized out>) at /opt/devkitpro/devkitARM/arm-none-eabi/include/c++/13.2.0/bits/stl_vector.h:378
#6  std::_Vector_base<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > >::_M_allocate (__n=<optimized out>, this=<optimized out>) at /opt/devkitpro/devkitARM/arm-none-eabi/include/c++/13.2.0/bits/stl_vector.h:375
#7  std::vector<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > >::_M_realloc_insert<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > (__position=..., this=0xb0039d4)
    at /opt/devkitpro/devkitARM/arm-none-eabi/include/c++/13.2.0/bits/vector.tcc:459
#8  std::vector<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > >::emplace_back<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > (this=0xb0039d4)
    at /opt/devkitpro/devkitARM/arm-none-eabi/include/c++/13.2.0/bits/vector.tcc:123
#9  i18n::load (lang=lang@entry=pksm::Language::JPN, name=..., array=...) at /home/sergio/pkmn-chest/arm9/core/source/i18n/i18n.cpp:177
#10 0x020253f4 in i18n::initMove (lang=pksm::Language::JPN) at /opt/devkitpro/devkitARM/arm-none-eabi/include/c++/13.2.0/bits/basic_string.tcc:238
#11 0x0201bbc0 in i18n::init (lang=pksm::Language::JPN) at /home/sergio/pkmn-chest/arm9/core/source/i18n/i18n.cpp:94
#12 0x02026b40 in i18n::checkInitialized (lang=<optimized out>) at /home/sergio/pkmn-chest/arm9/core/source/i18n/i18n_internal.hpp:75
#13 i18n::species[abi:cxx11](pksm::Language, pksm::Species) (lang=<optimized out>, val=...) at /home/sergio/pkmn-chest/arm9/core/source/i18n/i18n_species.cpp:45
#14 0x02026ba0 in pksm::internal::Species_impl::localize[abi:cxx11](pksm::Language) const (this=this@entry=0xb003a88, lang=<optimized out>)
    at /home/sergio/pkmn-chest/arm9/core/source/i18n/i18n_species.cpp:69
#15 0x020313e4 in pksm::Species::localize[abi:cxx11](pksm::Language) const (lang=<optimized out>, this=0xb003a88)
    at /home/sergio/pkmn-chest/arm9/core/include/enums/Species.hpp:1072
#16 pksm::PK3::convertToG4 (this=0x23a2540) at /home/sergio/pkmn-chest/arm9/core/source/pkx/PK3.cpp:572
#17 0x02061860 in pksm::Sav::transfer (this=this@entry=0x21ac100, pk=...) at /home/sergio/pkmn-chest/arm9/core/source/sav/Sav.cpp:197
#18 0x02019258 in manageBoxes () at /home/sergio/pkmn-chest/arm9/source/manager.cpp:699
#19 0x020105b0 in mainLoop () at /home/sergio/pkmn-chest/arm9/source/main.cpp:141
#20 0x020d97b8 in main (argc=1, argv=<optimized out>) at /home/sergio/pkmn-chest/arm9/source/main.cpp:163

@sergiotarxz
Copy link
Author

sergiotarxz commented May 1, 2024

I was able to make it work with the following not so clean patch on arm9/core:

diff --git a/source/i18n/i18n_species.cpp b/source/i18n/i18n_species.cpp
index 7181002..f0caf37 100644
--- a/source/i18n/i18n_species.cpp
+++ b/source/i18n/i18n_species.cpp
@@ -42,7 +42,8 @@ namespace i18n
 
     const std::string& species(pksm::Language lang, pksm::Species val)
     {
-        checkInitialized(lang);
+        speciess.erase(lang);
+        i18n::load(lang, "/species.txt", speciess[lang]);
         if (speciess.count(lang) > 0)
         {
             if (size_t(val) < speciess[lang].size())

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant