void main() { clear_screens(); if(mount_sd() != 0) { draw_loading("Failed to mount SD", "Make sure your SD card can be read correctly"); return; } // This function already correctly draws error messages if (load_firm() != 0) return; if (load_cakes_info("/cakes/patches") != 0) { draw_loading("Failed to read some cakes", "Make sure your cakes are up to date\n and your SD card can be read correctly"); return; } load_config(); // If the L button isn't pressed, autoboot. if (config->autoboot_enabled && *hid_regs ^ 0xFFF ^ key_l) { boot_cfw(); } menu_main(); }
void main() { clear_screens(); if(mount_sd() != 0) { draw_loading("Failed to mount SD", "Make sure your SD card can be read correctly"); return; } load_config(); // If the L button isn't pressed, autoboot. if (config->autoboot_enabled && *hid_regs ^ 0xFFF ^ key_l) { print("Autobooting..."); if (read_file(firm_loc, PATH_PATCHED_FIRMWARE, FCRAM_SPACING) != 0 || firm_loc->magic != FIRM_MAGIC) { print("Failed to load patched FIRM"); draw_message("Failed to load patched FIRM", "The option to autoboot was selected,\n but no valid FIRM could be found at:\n " PATH_PATCHED_FIRMWARE); } else { if (read_file(memory_loc, PATH_MEMORY, FCRAM_SPACING) != 0) { print("Failed to load memory patches"); draw_message("Failed to load memory patches", "The option to autoboot was selected,\n but no valid memory patches could be found at:\n " PATH_MEMORY); } else { if (config->firm_console == console_n3ds && config->firm_ver > 0x0F) { slot0x11key96_init(); } // boot_firm() requires current_firm->console and current_firm->version. struct firm_signature config_firm = {.console = config->firm_console, .version = config->firm_ver}; current_firm = &config_firm; boot_firm(); } } } if (load_firms() != 0) { if(menu_firms() !=0) return; } print("Loading cakes"); if (load_cakes_info(PATH_PATCHES) != 0) { draw_loading("Failed to read some cakes", "Make sure your cakes are up to date\n and your SD card can be read correctly"); return; } load_config_cakes(); menu_main(); }
int main(int argc, char **argv) { int ch,i=0,j,end=3; grsim_init(); gr(); clear_screens(); while(1) { /* clear old colors */ for(j=0;j<40;j++) row_color[j]=0; gr(); set_row_color(i+0,14); // aqua set_row_color(i+1,6); // med-blue set_row_color(i+2,12); // light-green set_row_color(i+3,4); // green set_row_color(i+4,13); // yellow set_row_color(i+5,9); // orange set_row_color(i+6,11); // pink set_row_color(i+7,1); // red for(j=0;j<40;j++) { if (row_color[j]) { color_equals(row_color[j]); hlin(0,0,40,j); } } grsim_update(); ch=grsim_input(); if (ch=='q') exit(0); usleep(100000); i++; if (i>(ELEMENTS-1)) { i=0; end--; if (end==0) break; } // printf("\n"); } return 0; }
void main_game(int nb_players, char **names) { time_t INIT_TIME; time_t nb_sec_passed; struct tm *time_passed; int *pts, i; pts = malloc(sizeof(int) * nb_players); for (i=0; i<nb_players; i++) { PA_CreateSprite(0, 4*i+0, (void*)btn_moins_1, OBJ_SIZE_32X32, 1, 0, 64*i+0, 128); PA_CreateSprite(0, 4*i+1, (void*)btn_plus_1, OBJ_SIZE_32X32, 1, 0, 64*i+32, 128); PA_CreateSprite(0, 4*i+2, (void*)btn_moins_5, OBJ_SIZE_32X32, 1, 0, 64*i+0, 160); PA_CreateSprite(0, 4*i+3, (void*)btn_plus_5, OBJ_SIZE_32X32, 1, 0, 64*i+32, 160); } RESET: INIT_TIME = time(NULL); for (i=0; i<nb_players; i++) { pts[i] = 20; } while (true) { nb_sec_passed = time(NULL) - INIT_TIME; time_passed = localtime(&nb_sec_passed); clear_screens(); /* Reset */ if (Pad.Newpress.Start) goto RESET; /* Modifications au score */ for (i=0; i<nb_players; i++) { if (PA_SpriteTouched(4*i+0) && Stylus.Newpress) pts[i]--; if (PA_SpriteTouched(4*i+1) && Stylus.Newpress) pts[i]++; if (PA_SpriteTouched(4*i+2) && Stylus.Newpress) pts[i] -= 5; if (PA_SpriteTouched(4*i+3) && Stylus.Newpress) pts[i] += 5; if (pts[i] < 0) pts[i] = 0; /* Noms */ PA_OutputText(0, 8*i, 0, "%s", names[i]); /* Points */ PA_OutputText(0, 8*i+3, 2, "%02d", pts[i]); } /* Affichage du temps */ PA_OutputText(1, 0, 0, "Now"); PA_OutputText(1, 2, 1, "%02d:%02d:%02d %04d/%02d/%02d", PA_RTC.Hour, PA_RTC.Minutes, PA_RTC.Seconds, PA_RTC.Year, PA_RTC.Month, PA_RTC.Day); PA_OutputText(1, 0, 3, "Time played"); PA_OutputText(1, 2, 4, "%02d:%02d:%02d", time_passed->tm_hour, time_passed->tm_min, time_passed->tm_sec); PA_WaitForVBL(); } }