예제 #1
0
static WRITE8_HANDLER( MC6840_control_port_0_w )
{
	/* MC6840 Emulation by Takahiro Nogi. 1999/09/27
    (This routine hasn't been completed yet.) */

	MC6840_index0 = data;

	if (MC6840_index0 & 0x80)	/* enable timer output */
	{
		if ((MC6840_register0 != S_TEMPO) && (MC6840_register0 != 0))
		{
			S_TEMPO = MC6840_register0;
#ifdef MAME_DEBUG
			ui_popup("I0:0x%02X R0:0x%02X I1:0x%02X R1:0x%02X", MC6840_index0, MC6840_register0, MC6840_index1, MC6840_register1);
#endif
		}
		MC6809_FLAG = 1;
	}
	else
	{
		MC6809_FLAG = 0;
	}
#ifdef MAME_DEBUG
	logerror("MC6840 Write:(0x%02X)0x%02X\n", MC6840_register0, data);
#endif
}
예제 #2
0
static WRITE8_HANDLER(speedspn_banked_rom_change)
{
	/* is this weird banking some form of protection? */

	unsigned char *rom = memory_region(REGION_CPU1);
	int addr;

	switch (data)
	{
		case 0: addr = 0x28000; break;
		case 1: addr = 0x14000; break;
		case 2: addr = 0x1c000; break;
		case 3: addr = 0x54000; break;
		case 4: addr = 0x48000; break;
		case 5: addr = 0x3c000; break;
		case 6: addr = 0x18000; break;
		case 7: addr = 0x4c000; break;
		case 8: addr = 0x50000; break;
		default:
			ui_popup ("Unmapped Bank Write %02x", data);
			addr = 0;
			break;
	}

	memory_set_bankptr(1,&rom[addr + 0x8000]);
}
예제 #3
0
static WRITE16_HANDLER( othunder_TC0220IOC_w )
{
	if (ACCESSING_LSB)
	{
		switch (offset)
		{
			case 0x03:

/*              0000000x    SOL-1 (gun solenoid)
                000000x0    SOL-2 (gun solenoid)
                00000x00    OBPRI (sprite priority)
                0000x000    (unused)
                000x0000    eeprom reset (active low)
                00x00000    eeprom clock
                0x000000    eeprom in data
                x0000000    eeprom out data  */

				set_led_status(0, data & 1);
				set_led_status(1, data & 2);

if (data & 4)
	ui_popup("OBPRI SET!");

				EEPROM_write_bit(data & 0x40);
				EEPROM_set_clock_line((data & 0x20) ? ASSERT_LINE : CLEAR_LINE);
				EEPROM_set_cs_line((data & 0x10) ? CLEAR_LINE : ASSERT_LINE);
				break;

			default:
				TC0220IOC_w(offset,data & 0xff);
		}
	}
}
예제 #4
0
파일: mp3.c 프로젝트: 173210/mvspsp
static int MP3SleepCheck(void)
{
	if (Sleep)
	{
		if (mp3_fd >= 0) sceIoClose(mp3_fd);

		mp3_sleep = 1;

		do
		{
			sceKernelDelayThread(5000000);
		} while (Sleep);

		mp3_sleep = 0;

		if ((mp3_fd = sceIoOpen(MP3_file, PSP_O_RDONLY, 0777)) < 0)
		{
			mp3_fd = -1;
			mp3_status = MP3_STOP;
			ui_popup(TEXT(COULD_NOT_REOPEN_MP3_FILEx), strrchr(MP3_file, '/') + 1);
			return 1;
		}

		sceIoLseek(mp3_fd, mp3_filepos, PSP_SEEK_SET);
	}
	else if (mp3_status == MP3_STOP)
	{
		return 1;
	}

	return 0;
}
예제 #5
0
void record_movie_toggle(void)
{
#if 0 /* AdvanceMAME has its record code */
	if (movie_file == NULL)
	{
		record_movie_start(NULL);
		if (movie_file)
			ui_popup("REC START");
	}
	else
	{
		record_movie_stop();
		ui_popup("REC STOP (%d frames)", movie_frame);
	}
#endif
}
예제 #6
0
ADDRESS_MAP_END

static READ8_HANDLER( s2650_data_r )
{
	ui_popup("S2650 data port read");
	return 0xff;
}
예제 #7
0
static void sslam_play(int melody, int data)
{
	int status = OKIM6295_status_0_r(0);

	logerror("Playing sample %01x:%02x from command %02x\n",sslam_snd_bank,sslam_sound,data);
	if (sslam_sound == 0) ui_popup("Unknown sound command %02x",sslam_sound);

	if (melody) {
		if (sslam_melody != sslam_sound) {
			sslam_melody      = sslam_sound;
			sslam_melody_loop = sslam_sound;
			if (status & 0x08)
				OKIM6295_data_0_w(0,0x40);
			OKIM6295_data_0_w(0,(0x80 | sslam_melody));
			OKIM6295_data_0_w(0,0x81);
		}
	}
	else {
		if ((status & 0x01) == 0) {
		OKIM6295_data_0_w(0,(0x80 | sslam_sound));
			OKIM6295_data_0_w(0,0x11);
		}
		else if ((status & 0x02) == 0) {
		OKIM6295_data_0_w(0,(0x80 | sslam_sound));
			OKIM6295_data_0_w(0,0x21);
		}
		else if ((status & 0x04) == 0) {
		OKIM6295_data_0_w(0,(0x80 | sslam_sound));
			OKIM6295_data_0_w(0,0x41);
		}
	}
}
예제 #8
0
static void warriorb_draw_sprites(mame_bitmap *bitmap,const rectangle *cliprect,int y_offs)
{
	int offs, data, data2, tilenum, color, flipx, flipy;
	int x, y, priority, pri_mask;

#ifdef MAME_DEBUG
	int unknown=0;
#endif

	/* pdrawgfx() needs us to draw sprites front to back */
	for (offs = 0;offs < spriteram_size/2;offs += 4)
	{
		data = spriteram16[offs+1];
		tilenum = data & 0x7fff;

		data = spriteram16[offs+0];
		y = (-(data &0x1ff) - 24) & 0x1ff;	/* (inverted y adjusted for vis area) */
		flipy = (data & 0x200) >> 9;

		data2 = spriteram16[offs+2];
		/* 8,4 also seen in msbyte */
		priority = (data2 & 0x0100) >> 8; // 1 = low

		if(priority)
			pri_mask = 0xfffe;
		else
			pri_mask = 0;

		color    = (data2 & 0x7f);

		data = spriteram16[offs+3];
		x = (data & 0x3ff);
		flipx = (data & 0x400) >> 10;


#ifdef MAME_DEBUG
		if (data2 & 0xf280)   unknown |= (data2 &0xf280);
#endif

		y += y_offs;

		/* sprite wrap: coords become negative at high values */
		if (x>0x3c0) x -= 0x400;
		if (y>0x180) y -= 0x200;

		pdrawgfx(bitmap,Machine->gfx[0],
		  		 tilenum,
				 color,
				 flipx,flipy,
				 x,y,
				 cliprect,TRANSPARENCY_PEN,0,pri_mask);
	}

#ifdef MAME_DEBUG
	if (unknown)
		ui_popup("unknown sprite bits: %04x",unknown);
#endif
}
예제 #9
0
int ui_empty_disk_dialog(char *name)
{
    edisk_file_name = name;
    *edisk_file_name= 0;

    build_emptydisk_dialog();
    ui_popup(emptydisk_dialog, _("Create empty disk"), True);
    return *name ? 0 : -1;
}
예제 #10
0
static WRITE8_HANDLER( ace_characterram_w )
{
	if (ace_characterram[offset] != data)
	{
		if (data&(~0x07))
		{
			logerror("write to %04x data=%02x\n", 0x8000+offset, data);
			ui_popup("write to %04x data=%02x\n", 0x8000+offset, data);
		}
		ace_characterram[offset] = data;
	}
}
예제 #11
0
파일: uidialogs.c 프로젝트: AreaScout/vice
/* Report a message to the user, allow different buttons. */
ui_jam_action_t ui_jam_dialog(const char *format, ...)
{
    char str[1024];
    va_list ap;
    static GtkWidget *jam_dialog, *message;
    gint res;

    if (console_mode) {
        va_start(ap, format);
        vfprintf(stderr, format, ap);
        va_end(ap);
        exit(0);
    }

    vsync_suspend_speed_eval();
    jam_dialog = gtk_dialog_new_with_buttons("", NULL, GTK_DIALOG_DESTROY_WITH_PARENT, _("Reset"), 0, _("Hard Reset"), 1, _("Monitor"), 2, _("Continue"), 3, NULL);
    g_signal_connect(G_OBJECT(jam_dialog), "destroy", G_CALLBACK(gtk_widget_destroyed), &jam_dialog);

    va_start(ap, format);
    vsprintf(str, format, ap);
    va_end(ap);
    message = gtk_label_new(str);
    gtk_box_pack_start(GTK_BOX(gtk_dialog_get_content_area(GTK_DIALOG(jam_dialog))), message, TRUE, TRUE, 0);
    gtk_widget_show(message);
    gtk_dialog_set_default_response(GTK_DIALOG(jam_dialog), 0);

    ui_popup(jam_dialog, "VICE", FALSE);
    res = gtk_dialog_run(GTK_DIALOG(jam_dialog));
    ui_popdown(jam_dialog);
    if (jam_dialog) {
        gtk_widget_destroy(jam_dialog);
    }

    ui_dispatch_events();

    switch (res) {
        case 3:
            return UI_JAM_NONE;
        case 2:
            ui_restore_mouse();
#ifdef HAVE_FULLSCREEN
            fullscreen_suspend(0);
#endif
            return UI_JAM_MONITOR;
        case 1:
            return UI_JAM_HARD_RESET;
        case 0:
        default:
            return UI_JAM_RESET;
    }

    return 0;
}
예제 #12
0
static WRITE8_HANDLER( bankswitch_w )
{
	unsigned char *rom = memory_region(REGION_CPU1);
	int offs;

	/* bit 0 = RAM bank? */
if ((data & 1) == 0) ui_popup("bankswitch RAM bank 0");

	/* bit 1-4 = ROM bank */
	if (data & 0x10) offs = 0x20000 + (data & 0x06) * 0x1000;
	else offs = 0x10000 + (data & 0x0e) * 0x1000;
	memory_set_bankptr(1,&rom[offs]);
}
예제 #13
0
파일: mame.c 프로젝트: broftkd/mess-cvs
void CLIB_DECL popmessage(const char *text, ...)
{
	extern void CLIB_DECL ui_popup(const char *text, ...) ATTR_PRINTF(1,2);
	va_list arg;

	/* dump to the buffer */
	va_start(arg, text);
	vsnprintf(giant_string_buffer, GIANT_STRING_BUFFER_SIZE, text, arg);
	va_end(arg);

	/* pop it in the UI */
	ui_popup("%s", giant_string_buffer);
}
예제 #14
0
static WRITE8_HANDLER( coincntr_w )
{
/*logerror("%04x: coincntr_w %02x\n",activecpu_get_pc(),data); */

	/* bits 0/1 = coin counters */
	coin_counter_w(0,data & 0x01);
	coin_counter_w(1,data & 0x02);

	/* bit 5 = flip screen */
	flip_screen_set(data & 0x20);

	/* other bit unknown */
if ((data & 0xdc) != 0x10) ui_popup("coincntr %02x",data);
}
예제 #15
0
파일: uidialogs.c 프로젝트: AreaScout/vice
/* Message Helper */
static void ui_message2(const GtkMessageType type, const char *msg, const char *title)
{
    static GtkWidget* msgdlg;

    vsync_suspend_speed_eval();
    msgdlg = gtk_message_dialog_new(GTK_WINDOW(get_active_toplevel()), GTK_DIALOG_DESTROY_WITH_PARENT, type, GTK_BUTTONS_OK, msg, NULL);

    ui_popup(msgdlg, title, FALSE);
    gtk_dialog_run(GTK_DIALOG(msgdlg));
    ui_unblock_shells();        /* ui_popdown can't be used in message_boxes */
    gtk_widget_destroy(msgdlg);

    /* still needed ? */
    ui_check_mouse_cursor();
    ui_dispatch_events();
}
예제 #16
0
파일: biosmenu.c 프로젝트: 173210/mvspsp
static void bios_error(const char *rom_name, int error, int flag)
{
	char mes[128];

	zip_close();

	if (error == -2)
		sprintf(mes, TEXT(CRC32_NOT_CORRECT_x), rom_name);
	else
		sprintf(mes, TEXT(FILE_NOT_FOUND_x), rom_name);

	if (flag)
		fatalerror(mes);
	else
		ui_popup(mes);
}
예제 #17
0
void ui_netplay_dialog(void)
{
    if (netplay_dialog) {
        gdk_window_show(gtk_widget_get_window(netplay_dialog));
        gdk_window_raise(gtk_widget_get_window(netplay_dialog));
        gtk_widget_show(netplay_dialog);
        netplay_update_status();
    } else {
        np_log = log_open("Netplay");
        netplay_dialog = build_netplay_dialog();
        g_signal_connect(G_OBJECT(netplay_dialog), "destroy", G_CALLBACK(gtk_widget_destroyed), &netplay_dialog);
    }
    ui_popup(netplay_dialog, "Netplay Dialog", FALSE);
    (void) gtk_dialog_run(GTK_DIALOG(netplay_dialog));
    ui_popdown(netplay_dialog);
}
예제 #18
0
static void check_eeprom_settings(int popup)
{
	UINT8 eeprom_value = EEPROM_read_data(driver->inp_eeprom);
	UINT8 coin_type = driver->inp_eeprom_value[eeprom_value];

	if (input_coin_chuter != coin_type)
	{
		input_coin_chuter = coin_type;
		input_max_players = max_players[coin_type];

		if (option_controller >= input_max_players)
		{
			option_controller = INPUT_PLAYER1;
			if (popup) ui_popup(TEXT(CONTROLLER_PLAYER1));
		}
	}
}
예제 #19
0
파일: uidialogs.c 프로젝트: AreaScout/vice
/* Ask for a confirmation. */
ui_button_t ui_ask_confirmation(const char *title, const char *text)
{
    static GtkWidget *confirm_dialog, *confirm_dialog_message;
    gint res;

    vsync_suspend_speed_eval();
    if (!confirm_dialog) {
        confirm_dialog = build_confirm_dialog(&confirm_dialog_message);
        g_signal_connect(G_OBJECT(confirm_dialog), "destroy", G_CALLBACK(gtk_widget_destroyed), &confirm_dialog);
    }

    gtk_label_set_text(GTK_LABEL(confirm_dialog_message),text);

    ui_popup(confirm_dialog, title, FALSE);
    res = gtk_dialog_run(GTK_DIALOG(confirm_dialog));
    ui_popdown(confirm_dialog);

    return (res == GTK_RESPONSE_YES) ? UI_BUTTON_YES : (res == GTK_RESPONSE_NO) ? UI_BUTTON_NO : UI_BUTTON_CANCEL;
}
예제 #20
0
static WRITE16_HANDLER( gotcha_lamps_w )
{
#if 0
	ui_popup("%c%c%c%c %c%c%c%c %c%c%c%c",
			(data & 0x001) ? 'R' : '-',
			(data & 0x002) ? 'G' : '-',
			(data & 0x004) ? 'B' : '-',
			(data & 0x008) ? 'S' : '-',
			(data & 0x010) ? 'R' : '-',
			(data & 0x020) ? 'G' : '-',
			(data & 0x040) ? 'B' : '-',
			(data & 0x080) ? 'S' : '-',
			(data & 0x100) ? 'R' : '-',
			(data & 0x200) ? 'G' : '-',
			(data & 0x400) ? 'B' : '-',
			(data & 0x800) ? 'S' : '-'
			);
#endif
}
예제 #21
0
파일: uidialogs.c 프로젝트: AreaScout/vice
ui_button_t ui_ask_yesno(const char *title, const char *text)
{
    static GtkWidget *yesno_dialog = NULL, *yesno_dialog_message = NULL;
    gint res;

    vsync_suspend_speed_eval();
    if (!yesno_dialog) {
        yesno_dialog = build_yesno_dialog(&yesno_dialog_message);
        g_signal_connect(G_OBJECT(yesno_dialog), "destroy", G_CALLBACK(gtk_widget_destroyed), &yesno_dialog);
    }

    gtk_label_set_text(GTK_LABEL(yesno_dialog_message),text);

    ui_popup(yesno_dialog, title, FALSE);
    res = gtk_dialog_run(GTK_DIALOG(yesno_dialog));
    ui_popdown(yesno_dialog);

    return (res == GTK_RESPONSE_YES) ? UI_BUTTON_YES : UI_BUTTON_NO;
}
예제 #22
0
void update_inputport(void)
{
	int i;
	UINT32 buttons;

	buttons = poll_gamepad();

	if (readHomeButton())
	{
		showmenu();
		setup_autofire();
		buttons = poll_gamepad();
	}
	else if ((buttons & PSP_CTRL_RTRIGGER) && (buttons & PSP_CTRL_SELECT))
	{
		commandlist(1);
		buttons = poll_gamepad();
	}

	buttons = update_autofire(buttons);

	for (i = 0; i < MAX_INPUTS; i++)
		input_flag[i] = (buttons & input_map[i]) != 0;

	update_inputport0();
	update_inputport1();
	update_inputport2();

	if (input_flag[SNAPSHOT])
	{
		save_snapshot();
	}
	if (input_flag[SWPLAYER])
	{
		if (!input_ui_wait)
		{
			option_controller ^= 1;
			ui_popup(TEXT(CONTROLLER_PLAYERx), option_controller + 1);
			input_ui_wait = 30;
		}
	}
	if (input_ui_wait > 0) input_ui_wait--;
}
예제 #23
0
파일: vsnes.c 프로젝트: RobinDX/xmame
/* remap callback */
static int remap_colors( int num, int addr, int data )
{
    /* this is the protection. color codes are shuffled around */
    /* the ones with value 0xff are unknown */

    if ( addr >= 0x3f00 )
    {
        int newdata = remapped_colortable[ data & 0x3f ];

        if ( newdata != 0xff )
            data = newdata;

#ifdef MAME_DEBUG
        else
            ui_popup( "Unmatched color %02x, at address %04x", data & 0x3f, addr );
#endif
    }

    return data;
}
예제 #24
0
파일: emumain.c 프로젝트: AMSMM/NJEMU
void save_snapshot(void)
{
	char path[MAX_PATH];

	sound_mute(1);
#if (EMU_SYSTEM == NCDZ)
	mp3_pause(1);
#endif
#if USE_CACHE
	cache_sleep(1);
#endif

	if (snap_no == -1)
	{
		FILE *fp;

		snap_no = 1;

		while (1)
		{
			sprintf(path, "%s/%s_%02d.png", screenshotDir, game_name, snap_no);
			if ((fp = fopen(path, "rb")) == NULL) break;
			fclose(fp);
			snap_no++;
		}
	}

	sprintf(path, "%s/%s_%02d.png", screenshotDir, game_name, snap_no);
	if (save_png(path))
		ui_popup(TEXT(SNAPSHOT_SAVED_AS_x_PNG), game_name, snap_no++);

#if USE_CACHE
	cache_sleep(0);
#endif
#if (EMU_SYSTEM == NCDZ)
	mp3_pause(0);
#endif
	sound_mute(0);
}
예제 #25
0
파일: uidialogs.c 프로젝트: AreaScout/vice
ui_button_t ui_change_dir(const char *title, const char *prompt, char *buf, unsigned int buflen)
{
    GtkWidget *fc;
    gint res;
    gchar *fname = NULL;
    ui_button_t r;

    fc = gtk_file_chooser_dialog_new(title, GTK_WINDOW(get_active_toplevel()), GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER, GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL, GTK_STOCK_OPEN, GTK_RESPONSE_ACCEPT, NULL);
    ui_popup(fc, title, FALSE);
    res = gtk_dialog_run(GTK_DIALOG(fc));
    ui_popdown(fc);

    if ((res == GTK_RESPONSE_ACCEPT) && (fname = gtk_file_chooser_get_filename(GTK_FILE_CHOOSER(fc)))) {
        strncpy(buf, fname, buflen);
        r = UI_BUTTON_OK;
    } else {
        r = UI_BUTTON_CANCEL;
    }

    g_free(fname);
    return r;
}
예제 #26
0
파일: uidialogs.c 프로젝트: AreaScout/vice
/* Ask for a string.  The user can confirm or cancel. */
ui_button_t ui_input_string(const char *title, const char *prompt, char *buf, unsigned int buflen)
{
    GtkWidget *input_dialog, *entry, *label;
    gint res;
    ui_button_t ret;

    vsync_suspend_speed_eval();
    input_dialog = gtk_dialog_new_with_buttons(title, NULL, GTK_DIALOG_DESTROY_WITH_PARENT, GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL, GTK_STOCK_OK, GTK_RESPONSE_ACCEPT, NULL);
    g_signal_connect(G_OBJECT(input_dialog), "destroy", G_CALLBACK(gtk_widget_destroyed), &input_dialog);

    entry = gtk_entry_new();

    label = gtk_label_new(prompt);
    gtk_box_pack_start(GTK_BOX(gtk_dialog_get_content_area(GTK_DIALOG(input_dialog))), label, FALSE, FALSE, 0);
    gtk_widget_show(label);

    gtk_box_pack_start(GTK_BOX(gtk_dialog_get_content_area(GTK_DIALOG(input_dialog))), entry, FALSE, FALSE, 0);
    gtk_entry_set_text(GTK_ENTRY(GTK_ENTRY(entry)), buf);
    gtk_widget_show(entry);

    gtk_dialog_set_default_response(GTK_DIALOG(input_dialog), GTK_RESPONSE_ACCEPT);
    ui_popup(input_dialog, title, FALSE);
    res = gtk_dialog_run(GTK_DIALOG(input_dialog));
    ui_popdown(input_dialog);

    if ((res == GTK_RESPONSE_ACCEPT) && input_dialog) {
        strncpy(buf, gtk_entry_get_text(GTK_ENTRY(entry)), buflen);
        ret = UI_BUTTON_OK;
    } else {
        ret = UI_BUTTON_CANCEL;
    }

    if (input_dialog) {
        gtk_widget_destroy(input_dialog);
    }

    return ret;
}
예제 #27
0
ROM_END


/******************************************************************************************
Simple protection check concept.The M68k writes a command and the MCU
returns the PC at address 0xffc000.
The problem is that only the concept is easy,beating this protection requires a good
amount of time without a trojan...

Misc Notes:
-Protection routine is at 0x890
-An original feature of this game is that if you enter into service mode the game gives you
the possibility to test various stuff on a pre-registered play such as the speed or
the zooming.To use it,you should use Player 2 Start button to show the test screens
or to advance into the tests.
******************************************************************************************/
#define PC(_num_)\
work_ram[0x000/2] = (_num_ & 0xffff0000) >> 16;\
work_ram[0x002/2] = (_num_ & 0x0000ffff) >> 0;

static WRITE16_HANDLER( twrldc94_mcu_w )
{
	switch(data)
	{
		/*P.O.S.T. / Test Mode*/
		case 0x53: PC(0x00000a4c); break;
		/*Time Up*/
		case 0x68: break;
		/*Title Screen*/
		case 0x69: break;
		/*Gameplay / Attract mode*/
		case 0x6b: PC(0x00000746); break;
		/*(after the P.O.S.T.)*/
		case 0x6e: PC(0x00000746); break;/*WRONG?*/
		default: ui_popup("Unknown MCU CMD %04x",data);
	}
}
예제 #28
0
void ui_cartridge_save_dialog(int type)
{
    gint res;
    char *name;

    if (cartridge_dialog) {
        gdk_window_show(gtk_widget_get_window(cartridge_dialog));
        gdk_window_raise(gtk_widget_get_window(cartridge_dialog));
        gtk_widget_show(cartridge_dialog);
    } else {
        uilib_file_filter_enum_t filter = UILIB_FILTER_ALL;
        cartridge_dialog = vice_file_entry(_("Save cartridge image"), NULL, NULL, &filter, 1, UI_FC_SAVE);
        g_signal_connect(G_OBJECT(cartridge_dialog), "destroy", G_CALLBACK(gtk_widget_destroyed), &cartridge_dialog);
    }

    ui_popup(cartridge_dialog, _("Save cartridge image"), FALSE);
    res = gtk_dialog_run(GTK_DIALOG(cartridge_dialog));
    ui_popdown(cartridge_dialog);
    
    if (res != GTK_RESPONSE_ACCEPT) {
        return;
    }
    
    name = gtk_file_chooser_get_filename(GTK_FILE_CHOOSER(cartridge_dialog));
    if (!name) {
        ui_error(_("Invalid filename"));
        return;
    }
	    
    if (cartridge_save_image (type, name) < 0) {
        ui_error(_("Cannot write cartridge image file\n`%s'\n"), name);
    } else {
	ui_message(_("Successfully wrote `%s'"), name);
    }
    lib_free(name);
}
예제 #29
0
파일: uiedisk.c 프로젝트: martinpiper/VICE
int ui_empty_disk_dialog(char *name)
{
    gint res;
    char *format_text;
    char *fname;
    const char *dname, *id;
    int i, type = 0, ret = 0;

    if (edisk_dialog)
    {
	gdk_window_show(edisk_dialog->window);
	gdk_window_raise(edisk_dialog->window);
	gtk_widget_show(edisk_dialog);
    }
    else
    {
	edisk_dialog = build_empty_disk_dialog();
	g_signal_connect(G_OBJECT(edisk_dialog),
			 "destroy",
			 G_CALLBACK(gtk_widget_destroyed),
			 &edisk_dialog);
    }

    ui_popup(edisk_dialog, _("Create empty Diskimage"), FALSE);
    res = gtk_dialog_run(GTK_DIALOG(edisk_dialog));
    ui_popdown(edisk_dialog);

    if (res != GTK_RESPONSE_ACCEPT)
	return -1;

    /* filename */
    fname = gtk_file_chooser_get_filename(GTK_FILE_CHOOSER(fileentry));
    if (!fname)
	return -1;
    
    strcpy(name, fname);
    lib_free(fname);
    
    /* format label */
    dname = gtk_entry_get_text(GTK_ENTRY(diskname));
    if (!dname)
	dname = "";

    /* disk ID */
    id = gtk_entry_get_text(GTK_ENTRY(diskid));
    if (!id)
	id = "00";

    /* type radio button */
    for (i = 0; type_radio[i].label; i++)
	if (GTK_TOGGLE_BUTTON(type_radio[i].w)->active)
	{
	    type = type_radio[i].type;
	    break;
	}

    format_text = util_concat(dname, ",", id, NULL);
    if (vdrive_internal_create_format_disk_image(name, format_text, type)
        < 0) {
	ui_error(_("Can't create image `%s'."));
	ret = -1;
    }
    lib_free(format_text);

    return ret;
}
예제 #30
0
void update_inputport(void)
{
	int i;
	UINT32 buttons;

#ifdef ADHOC
	if (adhoc_enable)
	{
#if !ADHOC_UPDATE_EVERY_FRAME
		if (adhoc_frame & 1)
		{
			adhoc_frame++;
		}
		else
#endif
		{
			while (adhoc_update && Loop == LOOP_EXEC)
			{
				sceKernelDelayThread(1);
			}

			cps2_port_value[0] = send_data.port_value[0] & recv_data.port_value[0];
			cps2_port_value[1] = send_data.port_value[1] & recv_data.port_value[1];
			cps2_port_value[2] = send_data.port_value[2] & recv_data.port_value[2];
			cps2_port_value[3] = send_data.port_value[3] & recv_data.port_value[3];

			if (Loop == LOOP_EXEC)
				Loop = recv_data.loop_flag;

			if (recv_data.paused)
				adhoc_paused = recv_data.paused;

			if (adhoc_paused)
			{
				adhoc_pause();
			}

			service_switch = 0;
			p12_start_pressed = 0;

			if (driver->inp_eeprom) check_eeprom_settings(0);

			buttons = poll_gamepad();

			if (readHomeButton())
			{
				buttons = 0;
				adhoc_paused = adhoc_server + 1;
			}
			else if ((buttons & PSP_CTRL_LTRIGGER) && (buttons & PSP_CTRL_RTRIGGER))
			{
				if (buttons & PSP_CTRL_SELECT)
				{
					buttons &= ~(PSP_CTRL_SELECT | PSP_CTRL_LTRIGGER | PSP_CTRL_RTRIGGER);
					service_switch = 1;
				}
				else if (buttons & PSP_CTRL_START)
				{
					buttons &= ~(PSP_CTRL_START | PSP_CTRL_LTRIGGER | PSP_CTRL_RTRIGGER);
					p12_start_pressed = 1;
				}
			}

			buttons = adjust_input(buttons);
			buttons = update_autofire(buttons);

			for (i = 0; i < MAX_INPUTS; i++)
				input_flag[i] = (buttons & input_map[i]) != 0;

			update_inputport0();
			update_inputport1();
			update_inputport2();
			if (machine_input_type == INPTYPE_pzloop2) update_inputport3();

			send_data.buttons   = buttons;
			send_data.paused    = adhoc_paused;
			send_data.loop_flag = Loop;
			send_data.frame     = adhoc_frame++;

			sceKernelDelayThread(100);

			adhoc_update = 1;
		}
	}
	else
#endif
	{
		service_switch = 0;
		p12_start_pressed = 0;

		if (driver->inp_eeprom) check_eeprom_settings(1);

		buttons = poll_gamepad();

		if (readHomeButton())
		{
			showmenu();
			setup_autofire();
			buttons = poll_gamepad();
		}

		if ((buttons & PSP_CTRL_LTRIGGER) && (buttons & PSP_CTRL_RTRIGGER))
		{
			if (buttons & PSP_CTRL_SELECT)
			{
				buttons &= ~(PSP_CTRL_SELECT | PSP_CTRL_LTRIGGER | PSP_CTRL_RTRIGGER);
				service_switch = 1;
			}
			else if (buttons & PSP_CTRL_START)
			{
				buttons &= ~(PSP_CTRL_START | PSP_CTRL_LTRIGGER | PSP_CTRL_RTRIGGER);
				p12_start_pressed = 1;
			}
		}

		buttons = adjust_input(buttons);
		buttons = update_autofire(buttons);

		for (i = 0; i < MAX_INPUTS; i++)
			input_flag[i] = (buttons & input_map[i]) != 0;

		update_inputport0();
		update_inputport1();
		update_inputport2();
		if (machine_input_type == INPTYPE_pzloop2) update_inputport3();

		if (input_flag[SNAPSHOT])
		{
			save_snapshot();
		}
		if (input_flag[SWPLAYER])
		{
			if (!input_ui_wait)
			{
				option_controller++;
				if (option_controller == input_max_players)
					option_controller = INPUT_PLAYER1;
				ui_popup(TEXT(CONTROLLER_PLAYERx), option_controller + 1);
				input_ui_wait = 30;
			}
		}
		if (input_ui_wait > 0) input_ui_wait--;
	}
}