Homebrew Homebrew Development

Spaqin

Well-Known Member
Member
Joined
Feb 17, 2015
Messages
123
Trophies
0
Age
29
XP
199
Country
Poland
I'm using NDSP.
I actually did some tests - I didn't move the NDSP thread to syscore (not appcore), but the thread calling ov_read (loading and decoding and putting into ndsp queue), and even with the bigger buffer it still skips. I guess 30% of the second core is not enough.
 

TarableCode

Well-Known Member
Member
Joined
Mar 2, 2016
Messages
184
Trophies
0
Age
37
XP
319
Country
Canada
I've been looking into how to get the consoleDoWhatever() functions to render to a texture but without luck since they seem to be raw framebuffer only.
Aside from de-initting all my bottom screen Citro3D stuff and switching to the console, is there an easy way to render text or am I stuck writing my own font renderer?
 

daxtsu

Well-Known Member
Member
Joined
Jun 9, 2007
Messages
5,627
Trophies
2
XP
5,194
Country
Antarctica
Does anyone know if it's possible to have a CIA application create a thread which can continue to run in the background, after the application itself has exited? I'm interested in creating a homebrew service (and no, I don't mean loading homebrew, I mean a custom service that can respond to commands, like srv, svc, etc.), but it's not really that useful if it dies when the application does.
 

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 anyone know if it's possible to have a CIA application create a thread which can continue to run in the background, after the application itself has exited? I'm interested in creating a homebrew service (and no, I don't mean loading homebrew, I mean a custom service that can respond to commands, like srv, svc, etc.), but it's not really that useful if it dies when the application does.

Quite sure @filfat already tried something like this and it resulted on thread closing when application exited.
 
  • Like
Reactions: filfat

TheCruel

Developer
Banned
Joined
Dec 6, 2013
Messages
1,350
Trophies
2
XP
3,131
Country
United States
Is it libvorbis giving problems with hard float abi? Have you tried stb_vorbis decoder? I'm about to try it now, so wondering if it also has problems.
 

daxtsu

Well-Known Member
Member
Joined
Jun 9, 2007
Messages
5,627
Trophies
2
XP
5,194
Country
Antarctica
No luck with a custom system module. Installed my test service (using category Base, like other system modules) and it's never ran (homebrew that tries to get a handle to the service I wanted to install freezes the console, same as if you tried to access an invalid/non-existent service). I guess what modules to load are hard-coded into NATIVE_FIRM or something. Oh well.
 

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

~Poke~

Well-Known Member
Member
Joined
Aug 18, 2015
Messages
260
Trophies
0
XP
144
Country
No luck with a custom system module. Installed my test service (using category Base, like other system modules) and it's never ran (homebrew that tries to get a handle to the service I wanted to install freezes the console, same as if you tried to access an invalid/non-existent service). I guess what modules to load are hard-coded into NATIVE_FIRM or something. Oh well.
Maybe it would be more practical to replace a little-used service until this gets figured out? 3Dbrew seems to suggest that some services only start when called, so it shouldn't need to be launched at console boot but perhaps it's hard coded which to call.
(Sorry for back seating, a couple days ago I was looking into doing the same, but I don't really understand enough internals to get past the pondering stage..)
 

daxtsu

Well-Known Member
Member
Joined
Jun 9, 2007
Messages
5,627
Trophies
2
XP
5,194
Country
Antarctica
Maybe it would be more practical to replace a little-used service until this gets figured out? 3Dbrew seems to suggest that some services only start when called, so it shouldn't need to be launched at console boot but perhaps it's hard coded which to call.
(Sorry for back seating, a couple days ago I was looking into doing the same, but I don't really understand enough internals to get past the pondering stage..)

I guess I could maybe have it replace the friends module or something as a test, since I almost never use the friends list. I've fiddled around with it enough for one day though.
 

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
Just wanted to throw in a picture of a litte 2 player competetive shooting game i developed around 4 months ago, and if someone wants to see it released with polished graphics and more powerups :D
turfwars.JPG
 
  • Like
Reactions: MRJPGames

Goombi

my_crypto = meme_crypto
Member
Joined
Jun 1, 2014
Messages
144
Trophies
0
Location
RnVja1lvdU15RHVkZQ
Website
www.goombi.fr
XP
178
Country
France
Hey there, I have a question, maybe you could help me: I'm working on a save editor and having 4 bytes at the end of the encrypted file that are not in the decrypted one.
The first two are always 0x0000, the last two change everytime the file change, so I highly suspect a checksum (CRC16 for 2 bytes or 32 with mixed bytes or whatever).
I can't figure how it is calculated. Does Nintendo always use the same method or every app has it's own way to compute checksums?
 

TarableCode

Well-Known Member
Member
Joined
Mar 2, 2016
Messages
184
Trophies
0
Age
37
XP
319
Country
Canada
I've been looking into how to get the consoleDoWhatever() functions to render to a texture but without luck since they seem to be raw framebuffer only.
Aside from de-initting all my bottom screen Citro3D stuff and switching to the console, is there an easy way to render text or am I stuck writing my own font renderer?

In case anyone else needs it, I've found a solution:
Code:
#include <3ds.h>
#include <citro3d.h>
#include <stdio.h>
#include <malloc.h>
#include <sys/iosupport.h>
#include "c3d_console.h"

#define CONSOLE_TEXTURE_TRANSFER_FLAGS \
	(GX_TRANSFER_FLIP_VERT(1) | GX_TRANSFER_OUT_TILED(1) | GX_TRANSFER_RAW_COPY(0) | \
	GX_TRANSFER_IN_FORMAT(GX_TRANSFER_FMT_RGB565) | GX_TRANSFER_OUT_FORMAT(GX_TRANSFER_FMT_RGB565) | \
	GX_TRANSFER_SCALING(GX_TRANSFER_SCALE_NO))

extern ssize_t con_write(struct _reent *r,int fd,const char *ptr, size_t len);
extern u8 default_font_bin[ ];

static u16* ConsoleBuffer240x320 = NULL;
static u16* ConsoleTextureBuffer = NULL;

C3D_Tex ConsoleTexture;

static PrintConsole C3DConsole = {
	{
		default_font_bin,
		0,
		256
	},
	NULL,
	0,
	0,
	0,
	0,
	40,
	30,
	0,
	0,
	40,
	30,
	3,
	7,
	0,
	0,
	0,
	false
};

static const devoptab_t MyDevOpTab = {
	"con",
	0,
	NULL,
	NULL,
	con_write,
	NULL,
	NULL,
	NULL
};

void C3D_ConsoleFree( void ) {
	if ( ConsoleBuffer240x320 )
		free( ConsoleBuffer240x320 );

	if ( ConsoleTextureBuffer )
		linearFree( ConsoleTextureBuffer );

	ConsoleBuffer240x320 = NULL;
	ConsoleTextureBuffer = NULL;
}

int C3D_ConsoleInit( void ) {
	int i = 0;

	ConsoleBuffer240x320 = ( u16* ) malloc( 240 * 320 * 2 );
	ConsoleTextureBuffer = ( u16* ) linearMemAlign( 256 * 512 * 2, 0x80 );

	if ( ConsoleBuffer240x320 && ConsoleTextureBuffer ) {
		C3D_TexInit( &ConsoleTexture, 256, 512, GPU_RGB565 );

		devoptab_list[ STD_OUT ] = &MyDevOpTab;
		devoptab_list[ STD_ERR ] = &MyDevOpTab;

		setvbuf( stdout, NULL, _IONBF, 0 );
		setvbuf( stderr, NULL, _IONBF, 0 );

		C3DConsole.frameBuffer = ConsoleBuffer240x320;
		C3DConsole.consoleInitialised = true;

		consoleSelect( &C3DConsole );
		consoleSetWindow( &C3DConsole, 0, 0, 320 / 8, 240 / 8 );
		consoleClear( );

		/*
		 * BUGBUGBUG:
		 * First 2 lines don't exist?
		 * So it's like the window is actually 40x28 for some reason.
		 */
		for ( i = 0; i <= 29; i++ ) {
			printf( "line %d\n", i );
		}

		return 1;
	}

	

	C3D_ConsoleFree( );
	return 0;
}

void C3D_ConsoleUpdate( void ) {
	u16* Src = ( u16* ) ConsoleBuffer240x320;
	u16* Dst = ( u16* ) ConsoleTextureBuffer;
	int x = 0;
	int y = 0;

	/*
	 * TODO:
	 * Speed up later, this is gonna be slow as BALLS.
	 */
	for ( y = 0; y < 320; y++ ) {
		for ( x = 0; x < 240; x++ ) {
			Dst[ x + ( y * 256 ) ] = Src[ x + ( y * 240 ) ];
		}
	}

	GSPGPU_FlushDataCache( ConsoleTextureBuffer, 256 * 512 * 2 );
	GX_DisplayTransfer( ( u32* ) ConsoleTextureBuffer, GX_BUFFER_DIM( 256, 512 ), ( u32* ) ConsoleTexture.data, GX_BUFFER_DIM( 256, 512 ), CONSOLE_TEXTURE_TRANSFER_FLAGS );
	gspWaitForPPF( );
}

void C3D_ConsoleDraw( void ) {
	C3D_TexBind( 0, &ConsoleTexture );

	/*
	 * Sorcery!
	 * I don't know it either.
	 */
	C3D_ImmDrawBegin( GPU_TRIANGLES );
		// 1st triangle
		C3D_ImmSendAttrib( 0, 0, 0.5, 0.0 );
		C3D_ImmSendAttrib( 1.0, 0.0, 0.0, 0.0 );

		C3D_ImmSendAttrib( 512, 256, 0.5, 0.0 );
		C3D_ImmSendAttrib( 0.0, 1.0, 0.0, 0.0 );

		C3D_ImmSendAttrib( 512, 0, 0.5, 0.0 );
		C3D_ImmSendAttrib( 1.0, 1.0, 0.0, 0.0 );
			
		// 2nd triangle
		C3D_ImmSendAttrib( 0, 0, 0.5, 0.0 );
		C3D_ImmSendAttrib( 1.0, 0.0, 0.0, 0.0 );

		C3D_ImmSendAttrib( 0, 256, 0.5, 0.0 );
		C3D_ImmSendAttrib( 0.0, 0.0, 0.0, 0.0 );

		C3D_ImmSendAttrib( 512, 256, 0.5, 0.0 );
		C3D_ImmSendAttrib( 0.0, 1.0, 0.0, 0.0 );
	C3D_ImmDrawEnd( );
}

Minor bug with the console being off by 2 lines but it seems to work.
 

daxtsu

Well-Known Member
Member
Joined
Jun 9, 2007
Messages
5,627
Trophies
2
XP
5,194
Country
Antarctica
Hey there, I have a question, maybe you could help me: I'm working on a save editor and having 4 bytes at the end of the encrypted file that are not in the decrypted one.
The first two are always 0x0000, the last two change everytime the file change, so I highly suspect a checksum (CRC16 for 2 bytes or 32 with mixed bytes or whatever).
I can't figure how it is calculated. Does Nintendo always use the same method or every app has it's own way to compute checksums?

Are you working on something relating to Majora's Mask or Ocarina of Time? That sounds awfully familiar.
 

Site & Scene News

Popular threads in this forum

General chit-chat
Help Users
  • No one is chatting at the moment.
    D @ diamondsofmayhem: G'night!