Homebrew Homebrew Development

MasterFeizz

Well-Known Member
Member
Joined
Oct 15, 2015
Messages
1,098
Trophies
1
Age
29
XP
3,710
Country
United States
Hello
I am trying to follow this guide on my Mac OS X.

Code:
Install devkitPro w/ devkitARM[edit]
DevkitPro is an essential set of toolchains for homebrew development.

Linux / Mac OSX[edit]
1) Download the devkitPro perl script

2) Download the latest ctrulib from GitHub. Place the ctrulib folder in the same location as the perl script

3) Open a terminal and execute these commands:

cd /path/to/the/script
chmod +x devkitARMupdate.pl
sudo ./devkitARMupdate.pl /opt/devkitPro
echo "export DEVKITPRO=/opt/devkitPro" >> ~/.bashrc
echo "export DEVKITARM=\$DEVKITPRO/devkitARM" >> ~/.bashrc
echo "export PATH=\$PATH:\$DEVKITARM/bin" >> ~/.bashrc
source ~/.bashrc
cd ctrulib/libctru
make
sudo -E make install

Don't use sudo and don't install it to /opt/devkitPro, install it on your home folder or somewhere else.($HOME/devkitPro)
And you need to clone ctrulib from the repo.
 

elhobbs

Well-Known Member
Member
Joined
Jul 28, 2008
Messages
1,044
Trophies
1
XP
3,033
Country
United States
Solved few seconds ago by replacing LUA_NUMBER pushes/checks to LUA_INTEGER ones (it looks like using LUA_NUMBER as type returns a pretty huge value (like 5*10^9) and adding low values like A button id was not enough to change the value). Now it works good.

https://github.com/Rinnegatamante/lpp-3ds/commit/0e23a7c19428d27eac61429d8dead38443f2f52b

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

Here's another problem, is it correct to execute an http request in this way with http:c service?

Code:
static int lua_download(lua_State *L){
   int argc = lua_gettop(L);
   #ifndef SKIP_ERROR_HANDLING
     if (argc != 2) return luaL_error(L, "wrong number of arguments");
   #endif
   const char* url = luaL_checkstring(L,1);
   const char* file = luaL_checkstring(L,2);
   httpcContext context;
   Result ret = httpcOpenContext(&context, (char*)url , 0);
   #ifndef SKIP_ERROR_HANDLING
     if(ret==0){
   #endif
     httpcBeginRequest(&context);
     HTTPC_RequestStatus loading;
     httpcGetRequestState(&context, &loading);
     while (loading == HTTPC_STATUS_REQUEST_IN_PROGRESS){
       httpcGetRequestState(&context, &loading);
     }
     u32 statuscode=0;
     u32 contentsize=0;
     httpcGetResponseStatusCode(&context, &statuscode, 0);
     #ifndef SKIP_ERROR_HANDLING
       if (statuscode != 200) luaL_error(L, "download request error");
     #endif
     httpcGetDownloadSizeState(&context, NULL, &contentsize);
     u8* buf = (u8*)malloc(contentsize);
     memset(buf, 0, contentsize);
     httpcDownloadData(&context, buf, contentsize, NULL);
     Handle fileHandle;
     u32 bytesWritten;
     FS_Archive sdmcArchive=(FS_Archive){ARCHIVE_SDMC, (FS_Path){PATH_EMPTY, 1, (u8*)""}};
     FS_Path filePath=fsMakePath(PATH_ASCII, file);
     FSUSER_OpenFileDirectly( &fileHandle, sdmcArchive, filePath, FS_OPEN_CREATE|FS_OPEN_WRITE, 0x00000000);
     FSFILE_Write(fileHandle, &bytesWritten, 0, buf, contentsize,0x10001);
     FSFILE_Close(fileHandle);
     svcCloseHandle(fileHandle);
     free(buf);
   #ifndef SKIP_ERROR_HANDLING
     }else luaL_error(L, "error opening url");
   #endif
   httpcCloseContext(&context);
   return 0;
}

I'm trying to take info from a PHP script (for example this one: http://188.166.72.241/3dsthem.es/api?json&popular ) but the downloaded file is alwyas 0 byte (function doesn't return errors). [the same function works good for HTML files and downloadable contents (rar, zip and similar files)]
Can you sniff the packet to see if it is returning data? Particularly is the service correctly setting the size?
 

Cloud9Skywalker

Pokémon Researcher
Member
Joined
Mar 26, 2015
Messages
280
Trophies
0
XP
501
Country
United States
Don't use sudo and don't install it to /opt/devkitPro, install it on your home folder or somewhere else.($HOME/devkitPro)
And you need to clone ctrulib from the repo.

So do I only erase Sudo or do I replace it with another command?
I wasn't sure what to do with Sudo so I just left it in the code.
I am new to using Macs so I don't know how to list directory paths accurately.

This is what I have so far:
Code:
cd Users/alexandergonzalez/Downloads
chmod +x devkitARMupdate.pl
sudo ./devkitARMupdate.pl $HOME/devkitPro
echo "export DEVKITPRO=$HOME/devkitPro" >> ~/.bashrc
echo "export DEVKITARM=\$DEVKITPRO/devkitARM" >> ~/.bashrc
echo "export PATH=\$PATH:\$DEVKITARM/bin" >> ~/.bashrc
source ~/.bashrc
cd ctrulib/libctru
make
sudo -E make install

Code:
I did download ctrulib I have ctrulib-1.1.0 it's in the Downloads Folder along with devkitARMupdate.pl
 
Last edited by Cloud9Skywalker,

MasterFeizz

Well-Known Member
Member
Joined
Oct 15, 2015
Messages
1,098
Trophies
1
Age
29
XP
3,710
Country
United States
So do I only erase Sudo or do I replace it with another command?
I wasn't sure what to do with Sudo so I just left it in the code.
I did download ctrulib I have ctrulib-1.1.0 it's in the Downloads Folder along with devkitARMupdate.pl
Just erase sudo, or else you will need super user permission to write to devkitpro folder.
Code:
cd Users/alexandergonzalez/Downloads
chmod +x devkitARMupdate.pl
./devkitARMupdate.pl $HOME/devkitPro
echo "export DEVKITPRO=$HOME/devkitPro" >> ~/.bash_profile
echo "export DEVKITARM=\$DEVKITPRO/devkitARM" >> ~/.bash_profile
echo "export PATH=\$PATH:\$DEVKITARM/bin" >> ~/.bash_profile
source ~/.bash_profile
cd ~
git clone https://github.com/smealum/ctrulib.git
cd ctrulib/libctru
make
make install
 

Cloud9Skywalker

Pokémon Researcher
Member
Joined
Mar 26, 2015
Messages
280
Trophies
0
XP
501
Country
United States
Just erase sudo, or else you will need super user permission to write to devkitpro folder.
Code:
cd Users/alexandergonzalez/Downloads
chmod +x devkitARMupdate.pl
./devkitARMupdate.pl $HOME/devkitPro
echo "export DEVKITPRO=$HOME/devkitPro" >> ~/.bash_profile
echo "export DEVKITARM=\$DEVKITPRO/devkitARM" >> ~/.bash_profile
echo "export PATH=\$PATH:\$DEVKITARM/bin" >> ~/.bash_profile
source ~/.bash_profile
cd ~
git clone https://github.com/smealum/ctrulib.git
cd ctrulib/libctru
make
make install

I am getting a couple of errors.
No such file or directory but that directory does exist.
and
make: *** No rule to make target

Code:
Last login: Sat Jan  9 15:09:25 on ttys001
AlexandersMacBookPro:~ alexandergonzalez$ cd Users/alexandergonzalez/Downloads
-bash: cd: Users/alexandergonzalez/Downloads: No such file or directory
AlexandersMacBookPro:~ alexandergonzalez$ chmod +x devkitARMupdate.pl
chmod: devkitARMupdate.pl: No such file or directory
AlexandersMacBookPro:~ alexandergonzalez$ ./devkitARMupdate.pl $HOME/devkitPro
-bash: ./devkitARMupdate.pl: No such file or directory
AlexandersMacBookPro:~ alexandergonzalez$ echo "export DEVKITPRO=$HOME/devkitPro" >> ~/.bash_profile
AlexandersMacBookPro:~ alexandergonzalez$ echo "export DEVKITARM=\$DEVKITPRO/devkitARM" >> ~/.bash_profile
AlexandersMacBookPro:~ alexandergonzalez$ echo "export PATH=\$PATH:\$DEVKITARM/bin" >> ~/.bash_profile
AlexandersMacBookPro:~ alexandergonzalez$ source ~/.bash_profile
AlexandersMacBookPro:~ alexandergonzalez$ cd ~
AlexandersMacBookPro:~ alexandergonzalez$ git clone https://github.com/smealum/ctrulib.git
Cloning into 'ctrulib'...
remote: Counting objects: 11148, done.
remote: Total 11148 (delta 0), reused 0 (delta 0), pack-reused 11148
Receiving objects: 100% (11148/11148), 6.29 MiB | 952.00 KiB/s, done.
Resolving deltas: 100% (8201/8201), done.
Checking connectivity... done.
AlexandersMacBookPro:~ alexandergonzalez$ cd ctrulib/libctru
AlexandersMacBookPro:libctru alexandergonzalez$ make
Makefile:9: /Users/alexandergonzalez/devkitPro/devkitARM/base_rules: No such file or directory
make: *** No rule to make target `/Users/alexandergonzalez/devkitPro/devkitARM/base_rules'.  Stop.
AlexandersMacBookPro:libctru alexandergonzalez$ make install
 

MasterFeizz

Well-Known Member
Member
Joined
Oct 15, 2015
Messages
1,098
Trophies
1
Age
29
XP
3,710
Country
United States
I am getting a couple of errors.
No such file or directory but that directory does exist.
and
make: *** No rule to make target
You are not using the right path to the download folder
try
Code:
cd ~/Downloads
or
Code:
cd $HOME/Downloads

Edit: you forgot the forward slash in front of "Users/alexandergonzalez/Downloads", it should actually be "/Users/alexandergonzalez/Downloads"
 
Last edited by MasterFeizz,

Cloud9Skywalker

Pokémon Researcher
Member
Joined
Mar 26, 2015
Messages
280
Trophies
0
XP
501
Country
United States
Perfect! I got it working all the files where installed and are now up to date. Thanks Everyone.

So if I want to start compiling sources once I download the Source zip where do I place the projects to be compiled?
 

zoogie

playing around in the end of life
Developer
Joined
Nov 30, 2014
Messages
8,560
Trophies
2
XP
15,000
Country
Micronesia, Federated States of
Why does a black screen appear awhen we brick our 3ds instead of a blue screeen??
https://3dbrew.org/wiki/Bootloader#Boot_Procedure

When you power on, if the bootloader can't read FIRM0 or it fails signature checks, it will load and check FIRM1. If that fails, you get the blue screen. You can also get the blue screen if the bootloader can't read the NAND chip at all for whatever reason (like wiring it to a sd adapter or getting it wet).

The black screen is due to any number of other system titles being corrupted (or mismatched versions) causing the 3ds to halt while booting up. There's dozens of them so plenty of ways things can go wrong if they're installed incorrectly (i.e hacky downgrades).

FYI - The actual FIRMs are only 4MBs each while the rest of the 3ds OS is about 200-300MBs.
 
Last edited by zoogie,

Rinnegatamante

Well-Known Member
Member
Joined
Nov 24, 2014
Messages
3,162
Trophies
2
Age
29
Location
Bologna
Website
rinnegatamante.it
XP
4,857
Country
Italy
Does someone know why CIA files installation seems to work only on 3DS/CIA builds in my interpreter?
Even if i launch a legit CIA installation on a 4.5 system with Ninjhax 1.1b (and libkhax for privilege escalation), nothing gets installed.
This is what lpp-3ds execute when a cia installation is called (libkhax init is called in main.cpp) : https://github.com/Rinnegatamante/l...53ea7b6478e0/source/luaSystem.cpp#L1062-L1109
 

Rinnegatamante

Well-Known Member
Member
Joined
Nov 24, 2014
Messages
3,162
Trophies
2
Age
29
Location
Bologna
Website
rinnegatamante.it
XP
4,857
Country
Italy
Does someone knows why in this part of code, i stays at 0 and size increases? It shouldn't be reverse? O.o

Code:
u64 i = 0;
     char* cia_buffer;
     while (i < size){
       u64 bytesToRead;
       if   (i+MAX_RAM_ALLOCATION > size){
         cia_buffer = (char*)(malloc((size-i) * sizeof(char)));
         bytesToRead = size - i;
       }else{
         cia_buffer = (char*)(malloc((MAX_RAM_ALLOCATION) * sizeof(char)));
         bytesToRead = MAX_RAM_ALLOCATION;
       }
       FSFILE_Read(fileHandle, &bytes, i, cia_buffer, bytesToRead);
       FSFILE_Write(ciaHandle, &bytes, i, cia_buffer, bytesToRead, 0);
       printf("%i / %i\n",i, size);
       i = i + bytesToRead;
       free(cia_buffer);
     }
 

elhobbs

Well-Known Member
Member
Joined
Jul 28, 2008
Messages
1,044
Trophies
1
XP
3,033
Country
United States
Does someone knows why in this part of code, i stays at 0 and size increases? It shouldn't be reverse? O.o

Code:
u64 i = 0;
     char* cia_buffer;
     while (i < size){
       u64 bytesToRead;
       if   (i+MAX_RAM_ALLOCATION > size){
         cia_buffer = (char*)(malloc((size-i) * sizeof(char)));
         bytesToRead = size - i;
       }else{
         cia_buffer = (char*)(malloc((MAX_RAM_ALLOCATION) * sizeof(char)));
         bytesToRead = MAX_RAM_ALLOCATION;
       }
       FSFILE_Read(fileHandle, &bytes, i, cia_buffer, bytesToRead);
       FSFILE_Write(ciaHandle, &bytes, i, cia_buffer, bytesToRead, 0);
       printf("%i / %i\n",i, size);
       i = i + bytesToRead;
       free(cia_buffer);
     }
Just a print issue. Format i as %lld since it is 64 bit.
 
  • Like
Reactions: Rinnegatamante

s0r00t

Active Member
Newcomer
Joined
Jan 6, 2016
Messages
42
Trophies
0
XP
110
Country
France
I really don't know if it's the good place to ask for that, but couldn't find a more suitable section :

Does anyone have the source code of the fixcrc.exe program used for CFL_DB.dat editing?
This program can be found here.

Tried analysing it with IDA Free, but it's quite hard, moreover I'm on Linux, making things worse.
 

Spaqin

Well-Known Member
Member
Joined
Feb 17, 2015
Messages
123
Trophies
0
Age
29
XP
199
Country
Poland
If I want to use a mutex, should I use svcCreateMutex, or LightLock?
And for the first one, is it like:
Code:
svcWaitSynchronization(mutex, U64_MAX);
//do thread critical stuff here
svcReleaseMutex(mutex);
or is it something different?
 

Rinnegatamante

Well-Known Member
Member
Joined
Nov 24, 2014
Messages
3,162
Trophies
2
Age
29
Location
Bologna
Website
rinnegatamante.it
XP
4,857
Country
Italy
  • Like
Reactions: Spaqin

AileenLumina

Python main, software engineer and API designer
Member
Joined
Sep 27, 2015
Messages
631
Trophies
0
Age
26
XP
614
Country
Germany
Hello :)

I tried to build a little homebrew tool but I wasn't able to do it. (If you're asking for what I've written so far: It's 100% trash coz I seem to be trash at this. ^^' ) The tool should read sdmc:\CFWKIT_VERSION.TXT. This .txt file includes a version number. The file looks like this:

Code:
4.001

The program should read this .txt file, then cast the string it contains into a float (let's say the float is named installedVersion). Then it should read http: //aidanlumina.bplaced.com/files/CFWKIT_VERSION.txt
Code:
4.005
, cast the string it contains into another float (onlineVersion) and compare that with installedVersion.
If onlineVersion is equal to installedVersion, it should display on-screen
You have the latest version installed on your system. :)
If onlineVersion (rounded down) is bigger than installedVersion (rounded down), it should display
You need to get the latest version of the 3DS CFW Kit manually.
If onlineVersion (not rounded) is bigger than installedVersion(not rounded), it should do the following onlineVersion - installedVersion * 1000 times (so, in this example 4 times):
Code:
Display "Downloading update V(4.002, then 4.003, then 4.004 and finally 4.005 in this example)... "
Download http: //aidanlumina.bplaced.com/files/upd/V(4.002/4.003/4.004/4.005 in this example, you get the idea ;) ).bin
Add "OK!" to the displayed line, then jump to the next line
These .bin files are ZIP files that were converted to .bin using that starterGen .bat included in the latest build of EmuNAND9 by d0k3. After the program has downloaded all the .bin files, it should extract them to sdmc:\ one by one (see 3DSZIPFX source code by d0k3 for how-to).

I HOPE you understand everything above. I would LOVE if someone takes the time and tries to implement this tool. :D I hope it's alright to post a request here. I will post it on gbatemp too if that's okay. :)

Thanks for reading! :)

Edit: Oh, and some info for the .smdh file:
Title: 3CKU
Description: 3DS CFW Kit Updater
Authors: [Your_Name], d0k3 (for 3DSZIPFX) AidanLumina (for the algorithm and the idea... Maybe? Please ^^)
 

Site & Scene News

Popular threads in this forum

General chit-chat
Help Users
  • No one is chatting at the moment.
    ZeroT21 @ ZeroT21: horny jail is full la