R4itool from lifehackerhansol

Tradegirl2011

Member
OP
Newcomer
Joined
Jan 17, 2020
Messages
16
Trophies
0
Age
43
XP
142
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,456
Trophies
3
Age
36
Location
Levelland, Texas
Website
www.mariopc.co.nr
XP
6,870
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
16
Trophies
0
Age
43
XP
142
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,456
Trophies
3
Age
36
Location
Levelland, Texas
Website
www.mariopc.co.nr
XP
6,870
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
16
Trophies
0
Age
43
XP
142
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,456
Trophies
3
Age
36
Location
Levelland, Texas
Website
www.mariopc.co.nr
XP
6,870
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
  • No one is chatting at the moment.
  • Jayro @ Jayro:
    I have yaoi anime hands, very lorge but slender.
  • Jayro @ Jayro:
    I'm Slenderman.
  • Veho @ Veho:
    I have hands.
  • BakerMan @ BakerMan:
    imagine not having hands, cringe
    +1
  • AncientBoi @ AncientBoi:
    ESPECIALLY for things I do to myself :sad:.. :tpi::rofl2: Or others :shy::blush::evil:
    +1
  • The Real Jdbye @ The Real Jdbye:
    @SylverReZ if you could find a v5 DS ML you would have the best of both worlds since the v5 units had the same backlight brightness levels as the DS Lite unlockable with flashme
  • The Real Jdbye @ The Real Jdbye:
    but that's a long shot
  • The Real Jdbye @ The Real Jdbye:
    i think only the red mario kart edition phat was v5
  • BigOnYa @ BigOnYa:
    A woman with no arms and no legs was sitting on a beach. A man comes along and the woman says, "I've never been hugged before." So the man feels bad and hugs her. She says "Well i've also never been kissed before." So he gives her a kiss on the cheek. She says "Well I've also never been fucked before." So the man picks her up, and throws her in the ocean and says "Now you're fucked."
    +2
  • BakerMan @ BakerMan:
    lmao
  • BakerMan @ BakerMan:
    anyways, we need to re-normalize physical media

    if i didn't want my games to be permanent, then i'd rent them
    +1
  • BigOnYa @ BigOnYa:
    Agreed, that why I try to buy all my games on disc, Xbox anyways. Switch games (which I pirate tbh) don't matter much, I stay offline 24/7 anyways.
  • AncientBoi @ AncientBoi:
    I don't pirate them, I Use Them :mellow:. Like I do @BigOnYa 's couch :tpi::evil::rofl2:
    +1
  • cearp @ cearp:
    @BakerMan - you can still "own" digital media, arguably easier and better than physical since you can make copies and backups, as much as you like.

    The issue is DRM
  • cearp @ cearp:
    You can buy drm free games / music / ebooks, and if you keep backups of your data (like documents and family photos etc), then you shouldn't lose the game. but with a disk, your toddler could put it in the toaster and there goes your $60

    :rofl2:
  • cearp @ cearp:
    still, I agree physical media is nice to have. just pointing out the issue is drm
  • rqkaiju2 @ rqkaiju2:
    i like physical media because it actually feels like you own it. thats why i plan on burning music to cds
  • cearp @ cearp:
    It's nice to not have to have a lot of physical things though, saves space
    +1
  • AncientBoi @ AncientBoi:
    Nor clothes 🤮 . Saves on time, soap, water and money having to wash them. :D
  • SylverReZ @ SylverReZ:
    @rqkaiju2, Physical media is a great source for archiving your data, none of that cloud storage shiz.
    +1
  • AncientBoi @ AncientBoi:
    [squeezes @SylverReZ onto a physical media, then archives you in my old stuff box] :tpi::rofl2::tpi:
    +1
    SylverReZ @ SylverReZ: @AncientBoi, Lmao +1