1
0
Fork 0
mirror of https://git.rip/DMCA_FUCKER/re3.git synced 2024-12-23 12:20:00 +00:00

fixed some stuff in frontend, badly broke others; disabled reversed frontend for the moment

This commit is contained in:
aap 2019-07-10 13:42:48 +02:00
parent 0d3cdcc01c
commit d360229b5b
6 changed files with 322 additions and 202 deletions

View file

@ -27,6 +27,8 @@
#include "PlayerInfo.h" #include "PlayerInfo.h"
#include "World.h" #include "World.h"
#define ALL_ORIGINAL_FRONTEND 1
int32 &CMenuManager::OS_Language = *(int32*)0x5F2F78; int32 &CMenuManager::OS_Language = *(int32*)0x5F2F78;
int8 &CMenuManager::m_PrefsUseVibration = *(int8*)0x95CD92; int8 &CMenuManager::m_PrefsUseVibration = *(int8*)0x95CD92;
int8 &CMenuManager::m_DisplayControllerOnFoot = *(int8*)0x95CD8D; int8 &CMenuManager::m_DisplayControllerOnFoot = *(int8*)0x95CD8D;
@ -62,9 +64,9 @@ CMenuManager &FrontEndMenuManager = *(CMenuManager*)0x8F59D8;
float lodMultiplier = *(float*)0x5F726C; float lodMultiplier = *(float*)0x5F726C;
// Stuff not in CMenuManager: // Stuff not in CMenuManager:
int VibrationTime; uint32 VibrationTime;
char* pEditString = (char*)0x628D00; char* pEditString = (char*)0x628D00;
int32 &pControlEdit = *(int32*)0x628D08; int32 *&pControlEdit = *(int32**)0x628D08;
int8 DisplayComboButtonErrMsg; int8 DisplayComboButtonErrMsg;
int8 MouseButtonJustClicked; int8 MouseButtonJustClicked;
int8 JoyButtonJustClicked; int8 JoyButtonJustClicked;
@ -73,6 +75,7 @@ int32 TypeOfControl = 0;
int32 *pControlTemp = 0; int32 *pControlTemp = 0;
// Frontend inputs. // Frontend inputs.
bool GetPadBack(); bool GetPadBack();
bool GetPadExitEnter(); bool GetPadExitEnter();
bool GetPadForward(); bool GetPadForward();
@ -80,6 +83,11 @@ bool GetPadMoveUp();
bool GetPadMoveDown(); bool GetPadMoveDown();
bool GetPadMoveLeft(); bool GetPadMoveLeft();
bool GetPadMoveRight(); bool GetPadMoveRight();
bool GetMouseClickLeft();
bool GetMouseClickRight();
bool GetMouseClickMiddle();
bool GetMouseWheelUp();
bool GetMouseWheelDown();
bool GetMouseForward(); bool GetMouseForward();
bool GetMouseBack(); bool GetMouseBack();
bool GetMousePos(); bool GetMousePos();
@ -142,7 +150,7 @@ char *MenuFilenames[] = {
nil, nil nil, nil
}; };
#if 0 #if ALL_ORIGINAL_FRONTEND
WRAPPER void CMenuManager::BuildStatLine(char *text, float *stat, bool aFloat, float* stat2) { EAXJMP(0x483870); } WRAPPER void CMenuManager::BuildStatLine(char *text, float *stat, bool aFloat, float* stat2) { EAXJMP(0x483870); }
#else #else
void CMenuManager::BuildStatLine(char *text, float *stat, bool aFloat, float* stat2) void CMenuManager::BuildStatLine(char *text, float *stat, bool aFloat, float* stat2)
@ -150,24 +158,27 @@ void CMenuManager::BuildStatLine(char *text, float *stat, bool aFloat, float* st
if (!text) if (!text)
return; return;
if (stat) { if (stat2) {
if (aFloat) if (aFloat)
sprintf(gString, "%.2f"); sprintf(gString2, " %.2f %s %.2f", *stat, UnicodeToAscii(TheText.Get("FEST_OO")), *stat2);
else else
sprintf(gString, "%d"); sprintf(gString2, " %d %s %d", *(int*)stat, UnicodeToAscii(TheText.Get("FEST_OO")), *(int*)stat2);
} }
else if (stat2) { else if (stat2) {
if (aFloat) if (aFloat)
sprintf(gString, "%.2f %s %.2f", stat, UnicodeToAscii(TheText.Get("FEST_OO")), stat2); sprintf(gString2, " %.2f", *stat);
else else
sprintf(gString, "%d %s %d", stat, UnicodeToAscii(TheText.Get("FEST_OO")), stat2); sprintf(gString2, " %d", *(int*)stat);
} }
else
gString2[0] = '\0';
wcscpy((wchar_t*)gUString, (wchar_t*)TheText.Get(text)); UnicodeStrcpy(gUString, TheText.Get(text));
AsciiToUnicode(gString2, gUString2);
} }
#endif #endif
#if 0 #if ALL_ORIGINAL_FRONTEND
WRAPPER void CMenuManager::CentreMousePointer() { EAXJMP(0x48ACE0); } WRAPPER void CMenuManager::CentreMousePointer() { EAXJMP(0x48ACE0); }
#else #else
void CMenuManager::CentreMousePointer() void CMenuManager::CentreMousePointer()
@ -195,7 +206,7 @@ void CMenuManager::CheckCodesForControls(int, int)
} }
#endif #endif
#if 0 #if ALL_ORIGINAL_FRONTEND
WRAPPER bool CMenuManager::CheckHover(int, int, int, int) { EAXJMP(0x48ACA0); } WRAPPER bool CMenuManager::CheckHover(int, int, int, int) { EAXJMP(0x48ACA0); }
#else #else
bool CMenuManager::CheckHover(int x1, int x2, int y1, int y2) bool CMenuManager::CheckHover(int x1, int x2, int y1, int y2)
@ -274,7 +285,7 @@ void CMenuManager::CheckSliderMovement(int value)
TheCamera.m_fMouseAccelVertical = fMouseSens; TheCamera.m_fMouseAccelVertical = fMouseSens;
SaveSettings(); SaveSettings();
break; break;
}; }
} }
#if 1 #if 1
@ -286,7 +297,7 @@ int CMenuManager::CostructStatLine(int)
} }
#endif #endif
#if 0 #if ALL_ORIGINAL_FRONTEND
WRAPPER void CMenuManager::DisplayHelperText() { EAXJMP(0x48B490); } WRAPPER void CMenuManager::DisplayHelperText() { EAXJMP(0x48B490); }
#else #else
void CMenuManager::DisplayHelperText() void CMenuManager::DisplayHelperText()
@ -326,7 +337,7 @@ void CMenuManager::DisplayHelperText()
break; break;
default: default:
break; break;
}; }
CFont::SetAlignment(ALIGN_CENTER); CFont::SetAlignment(ALIGN_CENTER);
CFont::SetScale(SCREEN_SCALE_X(0.4f), SCREEN_SCALE_Y(0.6f)); CFont::SetScale(SCREEN_SCALE_X(0.4f), SCREEN_SCALE_Y(0.6f));
@ -339,7 +350,7 @@ void CMenuManager::DisplayHelperText()
} }
#endif #endif
#if 0 #if ALL_ORIGINAL_FRONTEND
WRAPPER float CMenuManager::DisplaySlider(float, float, float, float, float, float) { EAXJMP(0x488420); } WRAPPER float CMenuManager::DisplaySlider(float, float, float, float, float, float) { EAXJMP(0x488420); }
#else #else
float CMenuManager::DisplaySlider(float x, float y, float leftSize, float rightSize, float rectSize, float progress) float CMenuManager::DisplaySlider(float x, float y, float leftSize, float rightSize, float rectSize, float progress)
@ -365,12 +376,12 @@ float CMenuManager::DisplaySlider(float x, float y, float leftSize, float rightS
float _s = SCREEN_SCALE_X(2.0f); float _s = SCREEN_SCALE_X(2.0f);
CSprite2d::DrawRect(CRect(_x + _s, _y + _s, _w + _s, _h + _s), CRGBA(0, 0, 0, FadeIn(255))); // Shadow CSprite2d::DrawRect(CRect(_x + _s, _y + _s, _w + _s, _h + _s), CRGBA(0, 0, 0, FadeIn(255))); // Shadow
CSprite2d::DrawRect(CRect(i * rectSize/16.0f + x, y + sizeRange - ((16 - i) * leftSize + i * rightSize)/16.0f, SCREEN_SCALE_X(10.0f) + i * rectSize/16.0f + x, y + sizeRange), color); CSprite2d::DrawRect(CRect(i * rectSize/16.0f + x, y + sizeRange - ((16 - i) * leftSize + i * rightSize)/16.0f, SCREEN_SCALE_X(10.0f) + i * rectSize/16.0f + x, y + sizeRange), color);
}; }
return input; return input;
} }
#endif #endif
#if 0 #if ALL_ORIGINAL_FRONTEND
WRAPPER void CMenuManager::DoSettingsBeforeStartingAGame() { EAXJMP(0x48AB40); } WRAPPER void CMenuManager::DoSettingsBeforeStartingAGame() { EAXJMP(0x48AB40); }
#else #else
void CMenuManager::DoSettingsBeforeStartingAGame() void CMenuManager::DoSettingsBeforeStartingAGame()
@ -389,7 +400,7 @@ void CMenuManager::DoSettingsBeforeStartingAGame()
} }
#endif #endif
#if 0 #if ALL_ORIGINAL_FRONTEND
WRAPPER void CMenuManager::Draw() { EAXJMP(0x47AE00); } WRAPPER void CMenuManager::Draw() { EAXJMP(0x47AE00); }
#else #else
void CMenuManager::Draw() void CMenuManager::Draw()
@ -450,7 +461,7 @@ void CMenuManager::Draw()
default: default:
str = TheText.Get(aScreens[m_nCurrScreen].m_aEntries[0].m_EntryName); str = TheText.Get(aScreens[m_nCurrScreen].m_aEntries[0].m_EntryName);
break; break;
}; }
CFont::SetDropShadowPosition(MENUDROP_COLOR_SIZE); CFont::SetDropShadowPosition(MENUDROP_COLOR_SIZE);
CFont::SetDropColor(CRGBA(0, 0, 0, FadeIn(MENUDROP_COLOR_A))); CFont::SetDropColor(CRGBA(0, 0, 0, FadeIn(MENUDROP_COLOR_A)));
@ -503,7 +514,7 @@ void CMenuManager::Draw()
case 3: case 3:
textToPrint[MENUCOLUMN_RIGHT] = TheText.Get("FEC_CF4"); textToPrint[MENUCOLUMN_RIGHT] = TheText.Get("FEC_CF4");
break; break;
}; }
break; break;
case MENUACTION_CTRLDISPLAY: case MENUACTION_CTRLDISPLAY:
break; break;
@ -533,7 +544,7 @@ void CMenuManager::Draw()
case AR_16_9: case AR_16_9:
textToPrint[MENUCOLUMN_RIGHT] = (wchar*)L"16:9"; textToPrint[MENUCOLUMN_RIGHT] = (wchar*)L"16:9";
break; break;
}; }
#endif #endif
break; break;
case MENUACTION_RADIO: case MENUACTION_RADIO:
@ -583,7 +594,7 @@ void CMenuManager::Draw()
case 2: case 2:
textToPrint[MENUCOLUMN_RIGHT] = TheText.Get("FEA_4SP"); textToPrint[MENUCOLUMN_RIGHT] = TheText.Get("FEA_4SP");
break; break;
}; }
} }
break; break;
case MENUACTION_CTRLMETHOD: case MENUACTION_CTRLMETHOD:
@ -594,7 +605,7 @@ void CMenuManager::Draw()
case 1: case 1:
textToPrint[MENUCOLUMN_LEFT] = TheText.Get("FET_CCN"); textToPrint[MENUCOLUMN_LEFT] = TheText.Get("FET_CCN");
break; break;
}; }
break; break;
case MENUACTION_DYNAMICACOUSTIC: case MENUACTION_DYNAMICACOUSTIC:
textToPrint[MENUCOLUMN_RIGHT] = TheText.Get(m_PrefsDMA ? "FEM_ON" : "FEM_OFF"); textToPrint[MENUCOLUMN_RIGHT] = TheText.Get(m_PrefsDMA ? "FEM_ON" : "FEM_OFF");
@ -602,7 +613,7 @@ void CMenuManager::Draw()
case MENUACTION_MOUSESTEER: case MENUACTION_MOUSESTEER:
textToPrint[MENUCOLUMN_RIGHT] = TheText.Get(m_bDisableMouseSteering ? "FEM_ON" : "FEM_OFF"); textToPrint[MENUCOLUMN_RIGHT] = TheText.Get(m_bDisableMouseSteering ? "FEM_ON" : "FEM_OFF");
break; break;
}; }
CFont::SetDropShadowPosition(MENUDROP_COLOR_SIZE); CFont::SetDropShadowPosition(MENUDROP_COLOR_SIZE);
CFont::SetDropColor(CRGBA(0, 0, 0, FadeIn(MENUDROP_COLOR_A))); CFont::SetDropColor(CRGBA(0, 0, 0, FadeIn(MENUDROP_COLOR_A)));
@ -690,7 +701,7 @@ void CMenuManager::Draw()
default: default:
vecPositions.y = (SCREEN_HEIGHT / 2) - SCREEN_SCALE_Y(MENUCOLUMN_MID_Y); vecPositions.y = (SCREEN_HEIGHT / 2) - SCREEN_SCALE_Y(MENUCOLUMN_MID_Y);
break; break;
}; }
} }
if (i > 0) if (i > 0)
@ -767,7 +778,7 @@ void CMenuManager::Draw()
case MENUACTION_MOUSESENS: case MENUACTION_MOUSESENS:
DisplaySlider(SCREEN_SCALE_FROM_RIGHT(MENUSLIDER_X), vecPositions.y - SCREEN_SCALE_Y(3.0f), SCREEN_SCALE_Y(2.0f), SCREEN_SCALE_Y(18.0f), SCREEN_SCALE_X(256.0f), TheCamera.m_fMouseAccelHorzntl * 200.0f); DisplaySlider(SCREEN_SCALE_FROM_RIGHT(MENUSLIDER_X), vecPositions.y - SCREEN_SCALE_Y(3.0f), SCREEN_SCALE_Y(2.0f), SCREEN_SCALE_Y(18.0f), SCREEN_SCALE_X(256.0f), TheCamera.m_fMouseAccelHorzntl * 200.0f);
break; break;
}; }
// Radio icons. // Radio icons.
float fIconSpacing = 59.52f; float fIconSpacing = 59.52f;
@ -816,9 +827,9 @@ void CMenuManager::Draw()
case MENUPAGE_MOUSE_CONTROLS: case MENUPAGE_MOUSE_CONTROLS:
DisplayHelperText(); DisplayHelperText();
break; break;
};
} }
}; }
}
} }
#endif #endif
@ -849,7 +860,7 @@ void CMenuManager::DrawControllerSetupScreen()
} }
#endif #endif
#if 0 #if ALL_ORIGINAL_FRONTEND
WRAPPER void CMenuManager::DrawFrontEnd(void) { EAXJMP(0x47A540); } WRAPPER void CMenuManager::DrawFrontEnd(void) { EAXJMP(0x47A540); }
#else #else
void CMenuManager::DrawFrontEnd() void CMenuManager::DrawFrontEnd()
@ -873,7 +884,7 @@ void CMenuManager::DrawFrontEnd()
} }
#endif #endif
#if 0 #if ALL_ORIGINAL_FRONTEND
WRAPPER void CMenuManager::DrawFrontEndNormal(void) { EAXJMP(0x47A5B0); } WRAPPER void CMenuManager::DrawFrontEndNormal(void) { EAXJMP(0x47A5B0); }
#else #else
void CMenuManager::DrawFrontEndNormal() void CMenuManager::DrawFrontEndNormal()
@ -927,7 +938,7 @@ void CMenuManager::DrawFrontEndNormal()
case MENUPAGE_OPTIONS: case MENUPAGE_OPTIONS:
previousSprite = MENUSPRITE_PLAYERSET; previousSprite = MENUSPRITE_PLAYERSET;
break; break;
}; }
if (m_nPrevScreen == MENUPAGE_NONE) if (m_nPrevScreen == MENUPAGE_NONE)
CSprite2d::DrawRect(CRect(0.0f, 0.0f, SCREEN_WIDTH, SCREEN_HEIGHT), CRGBA(0, 0, 0, 255)); CSprite2d::DrawRect(CRect(0.0f, 0.0f, SCREEN_WIDTH, SCREEN_HEIGHT), CRGBA(0, 0, 0, 255));
@ -972,7 +983,7 @@ void CMenuManager::DrawFrontEndNormal()
case MENUPAGE_OPTIONS: case MENUPAGE_OPTIONS:
currentSprite = MENUSPRITE_PLAYERSET; currentSprite = MENUSPRITE_PLAYERSET;
break; break;
}; }
uint32 savedShade; uint32 savedShade;
uint32 savedAlpha; uint32 savedAlpha;
@ -1016,7 +1027,7 @@ void CMenuManager::DrawFrontEndNormal()
default: default:
CMenuManager::Draw(); CMenuManager::Draw();
break; break;
}; }
CFont::DrawFonts(); CFont::DrawFonts();
@ -1035,7 +1046,7 @@ void CMenuManager::DrawPlayerSetupScreen()
} }
#endif #endif
#if 0 #if ALL_ORIGINAL_FRONTEND
WRAPPER int CMenuManager::FadeIn(int alpha) { EAXJMP(0x48AC60); } WRAPPER int CMenuManager::FadeIn(int alpha) { EAXJMP(0x48AC60); }
#else #else
int CMenuManager::FadeIn(int alpha) int CMenuManager::FadeIn(int alpha)
@ -1070,7 +1081,7 @@ int CMenuManager::GetStartOptionsCntrlConfigScreens()
} }
#endif #endif
#if 0 #if ALL_ORIGINAL_FRONTEND
WRAPPER void CMenuManager::InitialiseChangedLanguageSettings() { EAXJMP(0x47A4D0); } WRAPPER void CMenuManager::InitialiseChangedLanguageSettings() { EAXJMP(0x47A4D0); }
#else #else
void CMenuManager::InitialiseChangedLanguageSettings() void CMenuManager::InitialiseChangedLanguageSettings()
@ -1092,12 +1103,12 @@ void CMenuManager::InitialiseChangedLanguageSettings()
break; break;
default: default:
break; break;
}; }
} }
} }
#endif #endif
#if 0 #if ALL_ORIGINAL_FRONTEND
WRAPPER void CMenuManager::LoadAllTextures() { EAXJMP(0x47A230); } WRAPPER void CMenuManager::LoadAllTextures() { EAXJMP(0x47A230); }
#else #else
void CMenuManager::LoadAllTextures() void CMenuManager::LoadAllTextures()
@ -1133,7 +1144,7 @@ void CMenuManager::LoadAllTextures()
for (int i = 0; i < ARRAY_SIZE(FrontendFilenames); i++) { for (int i = 0; i < ARRAY_SIZE(FrontendFilenames); i++) {
m_aFrontEndSprites[i].SetTexture(FrontendFilenames[i]); m_aFrontEndSprites[i].SetTexture(FrontendFilenames[i]);
m_aFrontEndSprites[i].SetAddressing(rwTEXTUREADDRESSBORDER); m_aFrontEndSprites[i].SetAddressing(rwTEXTUREADDRESSBORDER);
}; }
CTxdStore::PopCurrentTxd(); CTxdStore::PopCurrentTxd();
@ -1146,7 +1157,7 @@ void CMenuManager::LoadAllTextures()
for (int i = 0; i < ARRAY_SIZE(MenuFilenames)/2; i++) { for (int i = 0; i < ARRAY_SIZE(MenuFilenames)/2; i++) {
m_aMenuSprites[i].SetTexture(MenuFilenames[i*2], MenuFilenames[i*2+1]); m_aMenuSprites[i].SetTexture(MenuFilenames[i*2], MenuFilenames[i*2+1]);
m_aMenuSprites[i].SetAddressing(rwTEXTUREADDRESSBORDER); m_aMenuSprites[i].SetAddressing(rwTEXTUREADDRESSBORDER);
}; }
CTxdStore::PopCurrentTxd(); CTxdStore::PopCurrentTxd();
@ -1155,7 +1166,7 @@ void CMenuManager::LoadAllTextures()
} }
#endif #endif
#if 0 #if ALL_ORIGINAL_FRONTEND
WRAPPER void CMenuManager::LoadSettings() { EAXJMP(0x488EE0); } WRAPPER void CMenuManager::LoadSettings() { EAXJMP(0x488EE0); }
#else #else
void CMenuManager::LoadSettings() void CMenuManager::LoadSettings()
@ -1174,13 +1185,13 @@ void CMenuManager::LoadSettings()
if (strncmp(&Ver, "THIS FILE IS NOT VALID YET", 26)) { if (strncmp(&Ver, "THIS FILE IS NOT VALID YET", 26)) {
CFileMgr::Seek(fileHandle, 0, 0); CFileMgr::Seek(fileHandle, 0, 0);
ControlsManager.LoadSettings(fileHandle); ControlsManager.LoadSettings(fileHandle);
CFileMgr::Read(fileHandle, buf(&gString), 20); CFileMgr::Read(fileHandle, buf(gString), 20);
CFileMgr::Read(fileHandle, buf(&gString), 20); CFileMgr::Read(fileHandle, buf(gString), 20);
CFileMgr::Read(fileHandle, buf(&gString), 4); CFileMgr::Read(fileHandle, buf(gString), 4);
CFileMgr::Read(fileHandle, buf(&gString), 4); CFileMgr::Read(fileHandle, buf(gString), 4);
CFileMgr::Read(fileHandle, buf(&gString), 1); CFileMgr::Read(fileHandle, buf(gString), 1);
CFileMgr::Read(fileHandle, buf(&gString), 1); CFileMgr::Read(fileHandle, buf(gString), 1);
CFileMgr::Read(fileHandle, buf(&gString), 1); CFileMgr::Read(fileHandle, buf(gString), 1);
CFileMgr::Read(fileHandle, buf(&TheCamera.m_bHeadBob), 1); CFileMgr::Read(fileHandle, buf(&TheCamera.m_bHeadBob), 1);
CFileMgr::Read(fileHandle, buf(&TheCamera.m_fMouseAccelHorzntl), 4); CFileMgr::Read(fileHandle, buf(&TheCamera.m_fMouseAccelHorzntl), 4);
CFileMgr::Read(fileHandle, buf(&TheCamera.m_fMouseAccelVertical), 4); CFileMgr::Read(fileHandle, buf(&TheCamera.m_fMouseAccelVertical), 4);
@ -1276,7 +1287,7 @@ void CMenuManager::PrintBriefs()
} }
#endif #endif
#if 0 #if ALL_ORIGINAL_FRONTEND
WRAPPER void CMenuManager::PrintErrorMessage() { EAXJMP(0x484F70); } WRAPPER void CMenuManager::PrintErrorMessage() { EAXJMP(0x484F70); }
#else #else
void CMenuManager::PrintErrorMessage() void CMenuManager::PrintErrorMessage()
@ -1309,34 +1320,27 @@ void CMenuManager::PrintStats()
} }
#endif #endif
#if 0 #if ALL_ORIGINAL_FRONTEND
WRAPPER void CMenuManager::Process(void) { EAXJMP(0x485100); } WRAPPER void CMenuManager::Process(void) { EAXJMP(0x485100); }
#else #else
void CMenuManager::Process(void) void CMenuManager::Process(void)
{ {
if (!m_bSaveMenuActive && TheCamera.GetScreenFadeStatus()) field_112 = 0;
if (!m_bSaveMenuActive && TheCamera.GetScreenFadeStatus() != FADE_0)
return; return;
field_112 = 0; //m_bLanguageLoaded = false; //XXX
m_bLanguageLoaded = false;
m_bStartGameLoading = false; m_bStartGameLoading = false;
InitialiseChangedLanguageSettings(); InitialiseChangedLanguageSettings();
// if (GetPadExitEnter()) //XXX only escape
RequestFrontEndStartUp();
SwitchMenuOnAndOff(); SwitchMenuOnAndOff();
// Be able to re-open menu correctly. // Be able to re-open menu correctly.
if (!m_bMenuActive) { if (m_bMenuActive) {
if (GetPadExitEnter())
RequestFrontEndStartUp();
UnloadTextures();
field_452 = 0;
SwitchToNewScreen(MENUPAGE_NONE);
pEditString = 0;
field_113 = 0;
return;
}
// Load frontend textures. // Load frontend textures.
LoadAllTextures(); LoadAllTextures();
@ -1392,40 +1396,29 @@ void CMenuManager::Process(void)
ProcessButtonPresses(); ProcessButtonPresses();
// Set binding keys. // Set binding keys.
if (pEditString && !CPad::EditString(pEditString, 0)) { if (pEditString && CPad::EditString(pEditString, 0) == nil) {
if (!pEditString) if (*pEditString == 0)
strcpy(pEditString, "NoName"); strcpy(pEditString, "NoName");
pEditString = 0; pEditString = nil;
SaveSettings(); SaveSettings();
} }
if (field_113) { if (field_113 && !field_456) {
if ((m_nCurrScreen == MENUPAGE_13 || m_nCurrScreen == MENUPAGE_16) && CTimer::GetTimeInMillisecondsPauseMode() > field_558) pControlEdit = CPad::EditCodesForControls(pControlEdit, 1);
SwitchToNewScreen(m_nPrevScreen);
// Reset pad shaking.
if (VibrationTime && CTimer::GetTimeInMillisecondsPauseMode() > VibrationTime) {
CPad::GetPad(0)->StopPadsShaking();
VibrationTime = 0;
}
if (m_bStartGameLoading) {
if (m_bGameNotLoaded)
DMAudio.Service();
}
}
if (!field_456) {
JoyButtonJustClicked = 0; JoyButtonJustClicked = 0;
CPad::EditCodesForControls(&pControlEdit, 0);
MouseButtonJustClicked = 0; MouseButtonJustClicked = 0;
if (GetMouseForward()) if (GetMouseClickLeft())
MouseButtonJustClicked = 1; MouseButtonJustClicked = 1;
else { else if (GetMouseClickRight())
if (GetMouseBack())
MouseButtonJustClicked = 3; MouseButtonJustClicked = 3;
} else if (GetMouseClickMiddle())
MouseButtonJustClicked = 2;
else if (GetMouseWheelUp())
MouseButtonJustClicked = 4;
else if (GetMouseWheelDown())
MouseButtonJustClicked = 5;
//XXX two more buttons
JoyButtonJustClicked = ControlsManager.GetJoyButtonJustDown(); JoyButtonJustClicked = ControlsManager.GetJoyButtonJustDown();
@ -1433,33 +1426,74 @@ void CMenuManager::Process(void)
TypeOfControl = 3; TypeOfControl = 3;
if (MouseButtonJustClicked) if (MouseButtonJustClicked)
TypeOfControl = 2; TypeOfControl = 2;
if (pControlEdit != 1056) if (*pControlEdit != rsNULL)
TypeOfControl = 0; TypeOfControl = 0;
if (field_534) { if (!field_534) {
if (!m_bKeyChangeNotProcessed) { DMAudio.PlayFrontEndSound(SOUND_FRONTEND_FAIL, 0);
if (pControlEdit != 1056 || MouseButtonJustClicked || JoyButtonJustClicked) pControlEdit = nil;
field_113 = 0;
m_KeyPressedCode = -1;
field_456 = 0;
}
else if (!m_bKeyChangeNotProcessed) {
if (*pControlEdit != rsNULL || MouseButtonJustClicked || JoyButtonJustClicked)
CheckCodesForControls(TypeOfControl); CheckCodesForControls(TypeOfControl);
field_535 = 1; field_535 = 1;
return; }
else {
DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_SUCCESS, 0);
for (int i = 0; i < 4; i++)
ControlsManager.ClearSettingsAssociatedWithAction(m_CurrCntrlAction, i);
field_534 = false;
m_bKeyChangeNotProcessed = false;
pControlEdit = nil;
field_113 = 0;
m_KeyPressedCode = -1;
field_456 = 0;
}
}
if ((m_nCurrScreen == MENUPAGE_13 || m_nCurrScreen == MENUPAGE_16) && CTimer::GetTimeInMillisecondsPauseMode() > field_558) {
m_nCurrScreen = m_nPrevScreen;
m_nCurrOption = 0;
}
// Reset pad shaking.
if (VibrationTime && CTimer::GetTimeInMillisecondsPauseMode() > VibrationTime) {
CPad::StopPadsShaking();
VibrationTime = 0;
} }
} }
else { else {
pControlEdit = 0; UnloadTextures();
field_452 = 0;
// byte_5F33E4 = 1; // unused
m_nPrevScreen = 0;
m_nCurrScreen = m_nPrevScreen;
m_nCurrOption = 0;
pEditString = nil;
field_113 = 0; field_113 = 0;
m_KeyPressedCode = -1;
} }
if (!m_bStartGameLoading) {
if (m_bGameNotLoaded)
DMAudio.Service();
} }
field_456 = 0;
} }
#endif #endif
#if 0 #if ALL_ORIGINAL_FRONTEND
WRAPPER void CMenuManager::ProcessButtonPresses() { EAXJMP(0x4856F0); } WRAPPER void CMenuManager::ProcessButtonPresses() { EAXJMP(0x4856F0); }
#else #else
void CMenuManager::ProcessButtonPresses() void CMenuManager::ProcessButtonPresses()
{ {
if(pEditString)
return;
if(pControlEdit)
return;
// Update mouse position // Update mouse position
m_nMouseOldPosX = m_nMousePosX; m_nMouseOldPosX = m_nMousePosX;
m_nMouseOldPosY = m_nMousePosY; m_nMouseOldPosY = m_nMousePosY;
@ -1500,7 +1534,7 @@ void CMenuManager::ProcessButtonPresses()
field_113 = 1; field_113 = 1;
field_456 = 1; field_456 = 1;
m_bKeyChangeNotProcessed = 1; m_bKeyChangeNotProcessed = 1;
//pControlEdit = m_KeyPressedCode; pControlEdit = &m_KeyPressedCode;
} }
if (GetPadForward()) { if (GetPadForward()) {
@ -1509,7 +1543,7 @@ void CMenuManager::ProcessButtonPresses()
if (m_nCurrScreen == MENUPAGE_KEYBOARD_CONTROLS) { if (m_nCurrScreen == MENUPAGE_KEYBOARD_CONTROLS) {
field_113 = 1; field_113 = 1;
field_456 = 1; field_456 = 1;
//pControlEdit = m_KeyPressedCode; pControlEdit = &m_KeyPressedCode;
} }
if (m_nCurrScreen == MENUPAGE_SKIN_SELECT) { if (m_nCurrScreen == MENUPAGE_SKIN_SELECT) {
strcpy(m_PrefsSkinFile, m_aSkinName); strcpy(m_PrefsSkinFile, m_aSkinName);
@ -1527,7 +1561,7 @@ void CMenuManager::ProcessButtonPresses()
break; break;
default: default:
break; break;
}; }
} }
bool once = false; bool once = false;
@ -1604,7 +1638,7 @@ void CMenuManager::ProcessButtonPresses()
SwitchToNewScreen(aScreens[m_nCurrScreen].m_PreviousPage[0]); SwitchToNewScreen(aScreens[m_nCurrScreen].m_PreviousPage[0]);
PlayEscSound = true; PlayEscSound = true;
break; break;
}; }
if (PlayEscSound) if (PlayEscSound)
DMAudio.PlayFrontEndSound(SOUND_FRONTEND_EXIT, 0); DMAudio.PlayFrontEndSound(SOUND_FRONTEND_EXIT, 0);
@ -1639,7 +1673,7 @@ void CMenuManager::ProcessButtonPresses()
default: default:
m_nHoverOption = HOVEROPTION_NULL; m_nHoverOption = HOVEROPTION_NULL;
break; break;
}; }
} }
// Process all menu options here, but first check if it's an option or a redirect. // Process all menu options here, but first check if it's an option or a redirect.
@ -1675,11 +1709,11 @@ void CMenuManager::ProcessButtonPresses()
break; break;
default: default:
break; break;
}; }
} }
#endif #endif
#if 0 #if ALL_ORIGINAL_FRONTEND
WRAPPER void CMenuManager::ProcessOnOffMenuOptions() { EAXJMP(0x48AE60); } WRAPPER void CMenuManager::ProcessOnOffMenuOptions() { EAXJMP(0x48AE60); }
#else #else
void CMenuManager::ProcessOnOffMenuOptions() void CMenuManager::ProcessOnOffMenuOptions()
@ -1740,7 +1774,7 @@ void CMenuManager::ProcessOnOffMenuOptions()
case AR_16_9: case AR_16_9:
m_PrefsUseWideScreen = AR_AUTO; m_PrefsUseWideScreen = AR_AUTO;
break; break;
}; }
} }
else { else {
switch (m_PrefsUseWideScreen) { switch (m_PrefsUseWideScreen) {
@ -1753,7 +1787,7 @@ void CMenuManager::ProcessOnOffMenuOptions()
case AR_16_9: case AR_16_9:
m_PrefsUseWideScreen = AR_4_3; m_PrefsUseWideScreen = AR_4_3;
break; break;
}; }
} }
#endif #endif
SaveSettings(); SaveSettings();
@ -1999,7 +2033,7 @@ void CMenuManager::ProcessOnOffMenuOptions()
case 2: case 2:
m_PrefsSpeakers = 0; m_PrefsSpeakers = 0;
break; break;
}; }
} }
else { else {
switch (m_PrefsSpeakers) { switch (m_PrefsSpeakers) {
@ -2012,7 +2046,7 @@ void CMenuManager::ProcessOnOffMenuOptions()
case 2: case 2:
m_PrefsSpeakers = 1; m_PrefsSpeakers = 1;
break; break;
}; }
} }
DMAudio.SetSpeakerConfig(m_PrefsSpeakers); DMAudio.SetSpeakerConfig(m_PrefsSpeakers);
@ -2040,11 +2074,11 @@ void CMenuManager::ProcessOnOffMenuOptions()
case MENUACTION_MOUSESTEER: case MENUACTION_MOUSESTEER:
m_bDisableMouseSteering = m_bDisableMouseSteering == false; m_bDisableMouseSteering = m_bDisableMouseSteering == false;
return; return;
}; }
} }
#endif #endif
#if 0 #if ALL_ORIGINAL_FRONTEND
WRAPPER void CMenuManager::RequestFrontEndShutdown() { EAXJMP(0x488750); } WRAPPER void CMenuManager::RequestFrontEndShutdown() { EAXJMP(0x488750); }
#else #else
void CMenuManager::RequestFrontEndShutdown() void CMenuManager::RequestFrontEndShutdown()
@ -2054,7 +2088,7 @@ void CMenuManager::RequestFrontEndShutdown()
} }
#endif #endif
#if 0 #if ALL_ORIGINAL_FRONTEND
WRAPPER void CMenuManager::RequestFrontEndStartUp() { EAXJMP(0x488770); } WRAPPER void CMenuManager::RequestFrontEndStartUp() { EAXJMP(0x488770); }
#else #else
void CMenuManager::RequestFrontEndStartUp() void CMenuManager::RequestFrontEndStartUp()
@ -2063,7 +2097,7 @@ void CMenuManager::RequestFrontEndStartUp()
} }
#endif #endif
#if 0 #if ALL_ORIGINAL_FRONTEND
WRAPPER void CMenuManager::ResetHelperText() { EAXJMP(0x48B470); } WRAPPER void CMenuManager::ResetHelperText() { EAXJMP(0x48B470); }
#else #else
void CMenuManager::ResetHelperText() void CMenuManager::ResetHelperText()
@ -2073,7 +2107,7 @@ void CMenuManager::ResetHelperText()
} }
#endif #endif
#if 0 #if ALL_ORIGINAL_FRONTEND
WRAPPER void CMenuManager::SaveLoadFileError_SetUpErrorScreen() { EAXJMP(0x488930); } WRAPPER void CMenuManager::SaveLoadFileError_SetUpErrorScreen() { EAXJMP(0x488930); }
#else #else
void CMenuManager::SaveLoadFileError_SetUpErrorScreen() void CMenuManager::SaveLoadFileError_SetUpErrorScreen()
@ -2116,8 +2150,8 @@ void CMenuManager::SaveLoadFileError_SetUpErrorScreen()
} }
#endif #endif
#if 0 #if ALL_ORIGINAL_FRONTEND
WRAPPER void CMenuManager::SetHelperText() { EAXJMP(0x48B450); } WRAPPER void CMenuManager::SetHelperText(int text) { EAXJMP(0x48B450); }
#else #else
void CMenuManager::SetHelperText(int text) void CMenuManager::SetHelperText(int text)
{ {
@ -2126,7 +2160,7 @@ void CMenuManager::SetHelperText(int text)
} }
#endif #endif
#if 0 #if ALL_ORIGINAL_FRONTEND
WRAPPER void CMenuManager::SaveSettings() { EAXJMP(0x488CC0); } WRAPPER void CMenuManager::SaveSettings() { EAXJMP(0x488CC0); }
#else #else
void CMenuManager::SaveSettings() void CMenuManager::SaveSettings()
@ -2173,7 +2207,7 @@ void CMenuManager::SaveSettings()
} }
#endif #endif
#if 0 #if ALL_ORIGINAL_FRONTEND
WRAPPER void CMenuManager::ShutdownJustMenu() { EAXJMP(0x488920); } WRAPPER void CMenuManager::ShutdownJustMenu() { EAXJMP(0x488920); }
#else #else
void CMenuManager::ShutdownJustMenu() void CMenuManager::ShutdownJustMenu()
@ -2184,7 +2218,7 @@ void CMenuManager::ShutdownJustMenu()
#endif #endif
// We won't ever use this again. // We won't ever use this again.
#if 0 #if ALL_ORIGINAL_FRONTEND
WRAPPER float CMenuManager::StretchX(float) { EAXJMP(0x48ABE0); } WRAPPER float CMenuManager::StretchX(float) { EAXJMP(0x48ABE0); }
#else #else
float CMenuManager::StretchX(float x) float CMenuManager::StretchX(float x)
@ -2196,7 +2230,7 @@ float CMenuManager::StretchX(float x)
} }
#endif #endif
#if 0 #if ALL_ORIGINAL_FRONTEND
WRAPPER float CMenuManager::StretchY(float) { EAXJMP(0x48AC20); } WRAPPER float CMenuManager::StretchY(float) { EAXJMP(0x48AC20); }
#else #else
float CMenuManager::StretchY(float y) float CMenuManager::StretchY(float y)
@ -2208,7 +2242,7 @@ float CMenuManager::StretchY(float y)
} }
#endif #endif
#if 0 #if ALL_ORIGINAL_FRONTEND
WRAPPER void CMenuManager::SwitchMenuOnAndOff() { EAXJMP(0x488790); } WRAPPER void CMenuManager::SwitchMenuOnAndOff() { EAXJMP(0x488790); }
#else #else
void CMenuManager::SwitchMenuOnAndOff() void CMenuManager::SwitchMenuOnAndOff()
@ -2230,7 +2264,7 @@ void CMenuManager::SwitchMenuOnAndOff()
ShutdownJustMenu(); ShutdownJustMenu();
SaveSettings(); SaveSettings();
m_bStartUpFrontEndRequested = false; m_bStartUpFrontEndRequested = false;
pControlEdit = 0; pControlEdit = nil;
m_bShutDownFrontEndRequested = false; m_bShutDownFrontEndRequested = false;
DisplayComboButtonErrMsg = 0; DisplayComboButtonErrMsg = 0;
CPad::GetPad(0)->Clear(0); CPad::GetPad(0)->Clear(0);
@ -2254,7 +2288,7 @@ void CMenuManager::SwitchMenuOnAndOff()
} }
#endif #endif
#if 0 #if ALL_ORIGINAL_FRONTEND
WRAPPER void CMenuManager::UnloadTextures() { EAXJMP(0x47A440); } WRAPPER void CMenuManager::UnloadTextures() { EAXJMP(0x47A440); }
#else #else
void CMenuManager::UnloadTextures() void CMenuManager::UnloadTextures()
@ -2279,7 +2313,7 @@ void CMenuManager::UnloadTextures()
} }
#endif #endif
#if 0 #if ALL_ORIGINAL_FRONTEND
WRAPPER void CMenuManager::WaitForUserCD(void) { EAXJMP(0x48ADD0); } WRAPPER void CMenuManager::WaitForUserCD(void) { EAXJMP(0x48ADD0); }
#else #else
void CMenuManager::WaitForUserCD() void CMenuManager::WaitForUserCD()
@ -2307,7 +2341,7 @@ uint8 CMenuManager::GetNumberOfMenuOptions()
break; break;
++Rows; ++Rows;
}; }
return Rows; return Rows;
} }
@ -2406,7 +2440,7 @@ void CMenuManager::SetDefaultPreferences(int8 screen)
CVehicle::m_bDisableMouseSteering = true; CVehicle::m_bDisableMouseSteering = true;
TheCamera.m_bHeadBob = false; TheCamera.m_bHeadBob = false;
break; break;
}; }
} }
// Frontend inputs. // Frontend inputs.
@ -2464,18 +2498,47 @@ bool GetPadMoveRight()
(CPad::GetPad(0)->NewState.LeftStickX > 0 && !(CPad::GetPad(0)->OldState.LeftStickX > 0)); (CPad::GetPad(0)->NewState.LeftStickX > 0 && !(CPad::GetPad(0)->OldState.LeftStickX > 0));
} }
bool GetMouseForward() bool GetMouseClickLeft()
{ {
return return
(CPad::GetPad(0)->NewMouseControllerState.LMB && !CPad::GetPad(0)->OldMouseControllerState.LMB); (CPad::GetPad(0)->NewMouseControllerState.LMB && !CPad::GetPad(0)->OldMouseControllerState.LMB);
} }
bool GetMouseBack() bool GetMouseClickRight()
{ {
return return
(CPad::GetPad(0)->NewMouseControllerState.RMB && !CPad::GetPad(0)->OldMouseControllerState.RMB); (CPad::GetPad(0)->NewMouseControllerState.RMB && !CPad::GetPad(0)->OldMouseControllerState.RMB);
} }
bool GetMouseClickMiddle()
{
return
(CPad::GetPad(0)->NewMouseControllerState.MMB && !CPad::GetPad(0)->OldMouseControllerState.MMB);
}
bool GetMouseWheelUp()
{
return
(CPad::GetPad(0)->NewMouseControllerState.WHEELUP && !CPad::GetPad(0)->OldMouseControllerState.WHEELUP);
}
bool GetMouseWheelDown()
{
return
(CPad::GetPad(0)->NewMouseControllerState.WHEELDN && !CPad::GetPad(0)->OldMouseControllerState.WHEELDN);
}
bool GetMouseForward()
{
return GetMouseClickLeft();
}
bool GetMouseBack()
{
return GetMouseClickRight;
}
bool GetMousePos() bool GetMousePos()
{ {
return return
@ -2484,14 +2547,12 @@ bool GetMousePos()
bool GetMouseMoveLeft() bool GetMouseMoveLeft()
{ {
return return GetMouseWheelDown();
(CPad::GetPad(0)->NewMouseControllerState.WHEELDN && !CPad::GetPad(0)->OldMouseControllerState.WHEELDN != 0.0f);
} }
bool GetMouseMoveRight() bool GetMouseMoveRight()
{ {
return return GetMouseWheelUp();
(CPad::GetPad(0)->NewMouseControllerState.WHEELUP && !CPad::GetPad(0)->OldMouseControllerState.WHEELUP != 0.0f);
} }
bool GetPadInput() bool GetPadInput()
@ -2516,6 +2577,7 @@ bool GetMouseInput()
} }
STARTPATCHES STARTPATCHES
#ifndef ALL_ORIGINAL_FRONTEND
InjectHook(0x47A230, &CMenuManager::LoadAllTextures, PATCH_JUMP); InjectHook(0x47A230, &CMenuManager::LoadAllTextures, PATCH_JUMP);
InjectHook(0x47A440, &CMenuManager::UnloadTextures, PATCH_JUMP); InjectHook(0x47A440, &CMenuManager::UnloadTextures, PATCH_JUMP);
InjectHook(0x485100, &CMenuManager::Process, PATCH_JUMP); InjectHook(0x485100, &CMenuManager::Process, PATCH_JUMP);
@ -2526,4 +2588,5 @@ STARTPATCHES
for (int i = 1; i < ARRAY_SIZE(aScreens); i++) for (int i = 1; i < ARRAY_SIZE(aScreens); i++)
Patch(0x611930 + sizeof(CMenuScreen) * i, aScreens[i]); Patch(0x611930 + sizeof(CMenuScreen) * i, aScreens[i]);
#endif
ENDPATCHES ENDPATCHES

View file

@ -448,7 +448,7 @@ public:
int m_nCurrOption; int m_nCurrOption;
int m_nPrevOption; int m_nPrevOption;
int m_nPrevScreen; int m_nPrevScreen;
int field_558; uint32 field_558;
int m_nCurrSaveSlot; int m_nCurrSaveSlot;
int m_nScreenChangeDelayTimer; int m_nScreenChangeDelayTimer;

View file

@ -210,7 +210,48 @@ AsciiToUnicode(const char *src, uint16 *dst)
while((*dst++ = *src++) != '\0'); while((*dst++ = *src++) != '\0');
} }
WRAPPER char UnicodeToAscii(wchar * src) { EAXJMP(0x52C2F0); } char*
UnicodeToAscii(wchar *src)
{
static char aStr[256];
int len;
for(len = 0; src && *src != 0 && len < 256-1; len++, src++)
if(*src < 256)
aStr[len] = *src;
else
aStr[len] = '#';
aStr[len] = '\0';
return aStr;
}
char*
UnicodeToAsciiForSaveLoad(wchar *src)
{
// exact same code as above
static char aStr[256];
int len;
for(len = 0; src && *src != 0 && len < 256-1; len++, src++)
if(*src < 256)
aStr[len] = *src;
else
aStr[len] = '#';
aStr[len] = '\0';
return aStr;
}
void
UnicodeStrcpy(wchar *dst, const wchar *src)
{
while((*dst++ = *src++) != '\0');
}
int
UnicodeStrlen(const wchar *str)
{
int len;
for(len = 0; *str != 0; len++, str++);
return len;
}
void void
TextCopy(wchar *dst, const wchar *src) TextCopy(wchar *dst, const wchar *src)
@ -218,6 +259,7 @@ TextCopy(wchar *dst, const wchar *src)
while((*dst++ = *src++) != '\0'); while((*dst++ = *src++) != '\0');
} }
STARTPATCHES STARTPATCHES
InjectHook(0x52C3C0, &CText::Load, PATCH_JUMP); InjectHook(0x52C3C0, &CText::Load, PATCH_JUMP);
InjectHook(0x52C580, &CText::Unload, PATCH_JUMP); InjectHook(0x52C580, &CText::Unload, PATCH_JUMP);

View file

@ -1,7 +1,10 @@
#pragma once #pragma once
void AsciiToUnicode(const char *src, wchar *dst); void AsciiToUnicode(const char *src, wchar *dst);
char UnicodeToAscii(wchar *src); char *UnicodeToAscii(wchar *src);
char *UnicodeToAsciiForSaveLoad(wchar *src);
void UnicodeStrcpy(wchar *dst, const wchar *src);
int UnicodeStrlen(const wchar *str);
void TextCopy(wchar *dst, const wchar *src); void TextCopy(wchar *dst, const wchar *src);
struct CKeyEntry struct CKeyEntry

View file

@ -54,8 +54,14 @@
GlobalScene &Scene = *(GlobalScene*)0x726768; GlobalScene &Scene = *(GlobalScene*)0x726768;
uint8 work_buff[55000]; uint8 work_buff[55000];
char gString[256]; //char gString[256];
//char gString2[512];
//wchar gUString[256];
//wchar gUString2[256];
char *gString = (char*)0x711B40;
char *gString2 = (char*)0x878A40;
wchar *gUString = (wchar*)0x74B018; wchar *gUString = (wchar*)0x74B018;
wchar *gUString2 = (wchar*)0x6EDD70;
bool &b_FoundRecentSavedGameWantToLoad = *(bool*)0x95CDA8; bool &b_FoundRecentSavedGameWantToLoad = *(bool*)0x95CDA8;

View file

@ -8,8 +8,14 @@ struct GlobalScene
extern GlobalScene &Scene; extern GlobalScene &Scene;
extern uint8 work_buff[55000]; extern uint8 work_buff[55000];
extern char gString[256]; //extern char gString[256];
//extern char gString2[512];
//extern wchar gUString[256];
//extern wchar gUString2[256];
extern char *gString;
extern char *gString2;
extern wchar *gUString; extern wchar *gUString;
extern wchar *gUString2;
extern bool &b_FoundRecentSavedGameWantToLoad; extern bool &b_FoundRecentSavedGameWantToLoad;
class CSprite2d; class CSprite2d;