Main Restorations Software Audio/Jukebox/MP3 Everything Else Buy/Sell/Trade
Project Announcements Monitor/Video GroovyMAME Merit/JVL Touchscreen Meet Up Retail Vendors
Driving & Racing Woodworking Software Support Forums Consoles Project Arcade Reviews
Automated Projects Artwork Frontend Support Forums Pinball Forum Discussion Old Boards
Raspberry Pi & Dev Board controls.dat Linux Miscellaneous Arcade Wiki Discussion Old Archives
Lightguns Arcade1Up Try the site in https mode Site News

Unread posts | New Replies | Recent posts | Rules | Chatroom | Wiki | File Repository | RSS | Submit news

  

Author Topic: CRT-MAME-ARCADE-2D Perceptual Sync 0.168 (MAJ V2.1) Auto_sync, Switchres CRT  (Read 12077 times)

0 Members and 2 Guests are viewing this topic.

Olivcade

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 13
  • Last login:Yesterday at 05:47:43 pm
  • I want to build my own arcade controls!
Download on GitHub:

https://github.com/HardCade/hardcade/releases

================================================================================
CRT-MAME-ARCADE-2D Perceptual Sync 0.168 V2.1
================================================================================

Development Version — December 2025
© 2025 Hardcade — Olivier Mileo

================================================================================
DESCRIPTION
================================================================================

CRT-MAME-ARCADE-2D Perceptual Sync is a specialized version of MAME 0.168 optimized for
2D arcade on 15 kHz CRT monitors under WINXP-32 with ATI or NVIDIA graphics card +
crt_emu drivers or soft15khz.

Three complementary approaches for CRT video synchronization and selection are
offered for total control of your display:


  INI Option auto_refresh_sync = 0

→ MANUAL PERFECT SYNC MODE: Precise tuning of the Refresh Rate Slider up to
  4 decimals (±0.0001 Hz) for total timing control. Ideal for purists
  who want to calibrate each game individually and achieve strictly
  authentic hardware timing with quasi-invisible fixed tearing.


  INI Option auto_refresh_sync = 1

→ AUTOMATIC PERFECT SYNC MODE (DDRAW): The real CRT refresh rate is measured automatically
  at game launch, after the video screen has produced a sufficient number of stable frames.
  The calculated value is applied dynamically to the video engine and user slider in memory
  only (no writing to CFG file). Ultra-smooth scrolling even on atypical modelines
  (57.45878 Hz, 58.25494 Hz, 60.61575 Hz…)


  HARDCADE SWITCHRES CRT (Built-in)

→ OPTIMIZED 15KHZ MODE SELECTION: A deep rewrite of the DirectDraw algorithm.
  Unlike standard MAME, this version prioritizes fluidity (Hz) over exact
  resolution through a ±24 line vertical tolerance. It allows using your best
  240p modelines for the entire catalog (224p, 239p, 256p...) to guarantee
  always complete, centered display, and perfect vertical synchronization without stuttering.


Choose your philosophy: absolute manual control or automatic fluidity without effort.
Both methods eliminate mobile tearing and guarantee an optimal CRT experience.
If your modelines are close to the original game timings, activating this
option will offer you the ultimate experience.

If your modelines are far from the original timings, you will only perceive a slight
increase or decrease in game speed, while maintaining perfect timing in terms
of smooth scrolling, tearing elimination, and overall visual fidelity.


// PHILOSOPHY:

Why "CRT-MAME-ARCADE-2D Perceptual Sync" when other emulators like GROOVYMAME already exist?

Whether you emulate in 15khz with recent or old hardware, synchronization between emulation and display
is never 100% perfect in practice. Even if the modeline is calculated to match exactly the original game frequency,
sometimes even respecting the precise values of MAME video drivers, the timing interpreted by your hardware will be more or less
distant from the timing it should actually adopt to be perfectly aligned with the game timing,

there are always discrepancies (large or tiny) due to:

- Hardware tolerances (CRT monitor, graphics card)
- Imprecisions in clocks and oscillators
- Rounding in calculations, operating system

These discrepancies are random depending on your hardware even if you use THE perfect modeline that mathematically respects
the values imposed by the MAME game system, despite that the synchronization drifts more or less over time,
creating this tearing line that "walks" slowly or quickly on the screen - it can take several minutes or even dozens of
minutes to cross the entire screen. This is generally considered acceptable because:

The line moves so slowly that it's hardly noticeable in-game
It's infinitely better than classic tearing with multiple lines moving quickly
By adding V-sync we make it disappear at the cost of one frame of input lag, but if our modeline is too far
from perfect timing we will get stuttering scrolling. Some users still refine their modelines or adjust
slightly the refresh rate to minimize this phenomenon, but micro-tearing often remains present.


Perceptual Sync is the philosophy of a CRT display mode that prioritizes perceived visual stability
(zero mobile tearing, smooth scrolling) rather than absolute accuracy of theoretical refresh.
it's a CRT display doctrine based on human perception, not mathematical perfection.

Perceptual Sync prioritizes perceived fluidity and CRT image stability.
Slight speed variations (≤0.0001 to 0.5 Hz) are voluntarily accepted to eliminate mobile tearing.

🔴 What Perceptual Sync DOES NOT TRY to do

❌ Be mathematically exact
❌ Be "perfect frame"
❌ Imitate GroovyMAME
❌ Convince theoretical purists

👉 It assumes its choices.

In other words: "What the eye sees is more important than what the numbers say."

// Fundamental principles:

- Refresh DOES NOT need to be exact if we tolerate a variation of: ±0.0001 to 0.5 Hz (configurable)

👉 Result: imperceptibly different speed, stable image.

// Absolute priority to tearing stability:

- Tearing allowed or not with Vsync enabled

But: fixed, stuck out of visible area if possible or always in the same place

👉 Immobile tearing is psychologically invisible.

// No chase for "perfect modeline":

- No dynamic calculation

- No mode creation

- No real-time adjustment

👉 Once the mode is chosen → and the refresh rate slider refined, don't touch it anymore!

// Player takes priority over chronometer:

- Emulation respects gameplay

- Not the atomic clock

- No perceptible drift in game

================================================================================
MAIN FEATURES
================================================================================

INPUT & LATENCY
───────────────
  • Late Input Polling — Input lag reduction
  • Non-buffered DirectInput — Direct polling of peripheral state
  • GPU frame queue suppression (D3D9)

VIDEO & SYNCHRONIZATION
───────────────────────

  • Auto Refresh Syncro, real refresh rate calculation, adapts AUTOMATICALLY to real CRT refresh
  • Screen Refresh Rate slider save in CFG + 4 decimal precision instead of default 3
  • Switchres - HARDCADE CRT-OPTIMIZED MODE SELECTION (Version 3.0)
  • DirectDraw Low-Level VSync — Tearing suppression without overhead
  • D3D9 Real VSync — Tearing suppression without overhead
  • Implicit frameskip deactivation — Smooth scrolling on CRT


INTERFACE & CONFIGURATION
─────────────────────────

  • Optimized 2D ARCADE Build — Lightweight executable (without 3D games, mechanical, casino, mahjong, computers, consoles...
    No Open GL, No BGFX, No Network support, No midi sound, No LUA Script)

================================================================================
DETAILED TECHNICAL MODIFICATIONS
================================================================================


┌─────────────────────────────────────────────────────────────────────────────
│ AUTO REFRESH SYNC CRT / LCD DDRAW (HARDCADE)
└─────────────────────────────────────────────────────────────────────────────

  This feature allows automatic measurement and synchronization of
  the real CRT refresh rate at game launch.

  Calibration is performed ONLY ONCE, after effective game startup,
  when the video screen is stable (real frames already produced).

  The measured refresh is:
    • applied dynamically to the video engine
    • applied to the user slider in memory only

  When auto_refresh_sync is enabled, any option to save the
  refresh slider in CFG is deliberately ignored.

  This approach guarantees:
    • exact CRT ↔ game synchronization
    • perfectly smooth scrolling
    • absence of tearing
    • deterministic behavior at each launch

  Calibration is deliberately delayed by several dozen frames
  to avoid any unstable measurement during initialization phases.

  INI Option:
    • auto_refresh_sync 1

  Behavior:
    • Function active only when auto_refresh_sync = 1
    • Refresh is recalculated at each game launch
    • User slider remains modifiable during execution
    • Compatible with direct command line launch
    • Independent of MAME UI

  Modified files:
    • src/emu/video.cpp
    • src/emu/video.h
    • src/emu/ui/ui.cpp
    • src/osd/windows/drawdd.cpp


┌─────────────────────────────────────────────────────────────────────────────
│ AUTO REFRESH SYNC CRT / LCD D3D (HARDCADE)
└─────────────────────────────────────────────────────────────────────────────

                        .... Under development ....


┌─────────────────────────────────────────────────────────────────────────────
│ SLIDER SCREEN REFRESH RATE – HIGH PRECISION & CFG SAVE
└─────────────────────────────────────────────────────────────────────────────

  Automatic save and reload of user frequency in
  cfg/[game_name].cfg, with ultra-fine CRT refresh rate adjustment management
  at 0.0001 Hz, display and save at 4 decimals.

  Works only if auto_refresh_sync = 0

  Key operation:
    • Arrows alone        → ±1.0000 Hz
    • SHIFT + arrows      → ±0.1000 Hz
    • ALT + arrows        → ±0.0010 Hz
    • SPACE + arrows      → ±0.0001 Hz
    • CTRL + arrows       → ±1.0000 Hz (fast)

  Added functions:
    • config_load_screen_refresh() — src/emu/video.cpp
    • config_save_screen_refresh() — src/emu/video.cpp

  Modified functions:
    • slider_refresh() — src/emu/ui/ui.cpp
        ◦ Base 10000 → Hz conversion for 4 decimals
        ◦ Rounding and precise CFG save at 4 decimals
        ◦ FPS display at 4 decimals
    • ui_menu_sliders::handle() — src/emu/ui/sliders.cpp
        ◦ SPACE key management for ultra-fine increment
    • slider_init() — src/emu/ui/ui.cpp
        ◦ refresh slider incval modified to 1 (0.0001 Hz)

  Affected files:
    • src/emu/screen.cpp / screen.h
    • src/emu/video.cpp
    • src/emu/ui/ui.cpp
    • src/emu/ui/sliders.cpp
┌─────────────────────────────────────────────────────────────────────────────
│ HARDCADE SWITCHRES - CRT-OPTIMIZED MODE SELECTION
└─────────────────────────────────────────────────────────────────────────────

  This version of CRT-MAME-ARCADE 0.168 introduces a complete rewrite of the
  DirectDraw SwitchRes function, specifically designed for 15 kHz CRT display
  (arcade / JAMMA / RGB) and Windows XP / GeForce configurations.

  DirectDraw video mode selection now relies on a "Hardware-First"
  priority hierarchy, guaranteeing fluidity and image integrity.

  HARDCADE V3 SELECTION LOGIC:

  1. ABSOLUTE PRIORITY TO "INI" (User Override):
     If a resolution is forced in the game's .ini file, SwitchRes
     applies it immediately with a priority score (1,000,000 pts).
     This allows forcing a specific mode even if it's technically
     far from the game's native resolution.

  2. INTELLIGENT VERTICAL TOLERANCE (±24 Lines):
     In Auto mode, SwitchRes now allows a gap of up to
     24 vertical lines (ex: using a 240p mode for a 224p game).
     This allows maintaining the use of stable and well
     physically framed modelines, avoiding black screens or truncated images.

  3. REFRESH RATE PRIORITY (Total Fluidity):
     Within the vertical tolerance zone, refresh rate proximity
     (Hz) determines the winner. The system will always prefer
     a 58Hz mode for a 58Hz game, even if the number of lines
     differs slightly, guaranteeing perfect scrolling without stuttering.

  DIFFERENCES WITH ORIGINAL MAME LOGIC:

  • ORIGINAL MAME (LCD Logic):
    - Priority to higher refresh (penalty if Hz lower).
    - Immediate rejection if resolution lower than target (Truncated image).
    - Excessive importance of width (Pixel Clock).

  • HARDCADE CRT (Analog Logic):
    - Height (Scanlines) and Refresh are the only vital criteria.
    - Width treated as secondary criterion (adjustable on monitor).
    - Elimination of destructive vertical scaling.


  MODIFIED FILES:

  • src/osd/modules/render/drawdd.cpp
  → Rewrite of enum_modes_callback (Hardcade V3 Logic)

  • LCD Rendering (Works perfectly too!)

  No impact on:
  • D3D / OGL
  • Other video backends


┌─────────────────────────────────────────────────────────────────────────────
│ LATE INPUT POLLING
└─────────────────────────────────────────────────────────────────────────────

  DirectInput inputs are polled as late as possible in the frame,
  just before video rendering. Avoids using N-1 frame inputs.

  Modified file: src/osd/windows/video.cpp
  Function      : windows_osd_interface::update(bool skip_redraw)

┌─────────────────────────────────────────────────────────────────────────────
│ NON-BUFFERED DIRECTINPUT
└─────────────────────────────────────────────────────────────────────────────

  Deactivation of DirectInput event buffer (DIPROP_BUFFERSIZE = 0).
  Direct reading via GetDeviceState eliminates 1 to 3 ms of latency.

  Modified file: src/osd/windows/input.cpp

┌─────────────────────────────────────────────────────────────────────────────
│ IMPLICIT FRAMESKIP DEACTIVATION (CRT)
└─────────────────────────────────────────────────────────────────────────────

  MAME 0.168 applies internal frameskip even with frameskip=0 when no
  video modification is detected. This behavior degrades CRT scrolling.

  Implicit frameskip is disabled when frameskip=0 is explicit.
  Compatible with DDraw, Windows XP, 15 kHz CRT.

  Modified file: src/emu/video.cpp

┌─────────────────────────────────────────────────────────────────────────────
│ GPU FRAME QUEUE SUPPRESSION (D3D9)
└─────────────────────────────────────────────────────────────────────────────

  D3D9 configuration:
    • SwapEffect = D3DSWAPEFFECT_COPY
    • BackBufferCount = 1

  Result: -1 frame of real display-side latency.

  Modified file: src/osd/windows/ddrawd3d.cpp


┌─────────────────────────────────────────────────────────────────────────────
│ D3D9 REAL VSYNC (NO TEARING)
└─────────────────────────────────────────────────────────────────────────────

  Forces real D3D9 hardware VSync (PresentationInterval = D3DPRESENT_INTERVAL_ONE)
  independent of classic MAME VSync. Suppresses tearing without CPU overhead.

  INI Option: crtvsync 0|1
    0 — Original MAME behavior (default)
    1 — D3D9 hardware VSync enabled

  Recommended usage: 31kHz LCD screens or CRT (adds ~1 frame of lag on CRT)

  Modified files:
    • src/osd/windows/winmain.cpp
    • src/osd/windows/video.h / video.cpp
    • src/osd/windows/ddrawd3d.cpp

┌─────────────────────────────────────────────────────────────────────────────
│ DIRECTDRAW LOW-LEVEL VSYNC (CRT) V3
└─────────────────────────────────────────────────────────────────────────────
  Low-level DirectDraw VSync mode for 15 kHz CRT under Windows XP.
  Direct rendering in primary surface synchronized on Vertical Blank.

  INI Option: ddraw_lowlevel_vsync 0|1
    0 — Classic MAME behavior (default)
    1 — Low-level DirectDraw VSync

  ⚠ Active only if waitvsync = 0
  ⚠ Automatically disabled if triple buffering active

  Operation:
    1. VBL wait via WaitForVerticalBlank(DDWAITVB_BLOCKEND)
    2. Direct lock of primary surface
    3. Primitive scan (blending/alpha detection)
    4. Membuffer or direct rendering according to needs
    5. Controlled copy membuffer → primary surface
    6. Unlock + MAME blit bypass
    7. Complete MAME throttling deactivation (update_throttle bypass)


  Result:
    • Latency reduced by approximately 1 frame
    • Automatic perfect CRT synchronization (Snes9x/RetroArch type)
    • Zero tearing, ultra-smooth scrolling whatever the modeline
    • No more need to manually fine-tune each game

  Modified files:
    • src/osd/modules/render/drawdd.cpp
    • src/emu/video.cpp (update_throttle bypass)
    • src/emu/emuopts.cpp / emuopts.h

┌─────────────────────────────────────────────────────────────────────────────
│ AUTOMATIC REFRESH ROUNDING (ONE-SHOT) — (FUNCTION REMOVED)
└─────────────────────────────────────────────────────────────────────────────

                       ....(FUNCTION REMOVED)....

┌─────────────────────────────────────────────────────────────────────────────
│ OPTIMIZED 2D BUILD — ARCADE.LST CLEANUP
└─────────────────────────────────────────────────────────────────────────────

  Lightweight version specialized for classic 2D arcade on 15 kHz CRT.

  Removed systems:
    ✗ All 3D games (Model 2/3, Naomi, Taito Type X etc.)
    ✗ Casino systems (slot machines, video poker)
    ✗ Mahjong games
    ✗ Non-arcade "machine" systems (computers, consoles)
    ✗ Mechanical game systems etc.

  Preserved systems (2D only):
    ✓ Capcom CPS1/CPS2/CPS3
    ✓ Neo Geo MVS
    ✓ Konami (GX, Classic)
    ✓ Sega System 16/18/24
    ✓ Taito (F2, F3)
    ✓ Cave (CV1000, PGM)
    ✓ Irem M72/M92
    ✓ Toaplan, Psikyo, Data East
    ✓ Namco System 1/2
    ✓ 8-bit classics (Pac-Man, Donkey Kong, Galaga, etc.)

  Result: Reduced executable, faster compilation, targeted 2D CRT list.

  Modified file: src/mame/arcade.lst


┌─────────────────────────────────────────────────────────────────────────────
│ UI LUA DEACTIVATION
└─────────────────────────────────────────────────────────────────────────────

Lua periodic_check and frame_hook periodic calls are now commented out
to avoid any impact on performance or menus.


================================================================================
COMPATIBILITY
================================================================================

  OS        : Windows XP / 7 / 8 / 10
  Renderers : DDraw (XP), D3D9, GDI
  Monitors  : CRT 15 kHz, LCD 31 kHz

================================================================================
CREDITS
================================================================================

  Development  : Olivier Mileo
  Project      : CRT-MAME ARCADE-2D 0.168 Edition
  Base         : MAME 0.168

  © 2025 Hardcade — All rights reserved

================================================================================
================================================================================


Download on GitHub:

https://github.com/HardCade/hardcade/releases


« Last Edit: Yesterday at 05:48:12 pm by Olivcade »
Hardcade / PlayRetro Frontend development / Mame 0.168 Slider Refresh Save 1.2 development

Hardcade Frontend : https://sourceforge.net/projects/arcade-frontend/

Mame 0.168 Slider Refresh Save 1.2 : https://github.com/HardCade/hardcade

Olivcade

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 13
  • Last login:Yesterday at 05:47:43 pm
  • I want to build my own arcade controls!

Update version 1.3

README – CRT-MAME 0.168 V1.3

Binary files and source code available here on GitHub:

https://github.com/HardCade/hardcade/releases

Development Version – December 2025
© 2025 Hardcade – PlayRetro

===========================================================================================
PROJECT: CRT-MAME 0.168 Edition

CRT-MAME 0.168 is a specialized version of MAME 0.168 optimized for: 15 kHz CRT monitors (arcade, TV, PVM/BVM, Hantarex, Nanao, etc.) and LCD

monitors

Minimal input lag,

advanced and precise refresh rate control per game.

Objectives:

    - Achieve minimal input lag
    - Achieve increased display performance and superior behavior (compared to existing emulators) for 15 kHz CRTs.
    - Achieve ultra-smooth display and optimal performance on LCD screens.

===============================================
CURRENT MAIN FEATURES (subject to change)
==============================================


- Saving the Refresh Rate slider to CFG files

- Improved slider (precision, stability, rounding, defect handling)

- Added Windows input timestamp (anti-lag preparation)

- Added Late Input Polling (reduces input lag by a full frame)

- Added Direct3D optimization – "Direct Present Minimal" (reduces display lag)

- Added Adaptive HardSync (stabilizes frame timing and prevents stuttering, reduces overall latency)

More features and improvements are coming soon...
Hardcade / PlayRetro Frontend development / Mame 0.168 Slider Refresh Save 1.2 development

Hardcade Frontend : https://sourceforge.net/projects/arcade-frontend/

Mame 0.168 Slider Refresh Save 1.2 : https://github.com/HardCade/hardcade

abispac

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 1632
  • Last login:January 18, 2026, 04:21:43 pm
Wth, why 168 and not the latest version? and dont we have groovymame already?

Olivcade

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 13
  • Last login:Yesterday at 05:47:43 pm
  • I want to build my own arcade controls!
I'm doing 15kHz emulation on older PCs running Windows XP. I don't want the latest versions, which are too demanding for my modest setup. I've already used GroovyMAME, but I don't always get the results I want. So I'm having fun tinkering with this version of MAME to see what I can do (it's a hobby I'm sharing). This version of MAME is perfect for older systems while emulating a large number of games. I only do 2D emulation of games from the 80s and 90s, so the latest versions of MAME aren't relevant for what I want to do.
Hardcade / PlayRetro Frontend development / Mame 0.168 Slider Refresh Save 1.2 development

Hardcade Frontend : https://sourceforge.net/projects/arcade-frontend/

Mame 0.168 Slider Refresh Save 1.2 : https://github.com/HardCade/hardcade

abispac

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 1632
  • Last login:January 18, 2026, 04:21:43 pm
cool i didnt knew xp and old hardware was still a thing, im 50 years old, and all this time ive been playing with mame and 15khz since the dos times, and i got to admit, better hardware with the latest apps are a nice thing to work with today. But every once in a while nostalgia can hit , for example some times i come across an og original xbox, and softmoding that thing will always brings some kind of joy in my life, so i get what you say. good luck with your project.

Olivcade

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 13
  • Last login:Yesterday at 05:47:43 pm
  • I want to build my own arcade controls!
Yes, that's exactly it. ;D I like using old equipment because you get better results! I love tinkering. I'm the same age as you, 50. I can't wait to share… After some testing, I removed some options. I kept the refresh rate saver slider, but I'm now adding a "Tear Offset (Top)" option to hide the tear line in the dead zone at the top of the screen, once the timing is perfect. I'll keep you posted soon..
« Last Edit: December 23, 2025, 06:33:14 pm by Olivcade »
Hardcade / PlayRetro Frontend development / Mame 0.168 Slider Refresh Save 1.2 development

Hardcade Frontend : https://sourceforge.net/projects/arcade-frontend/

Mame 0.168 Slider Refresh Save 1.2 : https://github.com/HardCade/hardcade

Olivcade

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 13
  • Last login:Yesterday at 05:47:43 pm
  • I want to build my own arcade controls!
Re: CRT-MAME-ARCADE-2D Perceptual Sync 0.168 (NEW MAJ V1.8)
« Reply #6 on: January 10, 2026, 01:34:50 pm »
Hello la TEAM,

I've released an update; many improvements have been made. All the details are available at the top in the readme file:

Download on GitHub:

https://github.com/HardCade/hardcade/releases


===========================================================================================
CRT-MAME-ARCADE-2D Perceptual Sync 0.168 V1.8
================================================================================================

Development Version — December 2025
© 2025 Hardcade — Olivier Mileo

===========================================================================================
DESCRIPTION
===============================================================================================================

CRT-MAME-ARCADE-2D Perceptual Sync is a specialized version of MAME 0.168 optimized for 2D arcade gaming on 15 kHz CRT monitors and modern LCD screens running WinXP-32 with an ATI or NVIDIA graphics card and crt_emu drivers or soft15khz.

This edition focuses on minimizing input lag, reducing file size, and improving video synchronization for an authentic arcade experience.

Two complementary CRT synchronization approaches are offered:

→ MANUAL MODE "Perceptual Sync": Precise adjustment of the Slider Refresh Rate to 4 decimal places (±0.0001 Hz) for total timing control. Ideal for purists who want to calibrate each game individually and achieve strictly authentic hardware timing with virtually invisible, fixed tearing.

→ AUTOMATIC MODE "Adaptive Sync" (currently being developed): VSync DirectDraw Low-Level that automatically adapts to the actual refresh rate of your CRT (like Snes9x/RetroArch). Ultra-smooth scrolling guaranteed regardless of your model (58 Hz, 60 Hz, 61 Hz...), without any manual adjustments required. MAME adjusts its speed to perfectly match your screen.

Choose your approach: absolute manual control or effortless automatic smoothness.
Both methods eliminate screen tearing and guarantee an optimal CRT experience.
// PHILOSOPHY:

Why "CRT-MAME-ARCADE-2D Perceptual Sync" when other emulators like GROOVYMAME already exist?

Whether you're emulating at 15kHz with new or older hardware, the synchronization between the emulation and the display
is never 100% perfect in practice. Even if the modelline is calculated to exactly match the original game's frame rate,

sometimes, even when adhering to the precise values ​​of the MAME video drivers, the timing interpreted by your hardware will be more or less
off from the timing it should actually adopt to be perfectly aligned with the game's timing.

There are always discrepancies (large or small) due to:

- Hardware tolerances (CRT monitor, graphics card)
- Inaccuracies in clocks and oscillators
- Rounding in calculations, operating system

These discrepancies are random depending on your hardware, even if you use THE perfect modelline that mathematically respects
the values ​​imposed by the MAME game system. Despite this, the synchronization drifts more or less over time,
creating that tearing line that "walks" slowly or quickly across the screen—it can take several minutes or even tens of
minutes to cross the entire screen. This is generally considered acceptable because:

The line moves so slowly that it's barely noticeable in-game.
It's infinitely better than classic tearing with multiple rapidly moving lines.
Adding V-sync eliminates it at the cost of one frame of input lag, but if our modelline is too far off
the perfect timing, we'll get choppy scrolling. Some users further refine their modellines or slightly adjust
the refresh rate to minimize this phenomenon, but micro-tearing often remains.

Perceptual Sync is the philosophy of a CRT display mode that prioritizes perceived visual stability

(zero mobile tearing, smooth scrolling) rather than the absolute accuracy of the theoretical refresh rate.

It's a CRT display doctrine based on human perception, not mathematical perfection.

Perceptual Sync prioritizes perceived smoothness and image stability on CRTs.

Slight variations in refresh rate (≤0.0001 to 0.5 Hz) are intentionally tolerated to eliminate mobile screen tearing.

🔴 What Perceptual Sync DOES NOT try to do

❌ Be mathematically exact
❌ Be “frame perfect”
❌ Imitate GroovyMAME
❌ Convince theoretical purists

👉 It stands by its choices.

In other words: “What the eye sees is more important than what the numbers say.”

// The fundamental principles:

- The refresh rate does NOT need to be exact if a variation of: ±0.0001 to 0.5 Hz (configurable) is tolerated

👉 Result: imperceptibly different refresh rate, stable image.

// Absolute priority on tearing stability:

- Tearing enabled or disabled with Vsync activated

But: fixed, stuck outside the visible area if possible, or always in the same place

👉 Static tearing is psychologically invisible.

/ // No chasing the “perfect modelline”:

- No dynamic calculations

- No mode creation

- No real-time adjustments

👉 Once the mode is chosen → and the refresh rate slider is fine-tuned, leave it alone!

// The player takes precedence over the timer:

- Emulation respects gameplay

- Not the atomic clock

- No perceptible drift in-game
« Last Edit: January 11, 2026, 03:10:50 pm by Olivcade »
Hardcade / PlayRetro Frontend development / Mame 0.168 Slider Refresh Save 1.2 development

Hardcade Frontend : https://sourceforge.net/projects/arcade-frontend/

Mame 0.168 Slider Refresh Save 1.2 : https://github.com/HardCade/hardcade

Olivcade

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 13
  • Last login:Yesterday at 05:47:43 pm
  • I want to build my own arcade controls!

MAJ 01/18/2026


Download on GitHub:

(release and sources)
https://github.com/HardCade/hardcade/releases

================================================================================
CRT-MAME-ARCADE-2D Perceptual Sync 0.168 V2.1
================================================================================

Development Version — December 2025
© 2025 Hardcade — Olivier Mileo

================================================================================
DESCRIPTION
================================================================================

CRT-MAME-ARCADE-2D Perceptual Sync is a specialized version of MAME 0.168 optimized for
2D arcade on 15 kHz CRT monitors under WINXP-32 with ATI or NVIDIA graphics card +
crt_emu drivers or soft15khz.

Three complementary approaches for CRT video synchronization and selection are
offered for total control of your display:


  INI Option auto_refresh_sync = 0

→ MANUAL PERFECT SYNC MODE: Precise tuning of the Refresh Rate Slider up to
  4 decimals (±0.0001 Hz) for total timing control. Ideal for purists
  who want to calibrate each game individually and achieve strictly
  authentic hardware timing with quasi-invisible fixed tearing.


  INI Option auto_refresh_sync = 1

→ AUTOMATIC PERFECT SYNC MODE (DDRAW): The real CRT refresh rate is measured automatically
  at game launch, after the video screen has produced a sufficient number of stable frames.
  The calculated value is applied dynamically to the video engine and user slider in memory
  only (no writing to CFG file). Ultra-smooth scrolling even on atypical modelines
  (57.45878 Hz, 58.25494 Hz, 60.61575 Hz…)


  HARDCADE SWITCHRES CRT (Built-in)

→ OPTIMIZED 15KHZ MODE SELECTION: A deep rewrite of the DirectDraw algorithm.
  Unlike standard MAME, this version prioritizes fluidity (Hz) over exact
  resolution through a ±24 line vertical tolerance. It allows using your best
  240p modelines for the entire catalog (224p, 239p, 256p...) to guarantee
  always complete, centered display, and perfect vertical synchronization without stuttering.


Choose your philosophy: absolute manual control or automatic fluidity without effort.
Both methods eliminate mobile tearing and guarantee an optimal CRT experience.
If your modelines are close to the original game timings, activating this
option will offer you the ultimate experience.

If your modelines are far from the original timings, you will only perceive a slight
increase or decrease in game speed, while maintaining perfect timing in terms
of smooth scrolling, tearing elimination, and overall visual fidelity.
Hardcade / PlayRetro Frontend development / Mame 0.168 Slider Refresh Save 1.2 development

Hardcade Frontend : https://sourceforge.net/projects/arcade-frontend/

Mame 0.168 Slider Refresh Save 1.2 : https://github.com/HardCade/hardcade