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,858
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,858
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
188
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
  • Xdqwerty @ Xdqwerty:
    @BigOnYa, i don't have one either
    +1
  • SylverReZ @ SylverReZ:
    @AcuteBulbasaurappears, A cute bulbasaur appears. :D
    +2
  • SylverReZ @ SylverReZ:
    @Psionic Roshambo, The Wii U gamepads are tied to the console's region, so its impossible to find a cheap gamepad that supports your model.
  • SylverReZ @ SylverReZ:
    Unless you modify your system, of course, and remove the region check.
  • Xdqwerty @ Xdqwerty:
    @SylverReZ, im now by episode 8 of lain
  • S @ salazarcosplay:
    @Xdqwerty can we discuss chrono trigger
  • S @ salazarcosplay:
    @Xdqwerty I like how the game had the middle ages 1000AD, the dark ages 600AD.It was great seeing the post robot apocalypse 2300 like Terminator and enter the matrix. some of mad max and fallout. 2300ad though it could had used more elements instead of just a generic ai uprising. It was a great idea for their judgement day to be 1999 Y2K.

    -great additions if they would have made an expansion or dlc in my opinion would be finding out humans trapped in a matrix -

    a follower having a cyborg character living tissue over metal endoskelleton like terminator, and the synths from fallout
  • S @ salazarcosplay:
    4After Zeal fell it would have been good to see more ancient eras. Perhaps Sumeria based in one area, then Egypt based in another area, Greek based in another area, then roman based in another area before the middle ages.---------

    ----between 1000ad and 1999 is a big gap they should have had the age of revolution like the american and French Revolution

    then the cowboyy era in one area of map and the Industrial revolution/age of enlightmentthen a ww1 and ww2 and a cold war era
  • S @ salazarcosplay:
    they could have added 75,000 bc like assassins creed. zeal was already establish in 12, 000 bc , soething before the kindom rose
  • S @ salazarcosplay:
    @Xdqwerty they could also add age of dscover, colonialism ect
    +1
  • S @ salazarcosplay:
    renaissance
  • S @ salazarcosplay:
    @Xdqwerty what did you think
  • S @ salazarcosplay:
    @Xdqwerty I think glenn (the frog) after becomming human had an affair with the queen
  • S @ salazarcosplay:
    so he is the great great great great grandfather of marle @Xdqwerty
  • S @ salazarcosplay:
    they made it like Lancelot from king arthur legends
  • BakerMan @ BakerMan:
    just found out i'm now taller than my dad
  • Xdqwerty @ Xdqwerty:
    @salazarcosplay, sorry i was busy
  • S @ salazarcosplay:
    @Xdqwerty thats completely fine
    +1
  • Xdqwerty @ Xdqwerty:
    @salazarcosplay,
    the ds version added a secret boss reference to chrono cross
  • S @ salazarcosplay:
    @Xdqwerty did you finish watching naruto shippuden and Boruto
  • Xdqwerty @ Xdqwerty:
    @salazarcosplay, i havent even started lol
  • Xdqwerty @ Xdqwerty:
    anyone here?
    Xdqwerty @ Xdqwerty: anyone here?