示例#1
0
void rxModeQuickBoot(){
	if(!checkEmuNAND()){
		rxMode(0);
	}else{
		rxMode(1);
	}
}
示例#2
0
文件: main.c 项目: ArnoJuan/rxTools
static _Noreturn void mainLoop()
{
	uint32_t pad;

	while (true) {
		drawBottom();
		pad = InputWait();

		if (pad & BUTTON_A) rxMode(1);		//EMUNAND
		if (pad & BUTTON_X) rxMode(0);		//SYSNAND
		if (pad & BUTTON_Y) PastaMode();	//PASTAMODE
		if (pad & BUTTON_B) ShutDown(1);	//SHUTDOWN
		if (pad & BUTTON_LEFT)
		{
			if(cfgs[CFG_DEFAULT].val.i == 0) cfgs[CFG_DEFAULT].val.i = 3;
			else cfgs[CFG_DEFAULT].val.i--;
			writeCfg();

		}
		if(pad & BUTTON_RIGHT)
		{
			if(cfgs[CFG_DEFAULT].val.i == 3) cfgs[CFG_DEFAULT].val.i = 0;
			else cfgs[CFG_DEFAULT].val.i++;
			writeCfg();
		}
	}
}
示例#3
0
文件: firm.c 项目: Syphurith/rxTools
void rxModeWithSplash(int emu)
{
	char s[32];

	sprintf(s, "/rxTools/Theme/%u/boot.bin", cfgs[CFG_THEME].val.i);
	DrawBottomSplash(s);
	rxMode(emu);
}
示例#4
0
void rxModeSys(){
    ConsoleInit();
    ConsoleSetTitle("rxMode - Booting in SysNand");
    print("Loading...\n"); ConsoleShow();
	rxMode(0);
	print("Cannot boot in rxMode.\n\nPress A to exit\n"); ConsoleShow();
	WaitForButton(BUTTON_A);
}
示例#5
0
文件: cfw.c 项目: nastys/rxTools
void rxModeSys(){
	sprintf(str, "/rxTools/Theme/%u/boot.bin", cfgs[CFG_THEME].val.i);
	DrawBottomSplash(str);
	rxMode(0);
	sprintf(str, "/rxTools/Theme/%u/bootE.bin", cfgs[CFG_THEME].val.i);
	DrawBottomSplash(str);
	WaitForButton(BUTTON_A);
}
示例#6
0
文件: firm.c 项目: Taktloss/rxTools
void rxModeWithSplash(int emu)
{
	wchar_t s[_MAX_LFN];

	swprintf(s, _MAX_LFN, L"/rxTools/Theme/%u/boot.bin",
		cfgs[CFG_THEME].val.i);
	DrawBottomSplash(s);
	rxMode(emu);
}
示例#7
0
void rxModeEmu(){
	if(!checkEmuNAND()) rxModeSys();
	else{
		ConsoleInit();
		ConsoleSetTitle("rxMode - Booting in EmuNand");
		print("Loading...\n"); ConsoleShow();
		rxMode(1);
		print("Cannot boot in rxMode.\n\nPress A to exit\n"); ConsoleShow();
		WaitForButton(BUTTON_A);
	}
}
示例#8
0
文件: cfw.c 项目: nastys/rxTools
void rxModeEmu(){
	if (!checkEmuNAND()) rxModeSys();
	else{
		sprintf(str, "/rxTools/Theme/%u/boot.bin", cfgs[CFG_THEME].val.i);
		DrawBottomSplash(str);
		rxMode(1);
		sprintf(str, "/rxTools/Theme/%u/bootE.bin", cfgs[CFG_THEME].val.i);
		DrawBottomSplash(str);
		WaitForButton(BUTTON_A);
	}
}
示例#9
0
文件: main.c 项目: ArnoJuan/rxTools
__attribute__((section(".text.start"), noreturn)) void _start()
{
	static const TCHAR fontPath[] = _T("") SYS_PATH "/" FONT_NAME;
	void *fontBuf;
	UINT btr, br;
	int r;
	FIL f;

	// Enable TMIO IRQ
	*(volatile uint32_t *)0x10001000 = 0x00010000;

	preloadStringsA();

	
	if (!FSInit()) {
		DrawString(BOT_SCREEN, strings[STR_FAILED],
			BOT_SCREEN_WIDTH / 2, SCREEN_HEIGHT - FONT_HEIGHT, RED, BLACK);
		while (1);
	}

	
	set_loglevel(ll_info);
	log(ll_info, "Initializing rxTools...");
	

	setConsole();

	fontIsLoaded = 0;
	r = f_open(&f, fontPath, FA_READ);
	if (r == FR_OK) {
		btr = f_size(&f);
		fontBuf = __builtin_alloca(btr);
		r = f_read(&f, fontBuf, btr, &br);
		if (r == FR_OK)
			fontIsLoaded = 1;

		f_close(&f);
		fontaddr = fontBuf;
	}

	if (fontIsLoaded)
		preloadStringsU();
	else
		warn(L"Failed to load " FONT_NAME ": %d\n", r);

	if (getMpInfo() == MPINFO_KTR)
    {
        r = initN3DSKeys();
        if (r != FR_OK) {
            warn(L"Failed to load keys for N3DS\n"
            "  Code: %d\n"
            "  RxMode will not boot. Please\n"
            "  include key_0x16.bin and\n"
            "  key_0x1B.bin at the root of your\n"
            "  SD card.\n", r);
            InputWait();
            goto postinstall;
        }
    }


	install();
	postinstall:
	readCfg();

	log(ll_info, "Done...");

	r = loadStrings();
	if (r)
		warn(L"Failed to load strings: %d\n", r);

	drawTop();

	//Default boot check
	if (cfgs[CFG_DEFAULT].val.i && HID_STATE & BUTTON_L1)
		{
			if(cfgs[CFG_DEFAULT].val.i == 3) PastaMode();
			else rxMode(cfgs[CFG_DEFAULT].val.i - 1);
		}

	if (sysver < 7) {
		r = initKeyX();
		if (r != FR_OK)
			warn(L"Failed to load key X for slot 0x25\n"
				"  Code: %d\n"
				"  If your firmware version is less\n"
				"  than 7.X, some titles decryption\n"
				"  will fail, and some EmuNANDs\n"
				"  will not boot.\n", r);
	}

	if (warned) {
		warn(strings[STR_PRESS_BUTTON_ACTION],
			strings[STR_BUTTON_A], strings[STR_CONTINUE]);
		WaitForButton(BUTTON_A);
	}

	OpenAnimation();
	mainLoop();
}
示例#10
0
文件: main.c 项目: motezazer/rxTools
int Initialize()
{
	char str[100];
	char strl[100];
	char strr[100];
	char tmp[256];
	wchar_t wtmp[256];
	int r;

	preloadStringsA();

	DrawString(BOT_SCREEN, strings[STR_INITIALIZING], FONT_WIDTH, SCREEN_HEIGHT-FONT_HEIGHT, WHITE, BLACK);

	if(FSInit()){
		DrawString(BOT_SCREEN, strings[STR_LOADING], BOT_SCREEN_WIDTH/2, SCREEN_HEIGHT-FONT_HEIGHT, WHITE, BLACK);
	}else{
		DrawString(BOT_SCREEN, strings[STR_FAILED], BOT_SCREEN_WIDTH/2, SCREEN_HEIGHT-FONT_HEIGHT, RED, BLACK);
		return 1;
	}

	LoadFont();
	if (fontLoaded){
		swprintf(wtmp, sizeof(wtmp)/sizeof(wtmp[0]), strings[STR_ERROR_OPENING], fontpath);
		DrawString(BOT_SCREEN, wtmp, FONT_WIDTH, SCREEN_HEIGHT-FONT_HEIGHT*2, RED, BLACK);
	}else{
		preloadStringsU();
	}

	//Console Stuff
	ConsoleSetXY(15, 20);
	ConsoleSetWH(BOT_SCREEN_WIDTH-30, SCREEN_HEIGHT-80);
	ConsoleSetBorderColor(BLUE);
	ConsoleSetTextColor(RGB(0, 141, 197));
	ConsoleSetBackgroundColor(TRANSPARENT);
	ConsoleSetSpecialColor(BLUE);
	ConsoleSetSpacing(2);
	ConsoleSetBorderWidth(3);
	//Check that the data is installed
	f_mkdir("rxTools");
	f_mkdir("rxTools/nand");
	InstallConfigData();
	readCfg();

	if (fontLoaded)
		cfgs[CFG_LANG].val.s = cfgLang;
	r = loadStrings();
	if (r) {
		sprintf(tmp, "%s/%s", langPath, cfgs[CFG_LANG].val.s);
		swprintf(wtmp, sizeof(wtmp)/sizeof(wtmp[0]), strings[STR_ERROR_OPENING], tmp);
		DrawString(BOT_SCREEN, wtmp, FONT_WIDTH, SCREEN_HEIGHT-FONT_HEIGHT*3, RED, BLACK);
	}
	sprintf(str, "/rxTools/Theme/%u/TOP.bin", cfgs[CFG_THEME].val.i);
	sprintf(strl, "/rxTools/Theme/%u/TOPL.bin", cfgs[CFG_THEME].val.i);
	sprintf(strr, "/rxTools/Theme/%u/TOPR.bin", cfgs[CFG_THEME].val.i);
	if (cfgs[CFG_3D].val.i)
		DrawTopSplash(str, strl, strr);
	else
		DrawTopSplash(str, str, str);

	if (!cfgs[CFG_GUI].val.i)
	{
		if(cfgs[CFG_SILENT].val.i)
		{
			sprintf(str, "/rxTools/Theme/%u/boot.bin", cfgs[CFG_THEME].val.i);
			DrawBottomSplash(str);

			for (int i = 0; i < 0x333333 * 2; i++){
				uint32_t pad = GetInput();
				if (pad & BUTTON_R1 && i > 0x333333) goto rxTools_boot;
			}
		}
		else
		{
			ConsoleInit();
			ConsoleSetTitle(strings[STR_AUTOBOOT]);
			print(strings[STR_HOLD_BUTTON_ACTION], strings[STR_BUTTON_R], strings[STR_OPEN_MENU]);
			ConsoleShow();

			for (int i = 0; i < 0x333333 * 6; i++){
				uint32_t pad = GetInput();
				if (pad & BUTTON_R1 && i > 0x333333) goto rxTools_boot;
			}
		}
		rxMode(1);
	}
rxTools_boot:
	sprintf(str, "/rxTools/Theme/%u/TOP.bin", cfgs[CFG_THEME].val.i);
	sprintf(strl, "/rxTools/Theme/%u/TOPL.bin", cfgs[CFG_THEME].val.i);
	sprintf(strr, "/rxTools/Theme/%u/TOPR.bin", cfgs[CFG_THEME].val.i);
	if (cfgs[CFG_3D].val.i)
		DrawTopSplash(str, strl, strr);
	else
		DrawTopSplash(str, str, str);

	return 0;
}
示例#11
0
文件: cfw.c 项目: nastys/rxTools
void rxModeQuickBoot(){
	rxMode(1);
}
示例#12
0
文件: main.c 项目: mikemow/rxTools
__attribute__((section(".text.start"), noreturn)) void _start()
{
	static const TCHAR fontPath[] = _T("") SYS_PATH "/" FONT_NAME;
	void *fontBuf;
	UINT btr, br;
	int r;
	FIL f;

	// Enable TMIO IRQ
	*(volatile uint32_t *)0x10001000 = 0x00010000;

	preloadStringsA();

	if (!FSInit()) {
		DrawString(BOT_SCREEN, strings[STR_FAILED],
			BOT_SCREEN_WIDTH / 2, SCREEN_HEIGHT - FONT_HEIGHT, RED, BLACK);
		while (1);
	}

	/*
	set_loglevel(ll_info);
	log(ll_info, "Initializing rxTools...");
	*/

	setConsole();

	fontIsLoaded = 0;
	r = f_open(&f, fontPath, FA_READ);
	if (r == FR_OK) {
		btr = f_size(&f);
		fontBuf = __builtin_alloca(btr);
		r = f_read(&f, fontBuf, btr, &br);
		if (r == FR_OK)
			fontIsLoaded = 1;

		f_close(&f);
		fontaddr = fontBuf;
	}

	if (fontIsLoaded)
		preloadStringsU();
	else
		warn(L"Failed to load " FONT_NAME ": %d\n", r);

	install();
	readCfg();

	r = loadStrings();
	if (r)
		warn(L"Failed to load strings: %d\n", r);

	drawTop();

	if (!cfgs[CFG_GUI].val.i && HID_STATE & BUTTON_L1)
		rxMode(cfgs[CFG_ABSYSN].val.i ? 0 : 1);

	if (sysver < 7) {
		r = initKeyX();
		if (r != FR_OK)
			warn(L"Failed to load key X for slot 0x25\n"
				"  Code: %d\n"
				"  If your firmware version is less\n"
				"  than 7.X, some titles decryption\n"
				"  will fail, and some EmuNANDs\n"
				"  will not boot.\n", r);
	}

	if (warned) {
		warn(strings[STR_PRESS_BUTTON_ACTION],
			strings[STR_BUTTON_A], strings[STR_CONTINUE]);
		WaitForButton(BUTTON_A);
	}

	OpenAnimation();
	MenuInit(&MainMenu);
	MenuShow();
	mainLoop();
}
示例#13
0
文件: main.c 项目: nerirififi/rxTools
int Initialize()
{
	char str[100];
	char strl[100];
	char strr[100];
	char tmp[256];
	wchar_t wtmp[256];
	int r;

	preloadStringsA();

	//Show error if FSInit is not successfull
	if (!FSInit()){
		DrawString(BOT_SCREEN, strings[STR_FAILED], BOT_SCREEN_WIDTH / 2, SCREEN_HEIGHT - FONT_HEIGHT, RED, BLACK);
		return 1;
	}

	/* Set log level here for code debug/trace */
	/*
	set_loglevel(ll_info);
	log(ll_info, "Initializing rxTools...");
	*/

	//Load the font
	LoadFont();
	if (fontLoaded){
		swprintf(wtmp, sizeof(wtmp) / sizeof(wtmp[0]), strings[STR_ERROR_OPENING], fontpath);
		DrawString(BOT_SCREEN, wtmp, FONT_WIDTH, SCREEN_HEIGHT - FONT_HEIGHT * 2, RED, BLACK);
	}
	else{
		preloadStringsU();
	}

	//Console Stuff
	ConsoleSetXY(15, 20);
	ConsoleSetWH(BOT_SCREEN_WIDTH - 30, SCREEN_HEIGHT - 80);
	ConsoleSetBorderColor(BLUE);
	ConsoleSetTextColor(RGB(0, 141, 197));
	ConsoleSetBackgroundColor(TRANSPARENT);
	ConsoleSetSpecialColor(BLUE);
	ConsoleSetSpacing(2);
	ConsoleSetBorderWidth(3);
	//Check that the data is installed
	f_mkdir("rxTools");
	f_mkdir("rxTools/nand");
	InstallConfigData();
	readCfg();

	//Load strings
	if (fontLoaded)
		cfgs[CFG_LANG].val.s = cfgLang;
	r = loadStrings();
	if (r) {
		sprintf(tmp, "%s/%s", langPath, cfgs[CFG_LANG].val.s);
		swprintf(wtmp, sizeof(wtmp) / sizeof(wtmp[0]), strings[STR_ERROR_OPENING], tmp);
		DrawString(BOT_SCREEN, wtmp, FONT_WIDTH, SCREEN_HEIGHT - FONT_HEIGHT * 3, RED, BLACK);
	}

	//Draw the top screen splash
	sprintf(str, "/rxTools/Theme/%u/TOP.bin", cfgs[CFG_THEME].val.i);
	sprintf(strl, "/rxTools/Theme/%u/TOPL.bin", cfgs[CFG_THEME].val.i);
	sprintf(strr, "/rxTools/Theme/%u/TOPR.bin", cfgs[CFG_THEME].val.i);
	if (cfgs[CFG_3D].val.i)
		DrawTopSplash(str, strl, strr);
	else
		DrawTopSplash(str, str, str);

	//If the GUI is not forced, show it only if L is hold, else directly boot rxMode (sys or emu)
	if (!cfgs[CFG_GUI].val.i)
	{
		if ((~HID_STATE) & BUTTON_L1) return 0;

		if (cfgs[CFG_ABSYSN].val.i) rxMode(0);
		else rxMode(1);
	}

	return 0; //Boot rxTools menu
}
示例#14
0
void CatManager::PerformCmd(QString str)
{
	short cmd = GetNameCmd(str);
	QString tmpstr1, tmpstr2, tmpFreq, tmpStep, tmpMod;
	int Freq, Tmp;
	QString SendStr;
	QByteArray Data;
	switch(cmd)
	{
	case 0x4741:
		if(str.size() == 3)
		{
			if(str.right(1).toInt() == 0)
			{
                Tmp = (pSdr->ui.slVol->value()*255)/100;
                tmpstr1.setNum((pSdr->ui.slVol->value()*255)/100);
				if(Tmp < 10)
					SendStr = "AG000" + tmpstr1 + ";";
				else if(Tmp < 100)
					SendStr = "AG00" + tmpstr1 + ";";
				else
					SendStr = "AG0" + tmpstr1 + ";";

                Data = SendStr.toLatin1();
				pCom->write(Data);
			}
		}
        else if(str.size() == 6)
		{
        	emit changedVolume(str.right(3).toInt());
            pSdr->ui.slVol->setValue((str.right(3).toInt()*100)/255);
            pSdr->OnVolume((str.right(3).toInt()*100)/255);



		}
		else
		{
			SentErrorCode(ERROR_PARAM);
			break;
		}
		break;
	case 0x4941:
		SentErrorCode(ERROR_CMD);
		break;
	case 0x4442:
		if(str.size() == 2)
		{
			emit changedBand(-1);
			Tmp = pSdr->pBandBut->checkedId();
			if(--Tmp < 0)
				Tmp = 13;
			pSdr->OnChangeBand(Tmp);
		}
		else
		{
			SentErrorCode(ERROR_PARAM);
			break;
		}
		break;
	case 0x5542:
		if(str.size() == 2)
		{
			emit changedBand(1);
			Tmp = pSdr->pBandBut->checkedId();
			if(++Tmp > 13)
				Tmp = 0;
			pSdr->OnChangeBand(Tmp);
		}
		else
		{
			SentErrorCode(ERROR_PARAM);
			break;
		}
		break;
	case 0x4E44:
		if(str.size() == 2)
		{
			emit changedIncrDecrVFO_A(-1);
		}
		else
		{
			SentErrorCode(ERROR_PARAM);
			break;
		}
		break;
	case 0x4146:
	case 0x5246:
	case 0x5446:
		if(str.size() == 2)
		{
			Freq = pSdr->FreqNum + pSdr->pGraph->pGl->GetPitch();
			tmpstr1.setNum(Freq);

			if(Freq < 10)
				tmpFreq = "0000000000" + tmpstr1;
			else if(Freq < 100)
				tmpFreq = "000000000" + tmpstr1;
			else if(Freq < 1000)
				tmpFreq = "00000000" + tmpstr1;
			else if(Freq < 10000)
				tmpFreq = "0000000" + tmpstr1;
			else if(Freq < 100000)
				tmpFreq = "000000" + tmpstr1;
			else if(Freq < 1000000)
				tmpFreq = "00000" + tmpstr1;
			else if(Freq < 10000000)
				tmpFreq = "0000" + tmpstr1;
			else if(Freq < 100000000)
				tmpFreq = "000" + tmpstr1;
			else if(Freq < 1000000000)
				tmpFreq = "00" + tmpstr1;

			if(cmd == 0x4146)
			{
				SendStr = "FA" + tmpFreq + ";";
			}
			else if(cmd == 0x5246)
			{
				SendStr = "FR" + tmpFreq + ";";
			}
			else if(cmd == 0x5446)
			{
                if(pSdr->ui.pbSplit->isChecked())
				{
					SendStr = "FT" + tmpFreq + ";";
				}
				else
				{
					Freq = pSdr->pVfoB->value() + pSdr->pGraph->pGl->GetPitch();
					tmpstr1.setNum(Freq);
					SendStr = "FT" + tmpFreq + ";";
				}
			}
            Data = SendStr.toLatin1();
			pCom->write(Data);
		}
		else if(str.size() == 13)
		{
			emit changedVFO_A(str.right(11).toInt() - pSdr->pGraph->pGl->GetPitch());
			pSdr->OnChangeMainFreqWithWdgMem(str.right(11).toInt() - pSdr->pGraph->pGl->GetPitch(), pSdr->MainMod());
		}
		else
		{
			SentErrorCode(ERROR_PARAM);
			break;
		}
		break;
	case 0x4246:
		if(str.size() == 2)
		{
			Freq = pSdr->pVfoB->value() + pSdr->pGraph->pGl->GetPitch();//FreqNum;
			tmpstr1.setNum(Freq);

			if(Freq < 10)
				tmpFreq = "0000000000" + tmpstr1;
			else if(Freq < 100)
				tmpFreq = "000000000" + tmpstr1;
			else if(Freq < 1000)
				tmpFreq = "00000000" + tmpstr1;
			else if(Freq < 10000)
				tmpFreq = "0000000" + tmpstr1;
			else if(Freq < 100000)
				tmpFreq = "000000" + tmpstr1;
			else if(Freq < 1000000)
				tmpFreq = "00000" + tmpstr1;
			else if(Freq < 10000000)
				tmpFreq = "0000" + tmpstr1;
			else if(Freq < 100000000)
				tmpFreq = "000" + tmpstr1;
			else if(Freq < 1000000000)
				tmpFreq = "00" + tmpstr1;

			SendStr = "FB" + tmpFreq + ";";

            Data = SendStr.toLatin1();
			pCom->write(Data);
		}
		else if(str.size() == 13)
		{
			emit changedVFO_B(str.right(11).toInt() - pSdr->pGraph->pGl->GetPitch());
			pSdr->pVfoB->setValue(str.right(11).toInt() - pSdr->pGraph->pGl->GetPitch());
		}
		else
		{
			SentErrorCode(ERROR_PARAM);
		}
		break;
	case 0x5746:
		SentErrorCode(ERROR_CMD);
		break;
	case 0x5447:
		if(str.size() == 2)
		{
			Tmp = pSdr->MainAGC();
			tmpstr1.setNum(Tmp);
			SendStr = "GT00" + tmpstr1 + ";";
            Data = SendStr.toLatin1();
			pCom->write(Data);
		}
		else if(str.size() == 5)
		{
			Tmp = str.right(3).toInt();
			if(Tmp >= 0 && Tmp < 6)
			{
				emit changedAGC(str.right(3).toInt());
				pSdr->OnAgc(Tmp);
			}
			else
			{
				SentErrorCode(ERROR_PARAM);
			}
		}
		else
		{
			SentErrorCode(ERROR_PARAM);
			break;
		}
		break;
	case 0x4449:
		if(str.size() == 2)
		{
			SendStr = "ID019;";
            Data = SendStr.toLatin1();
			pCom->write(Data);
		}
		else
		{
			SentErrorCode(ERROR_PARAM);
			break;
		}
		break;
	case 0x4649:
		if(str.size() != 2)
		{
			SentErrorCode(ERROR_CMD);
			return;
		}
		tmpMod = ModToCat[pSdr->MainMod()];
		if(tmpMod == "0")
		{
			SentErrorCode(ERROR_PARAM);
			return;
		}

		Freq = pSdr->FreqNum + pSdr->pGraph->pGl->GetPitch();
		tmpstr1.setNum(Freq);

		if(Freq < 10)
			tmpFreq = "0000000000" + tmpstr1;
		else if(Freq < 100)
			tmpFreq = "000000000" + tmpstr1;
		else if(Freq < 1000)
			tmpFreq = "00000000" + tmpstr1;
		else if(Freq < 10000)
			tmpFreq = "0000000" + tmpstr1;
		else if(Freq < 100000)
			tmpFreq = "000000" + tmpstr1;
		else if(Freq < 1000000)
			tmpFreq = "00000" + tmpstr1;
		else if(Freq < 10000000)
			tmpFreq = "0000" + tmpstr1;
		else if(Freq < 100000000)
			tmpFreq = "000" + tmpstr1;
		else if(Freq < 1000000000)
			tmpFreq = "00" + tmpstr1;

		tmpStep = StepToCat[pSdr->MainStep()];

		tmpstr1 = "IF" + tmpFreq + tmpStep + "000000" + "0" + "0" + "0" + "00";

        tmpstr2.setNum((int)(pSdr->ui.pbMox->isChecked()));

		tmpstr1 += tmpstr2 + tmpMod + "0" + "0" + "0" + "0" + "00" + "0;";

                Data = tmpstr1.toLatin1();
		pCom->write(Data);

		break;
	case 0x534B:
		if(str.size() == 2)
		{
			SendStr = "KS000;";
            Data = SendStr.toLatin1();
			pCom->write(Data);
		}
		else if(str.size() == 5)
		{
			emit changetCWLSpeed(str.right(3).toInt());
		}
		else
		{
			SentErrorCode(ERROR_PARAM);
			break;
		}
		break;
	case 0x594B:
		SentErrorCode(ERROR_CMD);
		break;
	case 0x444D:
		if(str.size() == 2)
		{
			tmpMod = ModToCat[pSdr->MainMod()];
			if(tmpMod == "0")
			{
				SentErrorCode(ERROR_PARAM);
				return;
			}

			SendStr = "MD" + tmpMod + ";";
            Data = SendStr.toLatin1();
			pCom->write(Data);
		}
		else if(str.size() == 3)
		{
			emit changedMode(str.right(1).toInt());
			Tmp = CatToMod[str.right(1).toInt()];
			if(Tmp >= 0)
				pSdr->OnChangeMode(Tmp);
			else
				SentErrorCode(ERROR_PARAM);
		}
		else
		{
			SentErrorCode(ERROR_PARAM);
			break;
		}
		break;
	case 0x474D:
		if(str.size() == 2)
		{
            Tmp = pSdr->ui.slMic->value();
			if(Tmp < 10)
			{
				tmpstr1.setNum(Tmp);
				SendStr = "MG00" + tmpstr1 + ";";
			}
			else if(Tmp < 100)
			{
				tmpstr1.setNum(Tmp);
				SendStr = "MG0" + tmpstr1 + ";";
			}
			else
			{
				tmpstr1.setNum(Tmp);
				SendStr = "MG" + tmpstr1 + ";";
			}
            Data = SendStr.toLatin1();
			pCom->write(Data);
		}
		else if(str.size() == 5)
		{
			emit changedGainMicrophone(str.right(3).toInt());
			Tmp = str.right(3).toInt();
			pSdr->OnMic(Tmp);
		}
		else
		{
			SentErrorCode(ERROR_PARAM);
			break;
		}
		break;
	case 0x4F4D:
		SentErrorCode(ERROR_CMD);
		break;
	case 0x424E:
		if(str.size() == 2)
		{
            if(pSdr->ui.pbNb->isChecked())
				SendStr = "NB0;";
			else
				SendStr = "NB1;";

            Data = SendStr.toLatin1();
			pCom->write(Data);
		}
		else if(str.size() == 3)
		{
			if(str.right(1).toInt() != 0)
				pSdr->OnNb(false);
			else
				pSdr->OnNb(true);

			emit changedNB((bool)str.right(1).toInt());
		}
		else
		{
			SentErrorCode(ERROR_PARAM);
			break;
		}
		break;
	case 0x544E:
		if(str.size() == 2)
		{
            if(pSdr->ui.pbAnf->isChecked())
				SendStr = "NT0;";
			else
				SendStr = "NT1;";
            Data = SendStr.toLatin1();
			pCom->write(Data);
		}
		else if(str.size() == 3)
		{
			if(str.right(1).toInt() != 0)
				pSdr->OnAnf(false);
			else
				pSdr->OnAnf(true);

			emit changedANF((bool)str.right(1).toInt());
		}
		else
		{
			SentErrorCode(ERROR_PARAM);
			break;
		}
		break;
	case 0x4350:
		if(str.size() == 2)
		{
            Tmp = pSdr->ui.slDrive->value();
			tmpstr1.setNum(Tmp);
			if(Tmp < 10)
				SendStr = "PC00" + tmpstr1 + ";";
			else if(Tmp < 100)
				SendStr = "PC0" + tmpstr1 + ";";
			else
				SendStr = "PC" + tmpstr1 + ";";

			SendStr = "PC" + tmpstr1 + ";";
            Data = SendStr.toLatin1();
			pCom->write(Data);
		}
		else if(str.size() == 5)
		{
			Tmp = str.right(3).toInt();
			if(Tmp >= 0 && Tmp <= 100)
			{
				pSdr->OnDrive(Tmp);
				emit changedPWR(str.right(3).toInt());
			}
			else
				SentErrorCode(ERROR_PARAM);
		}
		else
		{
			SentErrorCode(ERROR_PARAM);
			break;
		}
		break;
	case 0x5250:
		if(str.size() == 2)
		{
            if(pSdr->ui.pbComp->isChecked())
				SendStr = "PR0;";
			else
				SendStr = "PR1;";
            Data = SendStr.toLatin1();
			pCom->write(Data);
		}
		else if(str.size() == 3)
		{
			if(str.right(1).toInt() != 0)
				pSdr->OnComp(false);
			else
				pSdr->OnComp(true);

			emit changedCOMP((bool)str.right(1).toInt());
		}
		else
		{
			SentErrorCode(ERROR_PARAM);
			break;
		}
		break;
	case 0x5350:
		if(str.size() == 2)
		{
            if(pSdr->ui.pbStart->isChecked())
				SendStr = "PS1;";
			else
				SendStr = "PS0;";

            Data = SendStr.toLatin1();
			pCom->write(Data);
		}
		else if(str.size() == 3)
		{
			if(str.right(1).toInt() != 0)
				pSdr->OnStart(true);
			else
				pSdr->OnStart(false);
			emit changedOnOff((bool)str.right(1).toInt());
		}
		else
		{
			SentErrorCode(ERROR_PARAM);
			break;
		}
		break;
	case 0x4352:
		if(str.size() == 2)
		{

		}
		else
		{
			SentErrorCode(ERROR_PARAM);
			break;
		}
		break;
	case 0x5452:
		if(str.size() == 2)
		{
			SendStr = "RT0;";
            Data = SendStr.toLatin1();
			pCom->write(Data);
		}
		else if(str.size() == 3)
		{
			emit changedOnOff((bool)str.right(1).toInt());
		}
		else
		{
			SentErrorCode(ERROR_PARAM);
			break;
		}
		break;
	case 0x5852:
		if(str.size() == 2)
		{
			emit rxMode();
		}
		else
		{
			SentErrorCode(ERROR_PARAM);
			break;
		}
		break;
	case 0x4853:
		SentErrorCode(ERROR_CMD);
		break;
	case 0x4C53:
		SentErrorCode(ERROR_CMD);
		break;
	case 0x4D53:
		if(str.size() == 3)
		{
			Tmp = pSdr->MainSmeter();
			Tmp += 73;
			Tmp /= 4.0;
			Tmp += 15;
			if(Tmp < 0)
				Tmp = 0;
			else if(Tmp > 30)
				Tmp = 30;

			tmpstr1.setNum(Tmp);
			if(Tmp < 10)
				SendStr = "SM0000" + tmpstr1 + ";";
			else
				SendStr = "SM000" + tmpstr1 + ";";

            Data = SendStr.toLatin1();
			pCom->write(Data);
		}
		else
		{
			SentErrorCode(ERROR_PARAM);
			break;
		}
		break;
	case 0x5153:
		if(str.size() == 3)
		{
            Tmp = pSdr->ui.slSql->value();
			Tmp *= -255.0/160.0;
			tmpstr1.setNum(Tmp);
			if(Tmp < 10)
				SendStr = "SQ000" + tmpstr1 + ";";
			else if(Tmp < 100)
				SendStr = "SQ00" + tmpstr1 + ";";
			else
				SendStr = "SQ0" + tmpstr1 + ";";

            Data = SendStr.toLatin1();
			pCom->write(Data);
		}
		else if(str.size() == 6)
		{
			Tmp = str.right(3).toInt();
			Tmp *= -160.0/255.0;
			pSdr->OnSql(Tmp);
			emit changedSQLval(Tmp);
		}
		else
		{
			SentErrorCode(ERROR_PARAM);
			break;
		}
		break;
	case 0x5854:
		if((str.size() == 2) || (str.size() == 3))
		{
			emit txMode();
		}
		else
		{
			SentErrorCode(ERROR_PARAM);
			break;
		}
		break;
	case 0x5055:
		if(str.size() == 2)
		{
			emit changedIncrDecrVFO_A(1);
		}
		else
		{
			SentErrorCode(ERROR_PARAM);
			break;
		}
		break;
	case 0x5458:
		if(str.size() == 2)
		{
			SendStr = "XT0;";
            Data = SendStr.toLatin1();
			pCom->write(Data);
		}
		else if(str.size() == 3)
		{
			emit changedXIT((bool)str.right(1).toInt());
		}
		else
		{
			SentErrorCode(ERROR_PARAM);
			break;
		}
		break;

	default:
		SentErrorCode(ERROR_CMD);
		break;
	}
}