Skip to content

Commit

Permalink
Hollywood and fpfc controls
Browse files Browse the repository at this point in the history
  • Loading branch information
Metalit committed Nov 16, 2024
1 parent a76bd01 commit 6df4f0d
Show file tree
Hide file tree
Showing 9 changed files with 271 additions and 935 deletions.
2 changes: 0 additions & 2 deletions qmod/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -86,8 +86,6 @@ target_include_directories(${COMPILE_ID} PUBLIC ${SHARED_DIR})
target_include_directories(${COMPILE_ID} PRIVATE ${EXTERN_DIR}/includes/${CODEGEN_ID}/include)

target_link_libraries(${COMPILE_ID} PRIVATE -llog)
# video stuff
target_link_libraries(${COMPILE_ID} PRIVATE mediandk -lOpenSLES GLESv3 -lEGL -landroid)

# add extern stuff like libs and other includes
include(extern.cmake)
Expand Down
72 changes: 11 additions & 61 deletions qmod/include/CameraController.hpp
Original file line number Diff line number Diff line change
@@ -1,13 +1,10 @@
#pragma once

#include "UnityEngine/Camera.hpp"
#include "UnityEngine/GameObject.hpp"
#include "UnityEngine/MonoBehaviour.hpp"
#include "UnityEngine/Transform.hpp"
#include "UnityEngine/Vector2.hpp"
#include "UnityEngine/Vector3.hpp"
#include "custom-types/shared/macros.hpp"
#include "sombrero/shared/FastVector2.hpp"
#include "sombrero/shared/FastVector3.hpp"

#ifdef BEAT_SABER
#include "GlobalNamespace/VRController.hpp"
Expand All @@ -20,78 +17,31 @@ DECLARE_CLASS_CODEGEN(QRUE, CameraController, UnityEngine::MonoBehaviour,
DECLARE_INSTANCE_METHOD(void, OnEnable);
DECLARE_INSTANCE_METHOD(void, OnDisable);
DECLARE_INSTANCE_METHOD(void, Update);
DECLARE_INSTANCE_METHOD(void, Rotate, Sombrero::FastVector2);
DECLARE_INSTANCE_METHOD(void, Move, Sombrero::FastVector3);
DECLARE_INSTANCE_METHOD(void, Rotate, UnityEngine::Vector2);
DECLARE_INSTANCE_METHOD(void, KeyDown, StringW);
DECLARE_INSTANCE_METHOD(void, KeyUp, StringW);
DECLARE_INSTANCE_METHOD(void, MouseDown);
DECLARE_INSTANCE_METHOD(void, MouseUp);

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_METHOD(void, GetControllers);
DECLARE_INSTANCE_METHOD(void, ReleaseControllers);

DECLARE_INSTANCE_FIELD(GlobalNamespace::VRController*, controller0);
DECLARE_INSTANCE_FIELD(GlobalNamespace::VRController*, controller1);
#endif
)

#ifdef UNITY_2021
#include <EGL/egl.h>

#include "media/NdkMediaCodec.h"

DECLARE_CLASS_CODEGEN(QRUE, CameraStreamer, UnityEngine::MonoBehaviour,
DECLARE_DEFAULT_CTOR();

DECLARE_INSTANCE_METHOD(void, Init, int width, int height, int bitrate);
DECLARE_INSTANCE_METHOD(void, Stop);
DECLARE_INSTANCE_METHOD(void, FinishStop);
DECLARE_INSTANCE_METHOD(void, Update);
DECLARE_INSTANCE_METHOD(void, OnDestroy);

DECLARE_INSTANCE_FIELD_DEFAULT(int, texture, -1);
DECLARE_INSTANCE_FIELD_DEFAULT(int, buffer, -1);
DECLARE_INSTANCE_FIELD_DEFAULT(int, id, -1);
DECLARE_INSTANCE_FIELD_DEFAULT(int, width, -1);
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:
std::function<void(uint8_t*, size_t)> onOutputFrame;

ANativeWindow* window;
EGLSurface surface;

static CameraStreamer* GetById(int id);

private:
AMediaCodec* encoder;

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{};
UnityEngine::Vector3 movementF;
UnityEngine::Vector3 movementB;
)
#endif

extern bool fpfcEnabled;

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

#ifdef BEAT_SABER
extern bool click;
extern bool clickOnce;
extern HMUI::UIKeyboard* keyboardOpen;

UnityEngine::GameObject* GetHovered();
Expand Down
7 changes: 6 additions & 1 deletion qmod/qpm.json
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,11 @@
"id": "sombrero",
"versionRange": "^0.1.40",
"additionalData": {}
},
{
"id": "hollywood",
"versionRange": "^1.0.0",
"additionalData": {}
}
]
}
}
33 changes: 24 additions & 9 deletions qmod/qpm.shared.json
Original file line number Diff line number Diff line change
Expand Up @@ -78,20 +78,25 @@
"id": "sombrero",
"versionRange": "^0.1.40",
"additionalData": {}
},
{
"id": "hollywood",
"versionRange": "^1.0.0",
"additionalData": {}
}
]
},
"restoredDependencies": [
{
"dependency": {
"id": "paper",
"versionRange": "=3.6.4",
"versionRange": "=3.7.0",
"additionalData": {
"soLink": "https://github.com/Fernthedev/paperlog/releases/download/v3.6.4/libpaperlog.so",
"debugSoLink": "https://github.com/Fernthedev/paperlog/releases/download/v3.6.4/debug_libpaperlog.so",
"soLink": "https://github.com/Fernthedev/paperlog/releases/download/v3.7.0/libpaperlog.so",
"debugSoLink": "https://github.com/Fernthedev/paperlog/releases/download/v3.7.0/debug_libpaperlog.so",
"overrideSoName": "libpaperlog.so",
"modLink": "https://github.com/Fernthedev/paperlog/releases/download/v3.6.4/paperlog.qmod",
"branchName": "version/v3_6_4",
"modLink": "https://github.com/Fernthedev/paperlog/releases/download/v3.7.0/paperlog.qmod",
"branchName": "version/v3_7_0",
"compileOptions": {
"systemIncludes": [
"shared/utfcpp/source"
Expand All @@ -100,7 +105,7 @@
"cmake": false
}
},
"version": "3.6.4"
"version": "3.7.0"
},
{
"dependency": {
Expand Down Expand Up @@ -167,6 +172,16 @@
},
"version": "3700.0.0"
},
{
"dependency": {
"id": "hollywood",
"versionRange": "=1.0.0",
"additionalData": {
"overrideSoName": "libhollywood.so"
}
},
"version": "1.0.0"
},
{
"dependency": {
"id": "beatsaber-hook",
Expand Down Expand Up @@ -196,10 +211,10 @@
{
"dependency": {
"id": "fmt",
"versionRange": "=10.0.0",
"versionRange": "=11.0.2",
"additionalData": {
"headersOnly": true,
"branchName": "version/v10_0_0",
"branchName": "version/v11_0_2",
"compileOptions": {
"systemIncludes": [
"fmt/include/"
Expand All @@ -210,7 +225,7 @@
}
}
},
"version": "10.0.0"
"version": "11.0.2"
}
]
}
Loading

0 comments on commit 6df4f0d

Please sign in to comment.