]> Chaos Git - corbenik/corbenik.git/commitdiff
Because people still have yet to learn their lesson regarding pointers shoved in...
authorchaoskagami <chaos.kagami@gmail.com>
Thu, 4 Aug 2016 05:44:19 +0000 (01:44 -0400)
committerchaoskagami <chaos.kagami@gmail.com>
Thu, 4 Aug 2016 05:44:19 +0000 (01:44 -0400)
Makefile.am
autogen.sh
configure.ac
include/std/draw.h
source/main.c
source/option.c
source/screeninit.c
source/std/allocator.c

index 7b893a18e268acb1ad45bbd549b7cca476a2f9af..1bf62034d23e98b8783b47049c88e418933319a8 100644 (file)
@@ -43,3 +43,6 @@ all-local:
        echo "wget http://nus.cdn.c.shop.nintendowifi.net/ccs/download/0004013820000202/cetk     -O .@datarootdir@/keys/agb.cetk" >> out/n3ds_firm.sh
        chmod 755 out/*.sh
        cp README.md LICENSE.txt out/
+
+clean-local:
+       rm -rf out
index fad27d8d50950e524565ecc44a64fab384140fdc..28a183b02bacabbeaa10492ad9a26f66f7f0f73a 100755 (executable)
@@ -1,3 +1,2 @@
 #!/bin/sh
-mkdir -p m4
 autoreconf -fi
index 82f672b80312ae2f7689d0efa8f9711355f317da..bf60672d78b47586e6e5bd7ff7a05670eb2925c4 100644 (file)
@@ -1,8 +1,6 @@
 AC_INIT([Corbenik], [0.1.2], [https://github.com/chaoskagami/corbenik], [corbenik])
 AM_INIT_AUTOMAKE([foreign no-dist-gzip dist-xz subdir-objects])
 
-AC_CONFIG_MACRO_DIRS([m4])
-
 # Find AR and RANLIB for lto support before initializing libtool
 AC_CHECK_TOOL([AR],gcc-ar)
 AC_CHECK_TOOL([RANLIB],gcc-ranlib)
index dbc88a645275ea6f1e54009d5b3e56e3c51f6174..ea6ed755d3723b98323e49364e3fd0b00275f9c5 100644 (file)
@@ -25,12 +25,15 @@ enum screen
     screen_bottom
 };
 
-_UNUSED static struct framebuffers
+struct framebuffers
 {
     uint8_t *top_left;
     uint8_t *top_right;
     uint8_t *bottom;
-} *framebuffers = (struct framebuffers *)0x23FFFE00;
+};
+
+_UNUSED static struct framebuffers *framebuffers_cakehax = (struct framebuffers *)0x23FFFE00;
+extern struct framebuffers *framebuffers;
 // This is marked unused since it occurs in all files.
 
 #define TOP_FB framebuffers->top_left
index 3da3db262e612dc93e6d1dd0c4dc60b7eb6feebc..01d0ed9475a4a82eae71f6510981b5e03b767bee 100644 (file)
@@ -19,19 +19,8 @@ main(int argc, char** argv)
 
     std_init();
 
-    int c = fmount();
-
-    if (c) {
-        // Failed to mount SD. Bomb out.
-        // TODO - What the hell does one even do in this situation?
-        //        Spin until the card is available to mount, maybe?
-        abort("Failed to mount SD card.\n");
-    }
-
-    if (argc >= 1 && argc < 2) {
-        // Valid argc passed.
-        fprintf(stderr, "Chainloaded. Path: %s\n", argv[0]);
-    }
+    if (fmount())
+        poweroff(); // Failed to mount SD. Bomb out.
 
     set_font(PATH_TERMFONT); // Read the font before all else.
 
index 88924d5ed040251f3d9555afb0e1ab7544ad1f28..c75fe99e479f8cf718564eaec1985b4fd065d0aa 100644 (file)
@@ -17,12 +17,10 @@ regenerate_config()
     config->options[OPTION_BRIGHTNESS]   = 3;
 
     if (!(conf_handle = fopen(PATH_CONFIG, "w")))
-        abort("Failed to open config for write?\n");
+        poweroff();
 
     fwrite(config, 1, sizeof(struct config_file), conf_handle);
     fclose(conf_handle);
-
-    fprintf(BOTTOM_SCREEN, "Config file written.\n");
 }
 
 void
@@ -60,7 +58,6 @@ update_config()
     int updated = 0;
 
     if (config->options[OPTION_ACCENT_COLOR] == 0) {
-        fprintf(stderr, "Config update: accent color\n");
         config->options[OPTION_ACCENT_COLOR] = 2;
         updated = 1;
     }
@@ -80,31 +77,17 @@ load_config()
 
     // Zero on success.
     if (!(conf_handle = fopen(PATH_CONFIG, "r"))) {
-        fprintf(BOTTOM_SCREEN, "Config file is missing:\n"
-                               "  %s\n"
-                               "Regenerating with defaults.\n",
-                PATH_CONFIG);
         regenerate_config();
     } else {
         fread(config, 1, sizeof(struct config_file), conf_handle);
         fclose(conf_handle);
 
         if (memcmp(&(config->magic), CONFIG_MAGIC, 4)) {
-            fprintf(BOTTOM_SCREEN, "Config file at:\n"
-                                   "  %s\n"
-                                   "has incorrect magic:\n"
-                                   "  '%c%c%c%c'\n"
-                                   "Regenerating with defaults.\n",
-                    PATH_CONFIG, config->magic[0], config->magic[1], config->magic[2], config->magic[3]);
             f_unlink(PATH_CONFIG);
             regenerate_config();
         }
 
         if (config->config_ver < config_version) {
-            fprintf(BOTTOM_SCREEN, "Config file has outdated version:\n"
-                                   "  %s\n"
-                                   "Regenerating with defaults.\n",
-                    PATH_CONFIG);
             f_unlink(PATH_CONFIG);
             regenerate_config();
         }
@@ -112,9 +95,6 @@ load_config()
 
     list_patches_build(PATH_PATCHES, 0);
 
-    if (!config->options[OPTION_SILENCE])
-        fprintf(BOTTOM_SCREEN, "Config file loaded.\n");
-
     update_config();
 }
 
index 9b1e255e95ec935796b5c57b5bd4ada51d6a3520..4f8b3a7558cf3148a5bf426753f26a87f3c4c451 100644 (file)
@@ -7,6 +7,8 @@
 
 static volatile uint32_t *const a11_entry = (volatile uint32_t *)0x1FFFFFF8;
 
+struct framebuffers* framebuffers = NULL;
+
 void
 screen_mode(uint32_t mode)
 {
@@ -39,6 +41,11 @@ screen_mode(uint32_t mode)
 
     while (*a11_entry);
 
+    if (!framebuffers) {
+        framebuffers = malloc(sizeof(struct framebuffers));
+        memcpy(framebuffers, framebuffers_cakehax, sizeof(struct framebuffers));
+    }
+
     // Turn on backlight
     i2cWriteRegister(I2C_DEV_MCU, 0x22, 1 << 1);
 }
index 7cda16e65e311d2b263dbbc3e768daae4cc86a21..b6b380d2e53056c4d62158c97f89c2d1a8cbf07e 100644 (file)
@@ -14,6 +14,8 @@ void* sbrk(size_t incr) {
     heap_end = &__end__;
   }
 
+  // FIXME - Make sure heap isn't leaking into stack here. That would be bad.
+
   prev_heap_end = heap_end;
 
   heap_end += incr;