Skip to content

Instantly share code, notes, and snippets.

@Skarsnik
Last active January 20, 2018 13:08
Show Gist options
  • Save Skarsnik/43f9d3dedb0437a33b1abab399ea356e to your computer and use it in GitHub Desktop.
Save Skarsnik/43f9d3dedb0437a33b1abab399ea356e to your computer and use it in GitHub Desktop.
import QtQuick 2.0
// Display the remaining time on the Nobilia market in Secret of Evermore
/* First is your 'ui' definition (use Qt creator if you don't want to do that manually and copy/paste) */
Rectangle {
width: 250
height: 150
id : window
color : "black"
Text {
id : markettimer
color : white
text: "00:00"
}
// You need this object
USB2Snes {
id : usbsnes
timer : 10 // The interval between refresh in ms
// I can add functions!
function frameToTime(framecount)
{
var minutes = framecount / 60 * 60;
var seconds = (framecount / 60) % 60;
return "%d:%d".sprintf(minutes, seconds);
}
/* Main Code is actually here */
onTimerTick {
/* SoE timer for market goes like 5000 to 20000 */
var stop_value = 200000;
var counter = usb2snes.readlong(0x7E0B19);
counter = stop_value - (counter - 5000); // counter does not start at 0
markettimer.text = frameToTime();
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment