Homebrew Homebrew Development

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 how IR service works with ctrulib? (For example: https://github.com/smealum/ctrulib/blob/master/libctru/include/3ds/services/ir.h what flag is for RecvData).

I tried to write a simple string sender/receiver without success. These are the functions i wrote to test but i get no data received:
Code:
static int lua_receive(lua_State *L){
    int argc = lua_gettop(L);
    if (argc != 0) return luaL_error(L, "wrong number of arguments");
    char result[2048];
    u32 received_bytes = 0;
    while (received_bytes == 0){
        IRU_RecvData((u8*)&result, 2048, 0x00, &received_bytes, 1);
    }
    u32 confirm = 0xDEAD;
    IRU_SendData((u8*)confirm, 4, 1);
    lua_pushlstring(L,result,received_bytes);
    return 1;
}
 
static int lua_send(lua_State *L){
    int argc = lua_gettop(L);
    if (argc != 1) return luaL_error(L, "wrong number of arguments");
    const char *data = luaL_checkstring(L, 1);
    u32 result = 0x0000;
    u32 received_bytes;
    while (result != 0xDEAD){
        IRU_SendData((u8*)data, strlen(data), 1);
        IRU_RecvData((u8*)&result, 4, 0x00, &received_bytes, 1);
    }
    return 0;
}
 

Suiginou

(null)
Member
Joined
Jun 26, 2012
Messages
565
Trophies
0
Location
pc + 8
XP
738
Country
Gambia, The
Code:
u32 pid;
svcGetProcessId(&pid, 0xFFFF8001);

svcGetProcessId is defined by ctrulib and gets linked in:

Code:
.global svcGetProcessId
.type svcGetProcessId, %function
svcGetProcessId:
	str r0, [sp, #-0x4]!
	svc 0x35
	ldr r3, [sp], #4
	str r1, [r3]
	bx  lr

The code freezes at the svcGetProcessId call if run from spider LoadCode. Any hints as to what might be going wrong?
 

Marco D

Well-Known Member
Newcomer
Joined
Mar 26, 2015
Messages
66
Trophies
0
Age
38
Location
Queretaro
XP
216
Country
Mexico

Arisotura

rise of melonism
Member
Joined
Dec 5, 2009
Messages
839
Trophies
1
Age
30
Location
center of the Sun
Website
kuribo64.net
XP
2,498
Country
France
Has anyone looked into using CTRAging's exheader for Gateway (.3ds) homebrew? It has access to CSND, as well as all the services you need for sane userland homebrew. The parameters are that of a regular application, so the home menu shouldn't throw it out, either.

I guess it'd be nice to get a New3DS CTRAging, though. That would have access to the New3DS-specific services.
 

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
Has anyone looked into using CTRAging's exheader for Gateway (.3ds) homebrew? It has access to CSND, as well as all the services you need for sane userland homebrew. The parameters are that of a regular application, so the home menu shouldn't throw it out, either.

I guess it'd be nice to get a New3DS CTRAging, though. That would have access to the New3DS-specific services.

Don't know what CTRAging is but lpp-3ds is compiled in .3ds build with ns:s, am:u and csnd:SND services access. ( https://github.com/Rinnegatamante/lpp-3ds/blob/master/gw_workaround.rsf )
 

daxtsu

Well-Known Member
Member
Joined
Jun 9, 2007
Messages
5,627
Trophies
2
XP
5,194
Country
Antarctica

Arisotura

rise of melonism
Member
Joined
Dec 5, 2009
Messages
839
Trophies
1
Age
30
Location
center of the Sun
Website
kuribo64.net
XP
2,498
Country
France
Yeah. I was able to recover it from a dump of my NAND. The code is partially corrupted though, but the exheader is intact.


Didn't know it was possible to get around the signed exheader requirement for .3ds files, though. Interesting.
 

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
Yeah. I was able to recover it from a dump of my NAND. The code is partially corrupted though, but the exheader is intact.


Didn't know it was possible to get around the signed exheader requirement for .3ds files, though. Interesting.

As said also in Legohax thread, you just have to modify Descriptor in your workaround. It's encoded as a BASE64 string.
You can also use an online converter to have the exheader you're usual to see ( http://www.motobit.com/util/base64-decoder-encoder.asp ).
 

daxtsu

Well-Known Member
Member
Joined
Jun 9, 2007
Messages
5,627
Trophies
2
XP
5,194
Country
Antarctica
Didn't know it was possible to get around the signed exheader requirement for .3ds files, though. Interesting.


The only weird thing right now is that Gateway doesn't seem to allow for access to the IR services needed for the C-Stick and ZL/ZR buttons, even if you have the correct Base64 string (can't test with 3.2.1 right now, as my LL is disassembled for a NAND mod, but I can confirm for 3.1, and 3.1.1 that it didn't work).
 

MeisterFenster

Well-Known Member
Member
Joined
Nov 18, 2014
Messages
168
Trophies
0
Age
28
XP
165
Country
Gambia, The
I cant get FBI to compile, I always get

Code:
no such file or directionary
#include 3ds.h

other projects are fine, it is just this and the ntr plugins. Any ideas?

Edit: I have set all the environment variables
 

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
Is it possible to simulate POWER button pressure? I'm trying with this piece of code but i get an Home Menu return instead of Shutdown Menu launch:

Code:
static int lua_exit(lua_State *L)
{
    int argc = lua_gettop(L);
    if (argc != 0) return luaL_error(L, "wrong number of arguments");
 
    aptOpenSession();
    APT_ReplySleepQuery(NULL, currentAppId, 0x0);
    aptCloseSession();
    aptSetStatusPower(1);
    aptSetStatus(APP_SUSPENDING);
    aptReturnToMenu();
   
    // This is used for lpp-3ds shutdown
    char string[20];
    strcpy(string,"lpp_exit_0456432");
    return luaL_error(L, string); // NOTE: This is a fake error
 
}
 
  • Like
Reactions: Idaho

daxtsu

Well-Known Member
Member
Joined
Jun 9, 2007
Messages
5,627
Trophies
2
XP
5,194
Country
Antarctica
You need to fiddle around with stripping the elf you get and then using makerom. Or just use the fork of SteveIce's homebrew template I made, which has everything needed already (minus the ctrcommon dependency): https://github.com/thedax/3DSHomebrewTemplate

You just type make it and spits out a CIA for your program. If you mean turning other peoples' homebrew into CIA, well, take a peek inside the template makefile, and you'll see what to pass to makerom.
 

KazoWAR

Well-Known Member
Member
Joined
Aug 12, 2008
Messages
1,952
Trophies
1
Age
35
Location
Winter Haven
XP
2,130
Country
United States
You need to fiddle around with stripping the elf you get and then using makerom. Or just use the fork of SteveIce's homebrew template I made, which has everything needed already (minus the ctrcommon dependency): https://github.com/thedax/3DSHomebrewTemplate

You just type make it and spits out a CIA for your program. If you mean turning other peoples' homebrew into CIA, well, take a peek inside the template makefile, and you'll see what to pass to makerom.

i tried using the 3DSHombrewTemplate, it builds find. the 3dsx runs in citra perfectly, but the cia just boots to black screen. if it makes a difference, i am using sf2dlib and 4.X CFW.
 

TheCruel

Developer
Banned
Joined
Dec 6, 2013
Messages
1,350
Trophies
2
XP
3,131
Country
United States
How do you support app suspension using ctrulib? It seems to always screw up memory allocation (or something similar) and all textures and such disappear. Do you have to reinitialize some things (e.g. GPU)?
 

Site & Scene News

Popular threads in this forum

General chit-chat
Help Users
  • BakerMan
    I rather enjoy a life of taking it easy. I haven't reached that life yet though.
  • Xdqwerty
    what are you looking at?
    BakerMan @ BakerMan: