diff --git a/Makefile_lv2.mk b/Makefile_lv2.mk
index de8f5af..b38eed3 100644
--- a/Makefile_lv2.mk
+++ b/Makefile_lv2.mk
@@ -29,6 +29,8 @@ BINUTILS_VERSION = $(shell $(PREFIX)ld --version | grep ld | awk '{print $$5}')
#---------------------------------------------------------------------------------
CFLAGS = -ffunction-sections -fdata-sections -g -Os -Wall -Werror $(MACHDEP) $(INCLUDE)
+# extra defines, e.g. XELL_EXTRA=-DFAKE08_LOADER
+CFLAGS += $(XELL_EXTRA)
CXXFLAGS = $(CFLAGS)
ASFLAGS = -m32
diff --git a/source/lv2/main.c b/source/lv2/main.c
index fca038c..8fd10c7 100644
--- a/source/lv2/main.c
+++ b/source/lv2/main.c
@@ -38,6 +38,40 @@
#include "log.h"
+#ifdef FAKE08_LOADER
+#include <sys/stat.h>
+
+/*
+ * FAKE-08 loader: boot fake08.elf straight away, before networking, so that
+ * "XeLL Launch" + this xell.bin acts like a FAKE-08 app in Aurora/FSD.
+ * Falls back to normal XeLL behaviour if no fake08.elf is found.
+ */
+static void fake08_autoboot(void)
+{
+ static const char *dirs[] = {
+ "fake08", "Apps/FAKE-08", "Homebrew/FAKE-08", "Applications/FAKE-08", NULL
+ };
+ char path[256];
+ struct stat st;
+ int i, d;
+
+ for (i = 3; i < STD_MAX; i++) {
+ if (!devoptab_list[i] || !devoptab_list[i]->structSize)
+ continue;
+ for (d = 0; dirs[d]; d++) {
+ snprintf(path, sizeof(path), "%s:/%s/fake08.elf",
+ devoptab_list[i]->name, dirs[d]);
+ if (stat(path, &st) == 0) {
+ printf(" * FAKE-08: booting %s\n", path);
+ try_load_file(path, TYPE_ELF); /* only returns on failure */
+ printf(" ! FAKE-08: failed to boot %s\n", path);
+ }
+ }
+ }
+ printf(" * FAKE-08: fake08.elf not found, continuing as XeLL\n");
+}
+#endif
+
static const char *consoleNames[] =
{
"Xenon",
@@ -145,6 +179,20 @@ int main(){
xenon_config_init();
+#ifdef FAKE08_LOADER
+ /* storage first, so FAKE-08 starts without waiting for DHCP */
+ printf(" * usb init\n");
+ usb_init();
+ usb_do_poll();
+ printf(" * sata hdd init\n");
+ xenon_ata_init();
+#ifndef NO_DVD
+ xenon_atapi_init();
+#endif
+ mount_all_devices();
+ fake08_autoboot();
+#endif
+
#ifndef NO_NETWORKING
printf(" * network init\n");
@@ -156,6 +204,7 @@ int main(){
#endif
+#ifndef FAKE08_LOADER
printf(" * usb init\n");
usb_init();
usb_do_poll();
@@ -171,6 +220,7 @@ int main(){
#endif
mount_all_devices();
+#endif
/*int device_list_size = */ // findDevices();