void RegisteredUsersDialog::FilterRegs() {
    int iTextLength = ::GetWindowTextLength(m_hWndWindowItems[EDT_FILTER]);

    if(iTextLength == 0) {
        m_sFilterString.clear();

    	AddAllRegs();
    } else {
        m_iFilterColumn = (int)::SendMessage(m_hWndWindowItems[CB_FILTER], CB_GETCURSEL, 0, 0);

        char buf[65];

        int iLen = ::GetWindowText(m_hWndWindowItems[EDT_FILTER], buf, 65);

        for(int i = 0; i < iLen; i++) {
            buf[i] = (char)tolower(buf[i]);
        }

        m_sFilterString = buf;

        ::SendMessage(m_hWndWindowItems[LV_REGS], WM_SETREDRAW, (WPARAM)FALSE, 0);

        ::SendMessage(m_hWndWindowItems[LV_REGS], LVM_DELETEALLITEMS, 0, 0);

        RegUser * curReg = nullptr,
            * nextReg = RegManager::m_Ptr->m_pRegListS;

        while(nextReg != nullptr) {
            curReg = nextReg;
            nextReg = curReg->m_pNext;

            switch(m_iFilterColumn) {
                case 0:
                    if(stristr2(curReg->m_sNick, m_sFilterString.c_str()) == nullptr) {
                        continue;
                    }
                    break;
                case 1:
                    if(stristr2(curReg->m_sPass, m_sFilterString.c_str()) == nullptr) {
                        continue;
                    }
                    break;
                case 2:
                    if(stristr2(ProfileManager::m_Ptr->m_ppProfilesTable[curReg->m_ui16Profile]->m_sName, m_sFilterString.c_str()) == nullptr) {
                        continue;
                    }
                    break;
            }

            AddReg(curReg);
        }

        ListViewSelectFirstItem(m_hWndWindowItems[LV_REGS]);

        ::SendMessage(m_hWndWindowItems[LV_REGS], WM_SETREDRAW, (WPARAM)TRUE, 0);
    }
}
Пример #2
0
void CRegression::AddList(CRegression* reglist)
{
	CRegression* p = reglist->Next;
	while(NULL!=p)
	{
		AddReg(p->Weight,p->Vars);
		p = p->Next;
	}
	//Delete();

	return;
}
Пример #3
0
void FragmentProgramDecompiler::SetDst(std::string code, bool append_mask)
{
	if (!src0.exec_if_eq && !src0.exec_if_gr && !src0.exec_if_lt) return;

	switch (src1.scale)
	{
	case 0: break;
	case 1: code = "(" + code + " * 2.0)"; break;
	case 2: code = "(" + code + " * 4.0)"; break;
	case 3: code = "(" + code + " * 8.0)"; break;
	case 5: code = "(" + code + " / 2.0)"; break;
	case 6: code = "(" + code + " / 4.0)"; break;
	case 7: code = "(" + code + " / 8.0)"; break;

	default:
		LOG_ERROR(RSX, "Bad scale: %d", u32{ src1.scale });
		Emu.Pause();
		break;
	}

	if (dst.saturate)
	{
		code = saturate(code);
	}

	code += (append_mask ? "$m" : "");

	if (dst.no_dest)
	{
		if (dst.set_cond)
		{
			AddCode("$ifcond " + m_parr.AddParam(PF_PARAM_NONE, getFloatTypeName(4), "cc" + std::to_string(src0.cond_mod_reg_index)) + "$m = " + code + ";");
		}
		else
		{
			AddCode("$ifcond " + code + ";");
		}

		return;
	}

	std::string dest = AddReg(dst.dest_reg, dst.fp16) + "$m";

	AddCodeCond(Format(dest), code);
	//AddCode("$ifcond " + dest + code + (append_mask ? "$m;" : ";"));

	if (dst.set_cond)
	{
		AddCode(m_parr.AddParam(PF_PARAM_NONE, getFloatTypeName(4), "cc" + std::to_string(src0.cond_mod_reg_index)) + "$m = " + dest + ";");
	}
}
void RegisteredUsersDialog::AddAllRegs() {
    ::SendMessage(m_hWndWindowItems[LV_REGS], WM_SETREDRAW, (WPARAM)FALSE, 0);

    ::SendMessage(m_hWndWindowItems[LV_REGS], LVM_DELETEALLITEMS, 0, 0);

    RegUser * curReg = nullptr,
        * nextReg = RegManager::m_Ptr->m_pRegListS;

    while(nextReg != nullptr) {
        curReg = nextReg;
        nextReg = curReg->m_pNext;

        AddReg(curReg);
    }

    ListViewSelectFirstItem(m_hWndWindowItems[LV_REGS]);

    ::SendMessage(m_hWndWindowItems[LV_REGS], WM_SETREDRAW, (WPARAM)TRUE, 0);
}
Пример #5
0
void GLFragmentDecompilerThread::SetDst(std::string code, bool append_mask)
{
	if(!src0.exec_if_eq && !src0.exec_if_gr && !src0.exec_if_lt) return;

	switch(src1.scale)
	{
	case 0: break;
	case 1: code = "(" + code + " * 2.0)"; break;
	case 2: code = "(" + code + " * 4.0)"; break;
	case 3: code = "(" + code + " * 8.0)"; break;
	case 5: code = "(" + code + " / 2.0)"; break;
	case 6: code = "(" + code + " / 4.0)"; break;
	case 7: code = "(" + code + " / 8.0)"; break;

	default:
		ConLog.Error("Bad scale: %d", fmt::by_value(src1.scale));
		Emu.Pause();
	break;
	}

	if(dst.saturate)
	{
		code = "clamp(" + code + ", 0.0, 1.0)";
	}

	std::string dest;

	if (dst.set_cond)
	{
		dest += m_parr.AddParam(PARAM_NONE, "vec4", "cc" + std::to_string(src0.cond_mod_reg_index)) + "$m = ";
	}

	if (!dst.no_dest)
	{
		dest += AddReg(dst.dest_reg, dst.fp16) + "$m = ";
	}

	AddCode("$ifcond " + dest + code + (append_mask ? "$m;" : ";"));
}
Пример #6
0
int DecVRT(struct fp_img_dev *dev)
{
  return AddReg(dev, 0xE1, -1, "VRT", 0, 0x3F);
}
Пример #7
0
int IncVRB(struct fp_img_dev *dev)
{
  /* TODO unknown min max */
  return AddReg(dev, 0xE2, 1, "VRB", 0, 0x3A);
}
Пример #8
0
template<typename T> std::string GLFragmentDecompilerThread::GetSRC(T src)
{
	std::string ret;

	switch(src.reg_type)
	{
	case 0: //tmp
		ret += AddReg(src.tmp_reg_index, src.fp16);
	break;

	case 1: //input
	{
		static const std::string reg_table[] =
		{
			"gl_Position",
			"diff_color", "spec_color",
			"fogc",
			"tc0", "tc1", "tc2", "tc3", "tc4", "tc5", "tc6", "tc7", "tc8", "tc9",
			"ssa"
		};

		switch(dst.src_attr_reg_num)
		{
		case 0x00: ret += reg_table[0]; break;
		default:
			if(dst.src_attr_reg_num < sizeof(reg_table)/sizeof(reg_table[0]))
			{
				ret += m_parr.AddParam(PARAM_IN, "vec4", reg_table[dst.src_attr_reg_num]);
			}
			else
			{
				ConLog.Error("Bad src reg num: %d", fmt::by_value(dst.src_attr_reg_num));
				ret += m_parr.AddParam(PARAM_IN, "vec4", "unk");
				Emu.Pause();
			}
		break;
		}
	}
	break;

	case 2: //const
		ret += AddConst();
	break;

	default:
		ConLog.Error("Bad src type %d", fmt::by_value(src.reg_type));
		Emu.Pause();
	break;
	}

	static const char f[4] = {'x', 'y', 'z', 'w'};

	std::string swizzle = "";
	swizzle += f[src.swizzle_x];
	swizzle += f[src.swizzle_y];
	swizzle += f[src.swizzle_z];
	swizzle += f[src.swizzle_w];

	if(strncmp(swizzle.c_str(), f, 4) != 0) ret += "." + swizzle;

	if(src.abs) ret = "abs(" + ret + ")";
	if(src.neg) ret = "-" + ret;

	return ret;
}
Пример #9
0
int DecReg04(struct fp_img_dev *dev)
{
  return AddReg(dev, 0x04, -1, "REG_04", 0, 0x35);
}
Пример #10
0
int DecVCO_C(struct fp_img_dev *dev)
{
  return AddReg(dev, 0xE5, -1, "VCO_C", 0, 0x20);
}
Пример #11
0
void GLFragmentDecompilerThread::AddCode(std::string code, bool append_mask)
{
    if(!src0.exec_if_eq && !src0.exec_if_gr && !src0.exec_if_lt) return;

    const std::string mask = GetMask().c_str();
    std::string cond = "";

    if(!src0.exec_if_gr || !src0.exec_if_lt || !src0.exec_if_eq)
    {
        static const char f[4] = {'x', 'y', 'z', 'w'};

        std::string swizzle = "";
        swizzle += f[src0.cond_swizzle_x];
        swizzle += f[src0.cond_swizzle_y];
        swizzle += f[src0.cond_swizzle_z];
        swizzle += f[src0.cond_swizzle_w];

        if(src0.exec_if_gr && src0.exec_if_eq)
        {
            cond = "greaterThanEqual";
        }
        else if(src0.exec_if_lt && src0.exec_if_eq)
        {
            cond = "lessThanEqual";
        }
        else if(src0.exec_if_gr && src0.exec_if_lt)
        {
            cond = "notEqual";
        }
        else if(src0.exec_if_gr)
        {
            cond = "greaterThan";
        }
        else if(src0.exec_if_lt)
        {
            cond = "lessThan";
        }
        else //if(src0.exec_if_eq)
        {
            cond = "equal";
        }

        cond = std::string("if(all(" + cond + "(" + AddCond(dst.no_dest) + "." + swizzle +", vec4(0, 0, 0, 0)))) ");
        //ConLog.Error("cond! [eq: %d  gr: %d  lt: %d] (%s)", src0.exec_if_eq, src0.exec_if_gr, src0.exec_if_lt, cond);
        //Emu.Pause();
        //return;
    }

    if(src1.scale)
    {
        switch(src1.scale)
        {
        case 1:
            code = "(" + code + " * 2)";
            break;
        case 2:
            code = "(" + code + " * 4)";
            break;
        case 3:
            code = "(" + code + " * 8)";
            break;
        case 5:
            code = "(" + code + " / 2)";
            break;
        case 6:
            code = "(" + code + " / 4)";
            break;
        case 7:
            code = "(" + code + " / 8)";
            break;

        default:
            ConLog.Error("Bad scale: %d", src1.scale);
            Emu.Pause();
            break;
        }
    }

    if(dst.saturate)
    {
        code = "clamp(" + code + ", 0.0, 1.0)";
    }

    code = cond + (dst.set_cond ? m_parr.AddParam(PARAM_NONE , "vec4", std::string(dst.fp16 ? "hc" : "rc") + std::to_string(src0.cond_reg_index))
                   : AddReg(dst.dest_reg, dst.fp16)) + mask
           + " = " + code + (append_mask ? mask : "");

    main += "\t" + code + ";\n";
}
Пример #12
0
int DecReg93(struct fp_img_dev *dev)
{
  return AddReg(dev, 0x93, -1, "REG_93", 0, 0x50);
}
Пример #13
0
int DecDTVRT(struct fp_img_dev *dev)
{
  return AddReg(dev, 0xE3, -1, "DTVRT", 0, 0x20);
}
Пример #14
0
int DecReg1A(struct fp_img_dev *dev)
{
  return AddReg(dev, 0x1A, -1, "REG_1A", 0, 0x35);
}
Пример #15
0
int IncReg93(struct fp_img_dev *dev)
{
  /* TODO unknown min max */
  return AddReg(dev, 0x93, 1, "REG_93", 0, 0x50);
}
Пример #16
0
int IncReg1A(struct fp_img_dev *dev)
{
  /* TODO unknown min max */
  return AddReg(dev, 0x1A, 1, "REG_1A", 0, 0x35);
}
Пример #17
0
int DecReg10(struct fp_img_dev *dev)
{
  return AddReg(dev, 0x10, -1, "REG_10", 0, 0x99);
}
Пример #18
0
int IncReg10(struct fp_img_dev *dev)
{
  /* TODO unknown min max */
  return AddReg(dev, 0x10, 1, "REG_10", 0, 0x99);
}
Пример #19
0
int DecVRB(struct fp_img_dev *dev)
{
  return AddReg(dev, 0xE2, -1, "VRB", 0, 0x3A);
}
Пример #20
0
int IncReg94(struct fp_img_dev *dev)
{
  /* TODO unknown min max */
  return AddReg(dev, 0x94, 1, "REG_94", 0, 0x35);
}
Пример #21
0
int IncDTVRT(struct fp_img_dev *dev)
{
  /* TODO unknown min max */
  return AddReg(dev, 0xE3, 1, "DTVRT", 0, 0x20);
}
Пример #22
0
int DecReg94(struct fp_img_dev *dev)
{
  return AddReg(dev, 0x94, -1, "REG_94", 0, 0x35);
}
Пример #23
0
int IncVCO_C(struct fp_img_dev *dev)
{
  /* TODO unknown min max */
  return AddReg(dev, 0xE5, 1, "VCO_C", 0, 0x20);
}
Пример #24
0
template<typename T> std::string FragmentProgramDecompiler::GetSRC(T src)
{
	std::string ret;

	switch (src.reg_type)
	{
	case 0: //tmp
		ret += AddReg(src.tmp_reg_index, src.fp16);
		break;

	case 1: //input
	{
		static const std::string reg_table[] =
		{
			"gl_Position",
			"diff_color", "spec_color",
			"fogc",
			"tc0", "tc1", "tc2", "tc3", "tc4", "tc5", "tc6", "tc7", "tc8", "tc9",
			"ssa"
		};

		switch (dst.src_attr_reg_num)
		{
		case 0x00: ret += reg_table[0]; break;
		default:
			if (dst.src_attr_reg_num < sizeof(reg_table) / sizeof(reg_table[0]))
			{
				ret += m_parr.AddParam(PF_PARAM_IN, getFloatTypeName(4), reg_table[dst.src_attr_reg_num]);
			}
			else
			{
				LOG_ERROR(RSX, "Bad src reg num: %d", u32{ dst.src_attr_reg_num });
				ret += m_parr.AddParam(PF_PARAM_IN, getFloatTypeName(4), "unk");
				Emu.Pause();
			}
			break;
		}
	}
	break;

	case 2: //const
		ret += AddConst();
		break;

	case 3: // ??? Used by a few games, what is it?
		LOG_ERROR(RSX, "Src type 3 used, please report this to a developer.");
		break;

	default:
		LOG_ERROR(RSX, "Bad src type %d", u32{ src.reg_type });
		Emu.Pause();
		break;
	}

	static const char f[4] = { 'x', 'y', 'z', 'w' };

	std::string swizzle = "";
	swizzle += f[src.swizzle_x];
	swizzle += f[src.swizzle_y];
	swizzle += f[src.swizzle_z];
	swizzle += f[src.swizzle_w];

	if (strncmp(swizzle.c_str(), f, 4) != 0) ret += "." + swizzle;

	if (src.abs) ret = "abs(" + ret + ")";
	if (src.neg) ret = "-" + ret;

	return ret;
}
Пример #25
0
int DecDCOffset(struct fp_img_dev *dev)
{
  return AddReg(dev, 0xE6, -1, "DCOFFSET", 0, 0x35);
}
Пример #26
0
int DecGain(struct fp_img_dev *dev)
{
  return AddReg(dev, 0xE0, -1, "GAIN", 0, 0x35);
}
Пример #27
0
void GLFragmentDecompilerThread::AddCode(std::string code, bool append_mask)
{
	if(!src0.exec_if_eq && !src0.exec_if_gr && !src0.exec_if_lt) return;

	const std::string mask = GetMask();
	std::string cond;

	if(!src0.exec_if_gr || !src0.exec_if_lt || !src0.exec_if_eq)
	{
		static const char f[4] = {'x', 'y', 'z', 'w'};

		std::string swizzle;
		swizzle += f[src0.cond_swizzle_x];
		swizzle += f[src0.cond_swizzle_y];
		swizzle += f[src0.cond_swizzle_z];
		swizzle += f[src0.cond_swizzle_w];
		swizzle = swizzle == "xyzw" ? "" : "." + swizzle;

		if(src0.exec_if_gr && src0.exec_if_eq)
		{
			cond = "greaterThanEqual";
		}
		else if(src0.exec_if_lt && src0.exec_if_eq)
		{
			cond = "lessThanEqual";
		}
		else if(src0.exec_if_gr && src0.exec_if_lt)
		{
			cond = "notEqual";
		}
		else if(src0.exec_if_gr)
		{
			cond = "greaterThan";
		}
		else if(src0.exec_if_lt)
		{
			cond = "lessThan";
		}
		else //if(src0.exec_if_eq)
		{
			cond = "equal";
		}

		cond = "if(all(" + cond + "(" + AddCond(dst.no_dest) + swizzle + ", vec4(0.0)))) ";
	}

	if(src1.scale)
	{
		switch(src1.scale)
		{
		case 1: code = "(" + code + " * 2)"; break;
		case 2: code = "(" + code + " * 4)"; break;
		case 3: code = "(" + code + " * 8)"; break;
		case 5: code = "(" + code + " / 2)"; break;
		case 6: code = "(" + code + " / 4)"; break;
		case 7: code = "(" + code + " / 8)"; break;

		default:
			ConLog.Error("Bad scale: %d", fmt::by_value(src1.scale));
			Emu.Pause();
		break;
		}
	}

	if(dst.saturate)
	{
		code = "clamp(" + code + ", 0.0, 1.0)";
	}

	std::string dest;

	if(dst.no_dest)
	{
		if(dst.set_cond)
		{
			dest = m_parr.AddParam(PARAM_NONE , "vec4", std::string(dst.fp16 ? "hc" : "rc") + std::to_string(src0.cond_reg_index));
		}
	}
	else
	{
		dest = AddReg(dst.dest_reg, dst.fp16);
	}

	code = cond + (dest.length() ? dest + mask + " = " : "") + code + (append_mask ? mask : "");

	main += "\t" + code + ";\n";
}
Пример #28
0
int IncVRT(struct fp_img_dev *dev)
{
  /* TODO unknown min max */
  return AddReg(dev, 0xE1, 1, "VRT", 0, 0x3F);
}
Пример #29
0
int IncGain(struct fp_img_dev *dev)
{
  /* TODO unknown min max */
  return AddReg(dev, 0xE0, 1, "GAIN", 0, 0x35);
}
Пример #30
0
int DecReg03(struct fp_img_dev *dev)
{
  return AddReg(dev, 0x03, -1, "REG_03", 0, 0x35);
}