mirror of https://github.com/mgba-emu/mgba.git
Wii: Replace libFAT-specific code with general devop support
This commit is contained in:
parent
e1fe7ea41b
commit
843413021b
|
@ -5,7 +5,7 @@
|
||||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||||
#include "util/vfs.h"
|
#include "util/vfs.h"
|
||||||
|
|
||||||
#include <fat.h>
|
#include <sys/iosupport.h>
|
||||||
|
|
||||||
static bool _vdlClose(struct VDir* vd);
|
static bool _vdlClose(struct VDir* vd);
|
||||||
static void _vdlRewind(struct VDir* vd);
|
static void _vdlRewind(struct VDir* vd);
|
||||||
|
@ -16,11 +16,6 @@ static struct VDir* _vdlOpenDir(struct VDir* vd, const char* path);
|
||||||
static const char* _vdleName(struct VDirEntry* vde);
|
static const char* _vdleName(struct VDirEntry* vde);
|
||||||
static enum VFSType _vdleType(struct VDirEntry* vde);
|
static enum VFSType _vdleType(struct VDirEntry* vde);
|
||||||
|
|
||||||
extern const struct {
|
|
||||||
const char* name;
|
|
||||||
const DISC_INTERFACE* (*getInterface)(void);
|
|
||||||
} _FAT_disc_interfaces[];
|
|
||||||
|
|
||||||
struct VDirEntryDevList {
|
struct VDirEntryDevList {
|
||||||
struct VDirEntry d;
|
struct VDirEntry d;
|
||||||
size_t index;
|
size_t index;
|
||||||
|
@ -63,7 +58,7 @@ static void _vdlRewind(struct VDir* vd) {
|
||||||
struct VDirDevList* vdl = (struct VDirDevList*) vd;
|
struct VDirDevList* vdl = (struct VDirDevList*) vd;
|
||||||
free(vdl->vde.name);
|
free(vdl->vde.name);
|
||||||
vdl->vde.name = 0;
|
vdl->vde.name = 0;
|
||||||
vdl->vde.index = 0;
|
vdl->vde.index = 3;
|
||||||
}
|
}
|
||||||
|
|
||||||
static struct VDirEntry* _vdlListNext(struct VDir* vd) {
|
static struct VDirEntry* _vdlListNext(struct VDir* vd) {
|
||||||
|
@ -73,19 +68,17 @@ static struct VDirEntry* _vdlListNext(struct VDir* vd) {
|
||||||
free(vdl->vde.name);
|
free(vdl->vde.name);
|
||||||
vdl->vde.name = 0;
|
vdl->vde.name = 0;
|
||||||
}
|
}
|
||||||
while (true) {
|
while (vdl->vde.index < STD_MAX) {
|
||||||
if (!_FAT_disc_interfaces[vdl->vde.index].name || !_FAT_disc_interfaces[vdl->vde.index].getInterface) {
|
const devoptab_t *devops = devoptab_list[vdl->vde.index];
|
||||||
return 0;
|
if (devops->dirStateSize > 0) {
|
||||||
}
|
vdl->vde.name = malloc(strlen(devops->name) + 3);
|
||||||
const DISC_INTERFACE* iface = _FAT_disc_interfaces[vdl->vde.index].getInterface();
|
sprintf(vdl->vde.name, "%s:", devops->name);
|
||||||
if (iface && iface->isInserted()) {
|
|
||||||
vdl->vde.name = malloc(strlen(_FAT_disc_interfaces[vdl->vde.index].name) + 3);
|
|
||||||
sprintf(vdl->vde.name, "%s:", _FAT_disc_interfaces[vdl->vde.index].name);
|
|
||||||
return &vdl->vde.d;
|
return &vdl->vde.d;
|
||||||
}
|
}
|
||||||
|
|
||||||
++vdl->vde.index;
|
++vdl->vde.index;
|
||||||
}
|
}
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static struct VFile* _vdlOpenFile(struct VDir* vd, const char* path, int mode) {
|
static struct VFile* _vdlOpenFile(struct VDir* vd, const char* path, int mode) {
|
||||||
|
|
Loading…
Reference in New Issue