feat: some more ffi communication

This commit is contained in:
TrèsAbhi committed 2025-06-10 13:16:14 -05:00
1 parent fe3d029e74
commit a5a72f9536
12 files changed
+95 -64

No files matched your search

@@ -0,0 +1,11 @@
import { Flex, Text } from '@radix-ui/themes';
import { ffi } from '../../core/blitzkit/ffi';
export function FFIEcho() {
return (
<Flex direction="column" align="start" gap="2">
<Text>{ffi.debug_echo(new Date().toLocaleString())}</Text>
<img src="https://i.imgflip.com/9wrr7u.gif" />
</Flex>
);
}
@@ -0,0 +1,10 @@
import { Code, Text } from '@radix-ui/themes';
import { ffi } from '../../core/blitzkit/ffi';
export function FFIFileCount() {
return (
<Text>
<Code>{ffi.debug_get_file_count().toLocaleString()}</Code> files loaded
</Text>
);
}
@@ -0,0 +1,13 @@
import { Library, types } from 'ffi-napi';
import { assertSecret } from 'packages/core/src';
export const FFI_PATH =
'../../src/BlitzKit.FFI/bin/Release/net9.0/win-x64/publish/BlitzKit.FFI.dll';
export const ffi = Library(FFI_PATH, {
debug_echo: [types.CString, [types.CString]],
mount_game: ['void', [types.CString]],
debug_get_file_count: [types.int, []],
});
ffi.mount_game(assertSecret(import.meta.env.GAME_MOUNT_POINT));
@@ -1,47 +1,14 @@
import { Link, Table } from '@radix-ui/themes';
import { Heading } from '@radix-ui/themes';
import { FFIEcho } from '../../components/Internal/FFIEcho';
import { FFIFileCount } from '../../components/Internal/FFIFileCount';
import { PageWrapper } from '../../components/PageWrapper';
export function Page() {
return (
<PageWrapper>
<Table.Root>
<Table.Header>
<Table.Row>
<Table.ColumnHeaderCell>Name</Table.ColumnHeaderCell>
<Table.ColumnHeaderCell>Memo</Table.ColumnHeaderCell>
</Table.Row>
</Table.Header>
<Table.Body>
<Table.Row>
<Table.Cell>
<Link href="internal/ffi">FFI</Link>
</Table.Cell>
<Table.Cell>
Status of BlitzKit's currently mounted foreign function interface
</Table.Cell>
</Table.Row>
<Table.Row>
<Table.Cell>
<Link href="internal/ffi">Client</Link>
</Table.Cell>
<Table.Cell>
Location and information of the currently mounted client
</Table.Cell>
</Table.Row>
<Table.Row>
<Table.Cell>
<Link href="/internal/bindings">Bindings</Link>
</Table.Cell>
<Table.Cell>
Exhaustive list of all bindings and preference of currently
mounted client
</Table.Cell>
</Table.Row>
</Table.Body>
</Table.Root>
<PageWrapper color="amber">
<Heading>BlitzKit FFI</Heading>
<FFIEcho />
<FFIFileCount />
</PageWrapper>
);
}
@@ -1,11 +0,0 @@
import { PageWrapper } from 'packages/website-ue/src/components/PageWrapper';
import { ffi } from 'packages/website-ue/src/core/blitzkit/ffi';
export function Page() {
return (
<PageWrapper align="center" justify="center">
🟢 {ffi.echo(new Date().toLocaleString())}
<img src="https://i.imgflip.com/9wrr7u.gif" />
</PageWrapper>
);
}
@@ -1,8 +0,0 @@
---
import InternalBaseLayout from 'packages/website-ue/src/layouts/InternalBaseLayout.astro';
import { Page } from './_index';
---
<InternalBaseLayout>
<Page />
</InternalBaseLayout>