예제 #1
0
   void action(const gcn::ActionEvent& actionEvent)
   {
     int selected_item;
     selected_item = lstConfigs->getSelected();
     if(!txtName->getText().compare(ConfigFilesList[selected_item]->Name))
     {
       //-----------------------------------------------
       // Selected same config again -> load and start it
       //-----------------------------------------------
       if(ConfigFilesList[selected_item]->BuildInID != BUILDINID_NONE) {
         load_buildin_config(ConfigFilesList[selected_item]->BuildInID);
         strcpy(changed_prefs.description, ConfigFilesList[selected_item]->Description);
       } else {
         target_cfgfile_load(&changed_prefs, ConfigFilesList[selected_item]->FullPath, 0, 0);
       }
       strncpy(last_active_config, ConfigFilesList[selected_item]->Name, MAX_PATH);
       DisableResume();
       RefreshAllPanels();
 			if(emulating)
 			  uae_reset(1, 1);
 			else
 			  uae_reset(0, 1);
 			gui_running = false;
     }
     else
     {
       txtName->setText(ConfigFilesList[selected_item]->Name);
       txtDesc->setText(ConfigFilesList[selected_item]->Description);
     }
   }
예제 #2
0
파일: svga.c 프로젝트: Pa0l0ne/Amiga360
static void my_kbd_handlerx (int scancode, int newstate)
{
    int akey = scancode2amiga (scancode);

    assert (scancode >= 0 && scancode < 0x100);
    if (scancode == SCODE_F12) {
	uae_quit ();
    } else if (scancode == SCODE_F11) {
	gui_requested = 1;
    }
    if (keystate[scancode] == newstate)
	return;

    keystate[scancode] = newstate;

    if (akey == -1)
	return;

    if (newstate == KEY_EVENTPRESS) {
	if (akey == AK_inhibit)
	    toggle_inhibit_frame (0);
	else
	    record_key (akey << 1);
    } else
	record_key ((akey << 1) | 1);

    /* "Affengriff" */
    if ((keystate[AK_CTRL] || keystate[AK_RCTRL]) && keystate[AK_LAMI] && keystate[AK_RAMI])
	uae_reset ();
}
예제 #3
0
파일: memory.c 프로젝트: trevornunes/uaesdl
uae_u8 REGPARAM2 *default_xlate (uaecptr a)
{
    printf ("Your Amiga program just did something terribly stupid\n");
    uae_reset (1);

    set_special (SPCFLAG_RESTORE_SANITY);
    /* rtarea_bank has an infinite loop in m68k space, which we use to avoid a
     * crash. */
    return rtarea_bank.xlateaddr (0xF0FFC0);
}
예제 #4
0
파일: uaelib.c 프로젝트: amigrave/PUAE
/*
 * Changes fast memory size
 *  (reboots)
 */
static uae_u32 REGPARAM2 emulib_ChgFMemSize (struct regstruct *regs, uae_u32 memsize)
{
    if (memsize != 0x100000 && memsize != 0x200000 &&
	memsize != 0x400000 && memsize != 0x800000) {
	memsize = 0;
	write_log ("Unsupported fastmem size!\n");
    }
    m68k_dreg (regs, 0) = 0;
    currprefs.fastmem_size = memsize;
    uae_reset (0);
    return 0;
}
예제 #5
0
파일: tui.c 프로젝트: ApolloniaUK/PUAE
static int do_gui (int mode)
{
    char cwd[1024];

    if (getcwd (cwd, 1024) == NULL)
	return 0;

    tui_setup ();

    for (;;) {
	int c;

	tui_selwin (0);
	print_configuration ();
	c = tui_menubrowse (mode == 0 ? mainmenu2 : mainmenu, MENU_COL_OFFSET, 4, 0, MAX_MENU_HEIGHT);
	if (c == -1) {
	    tui_shutdown ();
	    return -2;
	}
	if (mode == 1) {
	    if (c == 8)
		break;
	    switch (c) {
	     case 0: DiskOptions (); break;
	     case 1: VideoOptions (); break;
	     case 2: MemoryOptions (); break;
	     case 3: CPUOptions (); break;
	     case 4: HDOptions (); break;
	     case 5: SoundOptions (); break;
	     case 6: OtherOptions (); break;
	     case 7: save_settings (); break;
	    }
	} else {
	    if (c == 5)
		break;
	    switch (c) {
	     case 0: DiskOptions (); break;
	     case 1: OtherOptions (); break;
	     case 2: save_settings (); break;
	     case 3: uae_reset (0); break;
	     case 4: uae_quit (); break;
	    }
	}
    }
    tui_shutdown ();

    chdir (cwd);
    return 0;
}
예제 #6
0
파일: writelog.cpp 프로젝트: biglad/WinUAE
void jit_abort (const TCHAR *format,...)
{
	static int happened;
	int count;
	TCHAR buffer[WRITE_LOG_BUF_SIZE];
	va_list parms;
	va_start (parms, format);

	count = _vsntprintf (buffer, WRITE_LOG_BUF_SIZE - 1, format, parms);
	writeconsole (buffer);
	va_end (parms);
	if (!happened)
		gui_message (_T("JIT: Serious error:\n%s"), buffer);
	happened = 1;
	uae_reset (1, 0);
}
예제 #7
0
static void gayle_cs_change (uae_u8 mask, int onoff)
{
	int changed = 0;
	if ((gayle_cs & mask) && !onoff) {
		gayle_cs &= ~mask;
		changed = 1;
	} else if (!(gayle_cs & mask) && onoff) {
		gayle_cs |= mask;
		changed = 1;
	}
	if (changed) {
		gayle_irq |= mask;
		rethink_gayle ();
		if ((mask & GAYLE_CS_CCDET) && (gayle_irq & (GAYLE_IRQ_RESET | GAYLE_IRQ_BERR)) != (GAYLE_IRQ_RESET | GAYLE_IRQ_BERR)) {
			if (gayle_irq & GAYLE_IRQ_RESET)
				uae_reset (0, 0);
			if (gayle_irq & GAYLE_IRQ_BERR)
				Exception (2);
		}
	}
}
예제 #8
0
void jit_abort (const char *fmt, ...)
{
    va_list ap;
    va_start (ap, fmt);
#ifdef HAVE_VFPRINTF
    vfprintf (stderr, fmt, ap);
#else
    /* Technique stolen from GCC.  */
    {
	int x1, x2, x3, x4, x5, x6, x7, x8;
	x1 = va_arg (ap, int);
	x2 = va_arg (ap, int);
	x3 = va_arg (ap, int);
	x4 = va_arg (ap, int);
	x5 = va_arg (ap, int);
	x6 = va_arg (ap, int);
	x7 = va_arg (ap, int);
	x8 = va_arg (ap, int);
	fprintf (stderr, fmt, x1, x2, x3, x4, x5, x6, x7, x8);
    }
#endif
	uae_reset(1, 0);
}
예제 #9
0
파일: libamiga.cpp 프로젝트: emoon/fs-uae
int amiga_reset(int hard) {
    uae_reset(hard, 1);
    return hard;
}
예제 #10
0
파일: main.cpp 프로젝트: CypherXG/UAE4Droid
extern "C" void
JAVA_EXPORT_NAME(DemoActivity_nativeReset) ( JNIEnv*  env, jobject  thiz) {
    uae_reset();
}
예제 #11
0
파일: menu.c 프로젝트: libretro/PUAE
void gui_display (int shortcut){

	void* stor = display ? malloc(display->h * display->pitch) : 0;
	if (stor) memcpy(stor, display->pixels, display->h * display->pitch);

	if (tmpSDLScreen == NULL) {
		tmpSDLScreen = SDL_DisplayFormat(display);
		if (tmpSDLScreen == NULL) {
			write_log ("SDLUI: Failed to create temp screen\n");
			abort();
		} else {
			write_log ("SDLUI: Created temp screen %dx%dx%d\n", display->w, display->h, display->format->BitsPerPixel);
		}
	}
	SDL_Event event;

	int menu_exitcode = -1;
	int mainloopdone = 0;
	int mouse_x = 30;
	int mouse_y = 40;
	int kup = 0;
	int kdown = 0;
	int kleft = 0;
	int kright = 0;
	int ksel = 0;
	int iconpos_x = 0;
	int iconpos_y = 0;

	if (getcwd (launchDir, 256)) {
		strcpy (yol, launchDir);
		write_log ("SDLUI: current dir: %s\n", launchDir);
	} else {
		write_log("getcwd failed with errno %d\n", errno);
		return;
	}

	/* set a proper keyboard delay so we can move through lists without having
	   hammer the keyboard... */
	SDL_EnableKeyRepeat(SDL_DEFAULT_REPEAT_DELAY, SDL_DEFAULT_REPEAT_INTERVAL);

	int need_redraw = 1;
	while (!mainloopdone) {
		while (SDL_PollEvent(&event)) {
			need_redraw = 1;
			switch(event.type) {
				case SDL_QUIT:
					mainloopdone = 1; break;
				case SDL_JOYBUTTONDOWN:
					switch (event.jbutton.button) {
						case PLATFORM_BUTTON_R: break;
						case PLATFORM_BUTTON_L: break;
						case PLATFORM_BUTTON_UP: kup = 1; break;
						case PLATFORM_BUTTON_DOWN: kdown = 1; break;
						case PLATFORM_BUTTON_LEFT: kleft = 1; break;
						case PLATFORM_BUTTON_RIGHT: kright = 1; break;
						case PLATFORM_BUTTON_CLICK: ksel = 1; break;
						case PLATFORM_BUTTON_B: ksel = 1; break;
						case PLATFORM_BUTTON_Y: break;
						case PLATFORM_BUTTON_START: mainloopdone = 1; break;
					}
					break;
				case SDL_KEYDOWN:
	    				switch (event.key.keysym.sym) {
						case SDLK_RETURN:
						if((event.key.keysym.mod & KMOD_LALT) ||
						   (event.key.keysym.mod & KMOD_RALT)) {
							toggle_fullscreen(0);
							//SDL_Delay(100);
							break;
						} else {
							// enter to select
							ksel = 1; break;
						}
						case SDLK_ESCAPE:	mainloopdone = 1; break;
					 	case SDLK_UP:		kup = 1; break;
						case SDLK_DOWN:		kdown = 1; break;
						case SDLK_LEFT:		kleft = 1; break;
						case SDLK_RIGHT:	kright = 1; break;
						// space to run default
						case SDLK_SPACE:	selected_item = menu_sel_run; ksel =1; break;
						default: break;
					}
					break;
				case SDL_MOUSEMOTION:
					mouse_x += event.motion.xrel;
					mouse_y += event.motion.yrel;
					break;
				case SDL_MOUSEBUTTONDOWN:
					if (selected_item == 0) {
						if (mouse_x >= 0 && mouse_x <= 20) {
							if (mouse_y >= 0 && mouse_y <= 20) {
								mainloopdone = 1;
							}
						}
					} else {
						ksel = 1; break;
					}
					break;
				case SDL_ACTIVEEVENT: case SDL_KEYUP: break;
				default:
					dprintf(2, "got event %lu\n", (long) event.type);
					need_redraw = 0;
			}
		}
		if(!need_redraw) { SDL_Delay(20); continue; }
		if (ksel == 1) {
			if (selected_item == menu_sel_expansion) {
				sprintf (msg, "%s", "Select KickStart ROM");
				sprintf (msg_status, "%s", "EXIT: Back/ESC");
				sprintf (yol, "%s/roms", launchDir);
				dirz(1);
			}
			if (selected_item == menu_sel_floppy) {
				sprintf (msg, "%s", "Select Disk Image");
				sprintf (msg_status, "%s", "DF0: B  DF1: A");
				sprintf (yol, "%s/disks", launchDir);
				dirz(0);
			}
			if (selected_item == menu_sel_prefs) {
				sprintf (msg, "%s", "Emulation Configuration");
				sprintf (msg_status, "%s", "EXIT: Back/ESC");
				prefz(0);
			}
			if (selected_item == menu_sel_reset) {
				uae_reset(0, 1);
				menu_exitcode = 2;
				mainloopdone = 1;
			}
			if (selected_item == menu_sel_keymaps) {
			}
/*			if (selected_item == menu_sel_tweaks) {
				sprintf(msg,"%s","Tweaks");
				sprintf(msg_status,"%s","L/R = -/+  B: Apply");
				tweakz(0);
			}*/
			if (selected_item == menu_sel_storage) {
				strcpy(msg, "Savestates");
				strcpy(msg_status, "LOAD: A SAVE: B");
				sprintf (yol, "%s/saves", launchDir);
				dirz(2);
			}
			if (selected_item == menu_sel_run) {
				menu_exitcode = 1;
				mainloopdone = 1;
			}
			if (selected_item == menu_sel_exit) {
				SDL_Quit();
				exit(0);
			}
			ksel = 0;
		}
	// background
		SDL_BlitSurface (pMenu_Surface, NULL, tmpSDLScreen, NULL);

	// icons
        	iconpos_x = 10;
	        iconpos_y = 33;

        	selected_hilite (iconpos_x, iconpos_y, mouse_x, mouse_y, icon_floppy, menu_sel_floppy);
	        blit_image (icon_floppy, iconpos_x, iconpos_y);

	        iconpos_x += iconsizex + bosluk;
        	selected_hilite (iconpos_x, iconpos_y, mouse_x, mouse_y, icon_preferences, menu_sel_prefs);
	        blit_image (icon_preferences, iconpos_x, iconpos_y);

//	        iconpos_x += iconsizex + bosluk;
//        	selected_hilite (iconpos_x, iconpos_y, mouse_x, mouse_y, icon_tweaks, menu_sel_tweaks);
//	        blit_image (icon_tweaks, iconpos_x, iconpos_y);

        	iconpos_x += iconsizex + bosluk;
	        selected_hilite (iconpos_x, iconpos_y, mouse_x, mouse_y, icon_keymaps, menu_sel_keymaps);
        	blit_image (icon_keymaps, iconpos_x, iconpos_y);

	        iconpos_x += iconsizex + bosluk;
	        selected_hilite (iconpos_x, iconpos_y, mouse_x, mouse_y, icon_expansion, menu_sel_expansion);
        	blit_image (icon_expansion, iconpos_x, iconpos_y);

        	iconpos_x = 10;
	        iconpos_y = iconpos_y + iconsizey + bosluk;

        	selected_hilite (iconpos_x,iconpos_y,mouse_x,mouse_y,icon_storage, menu_sel_storage);
	        blit_image (icon_storage, iconpos_x, iconpos_y);

	        iconpos_x += iconsizex + bosluk;
	        selected_hilite (iconpos_x,iconpos_y,mouse_x,mouse_y, icon_reset, menu_sel_reset);
        	blit_image (icon_reset, iconpos_x, iconpos_y);

	        iconpos_x += iconsizex + bosluk;
        	selected_hilite (iconpos_x,iconpos_y,mouse_x,mouse_y, icon_run, menu_sel_run);
	        blit_image (icon_run, iconpos_x, iconpos_y);

        	iconpos_x += iconsizex + bosluk;
	        selected_hilite (iconpos_x,iconpos_y,mouse_x,mouse_y, icon_exit, menu_sel_exit);
        	blit_image (icon_exit, iconpos_x, iconpos_y);
	// texts
		write_text (TITLE_X, TITLE_Y, "PUAE //GnoStiC");

	// mouse pointer ------------------------------
		if (kleft == 1) {
	                mouse_x -= (iconsizex + bosluk);
        	        kleft = 0;
		}
		if (kright == 1) {
	                mouse_x += (iconsizex + bosluk);
	                kright = 0;
		}
	        if (kup == 1) {
	                mouse_y -= (iconsizey + bosluk);
	                kup = 0;
		}
		if (kdown == 1) {
        	        kdown = 0;
	                mouse_y += (iconsizey + bosluk);
		}

#define _MENU_X 640
#define _MENU_Y 480

		if (mouse_x < 1) { mouse_x = 1; }
		if (mouse_y < 1) { mouse_y = 1; }
/* pMainMenu_Surface->w */
#define MOUSE_MAX_X (_MENU_X - pMouse_Pointer->w)
#define MOUSE_MAX_Y (_MENU_Y - pMouse_Pointer->h)
		if (mouse_x > MOUSE_MAX_X) { mouse_x = MOUSE_MAX_X; }
		if (mouse_y > MOUSE_MAX_Y) { mouse_y = MOUSE_MAX_Y; }
		rect.x = mouse_x;
		rect.y = mouse_y;
		//rect.w = pMouse_Pointer->w;
		//rect.h = pMouse_Pointer->h;
		SDL_BlitSurface (pMouse_Pointer, NULL, tmpSDLScreen, &rect);
		// mouse pointer-end

		SDL_BlitSurface (tmpSDLScreen, NULL, display, NULL);
#ifdef USE_GL
		flush_gl_buffer (&glbuffer, 0, display->h - 1);
		render_gl_buffer (&glbuffer, 0, display->h - 1);
		glFlush ();
		SDL_GL_SwapBuffers ();
#else
		SDL_Flip (display);
#endif
		need_redraw = 0;
		SDL_Delay(20);
	} //while done

	if (stor) {
		memcpy(display->pixels, stor, display->h * display->pitch);
		free(stor);
		SDL_Flip(display);
	}

	SDL_EnableKeyRepeat(0, 0); /* disable keyrepeat again */
//	return menu_exitcode;
}
예제 #12
0
static void ersatz_init (void)
{
    int f;
    uaecptr request;
    uaecptr a;

    already_failed = 0;
    write_log ("initializing kickstart replacement\n");
    if (disk_empty (0)) {
	    already_failed = 1;
	    notify_user (NUMSG_KICKREP);
	    uae_restart (-1, NULL);
	    return;
    }

    regs.s = 0;

    /* Set some interrupt vectors */
    for (a = 8; a < 0xC0; a += 4) {
	put_long (a, 0xF8001A);
    }
    regs.isp = regs.msp = regs.usp = 0x800;
    m68k_areg(&regs, 7) = 0x80000;
    regs.intmask = 0;

    /* Build a dummy execbase */
    put_long (4, m68k_areg(&regs, 6) = 0x676);
    put_byte (0x676 + 0x129, 0);
    for (f = 1; f < 105; f++) {
	put_word (0x676 - 6*f, 0x4EF9);
	put_long (0x676 - 6*f + 2, 0xF8000C);
    }
    /* Some "supported" functions */
    put_long (0x676 - 456 + 2, 0xF80014);
    put_long (0x676 - 216 + 2, 0xF80020);
    put_long (0x676 - 198 + 2, 0xF80026);
    put_long (0x676 - 204 + 2, 0xF8002c);
    put_long (0x676 - 210 + 2, 0xF8002a);

    /* Build an IORequest */
    request = 0x800;
    put_word (request + 0x1C, 2);
    put_long (request + 0x28, 0x4000);
    put_long (request + 0x2C, 0);
    put_long (request + 0x24, 0x200 * 4);
    m68k_areg(&regs, 1) = request;
    ersatz_doio ();
    /* kickstart disk loader */
    if (get_long(0x4000) == 0x4b49434b) {
	/* a kickstart disk was found in drive 0! */
	write_log ("Loading Kickstart rom image from Kickstart disk\n");
	/* print some notes... */
	write_log ("NOTE: if UAE crashes set CPU to 68000 and/or chipmem size to 512KB!\n");

	/* read rom image from kickstart disk */
	put_word (request + 0x1C, 2);
	put_long (request + 0x28, 0xF80000);
	put_long (request + 0x2C, 0x200);
	put_long (request + 0x24, 0x200 * 512);
	m68k_areg(&regs, 1) = request;
	ersatz_doio ();

	/* read rom image once again to mirror address space.
	   not elegant, but it works... */
	put_word (request + 0x1C, 2);
	put_long (request + 0x28, 0xFC0000);
	put_long (request + 0x2C, 0x200);
	put_long (request + 0x24, 0x200 * 512);
	m68k_areg(&regs, 1) = request;
	ersatz_doio ();

	disk_eject (0);

	m68k_setpc (&regs, 0xFC0002);
	fill_prefetch_slow (&regs);
	uae_reset (0);
	ersatzkickfile = 0;
	return;
    }

    m68k_setpc (&regs, 0x400C);
    fill_prefetch_slow (&regs);

    /* Init the hardware */
    put_long (0x3000, 0xFFFFFFFEul);
    put_long (0xDFF080, 0x3000);
    put_word (0xDFF088, 0);
    put_word (0xDFF096, 0xE390);
    put_word (0xDFF09A, 0xE02C);
    put_word (0xDFF09E, 0x0000);
    put_word (0xDFF092, 0x0038);
    put_word (0xDFF094, 0x00D0);
    put_word (0xDFF08E, 0x2C81);
    put_word (0xDFF090, 0xF4C1);
    put_word (0xDFF02A, 0x8000);

    put_byte (0xBFD100, 0xF7);
    put_byte (0xBFEE01, 0);
    put_byte (0xBFEF01, 0x08);
    put_byte (0xBFDE00, 0x04);
    put_byte (0xBFDF00, 0x84);
    put_byte (0xBFDD00, 0x9F);
    put_byte (0xBFED01, 0x9F);
}
예제 #13
0
static void ersatz_init (void)
{
    int f;
    uaecptr request;
    uaecptr a;

    if (disk_empty (0)) {
	write_log ("You need to have a diskfile in DF0 to use the Kickstart replacement!\n");
	uae_quit ();
	_68k_setpc (0xF80010);
	return;
    }

    _68k_sreg = 0;
    /* Set some interrupt vectors */
    for (a = 8; a < 0xC0; a += 4) {
	put_long (a, 0xF8001A);
    }
    _68k_ispreg = _68k_mspreg = _68k_uspreg = 0x800;
    _68k_areg(7) = 0x80000;
#ifndef USE_FAME_CORE
    _68k_intmask = 0;
#endif

    /* Build a dummy execbase */
    put_long (4, _68k_areg(6) = 0x676);
    put_byte (0x676 + 0x129, 0);
    for (f = 1; f < 105; f++) {
	put_word (0x676 - 6*f, 0x4EF9);
	put_long (0x676 - 6*f + 2, 0xF8000C);
    }
    /* Some "supported" functions */
    put_long (0x676 - 456 + 2, 0xF80014);
    put_long (0x676 - 216 + 2, 0xF80020);
    put_long (0x676 - 198 + 2, 0xF80026);
    put_long (0x676 - 204 + 2, 0xF8002c);
    put_long (0x676 - 210 + 2, 0xF8002a);

    /* Build an IORequest */
    request = 0x800;
    put_word (request + 0x1C, 2);
    put_long (request + 0x28, 0x4000);
    put_long (request + 0x2C, 0);
    put_long (request + 0x24, 0x200 * 4);
    _68k_areg(1) = request;
    ersatz_doio ();
    /* kickstart disk loader */
    if (get_long(0x4000) == 0x4b49434b) {
	/* a kickstart disk was found in drive 0! */
	write_log ("Loading Kickstart rom image from Kickstart disk\n");
	/* print some notes... */
	write_log ("NOTE: if UAE crashes set CPU to 68000 and/or chipmem size to 512KB!\n");

	/* read rom image from kickstart disk */
	put_word (request + 0x1C, 2);
	put_long (request + 0x28, 0xF80000);
	put_long (request + 0x2C, 0x200);
	put_long (request + 0x24, 0x200 * 512);
	_68k_areg(1) = request;
	ersatz_doio ();

	/* read rom image once ajain to mirror address space.
	   not elegant, but it works... */
	put_word (request + 0x1C, 2);
	put_long (request + 0x28, 0xFC0000);
	put_long (request + 0x2C, 0x200);
	put_long (request + 0x24, 0x200 * 512);
	_68k_areg(1) = request;
	ersatz_doio ();

	disk_eject (0);

	_68k_setpc (0xFC0002);
	fill_prefetch_0 ();
	uae_reset ();
	ersatzkickfile = 0;
	return;
    }

    _68k_setpc (0x400C);
    fill_prefetch_0 ();

    /* Init the hardware */
    put_long (0x3000, 0xFFFFFFFEul);
    put_long (0xDFF080, 0x3000);
    put_word (0xDFF088, 0);
    put_word (0xDFF096, 0xE390);
    put_word (0xDFF09A, 0xE02C);
    put_word (0xDFF09E, 0x0000);
    put_word (0xDFF092, 0x0038);
    put_word (0xDFF094, 0x00D0);
    put_word (0xDFF08E, 0x2C81);
    put_word (0xDFF090, 0xF4C1);
    put_word (0xDFF02A, 0x8000);

    put_byte (0xBFD100, 0xF7);
    put_byte (0xBFEE01, 0);
    put_byte (0xBFEF01, 0x08);
    put_byte (0xBFDE00, 0x04);
    put_byte (0xBFDF00, 0x84);
    put_byte (0xBFDD00, 0x9F);
    put_byte (0xBFED01, 0x9F);
}
예제 #14
0
파일: uaelib.c 프로젝트: amigrave/PUAE
static uae_u32 emulib_Reset (void)
{
    uae_reset(0);
    return 0;
}
예제 #15
0
파일: html_gui.c 프로젝트: Yamakuzure/PUAE
/*
 * gui_handle_events()
 *
 * This is called from the main UAE thread to process events sent from
 * the GUI thread.
 *
 * If the UAE emulation proper is not running yet or is paused,
 * this loops continuously waiting for and responding to events
 * until the emulation is started or resumed, respectively. When
 * the emulation is running, this is called periodically from
 * the main UAE event loop.
 */
void gui_handle_events (void)
{
    /* Read GUI command if any. */

    /* Process it, e.g., call uae_reset(). */
    while (comm_pipe_has_data (&from_gui_pipe) || gui_pause_uae) {
        DEBUG_LOG("gui_handle_events: trying to read...\n");
        int32_t cmd = read_comm_pipe_int_blocking (&from_gui_pipe);
        DEBUG_LOG("gui_handle_events: %i\n", cmd);

        switch (cmd) {
        case UAECMD_EJECTDISK: {
            int32_t n = read_comm_pipe_int_blocking (&from_gui_pipe);
            uae_sem_wait(&gui_sem);
            changed_prefs.floppyslots[n].df[0] = '\0';
            uae_sem_post(&gui_sem);
            continue;
        }
        case UAECMD_INSERTDISK: {
            int32_t n = read_comm_pipe_int_blocking (&from_gui_pipe);
            if (using_restricted_cloanto_rom) {
                write_log("Loading other disks is not permitted under the "
                          "license for the built-in Cloanto Kickstart "
                          "ROM.\n");
                continue;
            }
            uae_sem_wait(&gui_sem);
            strncpy (changed_prefs.floppyslots[n].df, new_disk_string[n], 255);
            free (new_disk_string[n]);
            new_disk_string[n] = 0;
            changed_prefs.floppyslots[n].df[255] = '\0';
            uae_sem_post(&gui_sem);
            continue;
        }
        case UAECMD_RESET:
            uae_reset(1);
            break; // Stop GUI command processing until UAE is ready again.
        case UAECMD_PAUSE:
            gui_pause_uae = 1;
            continue;
        case UAECMD_RESUME:
            gui_pause_uae = 0;
            continue;
        case UAECMD_SELECT_ROM:
            uae_sem_wait(&gui_sem);
            strncpy(changed_prefs.romfile, gui_romname, 255);
            changed_prefs.romfile[255] = '\0';
            free(gui_romname);
            gui_romname = 0;

            /* Switching to non-restricted ROM; rebooting. */
            using_restricted_cloanto_rom = 0;
            uae_reset(1);

            uae_sem_post(&gui_sem);
            continue;
        case UAECMD_RESIZE: {
            int32_t width = read_comm_pipe_int_blocking(&from_gui_pipe);
            int32_t height = read_comm_pipe_int_blocking(&from_gui_pipe);
            screen_size_changed(width, height);
            continue;
        }
        default:
            DEBUG_LOG("Unknown command %d received from GUI.\n", cmd);
            continue;
        }
    }
}
예제 #16
0
uae_u8 REGPARAM2 *default_xlate (uaecptr a)
{
    write_log ("Your Amiga program just did something terribly stupid\n");
    uae_reset ();
    return kickmem_xlate (get_long (0xF80000));	/* So we don't crash. */
}
예제 #17
0
// Handler for the XM_NOTIFY message
HRESULT CRomListScene::OnNotifyPress( HXUIOBJ hObjPressed, 
       BOOL& bHandled )
    {
		int nIndex;
		wchar_t tmpFile[MAX_PATH];

        if ( hObjPressed == m_RomList )
        {
			nIndex = m_RomList.GetCurSel(); 
			 									 
			mainloopdone = 1;
			bHandled = TRUE;
			return S_OK;
			
        }
		else if ( hObjPressed == m_DriveList )
        {
            nIndex = m_DriveList.GetCurSel();
            //m_text1.SetText(m_commonlist.GetText(nIndex));;
            // handle list item press here...

			bHandled = TRUE;
			return S_OK;

        }
		else if (hObjPressed == m_DiskEject)
		{

			switch (currDrive)
			{
			case 0:
				swprintf_s(tmpFile, L"DF0 : Empty");
				m_DeviceDrive1.SetText(tmpFile);			 
				break;
			case 1:
				swprintf_s(tmpFile, L"DF1 : Empty");
				m_DeviceDrive2.SetText(tmpFile);			 
				break;
			case 2:
				swprintf_s(tmpFile, L"DF2 : Empty");
				m_DeviceDrive3.SetText(tmpFile);			 
				break;
			case 3:
				swprintf_s(tmpFile, L"DF3 : Empty");
				m_DeviceDrive4.SetText(tmpFile);			 
				break;
			}

			disk_eject(currDrive);

			bHandled = TRUE;
			return S_OK;

		}
		else if (hObjPressed == m_InsertDiskDrive0)
		{
			nIndex = m_RomList.GetCurSel(); 			 			 
		 				  
			switch (currDrive)
			{
			case 0:
				swprintf_s(tmpFile, L"DF0 : %S", (char *)m_ListData[nIndex].c_str());
				m_DeviceDrive1.SetText(tmpFile);			 
				break;
			case 1:
				swprintf_s(tmpFile, L"DF1 : %S", (char *)m_ListData[nIndex].c_str());
				m_DeviceDrive2.SetText(tmpFile);			 
				break;
			case 2:
				swprintf_s(tmpFile, L"DF2 : %S", (char *)m_ListData[nIndex].c_str());
				m_DeviceDrive3.SetText(tmpFile);			 
				break;
			case 3:
				swprintf_s(tmpFile, L"DF3 : %S", (char *)m_ListData[nIndex].c_str());
				m_DeviceDrive4.SetText(tmpFile);			 
				break;
			}
			
			

			strcpy(szRoms,"GAME:\\ROMS\\");
			strcat(szRoms,(char *)m_ListData[nIndex].c_str());


			if (currprefs.nr_floppies-1 < currDrive ) {
				currprefs.nr_floppies = currDrive  + 1;
			}

		 
			if (currprefs.floppyslots[currDrive].dfxtype < 0) {
				currprefs.floppyslots[currDrive].dfxtype = 0;
				DISK_check_change();
			}

 

			strcpy(changed_prefs.floppyslots[currDrive].df, szRoms);
			disk_insert (currDrive, changed_prefs.floppyslots[currDrive].df);
 

			config_changed = 1;
			bHandled = TRUE;
			return S_OK;
			


		}
		else if (hObjPressed == m_SwitchDrive)
		{

			
			currDrive++;

			if (currDrive > 3)
			{
				currDrive = 0;
			}

			switch (currDrive)
			{
			case 0:
				swprintf_s(tmpFile, L"Current Drive : DF0");
				break;
			case 1:
				swprintf_s(tmpFile, L"Current Drive : DF1");
				break;
			case 2:
				swprintf_s(tmpFile, L"Current Drive : DF2");
				break;
			case 3:
				swprintf_s(tmpFile, L"Current Drive : DF3");
				break;
			}

			m_SwitchDrive.SetText(tmpFile);


			bHandled = TRUE;
			return S_OK;

			
		}
		else if (hObjPressed == m_Kick)
		{

			XuiSceneCreate( L"file://game:/media/skin.xzp#Skin\\", L"KickStart.xur", NULL, &hKickScene );
			this->NavigateForward(hKickScene);	

			bHandled = TRUE;
			return S_OK;
		}		 
		else if (hObjPressed == m_ResetAmiga)
		{		
			uae_reset(0);
			mainloopdone = 1;
			return S_OK;
		}
		else if (hObjPressed == m_Back)
		{

			this->NavigateBack(hMainScene);
			bHandled = TRUE;
			return S_OK;

		}
		
 
		 
        bHandled = TRUE;
        return S_OK;
    }
예제 #18
0
파일: main.cpp 프로젝트: CypherXG/UAE4Droid
extern "C" void
JAVA_EXPORT_NAME(DemoActivity_setPrefs) ( JNIEnv*  env, jobject  thiz, jstring rom, jstring romkey, jstring hddir, jstring hdfile, jstring floppy1, jstring floppy2, jstring floppy3, jstring floppy4, jint frameskip, jint floppyspeed, jint cpu_model, jint chip_mem, jint slow_mem, jint fast_mem, jint chipset, jint cpu_speed, jint change_sound, jint sound, jint change_disk, jint reset, jint drive_status, jint ntsc ) {
    if (rom)
    {
        const char *srom = (env)->GetStringUTFChars(rom, 0);
        strcpy(romfile, srom);
        (env)->ReleaseStringUTFChars(rom, srom);
    }
    
    if (romkey)
    {
        const char *sromkey = (env)->GetStringUTFChars(romkey, 0);
        strcpy(romkeyfile, sromkey);
        (env)->ReleaseStringUTFChars(romkey, sromkey);
    }

    if (change_disk)
    {
        savestate_state = 0;
    }
    default_prefs_uae (&currprefs);
    default_prefs();
    
    mainMenu_floppyspeed = floppyspeed;
    mainMenu_CPU_model = cpu_model; // m68020
    mainMenu_chipMemory = chip_mem; // 2MB
    mainMenu_slowMemory = slow_mem;
    mainMenu_fastMemory = fast_mem;
    mainMenu_chipset = chipset; // aga
    mainMenu_CPU_speed = cpu_speed; // 500/5T/a1200/12T/12T2

    __android_log_print(ANDROID_LOG_INFO, "UAE", "floppyspeed= %d, cpu_model= %d, chip_mem= %d, slow_mem= %d, fast_mem= %d, chipset= %d, cpu_speed= %d", floppyspeed, cpu_model, chip_mem, slow_mem, fast_mem, chipset, cpu_speed);

    UpdateCPUModelSettings(&changed_prefs);
    UpdateMemorySettings(&changed_prefs);
    UpdateChipsetSettings(&changed_prefs);
    if (change_disk && uae4all_hard_dir[0] != '\0' && currprefs.mountinfo) {
        __android_log_print(ANDROID_LOG_INFO, "UAE", "kill_filesys_unit hd dir: %s", uae4all_hard_dir);
        kill_filesys_unit(currprefs.mountinfo, 0);
        mainMenu_filesysUnits--;
        hd_dir_unit_nr = -1;
        uae4all_hard_dir[0] = '\0';
    }
    if (hddir && currprefs.mountinfo)
    {            
        const char *hddir1 = (env)->GetStringUTFChars(hddir, 0);
        strcpy(uae4all_hard_dir, hddir1);
        (env)->ReleaseStringUTFChars(hddir, hddir1);

        __android_log_print(ANDROID_LOG_INFO, "UAE", "add_filesys_unit hd dir: %s", uae4all_hard_dir);
        char *s2 = add_filesys_unit (currprefs.mountinfo, "HD0", uae4all_hard_dir, 1, 0, 0, 0, 0);
        if (s2)
            __android_log_print(ANDROID_LOG_ERROR, "UAE", "%s\n", s2);
        hd_dir_unit_nr = mainMenu_filesysUnits++;
    }
    if (change_disk && uae4all_hard_file[0] != '\0' && currprefs.mountinfo) {
        __android_log_print(ANDROID_LOG_INFO, "UAE", "kill_filesys_unit hd file: %s", uae4all_hard_file);
        kill_filesys_unit(currprefs.mountinfo, 0);
        mainMenu_filesysUnits--;
        hd_file_unit_nr = -1;
        uae4all_hard_file[0] = '\0';
    } 
    if (hdfile && currprefs.mountinfo)
    {
        const char *hdfile1 = (env)->GetStringUTFChars(hdfile, 0);
        strcpy(uae4all_hard_file, hdfile1);
        (env)->ReleaseStringUTFChars(hdfile, hdfile1);
        __android_log_print(ANDROID_LOG_INFO, "UAE", "add_filesys_unit hd file: %s", uae4all_hard_file);
        char *s2 = add_filesys_unit (currprefs.mountinfo, 0, uae4all_hard_file, 0, 32, 1, 2, 512);
        if (s2)
            __android_log_print(ANDROID_LOG_ERROR, "UAE", "%s\n", s2);
        hd_file_unit_nr = mainMenu_filesysUnits++;
    }
    if (floppy1)
    {
        const char *sfloppy1 = (env)->GetStringUTFChars(floppy1, 0);
        
        if (change_disk) {
            strcpy(changed_df[0], sfloppy1);
            real_changed_df[0]=1;
            __android_log_print(ANDROID_LOG_INFO, "UAE", "change floppy1: %s", changed_df[0]);
        } else
            strcpy(prefs_df[0], sfloppy1);
        (env)->ReleaseStringUTFChars(floppy1, sfloppy1);
        
    } else
        strcpy (prefs_df[0], "/sdcard/df0.adf");
    if (floppy2)
    {
        const char *sfloppy2 = (env)->GetStringUTFChars(floppy2, 0);
        
        if (change_disk) {
            strcpy(changed_df[1], sfloppy2);
            real_changed_df[1]=1;
        } else
            strcpy(prefs_df[1], sfloppy2);
        (env)->ReleaseStringUTFChars(floppy2, sfloppy2);
        //__android_log_print(ANDROID_LOG_INFO, "UAE", "prefs_df[1]: %s", prefs_df[1]);
    } else
        strcpy (prefs_df[1], "/sdcard/df1.adf");

    if (floppy3)
    {
        const char *sfloppy3 = (env)->GetStringUTFChars(floppy3, 0);
        
        if (change_disk) {
            strcpy(changed_df[2], sfloppy3);
            real_changed_df[2]=1;
        } else
            strcpy(prefs_df[2], sfloppy3);
        (env)->ReleaseStringUTFChars(floppy3, sfloppy3);
        //__android_log_print(ANDROID_LOG_INFO, "UAE", "prefs_df[1]: %s", prefs_df[1]);
    } else
        strcpy (prefs_df[2], "/sdcard/df2.adf");

    if (floppy4)
    {
        const char *sfloppy4 = (env)->GetStringUTFChars(floppy4, 0);
        
        if (change_disk) {
            strcpy(changed_df[3], sfloppy4);
            real_changed_df[3]=1;
        } else
            strcpy(prefs_df[3], sfloppy4);
        (env)->ReleaseStringUTFChars(floppy4, sfloppy4);
        //__android_log_print(ANDROID_LOG_INFO, "UAE", "prefs_df[1]: %s", prefs_df[1]);
    } else
        strcpy (prefs_df[3], "/sdcard/df3.adf");

    mainMenu_showStatus = drive_status;
    mainMenu_ntsc = ntsc;

    if (change_sound)
        changed_produce_sound = sound;
    else {
        produce_sound = sound;
        changed_produce_sound = sound;
    }

    if (frameskip >= 100)   
        prefs_gfx_framerate = -1;
    else
        prefs_gfx_framerate = frameskip;
    changed_gfx_framerate = prefs_gfx_framerate;
    __android_log_print(ANDROID_LOG_INFO, "UAE", "prefs_gfx_framerate: %d", prefs_gfx_framerate);
    m68k_speed = 0;
    check_prefs_changed_cpu();
    check_prefs_changed_audio();
    //DISK_init();



    //__android_log_print(ANDROID_LOG_INFO, "UAE", "prefs_df[0]: %s", prefs_df[0]);
    //__android_log_print(ANDROID_LOG_INFO, "UAE", "prefs_df[1]: %s", prefs_df[1]);
    //__android_log_print(ANDROID_LOG_INFO, "UAE", "m68k_speed: %d / timeslice_mode: %d", m68k_speed, timeslice_mode);

    if (reset) {

        uae_reset();
    }
}
예제 #19
0
파일: gui.cpp 프로젝트: kerheol/uae4all
static void goMenu(void)
{

   int exitmode=0;
   int autosave=mainMenu_autosave;
   if (quit_program != 0)
	    return;
#ifdef PROFILER_UAE4ALL
   uae4all_prof_show();
#endif
#ifdef DEBUG_FRAMERATE
   uae4all_show_time();
#endif
   emulating=1;
   vkbd_quit();
   init_text(0);
   pause_sound();

   menu_raise();
   exitmode=run_mainMenu();
   notice_screen_contents_lost();
   resume_sound();
   if ((!(strcmp(prefs_df[0],uae4all_image_file0))) || ((!(strcmp(prefs_df[1],uae4all_image_file1)))))
	   menu_unraise();
   quit_text();
   vkbd_init();
#ifdef DREAMCAST
   SDL_DC_EmulateKeyboard(SDL_FALSE);
#endif
    getChanges();
	vkbd_init_button2();
    if (exitmode==1 || exitmode==2)
    {
    	    extern char *savestate_filename;
    	    extern int saveMenu_n_savestate;
	    for(int i=0;i<mainMenu_drives;i++)
	    {
		if (i==0 && strcmp(changed_df[0],uae4all_image_file0)) {
		    strcpy(changed_df[0],uae4all_image_file0);
		    real_changed_df[0]=1;
		}
		else if (i==1 && strcmp(changed_df[1],uae4all_image_file1)) {
		    strcpy(changed_df[1],uae4all_image_file1);
		    real_changed_df[1]=1;
		}
		else if (i==2 && strcmp(changed_df[2],uae4all_image_file2)) {
		    strcpy(changed_df[2],uae4all_image_file2);
		    real_changed_df[2]=1;
		}
		else if (i==3 && strcmp(changed_df[3],uae4all_image_file3)) {
		    strcpy(changed_df[3],uae4all_image_file3);
		    real_changed_df[3]=1;
		}
	    }
    	    strcpy(savestate_filename,uae4all_image_file0);
	    switch(saveMenu_n_savestate)
    	    {
	    	case 1:
    			strcat(savestate_filename,"-1.asf"); break;
	    	case 2:
    			strcat(savestate_filename,"-2.asf"); break;
	    	case 3:
    			strcat(savestate_filename,"-3.asf"); break;
	    	default:
    	   		strcat(savestate_filename,".asf");
    	    }
    }
    if (exitmode==3)
    {
    	    extern char *savestate_filename;
    	    extern int saveMenu_n_savestate;
	    for(int i=0;i<mainMenu_drives;i++)
	    {
		changed_df[i][0]=0;
		if (i==0) {
		    uae4all_image_file0[0]=0;
		    if (strcmp(changed_df[0],uae4all_image_file0))
		    {
			strcpy(changed_df[0],uae4all_image_file0);
			real_changed_df[0]=1;
		    }
		}
		else if (i==1) {
		    uae4all_image_file1[0]=0;
		    if (strcmp(changed_df[1],uae4all_image_file1))
		    {
			strcpy(changed_df[1],uae4all_image_file1);
			real_changed_df[1]=1;
		    }
		}
		else if (i==2) {
		    uae4all_image_file2[0]=0;
		    if (strcmp(changed_df[2],uae4all_image_file2))
		    {
			strcpy(changed_df[2],uae4all_image_file2);
			real_changed_df[2]=1;
		    }
		}
		else if (i==3) {
		    uae4all_image_file3[0]=0;
		    if (strcmp(changed_df[3],uae4all_image_file3))
		    {
			strcpy(changed_df[3],uae4all_image_file3);
			real_changed_df[3]=1;
		    }
		}
		disk_eject(i);
	    }
    	    strcpy(savestate_filename,uae4all_image_file0);
    	    switch(saveMenu_n_savestate)
    	    {
	   	case 1:
    			strcat(savestate_filename,"-1.asf"); break;
	    	case 2:
    			strcat(savestate_filename,"-2.asf"); break;
	    	case 3:
    			strcat(savestate_filename,"-3.asf"); break;
	    	default:
    	  	 	strcat(savestate_filename,".asf");
    	    }
    }
    if (exitmode==2)
    {
	    if (autosave!=mainMenu_autosave)
	    {
	    	prefs_df[0][0]=0;
	   		prefs_df[1][0]=0;
			prefs_df[2][0]=0;
	   		prefs_df[3][0]=0;
	    }
		if(gp2xButtonRemappingOn)
			togglemouse();
		int gp2xMouseEmuOn=0;
		int gp2xButtonRemappingOn=0;
	    uae_reset ();
    }
    check_all_prefs();
    gui_purge_events();
    notice_screen_contents_lost();
#ifdef DEBUG_FRAMERATE
    uae4all_update_time();
#endif
#ifdef PROFILER_UAE4ALL
    uae4all_prof_init();
#endif

}