Source: Engines/Wine/Verbs/d3dx10/script.js

  1. const Wine = include("engines.wine.engine.object");
  2. const Resource = include("utils.functions.net.resource");
  3. const { CabExtract } = include("utils.functions.filesystem.extract");
  4. const Optional = Java.type("java.util.Optional");
  5. const OverrideDLL = include("engines.wine.plugins.override_dll");
  6. /**
  7. * Verb to install D3DX10
  8. */
  9. class D3DX10 {
  10. constructor(wine) {
  11. this.wine = wine;
  12. }
  13. /**
  14. * Extracts DirectX10 to the system directory
  15. *
  16. * @param {*} progressBar The progress bar
  17. * @param {*} filesToExtract A list of files to be extracted
  18. * @param {*} destination The destination folder
  19. * @param {*} pattern The file pattern used during extraction
  20. * @returns {void}
  21. */
  22. extractDirectXToSystemDirectory(progressBar, filesToExtract, destination, pattern) {
  23. const wizard = this.wine.wizard();
  24. const prefixDirectory = this.wine.prefixDirectory();
  25. filesToExtract.reduce((numberOfExtractedFiles, cabFile) => {
  26. print(tr("Extracting {0}...", cabFile));
  27. progressBar.setText(tr("Extracting {0}...", "DirectX 10"));
  28. progressBar.setProgressPercentage((numberOfExtractedFiles * 100) / filesToExtract.length);
  29. new CabExtract()
  30. .wizard(wizard)
  31. .archive(`${prefixDirectory}/drive_c/d3dx10/${cabFile}`)
  32. .to(destination)
  33. .extract(["-L", "-F", pattern]);
  34. return numberOfExtractedFiles + 1;
  35. }, 0);
  36. }
  37. go() {
  38. const wizard = this.wine.wizard();
  39. const prefixDirectory = this.wine.prefixDirectory();
  40. const system32directory = this.wine.system32directory();
  41. const architecture = this.wine.architecture();
  42. const setupFile = new Resource()
  43. .wizard(wizard)
  44. .url(
  45. "http://download.microsoft.com/download/8/4/A/84A35BF1-DAFE-4AE8-82AF-AD2AE20B6B14/directx_Jun2010_redist.exe"
  46. )
  47. .checksum("f8f1217f666bf2f6863631a7d5e5fb3a8d1542df")
  48. .name("directx_Jun2010_redist.exe")
  49. .get();
  50. const progressBar = wizard.progressBar(tr("Please wait..."));
  51. progressBar.setText(tr("Extracting {0}...", "DirectX 10"));
  52. progressBar.setProgressPercentage(0);
  53. new CabExtract()
  54. .wizard(wizard)
  55. .archive(setupFile)
  56. .to(`${prefixDirectory}/drive_c/d3dx10/`)
  57. .extract(["-L", "-F", "*d3dx10*x86*"]);
  58. const filesToExtractx86 = [
  59. "apr2007_d3dx10_33_x86.cab",
  60. "aug2007_d3dx10_35_x86.cab",
  61. "aug2008_d3dx10_39_x86.cab",
  62. "aug2009_d3dx10_42_x86.cab",
  63. "dec2006_d3dx10_00_x86.cab",
  64. "jun2007_d3dx10_34_x86.cab",
  65. "jun2008_d3dx10_38_x86.cab",
  66. "jun2010_d3dx10_43_x86.cab",
  67. "mar2008_d3dx10_37_x86.cab",
  68. "mar2009_d3dx10_41_x86.cab",
  69. "nov2007_d3dx10_36_x86.cab",
  70. "nov2008_d3dx10_40_x86.cab"
  71. ];
  72. this.extractDirectXToSystemDirectory(progressBar, filesToExtractx86, system32directory, "d3dx10*.dll");
  73. if (architecture == "amd64") {
  74. const system64directory = this.wine.system64directory();
  75. new CabExtract()
  76. .wizard(wizard)
  77. .archive(setupFile)
  78. .to(`${prefixDirectory}/drive_c/d3dx10/`)
  79. .extract(["-L", "-F", "*d3dx10*x64*"]);
  80. const filesToExtractx64 = [
  81. "apr2007_d3dx10_33_x64.cab",
  82. "aug2007_d3dx10_35_x64.cab",
  83. "aug2008_d3dx10_39_x64.cab",
  84. "aug2009_d3dx10_42_x64.cab",
  85. "dec2006_d3dx10_00_x64.cab",
  86. "jun2007_d3dx10_34_x64.cab",
  87. "jun2008_d3dx10_38_x64.cab",
  88. "jun2010_d3dx10_43_x64.cab",
  89. "mar2008_d3dx10_37_x64.cab",
  90. "mar2009_d3dx10_41_x64.cab",
  91. "nov2007_d3dx10_36_x64.cab",
  92. "nov2008_d3dx10_40_x64.cab"
  93. ];
  94. this.extractDirectXToSystemDirectory(progressBar, filesToExtractx64, system64directory, "d3dx10*.dll");
  95. }
  96. new OverrideDLL(this.wine)
  97. .withMode("native", [
  98. "d3dx10_33",
  99. "d3dx10_34",
  100. "d3dx10_35",
  101. "d3dx10_36",
  102. "d3dx10_37",
  103. "d3dx10_38",
  104. "d3dx10_39",
  105. "d3dx10_40",
  106. "d3dx10_41",
  107. "d3dx10_42",
  108. "d3dx10_43"
  109. ])
  110. .go();
  111. }
  112. static install(container) {
  113. const wine = new Wine();
  114. const wizard = SetupWizard(InstallationType.VERBS, "d3dx10", Optional.empty());
  115. wine.prefix(container);
  116. wine.wizard(wizard);
  117. new D3DX10(wine).go();
  118. wizard.close();
  119. }
  120. }
  121. module.default = D3DX10;