Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
63 commits
Select commit Hold shift + click to select a range
05402db
Avalonia take 2
Dragorn421 Jun 16, 2025
30dc508
fix replace-all
Dragorn421 Jun 16, 2025
aea393c
fix
Dragorn421 Jun 16, 2025
0fd24b2
format
Dragorn421 Jun 16, 2025
f359f6d
some SkeletonViewer cleanup
Dragorn421 Jun 16, 2025
8c3f0fc
SkelViewer fixes
Dragorn421 Jun 16, 2025
f99d868
fix types passed to AvaloniaProperty.Register
Dragorn421 Jun 25, 2025
a130de7
debugger.break in utils.assert on failed
Dragorn421 Jun 25, 2025
58dd550
do not crash on failure to parse image, more details on image holders
Dragorn421 Jun 25, 2025
bef06b2
Implement segments config UI
Dragorn421 Jun 25, 2025
281ae38
restore ShowGLInfo functionality
Dragorn421 Jun 26, 2025
dabaee0
use EnumComboBox for render settings RenderMode
Dragorn421 Jun 26, 2025
fdf2bca
redecode and rerender on segments config change
Dragorn421 Jun 26, 2025
1da15e7
less ugly code
Dragorn421 Jun 26, 2025
91bef4c
commit to what ToAvaloniaBitmap is
Dragorn421 Jun 26, 2025
55b82db
release nightly-avalonia on re_avalonia branch
Dragorn421 Jun 26, 2025
141c319
also build linux builds
Dragorn421 Jun 26, 2025
ba33e12
Fix GHA: target the .csproj instead of the .sln
Dragorn421 Jun 26, 2025
a52b148
Merge remote-tracking branch 'upstream/master' into re_avalonia
Dragorn421 Jun 26, 2025
9bdcbc1
refine HexTextBox scrolling, allow using up/down keys, customizable s…
Dragorn421 Jun 26, 2025
72432cc
cleanup usings in Views/ and ViewModels/
Dragorn421 Jun 26, 2025
e179aa2
Better MVVM/DI pattern (fix AVLN3001 warnings)
Dragorn421 Jun 27, 2025
5de3024
cleanup DL viewer text
Dragorn421 Jun 27, 2025
0ce354f
Better MVVM/DI pattern 2 (fix remaining AVLN3001 warnings)
Dragorn421 Jun 27, 2025
76c80e0
skelviewer: implement limb highlighting
Dragorn421 Jun 27, 2025
3cfe300
misc, formatting
Dragorn421 Jun 27, 2025
c92576e
skelviewer: implement render settings (easy copypaste from the dlist …
Dragorn421 Jun 27, 2025
db52f9b
skelviewer: implement segments config (easy copypaste from the dlist …
Dragorn421 Jun 27, 2025
4e81382
cleanup: .NET naming style, MVVM/DI pattern
Dragorn421 Jun 27, 2025
e2e7cac
icons in MainWindow menu
Dragorn421 Jun 27, 2025
98c193e
skelviewer: icons for play forwards/backwards
Dragorn421 Jun 27, 2025
ba17f11
better default segments config: 4=gkeep, 8-15=empty DL
Dragorn421 Jun 27, 2025
a40ffa3
add "Load Player Animations" menu item
Dragorn421 Jun 27, 2025
494f16e
implement opening any file in object analyzer without loading a rom
Dragorn421 Jun 27, 2025
5d22034
Add load external anims menu items, from ROM and from external file
Dragorn421 Jun 27, 2025
b4d3742
add AnimationError for when parsing anims fails
Dragorn421 Jun 27, 2025
5e7dab2
skelviewer: make play forwards/backwards buttons show pause icon whil…
Dragorn421 Jun 28, 2025
13a6d9e
light cleanup
Dragorn421 Jun 28, 2025
35bea6c
Collision viewer: implement render settings and cleanup
Dragorn421 Jun 28, 2025
2b66af8
main window: implement export rom FS
Dragorn421 Jun 28, 2025
a35da85
main window: implement save rom as
Dragorn421 Jun 28, 2025
4c2f41b
main window: implement file inject
Dragorn421 Jun 28, 2025
d489916
main window: implement save file
Dragorn421 Jun 28, 2025
a35806f
main window: implement file rename
Dragorn421 Jun 28, 2025
5c5c05b
main window: implement export/import file names list
Dragorn421 Jun 28, 2025
53e40f0
auto-analyze on object analyzer open, misc
Dragorn421 Jun 28, 2025
50fa7df
cleanup namespaces 1
Dragorn421 Jun 28, 2025
c14039f
cleanup namespaces 2
Dragorn421 Jun 28, 2025
1d5e682
cleanup namespaces 3
Dragorn421 Jun 28, 2025
51eba2f
cleanup namespaces 4
Dragorn421 Jun 28, 2025
8df5b13
skelviewer: work around datagrid extending over UI and beyond window
Dragorn421 Jun 29, 2025
83190b6
cleanup
Dragorn421 Jun 29, 2025
91e4424
CRLF to LF (new files only)
Dragorn421 Jun 29, 2025
4b852dc
object analyzer: implement export/import json
Dragorn421 Jun 29, 2025
bca270c
fix async commands to return Task and use [RelayCommand] wrapping so …
Dragorn421 Jun 29, 2025
18bb6dc
remove disassembly menu items from dlist viewer and skeleton viewer (…
Dragorn421 Jun 29, 2025
a65841c
update README
Dragorn421 Jun 29, 2025
30e82f5
GHA: remove nightly-avalonia-release
Dragorn421 Jun 29, 2025
4334db7
add back LoadNvApi hack (with documentation this time...)
Dragorn421 Jun 29, 2025
2821bdc
skelviewer: fix anims continuing to "play" once closed
Dragorn421 Jun 29, 2025
d8e84ed
main window: better suggested segment id on open object analyzer
Dragorn421 Jun 29, 2025
116f10a
ROMRAM conversion window: use EnumComboBox and misc
Dragorn421 Jun 29, 2025
7b43935
bump avalona version to 11.2.8 (stay on 11.2 for stability)
Dragorn421 Jun 29, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 8 additions & 7 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,18 @@ on: [workflow_call]

jobs:
build:
runs-on: windows-latest
runs-on: ubuntu-latest
strategy:
matrix:
target-runtime: [linux-x64, win-x64]
configuration: [Debug, Release]

name: Z64Utils-${{ matrix.configuration }}
name: Z64Utils-${{ matrix.target-runtime }}-${{ matrix.configuration }}
env:
DOTNET_CLI_TELEMETRY_OPTOUT: true
restore_args: ''
restore_args: --runtime ${{ matrix.target-runtime }}
build_args: --no-self-contained --configuration ${{ matrix.configuration }} --version-suffix ${{ github.sha }} --property:IncludeSourceRevisionInInformationalVersion=false
archive_name: Z64Utils-${{ matrix.configuration }}-${{ github.sha }}
archive_name: Z64Utils-${{ matrix.target-runtime }}-${{ matrix.configuration }}-${{ github.sha }}
steps:
- uses: actions/checkout@v4
with:
Expand All @@ -28,17 +29,17 @@ jobs:
- name: dotnet restore
shell: bash
run: |
dotnet restore ${{ env.restore_args }}
dotnet restore Z64Utils/Z64Utils.csproj ${{ env.restore_args }}

- name: dotnet build
shell: bash
run: |
dotnet build ${{ env.restore_args }} ${{ env.build_args }}
dotnet build Z64Utils/Z64Utils.csproj ${{ env.restore_args }} ${{ env.build_args }}

- name: dotnet publish
shell: bash
run: |
dotnet publish --output publish_out/ ${{ env.restore_args }} ${{ env.build_args }}
dotnet publish Z64Utils/Z64Utils.csproj --output publish_out/ ${{ env.restore_args }} ${{ env.build_args }}

- uses: actions/checkout@v4
with:
Expand Down
15 changes: 5 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,20 +39,15 @@ You can find these configuration files as well as some additional information ab

Currently, the only requirement is `.NET 6` (Not to be confused with `.NET Core` or `.NET Framework`).

The general purpose download link for `.NET` is [this](https://dotnet.microsoft.com/download), and the direct download is [here](https://builds.dotnet.microsoft.com/dotnet/WindowsDesktop/6.0.36/windowsdesktop-runtime-6.0.36-win-x64.exe).

## Wine / Linux
## Windows

Z64Utils v2.0.1 is wine-compatible (this may change in the future).
The general purpose download link for `.NET` is [this](https://dotnet.microsoft.com/download), and the direct download is [here](https://builds.dotnet.microsoft.com/dotnet/WindowsDesktop/6.0.36/windowsdesktop-runtime-6.0.36-win-x64.exe).

To run it, first you need to install `.NET 6` using the installer (see [Dependencies](#dependencies) for the download link).
## Linux

Please keep in mind you need to use `wine64` instead of `wine` because this is a 64bits-only app.
On Ubuntu, you can install `.NET 6` with `sudo apt install dotnet-runtime-6.0`.

```bash
wine64 windowsdesktop-runtime-6.0.36-win-x64.exe
wine64 Z64Utils.exe
```
For other Linux distributions, additional details or other installation methods, see (Microsoft's documentation)[https://learn.microsoft.com/en-us/dotnet/core/install/linux].

# Contributing

Expand Down
34 changes: 34 additions & 0 deletions Z64Utils/App.axaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
<Application xmlns="https://github.com/avaloniaui"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:c="using:Z64Utils.Controls"
x:Class="Z64Utils.App"
RequestedThemeVariant="Default">
<!-- "Default" ThemeVariant follows system theme variant. "Dark" or "Light" are other available
options. -->

<Application.Styles>
<FluentTheme />
<StyleInclude Source="avares://Avalonia.Controls.DataGrid/Themes/Fluent.xaml" />
<StyleInclude Source="avares://Avalonia.Controls.ColorPicker/Themes/Fluent/Fluent.xaml" />
</Application.Styles>
<Application.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<ResourceInclude Source="/Controls/HexTextBox/Themes/Fluent.xaml" />
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>
<FontFamily x:Key="MonospacedFont">avares://Z64Utils/Assets/Fonts#Hack</FontFamily>

<c:EnumUINameMap x:Key="SegmentTypeEnumUINameMap">
<c:EnumUINameMapEntry Enum="EMPTY" UI="Empty" />
<c:EnumUINameMapEntry Enum="ADDRESS" UI="Address" />
<c:EnumUINameMapEntry Enum="ROM_FILESYSTEM" UI="ROM FS" />
<c:EnumUINameMapEntry Enum="FILE" UI="File" />
<c:EnumUINameMapEntry Enum="IDENTITY_MATRICES" UI="Identity Matrices" />
<c:EnumUINameMapEntry Enum="PRIM_COLOR_DLIST" UI="Prim Color" />
<c:EnumUINameMapEntry Enum="ENV_COLOR_DLIST" UI="Env Color" />
<c:EnumUINameMapEntry Enum="NULL_BYTES" UI="Null Bytes" />
<c:EnumUINameMapEntry Enum="EMPTY_DLIST" UI="Empty DList" />
</c:EnumUINameMap>
</Application.Resources>
</Application>
125 changes: 125 additions & 0 deletions Z64Utils/App.axaml.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,125 @@
using System;
using System.Linq;
using Avalonia;
using Avalonia.Controls.ApplicationLifetimes;
using Avalonia.Markup.Xaml;
using Z64Utils.ViewModels;
using Z64Utils.Views;

namespace Z64Utils;

public partial class App : Application
{
private static readonly NLog.Logger Logger = NLog.LogManager.GetCurrentClassLogger();

public override void Initialize()
{
AvaloniaXamlLoader.Load(this);
}

public override void OnFrameworkInitializationCompleted()
{
if (ApplicationLifetime is IClassicDesktopStyleApplicationLifetime desktop)
{
var winVM = new MainWindowViewModel();
var win = new MainWindow() { DataContext = winVM };
desktop.MainWindow = win;

win.Opened += (sender, ev) =>
{
string? romPath = Program.ParsedArgs?.RomFile?.FullName;
Logger.Debug("romPath={romPath}", romPath);
if (romPath != null)
{
winVM.OpenROMImpl(romPath);
var objectAnalyzerFileNames = Program.ParsedArgs?.ObjectAnalyzerFileNames;
if (objectAnalyzerFileNames != null)
{
Logger.Debug(
"objectAnalyzerFileNames={objectAnalyzerFileNames}",
objectAnalyzerFileNames
);
foreach (var name in objectAnalyzerFileNames)
{
// TODO un-hardcode segment 6
var oavm = winVM.OpenObjectAnalyzerByFileName(name, 6);

if (oavm == null)
{
// TODO maybe show error window
Logger.Error(
"Could not find an object with name {objectName}",
name
);
continue;
}

// TODO put find and analyze behind more command line args
// TODO don't use the Command funcs themselves?
oavm.FindDListsCommand();
oavm.AnalyzeDListsCommand();

var dListViewerOHEName = Program.ParsedArgs?.DListViewerOHEName;
if (dListViewerOHEName != null)
{
ObjectAnalyzerWindowViewModel.ObjectHolderEntry? ohe;
try
{
ohe = oavm.ObjectHolderEntries.First(ohe =>
ohe.ObjectHolder.Name == dListViewerOHEName
);
}
catch (InvalidOperationException)
{
ohe = null;
}
if (ohe != null)
{
oavm.OpenDListViewerObjectHolderEntryCommand.Execute(ohe);
}
else
{
// TODO maybe show error window
Logger.Error(
"Could not find an entry with name {0}",
dListViewerOHEName
);
}
}

var skeletonViewerOHEName = Program.ParsedArgs?.SkeletonViewerOHEName;
if (skeletonViewerOHEName != null)
{
ObjectAnalyzerWindowViewModel.ObjectHolderEntry? ohe;
try
{
ohe = oavm.ObjectHolderEntries.First(ohe =>
ohe.ObjectHolder.Name == skeletonViewerOHEName
);
}
catch (InvalidOperationException)
{
ohe = null;
}
if (ohe != null)
{
oavm.OpenSkeletonViewerObjectHolderEntryCommand.Execute(ohe);
}
else
{
// TODO maybe show error window
Logger.Error(
"Could not find an entry with name {0}",
skeletonViewerOHEName
);
}
}
}
}
}
};
}

base.OnFrameworkInitializationCompleted();
}
}
45 changes: 45 additions & 0 deletions Z64Utils/Assets/Fonts/Hack-LICENSE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
The work in the Hack project is Copyright 2018 Source Foundry Authors and licensed under the MIT License

The work in the DejaVu project was committed to the public domain.

Bitstream Vera Sans Mono Copyright 2003 Bitstream Inc. and licensed under the Bitstream Vera License with Reserved Font Names "Bitstream" and "Vera"

### MIT License

Copyright (c) 2018 Source Foundry Authors

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

### BITSTREAM VERA LICENSE

Copyright (c) 2003 by Bitstream, Inc. All Rights Reserved. Bitstream Vera is a trademark of Bitstream, Inc.

Permission is hereby granted, free of charge, to any person obtaining a copy of the fonts accompanying this license ("Fonts") and associated documentation files (the "Font Software"), to reproduce and distribute the Font Software, including without limitation the rights to use, copy, merge, publish, distribute, and/or sell copies of the Font Software, and to permit persons to whom the Font Software is furnished to do so, subject to the following conditions:

The above copyright and trademark notices and this permission notice shall be included in all copies of one or more of the Font Software typefaces.

The Font Software may be modified, altered, or added to, and in particular the designs of glyphs or characters in the Fonts may be modified and additional glyphs or characters may be added to the Fonts, only if the fonts are renamed to names not containing either the words "Bitstream" or the word "Vera".

This License becomes null and void to the extent applicable to Fonts or Font Software that has been modified and is distributed under the "Bitstream Vera" names.

The Font Software may be sold as part of a larger software package but no copy of one or more of the Font Software typefaces may be sold by itself.

THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL BITSTREAM OR THE GNOME FOUNDATION BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM OTHER DEALINGS IN THE FONT SOFTWARE.

Except as contained in this notice, the names of Gnome, the Gnome Foundation, and Bitstream Inc., shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Font Software without prior written authorization from the Gnome Foundation or Bitstream Inc., respectively. For further information, contact: fonts at gnome dot org.
Binary file added Z64Utils/Assets/Fonts/Hack-Regular.ttf
Binary file not shown.
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes.
32 changes: 19 additions & 13 deletions Z64Utils/Common/UpdateChecker.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
using System.Text;
using System.Text.Json;
using System.Text.Json.Serialization;
using System.Threading;
using System.Threading.Tasks;

namespace Common
Expand Down Expand Up @@ -171,21 +172,26 @@ public static class UpdateChecker
{
public const string ReleaseURL =
@"https://api.github.com/repos/zeldaret/Z64Utils/releases/latest";
public static readonly string CurrentTag = "v" + Z64.Program.Version;
public static readonly string CurrentTag = "v" + Z64Utils.Program.Version;
private static HttpClient GithubApiHttpClient = new()
{
BaseAddress = new("https://api.github.com"),
};

static UpdateChecker()
{
GithubApiHttpClient.DefaultRequestHeaders.UserAgent.ParseAdd("Z64Utils Updater");
}

public static GithubRelease? GetLatestRelease()
public static async Task<GithubRelease> GetLatestRelease()
{
HttpClient client = new();
var request = new HttpRequestMessage(HttpMethod.Get, ReleaseURL);
request.Headers.UserAgent.ParseAdd("Z64Utils Updater");
var resp = client.Send(request);

using (var stream = resp.Content.ReadAsStream())
{
StreamReader sr = new StreamReader(stream);
string json = sr.ReadToEnd();
return JsonSerializer.Deserialize<GithubRelease>(json);
}
CancellationTokenSource timeoutTokenSource = new();
timeoutTokenSource.CancelAfter(TimeSpan.FromSeconds(10));
var resp = await GithubApiHttpClient.GetAsync(ReleaseURL, timeoutTokenSource.Token);
string json = await resp.Content.ReadAsStringAsync();
var r = JsonSerializer.Deserialize<GithubRelease>(json);
Utils.Assert(r != null);
return r;
}
}
}
2 changes: 2 additions & 0 deletions Z64Utils/Common/Utils.cs
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,8 @@ public static void Assert([DoesNotReturnIf(false)] bool condition)
{
if (!condition)
{
if (Debugger.IsAttached)
Debugger.Break();
throw new AssertFailedException();
}
}
Expand Down
Loading