@@ -460,8 +460,13 @@ public static ExternalTool[] GetExternalTools()
460460 {
461461 tool . LocalPath = Path . Combine ( GeneralConfig . BasePath , tool . LocalPath ) ;
462462 }
463+ if ( CurrentOperatingSystem != OperatingSystems . Windows )
464+ {
465+ tool . LocalPath = tool . LocalPath . Replace ( "\\ \\ " , "/" ) . Replace ( "\\ " , "/" ) ;
466+ }
463467 }
464468
469+
465470 // order tools by order property
466471 ExternalTools = tools . OrderBy ( d => d . Order ) . ToArray ( ) ;
467472 return ExternalTools ;
@@ -917,7 +922,10 @@ public static ExternalTools_Version GetToolVersion(ExternalTool tool)
917922 case "mame" :
918923 return GetMAMEVersion ( dir ) ;
919924 case "tbbluemame" :
920- return GetTBBLueMAMEVersion ( Path . Combine ( GeneralConfig . BasePath , tool . LocalPath ) ) ;
925+ {
926+ var fileName = Path . Combine ( GeneralConfig . BasePath , tool . LocalPath ) . Replace ( "\\ \\ " , "/" ) . Replace ( "\\ " , "/" ) ;
927+ return GetTBBLueMAMEVersion ( fileName ) ;
928+ }
921929 case "zxbsmame" :
922930 case "hdfmonkey" :
923931 return GetDuefectuVersion ( tool ) ;
@@ -1174,11 +1182,20 @@ public static void DownloadAndInstallTool(ExternalTool tool, ExternalTools_Versi
11741182 ShowStatusPanel ( $ "After installing or updating ZXBSInstaller, run this program from { tool . LocalPath } .") ;
11751183 }
11761184
1185+ string tempFile = "" ;
1186+ string installationPath = "" ;
1187+
11771188 ShowStatusPanel ( $ "Downloading { tool . Name } version { version . Version } ...") ;
11781189
1190+ if ( tool . Id == "mame" && CurrentOperatingSystem == OperatingSystems . Linux )
1191+ {
1192+ version . DownloadUrl = "https://github.com/pkgforge-dev/MAME-AppImage/releases/download/0.286-2%402026-03-22_1774176335/MAME-0.286-2-anylinux-x86_64.AppImage" ;
1193+ tool . Unzip = false ;
1194+ }
1195+
11791196 // Download path
11801197 step = "Creating download path" ;
1181- var tempFile = Path . Combine ( GeneralConfig . BasePath , "downloads" ) ;
1198+ tempFile = Path . Combine ( GeneralConfig . BasePath , "downloads" ) ;
11821199 if ( ! Directory . Exists ( tempFile ) )
11831200 {
11841201 step = $ "Creating download path [{ tempFile } ]";
@@ -1189,7 +1206,6 @@ public static void DownloadAndInstallTool(ExternalTool tool, ExternalTools_Versi
11891206
11901207 // Get installation path
11911208 step = "Creating installation path" ;
1192- string installationPath = "" ;
11931209 if ( string . IsNullOrEmpty ( tool . LocalPath ) )
11941210 {
11951211 installationPath = Path . Combine ( GeneralConfig . BasePath , tool . Id ) ;
@@ -1198,6 +1214,7 @@ public static void DownloadAndInstallTool(ExternalTool tool, ExternalTools_Versi
11981214 {
11991215 installationPath = Path . Combine ( GeneralConfig . BasePath , tool . LocalPath ) ;
12001216 }
1217+
12011218 // Patch for Boriel Basic
12021219 if ( tool . Id == "zxbasic" )
12031220 {
@@ -1236,22 +1253,54 @@ public static void DownloadAndInstallTool(ExternalTool tool, ExternalTools_Versi
12361253 {
12371254 step = $ "Installing { tool . Name } ";
12381255 UpdateStatus ( $ "Installing { tool . Name } version { version . Version } ...", 50 ) ;
1256+ var destDir = Path . GetDirectoryName ( installationPath ) ;
1257+ if ( ! Directory . Exists ( destDir ) )
1258+ {
1259+ Directory . CreateDirectory ( destDir ) ;
1260+ }
12391261 ExtractFile ( tempFile , installationPath ) ;
12401262 }
12411263 else
12421264 {
1243- var dest = Path . Combine ( GeneralConfig . BasePath , tool . LocalPath ) ;
1244- if ( File . Exists ( dest ) )
1265+ if ( tool . Id == "mame" && CurrentOperatingSystem == OperatingSystems . Linux )
12451266 {
1246- File . Delete ( dest ) ;
1267+ var dest = Path . Combine ( GeneralConfig . BasePath , tool . LocalPath , "mame.AppImage" ) ;
1268+ var destDir = Path . GetDirectoryName ( dest ) ;
1269+ if ( ! Directory . Exists ( destDir ) )
1270+ {
1271+ Directory . CreateDirectory ( destDir ) ;
1272+ }
1273+ if ( File . Exists ( dest ) )
1274+ {
1275+ File . Delete ( dest ) ;
1276+ }
1277+ File . Move ( tempFile , dest ) ;
1278+ }
1279+ else
1280+ {
1281+ var dest = Path . Combine ( GeneralConfig . BasePath , tool . LocalPath ) ;
1282+ var destDir = Path . GetDirectoryName ( dest ) ;
1283+ if ( ! Directory . Exists ( destDir ) )
1284+ {
1285+ Directory . CreateDirectory ( destDir ) ;
1286+ }
1287+ if ( File . Exists ( dest ) )
1288+ {
1289+ File . Delete ( dest ) ;
1290+ }
1291+ File . Move ( tempFile , dest ) ;
12471292 }
1248- File . Move ( tempFile , installationPath ) ;
12491293 }
12501294
1295+
12511296 // Create Version.txt file
12521297 if ( tool . CreateVerFile )
12531298 {
12541299 var fileName = Path . Combine ( GeneralConfig . BasePath , $ "{ tool . LocalPath } .ver") ;
1300+ if ( tool . Id == "mame" && CurrentOperatingSystem != OperatingSystems . Windows )
1301+ {
1302+ fileName = Path . Combine ( GeneralConfig . BasePath , $ "{ tool . LocalPath } /mame.ver") ;
1303+ }
12551304 File . WriteAllText ( fileName , version . Version ) ;
12561305 }
12571306
@@ -1299,19 +1348,19 @@ public static void DownloadAndInstallTool(ExternalTool tool, ExternalTools_Versi
12991348 }
13001349
13011350 // Next SD Image patch
1302- if ( tool . Id == "nextsdimage" )
1351+ if ( tool . Id == "nextsdimage" )
13031352 {
1304- string dir = Path . Combine ( GeneralConfig . BasePath , tool . Id , "2gb" ) ;
1353+ string dir = Path . Combine ( GeneralConfig . BasePath , tool . Id , "2gb" ) ;
13051354 string source = Path . Combine ( dir , "cspect-next-2gb.img" ) ;
1306- string dest = Path . Combine ( GeneralConfig . BasePath , tool . Id , "cspect-next-2gb.img" ) ;
1355+ string dest = Path . Combine ( GeneralConfig . BasePath , tool . Id , "cspect-next-2gb.img" ) ;
13071356 if ( File . Exists ( dest ) )
13081357 {
13091358 File . Delete ( dest ) ;
13101359 }
13111360 File . Move ( source , dest ) ;
13121361
1313- source = Path . Combine ( dir , "version.txt" ) ;
1314- dest = Path . Combine ( GeneralConfig . BasePath , tool . Id , "version.txt" ) ;
1362+ source = Path . Combine ( dir , "version.txt" ) ;
1363+ dest = Path . Combine ( GeneralConfig . BasePath , tool . Id , "version.txt" ) ;
13151364 if ( File . Exists ( dest ) )
13161365 {
13171366 File . Delete ( dest ) ;
@@ -1367,7 +1416,7 @@ echo on
13671416 // Linux and Mac
13681417 bashFile = Path . Combine ( GeneralConfig . BasePath , "downloads" , "zxbsinstall.sh" ) ;
13691418 bash = @"
1370- # !/bin/bash
1419+ #!/bin/bash
13711420set -e
13721421
13731422echo ""Updating installer...""
@@ -1397,6 +1446,7 @@ exit 1
13971446# Ejecutar sin esperar
13981447./ZXBSInstaller &
13991448" ;
1449+ bash = bash . Replace ( "\r \n " , "\n " ) ;
14001450 }
14011451 bash = bash . Replace ( "{tempFile}" , tempFile ) . Replace ( "{installationPath}" , installationPath ) ;
14021452 File . WriteAllText ( bashFile , bash ) ;
@@ -1421,10 +1471,14 @@ exit 1
14211471 FileName = "bash" ,
14221472 Arguments = bashFile ,
14231473 WorkingDirectory = Path . Combine ( GeneralConfig . BasePath , "downloads" ) ,
1424- UseShellExecute = true ,
1474+ RedirectStandardOutput = false ,
1475+ RedirectStandardError = false ,
1476+ UseShellExecute = false ,
1477+ CreateNoWindow = true
14251478 } ;
14261479 var p = new Process { StartInfo = psi } ;
14271480 p . Start ( ) ;
1481+ Thread . Sleep ( 1000 ) ;
14281482 }
14291483 else
14301484 {
@@ -1687,6 +1741,12 @@ private static ExternalTools_Version GetMAMEVersion(string exePath)
16871741 {
16881742 // Windows fileName
16891743 var fileName = Path . Combine ( exePath , "mame.exe" ) ;
1744+ // Linux fileName
1745+ if ( CurrentOperatingSystem == OperatingSystems . Linux )
1746+ {
1747+ fileName = Path . Combine ( exePath , "mame.AppImage" ) ;
1748+ }
1749+
16901750 if ( ! File . Exists ( fileName ) )
16911751 {
16921752 // If not exist, try Linux/Mac fileName
@@ -1856,6 +1916,10 @@ private static ExternalTools_Version GetDuefectuVersion(ExternalTool tool)
18561916 else
18571917 {
18581918 exePath = Path . Combine ( GeneralConfig . BasePath , tool . LocalPath ) ;
1919+ if ( CurrentOperatingSystem != OperatingSystems . Windows )
1920+ {
1921+ exePath = exePath . Replace ( "\\ \\ " , "/" ) . Replace ( "\\ " , "/" ) ;
1922+ }
18591923 }
18601924 var fileName = Path . Combine ( exePath , "Version.txt" ) ;
18611925 if ( ! File . Exists ( fileName ) )
@@ -1918,7 +1982,7 @@ private static ExternalTools_Version GetNextSDImageVersion(ExternalTool tool)
19181982 {
19191983 try
19201984 {
1921- string fileName = Path . Combine ( GeneralConfig . BasePath , tool . Id , "version.txt" ) ;
1985+ string fileName = Path . Combine ( GeneralConfig . BasePath , tool . Id , "version.txt" ) ;
19221986 if ( ! File . Exists ( fileName ) )
19231987 {
19241988 return null ;
@@ -1936,7 +2000,7 @@ private static ExternalTools_Version GetNextSDImageVersion(ExternalTool tool)
19362000 OperatingSystem = OperatingSystems . All ,
19372001 Version = parts [ 0 ] ,
19382002 BetaNumber = 0 ,
1939- VersionNumber = ToDecimal ( parts [ 0 ] . Replace ( "-" , "" ) )
2003+ VersionNumber = ToDecimal ( parts [ 0 ] . Replace ( "-" , "" ) )
19402004 } ;
19412005 return v ;
19422006 }
0 commit comments