mirror of
https://github.com/thunderbrewhq/thunderbrew
synced 2025-04-19 11:30:09 +03:00
feat(sound): Small script related improvements
* chore(build): rename src/util/Log.* to SysMessage.* * chore(ui): implement SetNonSpaceWrap() for error messages * chore(ui): move Video Script methods into CGVideoOptions class * chore(script): temporary fix GetNumOutputDrivers to eliminate loading errors * feat(sound): add SI2 Log methods * chore(sound): add SI2 CVars * chore(ui): implement Script_PlayGlueMusic * chore(sound): update SI2::Init() * fix: resolve compilation errors in variadic macros SI2_ERR and SI2_LOG --------- Co-authored-by: Tristan Cormier <cormiert2@outlook.com>
This commit is contained in:
parent
8596860120
commit
32cfe08d0b
@ -19,6 +19,7 @@
|
||||
#include <bc/Debug.hpp>
|
||||
#include <common/Prop.hpp>
|
||||
#include <storm/Error.hpp>
|
||||
#include <storm/Log.hpp>
|
||||
#include <bc/os/Path.hpp>
|
||||
|
||||
CVar* Client::g_accountListVar;
|
||||
@ -150,6 +151,7 @@ void SetPaths() {
|
||||
datadir = buffer;
|
||||
}
|
||||
|
||||
SLogSetDefaultDirectory(datadir);
|
||||
SFile::SetBasePath(datadir);
|
||||
SFile::SetDataPath("Data\\");
|
||||
|
||||
@ -368,7 +370,7 @@ void StormInitialize() {
|
||||
// TODO
|
||||
// SStrInitialize();
|
||||
// SErrInitialize();
|
||||
// SLogInitialize();
|
||||
SLogInitialize();
|
||||
// SFile::Initialize();
|
||||
|
||||
Blizzard::Debug::SetAssertHandler(BlizzardAssertCallback);
|
||||
|
@ -4,6 +4,7 @@
|
||||
#include "client/ClientServices.hpp"
|
||||
#include "gx/Coordinate.hpp"
|
||||
#include "gx/Device.hpp"
|
||||
#include "gx/CGVideoOptions.hpp"
|
||||
#include "math/Utils.hpp"
|
||||
#include "net/Connection.hpp"
|
||||
#include "net/Login.hpp"
|
||||
@ -16,7 +17,7 @@
|
||||
#include "ui/ScriptFunctions.hpp"
|
||||
#include "console/CVar.hpp"
|
||||
#include "util/Filesystem.hpp"
|
||||
#include "util/Log.hpp"
|
||||
#include "util/SysMessage.hpp"
|
||||
#include <cstdio>
|
||||
#include <common/MD5.hpp>
|
||||
|
||||
@ -512,7 +513,8 @@ void CGlueMgr::Resume() {
|
||||
|
||||
// TODO
|
||||
// AccountMsg_RegisterScriptFunctions();
|
||||
// CGVideoOptions::RegisterScriptFunctions();
|
||||
|
||||
CGVideoOptions::RegisterScriptFunctions();
|
||||
|
||||
// TODO
|
||||
// FrameScript::s_scriptFunctionsLoaded = 1;
|
||||
@ -523,7 +525,7 @@ void CGlueMgr::Resume() {
|
||||
|
||||
CWOWClientStatus status;
|
||||
|
||||
if (!SLogCreate("Logs\\GlueXML.log", 0, status.m_logFile)) {
|
||||
if (!SLogCreate("Logs\\GlueXML.log", 0, &status.m_logFile)) {
|
||||
SysMsgPrintf(SYSMSG_WARNING, "Cannot create WOWClient log file \"%s\"!", "Logs\\GlueXML.log");
|
||||
}
|
||||
|
||||
|
45
src/gx/CGVideoOptions.cpp
Normal file
45
src/gx/CGVideoOptions.cpp
Normal file
@ -0,0 +1,45 @@
|
||||
#include "gx/CGVideoOptions.hpp"
|
||||
#include "ui/FrameScript.hpp"
|
||||
#include "util/Unimplemented.hpp"
|
||||
|
||||
int32_t Script_GetCurrentResolution(lua_State* L) {
|
||||
WHOA_UNIMPLEMENTED(0);
|
||||
}
|
||||
|
||||
int32_t Script_GetScreenResolutions(lua_State* L) {
|
||||
WHOA_UNIMPLEMENTED(0);
|
||||
}
|
||||
|
||||
int32_t Script_GetRefreshRates(lua_State* L) {
|
||||
WHOA_UNIMPLEMENTED(0);
|
||||
}
|
||||
|
||||
int32_t Script_GetCurrentMultisampleFormat(lua_State* L) {
|
||||
WHOA_UNIMPLEMENTED(0);
|
||||
}
|
||||
|
||||
int32_t Script_GetMultisampleFormats(lua_State* L) {
|
||||
WHOA_UNIMPLEMENTED(0);
|
||||
}
|
||||
|
||||
int32_t Script_IsStereoVideoAvailable(lua_State* L) {
|
||||
WHOA_UNIMPLEMENTED(0);
|
||||
}
|
||||
|
||||
FrameScript_Method CGVideoOptions::s_ScriptFunctions[] = {
|
||||
{ "GetCurrentResolution", &Script_GetCurrentResolution },
|
||||
{ "GetScreenResolutions", &Script_GetScreenResolutions },
|
||||
{ "GetRefreshRates", &Script_GetRefreshRates },
|
||||
{ "GetCurrentMultisampleFormat", &Script_GetCurrentMultisampleFormat },
|
||||
{ "GetMultisampleFormats", &Script_GetMultisampleFormats },
|
||||
{ "IsStereoVideoAvailable", &Script_IsStereoVideoAvailable },
|
||||
{ nullptr, nullptr }
|
||||
};
|
||||
|
||||
void CGVideoOptions::RegisterScriptFunctions() {
|
||||
FrameScript_Method* item = s_ScriptFunctions;
|
||||
while (item->name) {
|
||||
FrameScript_RegisterFunction(item->name, item->method);
|
||||
item++;
|
||||
}
|
||||
}
|
16
src/gx/CGVideoOptions.hpp
Normal file
16
src/gx/CGVideoOptions.hpp
Normal file
@ -0,0 +1,16 @@
|
||||
#ifndef GX_C_GX_VIDEO_OPTIONS_HPP
|
||||
#define GX_C_GX_VIDEO_OPTIONS_HPP
|
||||
|
||||
#include "ui/Types.hpp"
|
||||
#include <cstdint>
|
||||
|
||||
class CGVideoOptions {
|
||||
public:
|
||||
// Static variables
|
||||
static FrameScript_Method s_ScriptFunctions[];
|
||||
|
||||
// Static functions
|
||||
static void RegisterScriptFunctions();
|
||||
};
|
||||
|
||||
#endif
|
@ -13,4 +13,6 @@ target_link_libraries(sound
|
||||
PRIVATE
|
||||
ui
|
||||
util
|
||||
PUBLIC
|
||||
fmod
|
||||
)
|
||||
|
@ -1,11 +1,73 @@
|
||||
#include "sound/SI2.hpp"
|
||||
#include "ui/FrameScript.hpp"
|
||||
#include "console/CVar.hpp"
|
||||
#include <storm/Memory.hpp>
|
||||
|
||||
FMOD::System* SI2::sm_pGameSystem = nullptr;
|
||||
FMOD::System* SI2::sm_pChatSystem = nullptr;
|
||||
|
||||
void* F_CALL FMOD_Alloc(unsigned int size, FMOD_MEMORY_TYPE type, const char* sourcestr) {
|
||||
return SMemAlloc(size, sourcestr, 0, 0);
|
||||
}
|
||||
|
||||
void* F_CALL FMOD_ReAlloc(void* ptr, unsigned int size, FMOD_MEMORY_TYPE type, const char* sourcestr) {
|
||||
return SMemReAlloc(ptr, size, sourcestr, 0, 0);
|
||||
}
|
||||
|
||||
void F_CALL FMOD_Free(void* ptr, FMOD_MEMORY_TYPE type, const char* sourcestr) {
|
||||
SMemFree(ptr, sourcestr, 0, 0);
|
||||
}
|
||||
|
||||
|
||||
void SI2::RegisterScriptFunctions() {
|
||||
for (int32_t i = 0; i < NUM_SCRIPT_FUNCTIONS_SI2; ++i) {
|
||||
FrameScript_RegisterFunction(
|
||||
SI2::s_ScriptFunctions[i].name,
|
||||
SI2::s_ScriptFunctions[i].method
|
||||
);
|
||||
FrameScript_Method* item = s_ScriptFunctions;
|
||||
while (item->name) {
|
||||
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(" ");
|
||||
SI2_LOG("=> Setting up Game Sound:");
|
||||
SI2_LOG(" - SESound Engine Init");
|
||||
|
||||
SI2_LOG(" - FMOD Memory Init");
|
||||
FMOD::Memory_Initialize(nullptr, 0, &FMOD_Alloc, &FMOD_ReAlloc, &FMOD_Free);
|
||||
// sub_877440(&off_B1D5E4);
|
||||
|
||||
SI2_LOG(" - FMOD System Create");
|
||||
auto errcode = FMOD::System_Create(&sm_pGameSystem);
|
||||
if (errcode) {
|
||||
if (errcode != FMOD_ERR_DSP_SILENCE && errcode != FMOD_ERR_INVALID_VECTOR && errcode != FMOD_ERR_RECORD) {
|
||||
SI2_ERR(errcode, "");
|
||||
}
|
||||
SI2_LOG(" -###########################################################################################");
|
||||
SI2_ERR(errcode, " -######## ERROR INITIALIZING. ALL GAME SOUND DISABLED.");
|
||||
SI2_LOG(" -###########################################################################################");
|
||||
sm_pGameSystem->setOutput(FMOD_OUTPUTTYPE_NOSOUND);
|
||||
goto LABEL_9;
|
||||
}
|
||||
|
||||
errcode = FMOD::System_Create(&sm_pChatSystem);
|
||||
if (errcode != FMOD_ERR_DSP_SILENCE && errcode != FMOD_ERR_INVALID_VECTOR && errcode != FMOD_ERR_RECORD) {
|
||||
SI2_ERR(errcode, "");
|
||||
}
|
||||
|
||||
if (sm_pChatSystem && sm_pChatSystem->init(4, FMOD_INIT_NORMAL, nullptr)) {
|
||||
sm_pChatSystem->setOutput(FMOD_OUTPUTTYPE_NOSOUND);
|
||||
}
|
||||
|
||||
sm_pGameSystem->setOutput(FMOD_OUTPUTTYPE_AUTODETECT);
|
||||
|
||||
LABEL_9:
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
void SI2::StartGlueMusic(const char* filename) {
|
||||
|
||||
}
|
||||
|
@ -1,17 +1,34 @@
|
||||
#ifndef SOUND_SI2_HPP
|
||||
#define SOUND_SI2_HPP
|
||||
|
||||
#include "sound/SI2Script.hpp"
|
||||
#include "ui/Types.hpp"
|
||||
#include <storm/Log.hpp>
|
||||
#include <cstdint>
|
||||
#include <cstdarg>
|
||||
#include <fmod.hpp>
|
||||
#include <fmod_errors.h>
|
||||
|
||||
|
||||
#define SI2_ERR(errcode, format, ...) SI2::Log_Write(__LINE__, __FILE__, errcode, format, ##__VA_ARGS__)
|
||||
#define SI2_LOG(format, ...) SI2::Log_Write(__LINE__, __FILE__, FMOD_OK, format, ##__VA_ARGS__)
|
||||
|
||||
class SI2 {
|
||||
public:
|
||||
// Static variables
|
||||
static FrameScript_Method s_ScriptFunctions[NUM_SCRIPT_FUNCTIONS_SI2];
|
||||
static FrameScript_Method s_ScriptFunctions[];
|
||||
static uint32_t sm_logFlags;
|
||||
static HSLOG sm_log;
|
||||
static FMOD::System* sm_pGameSystem;
|
||||
static FMOD::System* sm_pChatSystem;
|
||||
|
||||
// Static functions
|
||||
static void RegisterScriptFunctions();
|
||||
static int32_t Log_Init();
|
||||
static void Log_Write(const char* format, ...);
|
||||
static void Log_Write(uint32_t line, const char* filename, FMOD_RESULT errcode, const char* format, ...);
|
||||
static void RegisterCVars();
|
||||
static int32_t Init(int32_t flag);
|
||||
static void StartGlueMusic(const char* filename);
|
||||
};
|
||||
|
||||
#endif
|
||||
|
80
src/sound/SI2Cvars.cpp
Normal file
80
src/sound/SI2Cvars.cpp
Normal file
@ -0,0 +1,80 @@
|
||||
#include "sound/SI2.hpp"
|
||||
#include "console/CVar.hpp"
|
||||
|
||||
bool OutboundChatVolumeHandler(CVar*, const char*, const char*, void*) {
|
||||
return true;
|
||||
}
|
||||
|
||||
bool InboundChatVolumeHandler(CVar*, const char*, const char*, void*) {
|
||||
return true;
|
||||
}
|
||||
|
||||
bool VoiceChatModeHandler(CVar*, const char*, const char*, void*) {
|
||||
return true;
|
||||
}
|
||||
|
||||
bool VoiceActivationSensitivityHandler(CVar*, const char*, const char*, void*) {
|
||||
return true;
|
||||
}
|
||||
|
||||
bool EnableMicrophoneHandler(CVar*, const char*, const char*, void*) {
|
||||
return true;
|
||||
}
|
||||
|
||||
bool EnableVoiceChatHandler(CVar*, const char*, const char*, void*) {
|
||||
return true;
|
||||
}
|
||||
|
||||
bool SelfMuteHandler(CVar*, const char*, const char*, void*) {
|
||||
return true;
|
||||
}
|
||||
|
||||
bool PushToTalkButtonHandler(CVar*, const char*, const char*, void*) {
|
||||
return true;
|
||||
}
|
||||
|
||||
bool EnableReverb_CVarCallback(CVar*, const char*, const char*, void*) {
|
||||
return true;
|
||||
}
|
||||
|
||||
bool VoiceChatInputDriverIndex_CVarCallback(CVar*, const char*, const char*, void*) {
|
||||
return true;
|
||||
}
|
||||
|
||||
bool VoiceChatOutputDriverIndex_CVarCallback(CVar*, const char*, const char*, void*) {
|
||||
return true;
|
||||
}
|
||||
|
||||
bool OutputDriverIndex_CVarCallback(CVar*, const char*, const char*, void*) {
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
void SI2::RegisterCVars() {
|
||||
CVar::Register("StartTalkingDelay", "", 0, "0.0", 0, 5, 0, 0, 0);
|
||||
CVar::Register("StartTalkingTime", "", 0, "1.0", 0, 5, 0, 0, 0);
|
||||
CVar::Register("StopTalkingDelay", "", 0, "0.0", 0, 5, 0, 0, 0);
|
||||
CVar::Register("StopTalkingTime", "", 0, "2.0", 0, 5, 0, 0, 0);
|
||||
CVar::Register("OutboundChatVolume", "The software amplification factor (0.0 - 2.0)", 0, "1.0", &OutboundChatVolumeHandler, 5, 0, 0, 0);
|
||||
CVar::Register("InboundChatVolume", "The volume of all other chat you hear (0.0 - 1.0)", 0, "1.0", &InboundChatVolumeHandler, 5, 0, 0, 0);
|
||||
CVar::Register("VoiceChatMode", "Push to talk(0) or voice activation(1)", 0, "0", &VoiceChatModeHandler, 5, 0, 0, 0);
|
||||
CVar::Register("VoiceActivationSensitivity", "Sensitivity of the microphone (0.0 - 1.0)", 0, "0.4", &VoiceActivationSensitivityHandler, 5, 0, 0, 0);
|
||||
CVar::Register("EnableMicrophone", "Enables the microphone so you can speak.", 0, "1", &EnableMicrophoneHandler, 5, 0, 0, 0);
|
||||
CVar::Register("EnableVoiceChat", "Enables the voice chat feature.", 0, "0", &EnableVoiceChatHandler, 5, 0, 0, 0);
|
||||
CVar::Register("VoiceChatSelfMute", "Turn off your ability to talk.", 0, "0", &SelfMuteHandler, 5, 0, 0, 0);
|
||||
CVar::Register("PushToTalkButton", "String representation of the Push-To-Talk button.", 0, "`", &PushToTalkButtonHandler, 5, 0, 0, 0);
|
||||
CVar::Register("Sound_OutputQuality", "sound quality, default 1 (medium)", 0, "1", 0, 7, 0, 0, 0);
|
||||
CVar::Register("Sound_NumChannels", "number of sound channels", 0, "32", 0, 7, 0, 0, 0);
|
||||
CVar::Register("Sound_EnableReverb", "", 0, "0", &EnableReverb_CVarCallback, 7, 0, 0, 0);
|
||||
CVar::Register("Sound_EnableSoftwareHRTF", "", 0, "0", 0, 7, 0, 0, 0);
|
||||
CVar::Register("Sound_VoiceChatInputDriverIndex", "", 0, "0", &VoiceChatInputDriverIndex_CVarCallback, 7, 0, 0, 0);
|
||||
CVar::Register("Sound_VoiceChatInputDriverName", "", 0, "Primary Sound Capture Driver", 0, 7, 0, 0, 0);
|
||||
CVar::Register("Sound_VoiceChatOutputDriverIndex", "", 0, "0", &VoiceChatOutputDriverIndex_CVarCallback, 7, 0, 0, 0);
|
||||
CVar::Register("Sound_VoiceChatOutputDriverName", "", 0, "Primary Sound Driver", 0, 7, 0, 0, 0);
|
||||
CVar::Register("Sound_OutputDriverIndex", "", 0, "0", &OutputDriverIndex_CVarCallback, 7, 0, 0, 0);
|
||||
CVar::Register("Sound_OutputDriverName", "", 0, "Primary Sound Driver", 0, 7, 0, 0, 0);
|
||||
CVar::Register("Sound_DSPBufferSize", "sound buffer size, default 0", 0, "0", 0, 7, 0, 0, 0);
|
||||
CVar::Register("Sound_EnableHardware", "Enables Hardware", 0, "0", 0, 7, 0, 0, 0);
|
||||
CVar::Register("Sound_EnableMode2", "test", 0, "0", 0, 7, 0, 0, 0);
|
||||
CVar::Register("Sound_EnableMixMode2", "test", 0, "0", 0, 7, 0, 0, 0);
|
||||
}
|
71
src/sound/SI2Log.cpp
Normal file
71
src/sound/SI2Log.cpp
Normal file
@ -0,0 +1,71 @@
|
||||
#include "sound/SI2.hpp"
|
||||
#include <storm/Error.hpp>
|
||||
#include <bc/os/File.hpp>
|
||||
#include <cstdio>
|
||||
|
||||
uint32_t SI2::sm_logFlags = SLOG_FLAG_DEFAULT;
|
||||
HSLOG SI2::sm_log = nullptr;
|
||||
|
||||
int32_t SI2::Log_Init() {
|
||||
OsCreateDirectory("Logs", 0);
|
||||
SLogCreate("Logs\\Sound.log", sm_logFlags, &sm_log);
|
||||
sm_logFlags |= SLOG_FLAG_APPEND;
|
||||
// return OsDeleteFile((Blizzard::File*)"Logs\\SESound.log");
|
||||
return 0;
|
||||
}
|
||||
|
||||
void SI2::Log_Write(const char* format, ...) {
|
||||
STORM_ASSERT(format);
|
||||
|
||||
char output[512] = { 0 };
|
||||
if (format[0]) {
|
||||
va_list va;
|
||||
va_start(va, format);
|
||||
vsnprintf(output, sizeof(output), format, va);
|
||||
va_end(va);
|
||||
}
|
||||
|
||||
Log_Write(__LINE__, __FILE__, FMOD_OK, output);
|
||||
}
|
||||
|
||||
void SI2::Log_Write(uint32_t line, const char* filename, FMOD_RESULT errcode, const char* format, ...) {
|
||||
static uint32_t s_nNumErrors = 0;
|
||||
|
||||
if (s_nNumErrors > 200) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (s_nNumErrors == 200) {
|
||||
SLogWrite(sm_log, " -######## TOO MANY ERRORS. NO FURTHER ERRORS WILL BE LOGGED.");
|
||||
SLogFlush(sm_log);
|
||||
s_nNumErrors++;
|
||||
return;
|
||||
}
|
||||
|
||||
STORM_ASSERT(format);
|
||||
|
||||
char output[512] = { 0 };
|
||||
if (format[0]) {
|
||||
va_list va;
|
||||
va_start(va, format);
|
||||
vsnprintf(output, sizeof(output), format, va);
|
||||
va_end(va);
|
||||
}
|
||||
|
||||
if (errcode == FMOD_OK) {
|
||||
SLogWrite(sm_log, output);
|
||||
SLogFlush(sm_log);
|
||||
}
|
||||
|
||||
if (errcode == FMOD_ERR_HTTP_PROXY_AUTH) {
|
||||
return;
|
||||
}
|
||||
|
||||
SLogWrite(sm_log, " -######## FMOD ERROR! (err %d) %s", errcode, FMOD_ErrorString(errcode));
|
||||
if (format[0]) {
|
||||
SLogWrite(sm_log, output);
|
||||
}
|
||||
SLogWrite(sm_log, "%s(%d)", filename, line);
|
||||
SLogFlush(sm_log);
|
||||
s_nNumErrors++;
|
||||
}
|
@ -1,4 +1,3 @@
|
||||
#include "sound/SI2Script.hpp"
|
||||
#include "sound/SI2.hpp"
|
||||
#include "ui/Types.hpp"
|
||||
#include "util/Lua.hpp"
|
||||
@ -21,7 +20,8 @@ int32_t Script_StopMusic(lua_State* L) {
|
||||
}
|
||||
|
||||
int32_t Script_Sound_GameSystem_GetNumInputDrivers(lua_State* L) {
|
||||
WHOA_UNIMPLEMENTED(0);
|
||||
lua_pushnumber(L, 0.0);
|
||||
return 1;
|
||||
}
|
||||
|
||||
int32_t Script_Sound_GameSystem_GetInputDriverNameByIndex(lua_State* L) {
|
||||
@ -29,7 +29,10 @@ int32_t Script_Sound_GameSystem_GetInputDriverNameByIndex(lua_State* L) {
|
||||
}
|
||||
|
||||
int32_t Script_Sound_GameSystem_GetNumOutputDrivers(lua_State* L) {
|
||||
WHOA_UNIMPLEMENTED(0);
|
||||
// TODO:
|
||||
// NumOutputDrivers = (double)(int)SE3::GetNumOutputDrivers(SE3::sm_pGameSystem, v3);
|
||||
lua_pushnumber(L, 0.0);
|
||||
return 1;
|
||||
}
|
||||
|
||||
int32_t Script_Sound_GameSystem_GetOutputDriverNameByIndex(lua_State* L) {
|
||||
@ -96,7 +99,7 @@ int32_t Script_VoiceChat_ActivatePrimaryCaptureCallback(lua_State* L) {
|
||||
WHOA_UNIMPLEMENTED(0);
|
||||
}
|
||||
|
||||
FrameScript_Method SI2::s_ScriptFunctions[NUM_SCRIPT_FUNCTIONS_SI2] = {
|
||||
FrameScript_Method SI2::s_ScriptFunctions[] = {
|
||||
{ "PlaySound", &Script_PlaySound },
|
||||
{ "PlayMusic", &Script_PlayMusic },
|
||||
{ "PlaySoundFile", &Script_PlaySoundFile },
|
||||
@ -119,5 +122,6 @@ FrameScript_Method SI2::s_ScriptFunctions[NUM_SCRIPT_FUNCTIONS_SI2] = {
|
||||
{ "VoiceChat_IsRecordingLoopbackSound", &Script_VoiceChat_IsRecordingLoopbackSound },
|
||||
{ "VoiceChat_IsPlayingLoopbackSound", &Script_VoiceChat_IsPlayingLoopbackSound },
|
||||
{ "VoiceChat_GetCurrentMicrophoneSignalLevel", &Script_VoiceChat_GetCurrentMicrophoneSignalLevel },
|
||||
{ "VoiceChat_ActivatePrimaryCaptureCallback", &Script_VoiceChat_ActivatePrimaryCaptureCallback }
|
||||
{ "VoiceChat_ActivatePrimaryCaptureCallback", &Script_VoiceChat_ActivatePrimaryCaptureCallback },
|
||||
{ nullptr, nullptr }
|
||||
};
|
||||
|
@ -1,6 +0,0 @@
|
||||
#ifndef SOUND_SI2_SCRIPT_HPP
|
||||
#define SOUND_SI2_SCRIPT_HPP
|
||||
|
||||
#define NUM_SCRIPT_FUNCTIONS_SI2 23
|
||||
|
||||
#endif
|
@ -25,4 +25,5 @@ target_link_libraries(ui
|
||||
common
|
||||
storm
|
||||
tempest
|
||||
fmod
|
||||
)
|
||||
|
@ -748,6 +748,17 @@ void CSimpleFontString::SetJustifyH(uint8_t justify) {
|
||||
|
||||
void CSimpleFontString::SetNonSpaceWrap(int32_t a2) {
|
||||
// TODO
|
||||
// Proper implementation
|
||||
uint32_t styleFlags = a2
|
||||
? this->m_styleFlags | 0x1000
|
||||
: this->m_styleFlags & ~0x1000;
|
||||
|
||||
if (this->m_styleFlags != styleFlags) {
|
||||
this->m_styleFlags = styleFlags;
|
||||
if (this->m_string) {
|
||||
this->UpdateString();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void CSimpleFontString::SetSpacing(float spacing) {
|
||||
|
@ -11,7 +11,7 @@ struct lua_State;
|
||||
#define NUM_SCRIPT_FUNCTIONS_GLUE_SCRIPT_EVENTS 113
|
||||
#define NUM_SCRIPT_FUNCTIONS_REALM_LIST 14
|
||||
#define NUM_SCRIPT_FUNCTIONS_SIMPLE_FRAME 7
|
||||
#define NUM_SCRIPT_FUNCTIONS_SYSTEM 13
|
||||
#define NUM_SCRIPT_FUNCTIONS_SYSTEM 7
|
||||
|
||||
namespace FrameScript {
|
||||
extern FrameScript_Method s_ScriptFunctions_CharCreate[NUM_SCRIPT_FUNCTIONS_CHAR_CREATE];
|
||||
@ -210,6 +210,5 @@ int32_t Script_GetTime(lua_State*);
|
||||
int32_t Script_GetGameTime(lua_State*);
|
||||
int32_t Script_ConsoleExec(lua_State*);
|
||||
int32_t Script_AccessDenied(lua_State*);
|
||||
int32_t Script_GetCurrentResolution(lua_State*);
|
||||
|
||||
#endif
|
||||
|
@ -11,6 +11,7 @@
|
||||
#include "util/Lua.hpp"
|
||||
#include "util/SFile.hpp"
|
||||
#include "util/Unimplemented.hpp"
|
||||
#include "sound/SI2.hpp"
|
||||
#include <cstdint>
|
||||
|
||||
int32_t Script_IsShiftKeyDown(lua_State* L) {
|
||||
@ -80,7 +81,12 @@ int32_t Script_QuitGameAndRunLauncher(lua_State* L) {
|
||||
}
|
||||
|
||||
int32_t Script_PlayGlueMusic(lua_State* L) {
|
||||
WHOA_UNIMPLEMENTED(0);
|
||||
if (!lua_isstring(L, 1)) {
|
||||
return luaL_error(L, "Usage: PlayGlueMusic(\"filename\")");
|
||||
}
|
||||
|
||||
SI2::StartGlueMusic(lua_tolstring(L, 1, 0));
|
||||
return 0;
|
||||
}
|
||||
|
||||
int32_t Script_PlayCreditsMusic(lua_State* L) {
|
||||
|
@ -24,30 +24,6 @@ int32_t Script_AccessDenied(lua_State* L) {
|
||||
return luaL_error(L, "Access Denied");
|
||||
}
|
||||
|
||||
int32_t Script_GetCurrentResolution(lua_State* L) {
|
||||
WHOA_UNIMPLEMENTED(0);
|
||||
}
|
||||
|
||||
int32_t Script_GetScreenResolutions(lua_State* L) {
|
||||
WHOA_UNIMPLEMENTED(0);
|
||||
}
|
||||
|
||||
int32_t Script_GetRefreshRates(lua_State* L) {
|
||||
WHOA_UNIMPLEMENTED(0);
|
||||
}
|
||||
|
||||
int32_t Script_GetCurrentMultisampleFormat(lua_State* L) {
|
||||
WHOA_UNIMPLEMENTED(0);
|
||||
}
|
||||
|
||||
int32_t Script_GetMultisampleFormats(lua_State* L) {
|
||||
WHOA_UNIMPLEMENTED(0);
|
||||
}
|
||||
|
||||
int32_t Script_IsStereoVideoAvailable(lua_State* L) {
|
||||
WHOA_UNIMPLEMENTED(0);
|
||||
}
|
||||
|
||||
FrameScript_Method FrameScript::s_ScriptFunctions_System[NUM_SCRIPT_FUNCTIONS_SYSTEM] = {
|
||||
{ "GetTime", &Script_GetTime },
|
||||
{ "GetGameTime", &Script_GetGameTime },
|
||||
@ -55,11 +31,5 @@ FrameScript_Method FrameScript::s_ScriptFunctions_System[NUM_SCRIPT_FUNCTIONS_SY
|
||||
{ "ReadFile", &Script_AccessDenied },
|
||||
{ "DeleteFile", &Script_AccessDenied },
|
||||
{ "AppendToFile", &Script_AccessDenied },
|
||||
{ "GetAccountExpansionLevel", &Script_GetAccountExpansionLevel },
|
||||
{ "GetCurrentResolution", &Script_GetCurrentResolution },
|
||||
{ "GetScreenResolutions", &Script_GetScreenResolutions },
|
||||
{ "GetRefreshRates", &Script_GetRefreshRates },
|
||||
{ "GetCurrentMultisampleFormat", &Script_GetCurrentMultisampleFormat },
|
||||
{ "GetMultisampleFormats", &Script_GetMultisampleFormats },
|
||||
{ "IsStereoVideoAvailable", &Script_IsStereoVideoAvailable },
|
||||
{ "GetAccountExpansionLevel", &Script_GetAccountExpansionLevel }
|
||||
};
|
||||
|
@ -4,8 +4,14 @@
|
||||
|
||||
CStatus CStatus::s_errorList;
|
||||
|
||||
void CStatus::Add(const CStatus& status) {
|
||||
void CStatus::Add(const CStatus& source) {
|
||||
// TODO
|
||||
// Remove const_cast<> workaround
|
||||
CStatus& src = const_cast<CStatus&>(source);
|
||||
|
||||
for (auto i = src.statusList.Head(); i; i = src.statusList.Next(i)) {
|
||||
this->Add(i->severity, i->text);
|
||||
}
|
||||
}
|
||||
|
||||
void CStatus::Add(STATUS_TYPE severity, const char* format, ...) {
|
||||
|
@ -1,6 +1,9 @@
|
||||
#ifndef UTIL_C_STATUS_HPP
|
||||
#define UTIL_C_STATUS_HPP
|
||||
|
||||
#include <storm/List.hpp>
|
||||
#include <storm/Log.hpp>
|
||||
|
||||
enum STATUS_TYPE {
|
||||
STATUS_INFO = 0x0,
|
||||
STATUS_WARNING = 0x1,
|
||||
@ -10,6 +13,13 @@ enum STATUS_TYPE {
|
||||
};
|
||||
|
||||
class CStatus {
|
||||
public:
|
||||
struct STATUSENTRY {
|
||||
char* text;
|
||||
STATUS_TYPE severity;
|
||||
TSLink<CStatus::STATUSENTRY> link;
|
||||
};
|
||||
|
||||
public:
|
||||
// Static variables
|
||||
static CStatus s_errorList;
|
||||
@ -17,11 +27,14 @@ class CStatus {
|
||||
// Member functions
|
||||
void Add(const CStatus&);
|
||||
void Add(STATUS_TYPE, const char*, ...);
|
||||
|
||||
public:
|
||||
STORM_EXPLICIT_LIST(CStatus::STATUSENTRY, link) statusList;
|
||||
};
|
||||
|
||||
class CWOWClientStatus : public CStatus {
|
||||
public:
|
||||
void* m_logFile = nullptr;
|
||||
HSLOG m_logFile = nullptr;
|
||||
};
|
||||
|
||||
CStatus& GetGlobalStatusObj(void);
|
||||
|
@ -1,11 +0,0 @@
|
||||
#include "util/Log.hpp"
|
||||
|
||||
bool SLogCreate(const char* filename, uint32_t flags, void* log) {
|
||||
// TODO
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void SysMsgPrintf(SYSMSG_TYPE severity, const char* format, ...) {
|
||||
// TODO
|
||||
}
|
5
src/util/SysMessage.cpp
Normal file
5
src/util/SysMessage.cpp
Normal file
@ -0,0 +1,5 @@
|
||||
#include "util/SysMessage.hpp"
|
||||
|
||||
void SysMsgPrintf(SYSMSG_TYPE severity, const char* format, ...) {
|
||||
// TODO
|
||||
}
|
@ -1,5 +1,5 @@
|
||||
#ifndef UTIL_LOG_HPP
|
||||
#define UTIL_LOG_HPP
|
||||
#ifndef UTIL_SYSMESSAGE_HPP
|
||||
#define UTIL_SYSMESSAGE_HPP
|
||||
|
||||
#include <cstdint>
|
||||
|
||||
@ -11,8 +11,6 @@ enum SYSMSG_TYPE {
|
||||
SYSMSG_NUMTYPES = 0x4
|
||||
};
|
||||
|
||||
bool SLogCreate(const char*, uint32_t, void*);
|
||||
|
||||
void SysMsgPrintf(SYSMSG_TYPE, const char*, ...);
|
||||
|
||||
#endif
|
Loading…
Reference in New Issue
Block a user