From 1bf410f0fc37052c25debd2bcadb3f3d9fce952f Mon Sep 17 00:00:00 2001 From: BigDonRob <71261864+BigDonRob@users.noreply.github.com> Date: Wed, 11 Mar 2026 17:18:30 -0500 Subject: [PATCH 1/6] RP Tab Preview Section --- AutoCR/js/overview.js | 1 + AutoCR/js/rp-preview.js | 114 ++++++++++++++++++++++++++++++++++++++++ 2 files changed, 115 insertions(+) create mode 100644 AutoCR/js/rp-preview.js diff --git a/AutoCR/js/overview.js b/AutoCR/js/overview.js index e7162ca..2bb7b51 100644 --- a/AutoCR/js/overview.js +++ b/AutoCR/js/overview.js @@ -1620,6 +1620,7 @@ function RichPresenceOverview() + ); } diff --git a/AutoCR/js/rp-preview.js b/AutoCR/js/rp-preview.js new file mode 100644 index 0000000..a6bf2c2 --- /dev/null +++ b/AutoCR/js/rp-preview.js @@ -0,0 +1,114 @@ +// ─── Rich Presence Preview ──────────────────────────────────────────────────── +// Drop this file into the project and add one line to RichPresenceOverview: +// +// +// +// Place it immediately above the existing line. +// No other changes needed. + +function RichPresencePreview() +{ + // ── Placeholder labels for numeric / time macros ────────────────────────── + + function macroPlaceholder(fmt) + { + if (!fmt) return '(CHAR)'; // null = ASCIIChar / UnicodeChar + + if (fmt.category === 'time') return '(TIME)'; + + switch (fmt.type) + { + case 'VALUE': return '(INT)'; + case 'UNSIGNED': return '(UINT)'; + case 'SCORE': + case 'POINTS': return '(SCORE)'; + case 'TENS': return '(INT0)'; + case 'HUNDREDS': return '(INT00)'; + case 'THOUSANDS': return '(INT000)'; + case 'FIXED1': return '(DEC.1)'; + case 'FIXED2': return '(DEC.2)'; + case 'FIXED3': return '(DEC.3)'; + default: return '(' + fmt.name + ')'; // Float1–Float6 etc. + } + } + + // ── Resolve one display string ──────────────────────────────────────────── + + function resolveRPString(str) + { + return str.replace(/@([ _a-zA-Z][ _a-zA-Z0-9]*)\((.+?)\)/g, (match, rawName) => + { + const name = rawName.trim(); + + // Lookup table? + if (current.rp.lookups.has(name)) + { + const ranges = current.rp.lookups.get(name); + // Prefer non-fallback (*) entries so we show real label text. + const pool = ranges.filter(r => !r.isFallback()); + const source = pool.length ? pool : ranges; + return (source[Math.floor(Math.random() * source.length)]?.value ?? ''); + } + + // Known macro (built-in or declared Format:)? + if (Object.prototype.hasOwnProperty.call(current.rp.macros, name)) + return macroPlaceholder(current.rp.macros[name]); + + // Completely unknown — leave raw so it's obvious. + return match; + }); + } + + // ── Partition display entries into dynamic vs. static ───────────────────── + // A display string is "dynamic" if it contains at least one @Macro() call. + // Static strings are fixed — they show exactly once and are never rerolled. + + const MACRO_RE = /@[ _a-zA-Z][ _a-zA-Z0-9]*\(.+?\)/; + + const display = current.rp ? current.rp.display : []; + const dynamicPool = display.filter(d => MACRO_RE.test(d.string)); + const staticLines = display.filter(d => !MACRO_RE.test(d.string)).map(d => d.string); + + // ── Generate 10 lines from the dynamic pool ─────────────────────────────── + + function generateLines() + { + if (!dynamicPool.length) return []; + return Array.from({ length: 10 }, () => { + const entry = dynamicPool[Math.floor(Math.random() * dynamicPool.length)]; + return resolveRPString(entry.string); + }); + } + + // ── Component state ─────────────────────────────────────────────────────── + + const [lines, setLines] = React.useState(() => generateLines()); + + if (!current.rp || !display.length) return null; + + function PreviewLine({ text }) + { + return text + ? <>{text} + : (empty string); + } + + return ( +
+

Preview

+
    + {lines.map((line, i) => ( +
  • + ))} + {staticLines.map((line, i) => ( +
  • + +
  • + ))} +
+ {dynamicPool.length > 0 && + + } +
+ ); +} From 8161146259f80da955c742db22abc0c06b355855 Mon Sep 17 00:00:00 2001 From: BigDonRob <71261864+BigDonRob@users.noreply.github.com> Date: Wed, 11 Mar 2026 17:20:03 -0500 Subject: [PATCH 2/6] Update rp-preview.js --- AutoCR/js/rp-preview.js | 8 -------- 1 file changed, 8 deletions(-) diff --git a/AutoCR/js/rp-preview.js b/AutoCR/js/rp-preview.js index a6bf2c2..cfb383f 100644 --- a/AutoCR/js/rp-preview.js +++ b/AutoCR/js/rp-preview.js @@ -1,11 +1,3 @@ -// ─── Rich Presence Preview ──────────────────────────────────────────────────── -// Drop this file into the project and add one line to RichPresenceOverview: -// -// -// -// Place it immediately above the existing line. -// No other changes needed. - function RichPresencePreview() { // ── Placeholder labels for numeric / time macros ────────────────────────── From 009b42883411fdeccbcd19792387d4424472f498 Mon Sep 17 00:00:00 2001 From: BigDonRob <71261864+BigDonRob@users.noreply.github.com> Date: Thu, 12 Mar 2026 01:16:48 -0500 Subject: [PATCH 3/6] Add files via upload --- rp-preview.js | 123 ++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 123 insertions(+) create mode 100644 rp-preview.js diff --git a/rp-preview.js b/rp-preview.js new file mode 100644 index 0000000..252dee8 --- /dev/null +++ b/rp-preview.js @@ -0,0 +1,123 @@ +// ─── Rich Presence Preview ──────────────────────────────────────────────────── +// Drop this file into the project and add one line to RichPresenceOverview: +// +// +// +// Place it immediately above the existing line. +// No other changes needed. + +function RichPresencePreview() +{ + // ── Placeholder labels for numeric / time macros ────────────────────────── + + function macroPlaceholder(fmt) + { + if (!fmt) return '(CHAR)'; // null = ASCIIChar / UnicodeChar + + if (fmt.category === 'time') return '(TIME)'; + + switch (fmt.type) + { + case 'VALUE': return '(INT)'; + case 'UNSIGNED': return '(UINT)'; + case 'SCORE': + case 'POINTS': return '(SCORE)'; + case 'TENS': return '(INT0)'; + case 'HUNDREDS': return '(INT00)'; + case 'THOUSANDS': return '(INT000)'; + case 'FIXED1': return '(DEC.1)'; + case 'FIXED2': return '(DEC.2)'; + case 'FIXED3': return '(DEC.3)'; + default: return '(' + fmt.name + ')'; // Float1–Float6 etc. + } + } + + // ── Resolve one display string ──────────────────────────────────────────── + + function resolveRPString(str) + { + return str.replace(/@([ _a-zA-Z][ _a-zA-Z0-9]*)\((.+?)\)/g, (match, rawName) => + { + const name = rawName.trim(); + + // Lookup table? + if (current.rp.lookups.has(name)) + { + const ranges = current.rp.lookups.get(name); + // Prefer non-fallback (*) entries so we show real label text. + const pool = ranges.filter(r => !r.isFallback()); + const source = pool.length ? pool : ranges; + return (source[Math.floor(Math.random() * source.length)]?.value ?? ''); + } + + // Known macro (built-in or declared Format:)? + if (Object.prototype.hasOwnProperty.call(current.rp.macros, name)) + return macroPlaceholder(current.rp.macros[name]); + + // Completely unknown — leave raw so it's obvious. + return match; + }); + } + + // ── Partition display entries into dynamic vs. static ───────────────────── + // A display string is "dynamic" if it contains at least one @Macro() call. + // Static strings are fixed — they show exactly once and are never rerolled. + + const MACRO_RE = /@[ _a-zA-Z][ _a-zA-Z0-9]*\(.+?\)/; + + const display = current.rp ? current.rp.display : []; + const dynamicPool = display.filter(d => MACRO_RE.test(d.string)); + const staticLines = display.filter(d => !MACRO_RE.test(d.string)).map(d => d.string); + + // ── Generate 10 lines from the dynamic pool ─────────────────────────────── + + function generateLines() + { + if (!dynamicPool.length) return []; + return Array.from({ length: 10 }, () => { + const entry = dynamicPool[Math.floor(Math.random() * dynamicPool.length)]; + return resolveRPString(entry.string); + }); + } + + // ── Component state ─────────────────────────────────────────────────────── + + const [lines, setLines] = React.useState(() => generateLines()); + + if (!current.rp || !display.length) return null; + + function PreviewLine({ text }) + { + return text + ? <>{text} + : (empty string); + } + + return ( +
+

Preview

+ {staticLines.length > 0 && ( +
+ + Static Lines ({staticLines.length}) + +
    + {staticLines.map((line, i) => ( +
  • + +
  • + ))} +
+
+ )} + {dynamicPool.length > 0 && <> +
    + {lines.map((line, i) => ( +
  • + ))} +
+ + } +
+ ); +} From 9993761986d743bd233bd77b370902aa7d0e735c Mon Sep 17 00:00:00 2001 From: BigDonRob <71261864+BigDonRob@users.noreply.github.com> Date: Thu, 12 Mar 2026 01:20:30 -0500 Subject: [PATCH 4/6] Delete rp-preview.js --- rp-preview.js | 123 -------------------------------------------------- 1 file changed, 123 deletions(-) delete mode 100644 rp-preview.js diff --git a/rp-preview.js b/rp-preview.js deleted file mode 100644 index 252dee8..0000000 --- a/rp-preview.js +++ /dev/null @@ -1,123 +0,0 @@ -// ─── Rich Presence Preview ──────────────────────────────────────────────────── -// Drop this file into the project and add one line to RichPresenceOverview: -// -// -// -// Place it immediately above the existing line. -// No other changes needed. - -function RichPresencePreview() -{ - // ── Placeholder labels for numeric / time macros ────────────────────────── - - function macroPlaceholder(fmt) - { - if (!fmt) return '(CHAR)'; // null = ASCIIChar / UnicodeChar - - if (fmt.category === 'time') return '(TIME)'; - - switch (fmt.type) - { - case 'VALUE': return '(INT)'; - case 'UNSIGNED': return '(UINT)'; - case 'SCORE': - case 'POINTS': return '(SCORE)'; - case 'TENS': return '(INT0)'; - case 'HUNDREDS': return '(INT00)'; - case 'THOUSANDS': return '(INT000)'; - case 'FIXED1': return '(DEC.1)'; - case 'FIXED2': return '(DEC.2)'; - case 'FIXED3': return '(DEC.3)'; - default: return '(' + fmt.name + ')'; // Float1–Float6 etc. - } - } - - // ── Resolve one display string ──────────────────────────────────────────── - - function resolveRPString(str) - { - return str.replace(/@([ _a-zA-Z][ _a-zA-Z0-9]*)\((.+?)\)/g, (match, rawName) => - { - const name = rawName.trim(); - - // Lookup table? - if (current.rp.lookups.has(name)) - { - const ranges = current.rp.lookups.get(name); - // Prefer non-fallback (*) entries so we show real label text. - const pool = ranges.filter(r => !r.isFallback()); - const source = pool.length ? pool : ranges; - return (source[Math.floor(Math.random() * source.length)]?.value ?? ''); - } - - // Known macro (built-in or declared Format:)? - if (Object.prototype.hasOwnProperty.call(current.rp.macros, name)) - return macroPlaceholder(current.rp.macros[name]); - - // Completely unknown — leave raw so it's obvious. - return match; - }); - } - - // ── Partition display entries into dynamic vs. static ───────────────────── - // A display string is "dynamic" if it contains at least one @Macro() call. - // Static strings are fixed — they show exactly once and are never rerolled. - - const MACRO_RE = /@[ _a-zA-Z][ _a-zA-Z0-9]*\(.+?\)/; - - const display = current.rp ? current.rp.display : []; - const dynamicPool = display.filter(d => MACRO_RE.test(d.string)); - const staticLines = display.filter(d => !MACRO_RE.test(d.string)).map(d => d.string); - - // ── Generate 10 lines from the dynamic pool ─────────────────────────────── - - function generateLines() - { - if (!dynamicPool.length) return []; - return Array.from({ length: 10 }, () => { - const entry = dynamicPool[Math.floor(Math.random() * dynamicPool.length)]; - return resolveRPString(entry.string); - }); - } - - // ── Component state ─────────────────────────────────────────────────────── - - const [lines, setLines] = React.useState(() => generateLines()); - - if (!current.rp || !display.length) return null; - - function PreviewLine({ text }) - { - return text - ? <>{text} - : (empty string); - } - - return ( -
-

Preview

- {staticLines.length > 0 && ( -
- - Static Lines ({staticLines.length}) - -
    - {staticLines.map((line, i) => ( -
  • - -
  • - ))} -
-
- )} - {dynamicPool.length > 0 && <> -
    - {lines.map((line, i) => ( -
  • - ))} -
- - } -
- ); -} From 970759dc16cbe7261828ab6629ccc0213664fc91 Mon Sep 17 00:00:00 2001 From: BigDonRob <71261864+BigDonRob@users.noreply.github.com> Date: Thu, 12 Mar 2026 01:20:49 -0500 Subject: [PATCH 5/6] Add files via upload --- AutoCR/js/rp-preview.js | 41 +++++++++++++++++++++++++++++------------ 1 file changed, 29 insertions(+), 12 deletions(-) diff --git a/AutoCR/js/rp-preview.js b/AutoCR/js/rp-preview.js index cfb383f..252dee8 100644 --- a/AutoCR/js/rp-preview.js +++ b/AutoCR/js/rp-preview.js @@ -1,3 +1,11 @@ +// ─── Rich Presence Preview ──────────────────────────────────────────────────── +// Drop this file into the project and add one line to RichPresenceOverview: +// +// +// +// Place it immediately above the existing line. +// No other changes needed. + function RichPresencePreview() { // ── Placeholder labels for numeric / time macros ────────────────────────── @@ -88,19 +96,28 @@ function RichPresencePreview() return (

Preview

-
    - {lines.map((line, i) => ( -
  • - ))} - {staticLines.map((line, i) => ( -
  • - -
  • - ))} -
- {dynamicPool.length > 0 && + {staticLines.length > 0 && ( +
+ + Static Lines ({staticLines.length}) + +
    + {staticLines.map((line, i) => ( +
  • + +
  • + ))} +
+
+ )} + {dynamicPool.length > 0 && <> +
    + {lines.map((line, i) => ( +
  • + ))} +
- } + }
); } From b1b32f6d8d249bddf363c50ec32aef1912147174 Mon Sep 17 00:00:00 2001 From: BigDonRob <71261864+BigDonRob@users.noreply.github.com> Date: Thu, 12 Mar 2026 15:34:20 -0500 Subject: [PATCH 6/6] Update rp-preview.js --- AutoCR/js/rp-preview.js | 9 --------- 1 file changed, 9 deletions(-) diff --git a/AutoCR/js/rp-preview.js b/AutoCR/js/rp-preview.js index 252dee8..3e7b0a4 100644 --- a/AutoCR/js/rp-preview.js +++ b/AutoCR/js/rp-preview.js @@ -1,11 +1,3 @@ -// ─── Rich Presence Preview ──────────────────────────────────────────────────── -// Drop this file into the project and add one line to RichPresenceOverview: -// -// -// -// Place it immediately above the existing line. -// No other changes needed. - function RichPresencePreview() { // ── Placeholder labels for numeric / time macros ────────────────────────── @@ -60,7 +52,6 @@ function RichPresencePreview() } // ── Partition display entries into dynamic vs. static ───────────────────── - // A display string is "dynamic" if it contains at least one @Macro() call. // Static strings are fixed — they show exactly once and are never rerolled. const MACRO_RE = /@[ _a-zA-Z][ _a-zA-Z0-9]*\(.+?\)/;