Skip to content

Commit 169a2f5

Browse files
committed
lets go 4.1.0 might be the first real llvm aot i made ha
1 parent 7f5a5ab commit 169a2f5

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

53 files changed

+838
-352
lines changed

.claude/settings.local.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,9 @@
33
"allow": [
44
"Bash(*)",
55
"WebFetch",
6-
"WebSearch"
6+
"WebSearch",
7+
"mcp__plugin_chrome-devtools-mcp_chrome-devtools__new_page",
8+
"mcp__plugin_chrome-devtools-mcp_chrome-devtools__take_snapshot"
79
],
810
"deny": [
911
"Bash(rm:*)",

Directory.Build.targets

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,3 @@
11
<Project>
2-
<!-- Sync package.json versions from Directory.Packages.props before Publish -->
3-
<Target Name="SyncVersionBeforePublish" BeforeTargets="Publish"
4-
Condition="Exists('$(MSBuildThisFileDirectory)sync-version.mjs')">
5-
<Exec Command="node &quot;$(MSBuildThisFileDirectory)sync-version.mjs&quot;" />
6-
</Target>
2+
<!-- Bootsharp and NodeApi handle packaging automatically via dotnet publish -->
73
</Project>

Directory.Packages.props

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<Project>
22
<PropertyGroup>
33
<ManagePackageVersionsCentrally>true</ManagePackageVersionsCentrally>
4-
<MotelyVersion>4.0.4</MotelyVersion>
4+
<MotelyVersion>4.1.1</MotelyVersion>
55
</PropertyGroup>
66
<ItemGroup>
77
<PackageVersion Include="Bootsharp" Version="0.7.0" />
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
namespace Motely.BrowserWasm;
2+
3+
public interface IMotelyBrowserApi
4+
{
5+
IMotelySingleSearchContext CreateSingleSearchContext(string seed, string deck, string stake);
6+
7+
string GetVersion();
8+
}

Motely.BrowserWasm/IMotelyJsUi.cs

Lines changed: 0 additions & 10 deletions
This file was deleted.
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
using Motely.Analysis;
2+
3+
namespace Motely.BrowserWasm;
4+
5+
/// <summary>WASM interop handle: keeps <see cref="Analysis.MotelySeedRouterDesc"/> + shop stream; uses real <see cref="MotelySingleSearchContext"/> inside each call.</summary>
6+
public interface IMotelySingleSearchContext : IDisposable
7+
{
8+
void BeginShopStream(int ante);
9+
10+
/// <summary>Same shape as <see cref="SeedAnalysisDto"/> shop queue: <c>id</c> = <see cref="Motely.MotelyItem.Type"/>, <c>name</c> = <see cref="Motely.FormatUtils.FormatItem"/>, <c>value</c> = packed <see cref="Motely.MotelyItem"/> bits for sprite lookup.</summary>
11+
ShopItemDto GetNextShopItem();
12+
}

Motely.BrowserWasm/IMotelyWasmBackend.cs

Lines changed: 0 additions & 23 deletions
This file was deleted.

Motely.BrowserWasm/Motely.BrowserWasm.csproj

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,17 @@
11
<Project Sdk="Microsoft.NET.Sdk">
22
<PropertyGroup>
3-
<TargetFramework>net10.0</TargetFramework>
3+
<TargetFramework>net10.0-browser</TargetFramework>
44
<RuntimeIdentifier>browser-wasm</RuntimeIdentifier>
55
<ImplicitUsings>enable</ImplicitUsings>
6+
<Nullable>enable</Nullable>
67
<InvariantGlobalization>true</InvariantGlobalization>
7-
<!-- Bootsharp output config -->
8+
<Version>$(MotelyVersion)</Version>
9+
<!-- Bootsharp output -->
810
<BootsharpName>motely-wasm</BootsharpName>
911
<BootsharpEmbedBinaries>false</BootsharpEmbedBinaries>
1012
<BootsharpBinariesDirectory>$(MSBuildThisFileDirectory)..\motely-wasm\dist\bootsharp</BootsharpBinariesDirectory>
11-
<BootsharpPackageDirectory>$(MSBuildThisFileDirectory)..\motely-wasm</BootsharpPackageDirectory>
1213
<BootsharpAggressiveTrimming>true</BootsharpAggressiveTrimming>
13-
<!-- NativeAOT-LLVM -->
14+
<!-- NativeAOT-LLVM (per bootsharp.com/guide/llvm) -->
1415
<BootsharpLLVM>true</BootsharpLLVM>
1516
<DotNetJsApi>true</DotNetJsApi>
1617
<UsingBrowserRuntimeWorkload>false</UsingBrowserRuntimeWorkload>
@@ -39,5 +40,6 @@
3940

4041
<ItemGroup>
4142
<ProjectReference Include="..\Motely\Motely.csproj" />
43+
<ProjectReference Include="..\Motely.Orchestration\Motely.Orchestration.csproj" />
4244
</ItemGroup>
4345
</Project>
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
namespace Motely.BrowserWasm;
2+
3+
public sealed class MotelyBrowserApi : IMotelyBrowserApi
4+
{
5+
public IMotelySingleSearchContext CreateSingleSearchContext(string seed, string deck, string stake) =>
6+
new MotelySingleSearchContextInterop(
7+
seed.Trim().Length > 0 ? seed.Trim() : "BALATRO1",
8+
Enum.Parse<Motely.MotelyDeck>(deck),
9+
Enum.Parse<Motely.MotelyStake>(stake));
10+
11+
public string GetVersion() =>
12+
typeof(MotelyBrowserApi).Assembly.GetName().Version?.ToString() ?? "unknown";
13+
}
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
using Motely;
2+
using Motely.Analysis;
3+
4+
namespace Motely.BrowserWasm;
5+
6+
/// <summary>Browser host only — not a second engine in Motely.dll.</summary>
7+
public sealed class MotelySingleSearchContextInterop : IMotelySingleSearchContext
8+
{
9+
private readonly MotelySeedRouterDesc _router;
10+
private MotelySingleShopItemStream _stream;
11+
private bool _hasStream;
12+
13+
public MotelySingleSearchContextInterop(string seed, MotelyDeck deck, MotelyStake stake) =>
14+
_router = new MotelySeedRouterDesc(seed, deck, stake);
15+
16+
public void BeginShopStream(int ante)
17+
{
18+
var ctx = _router.CreateContext();
19+
_stream = ctx.CreateShopItemStream(ante);
20+
_hasStream = true;
21+
}
22+
23+
public ShopItemDto GetNextShopItem()
24+
{
25+
if (!_hasStream)
26+
throw new InvalidOperationException("Call BeginShopStream before GetNextShopItem.");
27+
var ctx = _router.CreateContext();
28+
var item = ctx.GetNextShopItem(ref _stream);
29+
return new ShopItemDto
30+
{
31+
Id = item.Type.ToString(),
32+
Name = FormatUtils.FormatItem(item),
33+
Value = item.Value,
34+
};
35+
}
36+
37+
public void Dispose() => _router.Dispose();
38+
}

0 commit comments

Comments
 (0)