mirror of
https://github.com/blawar/ooot.git
synced 2024-06-30 16:29:55 +00:00
implemented language setting in config.json
This commit is contained in:
parent
2277fb7a1e
commit
455e16dcf4
|
@ -5,9 +5,20 @@
|
||||||
|
|
||||||
struct OcarinaStaff;
|
struct OcarinaStaff;
|
||||||
|
|
||||||
typedef enum { TEXTBOX_ICON_TRIANGLE, TEXTBOX_ICON_SQUARE, TEXTBOX_ICON_ARROW } TextBoxIcon;
|
enum TextBoxIcon
|
||||||
|
{
|
||||||
|
TEXTBOX_ICON_TRIANGLE,
|
||||||
|
TEXTBOX_ICON_SQUARE,
|
||||||
|
TEXTBOX_ICON_ARROW
|
||||||
|
};
|
||||||
|
|
||||||
typedef enum { LANGUAGE_ENG, LANGUAGE_GER, LANGUAGE_FRA, LANGUAGE_MAX } Language;
|
enum Language
|
||||||
|
{
|
||||||
|
LANGUAGE_ENG,
|
||||||
|
LANGUAGE_GER,
|
||||||
|
LANGUAGE_FRA,
|
||||||
|
LANGUAGE_MAX
|
||||||
|
};
|
||||||
|
|
||||||
// TODO get these properties from the textures themselves
|
// TODO get these properties from the textures themselves
|
||||||
#define FONT_CHAR_TEX_WIDTH 16
|
#define FONT_CHAR_TEX_WIDTH 16
|
||||||
|
|
|
@ -352,6 +352,7 @@ namespace oot::save
|
||||||
/* 0x1406 */ u16 minigameScore; // "yabusame_total"
|
/* 0x1406 */ u16 minigameScore; // "yabusame_total"
|
||||||
/* 0x1408 */ char unk_1408[0x0001];
|
/* 0x1408 */ char unk_1408[0x0001];
|
||||||
/* 0x1409 */ u8 language; // NTSC 0: Japanese; 1: English | PAL 0: English; 1: German; 2: French
|
/* 0x1409 */ u8 language; // NTSC 0: Japanese; 1: English | PAL 0: English; 1: German; 2: French
|
||||||
|
/* 0x1409 */ u8 saveLanguage; // NTSC 0: Japanese; 1: English | PAL 0: English; 1: German; 2: French
|
||||||
/* 0x140A */ u8 audioSetting;
|
/* 0x140A */ u8 audioSetting;
|
||||||
/* 0x140B */ char unk_140B[0x0001];
|
/* 0x140B */ char unk_140B[0x0001];
|
||||||
/* 0x140C */ u8 zTargetSetting; // 0: Switch; 1: Hold
|
/* 0x140C */ u8 zTargetSetting; // 0: Switch; 1: Hold
|
||||||
|
|
|
@ -3334,16 +3334,9 @@ void Message_SetTables(void) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static u8 g_currentLanguage = 0;
|
|
||||||
|
|
||||||
u8 Get_Language()
|
|
||||||
{
|
|
||||||
return gSaveContext.language;
|
|
||||||
}
|
|
||||||
|
|
||||||
void Set_Language(u8 language_id)
|
void Set_Language(u8 language_id)
|
||||||
{
|
{
|
||||||
g_currentLanguage = gSaveContext.language = language_id % LANGUAGE_MAX;
|
gSaveContext.language = language_id % LANGUAGE_MAX;
|
||||||
Message_SetTables();
|
Message_SetTables();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -4722,23 +4722,6 @@ void Interface_Update(GlobalContext* globalCtx)
|
||||||
s16 alpha;
|
s16 alpha;
|
||||||
s16 alpha1;
|
s16 alpha1;
|
||||||
u16 action;
|
u16 action;
|
||||||
Input* debugInput = &globalCtx->state.input[2];
|
|
||||||
|
|
||||||
if(CHECK_BTN_ALL(debugInput->press.button, BTN_DLEFT))
|
|
||||||
{
|
|
||||||
Set_Language(LANGUAGE_ENG);
|
|
||||||
osSyncPrintf("J_N=%x J_N=%x\n", gSaveContext.language, &gSaveContext.language);
|
|
||||||
}
|
|
||||||
else if(CHECK_BTN_ALL(debugInput->press.button, BTN_DUP))
|
|
||||||
{
|
|
||||||
Set_Language(LANGUAGE_GER);
|
|
||||||
osSyncPrintf("J_N=%x J_N=%x\n", gSaveContext.language, &gSaveContext.language);
|
|
||||||
}
|
|
||||||
else if(CHECK_BTN_ALL(debugInput->press.button, BTN_DRIGHT))
|
|
||||||
{
|
|
||||||
Set_Language(LANGUAGE_FRA);
|
|
||||||
osSyncPrintf("J_N=%x J_N=%x\n", gSaveContext.language, &gSaveContext.language);
|
|
||||||
}
|
|
||||||
|
|
||||||
if((globalCtx->pauseCtx.state == 0) && (globalCtx->pauseCtx.debugState == 0))
|
if((globalCtx->pauseCtx.state == 0) && (globalCtx->pauseCtx.debugState == 0))
|
||||||
{
|
{
|
||||||
|
|
|
@ -21,8 +21,6 @@
|
||||||
|
|
||||||
oot::save::Context gSaveContext;
|
oot::save::Context gSaveContext;
|
||||||
|
|
||||||
void Set_Language(u8 language_id);
|
|
||||||
|
|
||||||
namespace oot::save
|
namespace oot::save
|
||||||
{
|
{
|
||||||
// these are the main substructs of save context.
|
// these are the main substructs of save context.
|
||||||
|
@ -594,9 +592,6 @@ namespace oot::save
|
||||||
if(!isValidMagic())
|
if(!isValidMagic())
|
||||||
{
|
{
|
||||||
osSyncPrintf("SRAM Destruction!!!!!!\n"); // "SRAM destruction! ! ! ! ! !"
|
osSyncPrintf("SRAM Destruction!!!!!!\n"); // "SRAM destruction! ! ! ! ! !"
|
||||||
#ifdef USE_SAVE_LANGUAGE
|
|
||||||
Set_Language(sramCtx->readBuff[SRAM_HEADER_LANGUAGE]);
|
|
||||||
#endif
|
|
||||||
memcpy(header.magic, sZeldaMagic + 3, sizeof(sZeldaMagic) - 3);
|
memcpy(header.magic, sZeldaMagic + 3, sizeof(sZeldaMagic) - 3);
|
||||||
header.language = slot.language;
|
header.language = slot.language;
|
||||||
save();
|
save();
|
||||||
|
@ -605,13 +600,8 @@ namespace oot::save
|
||||||
slot.audioSetting = header.sound & 3;
|
slot.audioSetting = header.sound & 3;
|
||||||
slot.zTargetSetting = header.ztarget & 1;
|
slot.zTargetSetting = header.ztarget & 1;
|
||||||
|
|
||||||
#ifdef USE_SAVE_LANGUAGE
|
|
||||||
Set_Language(sramCtx->readBuff[SRAM_HEADER_LANGUAGE]);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
if(slot.language >= LANGUAGE_MAX)
|
if(slot.language >= LANGUAGE_MAX)
|
||||||
{
|
{
|
||||||
Set_Language(LANGUAGE_ENG);
|
|
||||||
header.language = slot.language;
|
header.language = slot.language;
|
||||||
save();
|
save();
|
||||||
}
|
}
|
||||||
|
@ -794,7 +784,7 @@ namespace oot::save
|
||||||
s.minigameState = this->minigameState;
|
s.minigameState = this->minigameState;
|
||||||
s.minigameScore = this->minigameScore;
|
s.minigameScore = this->minigameScore;
|
||||||
memcpy(s.unk_1408, this->unk_1408, sizeof(unk_1408));
|
memcpy(s.unk_1408, this->unk_1408, sizeof(unk_1408));
|
||||||
s.language = this->language;
|
s.language = this->saveLanguage;
|
||||||
s.audioSetting = this->audioSetting;
|
s.audioSetting = this->audioSetting;
|
||||||
memcpy(s.unk_140B, this->unk_140B, sizeof(unk_140B));
|
memcpy(s.unk_140B, this->unk_140B, sizeof(unk_140B));
|
||||||
s.zTargetSetting = this->zTargetSetting;
|
s.zTargetSetting = this->zTargetSetting;
|
||||||
|
@ -930,7 +920,7 @@ namespace oot::save
|
||||||
this->minigameState = s.minigameState;
|
this->minigameState = s.minigameState;
|
||||||
this->minigameScore = s.minigameScore;
|
this->minigameScore = s.minigameScore;
|
||||||
memcpy(this->unk_1408, s.unk_1408, sizeof(unk_1408));
|
memcpy(this->unk_1408, s.unk_1408, sizeof(unk_1408));
|
||||||
this->language = s.language;
|
this->saveLanguage = s.language;
|
||||||
this->audioSetting = s.audioSetting;
|
this->audioSetting = s.audioSetting;
|
||||||
memcpy(this->unk_140B, s.unk_140B, sizeof(unk_140B));
|
memcpy(this->unk_140B, s.unk_140B, sizeof(unk_140B));
|
||||||
this->zTargetSetting = s.zTargetSetting;
|
this->zTargetSetting = s.zTargetSetting;
|
||||||
|
@ -964,7 +954,6 @@ namespace oot::save
|
||||||
|
|
||||||
void Context::init()
|
void Context::init()
|
||||||
{
|
{
|
||||||
u8 currentLanguage = 0; // Get_Language(); TODO FIX
|
|
||||||
Slot emptySlot;
|
Slot emptySlot;
|
||||||
memset(&emptySlot, 0, sizeof(emptySlot));
|
memset(&emptySlot, 0, sizeof(emptySlot));
|
||||||
load(emptySlot);
|
load(emptySlot);
|
||||||
|
@ -979,6 +968,6 @@ namespace oot::save
|
||||||
dogIsLost = true;
|
dogIsLost = true;
|
||||||
nextTransition = 0xFF;
|
nextTransition = 0xFF;
|
||||||
unk_13EE = 50;
|
unk_13EE = 50;
|
||||||
language = currentLanguage;
|
language = oot::config().game().language();
|
||||||
}
|
}
|
||||||
} // namespace oot::save
|
} // namespace oot::save
|
||||||
|
|
|
@ -32,9 +32,6 @@
|
||||||
#include "def/z_vr_box_draw.h"
|
#include "def/z_vr_box_draw.h"
|
||||||
#include "def/z_play.h" // FORCE
|
#include "def/z_play.h" // FORCE
|
||||||
|
|
||||||
void Set_Language(u8 language_id);
|
|
||||||
u8 Get_Language();
|
|
||||||
|
|
||||||
extern u16 gSramSlotOffsets[];
|
extern u16 gSramSlotOffsets[];
|
||||||
|
|
||||||
static s16 sUnused = 106;
|
static s16 sUnused = 106;
|
||||||
|
|
|
@ -347,12 +347,12 @@ namespace oot::hid
|
||||||
return value * (oot::config().controls().mouseyInvert() ? -1 : 1) * oot::config().controls().mouseyScaler();
|
return value * (oot::config().controls().mouseyInvert() ? -1 : 1) * oot::config().controls().mouseyScaler();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Controller::updateRebind(int input)
|
bool Controller::updateRebind(hid::Button input)
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Controller::processKey(int input)
|
void Controller::processKey(hid::Button input)
|
||||||
{
|
{
|
||||||
if(input > 0xFFFF)
|
if(input > 0xFFFF)
|
||||||
{
|
{
|
||||||
|
@ -386,7 +386,7 @@ namespace oot::hid
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Controller::processKeyDown(int input)
|
void Controller::processKeyDown(hid::Button input)
|
||||||
{
|
{
|
||||||
switch(input)
|
switch(input)
|
||||||
{
|
{
|
||||||
|
@ -417,10 +417,13 @@ namespace oot::hid
|
||||||
case Button::CENTER_CAMERA:
|
case Button::CENTER_CAMERA:
|
||||||
oot::state.center_camera = true;
|
oot::state.center_camera = true;
|
||||||
break;
|
break;
|
||||||
|
case LANGUAGE_TOGGLE:
|
||||||
|
config().game().setLanguage((Language)((int)config().game().language() + 1));
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Controller::processKeyUp(int input)
|
void Controller::processKeyUp(hid::Button input)
|
||||||
{
|
{
|
||||||
switch(input)
|
switch(input)
|
||||||
{
|
{
|
||||||
|
@ -479,7 +482,7 @@ namespace oot::hid
|
||||||
|
|
||||||
namespace controller
|
namespace controller
|
||||||
{
|
{
|
||||||
const char* getInputName(Button input)
|
const char* getInputName(hid::Button input)
|
||||||
{
|
{
|
||||||
switch(input)
|
switch(input)
|
||||||
{
|
{
|
||||||
|
@ -517,6 +520,8 @@ namespace oot::hid
|
||||||
return "DEBUG_MENU";
|
return "DEBUG_MENU";
|
||||||
case Button::FAST_FORWARD:
|
case Button::FAST_FORWARD:
|
||||||
return "FAST_FORWARD";
|
return "FAST_FORWARD";
|
||||||
|
case Button::LANGUAGE_TOGGLE:
|
||||||
|
return "LANGUAGE_TOGGLE";
|
||||||
case Button::CENTER_CAMERA:
|
case Button::CENTER_CAMERA:
|
||||||
return "CENTER_CAMERA";
|
return "CENTER_CAMERA";
|
||||||
case Button::CURRENT_ACTION:
|
case Button::CURRENT_ACTION:
|
||||||
|
@ -583,6 +588,8 @@ namespace oot::hid
|
||||||
return Button::DEBUG_MENU;
|
return Button::DEBUG_MENU;
|
||||||
if(input == "FAST_FORWARD")
|
if(input == "FAST_FORWARD")
|
||||||
return Button::FAST_FORWARD;
|
return Button::FAST_FORWARD;
|
||||||
|
if(input == "LANGUAGE_TOGGLE")
|
||||||
|
return Button::LANGUAGE_TOGGLE;
|
||||||
if(input == "OCARINA")
|
if(input == "OCARINA")
|
||||||
return Button::OCARINA;
|
return Button::OCARINA;
|
||||||
if(input == "HOOKSHOT")
|
if(input == "HOOKSHOT")
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
|
|
||||||
namespace oot::hid
|
namespace oot::hid
|
||||||
{
|
{
|
||||||
enum Button
|
enum Button : s64
|
||||||
{
|
{
|
||||||
EMPTY_BUTTON = 0,
|
EMPTY_BUTTON = 0,
|
||||||
CONT_A = 0x8000,
|
CONT_A = 0x8000,
|
||||||
|
@ -36,23 +36,24 @@ namespace oot::hid
|
||||||
L_CBUTTONS = CONT_C,
|
L_CBUTTONS = CONT_C,
|
||||||
R_CBUTTONS = CONT_F,
|
R_CBUTTONS = CONT_F,
|
||||||
D_CBUTTONS = CONT_D,
|
D_CBUTTONS = CONT_D,
|
||||||
STICK_X_LEFT = 1 << 16,
|
STICK_X_LEFT = 1ULL << 16,
|
||||||
STICK_X_RIGHT = 1 << 17,
|
STICK_X_RIGHT = 1ULL << 17,
|
||||||
STICK_X_DOWN = 1 << 19,
|
STICK_X_DOWN = 1ULL << 19,
|
||||||
STICK_X_UP = 1 << 18,
|
STICK_X_UP = 1ULL << 18,
|
||||||
WALK_BUTTON = 1 << 20,
|
WALK_BUTTON = 1ULL << 20,
|
||||||
DEBUG_MENU = 1 << 21,
|
DEBUG_MENU = 1ULL << 21,
|
||||||
OCARINA = 1 << 22,
|
OCARINA = 1ULL << 22,
|
||||||
HOOKSHOT = 1 << 23,
|
HOOKSHOT = 1ULL << 23,
|
||||||
BOW_ARROW = 1 << 24,
|
BOW_ARROW = 1ULL << 24,
|
||||||
LENS_OF_TRUTH = 1 << 25,
|
LENS_OF_TRUTH = 1ULL << 25,
|
||||||
BOOTS_TOGGLE = 1 << 26,
|
BOOTS_TOGGLE = 1ULL << 26,
|
||||||
SWORD_TOGGLE = 1 << 27,
|
SWORD_TOGGLE = 1ULL << 27,
|
||||||
SHIELD_TOGGLE = 1 << 28,
|
SHIELD_TOGGLE = 1ULL << 28,
|
||||||
TUNIC_TOGGLE = 1 << 29,
|
TUNIC_TOGGLE = 1ULL << 29,
|
||||||
FAST_FORWARD = 1 << 30,
|
FAST_FORWARD = 1ULL << 30,
|
||||||
CENTER_CAMERA = 1 << 31,
|
CENTER_CAMERA = 1ULL << 31,
|
||||||
CURRENT_ACTION = 1 << 32
|
CURRENT_ACTION = 1ULL << 32,
|
||||||
|
LANGUAGE_TOGGLE = 1ULL << 33
|
||||||
};
|
};
|
||||||
|
|
||||||
class State
|
class State
|
||||||
|
@ -127,10 +128,10 @@ namespace oot::hid
|
||||||
virtual void ResetMotorPack();
|
virtual void ResetMotorPack();
|
||||||
virtual void SendMotorVib(int level);
|
virtual void SendMotorVib(int level);
|
||||||
|
|
||||||
virtual bool updateRebind(int input);
|
virtual bool updateRebind(hid::Button input);
|
||||||
virtual void processKey(int input);
|
virtual void processKey(hid::Button input);
|
||||||
virtual void processKeyUp(int input);
|
virtual void processKeyUp(hid::Button input);
|
||||||
virtual void processKeyDown(int input);
|
virtual void processKeyDown(hid::Button input);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual void vibrate();
|
virtual void vibrate();
|
||||||
|
@ -152,7 +153,7 @@ namespace oot::hid
|
||||||
|
|
||||||
namespace controller
|
namespace controller
|
||||||
{
|
{
|
||||||
const char* getInputName(Button input);
|
const char* getInputName(hid::Button input);
|
||||||
Button getInputValue(const std::string& input);
|
Button getInputValue(const std::string& input);
|
||||||
}
|
}
|
||||||
} // namespace oot::hid
|
} // namespace oot::hid
|
||||||
|
|
|
@ -41,7 +41,7 @@ namespace oot::hid
|
||||||
return *m_controllers[index];
|
return *m_controllers[index];
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Driver::updateRebind(int input)
|
bool Driver::updateRebind(hid::Button input)
|
||||||
{
|
{
|
||||||
bool result = 0;
|
bool result = 0;
|
||||||
for (auto& controller : m_controllers)
|
for (auto& controller : m_controllers)
|
||||||
|
@ -75,7 +75,7 @@ namespace oot::hid
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Controllers::Controllers() : m_rebindInput(0)
|
Controllers::Controllers() : m_rebindInput(Button::EMPTY_BUTTON)
|
||||||
{
|
{
|
||||||
#if defined(_MSC_VER)
|
#if defined(_MSC_VER)
|
||||||
if(oot::config().controls().useXInput() && !oot::config().controls().enableGyro())
|
if(oot::config().controls().useXInput() && !oot::config().controls().enableGyro())
|
||||||
|
@ -125,7 +125,7 @@ namespace oot::hid
|
||||||
|
|
||||||
if (result)
|
if (result)
|
||||||
{
|
{
|
||||||
m_rebindInput = 0;
|
m_rebindInput = Button::EMPTY_BUTTON;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -158,7 +158,7 @@ namespace oot::hid
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Controllers::rebind(int input)
|
void Controllers::rebind(hid::Button input)
|
||||||
{
|
{
|
||||||
m_rebindInput = input;
|
m_rebindInput = input;
|
||||||
}
|
}
|
||||||
|
|
|
@ -15,7 +15,7 @@ namespace oot::hid
|
||||||
virtual const u64 size() const;
|
virtual const u64 size() const;
|
||||||
virtual Controller& controller(const u64 index);
|
virtual Controller& controller(const u64 index);
|
||||||
virtual void update();
|
virtual void update();
|
||||||
virtual bool updateRebind(int input);
|
virtual bool updateRebind(hid::Button input);
|
||||||
virtual void scan(class Controllers* controllers);
|
virtual void scan(class Controllers* controllers);
|
||||||
virtual void resetBindings();
|
virtual void resetBindings();
|
||||||
virtual bool defaultOnly()
|
virtual bool defaultOnly()
|
||||||
|
@ -41,7 +41,7 @@ namespace oot::hid
|
||||||
void update();
|
void update();
|
||||||
void scan();
|
void scan();
|
||||||
bool isRebindMode() const;
|
bool isRebindMode() const;
|
||||||
void rebind(int input);
|
void rebind(hid::Button input);
|
||||||
void resetBindings();
|
void resetBindings();
|
||||||
std::vector<class Driver*>& drivers()
|
std::vector<class Driver*>& drivers()
|
||||||
{
|
{
|
||||||
|
@ -50,7 +50,7 @@ namespace oot::hid
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
std::vector<class Driver*> m_drivers;
|
std::vector<class Driver*> m_drivers;
|
||||||
int m_rebindInput;
|
Button m_rebindInput;
|
||||||
};
|
};
|
||||||
|
|
||||||
Controllers& controllers();
|
Controllers& controllers();
|
||||||
|
|
|
@ -110,6 +110,7 @@ namespace oot::hid
|
||||||
|
|
||||||
m_keyBindings[SDL_SCANCODE_F5] = Button::DEBUG_MENU;
|
m_keyBindings[SDL_SCANCODE_F5] = Button::DEBUG_MENU;
|
||||||
m_keyBindings[SDL_SCANCODE_G] = Button::FAST_FORWARD;
|
m_keyBindings[SDL_SCANCODE_G] = Button::FAST_FORWARD;
|
||||||
|
m_keyBindings[SDL_SCANCODE_F9] = Button::LANGUAGE_TOGGLE;
|
||||||
|
|
||||||
m_mouseBindings[SDL_BUTTON_LEFT] = Button::B_BUTTON;
|
m_mouseBindings[SDL_BUTTON_LEFT] = Button::B_BUTTON;
|
||||||
m_mouseBindings[SDL_BUTTON_RIGHT] = Button::CENTER_CAMERA;
|
m_mouseBindings[SDL_BUTTON_RIGHT] = Button::CENTER_CAMERA;
|
||||||
|
@ -288,7 +289,7 @@ namespace oot::hid
|
||||||
this->state().has_mouse = true;
|
this->state().has_mouse = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool canRebind(SDL_Scancode scancode, int input)
|
bool canRebind(SDL_Scancode scancode, hid::Button input)
|
||||||
{
|
{
|
||||||
if(m_keyBindings.count(scancode) == 0)
|
if(m_keyBindings.count(scancode) == 0)
|
||||||
{
|
{
|
||||||
|
@ -309,7 +310,7 @@ namespace oot::hid
|
||||||
return count != 1;
|
return count != 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool updateRebind(int input) override
|
bool updateRebind(hid::Button input) override
|
||||||
{
|
{
|
||||||
int count = 0;
|
int count = 0;
|
||||||
auto state = SDL_GetKeyboardState(&count);
|
auto state = SDL_GetKeyboardState(&count);
|
||||||
|
|
|
@ -284,7 +284,7 @@ namespace oot::hid
|
||||||
return convertToByte(value, g_rstickY_peak);
|
return convertToByte(value, g_rstickY_peak);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool canRebind(SDL_GameControllerButton button, int input)
|
bool canRebind(SDL_GameControllerButton button, hid::Button input)
|
||||||
{
|
{
|
||||||
if(m_keyBindings.count(button) == 0)
|
if(m_keyBindings.count(button) == 0)
|
||||||
{
|
{
|
||||||
|
@ -319,7 +319,7 @@ namespace oot::hid
|
||||||
return count != 1;
|
return count != 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool updateRebind(int input) override
|
bool updateRebind(hid::Button input) override
|
||||||
{
|
{
|
||||||
u8 state[SDL_CONTROLLER_BUTTON_MAX];
|
u8 state[SDL_CONTROLLER_BUTTON_MAX];
|
||||||
|
|
||||||
|
|
|
@ -318,7 +318,7 @@ namespace oot::hid
|
||||||
resetBindingsImpl();
|
resetBindingsImpl();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool canRebind(XInputButtons button, int input)
|
bool canRebind(XInputButtons button, hid::Button input)
|
||||||
{
|
{
|
||||||
if(m_keyBindings.count(button) == 0)
|
if(m_keyBindings.count(button) == 0)
|
||||||
{
|
{
|
||||||
|
@ -353,7 +353,7 @@ namespace oot::hid
|
||||||
return count != 1;
|
return count != 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool updateRebind(int input) override
|
bool updateRebind(hid::Button input) override
|
||||||
{
|
{
|
||||||
u8 state[MAX_BUTTONS];
|
u8 state[MAX_BUTTONS];
|
||||||
XINPUT_STATE xstate;
|
XINPUT_STATE xstate;
|
||||||
|
|
|
@ -16,6 +16,39 @@
|
||||||
#define CONFIG_JSON_FILE "config.json"
|
#define CONFIG_JSON_FILE "config.json"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
void Set_Language(u8 language_id);
|
||||||
|
|
||||||
|
std::string languageGetString(Language id)
|
||||||
|
{
|
||||||
|
switch(id)
|
||||||
|
{
|
||||||
|
case LANGUAGE_ENG:
|
||||||
|
return "en";
|
||||||
|
case LANGUAGE_FRA:
|
||||||
|
return "fr";
|
||||||
|
case LANGUAGE_GER:
|
||||||
|
return "de";
|
||||||
|
}
|
||||||
|
return "en";
|
||||||
|
}
|
||||||
|
|
||||||
|
Language languageGetId(const std::string& s)
|
||||||
|
{
|
||||||
|
if(s == "en")
|
||||||
|
{
|
||||||
|
return LANGUAGE_ENG;
|
||||||
|
}
|
||||||
|
else if(s == "fr")
|
||||||
|
{
|
||||||
|
return LANGUAGE_FRA;
|
||||||
|
}
|
||||||
|
else if(s == "de")
|
||||||
|
{
|
||||||
|
return LANGUAGE_GER;
|
||||||
|
}
|
||||||
|
return LANGUAGE_ENG;
|
||||||
|
}
|
||||||
|
|
||||||
namespace oot
|
namespace oot
|
||||||
{
|
{
|
||||||
static Options* g_options = nullptr;
|
static Options* g_options = nullptr;
|
||||||
|
@ -132,9 +165,11 @@ namespace oot
|
||||||
json::setBool(container, "recordTas", recordTas(), allocator);
|
json::setBool(container, "recordTas", recordTas(), allocator);
|
||||||
json::setBool(container, "forceMouse", forceMouse(), allocator);
|
json::setBool(container, "forceMouse", forceMouse(), allocator);
|
||||||
json::setBool(container, "enableExtendedOptionsMenu", enableExtendedOptionsMenu(), allocator);
|
json::setBool(container, "enableExtendedOptionsMenu", enableExtendedOptionsMenu(), allocator);
|
||||||
json::setBool(container, "enablDebugLevelSelect", enablDebugLevelSelect(), allocator);
|
json::setBool(container, "enableDebugLevelSelect", enablDebugLevelSelect(), allocator);
|
||||||
u64 m_pauseExitInputClearFrames;
|
|
||||||
u64 m_textScrollSpeed;
|
json::setU64(container, "pauseExitInputClearFrames", pauseExitInputClearFrames(), allocator);
|
||||||
|
json::setU64(container, "textScrollSpeed", textScrollSpeed(), allocator);
|
||||||
|
json::set(container, "language", languageGetString(language()), allocator);
|
||||||
|
|
||||||
|
|
||||||
doc.AddMember(rapidjson::Value("game", allocator), container, allocator);
|
doc.AddMember(rapidjson::Value("game", allocator), container, allocator);
|
||||||
|
@ -154,10 +189,23 @@ namespace oot
|
||||||
json::getBool(container, "recordTas", recordTas());
|
json::getBool(container, "recordTas", recordTas());
|
||||||
json::getBool(container, "forceMouse", forceMouse());
|
json::getBool(container, "forceMouse", forceMouse());
|
||||||
json::getBool(container, "enableExtendedOptionsMenu", enableExtendedOptionsMenu());
|
json::getBool(container, "enableExtendedOptionsMenu", enableExtendedOptionsMenu());
|
||||||
json::getBool(container, "enablDebugLevelSelect", enablDebugLevelSelect());
|
json::getBool(container, "enableDebugLevelSelect", enablDebugLevelSelect());
|
||||||
|
|
||||||
|
json::getU64(container, "pauseExitInputClearFrames", pauseExitInputClearFrames());
|
||||||
|
json::getU64(container, "textScrollSpeed", textScrollSpeed());
|
||||||
|
|
||||||
|
std::string lang;
|
||||||
|
json::get(container, "language", lang);
|
||||||
|
setLanguage(languageGetId(lang));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Game::setLanguage(Language id)
|
||||||
|
{
|
||||||
|
m_language = (Language)(id % LANGUAGE_MAX);
|
||||||
|
Set_Language(id);
|
||||||
|
}
|
||||||
|
|
||||||
const bool Game::mirror() const
|
const bool Game::mirror() const
|
||||||
{
|
{
|
||||||
if(!m_mirror)
|
if(!m_mirror)
|
||||||
|
|
|
@ -3,6 +3,7 @@
|
||||||
#include <map>
|
#include <map>
|
||||||
#include "json.h"
|
#include "json.h"
|
||||||
#include "port/controller/controller.h"
|
#include "port/controller/controller.h"
|
||||||
|
#include "include/z64message.h"
|
||||||
|
|
||||||
namespace oot
|
namespace oot
|
||||||
{
|
{
|
||||||
|
@ -336,6 +337,13 @@ namespace oot
|
||||||
return m_textScrollSpeed;
|
return m_textScrollSpeed;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const Language& language() const
|
||||||
|
{
|
||||||
|
return m_language;
|
||||||
|
}
|
||||||
|
|
||||||
|
void setLanguage(Language id);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
bool m_graphicsEnabled = true;
|
bool m_graphicsEnabled = true;
|
||||||
bool m_audioEnabled = true;
|
bool m_audioEnabled = true;
|
||||||
|
@ -348,6 +356,7 @@ namespace oot
|
||||||
bool m_enablDebugLevelSelect = false;
|
bool m_enablDebugLevelSelect = false;
|
||||||
u64 m_pauseExitInputClearFrames = 2;
|
u64 m_pauseExitInputClearFrames = 2;
|
||||||
u64 m_textScrollSpeed = 1;
|
u64 m_textScrollSpeed = 1;
|
||||||
|
Language m_language = LANGUAGE_ENG;
|
||||||
};
|
};
|
||||||
|
|
||||||
class Base
|
class Base
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
|
|
||||||
namespace oot
|
namespace oot
|
||||||
{
|
{
|
||||||
Player::Player() : m_rebindInput(0)
|
Player::Player() : m_rebindInput(hid::Button::EMPTY_BUTTON)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -44,12 +44,12 @@ namespace oot
|
||||||
|
|
||||||
if (result)
|
if (result)
|
||||||
{
|
{
|
||||||
m_rebindInput = -10;
|
m_rebindInput = (hid::Button)-10;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (m_rebindInput < 0)
|
else if ((s64)m_rebindInput < 0)
|
||||||
{
|
{
|
||||||
m_rebindInput++;
|
m_rebindInput = (hid::Button)((s64)m_rebindInput + 1);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -68,7 +68,7 @@ namespace oot
|
||||||
m_controller.resolveInputs();
|
m_controller.resolveInputs();
|
||||||
}
|
}
|
||||||
|
|
||||||
void Player::rebind(int input)
|
void Player::rebind(hid::Button input)
|
||||||
{
|
{
|
||||||
m_rebindInput = input;
|
m_rebindInput = input;
|
||||||
}
|
}
|
||||||
|
|
|
@ -25,14 +25,14 @@ namespace oot
|
||||||
return m_controller;
|
return m_controller;
|
||||||
}
|
}
|
||||||
|
|
||||||
void rebind(int input);
|
void rebind(hid::Button input);
|
||||||
bool isRebindMode() const;
|
bool isRebindMode() const;
|
||||||
void SendMotorEvent(short time, short level, u8 decay = 0);
|
void SendMotorEvent(short time, short level, u8 decay = 0);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
std::vector<std::shared_ptr<hid::Controller> > m_controllers;
|
std::vector<std::shared_ptr<hid::Controller> > m_controllers;
|
||||||
hid::Controller m_controller;
|
hid::Controller m_controller;
|
||||||
int m_rebindInput;
|
hid::Button m_rebindInput;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace oot
|
} // namespace oot
|
||||||
|
|
Loading…
Reference in New Issue
Block a user