1
0
mirror of https://github.com/blawar/ooot.git synced 2024-07-04 18:13:37 +00:00
This commit is contained in:
Blake Warner 2022-04-03 19:01:04 -04:00
parent 009121ac68
commit e12c262129
7 changed files with 21 additions and 24 deletions

View File

@ -303,7 +303,7 @@ namespace oot::hid
if(isFirstPerson()) if(isFirstPerson())
{ {
if(this->r_stickMag > RDEADZONE) if(this->r_stickMag > oot::config().controls().stickRightDeadzone())
{ {
this->stickMag = this->r_stickMag; this->stickMag = this->r_stickMag;
this->stickX = this->r_stickX; this->stickX = this->r_stickX;

View File

@ -68,10 +68,8 @@ namespace oot::hid
s8 r_stick_x; /* -80 <= stick_x <= 80 */ s8 r_stick_x; /* -80 <= stick_x <= 80 */
s8 r_stick_y; /* -80 <= stick_y <= 80 */ s8 r_stick_y; /* -80 <= stick_y <= 80 */
#ifdef ENABLE_GYRO
float gyro[3]; float gyro[3];
float accel[3]; float accel[3];
#endif
s64 mouse_x; s64 mouse_x;
s64 mouse_y; s64 mouse_y;
@ -95,10 +93,8 @@ namespace oot::hid
float r_stickY; // [-64, 64] positive is up float r_stickY; // [-64, 64] positive is up
float r_stickMag; // distance from center [0, 64] float r_stickMag; // distance from center [0, 64]
#ifdef ENABLE_GYRO
bool m_hasGyro = false; bool m_hasGyro = false;
bool m_hasAccel = false; bool m_hasAccel = false;
#endif
static s64 mouseScaleX(s64 value); static s64 mouseScaleX(s64 value);
static s64 mouseScaleY(s64 value); static s64 mouseScaleY(s64 value);

View File

@ -441,7 +441,7 @@ namespace oot::hid
uint32_t magnitude_sq = (uint32_t)(m_state.stick_x * m_state.stick_x) + (uint32_t)(m_state.stick_y * m_state.stick_y); uint32_t magnitude_sq = (uint32_t)(m_state.stick_x * m_state.stick_x) + (uint32_t)(m_state.stick_y * m_state.stick_y);
if(magnitude_sq < (uint32_t)(DEADZONE * DEADZONE)) if(magnitude_sq < (uint32_t)(oot::config().controls().stickLeftDeadzone() * oot::config().controls().stickLeftDeadzone()))
{ {
m_state.stick_x = 0; m_state.stick_x = 0;
m_state.stick_y = 0; m_state.stick_y = 0;
@ -449,7 +449,7 @@ namespace oot::hid
magnitude_sq = (uint32_t)(m_state.r_stick_x * m_state.r_stick_x) + (uint32_t)(m_state.r_stick_y * m_state.r_stick_y); magnitude_sq = (uint32_t)(m_state.r_stick_x * m_state.r_stick_x) + (uint32_t)(m_state.r_stick_y * m_state.r_stick_y);
if(magnitude_sq < (uint32_t)(RDEADZONE * RDEADZONE)) if(magnitude_sq < (uint32_t)(oot::config().controls().stickRightDeadzone() * oot::config().controls().stickRightDeadzone()))
{ {
m_state.r_stick_x = 0; m_state.r_stick_x = 0;
m_state.r_stick_y = 0; m_state.r_stick_y = 0;

View File

@ -8,6 +8,7 @@
#include <unordered_map> #include <unordered_map>
#include "json.h" #include "json.h"
#include <fstream> #include <fstream>
#include "port/options.h"
#define MAX_BUTTONS 16 #define MAX_BUTTONS 16
@ -488,7 +489,7 @@ namespace oot::hid
uint32_t magnitude_sq = (uint32_t)(m_state.stick_x * m_state.stick_x) + (uint32_t)(m_state.stick_y * m_state.stick_y); uint32_t magnitude_sq = (uint32_t)(m_state.stick_x * m_state.stick_x) + (uint32_t)(m_state.stick_y * m_state.stick_y);
if(magnitude_sq < (uint32_t)(DEADZONE * DEADZONE)) if(magnitude_sq < (uint32_t)(oot::config().controls().stickLeftDeadzone() * oot::config().controls().stickLeftDeadzone()))
{ {
m_state.stick_x = 0; m_state.stick_x = 0;
m_state.stick_y = 0; m_state.stick_y = 0;
@ -496,7 +497,7 @@ namespace oot::hid
magnitude_sq = (uint32_t)(m_state.r_stick_x * m_state.r_stick_x) + (uint32_t)(m_state.r_stick_y * m_state.r_stick_y); magnitude_sq = (uint32_t)(m_state.r_stick_x * m_state.r_stick_x) + (uint32_t)(m_state.r_stick_y * m_state.r_stick_y);
if(magnitude_sq < (uint32_t)(RDEADZONE * RDEADZONE)) if(magnitude_sq < (uint32_t)(oot::config().controls().stickRightDeadzone() * oot::config().controls().stickRightDeadzone()))
{ {
m_state.r_stick_x = 0; m_state.r_stick_x = 0;
m_state.r_stick_y = 0; m_state.r_stick_y = 0;

View File

@ -35,7 +35,7 @@
#include "geo_commands.h" #include "geo_commands.h"
*/ */
namespace sm64 namespace oot
{ {
/* /*
ExportDl::ExportDl(const Gfx* gfx, const char* name) ExportDl::ExportDl(const Gfx* gfx, const char* name)
@ -46,7 +46,7 @@ namespace sm64
{ {
auto hash = XXHash64::hash(name, strlen(name), 0); auto hash = XXHash64::hash(name, strlen(name), 0);
sm64::hook::geo::reg(geo, hash); oot::hook::geo::reg(geo, hash);
} }
ExportBhv::ExportBhv(const BehaviorScript* bhv, const char* name) ExportBhv::ExportBhv(const BehaviorScript* bhv, const char* name)
@ -58,7 +58,7 @@ namespace sm64
ExportMacro::ExportMacro(const MacroObject* macro, const u64 len, const char* name) ExportMacro::ExportMacro(const MacroObject* macro, const u64 len, const char* name)
{ {
auto hash = sm64::hook::macro::fingerprint(macro); auto hash = oot::hook::macro::fingerprint(macro);
hook::macro::reg((const MacroObject*)macro, hash); hook::macro::reg((const MacroObject*)macro, hash);
} }
@ -77,7 +77,7 @@ namespace sm64
{ {
if(!g_logHandle) if(!g_logHandle)
{ {
g_logHandle = fopen("sm64.log", "w"); g_logHandle = fopen("oot.log", "w");
} }
return g_logHandle; return g_logHandle;
} }
@ -94,4 +94,4 @@ namespace sm64
va_end(args); va_end(args);
} }
} // namespace sm64 } // namespace oot

View File

@ -15,7 +15,7 @@
{ \ { \
if(!g_##v) \ if(!g_##v) \
{ \ { \
g_##v = sm64::hook::geo::apply(::v, hook::geo::Id::v); \ g_##v = oot::hook::geo::apply(::v, hook::geo::Id::v); \
} \ } \
return g_##v; \ return g_##v; \
} }
@ -26,7 +26,7 @@
{ \ { \
if(!g_##v) \ if(!g_##v) \
{ \ { \
g_##v = sm64::hook::bhv::apply(::v, hook::bhv::Id::v); \ g_##v = oot::hook::bhv::apply(::v, hook::bhv::Id::v); \
} \ } \
return g_##v; \ return g_##v; \
} }
@ -37,11 +37,11 @@
{ \ { \
if(!g_##v) \ if(!g_##v) \
{ \ { \
g_##v = sm64::hook::macro::apply(::v, hook::macro::Id::v); \ g_##v = oot::hook::macro::apply(::v, hook::macro::Id::v); \
} \ } \
return g_##v; \ return g_##v; \
} }
//#define EXPORT_MACRO(v) static const MacroObject* g_##v = nullptr; const MacroObject* v() { if(!g_##v) { g_##v = sm64::hook::macro::apply(nullptr, hook::macro::Id::v); } return g_##v; } //#define EXPORT_MACRO(v) static const MacroObject* g_##v = nullptr; const MacroObject* v() { if(!g_##v) { g_##v = oot::hook::macro::apply(nullptr, hook::macro::Id::v); } return g_##v; }
#define EXPORT_LEVEL(v) static ExportLevel export_##v(::v, sizeof(::v), #v) #define EXPORT_LEVEL(v) static ExportLevel export_##v(::v, sizeof(::v), #v)
#else #else
#define EXPORT_DL(v) #define EXPORT_DL(v)
@ -74,12 +74,12 @@
#define EXTERN_GeoLayout(X) extern const GeoLayout X[]; #define EXTERN_GeoLayout(X) extern const GeoLayout X[];
#define EXTERN_LevelScript(X) extern const LevelScript X[]; #define EXTERN_LevelScript(X) extern const LevelScript X[];
#define EXTERN_MacroObject(X) \ #define EXTERN_MacroObject(X) \
namespace sm64::macro \ namespace oot::macro \
{ \ { \
const MacroObject* X(); \ const MacroObject* X(); \
} }
namespace sm64 namespace oot
{ {
void log(const char* format, ...); void log(const char* format, ...);
void closeExportFile(); void closeExportFile();
@ -108,6 +108,6 @@ namespace sm64
{ {
ExportMacro(const MacroObject* macro, const u64 len, const char* name); ExportMacro(const MacroObject* macro, const u64 len, const char* name);
};*/ };*/
} // namespace sm64 } // namespace oot
#endif /* _DEBUG_H */ #endif /* _DEBUG_H */

View File

@ -114,12 +114,12 @@ bool verifyIntegrity()
if(!hasRom) if(!hasRom)
{ {
sm64::log("error: unable to locate Z64 rom.\n"); oot::log("error: unable to locate Z64 rom.\n");
} }
if(!hasPak) if(!hasPak)
{ {
sm64::log("error: unable to locate romfs/!!base.pak\n"); oot::log("error: unable to locate romfs/!!base.pak\n");
} }
free(buffer); free(buffer);
@ -143,7 +143,7 @@ static bool exists(const char* path)
void main_func(void) void main_func(void)
{ {
sm64::log("initializing app\n"); oot::log("initializing app\n");
//Check if texture packs exist //Check if texture packs exist
if(exists("THE LEGEND OF ZELDA_HIRESTEXTURES.hts")) if(exists("THE LEGEND OF ZELDA_HIRESTEXTURES.hts"))