Homebrew Homebrew Development

UltiNaruto

Well-Known Member
Member
Joined
Sep 4, 2015
Messages
182
Trophies
0
Age
30
XP
203
Country
France
Well it depends on your motivation. But if you decode png through code, you can then easily modify your image on your needs in case it's not perfect on first try.
 
D

Deleted User

Guest
Code:
C:\devkitPro\examples\3ds\graphics\gpu\gpusprites>make
ballsprites.png
vshader.v.pica
lodepng.c
arm-none-eabi-gcc -MMD -MP -MF /c/devkitPro/examples/3ds/graphics/gpu/gpusprites/build/lodepng.d -g -Wall -O2 -mword-relocations -fomit-frame-pointer -ffunction-sections -march=armv6k -mtune=mpcore -mfloat-abi=hard -mtp=soft -I/c/devkitPro/examples/3ds/graphics/gpu/gpusprites/include -I/c/devkitPro/libctru/include -I/c/devkitPro/examples/3ds/graphics/gpu/gpusprites/build -DARM11 -D_3DS -c /c/devkitPro/examples/3ds/graphics/gpu/gpusprites/source/lodepng.c -o lodepng.o
main.c
arm-none-eabi-gcc -MMD -MP -MF /c/devkitPro/examples/3ds/graphics/gpu/gpusprites/build/main.d -g -Wall -O2 -mword-relocations -fomit-frame-pointer -ffunction-sections -march=armv6k -mtune=mpcore -mfloat-abi=hard -mtp=soft -I/c/devkitPro/examples/3ds/graphics/gpu/gpusprites/include -I/c/devkitPro/libctru/include -I/c/devkitPro/examples/3ds/graphics/gpu/gpusprites/build -DARM11 -D_3DS -c /c/devkitPro/examples/3ds/graphics/gpu/gpusprites/source/main.c -o main.o
c:/devkitPro/examples/3ds/graphics/gpu/gpusprites/source/main.c: In function 'sceneInit':
c:/devkitPro/examples/3ds/graphics/gpu/gpusprites/source/main.c:137:10: error: redeclaration of 'i' with no linkage
  for(int i = 0; i<width*height; i++) {
  ^
c:/devkitPro/examples/3ds/graphics/gpu/gpusprites/source/main.c:100:6: note: previous declaration of 'i' was here
  int i;
  ^
c:/devkitPro/examples/3ds/graphics/gpu/gpusprites/source/main.c:137:2: error: 'for' loop initial declarations are only allowed in C99 or C11 mode
  for(int i = 0; i<width*height; i++) {
  ^
c:/devkitPro/examples/3ds/graphics/gpu/gpusprites/source/main.c:137:2: note: use option -std=c99, -std=gnu99, -std=c11 or -std=gnu11 to compile your code
make[1]: *** [main.o] Error 1
make: *** [build] Error 2

Anyone mind shining some light onto the situation? :/
 

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
Code:
C:\devkitPro\examples\3ds\graphics\gpu\gpusprites>make
ballsprites.png
vshader.v.pica
lodepng.c
arm-none-eabi-gcc -MMD -MP -MF /c/devkitPro/examples/3ds/graphics/gpu/gpusprites/build/lodepng.d -g -Wall -O2 -mword-relocations -fomit-frame-pointer -ffunction-sections -march=armv6k -mtune=mpcore -mfloat-abi=hard -mtp=soft -I/c/devkitPro/examples/3ds/graphics/gpu/gpusprites/include -I/c/devkitPro/libctru/include -I/c/devkitPro/examples/3ds/graphics/gpu/gpusprites/build -DARM11 -D_3DS -c /c/devkitPro/examples/3ds/graphics/gpu/gpusprites/source/lodepng.c -o lodepng.o
main.c
arm-none-eabi-gcc -MMD -MP -MF /c/devkitPro/examples/3ds/graphics/gpu/gpusprites/build/main.d -g -Wall -O2 -mword-relocations -fomit-frame-pointer -ffunction-sections -march=armv6k -mtune=mpcore -mfloat-abi=hard -mtp=soft -I/c/devkitPro/examples/3ds/graphics/gpu/gpusprites/include -I/c/devkitPro/libctru/include -I/c/devkitPro/examples/3ds/graphics/gpu/gpusprites/build -DARM11 -D_3DS -c /c/devkitPro/examples/3ds/graphics/gpu/gpusprites/source/main.c -o main.o
c:/devkitPro/examples/3ds/graphics/gpu/gpusprites/source/main.c: In function 'sceneInit':
c:/devkitPro/examples/3ds/graphics/gpu/gpusprites/source/main.c:137:10: error: redeclaration of 'i' with no linkage
  for(int i = 0; i<width*height; i++) {
  ^
c:/devkitPro/examples/3ds/graphics/gpu/gpusprites/source/main.c:100:6: note: previous declaration of 'i' was here
  int i;
  ^
c:/devkitPro/examples/3ds/graphics/gpu/gpusprites/source/main.c:137:2: error: 'for' loop initial declarations are only allowed in C99 or C11 mode
  for(int i = 0; i<width*height; i++) {
  ^
c:/devkitPro/examples/3ds/graphics/gpu/gpusprites/source/main.c:137:2: note: use option -std=c99, -std=gnu99, -std=c11 or -std=gnu11 to compile your code
make[1]: *** [main.o] Error 1
make: *** [build] Error 2

Anyone mind shining some light onto the situation? :/

Variable declaration in a for statement is allowed onlt in C99 mode or in C++.
Also it seems you're re-declaring the same variable.
 
D

Deleted User

Guest
alright, nevermind the png-decoder example, I'm having trouble with the output .bin files. :/

Whenever I apply them to an object, they just seem to display junk as the texture.

Does the image need to have a specific size?
 

UltiNaruto

Well-Known Member
Member
Joined
Sep 4, 2015
Messages
182
Trophies
0
Age
30
XP
203
Country
France
if you want your image to output as .bin offline you should rather look at this then :
devKitPro\examples\3ds\graphics\bitmap\24bit-color

gpusprites example is tiled into 1/4th of the image and it's loading a .png on runtime.
 
Last edited by UltiNaruto,
D

Deleted User

Guest
if you want your image to output as .bin offline you should rather look at this then :
devKitPro\examples\3ds\graphics\bitmap\24bit-color

gpusprites example is tiled into 1/4th of the image and it's loading a .png on runtime.
I still don't understand... I don't seem to get a .bin file when I build the 24bit-color example.
 

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
Is there some problem in the logic of this piece of code? I tried it on Citra and seems to work quite good most of the time (i want to make it work always) but on Windows i always get a stackdump trace:

Code:
float* vert_args = (float*)res; // Hacky way to iterate in vertex struct     
printf("writing vertex at ptr 0x%X\n",vert_args);
fflush(stdout);
while (init_val < end_vert){
       if (end_val > end_vert) end_val = end_vert;
       strncpy(float_val, init_val, end_val - init_val);
       float_val[end_val - init_val] = 0;
       printf("inserting vert_val (idx %i): %s...",idx,float_val);
       fflush(stdout);
       vert_args[idx] = atof(float_val);
       printf("done\n");
       idx++;
       init_val = end_val + 1;
       while (init_val[0] == ' ') init_val++;
       end_val = strstr(init_val," ");
}

In runtime i get this output before the crash:
Code:
searching for next vertex.. (vl: 0x53990 / vert : 0xA333838)
writing vertex at ptr 0xA333838
inserting vert_val (idx 3): 0.655716...
 

Coto

-
Member
Joined
Jun 4, 2010
Messages
2,979
Trophies
2
XP
2,565
Country
Chile
Is there some problem in the logic of this piece of code? I tried it on Citra and seems to work quite good most of the time (i want to make it work always) but on Windows i always get a stackdump trace:

Code:
float* vert_args = (float*)res; // Hacky way to iterate in vertex struct 
printf("writing vertex at ptr 0x%X\n",vert_args);
fflush(stdout);
while (init_val < end_vert){
       if (end_val > end_vert) end_val = end_vert;
       strncpy(float_val, init_val, end_val - init_val);
       float_val[end_val - init_val] = 0;
       printf("inserting vert_val (idx %i): %s...",idx,float_val);
       fflush(stdout);
       vert_args[idx] = atof(float_val);
       printf("done\n");
       idx++;
       init_val = end_val + 1;
       while (init_val[0] == ' ') init_val++;
       end_val = strstr(init_val," ");
}

In runtime i get this output before the crash:
Code:
searching for next vertex.. (vl: 0x53990 / vert : 0xA333838)
writing vertex at ptr 0xA333838
inserting vert_val (idx 3): 0.655716...
what about if(end_val >= end_vert) . I can see an exception raised due to stack overflow edit: or atof() failed to convert the value to float due to value not being numeric (ASCII does not represent a number)
 
Last edited by Coto,

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
what about if(end_val >= end_vert) . I can see an exception raised due to stack overflow edit: or atof() failed to convert the value to float due to value not being numeric (ASCII does not represent a number)

I found the problem, it was caused by res pointing to an unallocated memory region in certain circumstances ;)
 

spinal_cord

Knows his stuff
Member
Joined
Jul 21, 2007
Messages
3,227
Trophies
1
Age
43
Location
somewhere
Website
spinalcode.co.uk
XP
3,416
Country
Quick question, I tried building my emulator (breadbox) as a .cia, it installed fine, but when I hit the home button it freezes. I assume there's some code for detecting the home button? other apps such as blargsnes and gameyob don't have this issue.

Any help?
 

~Poke~

Well-Known Member
Member
Joined
Aug 18, 2015
Messages
260
Trophies
0
XP
144
Country
Hey, I have a few questions here but they're all relatively simple (or not, but, broad so probably have been considered before?)
Is there any way to create a background thread (always running, while playing games and etc.) outside of building it into a CFW, or doing a ninjhax2.5 style takeover of the whole system?
I suspect that the Home Menu applets work like this (Miiverse, Friend list, Browser)... do they?
If so, is it possible to replace them with a Homebrew .cia? I understand it would need to be compiled differently since they're a different type of app, do we have the capabilities to do this?
 

TarableCode

Well-Known Member
Member
Joined
Mar 2, 2016
Messages
184
Trophies
0
Age
37
XP
319
Country
Canada
work in progress
857RxwU.jpg


and now to disappear and never post anything ever again
 

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
Does someone knows why sf2dlib seems to be unusable after citro3D initialization?

It looks like whenever i try to load certain textures to use them on a model i get these two errors on Citra:
Code:
unknown GetPointer @ 0x00000000
DebugUtils::LookupTexture Unknown texture format: f

The same code works if i load the texture BEFORE initializing citro3D. :/
 

Site & Scene News

Popular threads in this forum

General chit-chat
Help Users
    rqkaiju2 @ rqkaiju2: istg if lose another game of minesweeper