void AdvancedCompilerOptionsDlg::OnCommandsChange(wxCommandEvent& WXUNUSED(event))
{
	CheckForChanges();
	int cmd = XRCCTRL(*this, "lstCommands", wxChoice)->GetSelection();
	ReadExtensions(cmd); // can change the extension cmb list !!!!!!!!!!!!!!!
	int ext = XRCCTRL(*this, "lstExt", wxChoice)->GetSelection();
    DisplayCommand(cmd, ext);
} // end of OnCommandsChange
示例#2
0
int ReadRevision4(FILE *pfConfig, USERDATAOPT *pUserdata,
                  OUTBOUND *pOutbounds, PAREALIST pRetList,
                  ULONG ulOptions)
{
   int rc;

   memset(&Config, 0, sizeof(Config));
   memset(Akas, 0, sizeof(Akas));

#ifdef DEBUG
   printf("Revision 4\n");
#endif

   /* zur�cksetzen */
   fseek(pfConfig, 0, SEEK_SET);

   /* CONFIG einlesen */
   if (1==fread(&Config, sizeof(Config), 1, pfConfig))
   {
#ifdef DEBUG
      printf("INF: Areas: %d\n", Config.AreaCnt);
      printf("INF: Akas: %d\n",  Config.AkaCnt);
      printf("INF: Outb: %s\n",  Config.OutBound);
#endif
      if (rc = ReadExtensions(pfConfig))
         return rc;
      else
      {
         if (ulOptions & READCFG_USERDATA)
            CopyUserData(pUserdata, Akas, &Config);

         if (ulOptions & READCFG_OUTBOUNDS)
            CopyOutbounds(pOutbounds, Akas);

         if ((ulOptions & READCFG_AREAS) && (rc = ReadAreas(pfConfig, pRetList)))
            return rc;
         else
            return CFGFILE_OK;
      }
   }
   else
   {
#ifdef DEBUG
      printf("ERROR: Config unreadable (%d)\n", errno);
#endif
      return CFGFILE_READ;
   }

}
void AdvancedCompilerOptionsDlg::ReadCompilerOptions()
{
    Compiler* compiler = CompilerFactory::GetCompiler(m_CompilerId);
    if (!compiler)
        return;

    wxChoice* lst = XRCCTRL(*this, "lstCommands", wxChoice);
    lst->Clear();
    for (int i = 0; i < ctCount; ++i)
    {
        m_Commands[i] = compiler->GetCommandToolsVector((CommandType)i);
        lst->Append(Compiler::CommandTypeDescriptions[i]);
    }
    lst->SetSelection(0);
    DisplayCommand(0,0);
    ReadExtensions(0);

    // switches
    const CompilerSwitches& switches = compiler->GetSwitches();
    XRCCTRL(*this, "txtAddIncludePath",       wxTextCtrl)->SetValue(switches.includeDirs);
    XRCCTRL(*this, "txtAddLibPath",           wxTextCtrl)->SetValue(switches.libDirs);
    XRCCTRL(*this, "txtAddLib",               wxTextCtrl)->SetValue(switches.linkLibs);
    XRCCTRL(*this, "txtLibPrefix",            wxTextCtrl)->SetValue(switches.libPrefix);
    XRCCTRL(*this, "txtLibExt",               wxTextCtrl)->SetValue(switches.libExtension);
    XRCCTRL(*this, "txtDefine",               wxTextCtrl)->SetValue(switches.defines);
    XRCCTRL(*this, "txtGenericSwitch",        wxTextCtrl)->SetValue(switches.genericSwitch);
    XRCCTRL(*this, "txtObjectExt",            wxTextCtrl)->SetValue(switches.objectExtension);
    XRCCTRL(*this, "chkFwdSlashes",           wxCheckBox)->SetValue(switches.forceFwdSlashes);
    XRCCTRL(*this, "chkLinkerNeedsLibPrefix", wxCheckBox)->SetValue(switches.linkerNeedsLibPrefix);
    XRCCTRL(*this, "chkLinkerNeedsLibExt",    wxCheckBox)->SetValue(switches.linkerNeedsLibExtension);
    XRCCTRL(*this, "chkLinkerNeedsPathRes",   wxCheckBox)->SetValue(switches.linkerNeedsPathResolved);
    XRCCTRL(*this, "chkNeedDeps",             wxCheckBox)->SetValue(switches.needDependencies);
    XRCCTRL(*this, "chkForceCompilerQuotes",  wxCheckBox)->SetValue(switches.forceCompilerUseQuotes);
    XRCCTRL(*this, "chkForceLinkerQuotes",    wxCheckBox)->SetValue(switches.forceLinkerUseQuotes);
    XRCCTRL(*this, "chkSupportsPCH",          wxCheckBox)->SetValue(switches.supportsPCH);
    XRCCTRL(*this, "txtPCHExt",               wxTextCtrl)->SetValue(switches.PCHExtension);
    XRCCTRL(*this, "chkUseFlatObjects",       wxCheckBox)->SetValue(switches.UseFlatObjects);
    XRCCTRL(*this, "chkUseFullSourcePaths",   wxCheckBox)->SetValue(switches.UseFullSourcePaths);
    XRCCTRL(*this, "txtIncludeDirSeparator",  wxTextCtrl)->SetValue(switches.includeDirSeparator);
    XRCCTRL(*this, "txtLibDirSeparator",      wxTextCtrl)->SetValue(switches.libDirSeparator);
    XRCCTRL(*this, "txtObjectSeparator",      wxTextCtrl)->SetValue(switches.objectSeparator);
    XRCCTRL(*this, "spnStatusSuccess",        wxSpinCtrl)->SetValue(switches.statusSuccess);
    XRCCTRL(*this, "chkUse83Paths",           wxCheckBox)->SetValue(switches.Use83Paths);

    m_Regexes = compiler->GetRegExArray();
    m_SelectedRegex = m_Regexes.Count() > 0 ? 0 : -1;
    FillRegexes();
}
void AdvancedCompilerOptionsDlg::OnAddExt(wxCommandEvent& WXUNUSED(event))
{
	wxString ext = wxGetTextFromUser(_("Please enter a semi-colon separated list of extensions, without the leading dot:"), _("New extension"));
	ext.Trim(false);
	ext.Trim(true);
	if (!ext.IsEmpty())
	{
		int nr = XRCCTRL(*this, "lstCommands", wxChoice)->GetSelection();
		CompilerTool* ptool = GetCompilerTool(nr,0);
		CompilerTool tool(ptool ? ptool->command : wxString(), ext);
		m_Commands[nr].push_back(tool);
		ReadExtensions(nr);
		wxChoice* cmb = XRCCTRL(*this, "lstExt", wxChoice);
		cmb->SetStringSelection(ext);
		DisplayCommand(nr,cmb->GetSelection());
	}
}
void AdvancedCompilerOptionsDlg::OnDelExt(wxCommandEvent& WXUNUSED(event))
{
	if (cbMessageBox(_("Are you sure you want to remove this extension set from the list?"), _T("Confirmation"), wxYES_NO) == wxID_YES)
	{
		int nr = XRCCTRL(*this, "lstCommands", wxChoice)->GetSelection();
		wxChoice* cmb = XRCCTRL(*this, "lstExt", wxChoice);
		wxString extS = cmb->GetStringSelection();
		if (!extS.IsEmpty())
		{
			int ext = cmb->GetSelection();
			m_Commands[nr].erase(m_Commands[nr].begin() + ext);
			ReadExtensions(nr);
			cmb->SetSelection(0);
			m_LastExtIndex = -1;
			DisplayCommand(nr,0);
		}
		else
			cbMessageBox(_("Can't remove default commands!"), _("Error"));
	}
}
示例#6
0
bool GmExe::Load(const std::string& filename, Gmk* gmk, unsigned int ver) {
    if (!gmk)
        return false;

    // Set handles
    version = ver;
    gmkHandle = gmk;
    exeFilename = filename;

    // Try to load the EXE
    if (!exeHandle->Load(filename))
        return false;

    // Now we need to check the ver so we know how to treat the EXE
    switch(version) {
    case 800: // GM8.0 EXE
    {
        std::cout << "Detected GM8.0 game!" << std::endl;

        Gm80* gm80 = new Gm80();

        if (!gm80->FindGameData(exeHandle))
            return false;

        delete gm80;
        break;
    }

    case 810: // GM8.1 EXE
    {
        std::cout << "Detected GM8.1 game!" << std::endl;

        Gm81* gm81 = new Gm81();

        if (!gm81->FindGameData(exeHandle))
            return false;

        gm81->Decrypt(exeHandle);

        delete gm81;
        break;
    }

    default: // Auto-detect version
        Gm81* gm81 = new Gm81();
        Gm80* gm80 = new Gm80();

        // Attempt to detect GM8.0 first
        if (gm80->FindGameData(exeHandle)) {
            version = 800;
            std::cout << "Detected GM8.0 game!" << std::endl;
            break;
        }

        // Attempt to detect GM8.1 next
        if (gm81->FindGameData(exeHandle)) {
            version = 810;
            std::cout << "Detected GM8.1 game!" << std::endl;

            if (!gm81->Decrypt(exeHandle)) {
                std::cout << "[Error  ] Failed to decrypt game data!" << std::endl;
                return false;
            }

            break;
        }

        std::cout << "Unknown game version!" << std::endl;

        delete gm80;
        delete gm81;
        return false;
    }

    // Read header
    std::cout << "Reading header..." << std::endl;
    if (version == 800)
        exeHandle->SkipDwords(2);	// Version, Debug flag
    else if (version == 810)
        exeHandle->SkipDwords(3);	// Null Magic, Null Version, Debug flag
    else
        return false;

    // Read settings
    std::cout << "Reading settings..." << std::endl;
    if (!ReadSettings())
        return false;

    // Read wrapper
    std::cout << "Reading d3d wrapper..." << std::endl;
    if (!ReadWrapper())
        return false;

    // Decrypt main game data paragraph
    std::cout << "Decrypting game data..." << std::endl;
    if (!DecryptGameData())
        return false;

    // Skip yet another garbage field -- and the pro flag, silly pro flag
    exeHandle->SkipDwords(exeHandle->ReadDword() + 1);

    gmkHandle->gameId = exeHandle->ReadDword();

    for(int i = 0; i < 4; i++)
        exeHandle->ReadDword();

    // Read extensions
    std::cout << "Reading extensions..." << std::endl;
    if (!ReadExtensions())
        return false;

    // Read triggers
    std::cout << "Reading triggers..." << std::endl;
    if (!ReadTriggers())
        return false;

    // Read constants
    std::cout << "Reading constants..." << std::endl;
    if (!ReadConstants())
        return false;

    // Read sounds
    std::cout << "Reading sounds..." << std::endl;
    if (!ReadSounds())
        return false;

    // Read sprites
    std::cout << "Reading sprites..." << std::endl;
    if (!ReadSprites())
        return false;

    // Read backgrounds
    std::cout << "Reading backgrounds..." << std::endl;
    if (!ReadBackgrounds())
        return false;

    // Read paths
    std::cout << "Reading paths..." << std::endl;
    if (!ReadPaths())
        return false;

    // Read scripts
    std::cout << "Reading scripts..." << std::endl;
    if (!ReadScripts())
        return false;

    // Read fonts
    std::cout << "Reading fonts..." << std::endl;
    if (!ReadFonts())
        return false;

    // Read timelines
    std::cout << "Reading timelines..." << std::endl;
    if (!ReadTimelines())
        return false;

    // Read objects
    std::cout << "Reading objects..." << std::endl;
    if (!ReadObjects())
        return false;

    // Read rooms
    std::cout << "Reading rooms..." << std::endl;
    if (!ReadRooms())
        return false;

    // Read last ID of object/tile placed
    gmkHandle->lastInstance = exeHandle->ReadDword();
    gmkHandle->lastTile = exeHandle->ReadDword();

    // Read includes
    std::cout << "Reading include files..." << std::endl;
    if (!ReadIncludes())
        return false;

    // Read game information
    std::cout << "Reading game information..." << std::endl;
    if (!ReadGameInformation())
        return false;

    // Ignore library initialization code
    std::cout << "Reading library initialization code..." << std::endl;
    exeHandle->SkipDwords(1);

    unsigned int i = exeHandle->ReadDword();
    for(; i; i--)
        exeHandle->iPosition += exeHandle->ReadDword();

    // Read room order
    std::cout << "Reading room order..." << std::endl;
    exeHandle->SkipDwords(1);

    i = exeHandle->ReadDword();
    for(; i; i--)
        gmkHandle->roomExecutionOrder.push_back(exeHandle->ReadDword());

    // Correct room order
    ResourceTree* tmpTree = new ResourceTree();
    tmpTree->group = RCT_GROUP_ROOMS;
    tmpTree->name = "Rooms";
    tmpTree->index = 0;
    tmpTree->status = 1;

    for(size_t a = 0; a < gmkHandle->roomExecutionOrder.size(); a++) {
        ResourceTree* rcItem = new ResourceTree();

        rcItem->name = gmkHandle->rooms[gmkHandle->roomExecutionOrder[a]]->name;
        rcItem->group = RCT_GROUP_ROOMS;
        rcItem->index = gmkHandle->roomExecutionOrder[a];
        rcItem->status = 3;

        tmpTree->contents.push_back(rcItem);
    }

    delete gmkHandle->resourceTree[RCT_ID_ROOMS];
    gmkHandle->resourceTree[RCT_ID_ROOMS] = tmpTree;

    return true;
}