io: implement music0, photo0, video0 devices

This commit is contained in:
bookmist 2024-02-03 13:51:35 +03:00
parent 17886d827e
commit da73a57c38
3 changed files with 23 additions and 2 deletions

View File

@ -26,8 +26,10 @@ BETTER_ENUM(VitaIoDevice, int,
gro0,
grw0,
imc0,
music0,
os0,
pd0,
photo0,
sa0,
savedata0,
savedata1,
@ -40,6 +42,7 @@ BETTER_ENUM(VitaIoDevice, int,
ur0,
ux0,
vd0,
video0,
vs0,
xmc0,
_INVALID = -1)

View File

@ -65,7 +65,7 @@ inline std::string get_device_string(const VitaIoDevice dev, const bool with_col
inline bool is_valid_output_path(const VitaIoDevice device) {
return !(device == VitaIoDevice::savedata0 || device == VitaIoDevice::savedata1 || device == VitaIoDevice::app0
|| device == VitaIoDevice::_INVALID || device == VitaIoDevice::addcont0 || device == VitaIoDevice::tty0
|| device == VitaIoDevice::tty1);
|| device == VitaIoDevice::tty1 || device == VitaIoDevice::music0 || device == VitaIoDevice::photo0 || device == VitaIoDevice::video0);
}
/**
@ -76,7 +76,7 @@ inline bool is_valid_output_path(const VitaIoDevice device) {
inline bool is_valid_output_path(const std::string &device) {
return !(device == (+VitaIoDevice::savedata0)._to_string() || device == (+VitaIoDevice::savedata1)._to_string() || device == (+VitaIoDevice::app0)._to_string()
|| device == (+VitaIoDevice::_INVALID)._to_string() || device == (+VitaIoDevice::addcont0)._to_string() || device == (+VitaIoDevice::tty0)._to_string()
|| device == (+VitaIoDevice::tty1)._to_string());
|| device == (+VitaIoDevice::tty1)._to_string() || device == (+VitaIoDevice::music0)._to_string() || device == (+VitaIoDevice::photo0)._to_string() || device == (+VitaIoDevice::video0)._to_string());
}
/**

View File

@ -109,6 +109,7 @@ bool init(IOState &io, const fs::path &cache_path, const fs::path &log_path, con
const fs::path ux0_data{ ux0 / "data" };
const fs::path uma0_data{ uma0 / "data" };
const fs::path ux0_app{ ux0 / "app" };
const fs::path ux0_music{ ux0 / "music" };
const fs::path ux0_picture{ ux0 / "picture" };
const fs::path ux0_theme{ ux0 / "theme" };
const fs::path ux0_video{ ux0 / "video" };
@ -120,6 +121,7 @@ bool init(IOState &io, const fs::path &cache_path, const fs::path &log_path, con
fs::create_directories(ux0);
fs::create_directories(ux0_data);
fs::create_directories(ux0_app);
fs::create_directories(ux0_music);
fs::create_directories(ux0_picture);
fs::create_directories(ux0_theme);
fs::create_directories(ux0_video);
@ -225,6 +227,22 @@ std::string translate_path(const char *path, VitaIoDevice &device, const IOState
device = VitaIoDevice::ux0;
break;
}
case +VitaIoDevice::music0: { // Redirect music0: to ux0:music
relative_path = device::remove_device_from_path(relative_path, device, "music");
device = VitaIoDevice::ux0;
break;
}
case +VitaIoDevice::photo0: { // Redirect photo0: to ux0:picture
relative_path = device::remove_device_from_path(relative_path, device, "picture");
device = VitaIoDevice::ux0;
break;
}
case +VitaIoDevice::video0: { // Redirect video0: to ux0:video
relative_path = device::remove_device_from_path(relative_path, device, "video");
device = VitaIoDevice::ux0;
break;
}
case +VitaIoDevice::host0:
case +VitaIoDevice::gro0:
case +VitaIoDevice::grw0: