diff --git a/src/client/Client.cpp b/src/client/Client.cpp index c2387c4..a8d90e8 100644 --- a/src/client/Client.cpp +++ b/src/client/Client.cpp @@ -19,6 +19,7 @@ #include #include #include +#include #include 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); diff --git a/src/glue/CGlueMgr.cpp b/src/glue/CGlueMgr.cpp index c38fd28..b2d6c27 100644 --- a/src/glue/CGlueMgr.cpp +++ b/src/glue/CGlueMgr.cpp @@ -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 #include @@ -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"); } diff --git a/src/gx/CGVideoOptions.cpp b/src/gx/CGVideoOptions.cpp new file mode 100644 index 0000000..c779e76 --- /dev/null +++ b/src/gx/CGVideoOptions.cpp @@ -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++; + } +} diff --git a/src/gx/CGVideoOptions.hpp b/src/gx/CGVideoOptions.hpp new file mode 100644 index 0000000..048e10f --- /dev/null +++ b/src/gx/CGVideoOptions.hpp @@ -0,0 +1,16 @@ +#ifndef GX_C_GX_VIDEO_OPTIONS_HPP +#define GX_C_GX_VIDEO_OPTIONS_HPP + +#include "ui/Types.hpp" +#include + +class CGVideoOptions { + public: + // Static variables + static FrameScript_Method s_ScriptFunctions[]; + + // Static functions + static void RegisterScriptFunctions(); +}; + +#endif diff --git a/src/sound/CMakeLists.txt b/src/sound/CMakeLists.txt index 6ac8bbd..44b9ad7 100644 --- a/src/sound/CMakeLists.txt +++ b/src/sound/CMakeLists.txt @@ -13,4 +13,6 @@ target_link_libraries(sound PRIVATE ui util + PUBLIC + fmod ) diff --git a/src/sound/SI2.cpp b/src/sound/SI2.cpp index 7622510..eef2cca 100644 --- a/src/sound/SI2.cpp +++ b/src/sound/SI2.cpp @@ -1,11 +1,73 @@ #include "sound/SI2.hpp" #include "ui/FrameScript.hpp" +#include "console/CVar.hpp" +#include + +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) { + +} diff --git a/src/sound/SI2.hpp b/src/sound/SI2.hpp index ec41703..bd8a881 100644 --- a/src/sound/SI2.hpp +++ b/src/sound/SI2.hpp @@ -1,17 +1,34 @@ #ifndef SOUND_SI2_HPP #define SOUND_SI2_HPP -#include "sound/SI2Script.hpp" #include "ui/Types.hpp" +#include #include +#include +#include +#include + + +#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 diff --git a/src/sound/SI2Cvars.cpp b/src/sound/SI2Cvars.cpp new file mode 100644 index 0000000..900bb18 --- /dev/null +++ b/src/sound/SI2Cvars.cpp @@ -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); +} diff --git a/src/sound/SI2Log.cpp b/src/sound/SI2Log.cpp new file mode 100644 index 0000000..e73e07d --- /dev/null +++ b/src/sound/SI2Log.cpp @@ -0,0 +1,71 @@ +#include "sound/SI2.hpp" +#include +#include +#include + +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++; +} diff --git a/src/sound/SI2Script.cpp b/src/sound/SI2Script.cpp index d358bcd..138b994 100644 --- a/src/sound/SI2Script.cpp +++ b/src/sound/SI2Script.cpp @@ -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 } }; diff --git a/src/sound/SI2Script.hpp b/src/sound/SI2Script.hpp deleted file mode 100644 index 9c3b882..0000000 --- a/src/sound/SI2Script.hpp +++ /dev/null @@ -1,6 +0,0 @@ -#ifndef SOUND_SI2_SCRIPT_HPP -#define SOUND_SI2_SCRIPT_HPP - -#define NUM_SCRIPT_FUNCTIONS_SI2 23 - -#endif diff --git a/src/ui/CMakeLists.txt b/src/ui/CMakeLists.txt index 8bf424e..17cb3aa 100644 --- a/src/ui/CMakeLists.txt +++ b/src/ui/CMakeLists.txt @@ -25,4 +25,5 @@ target_link_libraries(ui common storm tempest + fmod ) diff --git a/src/ui/CSimpleFontString.cpp b/src/ui/CSimpleFontString.cpp index cfc5889..525185e 100644 --- a/src/ui/CSimpleFontString.cpp +++ b/src/ui/CSimpleFontString.cpp @@ -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) { diff --git a/src/ui/ScriptFunctions.hpp b/src/ui/ScriptFunctions.hpp index 00c73ed..1bf8779 100644 --- a/src/ui/ScriptFunctions.hpp +++ b/src/ui/ScriptFunctions.hpp @@ -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 diff --git a/src/ui/ScriptFunctionsGlueScriptEvents.cpp b/src/ui/ScriptFunctionsGlueScriptEvents.cpp index 2c7aad8..376524a 100644 --- a/src/ui/ScriptFunctionsGlueScriptEvents.cpp +++ b/src/ui/ScriptFunctionsGlueScriptEvents.cpp @@ -11,6 +11,7 @@ #include "util/Lua.hpp" #include "util/SFile.hpp" #include "util/Unimplemented.hpp" +#include "sound/SI2.hpp" #include 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) { diff --git a/src/ui/ScriptFunctionsSystem.cpp b/src/ui/ScriptFunctionsSystem.cpp index e354f67..e007706 100644 --- a/src/ui/ScriptFunctionsSystem.cpp +++ b/src/ui/ScriptFunctionsSystem.cpp @@ -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 } }; diff --git a/src/util/CStatus.cpp b/src/util/CStatus.cpp index 39533a5..57e5c4b 100644 --- a/src/util/CStatus.cpp +++ b/src/util/CStatus.cpp @@ -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(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, ...) { diff --git a/src/util/CStatus.hpp b/src/util/CStatus.hpp index 141fef1..2a5ef32 100644 --- a/src/util/CStatus.hpp +++ b/src/util/CStatus.hpp @@ -1,6 +1,9 @@ #ifndef UTIL_C_STATUS_HPP #define UTIL_C_STATUS_HPP +#include +#include + 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 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); diff --git a/src/util/Log.cpp b/src/util/Log.cpp deleted file mode 100644 index 45a5355..0000000 --- a/src/util/Log.cpp +++ /dev/null @@ -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 -} diff --git a/src/util/SysMessage.cpp b/src/util/SysMessage.cpp new file mode 100644 index 0000000..7d28c80 --- /dev/null +++ b/src/util/SysMessage.cpp @@ -0,0 +1,5 @@ +#include "util/SysMessage.hpp" + +void SysMsgPrintf(SYSMSG_TYPE severity, const char* format, ...) { + // TODO +} diff --git a/src/util/Log.hpp b/src/util/SysMessage.hpp similarity index 73% rename from src/util/Log.hpp rename to src/util/SysMessage.hpp index 5b2e3b6..f796227 100644 --- a/src/util/Log.hpp +++ b/src/util/SysMessage.hpp @@ -1,5 +1,5 @@ -#ifndef UTIL_LOG_HPP -#define UTIL_LOG_HPP +#ifndef UTIL_SYSMESSAGE_HPP +#define UTIL_SYSMESSAGE_HPP #include @@ -11,8 +11,6 @@ enum SYSMSG_TYPE { SYSMSG_NUMTYPES = 0x4 }; -bool SLogCreate(const char*, uint32_t, void*); - void SysMsgPrintf(SYSMSG_TYPE, const char*, ...); #endif