Skip to content

Commit 52355c6

Browse files
committed
AVM2: Automate stubbed/done amounts on the general compatibility page
1 parent 8099473 commit 52355c6

File tree

2 files changed

+32
-22
lines changed

2 files changed

+32
-22
lines changed

src/app/compatibility/page.tsx

+30-21
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import React from "react";
66
import { Title } from "@mantine/core";
77
import { List, ListItem } from "@mantine/core";
88
import { WeeklyContributions } from "@/app/compatibility/weekly_contributions";
9-
import { getWeeklyContributions } from "@/app/downloads/github";
9+
import { fetchReport, getWeeklyContributions } from "@/app/downloads/github";
1010

1111
export default async function Downloads() {
1212
const contributions = await getWeeklyContributions();
@@ -16,6 +16,13 @@ export default async function Downloads() {
1616
Commits: item.total,
1717
};
1818
});
19+
const report = await fetchReport();
20+
const summary = report ? report.summary : undefined;
21+
const maxPoints = summary ? summary.max_points : NaN;
22+
const implPoints = summary ? summary.impl_points : NaN;
23+
const stubPenalty = summary ? summary.stub_penalty : NaN;
24+
const done = Math.round((implPoints - stubPenalty) / maxPoints * 100);
25+
const stubbed = Math.round(stubPenalty / maxPoints * 100);
1926

2027
return (
2128
<Container size="xl" className={classes.container}>
@@ -84,26 +91,28 @@ export default async function Downloads() {
8491
</Text>
8592
</AvmBlock>
8693

87-
<AvmBlock
88-
name="AVM 2: ActionScript 3"
89-
language={{ done: 75 }}
90-
api={{ done: 69, stubbed: 7 }}
91-
info_link="/compatibility/avm2"
92-
>
93-
<Text>
94-
AVM 2 was introduced with Flash Player 9 (June 2006), to replace
95-
the earlier AVM 1. After the release of Flash Professional CC
96-
(2013), authors are required to use ActionScript 3 - making any
97-
movie made after that date very likely to fall under this
98-
category.
99-
</Text>
100-
<Text>
101-
Ruffle now has decent support for AVM 2, and it&apos;s our
102-
experience that most games will work well enough to be played.
103-
We&apos;re still rapidly improving in this area though, so bug
104-
reports about any broken content are always welcome!
105-
</Text>
106-
</AvmBlock>
94+
{!Number.isNaN(done) && !Number.isNaN(stubbed) && (
95+
<AvmBlock
96+
name="AVM 2: ActionScript 3"
97+
language={{ done: 75 }}
98+
api={{ done: done, stubbed: stubbed }}
99+
info_link="/compatibility/avm2"
100+
>
101+
<Text>
102+
AVM 2 was introduced with Flash Player 9 (June 2006), to replace
103+
the earlier AVM 1. After the release of Flash Professional CC
104+
(2013), authors are required to use ActionScript 3 - making any
105+
movie made after that date very likely to fall under this
106+
category.
107+
</Text>
108+
<Text>
109+
Ruffle now has decent support for AVM 2, and it&apos;s our
110+
experience that most games will work well enough to be played.
111+
We&apos;re still rapidly improving in this area though, so bug
112+
reports about any broken content are always welcome!
113+
</Text>
114+
</AvmBlock>
115+
)}
107116
</Flex>
108117

109118
<Stack w="100%" align="center">

src/app/downloads/config.tsx

+2-1
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import {
1010
} from "@tabler/icons-react";
1111
import React from "react";
1212
import { IconBrandLinux } from "@/components/icons";
13+
import { SummaryStatistics } from "@/app/compatibility/avm2/report_utils";
1314

1415
export const repository = { owner: "ruffle-rs", repo: "ruffle" };
1516

@@ -200,6 +201,6 @@ export const allLinks: DownloadLink[] = [
200201
].flat();
201202

202203
export interface AVM2Report {
203-
summary: object,
204+
summary: SummaryStatistics,
204205
classes: object,
205206
}

0 commit comments

Comments
 (0)