add <Depends> and <PostInstallAction> to be able to install Diablo 2 Shareware with Download!

TODO: write the req. fix which creates a new shortcut with -w -glide
see <PostInstallAction> in the xml file

svn path=/trunk/; revision=31878
This commit is contained in:
Christoph von Wittich 2008-01-18 22:23:52 +00:00
parent 21613e19af
commit a00d6a195f
4 changed files with 79 additions and 0 deletions

View file

@ -102,6 +102,12 @@
<description>An Open Source bitmap graphics editor geared towards young children.</description>
<location>http://ovh.dl.sourceforge.net/sourceforge/tuxpaint/tuxpaint-0.9.18-win32-installer.exe</location>
</application>
<application name="zeckensack's glide wrapper">
<regname>GlidewrapZbag</regname>
<version>0.84c</version>
<description>glidewrapper needed to run Diablo 2 on ReactOS.</description>
<location>http://www.zeckensack.de/glide/archive/GlideWrapper084c.exe</location>
</application>
</category>
<category name="Multimedia" icon="4">
</category>
@ -132,6 +138,14 @@
<description>SamNMax, Day of Tentacle, etc on ReactOS</description>
<location>http://ovh.dl.sourceforge.net/sourceforge/scummvm/scummvm-0.10.0-win32.exe</location>
</application>
<application name="Diablo 2 Shareware">
<regname>Diablo 2 Shareware</regname>
<version>1.4</version>
<description>Diablo 2 Shareware. zeckensack's glide wrapper is req. to run it.</description>
<location>http://ftp.freenet.de./pub/filepilot/windows/spiele/diabloiidemo.exe</location>
<depends>GlidewrapZbag</depends>
<postinstallaction>http://svn.reactos.org/fixes/diablo2fix.exe</postinstallaction>
</application>
<application name="Tile World">
<description>Nice Clone of Chip's Challenge originally made for the Atari Lynx. Includes free CCLP2 Graphics Pack, so you dont need the copyrighted Original.</description>
<location>http://www.muppetlabs.com/~breadbox/pub/software/tworld/tworld-1.3.0-win32-CCLP2.exe</location>

View file

@ -635,10 +635,39 @@ ProfDlgProc(HWND hDlg,
return FALSE;
}
BOOL IsApplicationInstalled(struct Application* App)
{
WCHAR Uninstaller[200];
if(StrCmpW(App->RegName, L"")) {
if(getUninstaller(App->RegName, Uninstaller)) {
return TRUE;
}
}
return FALSE;
}
struct Application* GetDependency(const WCHAR* Dependency)
{
struct Category* Category = Root.Children;
while (Category->Next)
{
while (Category->Apps)
{
if(StrCmpW(Category->Apps->Name, Dependency) == 0)
return Category->Apps;
Category->Apps = Category->Apps->Next;
}
Category = Category->Next;
}
return NULL;
}
LRESULT CALLBACK
WndProc (HWND hwnd, UINT Message, WPARAM wParam, LPARAM lParam)
{
static RECT DescriptionRect;
struct Application* AppToInstall;
switch (Message)
{
@ -683,7 +712,31 @@ WndProc (HWND hwnd, UINT Message, WPARAM wParam, LPARAM lParam)
if (lParam == (LPARAM)hDownloadButton)
{
if(SelectedApplication)
{
/* install dependencies */
if(StrCmpW(SelectedApplication->Depends, L""))
{
AppToInstall = SelectedApplication;
SelectedApplication = GetDependency(SelectedApplication->Depends);
if (!IsApplicationInstalled(SelectedApplication))
{
DialogBoxW(GetModuleHandle(NULL), MAKEINTRESOURCEW(IDD_DOWNLOAD), 0, DownloadProc);
}
SelectedApplication = AppToInstall;
}
/* download and install the app */
DialogBoxW(GetModuleHandle(NULL), MAKEINTRESOURCEW(IDD_DOWNLOAD), 0, DownloadProc);
/* install req. hacks to get it working */
if(StrCmpW(SelectedApplication->PostInstallAction, L""))
{
AppToInstall = SelectedApplication;
CopyMemory(SelectedApplication->Location, SelectedApplication->PostInstallAction, sizeof(SelectedApplication->Location));
DialogBoxW(GetModuleHandle(NULL), MAKEINTRESOURCEW(IDD_DOWNLOAD), 0, DownloadProc);
SelectedApplication = AppToInstall;
}
}
else
ShowMessage(Strings[IDS_NO_APP_TITLE], Strings[IDS_NO_APP]);
}

View file

@ -8,6 +8,8 @@ struct Application
WCHAR Licence[0x100];
WCHAR Description[0x400];
WCHAR Location[0x100];
WCHAR Depends[0x100];
WCHAR PostInstallAction[0x100];
struct Application* Next;
};

View file

@ -134,6 +134,16 @@ void text (void* usrdata, const char* data, int len)
int currentlengt = lstrlenW(CurrentApplication->Licence);
MultiByteToWideChar(CP_UTF8, 0, data, len, &CurrentApplication->Licence[currentlengt], 0x100-currentlengt);
}
else if(!strcmp(CurrentTag, "depends"))
{
int currentlengt = lstrlenW(CurrentApplication->Depends);
MultiByteToWideChar(CP_UTF8, 0, data, len, &CurrentApplication->Depends[currentlengt], 0x100-currentlengt);
}
else if(!strcmp(CurrentTag, "postinstallaction"))
{
int currentlengt = lstrlenW(CurrentApplication->PostInstallAction);
MultiByteToWideChar(CP_UTF8, 0, data, len, &CurrentApplication->PostInstallAction[currentlengt], 0x100-currentlengt);
}
}
void tag_closed (void* tree, const char* tag)