Improve prettier formatting

This commit is contained in:
Jordan Eldredge 2021-07-31 14:03:32 -07:00
parent 24788be589
commit 608672ff90
19 changed files with 4188 additions and 550 deletions

View file

@ -10,8 +10,7 @@ new Webamp({
// NOTE: Your audio file must be served from the same domain as your HTML
// file, or served with permissive CORS HTTP headers:
// https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS
url:
"https://cdn.jsdelivr.net/gh/captbaritone/webamp@43434d82cfe0e37286dbbe0666072dc3190a83bc/mp3/llama-2.91.mp3",
url: "https://cdn.jsdelivr.net/gh/captbaritone/webamp@43434d82cfe0e37286dbbe0666072dc3190a83bc/mp3/llama-2.91.mp3",
duration: 5.322286,
},
],

View file

@ -10,8 +10,7 @@ new Webamp({
// NOTE: Your audio file must be served from the same domain as your HTML
// file, or served with permissive CORS HTTP headers:
// https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS
url:
"https://cdn.jsdelivr.net/gh/captbaritone/webamp@43434d82cfe0e37286dbbe0666072dc3190a83bc/mp3/llama-2.91.mp3",
url: "https://cdn.jsdelivr.net/gh/captbaritone/webamp@43434d82cfe0e37286dbbe0666072dc3190a83bc/mp3/llama-2.91.mp3",
duration: 5.322286,
},
],

View file

@ -90,14 +90,12 @@ async function main() {
});
await testPageAndRetry({
name: "Regular",
url:
"https://archive.org/details/78_mambo-no.-5_perez-prado-and-his-orchestra-d.-perez-prado_gbia0009774b",
url: "https://archive.org/details/78_mambo-no.-5_perez-prado-and-his-orchestra-d.-perez-prado_gbia0009774b",
firstTrackText: "Mambo No. 5",
});
await testPageAndRetry({
name: "Samples Only",
url:
"https://archive.org/details/lp_smokey-and-the-bandit-2-original-soundtrac_various-brenda-lee-burt-reynolds-don-willi",
url: "https://archive.org/details/lp_smokey-and-the-bandit-2-original-soundtrac_various-brenda-lee-burt-reynolds-don-willi",
firstTrackText: "Texas Bound And Flyin",
});
await testPageAndRetry({
@ -107,8 +105,7 @@ async function main() {
});
await testPageAndRetry({
name: "Another",
url:
"https://archive.org/details/78_house-of-the-rising-sun_josh-white-and-his-guitar_gbia0001628b",
url: "https://archive.org/details/78_house-of-the-rising-sun_josh-white-and-his-guitar_gbia0001628b",
firstTrackText: "House Of The Rising Sun",
});
}

View file

@ -25,7 +25,8 @@ export async function setReadmeForSkin(skin: SkinModel): Promise<void> {
const IS_README = /(file_id\.diz)|(\.txt)$/i;
// Skinning Updates.txt ?
const IS_NOT_README = /(genex\.txt)|(genexinfo\.txt)|(gen_gslyrics\.txt)|(region\.txt)|(pledit\.txt)|(viscolor\.txt)|(winampmb\.txt)|("gen_ex help\.txt)|(mbinner\.txt)$/i;
const IS_NOT_README =
/(genex\.txt)|(genexinfo\.txt)|(gen_gslyrics\.txt)|(region\.txt)|(pledit\.txt)|(viscolor\.txt)|(winampmb\.txt)|("gen_ex help\.txt)|(mbinner\.txt)$/i;
export async function getReadme(zip: JSZip): Promise<string | null> {
const readmeFiles = zip.filter((filePath) => {

View file

@ -72,24 +72,20 @@ export function parse(data: ArrayBuffer): ParsedMaki {
}
});
const resolvedBindings = bindings.map(
(binding): Binding => {
return Object.assign({}, binding, {
commandOffset: offsetToCommand[binding.binaryOffset],
const resolvedBindings = bindings.map((binding): Binding => {
return Object.assign({}, binding, {
commandOffset: offsetToCommand[binding.binaryOffset],
});
});
const resolvedCommands = commands.map((command): Command => {
if (command.argType === "COMMAND_OFFSET") {
return Object.assign({}, command, {
arg: offsetToCommand[command.arg],
});
}
);
const resolvedCommands = commands.map(
(command): Command => {
if (command.argType === "COMMAND_OFFSET") {
return Object.assign({}, command, {
arg: offsetToCommand[command.arg],
});
}
return command;
}
);
return command;
});
return {
classes,
methods,

View file

@ -87,8 +87,9 @@ for (const cls of classes) {
const className = document.createElement("td");
className.classList.add("class-name");
const totalCount = cls.methods.filter((m) => !m.hook).length;
const foundCount = cls.methods.filter((m) => !m.hook && m.status === "found")
.length;
const foundCount = cls.methods.filter(
(m) => !m.hook && m.status === "found"
).length;
total += totalCount;
found += foundCount;
className.innerText = `${cls.name} (${foundCount}/${totalCount})`;

View file

@ -79,18 +79,7 @@ export function glTransformImage(image: HTMLImageElement): string {
gl.bufferData(
gl.ARRAY_BUFFER,
new Float32Array([
0.0,
0.0,
1.0,
0.0,
0.0,
1.0,
0.0,
1.0,
1.0,
0.0,
1.0,
1.0,
0.0, 0.0, 1.0, 0.0, 0.0, 1.0, 0.0, 1.0, 1.0, 0.0, 1.0, 1.0,
]),
gl.STATIC_DRAW
);

File diff suppressed because one or more lines are too long

View file

@ -12,9 +12,10 @@ function parseFile(filePath) {
const objects = {};
lines.forEach((line, lineNumber) => {
const classDefinitionMatch = /\s*extern\s+class\s*\@\{(........\s?-\s?....\s?-\s?....\s?-\s?....\s?-\s?............)\}\s*\@\s*(.*?)\s+(.*?);/.exec(
line
);
const classDefinitionMatch =
/\s*extern\s+class\s*\@\{(........\s?-\s?....\s?-\s?....\s?-\s?....\s?-\s?............)\}\s*\@\s*(.*?)\s+(.*?);/.exec(
line
);
if (classDefinitionMatch) {
const id = classDefinitionMatch[1].replace(/[-\s]/g, "");
const parent = classDefinitionMatch[2];

View file

@ -308,16 +308,8 @@ function animatedLayerOffsetAndSize(
}
function AnimatedLayer({ makiObject }) {
const {
id,
js_assets,
x,
y,
w,
h,
framewidth,
frameheight,
} = makiObject.attributes;
const { id, js_assets, x, y, w, h, framewidth, frameheight } =
makiObject.attributes;
const img = js_assets.image;
if (img == null) {
console.warn("Got an AnimatedLayer without an image. Rendering null", id);
@ -334,14 +326,10 @@ function AnimatedLayer({ makiObject }) {
style.top = Number(y);
}
const {
offset: backgroundPositionX,
size: width,
} = animatedLayerOffsetAndSize(frameNum, framewidth, w, img.w, img.x);
const {
offset: backgroundPositionY,
size: height,
} = animatedLayerOffsetAndSize(frameNum, frameheight, h, img.h, img.y);
const { offset: backgroundPositionX, size: width } =
animatedLayerOffsetAndSize(frameNum, framewidth, w, img.w, img.x);
const { offset: backgroundPositionY, size: height } =
animatedLayerOffsetAndSize(frameNum, frameheight, h, img.h, img.y);
style = { ...style, width, height, backgroundPositionX, backgroundPositionY };
if (img.imgUrl !== undefined) {

View file

@ -1,7 +1,7 @@
const COMMANDS = {
"1": { name: "push", short: "", arg: "var", in: "0", out: "1" },
"2": { name: "pop", short: "pop", in: "1", out: "0" },
"3": {
1: { name: "push", short: "", arg: "var", in: "0", out: "1" },
2: { name: "pop", short: "pop", in: "1", out: "0" },
3: {
name: "popTo",
short: "popTo",
arg: "var",
@ -11,21 +11,21 @@ const COMMANDS = {
// argument but it is not visible to the parser because popTo
// is always at the start of a function
},
"8": { name: "eq", short: "==", in: "2", out: "1" },
"9": { name: "heq", short: "!=", in: "2", out: "1" },
"10": { name: "gt", short: ">", in: "2", out: "1" },
"11": { name: "gtq", short: ">=", in: "2", out: "1" },
"12": { name: "le", short: "<", in: "2", out: "1" },
"13": { name: "leq", short: "<=", in: "2", out: "1" },
8: { name: "eq", short: "==", in: "2", out: "1" },
9: { name: "heq", short: "!=", in: "2", out: "1" },
10: { name: "gt", short: ">", in: "2", out: "1" },
11: { name: "gtq", short: ">=", in: "2", out: "1" },
12: { name: "le", short: "<", in: "2", out: "1" },
13: { name: "leq", short: "<=", in: "2", out: "1" },
"16": { name: "jumpIf", short: "if", arg: "line", in: "1", out: "0" },
"17": { name: "jumpIfNot", arg: "line", in: "1", out: "0" },
"18": { name: "jump", arg: "line", in: "0", out: "0" },
16: { name: "jumpIf", short: "if", arg: "line", in: "1", out: "0" },
17: { name: "jumpIfNot", arg: "line", in: "1", out: "0" },
18: { name: "jump", arg: "line", in: "0", out: "0" },
"24": { name: "call", arg: "objFunc", in: "0", out: "1" },
"25": { name: "callGlobal", arg: "func", in: "0", out: "1" },
24: { name: "call", arg: "objFunc", in: "0", out: "1" },
25: { name: "callGlobal", arg: "func", in: "0", out: "1" },
"33": {
33: {
name: "ret",
short: "return",
in: "1",
@ -33,47 +33,47 @@ const COMMANDS = {
// pops one argument from the stack, which ist not the full truth.
},
"40": { name: "complete", short: "complete", in: "0", out: "0" },
40: { name: "complete", short: "complete", in: "0", out: "0" },
"48": { name: "mov", short: "=", in: "2", out: "1" },
48: { name: "mov", short: "=", in: "2", out: "1" },
"56": { name: "postinc", short: "++", post: 1, in: "1", out: "1" },
"57": { name: "postdec", short: "--", post: 1, in: "1", out: "1" },
"58": { name: "preinc", short: "++", in: "1", out: "1" },
"59": { name: "predec", short: "--", in: "1", out: "1" },
56: { name: "postinc", short: "++", post: 1, in: "1", out: "1" },
57: { name: "postdec", short: "--", post: 1, in: "1", out: "1" },
58: { name: "preinc", short: "++", in: "1", out: "1" },
59: { name: "predec", short: "--", in: "1", out: "1" },
"64": { name: "add", short: "+", in: "2", out: "1" },
"65": { name: "sub", short: "-", in: "2", out: "1" },
"66": { name: "mul", short: "*", in: "2", out: "1" },
"67": { name: "div", short: "/", in: "2", out: "1" },
"68": { name: "mod", short: "%", in: "2", out: "1" },
64: { name: "add", short: "+", in: "2", out: "1" },
65: { name: "sub", short: "-", in: "2", out: "1" },
66: { name: "mul", short: "*", in: "2", out: "1" },
67: { name: "div", short: "/", in: "2", out: "1" },
68: { name: "mod", short: "%", in: "2", out: "1" },
"72": { name: "and", short: "&", in: "2", out: "1" },
"73": { name: "or", short: "|", in: "2", out: "1" },
"74": { name: "not", short: "!", in: "1", out: "1" },
"76": { name: "negative", short: "-", in: "1", out: "1" },
72: { name: "and", short: "&", in: "2", out: "1" },
73: { name: "or", short: "|", in: "2", out: "1" },
74: { name: "not", short: "!", in: "1", out: "1" },
76: { name: "negative", short: "-", in: "1", out: "1" },
"80": { name: "logAnd", short: "&&", in: "2", out: "1" },
"81": { name: "logOr", short: "||", in: "2", out: "1" },
80: { name: "logAnd", short: "&&", in: "2", out: "1" },
81: { name: "logOr", short: "||", in: "2", out: "1" },
// The decompiler has these next two as 90 and 91.
"88": { name: "lshift", short: "<<", in: "2", out: "1" },
"89": { name: "rshift", short: ">>", in: "2", out: "1" },
88: { name: "lshift", short: "<<", in: "2", out: "1" },
89: { name: "rshift", short: ">>", in: "2", out: "1" },
"90": { name: "lshift", short: "<<", in: "2", out: "1" },
"91": { name: "rshift", short: ">>", in: "2", out: "1" },
90: { name: "lshift", short: "<<", in: "2", out: "1" },
91: { name: "rshift", short: ">>", in: "2", out: "1" },
"96": { name: "new", arg: "obj", in: "0", out: "1" },
"97": { name: "delete", short: "delete", in: "1", out: "1" },
96: { name: "new", arg: "obj", in: "0", out: "1" },
97: { name: "delete", short: "delete", in: "1", out: "1" },
"112": { name: "strangeCall", arg: "objFunc", in: "0", out: "1" },
112: { name: "strangeCall", arg: "objFunc", in: "0", out: "1" },
// Mystery opcode
// "255": { name: "MYSTERY", short: "WAT", in: "0", out: "0" },
"300": { name: "blockStart", short: "{", in: "0", out: "0" },
300: { name: "blockStart", short: "{", in: "0", out: "0" },
"301": { name: "blockEnd", short: "}", in: "0", out: "0" },
301: { name: "blockEnd", short: "}", in: "0", out: "0" },
};
module.exports = { COMMANDS };

View file

@ -12,9 +12,10 @@ function parseFile(filePath) {
const objects = {};
lines.forEach((line, lineNumber) => {
const classDefinitionMatch = /\s*extern\s+class\s*\@\{(........\s?-\s?....\s?-\s?....\s?-\s?....\s?-\s?............)\}\s*\@\s*(.*?)\s+(.*?);/.exec(
line
);
const classDefinitionMatch =
/\s*extern\s+class\s*\@\{(........\s?-\s?....\s?-\s?....\s?-\s?....\s?-\s?............)\}\s*\@\s*(.*?)\s+(.*?);/.exec(
line
);
if (classDefinitionMatch) {
const id = classDefinitionMatch[1].replace(/[-\s]/g, "");
const parent = classDefinitionMatch[2];

View file

@ -78,14 +78,8 @@ class AnimatedLayer extends Layer {
}
_initializeEnd(): number {
const {
end,
js_assets,
frameheight,
framewidth,
w,
h,
} = this._typedAttributes;
const { end, js_assets, frameheight, framewidth, w, h } =
this._typedAttributes;
if (end != null) {
return getNumber(end, 0);

File diff suppressed because one or more lines are too long

View file

@ -18,11 +18,10 @@ export default function ContextMenuWraper({
renderContents,
...passThroughProps
}: Props) {
const [openPosition, setOpenPosition] =
useState<{
x: number;
y: number;
} | null>(null);
const [openPosition, setOpenPosition] = useState<{
x: number;
y: number;
} | null>(null);
const closeMenu = useCallback(() => {
setOpenPosition(null);

View file

@ -35,8 +35,9 @@ function Visualizer({ analyser, width, height }: Props) {
const isEnabledVisualizer = visualizerStyle === VISUALIZERS.MILKDROP;
const canvasRef = useRef(null);
const [visualizer, setVisualizer] =
useState<ButterchurnVisualizer | null>(null);
const [visualizer, setVisualizer] = useState<ButterchurnVisualizer | null>(
null
);
// Initialize the visualizer
useEffect(() => {

View file

@ -17,8 +17,9 @@ interface Props {
function ResizeTarget(props: Props) {
const { currentSize, setWindowSize, widthOnly, ...passThroughProps } = props;
const [mouseDown, setMouseDown] = useState(false);
const [mouseStart, setMouseStart] =
useState<null | { x: number; y: number }>(null);
const [mouseStart, setMouseStart] = useState<null | { x: number; y: number }>(
null
);
useEffect(() => {
if (mouseDown === false || mouseStart == null) {
return;

View file

@ -36,8 +36,9 @@ function useHandleMouseDown(propsWindows: {
const browserWindowSize = useTypedSelector(Selectors.getBrowserWindowSize);
const updateWindowPositions = useActionCreator(Actions.updateWindowPositions);
const [draggingState, setDraggingState] =
useState<DraggingState | null>(null);
const [draggingState, setDraggingState] = useState<DraggingState | null>(
null
);
// When the mouse is down, attach a listener to track mouse move events.
useEffect(() => {

View file

@ -196,10 +196,8 @@ class Webamp {
// TODO: Make this much cleaner
let convertPreset = null;
if (__butterchurnOptions != null) {
const {
importConvertPreset,
presetConverterEndpoint,
} = __butterchurnOptions;
const { importConvertPreset, presetConverterEndpoint } =
__butterchurnOptions;
if (importConvertPreset != null && presetConverterEndpoint != null) {
convertPreset = async (file: File): Promise<Object> => {