示例#1
0
文件: rvflash.c 项目: rkujawa/fkload
/* reboot the machine */
void
reboot(void)
{
	/* think about opening graphics.library, 
	   then LoadView(); 2x WaitTOF(); to work around V39 bug */

	/* for now let's just call Exec's ColdReboot()... */
	ColdReboot();
}
示例#2
0
/*****************************************
* Main program                           *
*****************************************/
int main()
{
    int quit = 0, i;
    struct IntuiMessage *msg;
    struct Gadget *button;
    struct StringInfo *strinfo;
    char buf[257];
    UWORD koodi, msgID;
    ULONG classi, number;
    APTR address;
    ULONG CycleTags[3];

    CycleTags[0] = GTCY_Active;
    CycleTags[1] = (ULONG) & number;
    CycleTags[2] = TAG_DONE;

    /* Read UAE configuration */
    i = GetUaeConfig(&config);
    i = setup_window();
    if (i == 0) {
	quit_program(1, "Cannot setup a window!");
	return 1;
    }
    while (quit == 0) {
	WaitPort(window->UserPort);
	while (msg = (struct IntuiMessage *) GT_GetIMsg(window->UserPort)) {
	    classi = msg->Class;
	    koodi = msg->Code;
	    address = msg->IAddress;
	    if (classi == IDCMP_GADGETUP) {
		msgID = ((struct Gadget *) msg->IAddress)->GadgetID;
		button = (struct Gadget *) msg->IAddress;
		if (button->SpecialInfo) {
		    strinfo = (struct StringInfo *) button->SpecialInfo;
		}
	    } else
		msgID = msg->Code;

	    GT_ReplyIMsg((struct IntuiMessage *) msg);
	    switch (classi) {
	    case IDCMP_CLOSEWINDOW:
		quit = 1;
		break;
	    case IDCMP_GADGETUP:
		switch (msgID) {
		case GAD_EXITEMU:
		    ExitEmu();
		    break;
		case GAD_EJECT_DF0:
		    EjectDisk(0);
		    Delay(30);
		    GetUaeConfig(&config);
		    print_drive_status();
		    break;
		case GAD_EJECT_DF1:
		    EjectDisk(1);
		    Delay(30);
		    GetUaeConfig(&config);
		    print_drive_status();
		    break;
		case GAD_EJECT_DF2:
		    EjectDisk(2);
		    Delay(30);
		    GetUaeConfig(&config);
		    print_drive_status();
		    break;
		case GAD_EJECT_DF3:
		    EjectDisk(3);
		    Delay(30);
		    GetUaeConfig(&config);
		    print_drive_status();
		    break;
		case GAD_SOUND:
		    if (config.do_output_sound)
			DisableSound();
		    else
			EnableSound();

		    Delay(30);
		    GetUaeConfig(&config);
		    break;
		case GAD_JOYSTICK:
		    if (config.do_fake_joystick)
			DisableJoystick();
		    else
			EnableJoystick();

		    Delay(30);
		    GetUaeConfig(&config);
		    break;
		case GAD_FRAMERATE:
		    SetFrameRate(strinfo->LongInt);
		    Delay(30);
		    GetUaeConfig(&config);
		    break;
		case GAD_INSERT_DF0:
		    strcpy(buf, config.df0_name);
		    if (get_string(buf, 255)) {
			InsertDisk((UBYTE *) buf, 0);
			Delay(30);
			GetUaeConfig(&config);
			print_drive_status();
		    }
		    break;
		case GAD_INSERT_DF1:
		    strcpy(buf, config.df1_name);
		    if (get_string(buf, 255)) {
			InsertDisk((UBYTE *) buf, 1);
			Delay(30);
			GetUaeConfig(&config);
			print_drive_status();
		    }
		    break;
		case GAD_INSERT_DF2:
		    strcpy(buf, config.df2_name);
		    if (get_string(buf, 255)) {
			InsertDisk((UBYTE *) buf, 2);
			Delay(30);
			GetUaeConfig(&config);
			print_drive_status();
		    }
		    break;
		case GAD_INSERT_DF3:
		    strcpy(buf, config.df3_name);
		    if (get_string(buf, 255)) {
			InsertDisk((UBYTE *) buf, 3);
			Delay(30);
			GetUaeConfig(&config);
			print_drive_status();
		    }
		    break;
		case GAD_LANGUAGE:
		    number = config.keyboard;
		    number++;
		    if (number == 5)
			number = 0;
		    ChangeLanguage(number);
		    Delay(30);
		    GetUaeConfig(&config);
		    break;
		case GAD_RESET:
		    ColdReboot();
		    break;
		case GAD_DEBUG:
		    DebugFunc();
		    break;
		default:
		    break;
		}
		break;
	    default:
		break;
	    }
	}
    }
    quit_program(0, "");
    return (0);
}
示例#3
0
void mountPartitions(struct List *ptlist) 
{
    struct EasyStruct es =
    {
        sizeof(struct EasyStruct), 0,
        "HDToolBox",
        0,
        "Yes|No"
    };
    struct PartitionTableNode *table;
    struct PartitionHandle *ph;
    WORD cm;
    WORD reboot = 0;

    D(bug("[HDToolBox] mountPartitions()\n"));

    table = (struct PartitionTableNode *)ptlist->lh_Head;
    while (table->ln.ln_Succ)
    {
        if (table->type != PHPTT_UNKNOWN)
        {
            ph = (struct PartitionHandle *)table->ph->table->list.lh_Head;
            while (ph->ln.ln_Succ)
            {
                if (existsAttr(table->pattrlist, PTA_AUTOMOUNT))
                {
                LONG flag;

                    GetPartitionAttrsA(ph, PT_AUTOMOUNT, &flag, TAG_DONE);
                    if (flag)
                    {
                        if (existsAttr(table->pattrlist, PTA_NAME))
                        {
                        UBYTE name[32];
                        struct DosEnvec de;
    
                            GetPartitionAttrsA(ph, PT_NAME, name, PT_DOSENVEC, &de, TAG_DONE);
                            cm = checkMount(table, name, &de);
                            if (cm == 1)
                                mount(table, ph, name, &de);
                            else if (cm == 2)
                                kprintf("may reboot\n");
                            else if (cm == 3)
                                kprintf("have to reboot\n");
                            else
                                kprintf("mount %s not needed\n", name);
                            if (reboot<cm)
                                reboot = cm;
                        }
                        else
                            kprintf("Partition with no name is automountable\n");
                    }
                }
                ph = (struct PartitionHandle *)ph->ln.ln_Succ;
            }
        }
        table = (struct PartitionTableNode *)table->ln.ln_Succ;
    }
    if (reboot > 1)
    {
        if (reboot == 2)
        {
            es.es_TextFormat =
                "A reboot is not necessary because the changes do not\n"
                "affect the work of any running filesystem.\n"
                "Do you want to reboot anyway?";
        }
        else
        {
            es.es_TextFormat =
                "A reboot is required because the changes affect\n"
                "the work of at least one running filesystem.\n"
                "Do you want to reboot now?";
        }
        if (EasyRequestArgs(0, &es, 0, 0))
            ColdReboot();
    }
}