Load and write our settings in re3.ini & fixes
This commit is contained in:
parent
ee3f5744f5
commit
3bd3330227
@ -3450,21 +3450,6 @@ CMenuManager::LoadSettings()
|
|||||||
CFileMgr::Read(fileHandle, m_PrefsSkinFile, 256);
|
CFileMgr::Read(fileHandle, m_PrefsSkinFile, 256);
|
||||||
CFileMgr::Read(fileHandle, (char*)&m_ControlMethod, 1);
|
CFileMgr::Read(fileHandle, (char*)&m_ControlMethod, 1);
|
||||||
CFileMgr::Read(fileHandle, (char*)&m_PrefsLanguage, 1);
|
CFileMgr::Read(fileHandle, (char*)&m_PrefsLanguage, 1);
|
||||||
/*
|
|
||||||
#ifdef CUSTOM_FRONTEND_OPTIONS
|
|
||||||
for (int i = 0; i < numCustomFrontendOptions; i++) {
|
|
||||||
FrontendOption& option = customFrontendOptions[i];
|
|
||||||
if (option.save) {
|
|
||||||
CFileMgr::Read(fileHandle, (char*)option.value, 1);
|
|
||||||
option.lastSavedValue = option.displayedValue = *option.value;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
#ifdef NO_ISLAND_LOADING
|
|
||||||
CFileMgr::Read(fileHandle, (char *)&CMenuManager::m_PrefsIslandLoading, 1);
|
|
||||||
CMenuManager::m_DisplayIslandLoading = CMenuManager::m_PrefsIslandLoading;
|
|
||||||
#endif
|
|
||||||
*/
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -3481,8 +3466,11 @@ CMenuManager::LoadSettings()
|
|||||||
m_bLanguageLoaded = false;
|
m_bLanguageLoaded = false;
|
||||||
else {
|
else {
|
||||||
m_bLanguageLoaded = true;
|
m_bLanguageLoaded = true;
|
||||||
|
// Already called in InitialiseChangedLanguageSettings
|
||||||
|
/*
|
||||||
TheText.Unload();
|
TheText.Unload();
|
||||||
TheText.Load();
|
TheText.Load();
|
||||||
|
*/
|
||||||
m_bFrontEnd_ReloadObrTxtGxt = true;
|
m_bFrontEnd_ReloadObrTxtGxt = true;
|
||||||
InitialiseChangedLanguageSettings();
|
InitialiseChangedLanguageSettings();
|
||||||
|
|
||||||
@ -3555,23 +3543,14 @@ CMenuManager::SaveSettings()
|
|||||||
CFileMgr::Write(fileHandle, m_PrefsSkinFile, 256);
|
CFileMgr::Write(fileHandle, m_PrefsSkinFile, 256);
|
||||||
CFileMgr::Write(fileHandle, (char*)&m_ControlMethod, 1);
|
CFileMgr::Write(fileHandle, (char*)&m_ControlMethod, 1);
|
||||||
CFileMgr::Write(fileHandle, (char*)&m_PrefsLanguage, 1);
|
CFileMgr::Write(fileHandle, (char*)&m_PrefsLanguage, 1);
|
||||||
/*
|
|
||||||
#ifdef CUSTOM_FRONTEND_OPTIONS
|
|
||||||
for (int i = 0; i < numCustomFrontendOptions; i++) {
|
|
||||||
FrontendOption &option = customFrontendOptions[i];
|
|
||||||
if (option.save) {
|
|
||||||
CFileMgr::Write(fileHandle, (char*)option.value, 1);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
#ifdef NO_ISLAND_LOADING
|
|
||||||
CFileMgr::Write(fileHandle, (char *)&CMenuManager::m_PrefsIslandLoading, 1);
|
|
||||||
#endif
|
|
||||||
*/
|
|
||||||
}
|
}
|
||||||
|
|
||||||
CFileMgr::CloseFile(fileHandle);
|
CFileMgr::CloseFile(fileHandle);
|
||||||
CFileMgr::SetDir("");
|
CFileMgr::SetDir("");
|
||||||
|
|
||||||
|
#ifdef LOAD_INI_SETTINGS
|
||||||
|
SaveINISettings();
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
bool DoRWStuffStartOfFrame(int16 TopRed, int16 TopGreen, int16 TopBlue, int16 BottomRed, int16 BottomGreen, int16 BottomBlue, int16 Alpha);
|
bool DoRWStuffStartOfFrame(int16 TopRed, int16 TopGreen, int16 TopBlue, int16 BottomRed, int16 BottomGreen, int16 BottomBlue, int16 Alpha);
|
||||||
|
@ -295,9 +295,14 @@ bool CGame::InitialiseOnceAfterRW(void)
|
|||||||
CWorld::Players[0].SetPlayerSkin(CMenuManager::m_PrefsSkinFile);
|
CWorld::Players[0].SetPlayerSkin(CMenuManager::m_PrefsSkinFile);
|
||||||
|
|
||||||
#ifdef CUSTOM_FRONTEND_OPTIONS
|
#ifdef CUSTOM_FRONTEND_OPTIONS
|
||||||
|
// Apparently this func. can be run multiple times at the start.
|
||||||
if (numCustomFrontendOptions == 0 && numCustomFrontendScreens == 0) {
|
if (numCustomFrontendOptions == 0 && numCustomFrontendScreens == 0) {
|
||||||
|
// needs stored language and TheText to be loaded, and last TheText reload is at the start of here
|
||||||
CustomFrontendOptionsPopulate();
|
CustomFrontendOptionsPopulate();
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
#ifdef LOAD_INI_SETTINGS
|
||||||
|
LoadINISettings(); // needs frontend options to be loaded
|
||||||
#endif
|
#endif
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -219,6 +219,8 @@ public:
|
|||||||
extern int strcasecmp(const char *str1, const char *str2);
|
extern int strcasecmp(const char *str1, const char *str2);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
extern wchar *AllocUnicode(const char*src);
|
||||||
|
|
||||||
#define clamp(v, low, high) ((v)<(low) ? (low) : (v)>(high) ? (high) : (v))
|
#define clamp(v, low, high) ((v)<(low) ? (low) : (v)>(high) ? (high) : (v))
|
||||||
|
|
||||||
inline float sq(float x) { return x*x; }
|
inline float sq(float x) { return x*x; }
|
||||||
|
@ -198,6 +198,7 @@ enum Config {
|
|||||||
#define FIX_BUGS // fixes bugs that we've came across during reversing, TODO: use this more
|
#define FIX_BUGS // fixes bugs that we've came across during reversing, TODO: use this more
|
||||||
#define MORE_LANGUAGES // Add more translations to the game
|
#define MORE_LANGUAGES // Add more translations to the game
|
||||||
#define COMPATIBLE_SAVES // this allows changing structs while keeping saves compatible
|
#define COMPATIBLE_SAVES // this allows changing structs while keeping saves compatible
|
||||||
|
#define LOAD_INI_SETTINGS
|
||||||
|
|
||||||
// Rendering/display
|
// Rendering/display
|
||||||
#define ASPECT_RATIO_SCALE // Not just makes everything scale with aspect ratio, also adds support for all aspect ratios
|
#define ASPECT_RATIO_SCALE // Not just makes everything scale with aspect ratio, also adds support for all aspect ratios
|
||||||
@ -226,8 +227,8 @@ enum Config {
|
|||||||
#if !defined(RW_GL3) && defined(_WIN32)
|
#if !defined(RW_GL3) && defined(_WIN32)
|
||||||
#define XINPUT
|
#define XINPUT
|
||||||
#endif
|
#endif
|
||||||
#if defined(RW_GL3) && !defined(__SWITCH__) // TODO
|
#if !defined(_WIN32) && !defined(__SWITCH__)
|
||||||
#define DONT_TRUST_RECOGNIZED_JOYSTICKS // Then we'll only rely on GLFW gamepad DB, and want user to enter Cpntroller->Detect joysticks if his joystick isn't on that list.
|
#define DONT_TRUST_RECOGNIZED_JOYSTICKS // Then we'll only rely on GLFW gamepad DB, and expect user to enter Controller->Detect joysticks if his joystick isn't on that list.
|
||||||
#endif
|
#endif
|
||||||
#define DETECT_PAD_INPUT_SWITCH // Adds automatic switch of pad related stuff between controller and kb/m
|
#define DETECT_PAD_INPUT_SWITCH // Adds automatic switch of pad related stuff between controller and kb/m
|
||||||
#define KANGAROO_CHEAT
|
#define KANGAROO_CHEAT
|
||||||
|
@ -36,3 +36,8 @@ void ResetLoadingScreenBar(void);
|
|||||||
#ifndef MASTER
|
#ifndef MASTER
|
||||||
void TheModelViewer(void);
|
void TheModelViewer(void);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef LOAD_INI_SETTINGS
|
||||||
|
void LoadINISettings();
|
||||||
|
void SaveINISettings();
|
||||||
|
#endif
|
||||||
|
113
src/core/re3.cpp
113
src/core/re3.cpp
@ -1,6 +1,7 @@
|
|||||||
#include <csignal>
|
#include <csignal>
|
||||||
#define WITHWINDOWS
|
#define WITHWINDOWS
|
||||||
#include "common.h"
|
#include "common.h"
|
||||||
|
#include "platform.h"
|
||||||
#include "crossplatform.h"
|
#include "crossplatform.h"
|
||||||
#include "Renderer.h"
|
#include "Renderer.h"
|
||||||
#include "Credits.h"
|
#include "Credits.h"
|
||||||
@ -16,7 +17,6 @@
|
|||||||
#include "Heli.h"
|
#include "Heli.h"
|
||||||
#include "Automobile.h"
|
#include "Automobile.h"
|
||||||
#include "Ped.h"
|
#include "Ped.h"
|
||||||
#include "Particle.h"
|
|
||||||
#include "Console.h"
|
#include "Console.h"
|
||||||
#include "Debug.h"
|
#include "Debug.h"
|
||||||
#include "Hud.h"
|
#include "Hud.h"
|
||||||
@ -32,15 +32,12 @@
|
|||||||
#include "MBlur.h"
|
#include "MBlur.h"
|
||||||
#include "postfx.h"
|
#include "postfx.h"
|
||||||
#include "custompipes.h"
|
#include "custompipes.h"
|
||||||
#include "ControllerConfig.h"
|
|
||||||
|
|
||||||
#ifndef _WIN32
|
#ifndef _WIN32
|
||||||
#include "assert.h"
|
#include "assert.h"
|
||||||
#include <stdarg.h>
|
#include <stdarg.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include <list>
|
|
||||||
|
|
||||||
#ifdef RWLIBS
|
#ifdef RWLIBS
|
||||||
extern "C" int vsprintf(char* const _Buffer, char const* const _Format, va_list _ArgList);
|
extern "C" int vsprintf(char* const _Buffer, char const* const _Format, va_list _ArgList);
|
||||||
#endif
|
#endif
|
||||||
@ -74,7 +71,6 @@ mysrand(unsigned int seed)
|
|||||||
|
|
||||||
#ifdef CUSTOM_FRONTEND_OPTIONS
|
#ifdef CUSTOM_FRONTEND_OPTIONS
|
||||||
#include "frontendoption.h"
|
#include "frontendoption.h"
|
||||||
#include "platform.h"
|
|
||||||
#include "Font.h"
|
#include "Font.h"
|
||||||
|
|
||||||
void ReloadFrontendOptions(void)
|
void ReloadFrontendOptions(void)
|
||||||
@ -196,7 +192,7 @@ wchar* MultiSamplingDraw(bool *disabled, bool userHovering) {
|
|||||||
return unicodeTemp;
|
return unicodeTemp;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
char* multisamplingKey = "MultiSampling";
|
const char* multisamplingKey = "MultiSampling";
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef MORE_LANGUAGES
|
#ifdef MORE_LANGUAGES
|
||||||
@ -249,8 +245,7 @@ void FreeCamChange(int8 displayedValue)
|
|||||||
TheCamera.bFreeCam = !!displayedValue;
|
TheCamera.bFreeCam = !!displayedValue;
|
||||||
FrontEndMenuManager.SaveSettings();
|
FrontEndMenuManager.SaveSettings();
|
||||||
}
|
}
|
||||||
const wchar* freeCamText = (wchar*)L"FREE CAM";
|
const char* freeCamKey = "FreeCam";
|
||||||
char* freeCamKey = "FreeCam";
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef CUTSCENE_BORDERS_SWITCH
|
#ifdef CUTSCENE_BORDERS_SWITCH
|
||||||
@ -259,7 +254,7 @@ void BorderModeChange(int8 displayedValue)
|
|||||||
CMenuManager::m_PrefsCutsceneBorders = !!displayedValue;
|
CMenuManager::m_PrefsCutsceneBorders = !!displayedValue;
|
||||||
FrontEndMenuManager.SaveSettings();
|
FrontEndMenuManager.SaveSettings();
|
||||||
}
|
}
|
||||||
char* cutsceneBordersKey = "CutsceneBorders";
|
const char* cutsceneBordersKey = "CutsceneBorders";
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef PS2_ALPHA_TEST
|
#ifdef PS2_ALPHA_TEST
|
||||||
@ -268,13 +263,10 @@ void PS2AlphaTestChange(int8 displayedValue)
|
|||||||
gPS2alphaTest = !!displayedValue;
|
gPS2alphaTest = !!displayedValue;
|
||||||
FrontEndMenuManager.SaveSettings();
|
FrontEndMenuManager.SaveSettings();
|
||||||
}
|
}
|
||||||
char* ps2alphaKey = "PS2AlphaTest";
|
const char* ps2alphaKey = "PS2AlphaTest";
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef DONT_TRUST_RECOGNIZED_JOYSTICKS
|
#ifdef DONT_TRUST_RECOGNIZED_JOYSTICKS
|
||||||
const wchar* detectJoystickText = (wchar*)L"Detect Joystick";
|
|
||||||
const wchar* detectJoystickExplanation = (wchar*)L"Press any key on your preferred joystick that you would like to use on the game.";
|
|
||||||
const wchar* detectedJoystickText = (wchar*)L"Detected Joystick";
|
|
||||||
wchar selectedJoystickUnicode[128];
|
wchar selectedJoystickUnicode[128];
|
||||||
|
|
||||||
wchar* DetectJoystickDraw(bool* disabled, bool userHovering) {
|
wchar* DetectJoystickDraw(bool* disabled, bool userHovering) {
|
||||||
@ -287,7 +279,6 @@ wchar* DetectJoystickDraw(bool* disabled, bool userHovering) {
|
|||||||
const uint8* buttons = glfwGetJoystickButtons(i, &numButtons);
|
const uint8* buttons = glfwGetJoystickButtons(i, &numButtons);
|
||||||
for (int j = 0; j < numButtons; j++) {
|
for (int j = 0; j < numButtons; j++) {
|
||||||
if (buttons[j]) {
|
if (buttons[j]) {
|
||||||
strcpy(gSelectedJoystickName, joyname);
|
|
||||||
found = i;
|
found = i;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -303,17 +294,21 @@ wchar* DetectJoystickDraw(bool* disabled, bool userHovering) {
|
|||||||
else
|
else
|
||||||
PSGLOBAL(joy2id) = -1;
|
PSGLOBAL(joy2id) = -1;
|
||||||
|
|
||||||
|
strcpy(gSelectedJoystickName, joyname);
|
||||||
PSGLOBAL(joy1id) = found;
|
PSGLOBAL(joy1id) = found;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
AsciiToUnicode(gSelectedJoystickName, selectedJoystickUnicode);
|
if (PSGLOBAL(joy1id) == -1)
|
||||||
|
AsciiToUnicode("Not found", selectedJoystickUnicode);
|
||||||
|
else
|
||||||
|
AsciiToUnicode(gSelectedJoystickName, selectedJoystickUnicode);
|
||||||
|
|
||||||
return selectedJoystickUnicode;
|
return selectedJoystickUnicode;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Important: Make sure to read the warnings/informations in frontendoption.h!!
|
// Important: Make sure to read the warnings/informations in frontendoption.h!!
|
||||||
// If you won't use GXT entry as text, you may want to declare them globally, to not alloc them on each reload. (static declared texts has some problems on Linux etc.)
|
// If you will hardcode any text, please use AllocUnicode! wchar_t size differs between platforms
|
||||||
void
|
void
|
||||||
CustomFrontendOptionsPopulate(void)
|
CustomFrontendOptionsPopulate(void)
|
||||||
{
|
{
|
||||||
@ -416,7 +411,7 @@ CustomFrontendOptionsPopulate(void)
|
|||||||
|
|
||||||
#ifdef FREE_CAM
|
#ifdef FREE_CAM
|
||||||
SWITCH_TO_DISPLAY_MENU
|
SWITCH_TO_DISPLAY_MENU
|
||||||
FrontendOptionAddSelect(freeCamText, off_on, 2, (int8*)&TheCamera.bFreeCam, false, FreeCamChange, nil, freeCamKey);
|
FrontendOptionAddSelect(TheText.Get("FEC_FRC"), off_on, 2, (int8*)&TheCamera.bFreeCam, false, FreeCamChange, nil, freeCamKey);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
CLONE_OPTION(TheText.Get("FED_SUB"), MENUACTION_SUBTITLES, nil, nil);
|
CLONE_OPTION(TheText.Get("FED_SUB"), MENUACTION_SUBTITLES, nil, nil);
|
||||||
@ -433,24 +428,96 @@ CustomFrontendOptionsPopulate(void)
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
ADD_RESTORE_DEFAULTS(RestoreDefDisplay)
|
ADD_RESTORE_DEFAULTS(RestoreDefDisplay)
|
||||||
ADD_BACK
|
ADD_BACK
|
||||||
|
|
||||||
#ifdef DONT_TRUST_RECOGNIZED_JOYSTICKS
|
#ifdef DONT_TRUST_RECOGNIZED_JOYSTICKS
|
||||||
int detectJoystickMenu = FrontendScreenAdd("FET_CON", MENUSPRITE_MAINMENU, MENUPAGE_CONTROLLER_PC, 50, 60, 20,
|
int detectJoystickMenu = FrontendScreenAdd("FEC_JOD", MENUSPRITE_MAINMENU, MENUPAGE_CONTROLLER_PC, 40, 60, 20,
|
||||||
FONT_BANK, MEDIUMTEXT_X_SCALE, MEDIUMTEXT_Y_SCALE, FESCREEN_LEFT_ALIGN, false);
|
FONT_BANK, MEDIUMTEXT_X_SCALE, MEDIUMTEXT_Y_SCALE, FESCREEN_LEFT_ALIGN, false);
|
||||||
|
|
||||||
FrontendOptionSetCursor(detectJoystickMenu, 0);
|
FrontendOptionSetCursor(detectJoystickMenu, 0);
|
||||||
|
|
||||||
FrontendOptionAddBuiltinAction(detectJoystickExplanation, MENUACTION_LABEL, nil, nil);
|
FrontendOptionAddBuiltinAction(TheText.Get("FEC_JPR"), MENUACTION_LABEL, nil, nil);
|
||||||
FrontendOptionAddDynamic(detectedJoystickText, DetectJoystickDraw, nil, nil, nil);
|
FrontendOptionAddDynamic(TheText.Get("FEC_JDE"), DetectJoystickDraw, nil, nil, nil);
|
||||||
FrontendOptionAddBackButton(TheText.Get("FEDS_TB"));
|
FrontendOptionAddBackButton(TheText.Get("FEDS_TB"));
|
||||||
|
|
||||||
FrontendOptionSetCursor(MENUPAGE_CONTROLLER_PC, 2);
|
FrontendOptionSetCursor(MENUPAGE_CONTROLLER_PC, 2);
|
||||||
FrontendOptionAddRedirect(detectJoystickText, detectJoystickMenu, 1);
|
FrontendOptionAddRedirect(TheText.Get("FEC_JOD"), detectJoystickMenu, 1);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef LOAD_INI_SETTINGS
|
||||||
|
#include "ini_parser.hpp"
|
||||||
|
void LoadINISettings()
|
||||||
|
{
|
||||||
|
linb::ini cfg;
|
||||||
|
cfg.load_file("re3.ini");
|
||||||
|
char defaultStr[4];
|
||||||
|
|
||||||
|
#ifdef DONT_TRUST_RECOGNIZED_JOYSTICKS
|
||||||
|
strcpy(gSelectedJoystickName, cfg.get("DetectJoystick", "JoystickName", "").c_str());
|
||||||
|
_InputInitialiseJoys();
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef CUSTOM_FRONTEND_OPTIONS
|
||||||
|
for (int i = 0; i < numCustomFrontendOptions; i++) {
|
||||||
|
FrontendOption& option = customFrontendOptions[i];
|
||||||
|
if (option.save) {
|
||||||
|
// CFO only supports saving uint8 right now
|
||||||
|
sprintf(defaultStr, "%u", *option.value);
|
||||||
|
option.lastSavedValue = option.displayedValue = *option.value = atoi(cfg.get("FrontendOptions", option.save, defaultStr).c_str());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef NO_ISLAND_LOADING
|
||||||
|
sprintf(defaultStr, "%u", CMenuManager::m_PrefsIslandLoading);
|
||||||
|
CMenuManager::m_PrefsIslandLoading = atoi(cfg.get("FrontendOptions", "NoIslandLoading", defaultStr).c_str());
|
||||||
|
CMenuManager::m_DisplayIslandLoading = CMenuManager::m_PrefsIslandLoading;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void SaveINISettings()
|
||||||
|
{
|
||||||
|
linb::ini cfg;
|
||||||
|
cfg.load_file("re3.ini");
|
||||||
|
bool changed = false;
|
||||||
|
char temp[4];
|
||||||
|
|
||||||
|
#ifdef DONT_TRUST_RECOGNIZED_JOYSTICKS
|
||||||
|
if (strncmp(cfg.get("DetectJoystick", "JoystickName", "").c_str(), gSelectedJoystickName, strlen(gSelectedJoystickName)) != 0) {
|
||||||
|
changed = true;
|
||||||
|
cfg.set("DetectJoystick", "JoystickName", gSelectedJoystickName);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
#ifdef CUSTOM_FRONTEND_OPTIONS
|
||||||
|
for (int i = 0; i < numCustomFrontendOptions; i++) {
|
||||||
|
FrontendOption &option = customFrontendOptions[i];
|
||||||
|
if (option.save) {
|
||||||
|
if (atoi(cfg.get("FrontendOptions", option.save, "xxx").c_str()) != *option.value) { // if .ini doesn't have that key compare with xxx, so we can add it
|
||||||
|
changed = true;
|
||||||
|
sprintf(temp, "%u", *option.value);
|
||||||
|
cfg.set("FrontendOptions", option.save, temp);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
#ifdef NO_ISLAND_LOADING
|
||||||
|
if (atoi(cfg.get("FrontendOptions", "NoIslandLoading", "xxx").c_str()) != CMenuManager::m_PrefsIslandLoading) {
|
||||||
|
changed = true;
|
||||||
|
sprintf(temp, "%u", CMenuManager::m_PrefsIslandLoading);
|
||||||
|
cfg.set("FrontendOptions", "NoIslandLoading", temp);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
if (changed)
|
||||||
|
cfg.write_file("re3.ini");
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
#ifdef DEBUGMENU
|
#ifdef DEBUGMENU
|
||||||
void WeaponCheat();
|
void WeaponCheat();
|
||||||
void HealthCheat();
|
void HealthCheat();
|
||||||
@ -598,6 +665,8 @@ static const char *carnames[] = {
|
|||||||
"yankee", "escape", "borgnine", "toyz", "ghost",
|
"yankee", "escape", "borgnine", "toyz", "ghost",
|
||||||
};
|
};
|
||||||
|
|
||||||
|
//#include <list>
|
||||||
|
|
||||||
static CTweakVar** TweakVarsList;
|
static CTweakVar** TweakVarsList;
|
||||||
static int TweakVarsListSize = -1;
|
static int TweakVarsListSize = -1;
|
||||||
static bool bAddTweakVarsNow = false;
|
static bool bAddTweakVarsNow = false;
|
||||||
|
@ -216,7 +216,7 @@ void FrontendOptionAddBuiltinAction(const wchar* leftText, int action, ButtonPre
|
|||||||
option.save = nil;
|
option.save = nil;
|
||||||
}
|
}
|
||||||
|
|
||||||
void FrontendOptionAddSelect(const wchar* leftText, const wchar** rightTexts, int8 numRightTexts, int8 *var, bool onlyApplyOnEnter, ChangeFunc changeFunc, ReturnPrevPageFunc returnPrevPageFunc, char* saveName)
|
void FrontendOptionAddSelect(const wchar* leftText, const wchar** rightTexts, int8 numRightTexts, int8 *var, bool onlyApplyOnEnter, ChangeFunc changeFunc, ReturnPrevPageFunc returnPrevPageFunc, const char* saveName)
|
||||||
{
|
{
|
||||||
int8 screenOptionOrder = RegisterNewOption();
|
int8 screenOptionOrder = RegisterNewOption();
|
||||||
|
|
||||||
@ -236,7 +236,7 @@ void FrontendOptionAddSelect(const wchar* leftText, const wchar** rightTexts, in
|
|||||||
option.returnPrevPageFunc = returnPrevPageFunc;
|
option.returnPrevPageFunc = returnPrevPageFunc;
|
||||||
}
|
}
|
||||||
|
|
||||||
void FrontendOptionAddDynamic(const wchar* leftText, DrawFunc drawFunc, int8 *var, ButtonPressFunc buttonPressFunc, ReturnPrevPageFunc returnPrevPageFunc, char* saveName)
|
void FrontendOptionAddDynamic(const wchar* leftText, DrawFunc drawFunc, int8 *var, ButtonPressFunc buttonPressFunc, ReturnPrevPageFunc returnPrevPageFunc, const char* saveName)
|
||||||
{
|
{
|
||||||
int8 screenOptionOrder = RegisterNewOption();
|
int8 screenOptionOrder = RegisterNewOption();
|
||||||
|
|
||||||
|
@ -91,11 +91,11 @@ struct FrontendOption
|
|||||||
int8 type;
|
int8 type;
|
||||||
int8 screenOptionOrder;
|
int8 screenOptionOrder;
|
||||||
int32 screen;
|
int32 screen;
|
||||||
wchar leftText[64];
|
wchar leftText[128];
|
||||||
ReturnPrevPageFunc returnPrevPageFunc;
|
ReturnPrevPageFunc returnPrevPageFunc;
|
||||||
int8* value;
|
int8* value;
|
||||||
int8 displayedValue; // only if onlyApplyOnEnter enabled for now
|
int8 displayedValue; // only if onlyApplyOnEnter enabled for now
|
||||||
char* save;
|
const char* save;
|
||||||
int32 ogOptionId; // for replacements, see overwrite parameter of SetCursor
|
int32 ogOptionId; // for replacements, see overwrite parameter of SetCursor
|
||||||
|
|
||||||
union {
|
union {
|
||||||
@ -153,8 +153,8 @@ void FrontendOptionSetCursor(int screen, int8 option, bool overwrite = false);
|
|||||||
|
|
||||||
// var is optional in AddDynamic, enables you to save them in an INI file(also needs passing char array to saveName param. obv), otherwise pass nil/0
|
// var is optional in AddDynamic, enables you to save them in an INI file(also needs passing char array to saveName param. obv), otherwise pass nil/0
|
||||||
void FrontendOptionAddBuiltinAction(const wchar* leftText, int action, ButtonPressFunc buttonPressFunc, ReturnPrevPageFunc returnPrevPageFunc);
|
void FrontendOptionAddBuiltinAction(const wchar* leftText, int action, ButtonPressFunc buttonPressFunc, ReturnPrevPageFunc returnPrevPageFunc);
|
||||||
void FrontendOptionAddSelect(const wchar* leftText, const wchar** rightTexts, int8 numRightTexts, int8 *var, bool onlyApplyOnEnter, ChangeFunc changeFunc, ReturnPrevPageFunc returnPrevPageFunc, char* saveName = nil);
|
void FrontendOptionAddSelect(const wchar* leftText, const wchar** rightTexts, int8 numRightTexts, int8 *var, bool onlyApplyOnEnter, ChangeFunc changeFunc, ReturnPrevPageFunc returnPrevPageFunc, const char* saveName = nil);
|
||||||
void FrontendOptionAddDynamic(const wchar* leftText, DrawFunc rightTextDrawFunc, int8 *var, ButtonPressFunc buttonPressFunc, ReturnPrevPageFunc returnPrevPageFunc, char* saveName = nil);
|
void FrontendOptionAddDynamic(const wchar* leftText, DrawFunc rightTextDrawFunc, int8 *var, ButtonPressFunc buttonPressFunc, ReturnPrevPageFunc returnPrevPageFunc, const char* saveName = nil);
|
||||||
void FrontendOptionAddRedirect(const wchar* text, int to, int8 selectedOption = 0, bool fadeIn = true);
|
void FrontendOptionAddRedirect(const wchar* text, int to, int8 selectedOption = 0, bool fadeIn = true);
|
||||||
void FrontendOptionAddBackButton(const wchar* text, bool fadeIn = true);
|
void FrontendOptionAddBackButton(const wchar* text, bool fadeIn = true);
|
||||||
|
|
||||||
|
@ -84,6 +84,16 @@ void FileTimeToSystemTime(time_t* writeTime, SYSTEMTIME* out) {
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
// Because wchar length differs between platforms.
|
||||||
|
wchar*
|
||||||
|
AllocUnicode(const char* src)
|
||||||
|
{
|
||||||
|
wchar *dst = (wchar*)malloc(strlen(src)*2 + 2);
|
||||||
|
wchar *i = dst;
|
||||||
|
while((*i++ = (unsigned char)*src++) != '\0');
|
||||||
|
return dst;
|
||||||
|
}
|
||||||
|
|
||||||
// Funcs/features from Windows that we need on other platforms
|
// Funcs/features from Windows that we need on other platforms
|
||||||
#ifndef _WIN32
|
#ifndef _WIN32
|
||||||
char *strupr(char *s) {
|
char *strupr(char *s) {
|
||||||
|
@ -41,7 +41,6 @@
|
|||||||
#include "AnimViewer.h"
|
#include "AnimViewer.h"
|
||||||
#include "Font.h"
|
#include "Font.h"
|
||||||
|
|
||||||
|
|
||||||
#define MAX_SUBSYSTEMS (16)
|
#define MAX_SUBSYSTEMS (16)
|
||||||
|
|
||||||
|
|
||||||
@ -425,6 +424,10 @@ psInitialize(void)
|
|||||||
_dwOperatingSystemVersion = OS_WIN95;
|
_dwOperatingSystemVersion = OS_WIN95;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#else
|
||||||
|
_dwOperatingSystemVersion = OS_WINXP; // To fool other classes
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
#ifndef PS2_MENU
|
#ifndef PS2_MENU
|
||||||
|
|
||||||
@ -434,6 +437,8 @@ psInitialize(void)
|
|||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
#ifdef _WIN32
|
||||||
MEMORYSTATUS memstats;
|
MEMORYSTATUS memstats;
|
||||||
GlobalMemoryStatus(&memstats);
|
GlobalMemoryStatus(&memstats);
|
||||||
|
|
||||||
@ -442,20 +447,10 @@ psInitialize(void)
|
|||||||
debug("Physical memory size %u\n", memstats.dwTotalPhys);
|
debug("Physical memory size %u\n", memstats.dwTotalPhys);
|
||||||
debug("Available physical memory %u\n", memstats.dwAvailPhys);
|
debug("Available physical memory %u\n", memstats.dwAvailPhys);
|
||||||
#else
|
#else
|
||||||
|
|
||||||
#ifndef PS2_MENU
|
|
||||||
|
|
||||||
#ifdef GTA3_1_1_PATCH
|
|
||||||
FrontEndMenuManager.LoadSettings();
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#endif
|
|
||||||
struct sysinfo systemInfo;
|
struct sysinfo systemInfo;
|
||||||
sysinfo(&systemInfo);
|
sysinfo(&systemInfo);
|
||||||
|
|
||||||
_dwMemAvailPhys = systemInfo.freeram;
|
_dwMemAvailPhys = systemInfo.freeram;
|
||||||
_dwOperatingSystemVersion = OS_WINXP; // To fool other classes
|
|
||||||
|
|
||||||
debug("Physical memory size %u\n", systemInfo.totalram);
|
debug("Physical memory size %u\n", systemInfo.totalram);
|
||||||
debug("Available physical memory %u\n", systemInfo.freeram);
|
debug("Available physical memory %u\n", systemInfo.freeram);
|
||||||
|
|
||||||
@ -835,7 +830,7 @@ bool IsThisJoystickBlacklisted(int i)
|
|||||||
|
|
||||||
const char* joyname = glfwGetJoystickName(i);
|
const char* joyname = glfwGetJoystickName(i);
|
||||||
|
|
||||||
if (strncmp(joyname, gSelectedJoystickName, sizeof(gSelectedJoystickName)) == 0)
|
if (strncmp(joyname, gSelectedJoystickName, strlen(gSelectedJoystickName)) == 0)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
@ -844,6 +839,9 @@ bool IsThisJoystickBlacklisted(int i)
|
|||||||
|
|
||||||
void _InputInitialiseJoys()
|
void _InputInitialiseJoys()
|
||||||
{
|
{
|
||||||
|
PSGLOBAL(joy1id) = -1;
|
||||||
|
PSGLOBAL(joy2id) = -1;
|
||||||
|
|
||||||
for (int i = 0; i <= GLFW_JOYSTICK_LAST; i++) {
|
for (int i = 0; i <= GLFW_JOYSTICK_LAST; i++) {
|
||||||
if (glfwJoystickPresent(i) && !IsThisJoystickBlacklisted(i)) {
|
if (glfwJoystickPresent(i) && !IsThisJoystickBlacklisted(i)) {
|
||||||
if (PSGLOBAL(joy1id) == -1)
|
if (PSGLOBAL(joy1id) == -1)
|
||||||
@ -858,7 +856,9 @@ void _InputInitialiseJoys()
|
|||||||
if (PSGLOBAL(joy1id) != -1) {
|
if (PSGLOBAL(joy1id) != -1) {
|
||||||
int count;
|
int count;
|
||||||
glfwGetJoystickButtons(PSGLOBAL(joy1id), &count);
|
glfwGetJoystickButtons(PSGLOBAL(joy1id), &count);
|
||||||
|
#ifdef DONT_TRUST_RECOGNIZED_JOYSTICKS
|
||||||
strcpy(gSelectedJoystickName, glfwGetJoystickName(PSGLOBAL(joy1id)));
|
strcpy(gSelectedJoystickName, glfwGetJoystickName(PSGLOBAL(joy1id)));
|
||||||
|
#endif
|
||||||
ControlsManager.InitDefaultControlConfigJoyPad(count);
|
ControlsManager.InitDefaultControlConfigJoyPad(count);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -2067,14 +2067,15 @@ void joysChangeCB(int jid, int event)
|
|||||||
if (event == GLFW_CONNECTED && !IsThisJoystickBlacklisted(jid)) {
|
if (event == GLFW_CONNECTED && !IsThisJoystickBlacklisted(jid)) {
|
||||||
if (PSGLOBAL(joy1id) == -1) {
|
if (PSGLOBAL(joy1id) == -1) {
|
||||||
PSGLOBAL(joy1id) = jid;
|
PSGLOBAL(joy1id) = jid;
|
||||||
|
#ifdef DONT_TRUST_RECOGNIZED_JOYSTICKS
|
||||||
strcpy(gSelectedJoystickName, glfwGetJoystickName(jid));
|
strcpy(gSelectedJoystickName, glfwGetJoystickName(jid));
|
||||||
|
#endif
|
||||||
} else if (PSGLOBAL(joy2id) == -1)
|
} else if (PSGLOBAL(joy2id) == -1)
|
||||||
PSGLOBAL(joy2id) = jid;
|
PSGLOBAL(joy2id) = jid;
|
||||||
|
|
||||||
} else if (event == GLFW_DISCONNECTED) {
|
} else if (event == GLFW_DISCONNECTED) {
|
||||||
if (PSGLOBAL(joy1id) == jid) {
|
if (PSGLOBAL(joy1id) == jid) {
|
||||||
PSGLOBAL(joy1id) = -1;
|
PSGLOBAL(joy1id) = -1;
|
||||||
strcpy(gSelectedJoystickName, "");
|
|
||||||
} else if (PSGLOBAL(joy2id) == jid)
|
} else if (PSGLOBAL(joy2id) == jid)
|
||||||
PSGLOBAL(joy2id) = -1;
|
PSGLOBAL(joy2id) = -1;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user