Пример #1
0
				atapi_xfermod = 0;
			}

//          printf( "atapi_r: atapi_xferlen=%d\n", atapi_xferlen );
			if( atapi_xferlen != 0 )
			{
				atapi_regs[ATAPI_REG_CMDSTATUS] = ATAPI_STAT_DRQ | ATAPI_STAT_SERVDSC;
				gdrom_alt_status = ATAPI_STAT_DRQ | ATAPI_STAT_SERVDSC;
				atapi_regs[ATAPI_REG_INTREASON] = ATAPI_INTREASON_IO;
			}
			else
			{
				//mame_printf_debug("ATAPI: dropping DRQ\n");
				atapi_regs[ATAPI_REG_CMDSTATUS] = 0;
				gdrom_alt_status = 0;
				atapi_regs[ATAPI_REG_INTREASON] = ATAPI_INTREASON_IO;
			}

			atapi_regs[ATAPI_REG_COUNTLOW] = atapi_xferlen & 0xff;
			atapi_regs[ATAPI_REG_COUNTHIGH] = (atapi_xferlen>>8)&0xff;

			gdrom_raise_irq(machine);
		}

		if( atapi_data_ptr < atapi_data_len )
		{
			data = atapi_data[atapi_data_ptr++];
			data |= ( atapi_data[atapi_data_ptr++] << 8 );
			if( atapi_data_ptr >= atapi_data_len )
			{
//              printf( "atapi_r: read all bytes\n" );
				atapi_data_ptr = 0;
				atapi_data_len = 0;

				if( atapi_xferlen == 0 )
				{
					atapi_regs[ATAPI_REG_CMDSTATUS] = 0;
					gdrom_alt_status = 0;
					atapi_regs[ATAPI_REG_INTREASON] = ATAPI_INTREASON_IO;
					gdrom_raise_irq(machine);
				}
			}
		}
		else
		{
			data = 0;
		}
	}
	else
	{
		reg = offset;

		// get read-only side of read-only/write-only registers from elsewhere
		if (reg == ATAPI_REG_FEATURES)
		{
			reg = ATAPI_REG_ERROR;
		}
		data = atapi_regs[reg];

		#if 0
		switch( reg )
		{
		case ATAPI_REG_DATA:
			printf( "atapi_r: data=%02x\n", data );
			break;
		case ATAPI_REG_ERROR:
			printf( "atapi_r: error=%02x\n", data );
			break;
		case ATAPI_REG_INTREASON:
			printf( "atapi_r: intreason=%02x\n", data );
			break;
		case ATAPI_REG_SAMTAG:
			printf( "atapi_r: samtag=%02x\n", data );
			break;
		case ATAPI_REG_COUNTLOW:
			printf( "atapi_r: countlow=%02x\n", data );
			break;
		case ATAPI_REG_COUNTHIGH:
			printf( "atapi_r: counthigh=%02x\n", data );
			break;
		case ATAPI_REG_DRIVESEL:
			printf( "atapi_r: drivesel=%02x\n", data );
			break;
		case ATAPI_REG_CMDSTATUS:
			printf( "atapi_r: cmdstatus=%02x\n", data );
			break;
		}
		#endif

		mame_printf_debug("ATAPI: read reg %d = %x (PC=%x)\n", reg, data, space.device().safe_pc());
	}

//  printf( "atapi_r( %08x, %08x ) %08x\n", offset, mem_mask, data );
	return data;
}

static WRITE32_HANDLER( atapi_w )
{
	running_machine &machine = space.machine();
	int reg;

//  printf( "atapi_w( %08x, %08x, %08x )\n", offset, mem_mask, data );

	if (mem_mask == 0x0000ffff)	// word-wide command write
	{
//      printf("atapi_w: data=%04x\n", data );

//      printf("ATAPI: packet write %04x\n", data);
		atapi_data[atapi_data_ptr++] = data & 0xff;
		atapi_data[atapi_data_ptr++] = data >> 8;

		if (atapi_cdata_wait)
		{
//                  printf("ATAPI: waiting, ptr %d wait %d\n", atapi_data_ptr, atapi_cdata_wait);
			if (atapi_data_ptr == atapi_cdata_wait)
			{
				// send it to the device
				gdrom->WriteData( atapi_data, atapi_cdata_wait );

				// assert IRQ
				gdrom_raise_irq(machine);

				// not sure here, but clear DRQ at least?
				atapi_regs[ATAPI_REG_CMDSTATUS] = 0;
			}
		}

		else if ( atapi_data_ptr == 12 )
		{
			int phase;

//          printf("atapi_w: command %02x\n", atapi_data[0]&0xff );

			// reset data pointer for reading SCSI results
			atapi_data_ptr = 0;
			atapi_data_len = 0;

			// send it to the SCSI device
			gdrom->SetCommand( atapi_data, 12 );
			gdrom->ExecCommand( &atapi_xferlen );
			gdrom->GetPhase( &phase );

			if (atapi_xferlen != -1)
			{
				printf("ATAPI: SCSI command %02x returned %d bytes from the device\n", atapi_data[0]&0xff, atapi_xferlen);

				// store the returned command length in the ATAPI regs, splitting into
Пример #2
0
int cmdColors(Player* player, cmd* cmnd) {
    bool staff = player->isStaff();
//  player->defineMXP();

    if(!strcmp(cmnd->str[1], "reset")) {
        player->print("Custom colors have been reset to defaults.\n");
        player->resetCustomColors();
        return(0);
    } else if(cmnd->num > 2) {
        CustomColor i;
        bstring type = cmnd->str[1];
        type = type.toLower();

        if(type == "broadcast")
            i = CUSTOM_COLOR_BROADCAST;
        else if((type == "ptest" || type == "p-test") && isPtester(player))
            i = CUSTOM_COLOR_PTEST;
        else if(type == "gossip")
            i = CUSTOM_COLOR_GOSSIP;
        else if(type == "newbie")
            i = CUSTOM_COLOR_NEWBIE;
        else if(type == "dm" && player->isDm())
            i = CUSTOM_COLOR_DM;
        else if(type == "admin" && player->isAdm())
            i = CUSTOM_COLOR_ADMIN;
        else if(type == "send" && player->isCt())
            i = CUSTOM_COLOR_SEND;
        else if(type == "message" && player->isStaff())
            i = CUSTOM_COLOR_MESSAGE;
        else if(type == "watcher" && player->isWatcher())
            i = CUSTOM_COLOR_WATCHER;
        else if(type == "class")
            i = CUSTOM_COLOR_CLASS;
        else if(type == "race")
            i = CUSTOM_COLOR_RACE;
        else if(type == "clan")
            i = CUSTOM_COLOR_CLAN;
        else if(type == "tell")
            i = CUSTOM_COLOR_TELL;
        else if(type == "group")
            i = CUSTOM_COLOR_GROUP;
        else if(type == "damage")
            i = CUSTOM_COLOR_DAMAGE;
        else if(type == "self")
            i = CUSTOM_COLOR_SELF;
        else if(type == "guild")
            i = CUSTOM_COLOR_GUILD;
        else {
            player->print("Custom color type choice not understood.\n");
            return(0);
        }

        char color = nameToColorCode(getFullstrText(cmnd->fullstr, 2));
        player->setCustomColor(i, color);
        if(color == '!')
            color = '#';
        player->printColor("The ^%ccustom color^x has been set.\n", color);
        return(0);
    }

    // must be on separate lines because colorSection uses a static char
    player->print("Colors:\n");
    player->printColor("   %s", colorSection(staff, "Blue"));
    player->printColor("   %s\n", colorSection(staff, "Bold Blue"));
    player->printColor("   %s", colorSection(staff, "Red"));
    player->printColor("   %s\n", colorSection(staff, "Bold Red"));
    player->printColor("   %s", colorSection(staff, "Cyan"));
    player->printColor("   %s\n", colorSection(staff, "Bold Cyan"));
    player->printColor("   %s", colorSection(staff, "Green"));
    player->printColor("   %s\n", colorSection(staff, "Bold Green"));
    player->printColor("   %s", colorSection(staff, "Magenta"));
    player->printColor("   %s\n", colorSection(staff, "Bold Magenta"));
    player->printColor("   %s", colorSection(staff, "Yellow"));
    player->printColor("   %s\n", colorSection(staff, "Bold Yellow"));
    player->printColor("   %s", colorSection(staff, "White"));
    player->printColor("   %s\n", colorSection(staff, "Bold White"));
    player->printColor("   %s", colorSection(staff, "Black"));
    player->printColor("   %s\n", colorSection(staff, "Grey"));
    player->printColor("   %s\n", colorSection(staff, "Blink", '#'));
    player->print("\n");

    player->print("New MXP Colors:\n");
    if(!player->flagIsSet(P_MXP_ENABLED))
        player->printColor("   ^yYou will need to type \"set mxpcolors\" to enable the following colors.\n");
    player->printColor("   %s", colorSection(staff, "Gold"));
    player->printColor("   %s\n", colorSection(staff, "Cerulean"));
    player->printColor("   %s", colorSection(staff, "Pink"));
    player->printColor("   %s\n", colorSection(staff, "Sky Blue"));
    player->printColor("   %s\n", colorSection(staff, "Brown"));
    player->print("\n");
    player->printColor("Custom Colors:  type [color ^W<type> <color>^x]\n");
    player->printColor("                Choose ^Wtype^x from below, ^Wcolor^x from above.\n");
    player->printColor("                Type ^Wcolor reset^x to return to default colors.\n\n");

    std::map<bstring,bstring> options;
    std::map<bstring,bstring>::iterator it;
    options["Self: @"] = player->customColorize("*CC:SELF*");
    options["Broadcast"] = player->customColorize("*CC:BROADCAST*");
    options["Tell"] = player->customColorize("*CC:TELL*");
    options["Gossip"] = player->customColorize("*CC:GOSSIP*");
    options["Newbie"] = player->customColorize("*CC:NEWBIE*");
    options["Class"] = player->customColorize("*CC:CLASS*");
    options["Race"] = player->customColorize("*CC:RACE*");
    options["Clan"] = player->customColorize("*CC:CLAN*");
    options["Group"] = player->customColorize("*CC:GROUP*");
    options["Damage"] = player->customColorize("*CC:DAMAGE*");
    if(player->isDm())
        options["DM"] = player->customColorize("*CC:DM*");
    if(player->isAdm())
        options["Admin"] = player->customColorize("*CC:ADMIN*");
    if(player->isCt())
        options["Send"] = player->customColorize("*CC:SEND*");
    if(player->isStaff())
        options["Message"] = player->customColorize("*CC:MESSAGE*");
    if(player->isWatcher())
        options["Watcher"] = player->customColorize("*CC:WATCHER*");
    if(isPtester(player))
        options["P-Test"] = player->customColorize("*CC:PTEST*");
    if(player->getGuild())
        options["Guild"] = player->customColorize("*CC:GUILD*");

    for(it = options.begin() ; it != options.end() ; ) {
        for(int n=0; n<3; n++) {
            if(it != options.end()) {
                player->printColor("   ^x* %s%-10s", (*it).second.c_str(), (*it).first.c_str());
                it++;
            }
        }
        player->print("\n");
    }
    player->print("\n");

    return(0);
}