Homebrew Homebrew Development

  • Thread starter Thread starter aliak11
  • Start date Start date
  • Views Views 1,475,217
  • Replies Replies 6,048
  • Likes Likes 54
The Internet. I think this falls into the category of - if you are asking this question then the subject matter is probably beyond your skill level.
It is currently beyond my skill level because I'm trying to learn how to do it. If it was within my skill level, I'd be able to do it without looking at documentation.
Everything starts off beyond everyone's skill level until they learn how to do it. At one point, walking was beyond your skill level but you learned how to do it.
I was hoping that someone would point me in a direction that weren't pieces of uncommented code. And what I got is basically someone saying (this is how I took it, apologies if I misunderstand) "oh, you don't know how to do x, so it's beyond your skill level. Try something less strenuous than trying to learn how to do something you don't currently know how to do."
 
It is currently beyond my skill level because I'm trying to learn how to do it. If it was within my skill level, I'd be able to do it without looking at documentation.
Everything starts off beyond everyone's skill level until they learn how to do it. At one point, walking was beyond your skill level but you learned how to do it.
I was hoping that someone would point me in a direction that weren't pieces of uncommented code. And what I got is basically someone saying (this is how I took it, apologies if I misunderstand) "oh, you don't know how to do x, so it's beyond your skill level. Try something less strenuous than trying to learn how to do something you don't currently know how to do."
Learn and be comfortable with ARM assembly first. Learn how the stack works.
Then you are ready for ROP.
 
It is currently beyond my skill level because I'm trying to learn how to do it. If it was within my skill level, I'd be able to do it without looking at documentation.
Everything starts off beyond everyone's skill level until they learn how to do it. At one point, walking was beyond your skill level but you learned how to do it.
I was hoping that someone would point me in a direction that weren't pieces of uncommented code. And what I got is basically someone saying (this is how I took it, apologies if I misunderstand) "oh, you don't know how to do x, so it's beyond your skill level. Try something less strenuous than trying to learn how to do something you don't currently know how to do."
Well the first part was my answer - the Internet. Did you even try searching? A quick search for "rop chain how to " returned several results with precisely the results you are looking for. The second part was me being a dick. essentially I was putting in the same level of effort you did.
 
Well the first part was my answer - the Internet. Did you even try searching? A quick search for "rop chain how to " returned several results with precisely the results you are looking for. The second part was me being a dick. essentially I was putting in the same level of effort you did.
I did in fact use google, getting results which led me to the situation of seeing lots of uncommented code. It was when I was getting frustrated that I actually asked for help. I'm used to having readily available documentation on hand - I got spoiled with VB.net and basically all the other languages I learned at college. I was just hoping that documentation was just as easily found.

Learn and be comfortable with ARM assembly first. Learn how the stack works.
Then you are ready for ROP.
Thank you. I will definitely do my proper research on ARM assembly. I didn't know that ARM assembly had anything to do with ROP chains. All I knew getting into this was that ROP chains can be loaded into MSET and will execute by entering into the DS Profile.
 
I did in fact use google, getting results which led me to the situation of seeing lots of uncommented code. It was when I was getting frustrated that I actually asked for help. I'm used to having readily available documentation on hand - I got spoiled with VB.net and basically all the other languages I learned at college. I was just hoping that documentation was just as easily found.


Thank you. I will definitely do my proper research on ARM assembly. I didn't know that ARM assembly had anything to do with ROP chains. All I knew getting into this was that ROP chains can be loaded into MSET and will execute by entering into the DS Profile.
Just curious. There are a few open source hacks for the 3ds that use rop among other techniques to get homebrew running. Have you looked at ninjhax or oothax? Since there are already freely available means to run homebrew- what are you trying to achieve?
 
Just curious. There are a few open source hacks for the 3ds that use rop among other techniques to get homebrew running. Have you looked at ninjhax or oothax? Since there are already freely available means to run homebrew- what are you trying to achieve?
I'm researching both ninjhax and oothax, or trying to. I looked at the github involving oothax and I can understand tiny bits of the code. I've also looked at rop code and the lack of comments just made my eyes glaze over since I have no idea what each line is trying to do.

My understanding of what ROP does with MSET is that the ROP alters/changes/messes with what gets executed/looked at when the user enters the DS Profile. What I would love to do is get a ROP chain to execute the homebrew launcher by entering the DS Profile. Basically, I currently lack no method on my n3ds to enter the homebrew launcher. Of course, I don't even know if that kind of thing is even possible besides the fact that CFW use the MSET exploit that way (mostly reiNAND afaik). I know that Ninjhax/Tubehax/Ironhax is the way to go but the problem is that my n3ds lacks the youtube/ironfall applications and my finances no longer allow me to purchase anything more expensive than $5 that isn't food related.
 
Sockets are driving me mad, have tried so manu things but for some reason it wont work on the 3ds. Could someone plese give me a small example of a socket client on the 3ds that just connects to a server and sends 1 message? Dont even need the server. Just need that small bit of code to see what i Forgot in mine
 
Sockets are driving me mad, have tried so manu things but for some reason it wont work on the 3ds. Could someone plese give me a small example of a socket client on the 3ds that just connects to a server and sends 1 message? Dont even need the server. Just need that small bit of code to see what i Forgot in mine
The home brew launcher uses sockets for the netloader - https://github.com/smealum/3ds_hb_menu/blob/master/source/netloader.c

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

I'm researching both ninjhax and oothax, or trying to. I looked at the github involving oothax and I can understand tiny bits of the code. I've also looked at rop code and the lack of comments just made my eyes glaze over since I have no idea what each line is trying to do.

My understanding of what ROP does with MSET is that the ROP alters/changes/messes with what gets executed/looked at when the user enters the DS Profile. What I would love to do is get a ROP chain to execute the homebrew launcher by entering the DS Profile. Basically, I currently lack no method on my n3ds to enter the homebrew launcher. Of course, I don't even know if that kind of thing is even possible besides the fact that CFW use the MSET exploit that way (mostly reiNAND afaik). I know that Ninjhax/Tubehax/Ironhax is the way to go but the problem is that my n3ds lacks the youtube/ironfall applications and my finances no longer allow me to purchase anything more expensive than $5 that isn't food related.
Did you try tubehax? It is free and last I knew YouTube is still available on eshop . https://smealum.github.io/3ds/
 
  • Like
Reactions: Tjessx
I'd try tubehax but I lack youtube and a .cia installer on my 9.2 n3ds and I know that Smea is very busy so we may never get OoThax.
Has the free YouTube app been removed from the eshop? And why do you think you need a via installer for homebrew?
 
Last edited by zoogie,
What's the biggest texture size you can use? I tried 512x512 RGBA8, and it works (rendering polygons with a 64x64 RGBA texture to this large texture, filling it up, and then rendering that texture to the main display buffers), but when I tried 1024x1024 RGBA8, it began having problems. This large texture is allocated in VRAM (because even rendering to a 512x512 texture in main RAM is much slower). It may be 4MB in VRAM (out of 6MB on an o3DS) to allocate 1024x1024 RGBA8, but it does allocate. I have a reason to make a texture this big, but I don't want to reveal it just yet. I want to see if this can work.

Is it possible to change the destination format of a render? I'd like to use RGB5_A1 and RGBA4 in various scenarios for my render-to-texture setup to reduce VRAM usage, as right now, it seems to be rendering with RGBA8.
 
Has the free YouTube app been removed from the eshop? And why do you think you need a via installer for homebrew?
I can't access the eshop right now.

Youtube is still available. You can use eshop spoofer to get it on 9.2.
https://gbatemp.net/threads/how-to-...eshop-and-more-on-new-3ds-and-old-3ds.386591/

Oh, and a little birdie just told me ctrulib added romfs support. :P
The eshop spoofer is a .cia file and I don't have a .cia installer installed presently.
 
What's the biggest texture size you can use? I tried 512x512 RGBA8, and it works (rendering polygons with a 64x64 RGBA texture to this large texture, filling it up, and then rendering that texture to the main display buffers), but when I tried 1024x1024 RGBA8, it began having problems. This large texture is allocated in VRAM (because even rendering to a 512x512 texture in main RAM is much slower). It may be 4MB in VRAM (out of 6MB on an o3DS) to allocate 1024x1024 RGBA8, but it does allocate. I have a reason to make a texture this big, but I don't want to reveal it just yet. I want to see if this can work.

Is it possible to change the destination format of a render? I'd like to use RGB5_A1 and RGBA4 in various scenarios for my render-to-texture setup to reduce VRAM usage, as right now, it seems to be rendering with RGBA8.
IIRC the texture limit is 1024x1024, although I don't remember if that counts as too big or right on the limit. As for changing the destination format, not sure if you're using a GPU library or not, but if you're using the ctrulib GPU functions you can just change what format you pass in to GPU_SetTexture, along with changing whatever method you use to write to the texture to match your chosen format.
 
IIRC the texture limit is 1024x1024, although I don't remember if that counts as too big or right on the limit. As for changing the destination format, not sure if you're using a GPU library or not, but if you're using the ctrulib GPU functions you can just change what format you pass in to GPU_SetTexture, along with changing whatever method you use to write to the texture to match your chosen format.

I'm using the GPU to render to a texture (hoping to get 1k x 1k working, but it's not), and then rendering from that texture to the main display buffers. That first step for the render-to-texture method seems to be outputting at RGBA8, when I'd like that to output at RGB5_A1 or RGBA4, so instead of needing 4MB for the texture, I'm hoping to use just 2MB. I can change the texture's format as a source, but that requires the data to be in that format. What I'd like to know how to set the GPU to output to a different format instead of RGBA8.
 
I'm using the GPU to render to a texture (hoping to get 1k x 1k working, but it's not), and then rendering from that texture to the main display buffers. That first step for the render-to-texture method seems to be outputting at RGBA8, when I'd like that to output at RGB5_A1 or RGBA4, so instead of needing 4MB for the texture, I'm hoping to use just 2MB. I can change the texture's format as a source, but that requires the data to be in that format. What I'd like to know how to set the GPU to output to a different format instead of RGBA8.
Ah. There's probably some way to do it, but not one I know of or can find in ctrulib. The only places where you can set the pixel format that I can recall are when using GX_SetTexture or using GX_SetDisplayTransfer to transfer from one buffer to another.
 
Hmm, may have found where it can be set. In the GPU_SetViewport function of the ctrulib source, it does make GPUCMD writes to GPUREG_DEPTHBUFFER_FORMAT and GPUREG_COLORBUFFER_FORMAT, using constant values 3 and 2 respectively. I guess I can try figuring out what the values are for by duplicating the SetViewport function and using that for my render-to-texture section.

edit:

I guess I cannot delete my posts following this. Server went funky, making 3 identical posts (prior to my edits)

Anyways, I found where I can change the destination format

http://3dbrew.org/wiki/GPU/Internal_Registers#GPUREG_COLORBUFFER_FORMAT

Duplicated the GPU_SetViewport function, adjusted that write according to the description, and it works.

edit:

Ok, so I can render from a 1k x 1k texture as a source, but it doesn't seem to like rendering to such a texture. Started with an orthogonal projection. Worked with 512x512, but didn't with 1k x 1k. Tried perspective, and translated it enough to where I could set a modelview to have the 64x64 pixel texture fill up the entire 1k x 1k (test purposes), but as I got to the point of having it fill it up completely, I'd get a black screen and a freeze. Not sure why it's doing that, but since it seems to happen regarding my projection and modelview matrices, I might be ok, since my plan actually doesn't involve those, and I'm working with 2MB instead of 4MB, thanks to being able to change the color buffer format of the render.
 
Last edited by DiscostewSM,
I got these variables:
Code:
#define STACKSIZE (4 * 1024)

u32 *threadStack;

Handle trReceive, thReceive;
bool exitReceive = false;
I created a thread like this:
Code:
svcCreateEvent(&trReceive,0);
threadStack = memalign(32, STACKSIZE);

Result ret = svcCreateThread(&thReceive, (ThreadFunc)tr_receive, 0, &threadStack[STACKSIZE/4], 0x3f, 0);
    if(ret != 0) {
        //error output
    }

tr_receive function:
Code:
void tr_receive(void *arg) {
    while(1) {
        //wait for it...
        svcWaitSynchronization(trReceive, U64_MAX);
        svcClearEvent(trReceive);
        add_message("Starting to read", 1, white, background_message);
       
        while(!exitReceive) {
            get_message();
            svcSleepThread(100000000ULL);
        }
        if(exitReceive) {
            add_message("Stopped to read", 1, white, background_message);
            svcExitThread();
        }
    }
}

Now my problem:
The rest of the program only works during the svcSleepThread() function.
I need to use threads so that i don't skip any messages.
But for some reason this thread takes over the entire cpu.
Someone knows how to fix this?
 
First off that is how cooperative multi-tasking works. However it is not possible to answer your questions given the limited amount of code you provided. What does get_message do? Based on the limited information it looks like you are exiting the thread after reading a single message. To answer your question accurately I would need to see more code - for instance the context for signaling the event.
 

Site & Scene News

Popular threads in this forum