R4itool from lifehackerhansol

Tradegirl2011

Member
OP
Newcomer
Joined
Jan 17, 2020
Messages
8
Trophies
0
Age
43
XP
113
Country
Switzerland
Hi.

I tried to compile the R4itool for from @lifehackerhansol to get rid off the timebomb from the original kernel from my r4i-sdhc,com card.

unfortunately i get a warning during the compiling and the resulting binary seems to work, but when it is done with patching the r4.dat the "fixed" r4.dat doesn't boot the kernel.

following is the commandline from my test environment (linux mint):

1st error (fixed by renaming DES.h to des.h):
Code:
test@test-VirtualBox:~/r4itool-lifehackerhansol$ make
  CC      source/DES.c
source/DES.c:27:10: fatal error: des.h: No such file or directory
   27 | #include "des.h"
      |          ^~~~~~~
compilation terminated.
make: *** [Makefile:151: build/source/DES.c.o] Error 1

2nd error/warning:
Code:
test@test-VirtualBox:~/r4itool-lifehackerhansol$ make
  CC      source/DES.c
  CXX     source/Main.cpp
In file included from source/Main.cpp:1:
include/R4i.hpp:18:43: warning: attribute ignored in declaration of ‘struct r4i::SecretArea’ [-Wattributes]
   18 | alignas(2) struct __attribute__((packed)) SecretArea {
      |                                           ^~~~~~~~~~
include/R4i.hpp:18:43: note: attribute for ‘struct r4i::SecretArea’ must follow the ‘struct’ keyword
  CXX     source/R4i.cpp
In file included from source/R4i.cpp:5:
include/R4i.hpp:18:43: warning: attribute ignored in declaration of ‘struct r4i::SecretArea’ [-Wattributes]
   18 | alignas(2) struct __attribute__((packed)) SecretArea {
      |                                           ^~~~~~~~~~
include/R4i.hpp:18:43: note: attribute for ‘struct r4i::SecretArea’ must follow the ‘struct’ keyword
source/R4i.cpp: In function ‘r4i::u32 r4i::genAreaChk(r4i::u16, r4i::u16, r4i::u16)’:
source/R4i.cpp:205:24: warning: format ‘%lx’ expects argument of type ‘long unsigned int’, but argument 3 has type ‘r4i::u32’ {aka ‘unsigned int’} [-Wformat=]
  205 |   sprintf(buffer, "%08lx", (static_cast<u32>(arm7chk) << 16) | arm9chk);
      |                    ~~~~^   ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      |                        |                                     |
      |                        long unsigned int                     r4i::u32 {aka unsigned int}
      |                    %08x
  LD      r4itool-lifehackerhansol
 

Apache Thunder

I have cameras in your head!
Member
Joined
Oct 7, 2007
Messages
4,432
Trophies
3
Age
36
Location
Levelland, Texas
Website
www.mariopc.co.nr
XP
6,801
Country
United States
Try moving "alignas(2)" to the right of struct for SecretArea instead of the left where it is currently. That seemed to fix that warning (on Windows anyways)

Should look like this now:


Code:
struct alignas(2) __attribute__((packed)) SecretArea {
  u32 magic;
  u16 arm9chk;
  u16 arm7chk;
  u16 ldrchk;
  u32 areachk;
  u32 dldiOffset;
};


As for the other warning, it shouldn't be breaking things for you as that just impacts console display. But you can fix that easily too:

Code:
sprintf(buffer, "%08lx", (static_cast<long unsigned int>(arm7chk) << 16) | arm9chk);

Just cast it as the thing it wants. :P

Going to see if the patcher actually works for me now. Last time recall having the issue with the compiled build not producing a working result so maybe this was my issue too. :P

EDIT: It still hangs on loading for me. I think this just doesn't work on 4.1 version of R4.dat currently. :(
 
Last edited by Apache Thunder,

Tradegirl2011

Member
OP
Newcomer
Joined
Jan 17, 2020
Messages
8
Trophies
0
Age
43
XP
113
Country
Switzerland
Code:
struct alignas(2) __attribute__((packed)) SecretArea {
  u32 magic;
  u16 arm9chk;
  u16 arm7chk;
  u16 ldrchk;
  u32 areachk;
  u32 dldiOffset;
};

unfortunately the compiler no longer works for me with your changes.
I'm getting lots of errors now.


EDIT: @Apache Thunder : have you ever tried to build the r4itool from github kynex7510/r4itool?
i managed to compile it under windows a few weeks ago, but the tool also didn't work for me.
the output "r4-fixed.dat" was identical to the input "r4.dat".
 
Last edited by Tradegirl2011,

Apache Thunder

I have cameras in your head!
Member
Joined
Oct 7, 2007
Messages
4,432
Trophies
3
Age
36
Location
Levelland, Texas
Website
www.mariopc.co.nr
XP
6,801
Country
United States
The only thing it changed on mine is this:

1713216799859.png


Does the same thing as the lifehackerhansol build so no change on my end other then that it does alter the file unlike for you for some reason. I'm surprised it compiled. I used to have issues compiling cmake stuff. :P

I did have to comment out this code in R4i.hpp. It complained about comparison reduces to (20 == 18):

Code:
static_assert(sizeof(SecretArea) == 0x12, "Invalid SecretArea size!");
 

Tradegirl2011

Member
OP
Newcomer
Joined
Jan 17, 2020
Messages
8
Trophies
0
Age
43
XP
113
Country
Switzerland
For Windows i used the build tools from visual studio 2022 and compiled it with cmake in cli.
I did not have to change any of the files. :unsure:

unfortunately, the tool/tools doesn't seem to work for some reason.
 

Apache Thunder

I have cameras in your head!
Member
Joined
Oct 7, 2007
Messages
4,432
Trophies
3
Age
36
Location
Levelland, Texas
Website
www.mariopc.co.nr
XP
6,801
Country
United States
For me I ran cmake from console to build from cmake txt file then ran make after that....At some point I had to put it into VS but it seems i don't need to do that now. I think the real issue is the tool only works on an older version of the R4i kernel so it needs to be reworked for the updated ones. :(
 

Site & Scene News

Popular threads in this forum

General chit-chat
Help Users
  • Psionic Roshambo @ Psionic Roshambo:
    Offroad was awesome
    +2
  • Psionic Roshambo @ Psionic Roshambo:
    The NES version was not a bad conversion
    +1
  • BigOnYa @ BigOnYa:
    Yea true, but using a wheel and pedals for gas/brake was awesome feature back in the day.
  • Psionic Roshambo @ Psionic Roshambo:
    Not sure if that or RC Pro AM was my favorite NES racing game... hmmmm
  • BigOnYa @ BigOnYa:
    Yea I loved the rc pro am games
  • Psionic Roshambo @ Psionic Roshambo:
    @SylverReZ, RC Pro AM was made by Rare, and that explains why I liked it. Just learned the other day about a game I loved that was made by Rare and I was surprised lol
  • K3Nv2 @ K3Nv2:
    I was playing need for speed remastered and said to myself this is a nice Forza remaster
  • Psionic Roshambo @ Psionic Roshambo:
    https://en.wikipedia.org/wiki/List_of_video_games_developed_by_Rare Not all of them are awesome but man the hits on that list.
  • Psionic Roshambo @ Psionic Roshambo:
    Oh snap Super Offroad was by them too? lol damn
    +1
  • BakerMan @ BakerMan:
    Today I learned that the creators of the Donkey Kong games also made Sea of Thieves
  • BakerMan @ BakerMan:
    why do i feel the sudden urge to start singing pirate's scorn from the donkey kong country cartoon?
  • BigOnYa @ BigOnYa:
    Are you being for real, cause that's hard to believe, DK is Nintendo and made in japan, Sea of thieves was from Microsoft, in America. I'm not calling you a liar, just didn't know.
  • BigOnYa @ BigOnYa:
    Ok yes they were both made by Rare, but DK was from Rare back then, Rare now is owned by MS. So makes since.
    +1
  • Psionic Roshambo @ Psionic Roshambo:
    They even developed a LJN game.... lol
  • K3Nv2 @ K3Nv2:
    It was pretty rare
  • Psionic Roshambo @ Psionic Roshambo:
    I wonder what deal with Satan LJN worked to get Rare to make that one...
  • BigOnYa @ BigOnYa:
    I remember couple years ago, they announced they were working on a Perfect Dark remake, wonder what ever happen with that?
  • K3Nv2 @ K3Nv2:
    It went into the darkness
  • BigOnYa @ BigOnYa:
    Me and buddies used to play the hell out of Perfect Dark on N64, that and Goldeneye, was the first real PvP shooter games I remember
  • BigOnYa @ BigOnYa:
    4-way split screen on a tiny 19" TV, lol
  • K3Nv2 @ K3Nv2:
    Did you share joysticks also
  • BigOnYa @ BigOnYa:
    Nuh we had the 4 controller add on thingy for n64. Duh I just got your joke, lol
  • K3Nv2 @ K3Nv2:
    So you touched ends
    K3Nv2 @ K3Nv2: So you touched ends