3ds: 3ds port sources. Second set of two.

This commit adds new files written exclusively for the 3ds port.

Additional comments:

1. Plugins works, but will be enabled in future commits.
2. The port has only been tested on the New 3DS.
3. Not all features of rockbox have been tested so there may be bugs or non-functional features.
4. There is a known issue where a random crash can occur when exiting the app.

Change-Id: I122d0bea9aa604e04fca45ba8287cf79e6110769
This commit is contained in:
Mauricio Garrido 2025-10-08 19:30:37 -06:00 committed by Solomon Peachy
parent a4de1195cd
commit 3b7dafb117
51 changed files with 7322 additions and 0 deletions

View file

@ -0,0 +1,73 @@
/***************************************************************************
* __________ __ ___.
* Open \______ \ ____ ____ | | _\_ |__ _______ ___
* Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
* Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
* Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
* \/ \/ \/ \/ \/
* $Id$
*
* Copyright (C) 2010 by Thomas Martitz
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
* KIND, either express or implied.
*
****************************************************************************/
#define RB_FILESYSTEM_OS
#include <sys/stat.h>
#include <string.h>
#include <stdio.h>
#include <errno.h>
#include <utime.h>
#include "config.h"
#include "system.h"
#include "file.h"
#include "dir.h"
#include "mv.h"
#include "debug.h"
#include "pathfuncs.h"
#include "string-extra.h"
#include <3ds/archive.h>
void paths_init(void)
{
/* is this needed in 3DS? */
#if 0
char config_dir[MAX_PATH];
const char *home = "/3ds";
mkdir("/3ds/.rockbox" __MKDIR_MODE_ARG);
snprintf(config_dir, sizeof(config_dir), "%s/.config", home);
mkdir(config_dir __MKDIR_MODE_ARG);
snprintf(config_dir, sizeof(config_dir), "%s/.config/rockbox.org", home);
mkdir(config_dir __MKDIR_MODE_ARG);
/* Plugin data directory */
snprintf(config_dir, sizeof(config_dir), "%s/.config/rockbox.org/rocks.data", home);
mkdir(config_dir __MKDIR_MODE_ARG);
#endif
}
/* only sdcard volume is accesible to the user */
void volume_size(IF_MV(int volume,) sector_t *sizep, sector_t *freep)
{
sector_t size = 0, free = 0;
FS_ArchiveResource sdmcRSRC;
FSUSER_GetSdmcArchiveResource(&sdmcRSRC);
size = (sdmcRSRC.totalClusters * sdmcRSRC.clusterSize) / sdmcRSRC.sectorSize;
free = (sdmcRSRC.freeClusters * sdmcRSRC.clusterSize) / sdmcRSRC.sectorSize;
if (sizep)
*sizep = size;
if (freep)
*freep = free;
}