Advertisement
Guest User

Untitled

a guest
Jul 18th, 2017
87
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. ;Age of Empires - Rise of Rome(Portable Edition)
  2. ;by [#Ph4n70m]
  3.  
  4. Name "RoRPortable"
  5. SilentInstall silent
  6. ShowInstDetails nevershow
  7. OutFile "..\RiseOfRome.exe"
  8. Icon "RiseOfRome.ico"
  9. VIProductVersion "1.0.0.0"
  10. VIAddVersionKey FileVersion "1.0.0.0"
  11. VIAddVersionKey FileDescription "Age of Empires - Rise of Rome for portable devices."
  12. VIAddVersionKey LegalCopyright "[#Ph4n70m]"
  13. VIAddVersionKey ProductName "Age of Empires - Rise of Rome (Portable Edition)"
  14. VIAddVersionKey CompanyName "[#Ph4n70m]"
  15.  
  16. !define AOEHKLMREGKEY "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Games\Age of Empires\1.00"
  17. !define AOEHKCUREGKEY "HKEY_CURRENT_USER\Software\Microsoft\Games\Age of Empires\1.00"
  18. !define RORHKLMREGKEY "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Microsoft Games\Age of Empires Expansion\1.0"
  19. !define RORHKCUREGKEY "HKEY_CURRENT_USER\Software\Microsoft\Microsoft Games\Age of Empires Expansion\1.0"
  20.  
  21. !include Registry.nsh
  22.  
  23. Var APPDIR
  24. Var DEFAULTDATADIR
  25. Var DATADIR
  26.  
  27.  
  28. Section "Main"
  29.  Call SetVariables
  30.  Call PrepareHost
  31.  Call StartApplication
  32.  Call CleanHost
  33. SectionEnd
  34.  
  35. Function SetVariables
  36.  StrCpy $APPDIR "$EXEDIR\App\AoE"
  37.  StrCpy $DEFAULTDATADIR "$EXEDIR\App\DefaultData"
  38.  StrCpy $DATADIR "$EXEDIR\Data"
  39. FunctionEnd
  40.  
  41. Function PrepareHost
  42.  ; Age of Empires part:
  43.   SetOutPath "$APPDIR"
  44.   ${registry::KeyExists} "${AOEHKLMREGKEY}" $0
  45.   StrCmp $0 "-1" ContinueWithoutBackupAoEHKLM
  46.   ${registry::MoveKey} "${AOEHKLMREGKEY}" "${AOEHKLMREGKEY} HostBackup" $0
  47.  ContinueWithoutBackupAoEHKLM:
  48.   ${registry::KeyExists} "${AOEHKCUREGKEY}" $0
  49.   StrCmp $0 "-1" ContinueWithoutBackupAoEHKCU
  50.   ${registry::MoveKey} "${AOEHKCUREGKEY}" "${AOEHKCUREGKEY} HostBackup" $0
  51.  ContinueWithoutBackupAoEHKCU:
  52.   IfFileExists "$DATADIR\AgeOfEmpires_HKLM_Registry.reg" ImportAoEHKLM
  53.   CopyFiles /SILENT "$DEFAULTDATADIR\AgeOfEmpires_HKLM_Default.reg" "$DATADIR\AgeOfEmpires_HKLM_Registry.reg"
  54.  ImportAoEHKLM:
  55.   nsExec::Exec `"$WINDIR\system32\reg.exe" import "$DATADIR\AgeOfEmpires_HKLM_Registry.reg"`
  56.   IfFileExists "$DATADIR\AgeOfEmpires_HKCU_Registry.reg" ImportAoEHKCU
  57.   CopyFiles /SILENT "$DEFAULTDATADIR\AgeOfEmpires_HKCU_Default.reg" "$DATADIR\AgeOfEmpires_HKCU_Registry.reg"
  58.  ImportAoEHKCU:
  59.   nsExec::Exec `"$WINDIR\system32\reg.exe" import "$DATADIR\AgeOfEmpires_HKCU_Registry.reg"`
  60.   ${registry::Write} "${AOEHKLMREGKEY}" "InstallationDirectory" "$APPDIR" "REG_SZ" $0
  61.  
  62.  ; Rise of Rome part:
  63.   ${registry::KeyExists} "${RORHKLMREGKEY}" $0
  64.   StrCmp $0 "-1" ContinueWithoutBackupRoRHKLM
  65.   ${registry::MoveKey} "${RORHKLMREGKEY}" "${RORHKLMREGKEY} HostBackup" $0
  66.  ContinueWithoutBackupRoRHKLM:
  67.   ${registry::KeyExists} "${RORHKCUREGKEY}" $0
  68.   StrCmp $0 "-1" ContinueWithoutBackupRoRHKCU
  69.   ${registry::MoveKey} "${RORHKCUREGKEY}" "${RORHKCUREGKEY} HostBackup" $0
  70.  ContinueWithoutBackupRoRHKCU:
  71.   IfFileExists "$DATADIR\RiseOfRome_HKLM_Registry.reg" ImportRoRHKLM
  72.   CopyFiles /SILENT "$DEFAULTDATADIR\RiseOfRome_HKLM_Default.reg" "$DATADIR\RiseOfRome_HKLM_Registry.reg"
  73.  ImportRoRHKLM:
  74.   nsExec::Exec `"$WINDIR\system32\reg.exe" import "$DATADIR\RiseOfRome_HKLM_Registry.reg"`
  75.   IfFileExists "$DATADIR\RiseOfRome_HKCU_Registry.reg" ImportRoRHKCU
  76.   CopyFiles /SILENT "$DEFAULTDATADIR\RiseOfRome_HKCU_Default.reg" "$DATADIR\RiseOfRome_HKCU_Registry.reg"
  77.  ImportRoRHKCU:
  78.   nsExec::Exec `"$WINDIR\system32\reg.exe" import "$DATADIR\RiseOfRome_HKCU_Registry.reg"`
  79.   ${registry::Write} "${RORHKLMREGKEY}" "EXE Path" "$APPDIR" "REG_SZ" $0
  80. FunctionEnd
  81.  
  82. Function StartApplication
  83.  ExecWait "$APPDIR\Empiresx.exe"
  84. FunctionEnd
  85.  
  86. Function CleanHost
  87.  ; Age of Empires part:
  88.   ${registry::SaveKey} "${AOEHKLMREGKEY}" "$DATADIR\AgeOfEmpires_HKLM_Registry.reg" "" $0
  89.   ${registry::SaveKey} "${AOEHKCUREGKEY}" "$DATADIR\AgeOfEmpires_HKCU_Registry.reg" "" $0
  90.   ${registry::DeleteKey} "${AOEHKLMREGKEY}" $0
  91.   ${registry::DeleteKey} "${AOEHKCUREGKEY}" $0
  92.   ${registry::KeyExists} "${AOEHKLMREGKEY} HostBackup" $0
  93.   StrCmp $0 "-1" ContinueWithoutRestoreAoEHKLM
  94.   ${registry::MoveKey} "${AOEHKLMREGKEY} HostBackup" "${AOEHKLMREGKEY}" $0
  95.  ContinueWithoutRestoreAoEHKLM:
  96.   ${registry::KeyExists} "${AOEHKCUREGKEY} HostBackup" $0
  97.   StrCmp $0 "-1" ContinueWithoutRestoreAoEHKCU
  98.   ${registry::MoveKey} "${AOEHKCUREGKEY} HostBackup" "${AOEHKCUREGKEY}" $0
  99.  ContinueWithoutRestoreAoEHKCU:
  100.   ${registry::Unload}
  101.   DeleteRegKey /ifempty HKLM "SOFTWARE\Microsoft\Games\Age of Empires"
  102.   DeleteRegKey /ifempty HKLM "SOFTWARE\Microsoft\Games"
  103.   DeleteRegKey /ifempty HKCU "Software\Microsoft\Games\Age of Empires"
  104.   DeleteRegKey /ifempty HKCU "Software\Microsoft\Games"
  105.  
  106.  ; Rise of Rome part:
  107.   ${registry::SaveKey} "${RORHKLMREGKEY}" "$DATADIR\RiseOfRome_HKLM_Registry.reg" "" $0
  108.   ${registry::SaveKey} "${RORHKCUREGKEY}" "$DATADIR\RiseOfRome_HKCU_Registry.reg" "" $0
  109.   ${registry::DeleteKey} "${RORHKLMREGKEY}" $0
  110.   ${registry::DeleteKey} "${RORHKCUREGKEY}" $0
  111.   ${registry::KeyExists} "${RORHKLMREGKEY} HostBackup" $0
  112.   StrCmp $0 "-1" ContinueWithoutRestoreRoRHKLM
  113.   ${registry::MoveKey} "${RORHKLMREGKEY} HostBackup" "${RORHKLMREGKEY}" $0
  114.  ContinueWithoutRestoreRoRHKLM:
  115.   ${registry::KeyExists} "${RORHKCUREGKEY} HostBackup" $0
  116.   StrCmp $0 "-1" ContinueWithoutRestoreRoRHKCU
  117.   ${registry::MoveKey} "${RORHKCUREGKEY} HostBackup" "${RORHKCUREGKEY}" $0
  118.  ContinueWithoutRestoreRoRHKCU:
  119.   ${registry::Unload}
  120.   DeleteRegKey /ifempty HKLM "SOFTWARE\Microsoft\Microsoft Games\Age of Empires Expansion"
  121.   DeleteRegKey /ifempty HKLM "SOFTWARE\Microsoft\Microsoft Games"
  122.   DeleteRegKey /ifempty HKCU "Software\Microsoft\Microsoft Games\Age of Empires Expansion"
  123.   DeleteRegKey /ifempty HKCU "Software\Microsoft\Microsoft Games"
  124. FunctionEnd
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement