longjoel / quitbit

quitbit an emulator killer for frontends
1 stars 4 forks source link

Logic, Error Checking, Timer Argument #3

Closed MiRIr closed 9 years ago

MiRIr commented 9 years ago

The code that checked the button combinations is now just comparing 2 integers. This was done due to taking advantage of state.dwButtons, which, in integer form, already told which buttons were being pressed. It is also efficient because it rids the need to assume 16 buttons per controller when checking what is pressed. This also makes the checking process faster.

The error checks now outputs what exactly is wrong.

Some of the code is a bit more readable.

I added a Timer function(--time/--t), which only makes the program close if the button combination is held for a certain amount of time. The argument function takes milliseconds.

Starting the program up probably takes a few milliseconds longer due to more involved error checking and 'integerizing' the button combination, but the actual loop is faster since there's less processing per iteration.

longjoel commented 9 years ago

LOL, you keep taking work away from me. I was going to work on the timer function this Sunday, but this is awesome.

One more thing I am going to try to add is to end the emulator by closing it's main window first so it has a chance to do it's shutdown stuff, then kill it completely.