Homebrew RetroArch Switch

  • Thread starter Thread starter ShadowOne333
  • Start date Start date
  • Views Views 2,167,871
  • Replies Replies 9,226
  • Likes Likes 100
I actually like libtransistor more :X It's more low-level so I have more of an understanding of what's going on.

Anyway, I tried both memsetting the buffers to 0 after they're created with alloc_pages and commenting out the lines you highlighted and neither worked. Memsetting lead to more garbage being played and commenting them out lead to the nro failing to launch :( I'll keep looking into it, though. Thanks for the suggestion!

Don't memset.

Don't alloc pages, dont output it in the init. Add a bool initPages or some shit and add if(initPages && getRelase....) on the first query in the write func and on the else you copy the routines from the init
 
Are you working on any more cores?
Not at the moment. Eventually, sure, but I'm more focused on getting the audio buffer issue fixed. The only cores I would be interested in adding are ones that previously worked but didn't compile this time (psx_rearmed, for instance) and maybe some random ones that I'm sure could work like pokemon mini and game and watch.
 
  • Like
Reactions: Leonidas87
Not at the moment. Eventually, sure, but I'm more focused on getting the audio buffer issue fixed. The only cores I would be interested in adding are ones that previously worked but didn't compile this time (psx_rearmed, for instance) and maybe some random ones that I'm sure could work like pokemon mini and game and watch.

Its bad design (but not like its your fault :D). Actually the whole codebase is pretty horrible in my opinion lol (or maybe it wasn't as developed back then, idk)

I like low level more too, but thats when u do pull requests to libnx!

I mean it smth like that:

// TODO: Needs testing
static ssize_t switch_audio_write(void *data, const void *buf, size_t size)
{
size_t to_write = size;
switch_audio_t *swa = (switch_audio_t *)data;

if (!swa->current_buffer)
{
uint32_t num;
if (init && R_FAILED(audoutGetReleasedAudioOutBuffer(&swa->current_buffer, &num)))
{
RARCH_LOG("Failed to get released buffer?\n");
return -1;
}else{
...
//do alloc pages, proceed as seen
init = true
}




Then remove the stuff from init
 
Last edited by m4xw,
Not at the moment. Eventually, sure, but I'm more focused on getting the audio buffer issue fixed. The only cores I would be interested in adding are ones that previously worked but didn't compile this time (psx_rearmed, for instance) and maybe some random ones that I'm sure could work like pokemon mini and game and watch.

Gotcha.

Looking forward to a potential PS1 emu. ;)
 
The speed at which progress is being made is astonishing but expected.

Great group of people working together sharing information.

Appreciate all the work and time going into all these ports/updates.

5.0.2 does seem to be benefiting more right now but over time 4.1.0 or other lower versions will be best for compatability and features all around.

Just hate to see people updating from 4.x.x when being patient for a bit longer will bring you the same emulators in time.

Coming from someone running 4.1.0 and 5.0.2
 
Last edited by Leonidas87,
Here's the code I tried:

static ssize_t switch_audio_write(void *data, const void *buf, size_t size)

....

if (!swa->current_buffer)
{
uint32_t num;

if (swa->pages_initialized && audio_ipc_output_get_released_buffer(&swa->output, &num, &swa->current_buffer) != RESULT_OK)
{
RARCH_LOG("Failed to get released buffer?\n");
return -1;
} else {
for(int i = 0; i < 3; i++)
{
swa->buffers[ i ].ptr = &swa->buffers.[ i ]sample_data;
swa->buffers[ i ].sample_data = alloc_pages(sample_buffer_size, sample_buffer_size, NULL);
swa->buffers[ i ].buffer_size = sample_buffer_size;
swa->buffers[ i ].data_size = sample_buffer_size;
swa->buffers[ i ].unknown = 0;

audio_ipc_output_append_buffer(&swa->output, &swa->buffers[ i ]);
}

swa->pages_initialized = true;
}


Unfortunately, the garbage audio goes on longer and actually broke the sound in fceumm (the only emu I tried).
 
Last edited by DogParty,
@DogParty Dont append the output buffer there. Just remove that line, set current_buffer = &buffers[0] and num = 1 or mb 3, then continue like u did nothing
 
Omitting the audio_ipc_output_append_buffer line prevents Retroarch from opening the rom. It just freezes on an empty Horizon screen.
 
@DogParty u dont set false as default on pages_initialized in the init function

U dont assign swa->current_buffer to &swa->buffers (first element pointer) after you set init = true
 
Doesn't bool default to false on its own? Maybe I'm confusing Boolean's behavior in Java with how C handles bools, though.It's been awhile since I've worked in C.

Either way, I fixed the audio issue by changing how the audio buffers are allocated. Bless the Doom port source for being a resource.

https://pastebin.com/xGF0UM9J
 
> Doesn't bool default to false on its own? Maybe I'm confusing Boolean's behavior in Java with how C handles bools, though.It's been awhile since I've worked in C.

I think its undefined behaviour and implementation dependend.

> Either way, I fixed the audio issue by changing how the audio buffers are allocated. Bless the Doom port source for being a resource.

Now thats interesting.

Actually, that was earlier the implementation (did a git blame), but it was changed because it would probably be killed through DMA @DogParty

/* don't think this can be in mapped memory, since samples get DMA'd out of it */
static uint16_t __attribute__((aligned(0x1000))) sample_buffer_1[sample_buffer_size/sizeof(uint16_t)];
static uint16_t __attribute__((aligned(0x1000))) sample_buffer_2[sample_buffer_size/sizeof(uint16_t)];
static uint16_t __attribute__((aligned(0x1000))) sample_buffer_3[sample_buffer_size/sizeof(uint16_t)];
static uint16_t *sample_buffers[3] = {sample_buffer_1, sample_buffer_2, sample_buffer_3};

While it's a fix, I don't think it's the way to go.

I think you had it, just 2 silly mistakes in your earlier code ;)
 
Last edited by m4xw,
So, looks like staying on 4.1 is completely pointless right now.
I dont see anything big ebough that makes me want to update my switch. As i said before, the only thing 5.xx can run that 4.xx cant is snes and it still haa issues to saving
 
It has been months since I've tried (on my 3.0 switch), but I put a few hours into Advanced Wars on VBANEXT. I had to set the settings each time I started it up and I had to exit to get it to safe correctly. While it was a pain to do, my real concern is that one time I forget to exit out, and not only did it not save, but there was no longer any save. I couldn't restart knowing that one time forgetting to exit would start me all over again.

I've read more pages that I can count but I can't really see if this has been ever fixed or updated at least. Any information would be appreciated. Thanks.
 

Site & Scene News

Popular threads in this forum