DRIVER_INIT_MEMBER(alg_state,palr3) { UINT32 length = memregion("user2")->bytes(); UINT8 *rom = memregion("user2")->base(); UINT8 *original = auto_alloc_array(machine(), UINT8, length); UINT32 srcaddr; memcpy(original, rom, length); for (srcaddr = 0; srcaddr < length; srcaddr++) { UINT32 dstaddr = srcaddr; if (srcaddr & 0x2000) dstaddr ^= 0x1000; rom[dstaddr] = original[srcaddr]; } auto_free(machine(), original); alg_init(); }
DRIVER_INIT_MEMBER(alg_state,aplatoon) { /* NOT DONE TODO FIGURE OUT THE RIGHT ORDER!!!! */ UINT8 *rom = memregion("user2")->base(); UINT8 *decrypted = auto_alloc_array(machine(), UINT8, 0x40000); int i; static const int shuffle[] = { 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31, 32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63 }; for (i = 0; i < 64; i++) memcpy(decrypted + i * 0x1000, rom + shuffle[i] * 0x1000, 0x1000); memcpy(rom, decrypted, 0x40000); logerror("decrypt done\n "); alg_init(); }
int main (int argc, char *argv[]) { GtkWidget *main_window; GOptionContext *context; GError *option_error; gchar *config_file_name, *dir; gboolean show_version = FALSE; GOptionEntry options[] = { { "version", 'v', 0, G_OPTION_ARG_NONE, &show_version, _("Show version information"), NULL }, {NULL} }; #ifdef WITH_HILDON HildonProgram *hildon_program; #endif #ifdef ENABLE_NLS bindtextdomain (PACKAGE, PACKAGE_LOCALE_DIR); bind_textdomain_codeset (PACKAGE, "UTF-8"); textdomain (PACKAGE); gtk_set_locale(); #endif /* Parse command line options */ context = g_option_context_new (NULL); g_option_context_set_summary(context, _("Carry out simple and scientific calculations")); #ifdef ENABLE_NLS g_option_context_add_main_entries (context, options, GETTEXT_PACKAGE); #else g_option_context_add_main_entries (context, options, NULL); #endif g_option_context_add_group (context, gtk_get_option_group (TRUE)); if (!g_option_context_parse (context, &argc, &argv, &option_error)) { if (option_error) g_print ("%s\n", option_error->message); return EXIT_FAILURE; } g_option_context_free (context); if(show_version == TRUE) { g_print(_("%s v%s, (c) 2002-2010 Simon Floery\n"), PACKAGE, VERSION); return EXIT_SUCCESS; } gtk_init (&argc, &argv); /* at first, get config file */ dir = g_build_filename (g_get_user_config_dir (), PACKAGE, NULL); g_mkdir_with_parents (dir, S_IRUSR | S_IWUSR | S_IXUSR); config_file_name = g_build_filename (dir, CONFIG_FILE_NAME, NULL); g_free(dir); prefs = config_file_read (config_file_name); constant = config_file_get_constants(); user_function = config_file_get_user_functions(); g_free (config_file_name); current_status.notation = prefs.def_notation; #ifdef WITH_HILDON gtkbuilder_register_widget (HILDON_TYPE_WINDOW, gtkbuilder_hildon_window_new, gtkbuilder_standard_build_children, NULL); hildon_program = HILDON_PROGRAM(hildon_program_get_instance()); #endif /* at first get the main frame */ /* sth like ui_launch_up_ui for splitting into first time wizard? */ main_window = ui_main_window_create(); #ifdef WITH_HILDON hildon_program_add_window(hildon_program, HILDON_WINDOW(main_window)); g_set_application_name(PACKAGE_NAME); create_hildon_menu(HILDON_WINDOW(main_window)); #endif /* set the window title */ #ifndef WITH_DEFCALC gtk_window_set_title ((GtkWindow *)main_window, PACKAGE_NAME); #else gtk_window_set_title ((GtkWindow *)main_window, "Calculator"); #endif /* set the window's icon */ #ifndef WITH_DEFCALC gtk_window_set_default_icon_name (PACKAGE); #else gtk_window_set_default_icon_name ("utilities-calculator"); #endif /* usually, only Shift, CTRL and ALT modifiers are paid attention to by * accelerator code. add MOD2 (NUMLOCK allover the world?) to the list. * We have to do this for a working keypad. */ gtk_accelerator_set_default_mod_mask (gtk_accelerator_get_default_mod_mask () | GDK_MOD2_MASK); /* prepare calc_basic */ main_alg = alg_init (0); rpn_init (prefs.stack_size, 0); /* apply changes */ apply_preferences (prefs); memory.data = NULL; memory.len = 0; /* see function key_snooper for details */ gtk_key_snooper_install (key_snooper, NULL); gtk_window_resize ((GtkWindow *)main_window, 1, 1); /* gtk_widget_show main window as late as possible */ gtk_widget_show (main_window); gtk_main (); /* save changes to file */ dir = g_build_filename (g_get_user_config_dir (), PACKAGE, NULL); g_mkdir_with_parents (dir, S_IRUSR | S_IWUSR | S_IXUSR); config_file_name = g_build_filename (dir, CONFIG_FILE_NAME, NULL); g_free(dir); config_file_write (config_file_name, prefs, constant, user_function); g_free (config_file_name); return EXIT_SUCCESS; }
DRIVER_INIT_MEMBER(alg_state,none) { alg_init(); }
DRIVER_INIT_MEMBER(alg_state,none) { alg_init(machine()); }