mirror of
https://github.com/thunderbrewhq/thunderbrew
synced 2025-10-26 05:46:04 +03:00
refactor(thunderbrew): use static size members instead of null-termination to delimit FrameScript_Method arrays
This commit is contained in:
parent
32cfe08d0b
commit
2fb754a83a
@ -32,14 +32,14 @@ FrameScript_Method CGVideoOptions::s_ScriptFunctions[] = {
|
||||
{ "GetRefreshRates", &Script_GetRefreshRates },
|
||||
{ "GetCurrentMultisampleFormat", &Script_GetCurrentMultisampleFormat },
|
||||
{ "GetMultisampleFormats", &Script_GetMultisampleFormats },
|
||||
{ "IsStereoVideoAvailable", &Script_IsStereoVideoAvailable },
|
||||
{ nullptr, nullptr }
|
||||
{ "IsStereoVideoAvailable", &Script_IsStereoVideoAvailable }
|
||||
};
|
||||
|
||||
size_t CGVideoOptions::s_NumScriptFunctions = sizeof(CGVideoOptions::s_ScriptFunctions) / sizeof(FrameScript_Method);
|
||||
|
||||
void CGVideoOptions::RegisterScriptFunctions() {
|
||||
FrameScript_Method* item = s_ScriptFunctions;
|
||||
while (item->name) {
|
||||
for (int32_t i = 0; i < CGVideoOptions::s_NumScriptFunctions; i++) {
|
||||
auto item = &s_ScriptFunctions[i];
|
||||
FrameScript_RegisterFunction(item->name, item->method);
|
||||
item++;
|
||||
}
|
||||
}
|
||||
|
||||
@ -6,11 +6,12 @@
|
||||
|
||||
class CGVideoOptions {
|
||||
public:
|
||||
// Static variables
|
||||
static FrameScript_Method s_ScriptFunctions[];
|
||||
// Static variables
|
||||
static FrameScript_Method s_ScriptFunctions[];
|
||||
static size_t CGVideoOptions::s_NumScriptFunctions;
|
||||
|
||||
// Static functions
|
||||
static void RegisterScriptFunctions();
|
||||
// Static functions
|
||||
static void RegisterScriptFunctions();
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@ -1268,8 +1268,6 @@ void CGxDeviceGLSDL::SceneClear(uint32_t mask, CImVector color) {
|
||||
}
|
||||
|
||||
void CGxDeviceGLSDL::ScenePresent() {
|
||||
this->m_GLSDLWindow.DispatchEvents();
|
||||
|
||||
if (this->m_context) {
|
||||
// TODO
|
||||
|
||||
|
||||
@ -7,7 +7,7 @@ int32_t GLMipmap::GetDepthBits() {
|
||||
return this->m_DepthBits;
|
||||
}
|
||||
|
||||
void GLMipmap::Attach(GLFramebuffer* framebuffer, GLenum attachPoint, int32_t a4) {
|
||||
void GLMipmap::Attach(GLFramebuffer* framebuffer, GLenum attachPoint, int32_t level) {
|
||||
if (!this->m_AttachPoints) {
|
||||
this->m_AttachPoints = new std::vector<GLAttachPoint>();
|
||||
}
|
||||
@ -44,7 +44,7 @@ void GLMipmap::Attach(GLFramebuffer* framebuffer, GLenum attachPoint, int32_t a4
|
||||
GL_TEXTURE_3D,
|
||||
this->m_Texture->m_TextureID,
|
||||
this->m_Level,
|
||||
a4
|
||||
level
|
||||
);
|
||||
} else {
|
||||
glFramebufferTexture2DEXT(
|
||||
@ -67,7 +67,7 @@ void GLMipmap::Attach(GLFramebuffer* framebuffer, GLenum attachPoint, int32_t a4
|
||||
|
||||
auto& attach = attachPoints[framebufferID];
|
||||
attach.framebuffer = framebuffer;
|
||||
attach.zOffset = a4;
|
||||
attach.zOffset = level;
|
||||
|
||||
if (
|
||||
(attach.point != GL_DEPTH_ATTACHMENT || attachPoint != GL_STENCIL_ATTACHMENT)
|
||||
|
||||
@ -18,17 +18,14 @@ void F_CALL FMOD_Free(void* ptr, FMOD_MEMORY_TYPE type, const char* sourcestr) {
|
||||
SMemFree(ptr, sourcestr, 0, 0);
|
||||
}
|
||||
|
||||
|
||||
void SI2::RegisterScriptFunctions() {
|
||||
FrameScript_Method* item = s_ScriptFunctions;
|
||||
while (item->name) {
|
||||
for (int32_t i = 0; i < s_NumScriptFunctions; i++) {
|
||||
auto item = &s_ScriptFunctions[i];
|
||||
FrameScript_RegisterFunction(item->name, item->method);
|
||||
item++;
|
||||
}
|
||||
}
|
||||
|
||||
int32_t SI2::Init(int32_t flag) {
|
||||
|
||||
Log_Init();
|
||||
SI2_LOG("=> Version %s (%s) %s", "1.0.0", "00000", "Feb 25 2024");
|
||||
SI2_LOG(" ");
|
||||
|
||||
@ -16,6 +16,7 @@ class SI2 {
|
||||
public:
|
||||
// Static variables
|
||||
static FrameScript_Method s_ScriptFunctions[];
|
||||
static size_t s_NumScriptFunctions;
|
||||
static uint32_t sm_logFlags;
|
||||
static HSLOG sm_log;
|
||||
static FMOD::System* sm_pGameSystem;
|
||||
|
||||
@ -122,6 +122,7 @@ FrameScript_Method SI2::s_ScriptFunctions[] = {
|
||||
{ "VoiceChat_IsRecordingLoopbackSound", &Script_VoiceChat_IsRecordingLoopbackSound },
|
||||
{ "VoiceChat_IsPlayingLoopbackSound", &Script_VoiceChat_IsPlayingLoopbackSound },
|
||||
{ "VoiceChat_GetCurrentMicrophoneSignalLevel", &Script_VoiceChat_GetCurrentMicrophoneSignalLevel },
|
||||
{ "VoiceChat_ActivatePrimaryCaptureCallback", &Script_VoiceChat_ActivatePrimaryCaptureCallback },
|
||||
{ nullptr, nullptr }
|
||||
{ "VoiceChat_ActivatePrimaryCaptureCallback", &Script_VoiceChat_ActivatePrimaryCaptureCallback }
|
||||
};
|
||||
|
||||
size_t SI2::s_NumScriptFunctions = sizeof(SI2::s_ScriptFunctions) / sizeof(FrameScript_Method);
|
||||
|
||||
Loading…
Reference in New Issue
Block a user