Cerbios/Cerbios Bios/LithiumX-DualHDD/Source/LithiumX-DualHDD.diff
2025-07-11 21:30:41 +02:00

371 lines
14 KiB
Diff

diff -ur ./src/dash_browser.c ../LithiumX-DualHDD/src/dash_browser.c
--- ./src/dash_browser.c 2024-06-28 13:55:18.732000000 -0400
+++ ../LithiumX-DualHDD/src/dash_browser.c 2024-08-16 19:22:15.928000000 -0400
@@ -179,6 +179,7 @@
WIN32_FIND_DATA findData;
HANDLE hFind;
char searchPath[DASH_MAX_PATH];
+ char tmp[10];
int i = 0;
*cnt = 0;
@@ -187,19 +188,23 @@
//Xbox doesn't have a root drive that shows all partitions so we fake it
if (strcmp(path, DASH_ROOT_PATH) == 0)
{
- static const char root_drives[][3] = {"C:", "D:", "E:", "F:", "G:", "R:", "S:",
- "V:", "W:", "A:", "B:", "P:", "Q:", "X:", "Y:", "Z:", };
+ static const char* root_drives[] = {"HDD0-C", "DVD-ROM", "HDD0-E", "HDD0-F", "HDD0-G", "HDD0-H", "HDD0-I",
+ "HDD0-J", "HDD0-K", "HDD0-L", "HDD0-M", "HDD0-N", "ROOT", "HDD0-X", "HDD0-Y", "HDD0-Z",
+ "HDD1-C", "HDD1-E", "HDD1-F", "HDD1-G", "HDD1-H", "HDD1-I",
+ "HDD1-J", "HDD1-K", "HDD1-L", "HDD1-M", "HDD1-N", "HDD1-X", "HDD1-Y", "HDD1-Z", };
int _cnt = 0;
for (int i = 0; i < DASH_ARRAY_SIZE(root_drives); i++)
{
- if(!nxIsDriveMounted(root_drives[i][0]))
+ if(!nxIsDriveMounted((char*)root_drives[i]))
{
dash_printf(LEVEL_TRACE, "%s not mounted. Skipping\n", root_drives[i]);
continue;
}
if (list != NULL)
{
- list[_cnt].item = lv_strdup(root_drives[i]);
+ memset(tmp, 0, 10);
+ lv_snprintf(tmp, 10, "%s:", root_drives[i]);
+ list[_cnt].item = lv_strdup(tmp);
list[_cnt].is_dir = 1;
}
_cnt++;
diff -ur ./src/dash_main.c ../LithiumX-DualHDD/src/dash_main.c
--- ./src/dash_main.c 2024-06-28 13:55:18.732000000 -0400
+++ ../LithiumX-DualHDD/src/dash_main.c 2024-08-01 04:12:48.396000000 -0400
@@ -22,16 +22,16 @@
"\n"
"[[pages]]\n"
"name = \"Games\"\n"
- "paths = [\"E:/Games\", \"F:/Games\", \"G:/Games\"]\n"
+ "paths = [\"HDD0-E:/Games\", \"HDD0-F:/Games\", \"HDD0-G:/Games\", \"HDD1-E:/Games\", \"HDD1-F:/Games\", \"HDD1-G:/Games\"]\n"
"\n"
"[[pages]]\n"
"name = \"Applications\"\n"
- "paths = [\"E:/Applications\", \"F:/Applications\", \"G:/Applications\",\n"
- " \"E:/Apps\", \"F:/Apps\", \"G:/Apps\"]\n"
+ "paths = [\"HDD0-E:/Applications\", \"HDD0-F:/Applications\", \"HDD0-G:/Applications\", \"HDD1-E:/Applications\", \"HDD1-F:/Applications\", \"HDD1-G:/Applications\", \n"
+ " \"HDD0-E:/Apps\", \"HDD0-F:/Apps\", \"HDD0-G:/Apps\", \"HDD1-E:/Apps\", \"HDD1-F:/Apps\", \"HDD1-G:/Apps\"]\n"
"\n"
"[[pages]]\n"
"name = \"Homebrew\"\n"
- "paths = [\"E:/Homebrew\", \"F:/Homebrew\", \"G:/Homebrew\"]\n"
+ "paths = [\"HDD0-E:/Homebrew\", \"HDD0-F:/Homebrew\", \"HDD0-G:/Homebrew\", \"HDD1-E:/Homebrew\", \"HDD1-F:/Homebrew\", \"HDD1-G:/Homebrew\"]\n"
"\0";
static bool check_path_toml(char *err_msg, int err_msg_len)
diff -ur ./src/libs/ftpd/ftp_file.c ../LithiumX-DualHDD/src/libs/ftpd/ftp_file.c
--- ./src/libs/ftpd/ftp_file.c 2024-06-28 13:55:18.732000000 -0400
+++ ../LithiumX-DualHDD/src/libs/ftpd/ftp_file.c 2024-08-16 19:52:39.464000000 -0400
@@ -23,7 +23,11 @@
#ifdef NXDK
#include <xboxkrnl/xboxkrnl.h>
-static const char root_drives[][3] = {"/C", "/D", "/E", "/F", "/G", "/R", "/S", "/V", "/W", "/A", "/B", "/P", "/X", "/Y", "/Z"};
+static const char root_drives[][8] = {"HDD0-C", "DVD-ROM", "HDD0-E", "HDD0-F", "HDD0-G", "HDD0-H", "HDD0-I",
+ "HDD0-J", "HDD0-K", "HDD0-L", "HDD0-M", "HDD0-N", "ROOT", "HDD0-X", "HDD0-Y", "HDD0-Z",
+ "HDD1-C", "HDD1-E", "HDD1-F", "HDD1-G", "HDD1-H", "HDD1-I",
+ "HDD1-J", "HDD1-K", "HDD1-L", "HDD1-M", "HDD1-N", "HDD1-X", "HDD1-Y", "HDD1-Z", };
+
static int root_index;
#define FILE_DBG DbgPrint
#else
@@ -39,19 +43,29 @@
// Replace "/" with "\"
char *sep = strchr(out, '/');
+ char* start = 0;
+ char* end = 0;
+ int cnt = 0;
+ if(sep) start = sep;
while (sep)
{
+ if(cnt==1) end = sep;
*sep = '\\';
sep = strchr(out, '/');
+ cnt++;
}
+ if(!end) end = start + strlen(out);
+
#ifdef NXDK
// Replace \E\ with "E:\" etc.
if (out[0] == '\\' && out[1] != '\0')
{
- out[0] = out[1];
+ memcpy(out, start+1, end-start-1);
+ *(end-1) = ':';
+ /* out[0] = out[1];
out[1] = ':';
- out[2] = '\\';
+ out[2] = '\\';*/
}
#endif
return out;
@@ -63,7 +77,7 @@
int cnt = sizeof(root_drives) / sizeof(root_drives[0]);
for (int i = 0; i < cnt; i++)
{
- if (strcmp(path, root_drives[i]) == 0)
+ if (strcmp(path+1, root_drives[i]) == 0)
{
return 1;
}
@@ -208,7 +222,6 @@
{
WIN32_FIND_DATA findFileData;
FILE_DBG("Looking for files in %s\n", dp->path);
-
#ifdef FTP_CUSTOM_ROOT_PATH
if (strcmp(dp->path, "root") == 0)
{
@@ -217,11 +230,11 @@
for(; root_index < (sizeof(root_drives) / sizeof(root_drives[0])); root_index++)
{
- if(!nxIsDriveMounted(root_drives[root_index][1]))
+ if(!nxIsDriveMounted((char*)root_drives[root_index]))
continue;
- nfo->fname[0] = root_drives[root_index][1];
- nfo->fname[1] = '\0';
+ memcpy(nfo->fname, root_drives[root_index], sizeof(root_drives[0]));
+ //nfo->fname = root_drives[root_index];
nfo->fattrib = AM_DIR;
// Create default year and time for root dirs
@@ -479,4 +492,4 @@
// Not implemented
FILE_DBG("%s: NOT IMPLEMENTED\n", __FUNCTION__);
return FR_OK;
-}
\ No newline at end of file
+}
diff -ur ./src/libs/nxdk/lib/nxdk/automount_d.c ../LithiumX-DualHDD/src/libs/nxdk/lib/nxdk/automount_d.c
--- ./src/libs/nxdk/lib/nxdk/automount_d.c 2024-06-28 13:55:58.136000000 -0400
+++ ../LithiumX-DualHDD/src/libs/nxdk/lib/nxdk/automount_d.c 2024-08-01 01:43:43.288000000 -0400
@@ -11,7 +11,7 @@
__cdecl int automount_d_drive (void)
{
- if (nxIsDriveMounted('D')) {
+ if (nxIsDriveMounted("D")) {
return 0;
}
@@ -27,7 +27,7 @@
// Mount the obtained path as D:
BOOL success;
- success = nxMountDrive('D', targetPath);
+ success = nxMountDrive("D", targetPath);
assert(success);
return 0;
diff -ur ./src/libs/nxdk/lib/nxdk/mount.c ../LithiumX-DualHDD/src/libs/nxdk/lib/nxdk/mount.c
--- ./src/libs/nxdk/lib/nxdk/mount.c 2024-06-28 13:55:58.136000000 -0400
+++ ../LithiumX-DualHDD/src/libs/nxdk/lib/nxdk/mount.c 2024-08-01 01:42:32.208000000 -0400
@@ -8,15 +8,15 @@
#include <winbase.h>
#include <xboxkrnl/xboxkrnl.h>
-bool nxIsDriveMounted (char driveLetter)
+bool nxIsDriveMounted (char* driveLetter)
{
NTSTATUS status;
HANDLE handle;
ANSI_STRING drivePath;
- CHAR drivePathBuffer[7];
+ CHAR drivePathBuffer[20] = {0};
OBJECT_ATTRIBUTES objattr;
- sprintf(drivePathBuffer, "\\??\\%c:", driveLetter);
+ sprintf(drivePathBuffer, "\\??\\%s:", driveLetter);
RtlInitAnsiString(&drivePath, drivePathBuffer);
InitializeObjectAttributes(&objattr, &drivePath, OBJ_CASE_INSENSITIVE, NULL, NULL);
@@ -29,14 +29,14 @@
return false;
}
-bool nxMountDrive (char driveLetter, const char *path)
+bool nxMountDrive (char* driveLetter, const char *path)
{
NTSTATUS status;
ANSI_STRING drivePath;
- CHAR drivePathBuffer[7];
+ CHAR drivePathBuffer[20] = {0};
ANSI_STRING mountPath;
- sprintf(drivePathBuffer, "\\??\\%c:", driveLetter);
+ sprintf(drivePathBuffer, "\\??\\%s:", driveLetter);
RtlInitAnsiString(&drivePath, drivePathBuffer);
RtlInitAnsiString(&mountPath, path);
@@ -50,13 +50,13 @@
return true;
}
-bool nxUnmountDrive (char driveLetter)
+bool nxUnmountDrive (char* driveLetter)
{
NTSTATUS status;
ANSI_STRING drivePath;
- CHAR drivePathBuffer[7];
+ CHAR drivePathBuffer[20] = {0};
- sprintf(drivePathBuffer, "\\??\\%c:", driveLetter);
+ sprintf(drivePathBuffer, "\\??\\%s:", driveLetter);
RtlInitAnsiString(&drivePath, drivePathBuffer);
status = IoDeleteSymbolicLink(&drivePath);
diff -ur ./src/libs/nxdk/lib/nxdk/mount.h ../LithiumX-DualHDD/src/libs/nxdk/lib/nxdk/mount.h
--- ./src/libs/nxdk/lib/nxdk/mount.h 2024-06-28 13:55:58.136000000 -0400
+++ ../LithiumX-DualHDD/src/libs/nxdk/lib/nxdk/mount.h 2024-08-01 01:42:46.648000000 -0400
@@ -13,9 +13,9 @@
#include <stdbool.h>
#endif
-bool nxIsDriveMounted (char driveLetter);
-bool nxMountDrive (char driveLetter, const char *path);
-bool nxUnmountDrive (char driveLetter);
+bool nxIsDriveMounted (char* driveLetter);
+bool nxMountDrive (char* driveLetter, const char *path);
+bool nxUnmountDrive (char* driveLetter);
#ifdef __cplusplus
}
diff -ur ./src/lithiumx.h ../LithiumX-DualHDD/src/lithiumx.h
--- ./src/lithiumx.h 2024-06-28 13:55:18.772000000 -0400
+++ ../LithiumX-DualHDD/src/lithiumx.h 2024-08-01 03:55:40.896000000 -0400
@@ -63,7 +63,7 @@
//nxdk local directory is also mounting to Q: so we get Q:Q:..
#ifndef DASH_SEARCH_PATH_CONFIG
#ifdef NXDK
-#define DASH_SEARCH_PATH_CONFIG "E:\\UDATA\\LithiumX\\lithiumx.toml"
+#define DASH_SEARCH_PATH_CONFIG "HDD0-E:\\UDATA\\LithiumX\\lithiumx.toml"
#else
#define DASH_SEARCH_PATH_CONFIG "lithiumx.toml"
#endif
@@ -71,7 +71,7 @@
#ifndef DASH_DATABASE_PATH
#ifdef NXDK
-#define DASH_DATABASE_PATH "E:\\UDATA\\LithiumX\\lithiumx.db"
+#define DASH_DATABASE_PATH "HDD0-E:\\UDATA\\LithiumX\\lithiumx.db"
#else
#define DASH_DATABASE_PATH "lithiumx.db"
#endif
@@ -200,4 +200,4 @@
}
#endif
-#endif
\ No newline at end of file
+#endif
diff -ur ./src/platform/xbox/platform.c ../LithiumX-DualHDD/src/platform/xbox/platform.c
--- ./src/platform/xbox/platform.c 2024-06-28 16:01:47.012000000 -0400
+++ ../LithiumX-DualHDD/src/platform/xbox/platform.c 2024-08-16 19:12:41.508000000 -0400
@@ -129,47 +129,65 @@
debugPrint("%s ", loading_str);
// nxdk automounts D to the root xbe path. Lets undo that
- if (nxIsDriveMounted('D'))
+ if (nxIsDriveMounted("DVD-ROM"))
{
- nxUnmountDrive('D');
+ nxUnmountDrive("DVD-ROM");
}
// Mount the DVD drive
- nxMountDrive('D', "\\Device\\CdRom0");
+ nxMountDrive("DVD-ROM", "\\Device\\CdRom0");
// Mount root of LithiumX xbe to Q:
char targetPath[MAX_PATH];
nxGetCurrentXbeNtPath(targetPath);
*(strrchr(targetPath, '\\') + 1) = '\0';
- nxMountDrive('Q', targetPath);
+ nxMountDrive("ROOT", targetPath);
debugPrint(".");
// Mount stock partitions
- nxMountDrive('C', "\\Device\\Harddisk0\\Partition2\\");
- nxMountDrive('E', "\\Device\\Harddisk0\\Partition1\\");
- nxMountDrive('X', "\\Device\\Harddisk0\\Partition3\\");
- nxMountDrive('Y', "\\Device\\Harddisk0\\Partition4\\");
- nxMountDrive('Z', "\\Device\\Harddisk0\\Partition5\\");
+ nxMountDrive("HDD0-C", "\\Device\\Harddisk0\\Partition2\\");
+ nxMountDrive("HDD0-E", "\\Device\\Harddisk0\\Partition1\\");
+ nxMountDrive("HDD0-X", "\\Device\\Harddisk0\\Partition3\\");
+ nxMountDrive("HDD0-Y", "\\Device\\Harddisk0\\Partition4\\");
+ nxMountDrive("HDD0-Z", "\\Device\\Harddisk0\\Partition5\\");
debugPrint(".");
// Mount extended partitions
// NOTE: Both the retail kernel and modified kernels will mount these partitions
// if they exist and silently fail if they don't. So we can just try to mount them
// and not worry about checking if they exist.
- nxMountDrive('F', "\\Device\\Harddisk0\\Partition6\\");
- nxMountDrive('G', "\\Device\\Harddisk0\\Partition7\\");
- nxMountDrive('R', "\\Device\\Harddisk0\\Partition8\\");
- nxMountDrive('S', "\\Device\\Harddisk0\\Partition9\\");
- nxMountDrive('V', "\\Device\\Harddisk0\\Partition10\\");
- nxMountDrive('W', "\\Device\\Harddisk0\\Partition11\\");
- nxMountDrive('A', "\\Device\\Harddisk0\\Partition12\\");
- nxMountDrive('B', "\\Device\\Harddisk0\\Partition13\\");
- nxMountDrive('P', "\\Device\\Harddisk0\\Partition14\\");
+ nxMountDrive("HDD0-F", "\\Device\\Harddisk0\\Partition6\\");
+ nxMountDrive("HDD0-G", "\\Device\\Harddisk0\\Partition7\\");
+ nxMountDrive("HDD0-H", "\\Device\\Harddisk0\\Partition8\\");
+ nxMountDrive("HDD0-I", "\\Device\\Harddisk0\\Partition9\\");
+ nxMountDrive("HDD0-J", "\\Device\\Harddisk0\\Partition10\\");
+ nxMountDrive("HDD0-K", "\\Device\\Harddisk0\\Partition11\\");
+ nxMountDrive("HDD0-L", "\\Device\\Harddisk0\\Partition12\\");
+ nxMountDrive("HDD0-M", "\\Device\\Harddisk0\\Partition13\\");
+ nxMountDrive("HDD0-N", "\\Device\\Harddisk0\\Partition14\\");
+
+ // Mount any second drive partitions
+
+ nxMountDrive("HDD1-C", "\\Device\\Harddisk1\\Partition2\\");
+ nxMountDrive("HDD1-E", "\\Device\\Harddisk1\\Partition1\\");
+ nxMountDrive("HDD1-X", "\\Device\\Harddisk1\\Partition3\\");
+ nxMountDrive("HDD1-Y", "\\Device\\Harddisk1\\Partition4\\");
+ nxMountDrive("HDD1-Z", "\\Device\\Harddisk1\\Partition5\\");
+ nxMountDrive("HDD1-F", "\\Device\\Harddisk1\\Partition6\\");
+ nxMountDrive("HDD1-G", "\\Device\\Harddisk1\\Partition7\\");
+ nxMountDrive("HDD1-H", "\\Device\\Harddisk1\\Partition8\\");
+ nxMountDrive("HDD1-I", "\\Device\\Harddisk1\\Partition9\\");
+ nxMountDrive("HDD1-J", "\\Device\\Harddisk1\\Partition10\\");
+ nxMountDrive("HDD1-K", "\\Device\\Harddisk1\\Partition11\\");
+ nxMountDrive("HDD1-L", "\\Device\\Harddisk1\\Partition12\\");
+ nxMountDrive("HDD1-M", "\\Device\\Harddisk1\\Partition13\\");
+ nxMountDrive("HDD1-N", "\\Device\\Harddisk1\\Partition14\\");
+
debugPrint(".");
- CreateDirectoryA("E:\\UDATA", NULL);
- CreateDirectoryA("E:\\UDATA\\LithiumX", NULL);
- FILE *fp = fopen("E:\\UDATA\\LithiumX\\TitleMeta.xbx", "wb");
+ CreateDirectoryA("HDD0-E:\\UDATA", NULL);
+ CreateDirectoryA("HDD0-E:\\UDATA\\LithiumX", NULL);
+ FILE *fp = fopen("HDD0-E:\\UDATA\\LithiumX\\TitleMeta.xbx", "wb");
if (fp)
{
fprintf(fp, "TitleName=LithiumX Dashboard\r\n");
@@ -207,7 +225,7 @@
if (strcmp(dash_launch_path, "__MSDASH__") == 0)
{
// FIXME: Do we need to eject disk?
- strcpy(dash_launch_path, "C:\\xboxdash.xbe");
+ strcpy(dash_launch_path, "HDD0-C:\\xboxdash.xbe");
}
else if (strcmp(dash_launch_path, "__DVD__") == 0)
{