Homebrew Infra Red Resource Thread

Would you like to see development for IR homebrew (CPP or not) on the 3ds?

  • Yes, and I have the CPP!

    Votes: 40 19.1%
  • Yes, why not!

    Votes: 164 78.5%
  • No.

    Votes: 5 2.4%

  • Total voters
    209

VegaRoXas

Well-Known Member
Member
Joined
Mar 29, 2015
Messages
290
Trophies
0
XP
378
Country
Gambia, The
I don't have that game, sorry (It's like a hackers dream, and I don't have it! Gah!)... Someone else should give it a shot!

Edit: The main post should now reflect the current status of the project! I am now off to github, whoo!
You forgot Dead or Alive Dimensions.
 

daxtsu

Well-Known Member
Member
Joined
Jun 9, 2007
Messages
5,627
Trophies
2
XP
5,194
Country
Antarctica
We'd have to do all of the testing again, but we should try for ir:USER too (I'm modifying the original test now, almost done). Games like Majora's Mask and MH3/MH4 should have access to it, considering they can use the CPP.

Edit: Yeah, had no problems getting Majora's Mask to get a handle to ir:USER. Only problem is, ir:USER is pretty much completely undocumented.
 
Last edited by daxtsu,
  • Like
Reactions: VegaRoXas

RedHat

Well-Known Member
OP
Member
Joined
Oct 10, 2015
Messages
235
Trophies
0
Location
Mii Plaza
Website
github.com
XP
376
Country
United States
We'd have to do all of the testing again, but we should try for ir:USER too (I'm modifying the original test now, almost done). Games like Majora's Mask and MH3/MH4 should have access to it, considering they can use the CPP.
What is weird with both of the MH games is that when you try to launch them, the graphics get all weird (they never even initialize and I am certain that it is not my code)... Nothing is displayed on the bottom screen and the top screen goes nuts. Then, when you quit, homebrew launcher crashes and the 3DS must be powered off. Others might have to try to confirm this, however.

Yes, we should totally try ir:USER.

And, if you get a chance, either post your repository here and/or try and merge it with mine, either works.
 

Megalegacy98

Well-Known Member
Member
Joined
Aug 11, 2015
Messages
505
Trophies
0
Location
United States
XP
430
Country
United States
I was thinking; since OOT and CN were the only things that worked, and those games are both used for exploits, maybe it works for those only because the exploit installed in it gives another homebrew more permissions or something?

This is probably far from right, but hey I could be on to something
 

VegaRoXas

Well-Known Member
Member
Joined
Mar 29, 2015
Messages
290
Trophies
0
XP
378
Country
Gambia, The
What is weird with both of the MH games is that when you try to launch them, the graphics get all weird (they never even initialize and I am certain that it is not my code)... Nothing is displayed on the bottom screen and the top screen goes nuts. Then, when you quit, homebrew launcher crashes and the 3DS must be powered off. Others might have to try to confirm this, however.

Yes, we should totally try ir:USER.

And, if you get a chance, either post your repository here and/or try and merge it with mine, either works.
Same happens for example with acnl.
 

VegaRoXas

Well-Known Member
Member
Joined
Mar 29, 2015
Messages
290
Trophies
0
XP
378
Country
Gambia, The
I was thinking; since OOT and CN were the only things that worked, and those games are both used for exploits, maybe it works for those only because the exploit installed in it gives another homebrew more permissions or something?

This is probably far from right, but hey I could be on to something
It also works with themehax, so I don't think it's because of that.
 

daxtsu

Well-Known Member
Member
Joined
Jun 9, 2007
Messages
5,627
Trophies
2
XP
5,194
Country
Antarctica
And, if you get a chance, either post your repository here and/or try and merge it with mine, either works.

I mostly just commented out the ir:u stuff and slipped in some ir:USER stuff (I had to improvise a little, since ctrulib doesn't have ir:USER code yet). You also forgot a free for the irmemloc block, so I inserted one down at the end, commented out.

Code:
#include <stdlib.h>
#include <string.h>
#include <malloc.h>
#include <setjmp.h>

#include <3ds.h>

#include "drawing.h"

static jmp_buf exitJmp;
// u32 *irmemloc;
// Result Startup;
Result irUSERStartup;
Result SetIR;
int frame = 0; // if the framerate is 60, every time we hit 60, 1 second has passed. 

Handle irUSERHandle = 0;

Result irUserInit()
{
    return srvGetServiceHandle(&irUSERHandle, "ir:USER");
}

void irUserExit()
{
    if (irUSERHandle)svcCloseHandle(irUSERHandle);
}

void hang(char *message) {
    while(aptMainLoop()) {
        hidScanInput();
       
        clearScreen();
        drawString(10, 10, "%s", message);
        drawString(10, 20, "Start and Select to exit");
       
        u32 kHeld = hidKeysHeld();
        if((kHeld & KEY_START) && (kHeld & KEY_SELECT)) longjmp(exitJmp, 1);
       
        gfxFlushBuffers();
        gspWaitForVBlank();
        gfxSwapBuffers();
    }
}

int main(void) {
    //irmemloc = (u32*) malloc(0x1000);
    //Startup = IRU_Initialize(irmemloc, 0x1000);
    irUSERStartup = irUserInit();
    srvInit();        // services
    aptInit();        // applets
    hidInit(NULL);    // input
    gfxInitDefault(); // gfx
   
    gfxSetDoubleBuffering(GFX_TOP, true);
    gfxSetDoubleBuffering(GFX_BOTTOM, true);
   
    if(setjmp(exitJmp)) goto exit;
   
    clearScreen();
    gfxFlushBuffers();
    gfxSwapBuffers();
   
    while(aptMainLoop()) {
        hidScanInput();
        irrstScanInput();
       
        u32 kHeld = hidKeysHeld();
        circlePosition circlePad;
        circlePosition cStick;
        //circlePosition circlePadPro;
        u8 vol8;
        u8* volp = &vol8;
        hidCstickRead(&cStick);
        hidCircleRead(&circlePad);
        HIDUSER_GetSoundVolume(volp);
        touchPosition touch;
        touchRead(&touch);
       
        clearScreen();
       
        char keys[30] = "ABXY URDL SEST LR ZLZR";
       
        if(kHeld & KEY_A) {
            keys[0] = '*';
        }
        if(kHeld & KEY_B) {
            keys[1] = '*';
        }
        if(kHeld & KEY_X) {
            keys[2] = '*';
        }
        if(kHeld & KEY_Y) {
            keys[3] = '*';
        }
        if(kHeld & KEY_DUP) {
            keys[5] = '*';
        }
        if(kHeld & KEY_DRIGHT) {
            keys[6] = '*';
        }
        if(kHeld & KEY_DDOWN) {
            keys[7] = '*';
        }
        if(kHeld & KEY_DLEFT) {
            keys[8] = '*';
        }
        if(kHeld & KEY_SELECT) {
            keys[10] = '*';
            keys[11] = '*';
        }
        if(kHeld & KEY_START) {
            keys[12] = '*';
            keys[13] = '*';
        }
        if(kHeld & KEY_L) {
            keys[15] = '*';
        }
        if(kHeld & KEY_R) {
            keys[16] = '*';
        }
        if(kHeld & KEY_ZL) {
            keys[18] = '*';
            keys[19] = '*';
        }
        if(kHeld & KEY_ZR) {
            keys[20] = '*';
            keys[21] = '*';
        }
        drawString(10, 10, keys);
        drawString(10, 20, "Volume: %d", vol8);
        drawString(10, 30, "Circle Pad   x: %04+d, y: %04+d", circlePad.dx, circlePad.dy);
        drawString(10, 40, "CStick (new) x: %04+d, y: %04+d", cStick.dx, cStick.dy );
        drawString(10, 50, "CPadPr (old) x: NaN , y: NaN", cStick.dx, cStick.dy );
        drawString(10, 60, "Touch        x: %04d, y: %04d", touch.px, touch.py );
        drawString(10, 70, "ir:USER Init  Error: %x", irUSERStartup);
        drawString(10, 80, "IR I/O   Error: %x", SetIR);
        frame++;
        if(frame == 60) {
            frame = 0;
        }
        if(frame == 58 || frame == 59) {
            SetIR = IRU_SetIRLEDState(0x1);
            drawString(10, 90, "IR state:*");
        } else {
            SetIR = IRU_SetIRLEDState(0x0);
            drawString(10, 90, "IR state:");
        }
       
        drawString(10, 220, "Start + Select to exit.");

       
        if((kHeld & KEY_START) && (kHeld & KEY_SELECT)) longjmp(exitJmp, 1);
       
        gfxFlushBuffers();
        gspWaitForVBlank();
        gfxSwapBuffers();
    }
   
    exit:
   
    //IRU_Shutdown();
    //free(irmemloc);
    irUserExit();
    gfxExit();
    hidExit();
    aptExit();
    srvExit();
   
    return 0;
}
 

Attachments

  • CPPTest.zip
    49.7 KB · Views: 89

teampleb

BAH! DED! X_X
Banned
Joined
Aug 26, 2015
Messages
2,066
Trophies
0
Age
27
Location
Pennsylvania
XP
1,280
Country
United States
I tried quite a few on Ironhax.
Music app:
Fail
Camera app: Fail
eShop: Fail
AR Games: Fail
Settings: Fail
Pokemon Shuffle: Fail
Pokemon Rumble World: Fail
The Last Ranger: Fail
Flipnote Studio 3D: Fail
Steamworld Dig: Fail
Steel Diver Sub Wars: Fail
Crashmo: Fail
2Fast4Gnomz: Fail

I will try more later.
 
Last edited by teampleb,

RedHat

Well-Known Member
OP
Member
Joined
Oct 10, 2015
Messages
235
Trophies
0
Location
Mii Plaza
Website
github.com
XP
376
Country
United States
You also forgot a free for the irmemloc block
Shoot! I thought it did that on return 0! I am a Java programmer, guess I am used to garbage collectors :/

I tried quite a few on Ironhax.
Music app:
Fail
Camera app: Fail
eShop: Fail
AR Games: Fail
Settings: Fail
Pokemon Shuffle: Fail
Pokemon Rumble World: Fail
The Last Ranger: Fail
Flipnote 3D: Fail
Steamworld Dig: Fail
Steel Diver Sub Wars: Fail
Crashmo: Fail
2Fast4Gnomz: Fail

Thank you so much! I hope we don't end with just 3-4 games at this point...
 

daxtsu

Well-Known Member
Member
Joined
Jun 9, 2007
Messages
5,627
Trophies
2
XP
5,194
Country
Antarctica
Shoot! I thought it did that on return 0! I am a Java programmer, guess I am used to garbage collectors :/

Depending on the operating system, it *might* free used memory nicely for you at application exit, but in C, you should never assume that memory is auto-freed.
 

VegaRoXas

Well-Known Member
Member
Joined
Mar 29, 2015
Messages
290
Trophies
0
XP
378
Country
Gambia, The
Oh, I'm on n3DS 10.1 with Ironhax BTW. I'm just testing if the IR port turns on. :)
You won't have to test the standard titles (e.g. camera, ar games, music etc). They don't work.
At least on a 2ds they don't. But since we are on the same fw it shouldn't work for you either.
 

Site & Scene News

Popular threads in this forum

General chit-chat
Help Users
    K3Nv2 @ K3Nv2: https://youtu.be/owEOnspRpVk?si=rEd1m4Yi0aTKvjiv