added some kbm stuff

This commit is contained in:
2026-09-13 19:41:44 -07:00
parent 82e802873f
commit 5023e0a8d6
217 changed files with 3744 additions and 235 deletions
@@ -54,6 +54,12 @@ UIScene_SkinSelectMenu::UIScene_SkinSelectMenu(int iPad, void *initData, UILayer
m_bAnimatingMove = false;
m_bSkinIndexChanged = false;
m_fMouseDragStartX = 0.0f;
m_bMouseDragActive = false;
m_bMouseDragScrolled = false;
m_bMouseLDownPrev = false;
m_iPressedPackTab = 0;
m_currentNavigation = eSkinNavigation_Skin;
m_currentPackCount = 0;
@@ -77,7 +83,7 @@ UIScene_SkinSelectMenu::UIScene_SkinSelectMenu(int iPad, void *initData, UILayer
m_centreLabel = L"";
m_rightLabel = L"";
#ifdef __PSVITA__
#if defined(__PSVITA__) || defined(_WINDOWS64)
// initialise vita tab controls with ids
m_TouchTabLeft.init(ETouchInput_TabLeft);
m_TouchTabRight.init(ETouchInput_TabRight);
@@ -165,6 +171,247 @@ void UIScene_SkinSelectMenu::tick()
handleSkinIndexChanged();
}
#ifdef _WINDOWS64
{
m_TouchIggyCharacters.UpdateControl();
bool bHaveTouch = (m_TouchIggyCharacters.getWidth() >= 4 && m_TouchIggyCharacters.getHeight() >= 4);
bool bLDown = InputManager.IsMouseLDown();
static char s_szSkinLog[MAX_PATH];
static bool s_bSkinLogInit = false;
if (!s_bSkinLogInit)
{
s_bSkinLogInit = true;
s_szSkinLog[0] = 0;
char szExe[MAX_PATH];
DWORD dwExe = GetModuleFileNameA(NULL, szExe, MAX_PATH);
if (dwExe > 0 && dwExe < MAX_PATH)
{
int lastSlash = -1;
for (int i = 0; szExe[i] != 0; ++i)
if (szExe[i] == '\\') lastSlash = i;
if (lastSlash > 0 && lastSlash + 32 < MAX_PATH)
{
int i = 0;
for (; i <= lastSlash; ++i) s_szSkinLog[i] = szExe[i];
const char *tail = "skin_drag.log";
for (int j = 0; tail[j] != 0; ++j, ++i) s_szSkinLog[i] = tail[j];
s_szSkinLog[i] = 0;
}
}
if (!s_szSkinLog[0])
{
const char *fb = "skin_drag.log";
int i = 0;
for (; fb[i] != 0; ++i) s_szSkinLog[i] = fb[i];
s_szSkinLog[i] = 0;
}
m_probeTabLeft.UpdateControl();
m_probeTabCenter.UpdateControl();
m_probeTabRight.UpdateControl();
FILE *phead = fopen(s_szSkinLog, "a");
if (phead)
{
fprintf(phead, "=== SkinSelect tick alive. touchClip=%dx%d movie=%.0fx%.0f log=%s ===\n",
m_TouchIggyCharacters.getWidth(), m_TouchIggyCharacters.getHeight(),
(float)getMovieWidth(), (float)getMovieHeight(), s_szSkinLog);
fprintf(phead, " probeLeft x=%d y=%d w=%d h=%d | probeCenter x=%d y=%d w=%d h=%d | probeRight x=%d y=%d w=%d h=%d\n",
m_probeTabLeft.getXPos(), m_probeTabLeft.getYPos(),
m_probeTabLeft.getWidth(), m_probeTabLeft.getHeight(),
m_probeTabCenter.getXPos(), m_probeTabCenter.getYPos(),
m_probeTabCenter.getWidth(), m_probeTabCenter.getHeight(),
m_probeTabRight.getXPos(), m_probeTabRight.getYPos(),
m_probeTabRight.getWidth(), m_probeTabRight.getHeight());
fclose(phead);
}
}
if (!bHaveTouch)
{
extern int g_iWindowClientW, g_iWindowClientH;
float fMovieW = (float)getMovieWidth();
float fMovieH = (float)getMovieHeight();
float fx = (float)InputManager.GetMouseX();
float fy = (float)InputManager.GetMouseY();
if (fMovieW > 0.0f && fMovieH > 0.0f && g_iWindowClientW > 0 && g_iWindowClientH > 0)
{
fx = fx * (fMovieW / (float)g_iWindowClientW);
fy = fy * (fMovieH / (float)g_iWindowClientH);
}
m_controlIggyCharacters.UpdateControl();
float ox = (float)m_controlIggyCharacters.getXPos();
float oy = (float)m_controlIggyCharacters.getYPos();
m_characters[eCharacter_Current].UpdateControl();
m_characters[eCharacter_Next1].UpdateControl();
m_characters[eCharacter_Previous1].UpdateControl();
const float pad = 48.0f;
float x1 = ox + (float)m_characters[eCharacter_Current].getXPos();
float y1 = oy + (float)m_characters[eCharacter_Current].getYPos();
float x2 = x1 + (float)m_characters[eCharacter_Current].getWidth();
float y2 = y1 + (float)m_characters[eCharacter_Current].getHeight();
const int adj[2] = { eCharacter_Next1, eCharacter_Previous1 };
for (int i = 0; i < 2; ++i)
{
float ax1 = ox + (float)m_characters[adj[i]].getXPos();
float ay1 = oy + (float)m_characters[adj[i]].getYPos();
float ax2 = ax1 + (float)m_characters[adj[i]].getWidth();
float ay2 = ay1 + (float)m_characters[adj[i]].getHeight();
if (ax2 <= ax1 || ay2 <= ay1) continue;
if (ax1 < x1) x1 = ax1;
if (ay1 < y1) y1 = ay1;
if (ax2 > x2) x2 = ax2;
if (ay2 > y2) y2 = ay2;
}
bool bValidSurface = (x2 > x1 && y2 > y1);
bool bInside = bValidSurface
&& fx >= x1 - pad && fx < x2 + pad
&& fy >= y1 - pad && fy < y2 + pad;
if (bLDown && !m_bMouseLDownPrev)
{
FILE *ppress = fopen(s_szSkinLog[0] ? s_szSkinLog : "skin_drag.log", "a");
if (ppress)
{
fprintf(ppress, "PRESS pt=%.1f,%.1f surf=%.0f,%.0f-%.0f,%.0f valid=%d inside=%d nav=%d skin=%u touch=%dx%d cont=%d,%d\n",
fx, fy, x1, y1, x2, y2, (int)bValidSurface, (int)bInside,
(int)m_currentNavigation, m_skinIndex,
m_TouchIggyCharacters.getWidth(), m_TouchIggyCharacters.getHeight(),
m_controlIggyCharacters.getXPos(), m_controlIggyCharacters.getYPos());
fclose(ppress);
}
}
if (bLDown && !m_bMouseLDownPrev)
{
m_iPressedPackTab = 0;
m_bMouseDragActive = false;
int iTabHit = HitPackTab(fx, fy);
{
FILE *ptab = fopen(s_szSkinLog[0] ? s_szSkinLog : "skin_drag.log", "a");
if (ptab)
{
fprintf(ptab, "PACKPRESS tab=%d nav=%d pack=%u\n", iTabHit, (int)m_currentNavigation, m_packIndex);
fclose(ptab);
}
}
if (iTabHit != 0)
{
m_iPressedPackTab = iTabHit;
if (m_currentNavigation != eSkinNavigation_Pack)
{
ui.PlayUISFX(eSFX_Scroll);
m_currentNavigation = eSkinNavigation_Pack;
sendInputToMovie(ACTION_MENU_UP, false, true, false);
}
}
else if (bInside)
{
if (m_packIndex == SKIN_SELECT_PACK_FAVORITES
&& app.GetPlayerFavoriteSkinsCount(m_iPad) == 0)
{
}
else
{
if (m_currentNavigation != eSkinNavigation_Skin)
{
ui.PlayUISFX(eSFX_Scroll);
m_currentNavigation = eSkinNavigation_Skin;
sendInputToMovie(ACTION_MENU_DOWN, false, true, false);
}
m_fMouseDragStartX = fx;
m_bMouseDragScrolled = false;
m_bMouseDragActive = true;
}
}
}
else if (bLDown && m_bMouseDragActive)
{
if (m_currentNavigation == eSkinNavigation_Skin)
{
if (fx < m_fMouseDragStartX - 50.0f)
{
if (!m_bAnimatingMove && !m_bMouseDragScrolled)
{
ui.PlayUISFX(eSFX_Scroll);
m_skinIndex = getNextSkinIndex(m_skinIndex);
m_bSlidingSkins = true;
m_bAnimatingMove = true;
m_characters[eCharacter_Current].SetFacing(UIControl_PlayerSkinPreview::e_SkinPreviewFacing_Right, true);
m_characters[eCharacter_Next1].SetFacing(UIControl_PlayerSkinPreview::e_SkinPreviewFacing_Forward, true);
sendInputToMovie(ACTION_MENU_LEFT, false, true, false);
m_bMouseDragScrolled = true;
}
}
else if (fx > m_fMouseDragStartX + 50.0f)
{
if (!m_bAnimatingMove && !m_bMouseDragScrolled)
{
ui.PlayUISFX(eSFX_Scroll);
m_skinIndex = getPreviousSkinIndex(m_skinIndex);
m_bSlidingSkins = true;
m_bAnimatingMove = true;
m_characters[eCharacter_Current].SetFacing(UIControl_PlayerSkinPreview::e_SkinPreviewFacing_Left, true);
m_characters[eCharacter_Previous1].SetFacing(UIControl_PlayerSkinPreview::e_SkinPreviewFacing_Forward, true);
sendInputToMovie(ACTION_MENU_RIGHT, false, true, false);
m_bMouseDragScrolled = true;
}
}
}
}
else if (!bLDown && (m_bMouseDragActive || m_iPressedPackTab != 0))
{
int iTabRel = (m_iPressedPackTab != 0) ? HitPackTab(fx, fy) : 0;
FILE *prel = fopen(s_szSkinLog[0] ? s_szSkinLog : "skin_drag.log", "a");
if (prel)
{
fprintf(prel, "RELEASE scrolled=%d skin=%u packTab=%d relTab=%d pack=%u\n",
(int)m_bMouseDragScrolled, m_skinIndex, m_iPressedPackTab, iTabRel, m_packIndex);
fclose(prel);
}
if (m_iPressedPackTab != 0 && iTabRel == m_iPressedPackTab)
{
if (m_currentNavigation == eSkinNavigation_Pack
&& (m_iPressedPackTab == 1 || m_iPressedPackTab == 3))
{
ui.PlayUISFX(eSFX_Scroll);
DWORD startingIndex = m_packIndex;
if (m_iPressedPackTab == 1)
m_packIndex = getPreviousPackIndex(m_packIndex);
else
m_packIndex = getNextPackIndex(m_packIndex);
if (startingIndex != m_packIndex)
{
handlePackIndexChanged();
}
}
}
if (m_bMouseDragActive && !m_bMouseDragScrolled)
{
if (HitSkinPreview(fx, fy) != -1)
InputActionOK(m_iPad);
}
m_bMouseDragActive = false;
m_iPressedPackTab = 0;
}
}
else
{
m_bMouseDragActive = false;
m_iPressedPackTab = 0;
}
m_bMouseLDownPrev = bLDown;
}
#endif
// check for new DLC installed
// check for the patch error dialog
@@ -184,6 +431,80 @@ void UIScene_SkinSelectMenu::tick()
#endif
}
int UIScene_SkinSelectMenu::HitPackTab(float fx, float fy)
{
m_probeTabLeft.UpdateControl();
m_probeTabCenter.UpdateControl();
m_probeTabRight.UpdateControl();
const float tpad = 12.0f;
UIControl *tabs[3] = { &m_probeTabLeft, &m_probeTabCenter, &m_probeTabRight };
bool probesValid = false;
float tabsX[3], tabsY[3], tabsW[3], tabsH[3];
for (int ti = 0; ti < 3; ++ti)
{
float tw = (float)tabs[ti]->getWidth();
float th = (float)tabs[ti]->getHeight();
if (tw >= 4.0f && th >= 4.0f)
{
probesValid = true;
tabsX[ti] = (float)tabs[ti]->getXPos() - tpad;
tabsY[ti] = (float)tabs[ti]->getYPos() - tpad;
tabsW[ti] = tw + tpad * 2.0f;
tabsH[ti] = th + tpad * 2.0f;
}
}
if (probesValid)
{
for (int ti = 0; ti < 3; ++ti)
{
if (fx >= tabsX[ti] && fx < tabsX[ti] + tabsW[ti] && fy >= tabsY[ti] && fy < tabsY[ti] + tabsH[ti])
return ti + 1;
}
}
else
{
float movieH = (float)getMovieHeight();
float tabHeight = movieH * 0.15f;
float tabWidth = (float)getMovieWidth() * 0.33f;
float t = 8.0f;
for (int ti = 0; ti < 3; ++ti)
{
float tx = (float)getMovieWidth() * (ti * 0.33f);
float ty = 0.0f;
if (fx >= tx && fx < tx + tabWidth + t * 2.0f && fy >= ty && fy < ty + tabHeight + t * 2.0f)
return ti + 1;
}
}
return 0;
}
int UIScene_SkinSelectMenu::HitSkinPreview(float fx, float fy)
{
m_controlIggyCharacters.UpdateControl();
m_characters[eCharacter_Current].UpdateControl();
m_characters[eCharacter_Next1].UpdateControl();
m_characters[eCharacter_Previous1].UpdateControl();
float ox = (float)m_controlIggyCharacters.getXPos();
float oy = (float)m_controlIggyCharacters.getYPos();
const int ids[3] = { eCharacter_Previous1, eCharacter_Current, eCharacter_Next1 };
for (int k = 0; k < 3; ++k)
{
int id = ids[k];
float w = (float)m_characters[id].getWidth();
float h = (float)m_characters[id].getHeight();
if (w < 4.0f || h < 4.0f) continue;
float x = ox + (float)m_characters[id].getXPos();
float y = oy + (float)m_characters[id].getYPos();
if (fx >= x && fx < x + w && fy >= y && fy < y + h)
return id;
}
return -1;
}
void UIScene_SkinSelectMenu::handleAnimationEnd()
{
if(m_bSlidingSkins)
@@ -1300,7 +1621,7 @@ void UIScene_SkinSelectMenu::setRightLabel(const wstring &label)
}
}
#ifdef __PSVITA__
#if defined(__PSVITA__) || defined(_WINDOWS64)
void UIScene_SkinSelectMenu::handleTouchInput(unsigned int iPad, S32 x, S32 y, int iId, bool bPressed, bool bRepeat, bool bReleased)
{
if(bPressed)