Пример #1
0
void CWinMain::SetQuickMenu(HMENU hMenu)
{
	COption clOption;
	SOption& stOption = clOption.GetOpt();

	struct SQuickSet 
	{
		LPBOOL pbOption;
		int nID;
	} stQuickSet[] = {
		{&stOption.bHighSearchOgg,  IDM_QUICKSET_STD_SEARCHOGG},
		{&stOption.bCreateFolder,   IDM_QUICKSET_EXTRACT_CREATEFOLDER},
		{&stOption.bFixOgg,         IDM_QUICKSET_EXTRACT_FIXOGG},
		{&stOption.bEasyDecrypt,    IDM_QUICKSET_EXTRACT_EASYDECRYPT},
		{&stOption.bDstPNG,         IDM_QUICKSET_EXTRACT_DSTPNG},
		{&stOption.bAlphaBlend,     IDM_QUICKSET_EXTRACT_ALPHABLEND},
		{&stOption.bSusieUse,       IDM_QUICKSET_SUSIE_USE},
		{&stOption.bSusieFirst,     IDM_QUICKSET_SUSIE_FIRST}
	};

	for (int i = 0; i < ARRAYSIZE(stQuickSet); i++)
	{
		UINT uCheck = MF_BYCOMMAND | (*stQuickSet[i].pbOption == TRUE) ? MF_CHECKED : MF_UNCHECKED;
		CheckMenuItem(hMenu, stQuickSet[i].nID, uCheck);
	}
}
Пример #2
0
void CProfileOptions::SaveToProfile(IPlayerProfile* pProfile, bool online, unsigned int reason)
{
	if(reason & ePR_Options)
	{
	  if(online && gEnv->bMultiplayer)
	  if (pProfile == NULL)
		  return;
  
	  //Want to save all the options (mostly for online attributes)
	  std::vector<COption*>::iterator it = m_allOptions.begin();
	  std::vector<COption*>::iterator end = m_allOptions.end();
	  for(; it!=end; ++it)
	  {
			COption					*pOption = *it;

			IPlayerProfile	*pPrevPlayerProfile = pOption->GetPlayerProfile();

			pOption->SetPlayerProfile(pProfile);
		  
			pOption->SetToProfile();

			pOption->SetPlayerProfile(pPrevPlayerProfile);
	  }
	}
}
Пример #3
0
void CCLLKDlg::OnConfig(void)
{
	COption dlg;
	dlg.m_uColNum=m_nCol-2;
	dlg.m_uRowNum=m_nRow-2;
	dlg.m_uKindNum=m_Kind;
	dlg.m_iBlockWidth=FRONTWIDTH;
	dlg.m_iBlockHeight=FRONTHEIGHT;
	dlg.m_bFullScreen=m_bIsFullScreen;
	dlg.m_b3DBar=m_b3DBar;
	if(dlg.DoModal()==IDOK)
	{
		m_nCol=dlg.m_uColNum+2;
		m_nRow=dlg.m_uRowNum+2;
		m_Kind=dlg.m_uKindNum;
		FRONTWIDTH=dlg.m_iBlockWidth;
		FRONTHEIGHT=dlg.m_iBlockHeight;
		m_bIsFullScreen=dlg.m_bFullScreen;
		m_b3DBar=dlg.m_b3DBar;
		m_iSeekX=dlg.SeekX;
		m_iSeekY=dlg.SeekY;
		SizeWindow();
		if(dlg.m_bNeedReStart)
			StartNewGame();
	}
}
Пример #4
0
COption* CProfileOptions::GetOptionByCVar(const char* cvar) const
{
	if(!cvar || !cvar[0])
		return NULL;

	bool returnValue = false;
	std::vector<COption*>::const_iterator it = m_allOptions.begin();
	std::vector<COption*>::const_iterator end = m_allOptions.end();
	for(; it!=end; ++it)
	{
		COption* pOption = (*it);
		if(pOption->GetType() == ePOT_CVar || pOption->GetType() == ePOT_SysSpec)
		{
			CCVarOption* pCVarOption = static_cast<CCVarOption*>(pOption);

			if (pCVarOption->GetCVar().compareNoCase(cvar)==0)
			{
				return pOption;
			}
		}
		else if(pOption->GetType() == ePOT_ScreenResolution)
		{
			if(!stricmp("r_width", cvar) || !stricmp("r_height", cvar))
			{
				return pOption;
			}
		}
	}
	return NULL;
}
Пример #5
0
/**
 * @brief Add new option to list.
 * @param [in] name Option's name.
 * @param [in] defaultValue Option's initial and default value.
 */
int COptionsMgr::AddOption(const String& name, const varprop::VariantValue& defaultValue)
{
	int retVal = COption::OPT_OK;
	COption tmpOption;

	retVal = tmpOption.Init(name, defaultValue);
	if (retVal == COption::OPT_OK)
		m_optionsMap[name] = tmpOption;

	return retVal;
}
Пример #6
0
void CProfileOptions::ResetToDefault()
{
	ClearPendingOptionValues(); // Just to be safe

	std::vector<COption*>::iterator it = m_allOptions.begin();
	std::vector<COption*>::const_iterator end = m_allOptions.end();

	for(; it!=end; ++it)
	{
		COption* pOption = (*it);
		if (!pOption->IsWriteToConfig())
		{
			pOption->ResetDefault();
		}
	}
}
Пример #7
0
/**
 * @brief Reset option value to default.
 * @param [in] name Name of the option to reset.
 */
int COptionsMgr::Reset(LPCTSTR name)
{
	int retVal = OPT_OK;

	OptionsMap::const_iterator found = m_optionsMap.find(name);
	if (found != m_optionsMap.end())
	{
		COption tmpOption = found->second;
		tmpOption.Reset();
		m_optionsMap[name] = tmpOption;
	}
	else
	{
		retVal = OPT_NOTFOUND;
	}
	return retVal;
}
Пример #8
0
int main(int ArgI, char* ArgC[])
{
  COption op;
  
  CRec geneticmap;

  
  for (int i = 0; i != ArgI-1; ++i)
    {
      if (strcmp(ArgC[i], "-interval") == 0 && i + 2 < ArgI) 
	{
	  op.minpos = atoi(ArgC[i+1]);
	  op.maxpos = atoi(ArgC[i+2]);
	}

      if (strcmp(ArgC[i], "-include-variant") == 0) 	  op.fn0 = ArgC[i+1];
      if (strcmp(ArgC[i], "-exclude-vatiant") == 0)	  op.fn1 = ArgC[i+1];
      if (strcmp(ArgC[i], "-genetic-map") == 0) geneticmap.Init(ArgC[i+1]);
      if (strcmp(ArgC[i], "-buffer") == 0) op.intv = atoi(ArgC[i+1]);
      if (strcmp(ArgC[i], "-include-sample") == 0) op.GetIncludedSamples(ArgC[i+1]);
      if (strcmp(ArgC[i], "-exclude-sample") == 0) op.GetExcludedSamples(ArgC[i+1]);
      if (strcmp(ArgC[i], "-output") == 0) op.fnoutput = ArgC[i+1];   
      
    }
	
  op.GetData();

  CData dhap (&op);
  CData dlk (&op);

  for (int i = 0; i != ArgI-1; ++i)
    {
      if (strcmp(ArgC[i], "-hap") == 0) dhap.GetHaplotype(ArgC[i+1]);
      if (strcmp(ArgC[i], "-lk") == 0) dlk.GetLK(ArgC[i+1]);
    }
  
  dhap.MatchData(dlk.GetSamples()); 
  dhap.CM_Location(geneticmap);
  dlk.CM_Location(geneticmap);

  dhap.Estimate_Panel_ID(200); 
  CMCMC mcmc(&dhap, &op, &geneticmap, &dlk);
  
  dlk.Output(op.GetfnOutput());
  return 0;
}
Пример #9
0
COption* CProfileOptions::GetOption(const char* option) const
{
	if(!option || !option[0])
		return NULL;

	bool returnValue = false;
	std::vector<COption*>::const_iterator it = m_allOptions.begin();
	std::vector<COption*>::const_iterator end = m_allOptions.end();
	for(; it!=end; ++it)
	{
		COption* pOption = (*it);
		if (pOption->GetName().compare(option)==0)
		{
			return pOption;
		}
	}
	return NULL;
}
Пример #10
0
/**
 * @brief Add new option to list.
 * @param [in] name Option's name.
 * @param [in] defaultValue Option's initial and default value.
 */
int COptionsMgr::AddOption(LPCTSTR name, varprop::VariantValue defaultValue)
{
	int retVal = OPT_OK;
	COption tmpOption;

#ifdef _DEBUG
	OptionsMap::const_iterator found = m_optionsMap.find(name);
	if (found != m_optionsMap.end())
		_RPTF1(_CRT_WARN, "Re-adding option: %s !", name);
#endif

	retVal = tmpOption.Init(name, defaultValue);
	if (retVal == OPT_OK)
		m_optionsMap[name] = tmpOption;
	else
		_RPTF1(_CRT_ERROR, "Could not add option: %s!", name);

	return retVal;
}
Пример #11
0
/**
 * @brief Set new value for option.
 * @param [in] name Option's name.
 * @param [in] value Option's new value.
 */
int COptionsMgr::Set(const String& name, const varprop::VariantValue& value)
{
	int retVal = COption::OPT_OK;

	OptionsMap::const_iterator found = m_optionsMap.find(name);
	if (found != m_optionsMap.end())
	{
		// Allow automatic conversion so we don't bother callsites about this!
		COption tmpOption = found->second;
		retVal = tmpOption.Set(value, true);
		if (retVal == COption::OPT_OK)
			m_optionsMap[name] = tmpOption;
	}
	else
	{
		retVal = COption::OPT_NOTFOUND;
	}
	return retVal;
}
Пример #12
0
void CProfileOptions::AddOrReplacePendingOption(const char* command, const char* param)
{
	std::vector<SPendingOption>::iterator it = m_pendingOptions.begin();
	std::vector<SPendingOption>::const_iterator end = m_pendingOptions.end();

	for(; it!=end; ++it)
	{
		SPendingOption& option = (*it);
		
		if(option.command.compare(command))
			continue;

		if(option.preview)
		{
			SetOptionValue(command, param);
		}

		if(option.original.compare(param))
		{
			option.param = param;
		}
		else
		{
			m_pendingOptions.erase(it);
		}
		return;
	}

	COption* pOption = GetOption(command);
	if(pOption != NULL)
	{
		if(pOption->IsPreview())
		{
			m_pendingOptions.push_back(SPendingOption(command, param, GetOptionValue(command), true, pOption->IsConfirmation(), pOption->IsRequiresRestart(), pOption->IsWriteToConfig()));
			SetOptionValue(command, param);
		}
		else
		{
			m_pendingOptions.push_back(SPendingOption(command, param, GetOptionValue(command), false, pOption->IsConfirmation(), pOption->IsRequiresRestart(), pOption->IsWriteToConfig()));
		}
	}
}
Пример #13
0
/**
 * @brief Set new value for option.
 * @param [in] name Option's name.
 * @param [in] value Option's new value.
 */
int COptionsMgr::Set(LPCTSTR name, varprop::VariantValue value)
{
	int retVal = OPT_OK;

	OptionsMap::const_iterator found = m_optionsMap.find(name);
	if (found != m_optionsMap.end())
	{
		// Allow automatic conversion so we don't bother callsites about this!
		COption tmpOption = found->second;
		retVal = tmpOption.Set(value, true);
		if (retVal == OPT_OK)
			m_optionsMap[name] = tmpOption;
	}
	else
	{
		_RPTF1(_CRT_ERROR, "Could not set option: %s", name);
		retVal = OPT_NOTFOUND;
	}
	return retVal;
}
Пример #14
0
void CProfileOptions::CCVarSink::OnElementFound(ICVar *pCVar)
{
	if (pCVar == 0)
		return;

	const char* name = pCVar->GetName();
	const char* val = pCVar->GetString();

	COption* pOption = m_pOptions->GetOptionByCVar(name);
	if(!pOption)
		return;

	if(!pOption->IsWriteToConfig())
		return;

	const char* optionName = pOption->GetName().c_str();
	const char* writeValue = pOption->Get().c_str();

	const std::vector<SPendingOption>& pendingOptions = m_pOptions->GetPendingOptions();

	std::vector<SPendingOption>::const_iterator it = pendingOptions.begin();
	std::vector<SPendingOption>::const_iterator end = pendingOptions.end();

	for(; it!=end; ++it)
	{
		const SPendingOption& option = (*it);

		if(!option.writeToConfig)
			continue;

		if(option.command.compareNoCase(optionName))
			continue;

		writeValue = option.param.c_str();
		break;
	}

	CryFixedStringT<128> format;
	pOption->GetWriteToConfigString(format, pCVar, writeValue);
	fputs(format.c_str(), m_pFile);
}
Пример #15
0
void CWinMain::SetQuickMenuItem(int nID)
{
	COption clOption;
	SOption& stOption = clOption.GetOpt();

	struct SQuickSet
	{
		LPBOOL pbOption;
		int nID;
	} stQuickSet[] = {
		{&stOption.bHighSearchOgg,  IDM_QUICKSET_STD_SEARCHOGG},
		{&stOption.bCreateFolder,   IDM_QUICKSET_EXTRACT_CREATEFOLDER},
		{&stOption.bFixOgg,         IDM_QUICKSET_EXTRACT_FIXOGG},
		{&stOption.bEasyDecrypt,    IDM_QUICKSET_EXTRACT_EASYDECRYPT},
		{&stOption.bDstPNG,         IDM_QUICKSET_EXTRACT_DSTPNG},
		{&stOption.bAlphaBlend,     IDM_QUICKSET_EXTRACT_ALPHABLEND},
		{&stOption.bSusieUse,       IDM_QUICKSET_SUSIE_USE},
		{&stOption.bSusieFirst,     IDM_QUICKSET_SUSIE_FIRST}
	};

	for (int i = 0; i < ARRAYSIZE(stQuickSet); i++)
	{
		if (stQuickSet[i].nID == nID)
			*stQuickSet[i].pbOption ^= 1;
	}

	if (nID == IDM_QUICKSET_EXTRACT_DSTPNG)
	{
		// Extract images as PNG or BMP depending on setting
		stOption.bDstBMP ^= 1;
	}
	else if (nID == IDM_QUICKSET_SUSIE_USE && stOption.bSusieUse == TRUE)
	{
		// Load Susie Plug-ins
		CSusie clSusie;
		clSusie.LoadSpi(stOption.SusieDir);
	}

	clOption.SaveIni();
}
Пример #16
0
int main(int argc, char* argv[])
{
    COption option;

    // オプション解析
    if (!option.Analysis(argc, argv)) {
        _DispUsage();
        return INVALID_RET_VAL;
    }

    // オプションチェック
    if (!option.IsValid()) {
        _DispUsage();
        return INVALID_RET_VAL;
    }

    IImporter::SetEnableTexIdx(option.idxEnableTex);
    IImporter::SetShaderName(option.nameShader.c_str());

    // インポーター作成
    IImporter* importer = IImporter::CreateImporter(option.modelType);

#ifdef ENABLE_FBX_IMPORT
    if (importer == IZ_NULL && option.modelType == ModelType::ModelTypeFBX) {
        importer = new CFbxImporter();
    }
#endif

    // 入力ファイルを開く
    VRETURN_VAL(
        importer->Open(option.in.c_str()),
        INVALID_RET_VAL);

    static IZ_CHAR tmp[MAX_PATH];

    // マテリアル数を取得
    IZ_UINT mtrlNum = importer->GetMaterialNum();

    if (mtrlNum == 0) {
        // 何もしない

        // マテリアルが存在しないことを出力
        printf("There is not material in %s\n", option.in.c_str());
    }
    else if (mtrlNum == 1) {    
        VRETURN_VAL(
            CMtrlExporter::GetInstance().Export(
                option.out.c_str(),
                importer,
                0),
            INVALID_RET_VAL);
    }
    else {
        // 出力ファイル名から拡張子を取り除く
        VRETURN_VAL(
            option.RemoveExtFromExportFileName(),
            INVALID_RET_VAL);

        for (IZ_UINT i = 0; i < mtrlNum; i++) {
            // 出力ファイル名を作成
            sprintf_s(tmp, sizeof(tmp), "%s_%d.mtrl\0", option.out.c_str(), i);
        
            VRETURN_VAL(
                CMtrlExporter::GetInstance().Export(
                    tmp,
                    importer,
                    i),
                INVALID_RET_VAL);
        }
    }

    return 0;
}
Пример #17
0
//---------------------------------------------------------
//
//
void CGameMenu::menuCallback(CCObject * pSender)
{
	int tag = ((CCNode*)( pSender ))->getTag();

	switch( tag )
	{
	case CGAMEMENU_BUTTON_ONLINE:
		{
            
#if (CC_TARGET_PLATFORM == CC_PLATFORM_IOS)
            if( 0 == CDevice::CheckNet() )
            {
                CCMessageBox("网络貌似有问题!", "提示");
                return;
            }
#endif
            
			CSaveSence::Show();
            g_iGameMode = 1;
		}
		break;
	case CGAMEMENU_BUTTON_OFFLINE:
		{
			CSaveSence::Show();
            g_iGameMode = 0;
		}
		break;
	case CGAMEMENU_BUTTON_OPTION:
		{
			COption *poption = new COption();
			poption->autorelease();
			addChild( poption );

			EnableButton( false );
		}
		break;
	case CGAMEMENU_BUTTON_ABOUT:
		{
			CAbout *pabout = new CAbout();
			pabout->autorelease();
			addChild( pabout );

			EnableButton( false );

		}
		break;
    case CGAMEMENU_BUTTON_91:
        {
            CNd91Mng::enter91Platform();
        }
        break;
    case 5:
        {
            CNd91Mng::OpenUrl( "https://itunes.apple.com/cn/app/zhao-huan-chuan-shuo-zhi-jing/id594107545");
        }
        break;
	}

	if( CCUserDefault::sharedUserDefault()->getBoolForKey( "sound" ) )
	{
		CocosDenshion::SimpleAudioEngine::sharedEngine()->playEffect("data/audio/buttton.mp3", false);
	}
	//CMiniGameScene::Show();
}
Пример #18
0
void COption::Update(float deltaTime)
{
	// GUI EDITOR
	if(CVgui_editor.GetBool() && !(GetElementFlags() & EF_NOT_EDITABLE))
	{
		if (!m_szName) return; // neoznacene prvky nelze upravovat

		// popisek
		char str[64];
		bool popisek=false;

		if (g_bLMouseDownFirstTime)
		{
			if ((g_nMouseX>m_nPosX+m_nParentX+m_nWidth-3 && g_nMouseX <= m_nPosX+m_nParentX+m_nWidth)
				&& (g_nMouseY>m_nPosY+m_nParentY+m_nHeight-3 && g_nMouseY <= m_nPosY+m_nParentY+m_nHeight))
			{
				edit_mode = 2; // resize
			}
			else if (g_nMouseX >= m_nPosX+m_nParentX && g_nMouseX <= m_nPosX+m_nParentX+m_nWidth
				&& g_nMouseY >= m_nPosY+m_nParentY && g_nMouseY <= m_nPosY+m_nParentY+m_nHeight)
			{
				edit_mode = 1; // move
				edit_nRelPosX = g_nMouseX - m_nPosX;
				edit_nRelPosY = g_nMouseY - m_nPosY;
			}
		}
		else if (g_bLMouseUpFirstTime)
		{
			edit_mode = 0; // konec
		}

		// pokud je co delat, tak to udelej
		if (edit_mode==1) // move
		{
			m_nPosX = g_nMouseX - edit_nRelPosX;
			m_nPosY = g_nMouseY - edit_nRelPosY;
			sprintf(str, "X%d Y%d", m_nPosX, m_nPosY);
			g_Scheme._pLabelFont->DrawText(str, g_nMouseX+10, g_nMouseY+10, P3DCOLOR_XRGB(255, 255, 255));
			popisek = true;
		}
		else if (edit_mode==2) // resize
		{
			m_nWidth = g_nMouseX - m_nPosX - m_nParentX;
			m_nHeight = g_nMouseY - m_nPosY - m_nParentY;
			sprintf(str, "W%d H%d", m_nWidth, m_nHeight);
			g_Scheme._pLabelFont->DrawText(str, g_nMouseX+10, g_nMouseY+10, P3DCOLOR_XRGB(255, 255, 255));
			popisek = true;
		}

		// pokud neni zaden popisek a mys je nad timto prvkem, udelej popisek
		if (g_nMouseX >= m_nPosX+m_nParentX && g_nMouseX <= m_nPosX+m_nParentX+m_nWidth
			&& g_nMouseY >= m_nPosY+m_nParentY && g_nMouseY <= m_nPosY+m_nParentY+m_nHeight)
		{
			// popisek
			char str[64];
			if (!popisek)
			{
				// vykresli okraje
				g_p2D->Line_DrawRect(m_nPosX+m_nParentX, m_nPosY+m_nParentY, m_nWidth, m_nHeight, P3DCOLOR_ARGB(100, 0, 255, 0));

				sprintf(str, "%s", m_szName);
				g_Scheme._pLabelFont->DrawText(str, g_nMouseX+10, g_nMouseY+10, P3DCOLOR_ARGB(100, 255, 255, 255));
			}
		}
		return; // editor mode
	}
	//-GUI EDITOR
	
	m_bDrawGrayed=false;
	m_bOnSelect = false;
	m_bOnUnselect = false;

	if(g_nMouseX >= m_nPosX+m_nParentX && g_nMouseX <= m_nPosX+m_nParentX+m_nWidth
		&& g_nMouseY >= m_nPosY+m_nParentY && g_nMouseY <= m_nPosY+m_nParentY+m_nHeight)
	{
		if (g_bLMouseDownFirstTime) m_bDownFirstTime=true;
		if(g_bLMouseDown && m_bDownFirstTime) m_bDrawGrayed=true; // vykresli zesedle
		if(g_bLMouseUpFirstTime)
		{
			if (m_bDownFirstTime) {
				// vsechny nastav jako false
				for(unsigned int i=0;i<m_pParent->m_nChilds;i++)
				{
					if(m_pParent->m_pChilds[i]->m_nElementID == 1) // je to Option
					{
						// pokud to neni tento Option a neni skryt
						if(!m_pParent->m_pChilds[i]->m_bHidden)
						{
							COption* pOpt = (COption*)m_pParent->m_pChilds[i];
							pOpt->SetValue(false); // nastav jako false
						}
					}
				}
				m_bValue = true; // vyber tento jako aktivni
			}
			m_bDownFirstTime = false;
		}
	}

	// zjisti zda byl aktivovan nebo deaktivovan
	if (m_bLastValue == false && m_bValue == true)
		m_bOnSelect = true;
	else if (m_bLastValue == true && m_bValue == false)
		m_bOnUnselect = true;

	m_bLastValue = m_bValue;
}
Пример #19
0
/**
* オプションファイル解析
*/
BOOL COption::AnalysisOptionFile(std::vector<izanagi::tool::CString>& tvArgs)
{
    BOOL ret = TRUE;

    FILE* fp = NULL;

    // テンポラリファイル名を作成する
    izanagi::tool::CString strTmp;
    _CreateTmpFileName(strTmp);

    // プリプロセスする
    {
        // プリプロセス用
        COption cOpt;
        cOpt.Copy(*this);
        {
            // プリプロセス用にいろいろ変更・・・
            cOpt.shader = cOpt.optionFile;      // 入力
            cOpt.preprocFile = strTmp;          // 出力
        }

        // exe名
        izanagi::tool::CFileUtility::GetExeModuleName(s_BUF, sizeof(s_BUF));

        // 自分自身をプリプロセス処理モードで呼び出す
        ret = ExecWithPreprocMode(s_BUF, cOpt);

        if (!ret) {
            // 失敗・・・
            IZ_ASSERT(FALSE);

            // TODO

            goto __EXIT__;
        }
    }

    // オプションを引数リストに戻す
    ConvetOptionToArgs(tvArgs);

    // ファイル開く
    fopen_s(&fp, strTmp, "rt");
    if (fp == NULL) {
        IZ_ASSERT(FALSE);

        // TODO

        return FALSE;
    }

    memset(s_BUF, 0, sizeof(s_BUF));

    // リストファイルを解析
    while (fgets(s_BUF, sizeof(s_BUF), fp) != NULL) {
        izanagi::tool::CString str;
        str.format("%s", s_BUF);

        if (strlen(str) > 0) {
            if (_IsOptionString(str)) {
                // オプションを表している文字列
                std::vector<izanagi::tool::CString> tvTmp;

                _BreakString(str, tvTmp);

                // リストに登録
                tvArgs.insert(tvArgs.end(), tvTmp.begin(), tvTmp.end());
            }
        }

        // 次に向けてクリア
        memset(s_BUF, 0, sizeof(s_BUF));
    }

__EXIT__:
    // ファイル閉じる
    if (fp != NULL) {
        fclose(fp);
    }

    // テンポラリファイルを削除
    DeleteFile(strTmp);

    if (!optionFile.empty()) {
        optionFile.replace('/', '\\');
        ret = izanagi::tool::CFileUtility::GetPathWithoutFileName(s_BUF, sizeof(s_BUF), optionFile);
        VRETURN(ret);

        baseDir.append(s_BUF);
    }

    // クリアする
    Clear();

    return ret;
}
Пример #20
0
void QTServer::SlotOptionSet() {
    COption* a = new COption(this, m_gamePath);
    QObject::connect(a, &COption::SignalNewGamePath, this, &QTServer::SlotInitGamePath);
    a->setAttribute(Qt::WA_DeleteOnClose);
    a->show();
}
Пример #21
0
int main(int argc, char* argv[])
{
    int nRetCode = 0;

    CFontConverterBase* fontConverter = IZ_NULL;

    COption cOption;
    izanagi::tool::CGraphicsDeviceLite* pDevice = IZ_NULL;
    izanagi::CFileOutputStream cOut;

    // オプション解析
    if (!cOption.Analysis(argc, argv))
    {
        _DispUsage();
        _VGOTO(IZ_FALSE, __EXIT__);
    }

    // オプション正当性チェック
    if (!cOption.IsValid())
    {
        _DispUsage();
        _VGOTO(IZ_FALSE, __EXIT__);
    }
    
    // リストファイルを解析
    _VGOTO(cOption.AnalysisListFile(), __EXIT__);

    // ウインドウハンドル取得
    HWND hWnd = ::GetConsoleWindow();
    if (hWnd == NULL)
    {
        hWnd = FindWindow(0, 0);
    }
    _VGOTO(hWnd != NULL, __EXIT__);

    // GraphicsDevice作成
    pDevice = izanagi::tool::CGraphicsDeviceLite::CreateGraphicsDeviceLight(hWnd);
    _VGOTO(pDevice != IZ_NULL, __EXIT__);

    {
        std::vector<izanagi::tool::CString>::iterator it = cOption.in_file_list.begin();
        while (it != cOption.in_file_list.end()) {
            izanagi::CFileInputStream cIn;
            _VGOTO(cIn.Open(*it), __EXIT__);

            // 文字列登録
            CCharList::GetInstance().Register(
                cOption.charEncode,
                &cIn);

            cIn.Close();
            it++;
        }
    }

    // デバイスコンテキスト取得
    HDC hDC = ::GetDC(hWnd);
    _VGOTO(hDC != NULL, __EXIT__);

    //fontConverter = new CFontConverterGDI();
    fontConverter = new CFontConverterFT();

    // 準備
    _VGOTO(
        fontConverter->Init(hDC, cOption),
        __EXIT__);

    // フォントイメージデータ作成
    _VGOTO(
        fontConverter->CreateFontImage(cOption, CCharList::GetInstance().GetCharList()),
        __EXIT__);

    // 出力
#if 0
    _VGOTO(
        CFontConverter::GetInstance().ExportAsDDS(),
        __EXIT__);
#else
    _VGOTO(
        cOut.Open(cOption.out_file),
        __EXIT__);

    _VGOTO(
        fontConverter->Export(&cOut, cOption, CCharList::GetInstance().GetCharList()),
        __EXIT__);

    cOut.Finalize();
#endif

__EXIT__:
    // 開放
    fontConverter->Release();
    SAFE_DELETE(fontConverter);
    SAFE_RELEASE(pDevice);

    return nRetCode;
}
Пример #22
0
int main(int argc, char* argv[])
{
    int nRetCode = 0;

    COption option;

    izanagi::tool::CGraphicsDeviceLite* device = IZ_NULL;

    std::vector<izanagi::tool::CTextureLite*> texInEnv;
    std::vector<izanagi::tool::CTextureLite*> texOutEnv;

    std::vector<izanagi::tool::CString> inTexList;
    std::vector<izanagi::tool::CString> outTexList;

    // ウインドウハンドル取得
    HWND hWnd = ::GetConsoleWindow();
    VGOTO(hWnd != NULL);

    // グラフィックスデバイス作成
    device = izanagi::tool::CGraphicsDeviceLite::CreateGraphicsDeviceLight(hWnd);
    VGOTO(device != NULL);

    // オプション解析
    IZ_BOOL result = option.Analysis(argc, argv);
    VGOTO(result);
    VGOTO(option.IsValid());

    _GetTexNameList(
        option.in,
        option.typeInEnvMap,
        inTexList);

    // 環境マップ読み込み
    for (size_t i = 0; i < inTexList.size(); i++) {
        // NOTE
        // クロスの場合は2のべき乗にはならない
        izanagi::tool::CTextureLite* tex = device->CreateTextureFromFile(
            inTexList[i],
            option.typeInEnvMap == EnvMapTypeCross ? IZ_TRUE : IZ_FALSE);
        VGOTO(tex != NULL);

        texInEnv.push_back(tex);
    }

    // 出力先のサイズを計算
    IZ_UINT outWidth, outHeight;
    IZ_BOOL isValid = _ComputeSize(
        option.typeInEnvMap,
        option.typeOutEnvMap,
        texInEnv[0]->GetWidth(),
        texInEnv[0]->GetHeight(),
        outWidth,
        outHeight);
    VGOTO(isValid);

    _GetTexNameList(
        option.out,
        option.typeOutEnvMap,
        outTexList);

    // 出力先作成
    // 強制的にRGBA32Fにする
    for (size_t i = 0; i < outTexList.size(); i++) {
        izanagi::tool::CTextureLite* tex = device->CreateTexture(
                                                    outWidth,
                                                    outHeight,
                                                    izanagi::graph::E_GRAPH_PIXEL_FMT_RGBA32F);
        VGOTO(tex != NULL);

        texOutEnv.push_back(tex);
    }

    // 変換
    Convert(
        texInEnv, option.typeInEnvMap,
        texOutEnv, option.typeOutEnvMap);

    // 出力先保存
    for (size_t i = 0; i < outTexList.size(); i++) {
        result = device->SaveTexture(
                    outTexList[i],
                    texOutEnv[i],
                    option.typeExport);
        VGOTO(result);
    }

__EXIT__:
    _ReleaseTexture(texInEnv);
    _ReleaseTexture(texOutEnv);
    SAFE_RELEASE(device);

    return nRetCode;
}
Пример #23
0
// Window Procedure
LRESULT CWinMain::WndProc(HWND window, UINT msg, WPARAM wp, LPARAM lp)
{
	static CMainToolBar main_tool_bar;
	static CSearchToolBar search_tool_bar;
	static CMainListView list_view;
	static CStatusBar status_bar;
	static CExtractData extract;
	static COption option;
	static CVersionInfo version;
	static CLastDir last_dir;
	static TCHAR readme_file_name[MAX_PATH];
	static TCHAR history_file_name[MAX_PATH];
	static TCHAR state_file_name[MAX_PATH];
	INITCOMMONCONTROLSEX ic;

	switch (msg)
	{
	case WM_CREATE:
		{
			// Allow D&D (Drag & Drop)
			DragAcceptFiles(window, TRUE);

			option.Init(search_tool_bar, list_view);

			// Initialization of the common installation configuration
			ic.dwSize = sizeof(INITCOMMONCONTROLSEX);
			ic.dwICC = ICC_WIN95_CLASSES;
			InitCommonControlsEx(&ic);

			// Create main toolbar
			main_tool_bar.Create(window);
			search_tool_bar.Create(window);

			// Create list view
			list_view.Create(window, option.GetOpt());

			// Create status bar
			status_bar.Create(window, option.GetOpt(), list_view);

			// Get full path
			TCHAR ModulePath[MAX_PATH];
			GetModuleFileName(nullptr, ModulePath, MAX_PATH);
			PathRemoveFileSpec(ModulePath);

			// Retrieves full path of the location of Readme.txt
			lstrcpy(readme_file_name, ModulePath);
			PathAppend(readme_file_name, _T("Readme.txt"));

			// Retrieves full path of the location of History.txt
			lstrcpy(history_file_name, ModulePath);
			PathAppend(history_file_name, _T("History.txt"));

			// Retrieves full path of the location of State.txt
			lstrcpy(state_file_name, ModulePath);
			PathAppend(state_file_name, _T("State.txt"));

			extract.Init(window, option.GetOpt(), list_view);
			break;
		}

	case WM_DROPFILES:
		extract.OpenDrop(wp);
		main_tool_bar.AddOpenHistory(extract.GetArcList());
		status_bar.SetCount();
		break;

	case WM_COMMAND:
		switch (LOWORD(wp))
		{
		case IDM_OPEN: // Open a file to load
			extract.Open(last_dir.GetOpen());
			main_tool_bar.AddOpenHistory(extract.GetArcList());
			status_bar.SetCount();
			last_dir.SaveIni();
			break;

		case IDM_CLOSE: // Close the opened file
			extract.Close();
			status_bar.SetCount();
			break;

		// Open a file from history
		case ID_TOOLBAR_OPEN_HISTORY:
		case ID_TOOLBAR_OPEN_HISTORY+1:
		case ID_TOOLBAR_OPEN_HISTORY+2:
		case ID_TOOLBAR_OPEN_HISTORY+3:
		case ID_TOOLBAR_OPEN_HISTORY+4:
		case ID_TOOLBAR_OPEN_HISTORY+5:
		case ID_TOOLBAR_OPEN_HISTORY+6:
		case ID_TOOLBAR_OPEN_HISTORY+7:
		case ID_TOOLBAR_OPEN_HISTORY+8:
		case ID_TOOLBAR_OPEN_HISTORY+9:
			extract.OpenHistory(main_tool_bar.GetHistory()[LOWORD(wp)-ID_TOOLBAR_OPEN_HISTORY]);
			main_tool_bar.AddOpenHistory(extract.GetArcList());
			status_bar.SetCount();
			break;

		// Search button configuration file
		case IDM_AHX:
		case IDM_BMP:
		case IDM_JPG:
		case IDM_MID:
		case IDM_MPG:
		case IDM_OGG:
		case IDM_PNG:
		case IDM_WAV:
		case IDM_WMV:
			search_tool_bar.SetSearch(LOWORD(wp));
			break;

		// Quick settings
		case IDM_QUICKSET_STD_SEARCHOGG:
		case IDM_QUICKSET_EXTRACT_CREATEFOLDER:
		case IDM_QUICKSET_EXTRACT_FIXOGG:
		case IDM_QUICKSET_EXTRACT_EASYDECRYPT:
		case IDM_QUICKSET_EXTRACT_DSTPNG:
		case IDM_QUICKSET_EXTRACT_ALPHABLEND:
		case IDM_QUICKSET_SUSIE_USE:
		case IDM_QUICKSET_SUSIE_FIRST:
			SetQuickMenuItem(LOWORD(wp));
			break;

		case IDM_EXIT: // Exit
			SendMessage(window, WM_CLOSE, 0, 0);
			break;

		case IDM_EXTRACT: // Extract the selected range
			if (list_view.GetCountSel() > 0)
			{
				extract.SaveSel(last_dir.GetSave(), true);
			}
			last_dir.SaveIni();
			break;

		case IDM_EXTRACTALL: // Extract all
			if( list_view.GetCount() > 0 )
			{
				extract.SaveAll(last_dir.GetSave(), true);
			}
			last_dir.SaveIni();
			break;

		case IDM_EXTRACT_NOTCONVERT: // Extracts the selection without converting it
			if (list_view.GetCountSel() > 0)
			{
				extract.SaveSel(last_dir.GetSave(), false);
			}
			last_dir.SaveIni();
			break;

		case IDM_EXTRACTALL_NOTCONVERT: // Extracts all without conversion
			if (list_view.GetCount() > 0)
			{
				extract.SaveAll(last_dir.GetSave(), false);
			}
			last_dir.SaveIni();
			break;

		case IDM_SELECTALL: // Select all
			list_view.SetItemSelAll(LVIS_SELECTED);
			break;

		case IDM_OPTION: // Options
			option.DoModal(window);
			break;

		case IDM_README: // Open Readme.txt
			ShellExecute(nullptr, _T("open"), readme_file_name, nullptr, nullptr, SW_SHOWNORMAL);
			break;

		case IDM_HISTORY: // Open History.txt
			ShellExecute(nullptr, _T("open"), history_file_name, nullptr, nullptr, SW_SHOWNORMAL);
			break;

		case IDM_STATE: // Open State.txt
			ShellExecute(nullptr, _T("open"), state_file_name, nullptr, nullptr, SW_SHOWNORMAL);
			break;

		case IDM_VERSION: // Version info
			version.DoModal(window);
			break;
		}
		break;

	// Right-click Menu
	case WM_CONTEXTMENU:
		CreateMenu(lp);
		break;

	case WM_MOUSEWHEEL:
		{
			POINT pos;
			GetCursorPos(&pos);
			HWND point_window = WindowFromPoint(pos);
			if (point_window == list_view.GetHandle())
				SendMessage(point_window, WM_MOUSEWHEEL, wp, lp);
			break;
		}

	case WM_NOTIFY:
		{
			// Toolbar
			if (wp == ID_TOOLBAR)
			{
				LPNMTOOLBAR nm = reinterpret_cast<LPNMTOOLBAR>(lp);
				switch (nm->hdr.code)
				{
					// File History
					case TBN_DROPDOWN:
						main_tool_bar.CreateMenuHistory(nm->iItem);
						break;
				}
			}

			// List view
			if (wp == idsMainList)
			{
				LPNMLISTVIEW nm = reinterpret_cast<LPNMLISTVIEW>(lp);
				switch (nm->hdr.code)
				{
				// Sort
				case LVN_COLUMNCLICK:
					list_view.Sort(nm->iSubItem);
					break;
				// Show Tooltips
				case LVN_GETINFOTIP:
					list_view.ShowTip(reinterpret_cast<LPNMLVGETINFOTIP>(lp));
					break;
				// View
				case LVN_GETDISPINFO:
					list_view.Show(reinterpret_cast<NMLVDISPINFO*>(lp));
					break;
				// D&D (Drag & Drop)
				case LVN_BEGINDRAG:
				{
					//extract.SaveDrop();
					LRESULT result;
					list_view.OnBeginDrag(reinterpret_cast<NMHDR*>(lp), &result);
					break;
				}
				// Playback / Viewing by double-clicking
				case NM_DBLCLK:
					if (list_view.GetCountSel() > 0)
					{
						extract.DecodeTmp();
						extract.OpenRelate();
					}
					break;
				}
			}
			break;
		}

	case WM_SIZE:
		main_tool_bar.SetWindowPos(0, 0, 100, 26);
		search_tool_bar.SetWindowPos(100, 0, LOWORD(lp), 26);
		list_view.SetWindowPos(0, 28, LOWORD(lp), HIWORD(lp) - 48);
		status_bar.SetWindowPos(LOWORD(lp));
		break;

	case WM_CLOSE:
		// Save
		SaveIni();
		list_view.SaveIni();
		// Clean up
		extract.Close();
		DestroyWindow(window);
		break;

	case WM_DESTROY:
		PostQuitMessage(0);
		break;

	default:
		return DefWindowProc(window, msg, wp, lp);
	}

	return 0;
}
Пример #24
0
void CProfileOptions::AddOption(const char* name, const char* value, const char* cvar /*= NULL*/, const bool preview /*= false*/, const bool confirmation /*= false*/, const bool restart /*= false*/, const bool writeToConfig /*= false*/)
{
	if(!name || !name[0])
		return;

	if(!value)
		return;

	ScopedSwitchToGlobalHeap globalHeap;

	COption* pOption = NULL;
	CryFixedStringT<64> tmpName(name);
	CryFixedStringT<64> compareName("SysSpec");
	if(tmpName.find(compareName.c_str())==0)
	{
		if(compareName.length() == tmpName.length())
		{
			pOption = new CSysSpecAllOption(name, value, cvar);
		}
		else
		{
			pOption = new CSysSpecOption(name, value, cvar);
		}
	}
	else if(IsCVar(cvar))
	{
		pOption = new CCVarOption(name, value, cvar);
	}
	else if(!strcmp(name, "Resolution"))
	{
		pOption = new CScreenResolutionOption(name, value);
	}
	else
	{
		pOption = new COption(name, value);
	}

	pOption->SetPreview(preview);
	pOption->SetConfirmation(confirmation);
	pOption->SetRequiresRestart(restart);
	pOption->SetWriteToConfig(writeToConfig);

	if(pOption)
	{
		if(IPlayerProfileManager* profileManager = g_pGame->GetIGameFramework()->GetIPlayerProfileManager())
		{
			if(IPlayerProfile *profile = profileManager->GetCurrentProfile(profileManager->GetCurrentUser()))
			{
				pOption->SetPlayerProfile(profile);
				pOption->InitializeFromProfile();
			}

			if(!m_bLoadingProfile)
			{
				m_allOptions.push_back(pOption);
			}
			else
			{
				CryWarning(VALIDATOR_MODULE_GAME, VALIDATOR_WARNING,
						   "Adding \"%s\" option while loading values from profile, option might not be initialized properly. Consider adding to attributes.xml", name);
			}
		}
	}
}