Skip to content

Commit

Permalink
Begin fpfc refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
Metalit committed Nov 14, 2024
1 parent aea3ee7 commit a76bd01
Show file tree
Hide file tree
Showing 14 changed files with 575 additions and 371 deletions.
30 changes: 18 additions & 12 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion qmod/assets.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ if(EXISTS ${ASSETS_DIRECTORY})

add_custom_command(
OUTPUT ${PREPENDED_ASSETS_DIR}/${ASSET}
COMMAND ${CMAKE_COMMAND} -E cat ${ASSETS_DIRECTORY}/${ASSET} >> ${PREPENDED_ASSETS_DIR}/${ASSET}
COMMAND ${CMAKE_COMMAND} -E cat ${ASSETS_DIRECTORY}/${ASSET} > ${PREPENDED_ASSETS_DIR}/${ASSET}
COMMAND ${CMAKE_COMMAND} -E echo_append " " >> ${PREPENDED_ASSETS_DIR}/${ASSET}
DEPENDS ${ASSETS_DIRECTORY}/${ASSET}
)
Expand Down
43 changes: 20 additions & 23 deletions qmod/include/CameraController.hpp
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
#pragma once

#ifdef BEAT_SABER
#include "UnityEngine/Camera.hpp"
#include "UnityEngine/GameObject.hpp"
#include "UnityEngine/MonoBehaviour.hpp"
#include "UnityEngine/Transform.hpp"
#include "UnityEngine/Vector2.hpp"
#include "custom-types/shared/macros.hpp"

#include "sombrero/shared/FastVector2.hpp"
#include "sombrero/shared/FastVector3.hpp"

#include "UnityEngine/MonoBehaviour.hpp"
#include "UnityEngine/Vector2.hpp"
#include "UnityEngine/Transform.hpp"
#include "UnityEngine/GameObject.hpp"
#include "UnityEngine/Camera.hpp"
#ifdef BEAT_SABER
#include "GlobalNamespace/VRController.hpp"
#include "HMUI/UIKeyboard.hpp"
#endif

DECLARE_CLASS_CODEGEN(QRUE, CameraController, UnityEngine::MonoBehaviour,
DECLARE_DEFAULT_CTOR();
Expand All @@ -23,19 +23,15 @@ DECLARE_CLASS_CODEGEN(QRUE, CameraController, UnityEngine::MonoBehaviour,
DECLARE_INSTANCE_METHOD(void, Rotate, Sombrero::FastVector2);
DECLARE_INSTANCE_METHOD(void, Move, Sombrero::FastVector3);

#ifdef UNITY_2021
DECLARE_INSTANCE_FIELD(UnityEngine::Camera*, customCamera);
DECLARE_INSTANCE_FIELD_DEFAULT(bool, recording, false);
#endif
DECLARE_INSTANCE_FIELD(float, lastTime);
DECLARE_INSTANCE_FIELD(float, lastMovement);
DECLARE_INSTANCE_FIELD(bool, backspaceHold);
DECLARE_INSTANCE_FIELD(float, backspaceHoldStart);
DECLARE_INSTANCE_FIELD(UnityEngine::Vector2, lastPos);
#ifdef BEAT_SABER
DECLARE_INSTANCE_FIELD(GlobalNamespace::VRController*, controller0);
DECLARE_INSTANCE_FIELD(GlobalNamespace::VRController*, controller1);
DECLARE_INSTANCE_FIELD(UnityEngine::Transform*, parentTransform);
DECLARE_INSTANCE_FIELD(UnityEngine::Transform*, childTransform);
#endif
)

#ifdef UNITY_2021
Expand All @@ -59,6 +55,7 @@ DECLARE_CLASS_CODEGEN(QRUE, CameraStreamer, UnityEngine::MonoBehaviour,
DECLARE_INSTANCE_FIELD_DEFAULT(int, height, -1);
DECLARE_INSTANCE_FIELD_DEFAULT(bool, initializedEncoder, false);
DECLARE_INSTANCE_FIELD_DEFAULT(bool, initializedEgl, false);
DECLARE_INSTANCE_FIELD_DEFAULT(bool, stopping, false);
DECLARE_INSTANCE_FIELD_DEFAULT(int, framesProcessing, 0);

public:
Expand All @@ -72,31 +69,31 @@ DECLARE_CLASS_CODEGEN(QRUE, CameraStreamer, UnityEngine::MonoBehaviour,
private:
AMediaCodec* encoder;

bool stopThread = false;
bool threadRunning = false;
std::thread threadInst;
void EncodingThread();

bool shouldRestart = false;
int restartWidth, restartHeight, restartBitrate;

static inline int maxId = 0;
static inline std::shared_mutex idMapMutex;
static inline std::unordered_map<int, CameraStreamer*> idMap{};
)
#endif

extern bool fpfcEnabled;
#ifdef UNITY_2021
extern Sombrero::FastVector3 fpfcPos;
extern Sombrero::FastVector3 fpfcRot;
#endif

extern bool click;
extern bool clickOnce;
extern HMUI::UIKeyboard* keyboardOpen;

extern float rotateSensitivity;
extern float moveSensitivity;
extern float clickTime;
extern float movementThreshold;

UnityEngine::GameObject* GetHovered();
#ifdef BEAT_SABER
extern bool click;
extern bool clickOnce;
extern HMUI::UIKeyboard* keyboardOpen;

UnityEngine::GameObject* GetHovered();
#endif

Loading

0 comments on commit a76bd01

Please sign in to comment.