win32: autofire, autohold, input display fix
This commit is contained in:
parent
3d95e1061a
commit
dc9b05137e
|
@ -2414,8 +2414,61 @@ void NDS_setPadFromMovie(u16 pad)
|
|||
#undef FIX
|
||||
}
|
||||
|
||||
turbo Turbo;
|
||||
turbotime TurboTime;
|
||||
|
||||
void SetTurbo(bool (&pad) [10]) {
|
||||
|
||||
bool turbo[4] = {true, false, true, false};
|
||||
bool currentbutton;
|
||||
|
||||
for (int i=0; i < 10; i++) {
|
||||
currentbutton=Turbo.button(i);
|
||||
|
||||
if(currentbutton) {
|
||||
pad[i]=turbo[TurboTime.time(i)-1];
|
||||
|
||||
if(TurboTime.time(i)>=ARRAYSIZE(turbo))
|
||||
TurboTime.time(i)=0;
|
||||
}
|
||||
else
|
||||
TurboTime.time(i)=0; //reset timer if the button isn't pressed
|
||||
}
|
||||
for (int i=0; i<10; i++)
|
||||
TurboTime.time(i)++;
|
||||
}
|
||||
|
||||
autohold AutoHold;
|
||||
|
||||
void NDS_setPad(bool R,bool L,bool D,bool U,bool T,bool S,bool B,bool A,bool Y,bool X,bool W,bool E,bool G, bool F)
|
||||
{
|
||||
|
||||
bool padarray[10] = {R, L, D, U, T, S, B, A, Y, X};
|
||||
|
||||
SetTurbo(padarray);
|
||||
|
||||
R=padarray[0];
|
||||
L=padarray[1];
|
||||
D=padarray[2];
|
||||
U=padarray[3];
|
||||
T=padarray[4];
|
||||
S=padarray[5];
|
||||
B=padarray[6];
|
||||
A=padarray[7];
|
||||
Y=padarray[8];
|
||||
X=padarray[9];
|
||||
|
||||
if(AutoHold.Right) R=!padarray[0];
|
||||
if(AutoHold.Left) L=!padarray[1];
|
||||
if(AutoHold.Down) D=!padarray[2];
|
||||
if(AutoHold.Up) U=!padarray[3];
|
||||
if(AutoHold.Select)T=!padarray[4];
|
||||
if(AutoHold.Start) S=!padarray[5];
|
||||
if(AutoHold.B) B=!padarray[6];
|
||||
if(AutoHold.A) A=!padarray[7];
|
||||
if(AutoHold.Y) Y=!padarray[8];
|
||||
if(AutoHold.X) X=!padarray[9];
|
||||
|
||||
//this macro is the opposite of what you would expect
|
||||
#define FIX(b) (b?0:0x80)
|
||||
|
||||
|
|
|
@ -34,6 +34,57 @@
|
|||
|
||||
#include <string>
|
||||
|
||||
struct turbo {
|
||||
bool Right;
|
||||
bool Left;
|
||||
bool Down;
|
||||
bool Up;
|
||||
bool Select;
|
||||
bool Start;
|
||||
bool B;
|
||||
bool A;
|
||||
bool Y;
|
||||
bool X;
|
||||
|
||||
bool &button(int i) { return ((bool*)this)[i]; }
|
||||
};
|
||||
|
||||
extern turbo Turbo;
|
||||
|
||||
struct turbotime {
|
||||
int Right;
|
||||
int Left;
|
||||
int Down;
|
||||
int Up;
|
||||
int Select;
|
||||
int Start;
|
||||
int B;
|
||||
int A;
|
||||
int Y;
|
||||
int X;
|
||||
|
||||
int &time(int i) { return ((int*)this)[i]; }
|
||||
};
|
||||
|
||||
extern turbotime TurboTime;
|
||||
|
||||
struct autohold {
|
||||
bool Right;
|
||||
bool Left;
|
||||
bool Down;
|
||||
bool Up;
|
||||
bool Select;
|
||||
bool Start;
|
||||
bool B;
|
||||
bool A;
|
||||
bool Y;
|
||||
bool X;
|
||||
|
||||
bool &hold(int i) { return ((bool*)this)[i]; }
|
||||
};
|
||||
|
||||
extern autohold AutoHold;
|
||||
|
||||
int NDS_WritePNG(const char *fname);
|
||||
|
||||
extern volatile BOOL execute;
|
||||
|
|
|
@ -29,6 +29,7 @@
|
|||
|
||||
SCustomKeys CustomKeys;
|
||||
|
||||
bool AutoHoldPressed=false;
|
||||
|
||||
bool IsLastCustomKey (const SCustomKey *key)
|
||||
{
|
||||
|
@ -145,6 +146,46 @@ void HK_StateQuickLoadSlot(int)
|
|||
HK_StateLoadSlot(lastSaveState);
|
||||
}
|
||||
|
||||
void HK_AutoHoldClearKeyDown(int) {
|
||||
|
||||
for (int i=0; i < 10; i++) {
|
||||
AutoHold.hold(i)=false;
|
||||
}
|
||||
}
|
||||
|
||||
void HK_AutoHoldKeyDown(int) {AutoHoldPressed = true;}
|
||||
void HK_AutoHoldKeyUp(int) {AutoHoldPressed = false;}
|
||||
|
||||
void HK_TurboRightKeyDown(int) { Turbo.Right = true; }
|
||||
void HK_TurboRightKeyUp(int) { Turbo.Right = false; }
|
||||
|
||||
void HK_TurboLeftKeyDown(int) { Turbo.Left = true; }
|
||||
void HK_TurboLeftKeyUp(int) { Turbo.Left = false; }
|
||||
|
||||
void HK_TurboDownKeyDown(int) { Turbo.Down = true; }
|
||||
void HK_TurboDownKeyUp(int) { Turbo.Down = false; }
|
||||
|
||||
void HK_TurboUpKeyDown(int) { Turbo.Up = true; }
|
||||
void HK_TurboUpKeyUp(int) { Turbo.Up = false; }
|
||||
|
||||
void HK_TurboBKeyDown(int) { Turbo.B = true; }
|
||||
void HK_TurboBKeyUp(int) { Turbo.B = false; }
|
||||
|
||||
void HK_TurboAKeyDown(int) { Turbo.A = true; }
|
||||
void HK_TurboAKeyUp(int) { Turbo.A = false; }
|
||||
|
||||
void HK_TurboXKeyDown(int) { Turbo.X = true; }
|
||||
void HK_TurboXKeyUp(int) { Turbo.X = false; }
|
||||
|
||||
void HK_TurboYKeyDown(int) { Turbo.Y = true; }
|
||||
void HK_TurboYKeyUp(int) { Turbo.Y = false; }
|
||||
|
||||
void HK_TurboStartKeyDown(int) { Turbo.Start = true; }
|
||||
void HK_TurboStartKeyUp(int) { Turbo.Start = false; }
|
||||
|
||||
void HK_TurboSelectKeyDown(int) { Turbo.Select = true; }
|
||||
void HK_TurboSelectKeyUp(int) { Turbo.Select = false; }
|
||||
|
||||
void HK_Pause(int) { Pause(); }
|
||||
void HK_FastForwardToggle(int) { FastForward ^=1; }
|
||||
void HK_FastForwardKeyDown(int) { FastForward = 1; }
|
||||
|
@ -189,6 +230,89 @@ void InitCustomKeys (SCustomKeys *keys)
|
|||
keys->Pause.page = HOTKEY_PAGE_MAIN;
|
||||
keys->Pause.key = VK_SPACE;
|
||||
|
||||
keys->TurboRight.handleKeyDown = HK_TurboRightKeyDown;
|
||||
keys->TurboRight.handleKeyUp = HK_TurboRightKeyUp;
|
||||
keys->TurboRight.code = "TurboRight";
|
||||
keys->TurboRight.name = L"Turbo Right";
|
||||
keys->TurboRight.page = HOTKEY_PAGE_MAIN;
|
||||
keys->TurboRight.key = NULL;
|
||||
|
||||
keys->AutoHoldClear.handleKeyDown = HK_AutoHoldClearKeyDown;
|
||||
keys->AutoHoldClear.code = "AutoHoldClear";
|
||||
keys->AutoHoldClear.name = L"Auto-Hold Clear";
|
||||
keys->AutoHoldClear.page = HOTKEY_PAGE_MAIN;
|
||||
keys->AutoHoldClear.key = NULL;
|
||||
|
||||
keys->AutoHold.handleKeyDown = HK_AutoHoldKeyDown;
|
||||
keys->AutoHold.handleKeyUp = HK_AutoHoldKeyUp;
|
||||
keys->AutoHold.code = "AutoHold";
|
||||
keys->AutoHold.name = L"Auto-Hold";
|
||||
keys->AutoHold.page = HOTKEY_PAGE_MAIN;
|
||||
keys->AutoHold.key = NULL;
|
||||
|
||||
keys->TurboLeft.handleKeyDown = HK_TurboLeftKeyDown;
|
||||
keys->TurboLeft.handleKeyUp = HK_TurboLeftKeyUp;
|
||||
keys->TurboLeft.code = "TurboLeft";
|
||||
keys->TurboLeft.name = L"Turbo Left";
|
||||
keys->TurboLeft.page = HOTKEY_PAGE_MAIN;
|
||||
keys->TurboLeft.key = NULL;
|
||||
|
||||
keys->TurboDown.handleKeyDown = HK_TurboDownKeyDown;
|
||||
keys->TurboDown.handleKeyUp = HK_TurboDownKeyUp;
|
||||
keys->TurboDown.code = "TurboDown";
|
||||
keys->TurboDown.name = L"Turbo Down";
|
||||
keys->TurboDown.page = HOTKEY_PAGE_MAIN;
|
||||
keys->TurboDown.key = NULL;
|
||||
|
||||
keys->TurboUp.handleKeyDown = HK_TurboUpKeyDown;
|
||||
keys->TurboUp.handleKeyUp = HK_TurboUpKeyUp;
|
||||
keys->TurboUp.code = "TurboUp";
|
||||
keys->TurboUp.name = L"Turbo Up";
|
||||
keys->TurboUp.page = HOTKEY_PAGE_MAIN;
|
||||
keys->TurboUp.key = NULL;
|
||||
|
||||
keys->TurboB.handleKeyDown = HK_TurboBKeyDown;
|
||||
keys->TurboB.handleKeyUp = HK_TurboBKeyUp;
|
||||
keys->TurboB.code = "TurboB";
|
||||
keys->TurboB.name = L"Turbo B";
|
||||
keys->TurboB.page = HOTKEY_PAGE_MAIN;
|
||||
keys->TurboB.key = NULL;
|
||||
|
||||
keys->TurboA.handleKeyDown = HK_TurboAKeyDown;
|
||||
keys->TurboA.handleKeyUp = HK_TurboAKeyUp;
|
||||
keys->TurboA.code = "TurboA";
|
||||
keys->TurboA.name = L"Turbo A";
|
||||
keys->TurboA.page = HOTKEY_PAGE_MAIN;
|
||||
keys->TurboA.key = NULL;
|
||||
|
||||
keys->TurboX.handleKeyDown = HK_TurboXKeyDown;
|
||||
keys->TurboX.handleKeyUp = HK_TurboXKeyUp;
|
||||
keys->TurboX.code = "TurboX";
|
||||
keys->TurboX.name = L"Turbo X";
|
||||
keys->TurboX.page = HOTKEY_PAGE_MAIN;
|
||||
keys->TurboX.key = NULL;
|
||||
|
||||
keys->TurboY.handleKeyDown = HK_TurboYKeyDown;
|
||||
keys->TurboY.handleKeyUp = HK_TurboYKeyUp;
|
||||
keys->TurboY.code = "TurboY";
|
||||
keys->TurboY.name = L"Turbo Y";
|
||||
keys->TurboY.page = HOTKEY_PAGE_MAIN;
|
||||
keys->TurboY.key = NULL;
|
||||
|
||||
keys->TurboSelect.handleKeyDown = HK_TurboSelectKeyDown;
|
||||
keys->TurboSelect.handleKeyUp = HK_TurboSelectKeyUp;
|
||||
keys->TurboSelect.code = "TurboSelect";
|
||||
keys->TurboSelect.name = L"Turbo Select";
|
||||
keys->TurboSelect.page = HOTKEY_PAGE_MAIN;
|
||||
keys->TurboSelect.key = NULL;
|
||||
|
||||
keys->TurboStart.handleKeyDown = HK_TurboStartKeyDown;
|
||||
keys->TurboStart.handleKeyUp = HK_TurboStartKeyUp;
|
||||
keys->TurboStart.code = "TurboStart";
|
||||
keys->TurboStart.name = L"Turbo Start";
|
||||
keys->TurboStart.page = HOTKEY_PAGE_MAIN;
|
||||
keys->TurboStart.key = NULL;
|
||||
|
||||
keys->FastForward.handleKeyDown = HK_FastForwardKeyDown;
|
||||
keys->FastForward.handleKeyUp = HK_FastForwardKeyUp;
|
||||
keys->FastForward.code = "FastForward";
|
||||
|
|
|
@ -65,6 +65,10 @@ struct SCustomKeys
|
|||
|
||||
SCustomKey Pause, FrameAdvance, FastForward, FastForwardToggle, IncreaseSpeed, DecreaseSpeed;
|
||||
|
||||
SCustomKey TurboRight, TurboLeft, TurboDown, TurboUp, TurboSelect, TurboStart, TurboB, TurboA, TurboY, TurboX;
|
||||
|
||||
SCustomKey AutoHold, AutoHoldClear;
|
||||
|
||||
SCustomKey ToggleRasterizer;
|
||||
|
||||
SCustomKey PrintScreen;
|
||||
|
@ -91,6 +95,8 @@ void HK_StateSetSlot(int);
|
|||
void HK_Pause(int);
|
||||
void HK_FastForward(int);
|
||||
|
||||
extern bool AutoHoldPressed;
|
||||
|
||||
#endif //HOTKEY_H_INCLUDED
|
||||
|
||||
/**********************************************************************************
|
||||
|
|
|
@ -2198,7 +2198,21 @@ void input_process()
|
|||
bool G = joypads[0] & DEBUG_MASK;
|
||||
bool F = joypads[0] & LID_MASK;
|
||||
|
||||
if(AutoHoldPressed && R) AutoHold.Right ^= true;
|
||||
if(AutoHoldPressed && L) AutoHold.Left ^= true;
|
||||
if(AutoHoldPressed && D) AutoHold.Down ^= true;
|
||||
if(AutoHoldPressed && U) AutoHold.Up ^= true;
|
||||
if(AutoHoldPressed && T) AutoHold.Select ^= true;
|
||||
if(AutoHoldPressed && S) AutoHold.Start ^= true;
|
||||
if(AutoHoldPressed && B) AutoHold.B ^= true;
|
||||
if(AutoHoldPressed && A) AutoHold.A ^= true;
|
||||
if(AutoHoldPressed && Y) AutoHold.Y ^= true;
|
||||
if(AutoHoldPressed && X) AutoHold.X ^= true;
|
||||
|
||||
NDS_setPad( R, L, D, U, T, S, B, A, Y, X, W, E, G, F);
|
||||
|
||||
if (ShowInputDisplay) osd->addFixed(0, 45, "%s",InputDisplayString.c_str());
|
||||
|
||||
}
|
||||
|
||||
static void set_hotkeyinfo(HWND hDlg)
|
||||
|
|
|
@ -1008,7 +1008,6 @@ DWORD WINAPI run()
|
|||
}
|
||||
frameCounter++;
|
||||
if (frameCounterDisplay) osd->addFixed(0, 25, "%d",frameCounter);
|
||||
if (ShowInputDisplay) osd->addFixed(0, 45, "%s",InputDisplayString.c_str());
|
||||
if (ShowLagFrameCounter) osd->addFixed(0, 65, "%d",TotalLagFrames);
|
||||
DisplayMessage();
|
||||
CheckMessages();
|
||||
|
|
|
@ -12,6 +12,7 @@ void SaveStateMessages(int slotnum, int whichMessage);
|
|||
void Display();
|
||||
void Pause();
|
||||
void FrameAdvance();
|
||||
extern bool ShowInputDisplay;
|
||||
|
||||
#define GPU3D_NULL 0
|
||||
#define GPU3D_OPENGL 1
|
||||
|
|
Loading…
Reference in New Issue