mirror of
https://github.com/AxioDL/PrimeWorldEditor.git
synced 2025-05-31 03:31:32 +00:00
Added preliminary support for building new ISOs
This commit is contained in:
parent
4ffd1f0a2d
commit
31621874a6
@ -2,6 +2,7 @@
|
|||||||
#include "Core/Resource/Factory/CTemplateLoader.h"
|
#include "Core/Resource/Factory/CTemplateLoader.h"
|
||||||
#include "Core/Resource/Script/CMasterTemplate.h"
|
#include "Core/Resource/Script/CMasterTemplate.h"
|
||||||
#include <Common/Serialization/XML.h>
|
#include <Common/Serialization/XML.h>
|
||||||
|
#include <nod/nod.hpp>
|
||||||
|
|
||||||
CGameProject::~CGameProject()
|
CGameProject::~CGameProject()
|
||||||
{
|
{
|
||||||
@ -94,6 +95,30 @@ void CGameProject::Serialize(IArchive& rArc)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ProgressDummy(size_t, const nod::SystemString&, size_t) {}
|
||||||
|
|
||||||
|
bool CGameProject::BuildISO(const TString& rkIsoPath)
|
||||||
|
{
|
||||||
|
ASSERT( FileUtil::IsValidPath(rkIsoPath, false) );
|
||||||
|
|
||||||
|
if (IsWiiBuild())
|
||||||
|
{
|
||||||
|
Log::Error("Wii ISO building not supported!");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
else
|
||||||
|
{
|
||||||
|
nod::DiscBuilderGCN *pBuilder = new nod::DiscBuilderGCN(*rkIsoPath.ToUTF16(), *mGameID, *mProjectName, mFilesystemAddress, &ProgressDummy);
|
||||||
|
|
||||||
|
TWideString ProjRoot = ProjectRoot().ToUTF16();
|
||||||
|
TWideString DiscRoot = DiscDir(false).ToUTF16();
|
||||||
|
TWideString DolPath = ProjRoot + mDolPath.ToUTF16();
|
||||||
|
TWideString ApploaderPath = ProjRoot + mApploaderPath.ToUTF16();
|
||||||
|
return pBuilder->buildFromDirectory(*DiscRoot, *DolPath, *ApploaderPath);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void CGameProject::GetWorldList(std::list<CAssetID>& rOut) const
|
void CGameProject::GetWorldList(std::list<CAssetID>& rOut) const
|
||||||
{
|
{
|
||||||
for (u32 iPkg = 0; iPkg < mPackages.size(); iPkg++)
|
for (u32 iPkg = 0; iPkg < mPackages.size(); iPkg++)
|
||||||
|
@ -65,6 +65,7 @@ public:
|
|||||||
|
|
||||||
bool Save();
|
bool Save();
|
||||||
void Serialize(IArchive& rArc);
|
void Serialize(IArchive& rArc);
|
||||||
|
bool BuildISO(const TString& rkIsoPath);
|
||||||
void GetWorldList(std::list<CAssetID>& rOut) const;
|
void GetWorldList(std::list<CAssetID>& rOut) const;
|
||||||
CAssetID FindNamedResource(const TString& rkName) const;
|
CAssetID FindNamedResource(const TString& rkName) const;
|
||||||
CPackage* FindPackage(const TString& rkName) const;
|
CPackage* FindPackage(const TString& rkName) const;
|
||||||
@ -108,6 +109,7 @@ public:
|
|||||||
inline TString GameID() const { return mGameID; }
|
inline TString GameID() const { return mGameID; }
|
||||||
inline float BuildVersion() const { return mBuildVersion; }
|
inline float BuildVersion() const { return mBuildVersion; }
|
||||||
inline bool IsWiiBuild() const { return mBuildVersion >= 3.f; }
|
inline bool IsWiiBuild() const { return mBuildVersion >= 3.f; }
|
||||||
|
inline bool IsTrilogy() const { return mGame <= eCorruption && mBuildVersion >= 3.593f; }
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // CGAMEPROJECT_H
|
#endif // CGAMEPROJECT_H
|
||||||
|
@ -18,9 +18,17 @@ CProjectSettingsDialog::CProjectSettingsDialog(QWidget *pParent)
|
|||||||
|
|
||||||
connect(mpUI->CookPackageButton, SIGNAL(clicked()), this, SLOT(CookPackage()));
|
connect(mpUI->CookPackageButton, SIGNAL(clicked()), this, SLOT(CookPackage()));
|
||||||
connect(mpUI->CookAllDirtyPackagesButton, SIGNAL(clicked(bool)), this, SLOT(CookAllDirtyPackages()));
|
connect(mpUI->CookAllDirtyPackagesButton, SIGNAL(clicked(bool)), this, SLOT(CookAllDirtyPackages()));
|
||||||
|
connect(mpUI->BuildIsoButton, SIGNAL(clicked(bool)), this, SLOT(BuildISO()));
|
||||||
|
|
||||||
connect(gpEdApp, SIGNAL(ActiveProjectChanged(CGameProject*)), this, SLOT(ActiveProjectChanged(CGameProject*)));
|
connect(gpEdApp, SIGNAL(ActiveProjectChanged(CGameProject*)), this, SLOT(ActiveProjectChanged(CGameProject*)));
|
||||||
connect(gpEdApp, SIGNAL(AssetsModified()), this, SLOT(SetupPackagesList()));
|
connect(gpEdApp, SIGNAL(AssetsModified()), this, SLOT(SetupPackagesList()));
|
||||||
|
|
||||||
|
// Set build ISO button color
|
||||||
|
QPalette Palette = mpUI->BuildIsoButton->palette();
|
||||||
|
QBrush ButtonBrush = Palette.button();
|
||||||
|
ButtonBrush.setColor( UICommon::kImportantButtonColor );
|
||||||
|
Palette.setBrush(QPalette::Button, ButtonBrush);
|
||||||
|
mpUI->BuildIsoButton->setPalette(Palette);
|
||||||
}
|
}
|
||||||
|
|
||||||
CProjectSettingsDialog::~CProjectSettingsDialog()
|
CProjectSettingsDialog::~CProjectSettingsDialog()
|
||||||
@ -56,6 +64,7 @@ void CProjectSettingsDialog::ActiveProjectChanged(CGameProject *pProj)
|
|||||||
close();
|
close();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
mpUI->BuildIsoButton->setEnabled( pProj && !pProj->IsWiiBuild() );
|
||||||
SetupPackagesList();
|
SetupPackagesList();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -92,3 +101,18 @@ void CProjectSettingsDialog::CookAllDirtyPackages()
|
|||||||
gpEdApp->CookAllDirtyPackages();
|
gpEdApp->CookAllDirtyPackages();
|
||||||
SetupPackagesList();
|
SetupPackagesList();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CProjectSettingsDialog::BuildISO()
|
||||||
|
{
|
||||||
|
CGameProject *pProj = gpEdApp->ActiveProject();
|
||||||
|
ASSERT(pProj && !pProj->IsWiiBuild());
|
||||||
|
|
||||||
|
QString DefaultPath = TO_QSTRING(pProj->ProjectRoot() + pProj->Name()) + ".gcm";
|
||||||
|
QString IsoPath = UICommon::SaveFileDialog(this, "Choose output ISO path", "*.gcm", DefaultPath);
|
||||||
|
|
||||||
|
if (!IsoPath.isEmpty())
|
||||||
|
{
|
||||||
|
if (!pProj->BuildISO( TO_TSTRING(IsoPath) ))
|
||||||
|
UICommon::ErrorMsg(this, "Failed to build ISO! Check the log for details.");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@ -29,6 +29,7 @@ public slots:
|
|||||||
void SetupPackagesList();
|
void SetupPackagesList();
|
||||||
void CookPackage();
|
void CookPackage();
|
||||||
void CookAllDirtyPackages();
|
void CookAllDirtyPackages();
|
||||||
|
void BuildISO();
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // CPROJECTSETTINGSDIALOG_H
|
#endif // CPROJECTSETTINGSDIALOG_H
|
||||||
|
@ -141,6 +141,18 @@
|
|||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QPushButton" name="BuildIsoButton">
|
||||||
|
<property name="font">
|
||||||
|
<font>
|
||||||
|
<pointsize>12</pointsize>
|
||||||
|
</font>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>Build ISO</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
<resources/>
|
<resources/>
|
||||||
|
@ -112,6 +112,9 @@ inline void ErrorMsg(QWidget *pParent, QString ErrorText)
|
|||||||
QMessageBox::warning(pParent, "Error", ErrorText);
|
QMessageBox::warning(pParent, "Error", ErrorText);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Constants
|
||||||
|
const QColor kImportantButtonColor(36, 100, 100);
|
||||||
|
|
||||||
} // UICommon Namespace End
|
} // UICommon Namespace End
|
||||||
|
|
||||||
#endif // UICOMMON
|
#endif // UICOMMON
|
||||||
|
@ -119,7 +119,7 @@ CWorldEditor::CWorldEditor(QWidget *parent)
|
|||||||
|
|
||||||
QPalette Palette = pBrowserButton->palette();
|
QPalette Palette = pBrowserButton->palette();
|
||||||
QBrush ButtonBrush = Palette.button();
|
QBrush ButtonBrush = Palette.button();
|
||||||
ButtonBrush.setColor( QColor(36, 100, 100) );
|
ButtonBrush.setColor( UICommon::kImportantButtonColor );
|
||||||
Palette.setBrush(QPalette::Button, ButtonBrush);
|
Palette.setBrush(QPalette::Button, ButtonBrush);
|
||||||
pBrowserButton->setPalette(Palette);
|
pBrowserButton->setPalette(Palette);
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user