Homebrew Homebrew Development

  • Thread starter Thread starter aliak11
  • Start date Start date
  • Views Views 1,475,205
  • Replies Replies 6,048
  • Likes Likes 54
Yeah thats exactly what I wanted to do(with CIA). Would you mind to give me the code? If yes, you can PM me. I will only use it for personal use and won't share it with any one else, without your permission.


https://gist.github.com/thedax/a02eb93dcd1e0ce533cd

I don't mind making it public. I just wish I could figure out why the UTF-16 strings I try to display are corrupted. Anyway, the paste above simply passes null for the title and text, so the notification will be entirely empty. The 3DS doesn't seem to care if a notification has no title or not.
 
https://gist.github.com/thedax/a02eb93dcd1e0ce533cd
Thanks. This is awsome. Cause of this i can make a lot of progress in my project.

I don't mind making it public. I just wish I could figure out why the UTF-16 strings I try to display are corrupted. Anyway, the paste above simply passes null for the title and text, so the notification will be entirely empty. The 3DS doesn't seem to care if a notification has no title or not.
 
Thanks. This is awsome. Cause of this i can make a lot of progress in my project.


No problem. I might make a pull request to see if I can get it added to libctru later, if I can figure out the corruption issue.

Edit: Oops, I think I found the corruption issue. I'm using the wrong offsets in the header. That's embarassing. Time for more tests..and I'll correct the paste above in a little while.

A few corrections, and...

2y7z1km.png

I'm still having issues with title being corrupted (hence "otification world!") but I can control the message text now.

The title isn't actually being corrupted in that picture, there are 24 bytes of padding or other junk before the title string begins. Not really sure why 3DBrew fails to mention that, but I have the title part working now. Now it's just a matter of making this friendly to use (I have a bunch of stuff hardcoded).
 
No problem. I might make a pull request to see if I can get it added to libctru later, if I can figure out the corruption issue.

Edit: Oops, I think I found the corruption issue. I'm using the wrong offsets in the header. That's embarassing. Time for more tests..and I'll correct the paste above in a little while.

A few corrections, and...

2y7z1km.png

I'm still having issues with title being corrupted (hence "otification world!") but I can control the message text now.

The title isn't actually being corrupted in that picture, there are 24 bytes of padding or other junk before the title string begins. Not really sure why 3DBrew fails to mention that, but I have the title part working now. Now it's just a matter of making this friendly to use (I have a bunch of stuff hardcoded).

Ok, so I donloaded your code, but still have a problem. I wanted to compile it but then I got that error :
Code:
d:/ctrulib/3DSPong-master/source/main.cpp: In function 'Result NEWSU_AddNotifica
tion()':
d:/ctrulib/3DSPong-master/source/main.cpp:66:12: error: invalid conversion from
'newsu_header_t*' to 'u32 {aka long unsigned int}' [-fpermissive]
  cmdbuf[7] = &header;
            ^
d:/ctrulib/3DSPong-master/source/main.cpp:68:12: warning: converting to non-poin
ter type 'u32 {aka long unsigned int}' from NULL [-Wconversion-null]
  cmdbuf[9] = NULL; // Text pointer
            ^
d:/ctrulib/3DSPong-master/source/main.cpp:70:13: warning: converting to non-poin
ter type 'u32 {aka long unsigned int}' from NULL [-Wconversion-null]
  cmdbuf[11] = NULL; // Image buffer pointer
            ^
I don't know if it's a problem with my setup, because other things compile fine. I hope you can help me with this.
 
Ok, so I donloaded your code, but still have a problem. I wanted to compile it but then I got that error :
Code:
d:/ctrulib/3DSPong-master/source/main.cpp: In function 'Result NEWSU_AddNotifica
tion()':
d:/ctrulib/3DSPong-master/source/main.cpp:66:12: error: invalid conversion from
'newsu_header_t*' to 'u32 {aka long unsigned int}' [-fpermissive]
  cmdbuf[7] = &header;
            ^
d:/ctrulib/3DSPong-master/source/main.cpp:68:12: warning: converting to non-poin
ter type 'u32 {aka long unsigned int}' from NULL [-Wconversion-null]
  cmdbuf[9] = NULL; // Text pointer
            ^
d:/ctrulib/3DSPong-master/source/main.cpp:70:13: warning: converting to non-poin
ter type 'u32 {aka long unsigned int}' from NULL [-Wconversion-null]
  cmdbuf[11] = NULL; // Image buffer pointer
            ^
I don't know if it's a problem with my setup, because other things compile fine. I hope you can help me with this.

You just need to add some typecastings:
cmdbuf[7] = (u32)&header;
cmdbuf[9] = (u32)NULL; // Text pointer
cmdbuf[11] = (u32)NULL; // Image buffer pointer
 
  • Like
Reactions: josamilu
Ok, so I donloaded your code, but still have a problem. I wanted to compile it but then I got that error :
Code:
d:/ctrulib/3DSPong-master/source/main.cpp: In function 'Result NEWSU_AddNotifica
tion()':
d:/ctrulib/3DSPong-master/source/main.cpp:66:12: error: invalid conversion from
'newsu_header_t*' to 'u32 {aka long unsigned int}' [-fpermissive]
  cmdbuf[7] = &header;
            ^
d:/ctrulib/3DSPong-master/source/main.cpp:68:12: warning: converting to non-poin
ter type 'u32 {aka long unsigned int}' from NULL [-Wconversion-null]
  cmdbuf[9] = NULL; // Text pointer
            ^
d:/ctrulib/3DSPong-master/source/main.cpp:70:13: warning: converting to non-poin
ter type 'u32 {aka long unsigned int}' from NULL [-Wconversion-null]
  cmdbuf[11] = NULL; // Image buffer pointer
            ^
I don't know if it's a problem with my setup, because other things compile fine. I hope you can help me with this.

C++ doesn't allow implicit casting so you have to explicit all of them.
 
You just need to add some typecastings:
cmdbuf[7] = (u32)&header;
cmdbuf[9] = (u32)NULL; // Text pointer
cmdbuf[11] = (u32)NULL; // Image buffer pointer

Thanks, compiling it now gives no errors anymore. But now there is another problem. I get
Code:
d:/devkitpro/devkitarm/bin/../lib/gcc/arm-none-eabi/4.9.2/../../../../arm-none-e
abi/bin/ld.exe: cannot find 3dsx_crt0.o: No such file or directory
collect2.exe: error: ld returned 1 exit status
this, after it tries to Link the .elf file.

EDIT: I googled around a bit and i found out that i have to change -mfloat-abi=softfp to -mfloat-abi=hard but I still get the same error :/

EDIT 2: Ok, now I fixed the error myself, I just tried a bit with the makefile.
 
Ok, so I donloaded your code, but still have a problem. I wanted to compile it but then I got that error :

I don't know if it's a problem with my setup, because other things compile fine. I hope you can help me with this.


I tend to code in C on the 3DS, not C++, so I'm not surprised that C++ didn't like a few things. :P
 
The more I work with libctru , and I realize that he has very little possibility using the CPU frameskip . A simple 16 pixel display tilemap causes a drop in FPS.
It is essential to simplify the use of the GPU, if not many projects are doomed to failure ...​
 
The more I work with libctru , and I realize that he has very little possibility using the CPU frameskip . A simple 16 pixel display tilemap causes a drop in FPS.​
It is essential to simplify the use of the GPU, if not many projects are doomed to failure ...​

sf2dlib is really easy to use, porting them on lpp-3ds took me few minutes.
 
Has anyone been able to use definable uniforms with the geometry shader? I'm attempting to improve BlargSNES by using less input for rendering each tile from 2 vertices to 1. When using a constant uniform with the needed information, it works, but when I take it out and put it in the program code alongside other uniform functions (those which are used for the vertex shader), I get a blank screen, even when using the same values used for when the uniform was constant within the shader.
 
How would one go about cutting an image?
im thinking memcpy from the u8* just dont know how I would actually do it.

It depends on how the image buffer is made and also on how you want to crop your image.
For example, let's say that you have a row-major order buffer and you want to do a horizontal cut you can do something like this:
Code:
u8 *buffer; //Let's assume that it is already filled and it is a 24bit/pixel buffer
u16 width, height; //Already assigned to a certain value. Height isn't really necessary, but could be useful to check if we want to cut more than we can
u16 startRow; //The starting row from where you want to start your cut
u16 cutHeight; //The number of rows that you want to cut from your buffer
u8 *newBuffer; //The buffer containing the new image
 
newBuffer = (u8 *)malloc(width * cutHeight * 3); //Allocate the new buffer
 
memcpy(newBuffer, &buffer[width * startRow * 3], width * cutHeight * 3); //Copy the cropped image in the new buffer
Please note that you should do some checks to ensure to you are not trying to make a cut outside of the image buffer.
The same code can be easily modified to made vertical cut on a column-major order buffer.

In the case of vertical cuts on row-major order buffers (or horizontal ones on column-major order buffers) you should cycle through the buffer using two nested for loops and copy one pixel at a time
 
  • Like
Reactions: filfat
is the image tiled for the GPU or not? And what exactly do you mean by cutting? Grabbing a small sub-section of the pixels of the image?
 

Site & Scene News

Popular threads in this forum