Homebrew Homebrew Development

daxtsu

Well-Known Member
Member
Joined
Jun 9, 2007
Messages
5,627
Trophies
2
XP
5,194
Country
Antarctica
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.
 

josamilu

Well-Known Member
Member
Joined
Feb 1, 2015
Messages
383
Trophies
0
Location
Saturn is better than Jupiter :P
XP
319
Country
Gambia, The
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.
 

daxtsu

Well-Known Member
Member
Joined
Jun 9, 2007
Messages
5,627
Trophies
2
XP
5,194
Country
Antarctica
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).
 

josamilu

Well-Known Member
Member
Joined
Feb 1, 2015
Messages
383
Trophies
0
Location
Saturn is better than Jupiter :P
XP
319
Country
Gambia, The
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.
 

Aurelio

Well-Known Member
Newcomer
Joined
Jun 25, 2008
Messages
64
Trophies
0
XP
834
Country
Italy
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

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
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.
 

josamilu

Well-Known Member
Member
Joined
Feb 1, 2015
Messages
383
Trophies
0
Location
Saturn is better than Jupiter :P
XP
319
Country
Gambia, The
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.
 

daxtsu

Well-Known Member
Member
Joined
Jun 9, 2007
Messages
5,627
Trophies
2
XP
5,194
Country
Antarctica
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
 

Cid2mizard

Well-Known Member
Member
Joined
Aug 16, 2007
Messages
401
Trophies
1
Age
43
Location
Maubeuge
XP
2,435
Country
France
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 ...​
 

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
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.
 

DiscostewSM

Well-Known Member
Member
Joined
Feb 10, 2009
Messages
5,484
Trophies
2
Location
Sacramento, California
Website
lazerlight.x10.mx
XP
5,486
Country
United States
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.
 

Aurelio

Well-Known Member
Newcomer
Joined
Jun 25, 2008
Messages
64
Trophies
0
XP
834
Country
Italy
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

KingOfHell

Well-Known Member
Newcomer
Joined
Mar 15, 2015
Messages
74
Trophies
0
Age
36
XP
83
Country
United States
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

General chit-chat
Help Users
  • No one is chatting at the moment.
    NinStar @ NinStar: It will actually make it worse