port some of small fixes from trunk; disable autohold while playing a movie (r2624), fix movie length (r2629), keyrepeat improvement (r2641-2643)

This commit is contained in:
gocha 2009-07-22 04:35:12 +00:00
parent 3263ba4ef0
commit 624c72fd49
3 changed files with 53 additions and 35 deletions

View File

@ -2561,18 +2561,20 @@ void NDS_setPad(bool R,bool L,bool D,bool U,bool T,bool S,bool B,bool A,bool Y,b
W=padarray[10];
E=padarray[11];
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];
if(AutoHold.L) W=!padarray[10];
if(AutoHold.R) E=!padarray[11];
if (movieMode != MOVIEMODE_PLAY) {
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];
if(AutoHold.L) W=!padarray[10];
if(AutoHold.R) E=!padarray[11];
}
//this macro is the opposite of what you would expect
#define FIX(b) (b?0:0x80)

View File

@ -416,7 +416,7 @@ LRESULT CALLBACK WifiSettingsDlgProc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM
// const char *cflash_disk_image_file;
//};
int KeyInDelayInCount=10;
int KeyInDelayInCount=30;
static int lastTime = timeGetTime();
int repeattime;
@ -456,20 +456,30 @@ VOID CALLBACK KeyInputTimer( UINT idEvent, UINT uMsg, DWORD_PTR dwUser, DWORD_PT
// if((!GUI.InactivePause || !Settings.ForcedPause)
// || (GUI.BackgroundInput || !(Settings.ForcedPause & (PAUSE_INACTIVE_WINDOW | PAUSE_WINDOW_ICONISED))))
// {
static uint32 joyState [256];
for(int i = 0 ; i < 255 ; i++)
static u32 joyState [256];
static bool initialized = false;
if(!initialized) {
memset(joyState,0,sizeof(joyState));
initialized = true;
}
for(int i = 0 ; i < 256 ; i++)
{
bool active = !S9xGetState(i);
if(active)
{
if(joyState[i] < ULONG_MAX) // 0xffffffffUL
joyState[i]++;
if(joyState[i] == 1 || joyState[i] >= (unsigned) KeyInDelayInCount) {
if(joyState[i] == 1 || joyState[i] == (unsigned) KeyInDelayInCount) {
//HEY HEY HEY! this only repeats once. this is what it needs to be like for frame advance.
//if anyone wants a different kind of repeat, then the whole setup will need to be redone
//sort of fix the auto repeating
//TODO find something better
// repeattime++;
// if(repeattime % 10 == 0) {
//printf("trigger %d\n",i);
PostMessage(MainWindow->getHWnd(), WM_CUSTKEYDOWN, (WPARAM)(i),(LPARAM)(NULL));
repeattime=0;
// }
@ -1210,7 +1220,6 @@ DWORD WINAPI run()
}
if(FastForward) {
if(framesskipped < 9)
{
skipnextframe = 1;
@ -1967,6 +1976,7 @@ int WINAPI WinMain (HINSTANCE hThisInstance,
int nFunsterStil)
{
timeBeginPeriod(1);
hAppInst=hThisInstance;
OpenConsole(); // Init debug console
@ -2523,18 +2533,25 @@ bool first;
void FrameAdvance(bool state)
{
if(state) {
if(first) {
frameAdvance=true;
}
else {
execute = TRUE;
first=false;
}
if(first) {
execute = TRUE;
frameAdvance=true;
first=false;
}
else {
execute = TRUE;
}
}
else {
emu_halt();
SPU_Pause(1);
emu_paused = 1;
first = true;
if(frameAdvance)
{}
else
{
emu_halt();
SPU_Pause(1);
emu_paused = 1;
}
}
}

View File

@ -36,13 +36,12 @@ void Describe(HWND hwndDlg)
u32 num_frames = md.records.size();
u32 div = 60;
float tempCount = (num_frames % 60); //Get fraction of a second
float getTime = ((tempCount / div) * 100); //Convert to 2 digit number
int fraction = getTime; //Convert to 2 digit int
int seconds = (num_frames / div) % 60;
int minutes = (num_frames/(div*60))%60;
int hours = num_frames/(div*60*60);
double tempCount = num_frames / (33513982.0/6/355/263);
int num_seconds = tempCount;
int fraction = (tempCount - num_seconds) * 100;
int seconds = num_seconds % 60;
int minutes = (num_seconds / 60) % 60;
int hours = (num_seconds / 60 / 60) % 60;
char tmp[256];
sprintf(tmp, "%02d:%02d:%02d.%02d", hours, minutes, seconds, fraction);