Hacking Official [Source Release] ReiNand CFW

DjoeN

Captain Haddock!
Member
Joined
Oct 21, 2005
Messages
5,489
Trophies
0
Age
54
Location
Somewhere in this potatoland!
Website
djoen.dommel.be
XP
2,857
Country
Belgium
You will hate yourself later. Because of newer game compatibility, you'll find yourself on emunand much more than sysnand. You really want all of your previous progress on emunand. When rxTools catches up, it'll be easy to swap them though. You just have to carefully swap movable.sed between the nands.

Ok, right, think i'll redo it just like @mashers posted a few posts down :), this way i'll keep everything.
It's not that it's my main n3ds console to play, that's still on 10.3 on i won't downgrade that, also have another o3ds with everything on.
This N3DS will mainly be used for emulator installed as cia stuff and ports (yes also for the few n3ds exlusive titles)
 

ihaveahax

Well-Known Member
Member
Joined
Apr 20, 2015
Messages
6,070
Trophies
2
XP
7,876
Country
United States
Vermont was so impressed with Rei's emunand, they named the state after him.

View attachment 35312
the way this works is a bit weird... someone pointed out to me that Nintendo Badge Arcade showed the version as "RX-E 1.3.0".

also.......
42lEx6Gm.jpg
 
  • Like
Reactions: klear and zoogie

Aroth

Well-Known Member
Member
Joined
Apr 14, 2015
Messages
2,066
Trophies
0
Age
38
XP
901
Country
United States
Thanks... i am very interested to here the outcome

EDIT: are your nands unlinked ??

Patched agb_firm is NOT needed, for sysnand OR emunand. Holy shit.

Just install your DSiWare and GBA VC games to both sysnand and emunand (or keep your nands linked if you swing that way).
 
  • Like
Reactions: peteruk

The Real Jdbye

*is birb*
Member
Joined
Mar 17, 2010
Messages
23,410
Trophies
4
Location
Space
XP
14,072
Country
Norway
I found out why this happens.

Code:
int strcomp(char* s1, char* s2, unsigned int size)
{
  for(int i = 0; i < size; i++)
  {
    if(s1 != s2) return 0;
  }
  return 1;
}

Code:
void patches(void)
{
  //Change version string
  for(int i = 0; i < 0x600000; i+=4)
  {
    if(strcomp((void*)0x27B00000 - i, (void*)L"Ver.", 4)) strcopy((void*)0x27B00000 - i, (void*)L"\uE024Rei", 4);
  }
}

Anyone see the problem? It's passing "Ver." to the strcomp function and telling it to check 4 bytes.
But "Ver." is an unicode string. The characters are actually two bytes in width! It should be checking 8 bytes of data. So in reality, it's only checking for "Ve".
The fix is simple. Modify the strcomp() function so that it behaves the same way as strcopy()
Code:
int strcomp(char* s1, char* s2, unsigned int size){
  for(int i = 0; i < size*2; i++){
    if(s1[i] != s2[i]) return 0;
  }
  return 1;
}

@Reisyukaku There you go :)
 
Last edited by The Real Jdbye,

Aroth

Well-Known Member
Member
Joined
Apr 14, 2015
Messages
2,066
Trophies
0
Age
38
XP
901
Country
United States
I found out why this happens.





Anyone see the problem? It's passing "Ver." to the strcomp function and telling it to check 4 bytes.
But "Ver." is an unicode string. The characters are actually two bytes in width! It should be checking 8 bytes of data. So in reality, it's only checking for "Ve".
The fix is simple. Change the 4 to an 8.

@Reisyukaku There you go :)
Fuck it im brave, where is this at in the code and I'll test it myself
 

Aroth

Well-Known Member
Member
Joined
Apr 14, 2015
Messages
2,066
Trophies
0
Age
38
XP
901
Country
United States
It's in thread.c

thanks, I assume both instances of the value 4 need to be updated?

specifically, it should read like so?

Code:
void patches(void){
    //Change version string
    for(int i = 0; i < 0x600000; i+=8){
        if(strcomp((void*)0x27B00000  - i, (void*)L"Ver.", 8)) strcopy((void*)0x27B00000 - i, (void*)L"\uE024Rei", 8);
    }
}
 

The Real Jdbye

*is birb*
Member
Joined
Mar 17, 2010
Messages
23,410
Trophies
4
Location
Space
XP
14,072
Country
Norway
Fuck it im brave, where is this at in the code and I'll test it myself
https://github.com/Reisyukaku/ReiNand/blob/master/thread/source/thread.c#L71
You should only need to compile/replace arm9.bin

thanks, I assume both instances of the value 4 need to be updated?

specifically, it should read like so?

Code:
void patches(void){
    //Change version string
    for(int i = 0; i < 0x600000; i+=8){
        if(strcomp((void*)0x27B00000  - i, (void*)L"Ver.", 8)) strcopy((void*)0x27B00000 - i, (void*)L"\uE024Rei", 8);
    }
}
strcopy() is already correct so you don't need to change that.
The best fix would be to modify strcomp() so that it behaves the same as strcopy().
Change (in lib.c):
Code:
int strcomp(char* s1, char* s2, unsigned int size){
  for(int i = 0; i < size; i++){
    if(s1[i] != s2[i]) return 0;
  }
  return 1;
}
To:
Code:
int strcomp(char* s1, char* s2, unsigned int size){
  for(int i = 0; i < size*2; i++){
    if(s1[i] != s2[i]) return 0;
  }
  return 1;
}
 
Last edited by The Real Jdbye,

Shadowtrance

Well-Known Member
Member
Joined
May 9, 2014
Messages
2,493
Trophies
0
Location
Hervey Bay, Queensland
XP
1,807
Country
thanks, I assume both instances of the value 4 need to be updated?

specifically, it should read like so?

Code:
void patches(void){
    //Change version string
    for(int i = 0; i < 0x600000; i+=8){
        if(strcomp((void*)0x27B00000  - i, (void*)L"Ver.", 8)) strcopy((void*)0x27B00000 - i, (void*)L"\uE024Rei", 8);
    }
}
Nah only the first "4", if you change the second 4 also you ONLY see .::Rei and no version number at all. haha (just tried both ways).
 
  • Like
Reactions: klear

Aroth

Well-Known Member
Member
Joined
Apr 14, 2015
Messages
2,066
Trophies
0
Age
38
XP
901
Country
United States
https://github.com/Reisyukaku/ReiNand/blob/master/thread/source/thread.c#L71
You should only need to compile/replace arm9.bin


strcopy() is already correct so you don't need to change that.
The best fix would be to modify strcomp() so that it behaves the same as strcopy().
Change (in lib.c):
Code:
int strcomp(char* s1, char* s2, unsigned int size){
  for(int i = 0; i < size; i++){
    if(s1[i] != s2[i]) return 0;
  }
  return 1;
}
To:
Code:
int strcomp(char* s1, char* s2, unsigned int size){
  for(int i = 0; i < size*2; i++){
    if(s1[i] != s2[i]) return 0;
  }
  return 1;
}


Ok, so just the first instance then? i+=4 to i+=8? Leave strcomp() and strcopy() alone?

--------------------- MERGED ---------------------------

https://github.com/Reisyukaku/ReiNand/blob/master/thread/source/thread.c#L71
You should only need to compile/replace arm9.bin


strcopy() is already correct so you don't need to change that.
The best fix would be to modify strcomp() so that it behaves the same as strcopy().
Change (in lib.c):
Code:
int strcomp(char* s1, char* s2, unsigned int size){
  for(int i = 0; i < size; i++){
    if(s1[i] != s2[i]) return 0;
  }
  return 1;
}
To:
Code:
int strcomp(char* s1, char* s2, unsigned int size){
  for(int i = 0; i < size*2; i++){
    if(s1[i] != s2[i]) return 0;
  }
  return 1;
}
Yeah I see that now, wonder if there is a reason why strcomp doesn't double the size like strcopy does.
 

Site & Scene News

Popular threads in this forum

General chit-chat
Help Users
    Veho @ Veho: Can I hold it for a sec?