* Taseditor: Fixed previous commit accuracy
* Better turbo off method in lua engine when quitting
This commit is contained in:
parent
704af09cc8
commit
d659fab541
|
@ -700,13 +700,12 @@ LONG HISTORY::CustomDraw(NMLVCUSTOMDRAW* msg)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void HISTORY::Click(LPNMITEMACTIVATE info)
|
void HISTORY::Click(int row_index)
|
||||||
{
|
{
|
||||||
// jump to pointed snapshot
|
// jump to pointed snapshot
|
||||||
int item = info->iItem;
|
if (row_index >= 0)
|
||||||
if (item >= 0)
|
|
||||||
{
|
{
|
||||||
int result = jump(item);
|
int result = jump(row_index);
|
||||||
if (result >= 0)
|
if (result >= 0)
|
||||||
{
|
{
|
||||||
piano_roll.update();
|
piano_roll.update();
|
||||||
|
@ -758,6 +757,7 @@ int HISTORY::GetUndoHint()
|
||||||
// ---------------------------------------------------------------------------------
|
// ---------------------------------------------------------------------------------
|
||||||
LRESULT APIENTRY HistoryListWndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
|
LRESULT APIENTRY HistoryListWndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
|
||||||
{
|
{
|
||||||
|
extern HISTORY history;
|
||||||
switch(msg)
|
switch(msg)
|
||||||
{
|
{
|
||||||
case WM_CHAR:
|
case WM_CHAR:
|
||||||
|
@ -765,6 +765,19 @@ LRESULT APIENTRY HistoryListWndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM l
|
||||||
case WM_KEYUP:
|
case WM_KEYUP:
|
||||||
case WM_KILLFOCUS:
|
case WM_KILLFOCUS:
|
||||||
return 0;
|
return 0;
|
||||||
|
case WM_LBUTTONDOWN:
|
||||||
|
case WM_LBUTTONDBLCLK:
|
||||||
|
{
|
||||||
|
if (GetFocus() != hWnd)
|
||||||
|
SetFocus(hWnd);
|
||||||
|
// perform hit test
|
||||||
|
LVHITTESTINFO info;
|
||||||
|
info.pt.x = GET_X_LPARAM(lParam);
|
||||||
|
info.pt.y = GET_Y_LPARAM(lParam);
|
||||||
|
ListView_SubItemHitTest(hWnd, (LPARAM)&info);
|
||||||
|
history.Click(info.iItem);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
case WM_MBUTTONDOWN:
|
case WM_MBUTTONDOWN:
|
||||||
case WM_MBUTTONDBLCLK:
|
case WM_MBUTTONDBLCLK:
|
||||||
{
|
{
|
||||||
|
@ -773,6 +786,8 @@ LRESULT APIENTRY HistoryListWndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM l
|
||||||
}
|
}
|
||||||
case WM_RBUTTONDOWN:
|
case WM_RBUTTONDOWN:
|
||||||
case WM_RBUTTONDBLCLK:
|
case WM_RBUTTONDBLCLK:
|
||||||
|
if (GetFocus() != hWnd)
|
||||||
|
SetFocus(hWnd);
|
||||||
return 0;
|
return 0;
|
||||||
case WM_MOUSEWHEEL:
|
case WM_MOUSEWHEEL:
|
||||||
{
|
{
|
||||||
|
@ -781,6 +796,10 @@ LRESULT APIENTRY HistoryListWndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM l
|
||||||
if (GET_KEYSTATE_WPARAM(wParam) & (MK_RBUTTON|MK_SHIFT|MK_CONTROL) || (GetKeyState(VK_MENU) < 0))
|
if (GET_KEYSTATE_WPARAM(wParam) & (MK_RBUTTON|MK_SHIFT|MK_CONTROL) || (GetKeyState(VK_MENU) < 0))
|
||||||
return SendMessage(piano_roll.hwndList, msg, wParam, lParam);
|
return SendMessage(piano_roll.hwndList, msg, wParam, lParam);
|
||||||
}
|
}
|
||||||
|
case WM_MOUSEACTIVATE:
|
||||||
|
if (GetFocus() != hWnd)
|
||||||
|
SetFocus(hWnd);
|
||||||
|
break;
|
||||||
|
|
||||||
}
|
}
|
||||||
return CallWindowProc(hwndHistoryList_oldWndProc, hWnd, msg, wParam, lParam);
|
return CallWindowProc(hwndHistoryList_oldWndProc, hWnd, msg, wParam, lParam);
|
||||||
|
|
|
@ -86,7 +86,7 @@ public:
|
||||||
|
|
||||||
void GetDispInfo(NMLVDISPINFO* nmlvDispInfo);
|
void GetDispInfo(NMLVDISPINFO* nmlvDispInfo);
|
||||||
LONG CustomDraw(NMLVCUSTOMDRAW* msg);
|
LONG CustomDraw(NMLVCUSTOMDRAW* msg);
|
||||||
void Click(LPNMITEMACTIVATE info);
|
void Click(int row_index);
|
||||||
|
|
||||||
void RedrawHistoryList();
|
void RedrawHistoryList();
|
||||||
void UpdateHistoryList();
|
void UpdateHistoryList();
|
||||||
|
|
|
@ -93,7 +93,7 @@ void PIANO_ROLL::init()
|
||||||
|
|
||||||
hwndList = GetDlgItem(taseditor_window.hwndTasEditor, IDC_LIST1);
|
hwndList = GetDlgItem(taseditor_window.hwndTasEditor, IDC_LIST1);
|
||||||
// prepare the main listview
|
// prepare the main listview
|
||||||
ListView_SetExtendedListViewStyleEx(hwndList, LVS_EX_FULLROWSELECT|LVS_EX_GRIDLINES|LVS_EX_INFOTIP, LVS_EX_FULLROWSELECT|LVS_EX_GRIDLINES|LVS_EX_INFOTIP);
|
ListView_SetExtendedListViewStyleEx(hwndList, LVS_EX_FULLROWSELECT|LVS_EX_GRIDLINES, LVS_EX_FULLROWSELECT|LVS_EX_GRIDLINES);
|
||||||
// subclass the header
|
// subclass the header
|
||||||
hwndHeader = ListView_GetHeader(hwndList);
|
hwndHeader = ListView_GetHeader(hwndList);
|
||||||
hwndHeader_oldWndproc = (WNDPROC)SetWindowLong(hwndHeader, GWL_WNDPROC, (LONG)HeaderWndProc);
|
hwndHeader_oldWndproc = (WNDPROC)SetWindowLong(hwndHeader, GWL_WNDPROC, (LONG)HeaderWndProc);
|
||||||
|
@ -187,7 +187,6 @@ void PIANO_ROLL::init()
|
||||||
}
|
}
|
||||||
void PIANO_ROLL::free()
|
void PIANO_ROLL::free()
|
||||||
{
|
{
|
||||||
auto_mouseup_timer = 0;
|
|
||||||
if (hMainListFont)
|
if (hMainListFont)
|
||||||
{
|
{
|
||||||
DeleteObject(hMainListFont);
|
DeleteObject(hMainListFont);
|
||||||
|
@ -222,7 +221,6 @@ void PIANO_ROLL::free()
|
||||||
}
|
}
|
||||||
void PIANO_ROLL::reset()
|
void PIANO_ROLL::reset()
|
||||||
{
|
{
|
||||||
auto_mouseup_timer = 0;
|
|
||||||
next_header_update_time = header_item_under_mouse = 0;
|
next_header_update_time = header_item_under_mouse = 0;
|
||||||
// delete all columns except 0th
|
// delete all columns except 0th
|
||||||
while (ListView_DeleteColumn(hwndList, 1)) {}
|
while (ListView_DeleteColumn(hwndList, 1)) {}
|
||||||
|
@ -1063,10 +1061,7 @@ LRESULT APIENTRY ListWndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case WM_TIMER:
|
case WM_TIMER:
|
||||||
// very hacky way to force exit from modal message loop used by ListView's WM_LBUTTONDOWN handler
|
// disable timer of entering edit mode (there's no edit mode anyway)
|
||||||
if (piano_roll.auto_mouseup_timer)
|
|
||||||
PostMessage(hWnd, WM_LBUTTONUP, 0, 0);
|
|
||||||
// also disable timer of entering edit mode (there's no edit mode anyway)
|
|
||||||
return 0;
|
return 0;
|
||||||
case WM_LBUTTONDOWN:
|
case WM_LBUTTONDOWN:
|
||||||
case WM_LBUTTONDBLCLK:
|
case WM_LBUTTONDBLCLK:
|
||||||
|
@ -1109,13 +1104,8 @@ LRESULT APIENTRY ListWndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
|
||||||
piano_roll.RedrawRow(row_index);
|
piano_roll.RedrawRow(row_index);
|
||||||
}
|
}
|
||||||
// also select the row by calling hwndList_oldWndProc
|
// also select the row by calling hwndList_oldWndProc
|
||||||
// WARNING: incredible hack incoming!
|
PostMessage(hWnd, WM_LBUTTONUP, 0, 0); // ensure that oldWndProc will exit its modal message loop immediately
|
||||||
// This allows to intercept normal behaviour of ListView while still using it for setting selection
|
|
||||||
// very hacky way to force exit from modal message loop used by ListView's WM_LBUTTONDOWN handler
|
|
||||||
piano_roll.auto_mouseup_timer = SetTimer(0, 0, TIME_TO_GENERATE_AUTO_MOUSEUP, 0);
|
|
||||||
CallWindowProc(hwndList_oldWndProc, hWnd, msg, wParam, lParam);
|
CallWindowProc(hwndList_oldWndProc, hWnd, msg, wParam, lParam);
|
||||||
KillTimer(0, piano_roll.auto_mouseup_timer);
|
|
||||||
piano_roll.auto_mouseup_timer = 0;
|
|
||||||
}
|
}
|
||||||
} else if(column_index >= COLUMN_JOYPAD1_A && column_index <= COLUMN_JOYPAD4_R)
|
} else if(column_index >= COLUMN_JOYPAD1_A && column_index <= COLUMN_JOYPAD4_R)
|
||||||
{
|
{
|
||||||
|
@ -1123,21 +1113,9 @@ LRESULT APIENTRY ListWndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
|
||||||
// first call old wndproc to set selection on the row
|
// first call old wndproc to set selection on the row
|
||||||
if (alt_pressed)
|
if (alt_pressed)
|
||||||
wParam |= MK_SHIFT; // Alt should select region, just like Shift
|
wParam |= MK_SHIFT; // Alt should select region, just like Shift
|
||||||
// WARNING: incredible hack incoming!
|
|
||||||
// This allows to intercept normal behaviour of ListView while still using it for setting selection
|
|
||||||
if (msg == WM_LBUTTONDOWN)
|
if (msg == WM_LBUTTONDOWN)
|
||||||
{
|
PostMessage(hWnd, WM_LBUTTONUP, 0, 0); // ensure that oldWndProc will exit its modal message loop immediately
|
||||||
// very hacky way to force exit from modal message loop used by ListView's WM_LBUTTONDOWN handler
|
CallWindowProc(hwndList_oldWndProc, hWnd, msg, wParam, lParam);
|
||||||
piano_roll.auto_mouseup_timer = SetTimer(0, 0, TIME_TO_GENERATE_AUTO_MOUSEUP, 0);
|
|
||||||
CallWindowProc(hwndList_oldWndProc, hWnd, msg, wParam, lParam);
|
|
||||||
KillTimer(0, piano_roll.auto_mouseup_timer);
|
|
||||||
piano_roll.auto_mouseup_timer = 0;
|
|
||||||
// ehh... normally we should not even call oldWndProc with WM_LBUTTONDOWN, but we need it for setting selection
|
|
||||||
} else
|
|
||||||
{
|
|
||||||
// as for WM_LBUTTONDBLCLK, it won't freeze the window, so no need for hacks with SetTimer
|
|
||||||
CallWindowProc(hwndList_oldWndProc, hWnd, msg, wParam, lParam);
|
|
||||||
}
|
|
||||||
if (alt_pressed)
|
if (alt_pressed)
|
||||||
{
|
{
|
||||||
int joy = (column_index - COLUMN_JOYPAD1_A) / NUM_JOYPAD_BUTTONS;
|
int joy = (column_index - COLUMN_JOYPAD1_A) / NUM_JOYPAD_BUTTONS;
|
||||||
|
@ -1199,10 +1177,9 @@ LRESULT APIENTRY ListWndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case WM_RBUTTONDOWN:
|
case WM_RBUTTONDOWN:
|
||||||
if (GetFocus() != piano_roll.hwndList)
|
|
||||||
SetFocus(piano_roll.hwndList);
|
|
||||||
return 0;
|
|
||||||
case WM_RBUTTONDBLCLK:
|
case WM_RBUTTONDBLCLK:
|
||||||
|
if (GetFocus() != hWnd)
|
||||||
|
SetFocus(hWnd);
|
||||||
return 0;
|
return 0;
|
||||||
case WM_RBUTTONUP:
|
case WM_RBUTTONUP:
|
||||||
{
|
{
|
||||||
|
@ -1211,11 +1188,16 @@ LRESULT APIENTRY ListWndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
|
||||||
info.pt.x = GET_X_LPARAM(lParam);
|
info.pt.x = GET_X_LPARAM(lParam);
|
||||||
info.pt.y = GET_Y_LPARAM(lParam);
|
info.pt.y = GET_Y_LPARAM(lParam);
|
||||||
ListView_SubItemHitTest(hWnd, (LPARAM)&info);
|
ListView_SubItemHitTest(hWnd, (LPARAM)&info);
|
||||||
// show context menu
|
// show context menu if user right-clicked on Frame#
|
||||||
if(info.iSubItem <= COLUMN_FRAMENUM || info.iSubItem >= COLUMN_FRAMENUM2)
|
if(info.iSubItem <= COLUMN_FRAMENUM || info.iSubItem >= COLUMN_FRAMENUM2)
|
||||||
piano_roll.RightClick(info);
|
piano_roll.RightClick(info);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
case WM_MOUSEACTIVATE:
|
||||||
|
if (GetFocus() != hWnd)
|
||||||
|
SetFocus(hWnd);
|
||||||
|
break;
|
||||||
|
|
||||||
}
|
}
|
||||||
return CallWindowProc(hwndList_oldWndProc, hWnd, msg, wParam, lParam);
|
return CallWindowProc(hwndList_oldWndProc, hWnd, msg, wParam, lParam);
|
||||||
}
|
}
|
||||||
|
|
|
@ -18,7 +18,6 @@
|
||||||
#define HEADER_DX_FIX 4
|
#define HEADER_DX_FIX 4
|
||||||
|
|
||||||
#define BOOST_WHEN_BOTH_RIGHTBUTTON_AND_ALT_PRESSED 2
|
#define BOOST_WHEN_BOTH_RIGHTBUTTON_AND_ALT_PRESSED 2
|
||||||
#define TIME_TO_GENERATE_AUTO_MOUSEUP 20 // in milliseconds
|
|
||||||
|
|
||||||
enum
|
enum
|
||||||
{
|
{
|
||||||
|
@ -163,9 +162,6 @@ public:
|
||||||
HFONT hMainListFont, hMainListSelectFont, hMarkersFont, hMarkersEditFont;
|
HFONT hMainListFont, hMainListSelectFont, hMarkersFont, hMarkersEditFont;
|
||||||
HBRUSH bg_brush;
|
HBRUSH bg_brush;
|
||||||
|
|
||||||
// very hacky way to force exit from modal message loop used by ListView's WM_LBUTTONDOWN handler
|
|
||||||
UINT_PTR auto_mouseup_timer;
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void CenterListAt(int frame);
|
void CenterListAt(int frame);
|
||||||
|
|
||||||
|
|
|
@ -728,10 +728,6 @@ BOOL CALLBACK WndprocTasEditor(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lP
|
||||||
case LVN_GETDISPINFO:
|
case LVN_GETDISPINFO:
|
||||||
history.GetDispInfo((NMLVDISPINFO*)lParam);
|
history.GetDispInfo((NMLVDISPINFO*)lParam);
|
||||||
break;
|
break;
|
||||||
case NM_CLICK:
|
|
||||||
case NM_DBLCLK:
|
|
||||||
history.Click((LPNMITEMACTIVATE)lParam);
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case TASEDITOR_PLAYSTOP:
|
case TASEDITOR_PLAYSTOP:
|
||||||
|
|
|
@ -84,6 +84,8 @@ extern "C"
|
||||||
extern void AddRecentLuaFile(const char *filename);
|
extern void AddRecentLuaFile(const char *filename);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
extern bool turbo;
|
||||||
|
|
||||||
struct LuaSaveState {
|
struct LuaSaveState {
|
||||||
std::string filename;
|
std::string filename;
|
||||||
EMUFILE_MEMORY *data;
|
EMUFILE_MEMORY *data;
|
||||||
|
@ -238,7 +240,8 @@ static void FCEU_LuaOnStop() {
|
||||||
// FCEUI_ToggleEmulationPause();
|
// FCEUI_ToggleEmulationPause();
|
||||||
FCEUD_SetEmulationSpeed(EMUSPEED_NORMAL); //TODO: Ideally lua returns the speed to the speed the user set before running the script
|
FCEUD_SetEmulationSpeed(EMUSPEED_NORMAL); //TODO: Ideally lua returns the speed to the speed the user set before running the script
|
||||||
//rather than returning it to normal, and turbo off. Perhaps some flags and a FCEUD_GetEmulationSpeed function
|
//rather than returning it to normal, and turbo off. Perhaps some flags and a FCEUD_GetEmulationSpeed function
|
||||||
FCEUD_TurboOff(); //Turn off turbo
|
turbo = false;
|
||||||
|
//FCEUD_TurboOff();
|
||||||
#ifdef WIN32
|
#ifdef WIN32
|
||||||
TaseditorUpdateManualFunctionStatus();
|
TaseditorUpdateManualFunctionStatus();
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Reference in New Issue