Author: cwittich Date: Sat Jan 19 01:23:52 2008 New Revision: 31878
URL: http://svn.reactos.org/svn/reactos?rev=31878&view=rev Log: 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
Modified: trunk/rosapps/downloader/downloader.xml trunk/rosapps/downloader/main.c trunk/rosapps/downloader/structures.h trunk/rosapps/downloader/xml.c
Modified: trunk/rosapps/downloader/downloader.xml URL: http://svn.reactos.org/svn/reactos/trunk/rosapps/downloader/downloader.xml?r... ============================================================================== --- trunk/rosapps/downloader/downloader.xml (original) +++ trunk/rosapps/downloader/downloader.xml Sat Jan 19 01:23:52 2008 @@ -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-ins...</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-C...</location>
Modified: trunk/rosapps/downloader/main.c URL: http://svn.reactos.org/svn/reactos/trunk/rosapps/downloader/main.c?rev=31878... ============================================================================== --- trunk/rosapps/downloader/main.c (original) +++ trunk/rosapps/downloader/main.c Sat Jan 19 01:23:52 2008 @@ -635,10 +635,39 @@ 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 @@ 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]); }
Modified: trunk/rosapps/downloader/structures.h URL: http://svn.reactos.org/svn/reactos/trunk/rosapps/downloader/structures.h?rev... ============================================================================== --- trunk/rosapps/downloader/structures.h (original) +++ trunk/rosapps/downloader/structures.h Sat Jan 19 01:23:52 2008 @@ -8,6 +8,8 @@ WCHAR Licence[0x100]; WCHAR Description[0x400]; WCHAR Location[0x100]; + WCHAR Depends[0x100]; + WCHAR PostInstallAction[0x100]; struct Application* Next; };
Modified: trunk/rosapps/downloader/xml.c URL: http://svn.reactos.org/svn/reactos/trunk/rosapps/downloader/xml.c?rev=31878&... ============================================================================== --- trunk/rosapps/downloader/xml.c (original) +++ trunk/rosapps/downloader/xml.c Sat Jan 19 01:23:52 2008 @@ -134,6 +134,16 @@ 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)