Skip to content

Commit

Permalink
Fix error in export TSV, add some samples, basic build pipeline
Browse files Browse the repository at this point in the history
  • Loading branch information
starknebula committed Sep 16, 2022
1 parent 4598ded commit 9959b41
Show file tree
Hide file tree
Showing 4 changed files with 81 additions and 2 deletions.
46 changes: 46 additions & 0 deletions build-all.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
echo on

:: Move to project folder
pushd .
cd src/gfz-cli

:: Build all targets
dotnet publish -r linux-x64
dotnet publish -r osx.10.10-x64
dotnet publish -r osx.11.0-x64
dotnet publish -r osx.12-x64
dotnet publish -r rhel-x64
dotnet publish -r win-x86
dotnet publish -r win-x64

:: Go back to root folder
popd

:: Copy the publish folder to the root of the git repo
:: https://docs.microsoft.com/en-us/windows-server/administration/windows-commands/xcopy
:: /s Copies subdirectories. This option automatically excludes empty directories.

robocopy .\src\gfz-cli\bin\Debug\net6.0\linux-x64\publish\ .\builds\linux-x64\ /s
robocopy .\src\gfz-cli\bin\Debug\net6.0\osx.10.10-x64\publish\ .\builds\osx.10.10-x64\ /s
robocopy .\src\gfz-cli\bin\Debug\net6.0\osx.11.0-x64\publish\ .\builds\osx.11.0-x64\ /s
robocopy .\src\gfz-cli\bin\Debug\net6.0\osx.12-x64\publish\ .\builds\osx.12-x64\ /s
robocopy .\src\gfz-cli\bin\Debug\net6.0\rhel-x64\publish\ .\builds\rhel-x64\ /s
robocopy .\src\gfz-cli\bin\Debug\net6.0\win-x86\publish\ .\builds\win-x86\ /s
robocopy .\src\gfz-cli\bin\Debug\net6.0\win-x64\publish\ .\builds\win-x64\ /s

:: Compress folders as ZIP
pushd .
cd builds\

tar.exe -a -c -f linux-x64.zip linux-x64
tar.exe -a -c -f osx10.10-x64.zip osx10.10-x64
tar.exe -a -c -f osx.11.0-x64.zip osx.11.0-x64
tar.exe -a -c -f osx.12-x64.zip osx.12-x64
tar.exe -a -c -f rhel-x64.zip rhel-x64
tar.exe -a -c -f win-x86.zip win-x86
tar.exe -a -c -f win-x64.zip win-x64

popd

:: For debugging
:: PAUSE
6 changes: 6 additions & 0 deletions docs/cardata-sample.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
Convert cardata.lz

```shell
gfz-cli.exe --cardata-tsv-to-bin D:\gfzj01\game\cardata.tsv
```

22 changes: 22 additions & 0 deletions docs/sample-actions.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
:: CARDATA
:: Create spreadsheet to edit vehicle parameters
:: ./win-x64 gfz-cli.exe --cardata-bin-to-tsv D:\gfzj01\game\cardata.lz
:: Convert spreadsheet into `cardata.tsv.bin`
:: ./win-x64 gfz-cli.exe --cardata-tsv-to-bin D:\gfzj01\game\cardata.tsv


:: DECOMPRESS
:: Decompress specific file
:: ./win-x64 gfz-cli.exe --lzd D:\gfzj01\stage\st01.gma.lz
:: Decompress all lz files in folder
:: ./win-x64 gfz-cli.exe --lzd D:\gfzj01\stage\
:: Decompress all lz files in folder and subfolders
:: ./win-x64 gfz-cli.exe --lzd D:\gfzj01\ --searchSubdirs

:: COMPRESS
:: Compress specific file
:: ./win-x64 gfz-cli.exe --lzc D:\gfzj01\stage\st01.gma
:: Compress all gma files in folder
:: ./win-x64 gfz-cli.exe --lzc D:\gfzj01\stage\ --searchPattern *.gma
:: Compress all gma files in folder and subfolders
:: ./win-x64 gfz-cli.exe --lzc D:\gfzj01\ --searchPattern *.gma --searchSubdirs
9 changes: 7 additions & 2 deletions src/gfz-cli/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -84,14 +84,19 @@ public static void CarDataToBIN(Options options)
var carData = new CarData();
carData.Deserialize(reader);

// Update path to decompressed file
string fileName = Path.GetFileNameWithoutExtension(filePath);
string fileDir = Path.GetDirectoryName(filePath);
filePath = Path.Combine(fileDir, fileName);

// Save out
string outputPath = filePath + ".bin";
string outputPath = filePath + ".lz";
using (var writer = new EndianBinaryWriter(File.Create(outputPath), CarData.endianness))
{
carData.Serialize(writer);
Console.WriteLine($"Created file: {outputPath}");
}
LzUtility.CompressAvLz(outputPath, GameCube.AmusementVision.GxGame.FZeroGX);
LzUtility.CompressAvLzToDisk(outputPath, GameCube.AmusementVision.GxGame.FZeroGX, true);
}
}

Expand Down

0 comments on commit 9959b41

Please sign in to comment.