|
From: <sag...@us...> - 2010-03-21 14:45:54
|
Revision: 540
http://modplug.svn.sourceforge.net/modplug/?rev=540&view=rev
Author: saga-games
Date: 2010-03-21 14:45:39 +0000 (Sun, 21 Mar 2010)
Log Message:
-----------
[New] Installer: Try to find out what keymap file suits the user best.
Modified Paths:
--------------
trunk/OpenMPT/installer/install.iss
trunk/OpenMPT/installer/vst_scan.iss
Modified: trunk/OpenMPT/installer/install.iss
===================================================================
--- trunk/OpenMPT/installer/install.iss 2010-03-20 22:00:26 UTC (rev 539)
+++ trunk/OpenMPT/installer/install.iss 2010-03-21 14:45:39 UTC (rev 540)
@@ -95,9 +95,65 @@
; portable installation
Type: dirifempty; Name: "{app}\tunings"; Tasks: portable;
-; crappy workaround for uninstall stuff
+#include "vst_scan.iss"
+
[Code]
+procedure CurStepChanged(CurStep: TSetupStep);
+var
+ INIFile: String;
+ keyboardFilepath: String;
+ baseLanguage: Integer;
+
+begin
+ // Get the right INI path.
+ if(IsTaskSelected('portable')) then
+ begin
+ INIFile := ExpandConstant('{app}\mptrack.ini');
+ end else
+ begin
+ INIFile := ExpandConstant('{userappdata}\OpenMPT\mptrack.ini');
+ end;
+
+ case CurStep of
+ ssPostInstall:
+ begin
+ // Find a suitable keyboard layout (might not be very precise sometimes, as it's based on the UI language)
+ // Check http://msdn.microsoft.com/en-us/library/ms776294%28VS.85%29.aspx for the correct language codes.
+ keyboardFilepath := '';
+ baseLanguage := (GetUILanguage and $3FF);
+ case baseLanguage of
+ $07: // German
+ begin
+ keyboardFilepath := 'DE_jojo';
+ end;
+ $0c: // French
+ begin
+ keyboardFilepath := 'FR_mpt_classic_(vanisherIII)';
+ end;
+ $14: // Norwegian
+ begin
+ keyboardFilepath := 'NO_mpt_classic_(rakib)';
+ end;
+ end;
+
+ // Found an alternative keybinding.
+ if(keyboardFilepath <> '') then
+ begin
+ keyboardFilepath := ExpandConstant('{app}\extraKeymaps\' + keyboardFilepath + '.mkb');
+ SetIniString('Paths', 'Key_Config_File', keyboardFilepath, INIFile);
+ end;
+
+ // Scan for pre-installed VST plugins
+ if(IsTaskSelected('vst_scan')) then
+ begin
+ OnVSTScan(INIFile);
+ end;
+ end;
+ end;
+end;
+
+// Crappy workaround for uninstall stuff
procedure CurUninstallStepChanged(CurUninstallStep: TUninstallStep);
var
filepath: String;
@@ -140,6 +196,6 @@
end;
end;
-#include "vst_scan.iss"
+
Modified: trunk/OpenMPT/installer/vst_scan.iss
===================================================================
--- trunk/OpenMPT/installer/vst_scan.iss 2010-03-20 22:00:26 UTC (rev 539)
+++ trunk/OpenMPT/installer/vst_scan.iss 2010-03-21 14:45:39 UTC (rev 540)
@@ -11,11 +11,10 @@
ProgressValue: Integer;
ArrayLen: LongInt;
bExitSetup: Boolean;
- INIFile: String;
VSTPluginNumber: Integer;
OldVSTPluginNumber: Integer;
-procedure ProcessDirectory (RootDir: String; Progress: Boolean);
+procedure ProcessDirectory (RootDir: String; Progress: Boolean; INIFile: String);
var
NewRoot: String;
FilePath: String;
@@ -32,7 +31,7 @@
begin
FilePath := NewRoot + FindRec.Name;
if FindRec.Attributes AND FILE_ATTRIBUTE_DIRECTORY > 0 then
- ProcessDirectory (FilePath, Progress)
+ ProcessDirectory (FilePath, Progress, INIFile)
else
begin
// Start action -->
@@ -69,48 +68,38 @@
end;
end;
-procedure CurStepChanged (CurStep: TSetupStep);
+procedure OnVSTScan(INIFile: String);
var
Dir: String;
begin
- if ((CurStep = ssInstall) And (IsTaskSelected('vst_scan'))) then
- begin
+ VSTPluginNumber := GetIniInt('VST Plugins', 'NumPlugins', 0, 0, 0, INIFile);
+ OldVSTPluginNumber := VSTPluginNumber;
- // Get the right INI path.
- if(IsTaskSelected('portable')) then
- begin
- INIFile := ExpandConstant('{app}\mptrack.ini');
- end else
- begin
- INIFile := ExpandConstant('{userappdata}\OpenMPT\mptrack.ini');
- end;
- VSTPluginNumber := GetIniInt('VST Plugins', 'NumPlugins', 0, 0, 0, INIFile);
- OldVSTPluginNumber := VSTPluginNumber;
-
- // The folder to scan.
- Dir := ExpandConstant('{pf}\Steinberg\VstPlugins');
- RegQueryStringValue(HKEY_LOCAL_MACHINE, 'Software\VST', 'VSTPluginsPath', Dir); // won't touch Dir if registry path does not exist
- // The progress page.
- ProgressPage := CreateOutputProgressPage (CustomMessage ('ProgressTitle'),
- CustomMessage ('ProgressCaption'));
- ProgressPage.SetText (CustomMessage ('ProgressText'), Dir);
- ProgressPage.SetProgress(0, 0);
- ProgressPage.Show;
- // Make the Cancel button visible during the operation.
- ;WizardForm.CancelButton.Visible := TRUE;
- // Scan the folder.
- ProcessDirectory (Dir, TRUE);
- // Hide the progress page.
- try
- finally
- ProgressPage.Hide;
- end;
-
- // Update INI key
-
- if(VSTPluginNumber <> OldVSTPluginNumber) then
- begin
- SetIniInt('VST Plugins', 'NumPlugins', VSTPluginNumber, INIFile);
- end;
+ // The folder to scan.
+ Dir := ExpandConstant('{pf}\Steinberg\VstPlugins');
+ RegQueryStringValue(HKEY_LOCAL_MACHINE, 'Software\VST', 'VSTPluginsPath', Dir); // won't touch Dir if registry path does not exist
+ // The progress page.
+ ProgressPage := CreateOutputProgressPage (CustomMessage ('ProgressTitle'),
+ CustomMessage ('ProgressCaption'));
+ ProgressPage.SetText (CustomMessage ('ProgressText'), Dir);
+ ProgressPage.SetProgress(0, 0);
+ ProgressPage.Show;
+ // Make the Cancel button visible during the operation.
+ ;WizardForm.CancelButton.Visible := TRUE;
+ // Scan the folder.
+ ProcessDirectory (Dir, TRUE, INIFile);
+ // Hide the progress page.
+ try
+ finally
+ ProgressPage.Hide;
end;
+
+ // Update INI key
+
+ if(VSTPluginNumber <> OldVSTPluginNumber) then
+ begin
+ SetIniInt('VST Plugins', 'NumPlugins', VSTPluginNumber, INIFile);
+ end;
end;
+
+
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|