sifadil / pcsx2-playground

Automatically exported from code.google.com/p/pcsx2-playground
2 stars 0 forks source link

slight mistake in r580 :/ #125

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
well, when you press the shift key, it only makes save slots to decrease
the count, if you press shift again it wont let it increase slots' counts.
(make it as a toggle key)..

WinSysExec.cpp, line 634: 

case VK_SHIFT: shiftkey = 0; break;

it should be:
case VK_SHIFT: if (shiftkey == 0)
           shiftkey = 1;
           else
           shiftkey =0;
           break;

same thing line 651 (but the opposite),
it should be:
        case VK_SHIFT: if (shiftkey == 1)
                   shiftkey = 0;
                   else
                   shiftkey = 1;
        break;

Oh, I got a stupid theory about the switch block, in line 650.
don't you think that it should compare between old and current event
(KEYPRESS/KEYRELEASE) in KeyEvent function instead of doing this inside
the plugin itself! let's think about it..

I am talking about PADSSSXPSX/TwinPad plugins, which had to read the
keyboard status multiple times for nothing (4 times exactly, if configured
for PAD1 and PAD2); 1) for PadKeyEvent function (called twice, once for
pad1 and once for pad2), 2) for PadPoll/PadUpdate (called also twice pad1/2)

besides for each read of keyboard state, it's 256 bytes X 4 = 1KB every
vsync. in 1 second let's say 60 vsyncs X 2 (2 pad calls) = 120 times pad
plugin was called in a second, 120 x 1KB = 120KB/Second, I think could be
improved to be like 30KB/Sec for one call/vsync. (I know that sounds silly
but hey if we can improve something, why not! since it's crucial and called
every time inside CpuExecute function..) Oh look at SysUpdate function..

In the pad plugin, If I used the current Keyboard state from padupdate/poll
functions as the one to pass the events to keyEvent, pcsx2 will have
multiple keystrokes issue e.g pressing F2 for instance will cause the emu
to cycle between states, 10 times or more..
that's why I am thinking about comparing between old/current events inside
the emu and let the plugin use the Keystate from single query instead of 4
queries.. changing the pad plugin specification is another solution..

if you see all this stupid, you can forget about it, but at least I think
shiftkey should be a toggle key.. IMHO :)

Thanks..

Original issue reported on code.google.com by RebelliousX on 21 Jan 2009 at 5:34

GoogleCodeExporter commented 8 years ago
Shift releasing is made by this:

    if (ev->evt == KEYRELEASE) {
        switch (ev->key) {
        case VK_SHIFT: shiftkey = 0; break;
        }
        GSkeyEvent(ev); return;
    }

It's mean that if user release shift key, than shiftkey should be setting off, 
and
KeyEvent finish. This code allow user to press F2 and Shift simultaneous (but 
shift
first). And you suggestion is not very good -- on first time Shift+F2 would 
switch
negative, and second one -- positive.

Original comment by Zeydl...@gmail.com on 21 Jan 2009 at 5:41

GoogleCodeExporter commented 8 years ago
I know what it is supposed to mean, official pcsx2 works as you said, but ssspsx
plugin with pcsx2pg doesn't act like that

try and hit shift key once, release it, and then press F2 multiple times. you 
will
see the save slots numbers goes down, if you hit shift key again wont make any
difference..

Original comment by RebelliousX on 21 Jan 2009 at 6:15

GoogleCodeExporter commented 8 years ago
@Zeydlitz: Ok Thanks man, I found my mistake.. Apparently I was using old PAD
specifications v0.5 and the newer one is 0.6, besides My code was working but 
the
lack of pthread functions made the plugin not capable of sending the correct
keyEvents data to the emu.. All I had to do is lock/unlock the thread to prevent
deadlocks with GS.. didn't notice this since it was mentioned only in the new 
ps2def.h

spent hours and hours to debug correct code to no avail.. shoot me now T_T

btw, since this issue is useless now, is there anyway to delete it?

Original comment by RebelliousX on 24 Jan 2009 at 11:12

GoogleCodeExporter commented 8 years ago

Original comment by ramapcsx2 on 24 Jan 2009 at 2:47