Homebrew Infra Red Resource Thread

  • Thread starter Thread starter RedHat
  • Start date Start date
  • Views Views 63,849
  • Replies Replies 226
  • Likes Likes 10

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

  • Yes, and I have the CPP!

    Votes: 41 19.2%
  • Yes, why not!

    Votes: 167 78.4%
  • No.

    Votes: 5 2.3%

  • Total voters
    213
For the life of me, I cannot even get it to build. I'm going to put up what I edited into the main.c file here in case anyone wants to check it, but keep in my I have next to zilch coding experience and I wouldn't be surprised if I was doing something colossally wrong.

Lines 155 - 167
if((kHeld & KEY_X) && (kHeld & KEY_Y)) {
drawString(10, 110, "Sending IR signal...");
IRU_SendData(u8 *0, u32 0, u32 0);
} else {
drawString(10, 110, "Hold X & Y to send IR signal.");
}

if((kHeld & KEY_A) && (kHeld & KEY_B)) {
drawString(10, 120, "Receiving IR signal...");
IRU_RecvData(u8 *0, u32 0, u8 0, u32 *0, u32 0);
} else {
drawString(10, 120, "Hold A & B to send IR signal.");
}

Just remove the IRU_ parts of it and at least you have a structure for putting in sending and receiving.
 
Last edited by Pandaxclone2,
For the life of me, I cannot even get it to build. I'm going to put up what I edited into the main.c file here in case anyone wants to check it, but keep in my I have next to zilch coding experience and I wouldn't be surprised if I was doing something colossally wrong.

Lines 155 - 167

IRU_SendData(u8 *0, u32 0, u32 0); <- That function expects a buffer of data, a size, and a waiting duration, and you're not really passing the values in correctly. Try something more like this:

Code:
const size_t bufferSize = 4096;
u8* buffer = malloc(bufferSize);
const u32 wait = 100;
if(buffer != NULL)
{
    IRU_SendData(buffer, bufferSize, wait);
}
free(buffer);

That on its own will just try to send a 4KB block of memory with nothing but garbage in it (unless the 3DS OS is nice and gives you a buffer of zeroes, but I doubt it). But yeah, to pass parameters, you don't have to put the type in front of it, you just pass the values in directly (such as func(0, 0, 0), not func(u32 0, u32 0, u32 0) when it's a pointer (e.g. u8 *)) you should use a variable since it's a lot easier.
 
Last edited by daxtsu,
Kinda nearly lost the plot there but I think I understand what you're saying. So the first three lines is the data you are going to send and you just call that into the IRU_SendData, right?

I assume you ask for the same data when receiving, or is it different?
 
Kinda nearly lost the plot there but I think I understand what you're saying. So the first three lines is the data you are going to send and you just call that into the IRU_SendData, right?

I assume you ask for the same data when receiving, or is it different?

It would depend on whatever you're expecting to receive (for example, it'd be different if you were trading Pokémon. One 3DS would send one monster, and the other would send a different one). You might be sending the same data back and forth if you were trying to identify if the thing you're sending IR data to is another 3DS, for example (in other words, a handshake).
 
That's where it begins to get a bit tricky. You'd probably have to start coming up with your own custom data "packets" of sorts. For example, you could add a checksum of some sort to the end of your buffer, and then on the 3DS that receives the data, calculate the checksum on the incoming data, and compare it to the checksum that was sent. If they match, you could send a signal back to the other 3DS to let it know that it was successfully sent.

There's a fair amount of thought that goes into sending data over IR/wifi. :P
 
This will be cool for o3ds users if we could use the ir to send the data like the nintendo amiibo/ir item (dunno what is his name) does for the o3ds, with like a phone with ir, like a HTC One, i'll be glad to try that if needed.
 
Last edited by Patxinco,
I would like to see an Ir Shell equivalent so that I could use my 3DS as a universal remote or mess with people like what you can do with a TV-B-Gone.

when I used Ir Shell on my PSP1000, I was able to have the PSP act as a DOCS IR PS1 Gamepad
This model to be precise
$_35.JPG
 
Last edited by driverdis,
  • Like
Reactions: VegaRoXas
That's where it begins to get a bit tricky. You'd probably have to start coming up with your own custom data "packets" of sorts. For example, you could add a checksum of some sort to the end of your buffer, and then on the 3DS that receives the data, calculate the checksum on the incoming data, and compare it to the checksum that was sent. If they match, you could send a signal back to the other 3DS to let it know that it was successfully sent.

There's a fair amount of thought that goes into sending data over IR/wifi. :P

I'm not going to even pretend to know how to do that, however from what I've checked on that it seems checksums would be the slowest possible way to do that, unless I'm mistaken.

I'll just put up what I've gotten with your input and set up shop. Hopefully what has been done here can help.
if((kHeld & KEY_X) && (kHeld & KEY_Y)) { //Paste this at line 155
drawString(10, 110, "Sending IR signal...");
const size_t bufferSize = 4096;
u8* buffer = malloc(bufferSize);
const u32 wait = 100;

IRU_SendData(buffer, bufferSize, wait);
free(buffer);
} else {
drawString(10, 110, "Hold X & Y to send IR signal.");
}

if((kHeld & KEY_A) && (kHeld & KEY_B)) {
drawString(10, 120, "Receiving IR signal...");
//You'll have to insert receiving coding in here.
} else {
drawString(10, 120, "Hold A & B to send IR signal.");
}
Grim-reaper.png
 
Last edited by Pandaxclone2,
I'm not going to even pretend to know how to do that, however from what I've checked on that it seems checksums would be the slowest possible way to do that, unless I'm mistaken.

Well, I never claimed to be an expert in sending or receiving data. It's just one possible method, heh.

But hey, at least we learned something new.
 
Infrared range in up to eight inches ion o3dsxl, no body will notice someone holding 3ds few inches from tv.
 
They are like checksums, but the difference is speed vs accuracy. If you're looking for 100% then checksums is the way to go. However I don't even know which one would ultimately be more useful to homebrew cause, especially if we want to apply it to features like a pseudo link cable or 2P mode in emus or linking between apps.

This whole code part was just testing if we could send data from point A to point B. A PoC if you will.
 
Last edited by Pandaxclone2,
Update:
In attempt to use "irucmd_StartRecvTransfer()" I got this:
Code:
Error: e0210cca
Module: 67 (IR)
Level: 28 (Usage)
Summary: 1 (Nothing happened) --Thanks, me too!
Description: 202 (200-219 Not enough space) --Probably needs more space...

And it turned the blinking LED off. Then, this immediately showed up as a second error for IRU_SetIRLEDState():
Code:
Error: c8a10ff0
Module: 67 (IR)
Level: 25 (Status)
Summary: 5 (Invalid state) --Oh no!
Description: 1008 (Busy) --Oh, makes sense. Guess I can't read and write at the same time...

The error for IRU_SetIRLEDState() went away the second I pointed my rear facing camera at the 3DS's IR port! (Maybe LG G3s laser focus??)

I'll push the changes to GitHub in a second if someone wants to test it.
Edit: I guess code blocks color generic code...

EDIT: SUPER ULTRA URGENT DISCOVERY!!! NEEDS MORE TESTING!

Download the new .3dsx file and wait for IR get Error: e0210cca. When this happens point any IR remote at your 3DS's IR port. Watch what happens.
 
Last edited by RedHat,
@RedHat, one more minor correction to the memory allocation, instead of malloc, we should use memalign when dealing with IR stuff. The IR services require the memory blocks to be aligned to 4096 bytes (i.e. 0x1000). Not really a problem since we already allocated 4K before, but just for the future, use this instead (thanks to @profi200 for pointing this out):

memalign(0x1000, <size of your buffer here without <> >);
 
  • Like
Reactions: RedHat

Site & Scene News

Popular threads in this forum