R4itool from lifehackerhansol

Tradegirl2011

Member
OP
Newcomer
Joined
Jan 17, 2020
Messages
7
Trophies
0
Age
43
XP
111
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,429
Trophies
3
Age
36
Location
Levelland, Texas
Website
www.mariopc.co.nr
XP
6,798
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
7
Trophies
0
Age
43
XP
111
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,429
Trophies
3
Age
36
Location
Levelland, Texas
Website
www.mariopc.co.nr
XP
6,798
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
7
Trophies
0
Age
43
XP
111
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,429
Trophies
3
Age
36
Location
Levelland, Texas
Website
www.mariopc.co.nr
XP
6,798
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
  • BakerMan
    The snack that smiles back, Ballsack!
  • AncientBoi @ AncientBoi:
    How are you doing today K3Nv2?
  • AncientBoi @ AncientBoi:
    You did? By whom?
  • AncientBoi @ AncientBoi:
    Ohh, Don't tell me lEOTck did it to you? :O:sad:
  • BakerMan @ BakerMan:
    nah we all know luke is who leo's smashing
    +1
  • AncientBoi @ AncientBoi:
    Oh :shit:! And I didn't get to 📽️ it! :angry::sad::cry: :hateit:
  • BakerMan @ BakerMan:
    GUYS I JUST FOUND OUT THAT ULTERIOR MOTIVES WAS FOUND YESTERDAY, AND IT WAS FROM P O R N 💀😭
    +1
  • AncientBoi @ AncientBoi:
    😱 .............................. :evil::tpi::evil:
  • Xdqwerty @ Xdqwerty:
    Good afternoon
  • Xdqwerty @ Xdqwerty:
    @BakerMan, what's ulterior motives?
  • zeith_7 @ zeith_7:
    it was a lostwave song
  • Xdqwerty @ Xdqwerty:
    @zeith_7, 1) what's lostwave? 2) give context
  • zeith_7 @ zeith_7:
    lostwaves are like songs that became lost
  • zeith_7 @ zeith_7:
    they are partially or never found
  • zeith_7 @ zeith_7:
    ulterior motives is one of the internets lostwaves
  • Xdqwerty @ Xdqwerty:
    Ok read the Wikipedia article
  • zeith_7 @ zeith_7:
    and basically people were trying to find it for a while after a post with the lost songs only snippet
  • Xdqwerty @ Xdqwerty:
    @zeith_7, and an obscure norp film had the song
  • zeith_7 @ zeith_7:
    correct
  • zeith_7 @ zeith_7:
    the orginal snippet was from a pirated verison of the film basically
  • zeith_7 @ zeith_7:
    or so i think
  • zeith_7 @ zeith_7:
    i never expected it to get discovered this year/month
  • K3Nv2 @ K3Nv2:
    Lol this neighbor "I'm always hearing him shit" I'm sorry would you like my shits to be more settle
    +1
  • BakerMan @ BakerMan:
    never bring a knife to a gunfight, but bringing a gun to a knife fight is suggested
    +1
    BakerMan @ BakerMan: never bring a knife to a gunfight, but bringing a gun to a knife fight is suggested +1