From 77e63aa6438e9b472b6abb107263ad612913c75f Mon Sep 17 00:00:00 2001 From: Ilari Liusvaara Date: Sat, 27 Nov 2010 18:12:29 +0200 Subject: [PATCH] Add feature to show framerate --- Changelog.utf8 | 4 ++++ VERSIONINFO | 2 +- org/jpc/emulator/pci/peripheral/VGACard.java | 21 +++++++++++++++++++++ org/jpc/plugins/PCControl.java | 14 ++++++++++++++ 4 files changed, 40 insertions(+), 1 deletion(-) diff --git a/Changelog.utf8 b/Changelog.utf8 index 3e8de4e..5d31ea3 100644 --- a/Changelog.utf8 +++ b/Changelog.utf8 @@ -1,3 +1,7 @@ +Changes since JPC-RR Release 11.2: +================================== +- Add feature to show framerate. + Changes from JPC-RR Release 11.1 to JPC-RR Release 11.2: ======================================================== - Make some modules default in assembly dialog. diff --git a/VERSIONINFO b/VERSIONINFO index 26d6dad..0394a16 100644 --- a/VERSIONINFO +++ b/VERSIONINFO @@ -1 +1 @@ -11.2 +11.3-WIP diff --git a/org/jpc/emulator/pci/peripheral/VGACard.java b/org/jpc/emulator/pci/peripheral/VGACard.java index 2101c0f..3900c5e 100644 --- a/org/jpc/emulator/pci/peripheral/VGACard.java +++ b/org/jpc/emulator/pci/peripheral/VGACard.java @@ -635,6 +635,27 @@ public class VGACard extends AbstractPCIDevice implements IOPortCapable, TimerRe paletteDebuggingEnabled = _state; } + public String getFramerate() + { + long numerator = VGA_MASTER_CLOCK_FREQ; + long denumerator = draw_vtotal; + long gcd1 = numerator; + long gcd2 = denumerator; + if(SYSFLAG_VGATIMINGMETHOD == 0) + return "60"; + while(gcd2 != 0) { + long tmp = gcd1; + gcd1 = gcd2; + gcd2 = tmp % gcd2; + }; + numerator /= gcd1; + denumerator /= gcd1; + if(denumerator != 1) + return "" + numerator + "/" + denumerator; + else + return "" + numerator; + } + public void setVGADrawHack() { vgaDrawHackFlag = true; diff --git a/org/jpc/plugins/PCControl.java b/org/jpc/plugins/PCControl.java index 8f4694e..ab48097 100644 --- a/org/jpc/plugins/PCControl.java +++ b/org/jpc/plugins/PCControl.java @@ -46,6 +46,7 @@ import org.jpc.emulator.TraceTrap; import org.jpc.emulator.DriveSet; import org.jpc.emulator.DisplayController; import org.jpc.emulator.memory.PhysicalAddressSpace; +import org.jpc.emulator.pci.peripheral.VGACard; import org.jpc.emulator.StatusDumper; import org.jpc.emulator.Clock; import org.jpc.emulator.VGADigitalOut; @@ -822,6 +823,7 @@ public class PCControl implements Plugin, PCMonitorPanelEmbedder menuManager.addMenuItem("Debug→Hacks→NO_FPU", this, "menuNOFPU", null, PROFILE_HAVE_PC); menuManager.addMenuItem("Debug→Hacks→VGA_DRAW", this, "menuVGADRAW", null, PROFILE_HAVE_PC); menuManager.addMenuItem("Debug→Hacks→VGA_SCROLL_2", this, "menuVGASCROLL2", null, PROFILE_HAVE_PC); + menuManager.addMenuItem("Debug→Show frame rate", this, "menuFramerate", null, PROFILE_HAVE_PC); disks = new HashSet(); currentProject = new PC.PCFullStatus(); @@ -1063,6 +1065,18 @@ e.printStackTrace(); pc.setVGAScroll2Hack(); } + public void menuFramerate(String i, Object[] args) + { + VGACard card = (VGACard)pc.getComponent(VGACard.class); + if(card == null) { + callShowOptionDialog(window, "Can't get current framerate!", "Error", JOptionPane.YES_NO_OPTION, + JOptionPane.WARNING_MESSAGE, null, new String[]{"Dismiss"}, "Dismiss"); + return; + } + callShowOptionDialog(window, "Current framerate is " + card.getFramerate() + " fps.", "Information", + JOptionPane.YES_NO_OPTION,JOptionPane.INFORMATION_MESSAGE, null, new String[]{"Dismiss"}, "Dismiss"); + } + public void menuQuit(String i, Object[] args) { vPluginManager.shutdownEmulator(); -- 2.11.4.GIT