Files
SatyandClaude Opus 5.5 2e418f9e08 Client bring-up: glue screen, EULA/TOS, shutdown chain, LCD, x64 fixes
- Stand-in client reaches the glue screens (intro movie, EULA/TOS accept,
  login screen) at 16:9; stand-ins are report-only on x64
- Ports on the startup/idle path: GlueScriptEvents/CharacterSelection/
  CharacterCreation/RealmList/AccountMsg/VideoOptions _Scripts, CGlueMgr
  (Initialize/Resume/Idle/Accept*/Shutdown), ClientServices, NetClient/
  WowConnection, DBCache + instances, WorldParam/World/Map/Liquid/Weather/
  shadow, InputControl, Scrn, ConsoleClient, SysMessage, LoadingScreen,
  SystemRegisterFunctions, CGameTime, Screen::GetAspectRatio
- Shutdown chain: BeginCloseGame, DestroyEngineCallback, DBCache save/
  destroy, SpellVisuals/Effect/World/Glue teardown
- Logitech LCD no-device path in Ui/UILCD/Windows (Windows-only dir);
  lgLcd is a stub library in ThirdParty/lgLcd
- CVar and console commands split into <Module>_CVar.cpp / _Console.cpp
- DivxDecoder.dll (Win32, original) and XvidDecoder.dll (x64, port with
  vendored xvidcore) both copied to the build folder
- Warden: Win32 faithful port, Win64 stub
- x64 fixes: lua_newstate gcusage/gctime init, pointer render states reset
  with nullptr, g_rndSeed defined
- 37 class/struct forward-declaration mismatches fixed (false stand-ins)

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
2026-09-27 21:47:34 +02:00

118 lines
2.8 KiB
C++

#include <cstdint>
#include <cstring>
#include <xvid.h>
#include "ThirdParty/DivxDecoder/DivxDecoder.h"
struct XvidDecoderSlot {
void* m_handle;
int32_t m_width;
int32_t m_height;
};
static XvidDecoderSlot s_slots[16];
static bool s_globalInitialized;
static bool ValidSlot(int32_t decoder) {
return decoder >= 0 && decoder < static_cast<int32_t>(sizeof(s_slots) / sizeof(s_slots[0]));
}
static bool GlobalInitialize() {
if (s_globalInitialized) {
return true;
}
xvid_gbl_init_t init;
memset(&init, 0, sizeof(init));
init.version = XVID_VERSION;
if (xvid_global(nullptr, XVID_GBL_INIT, &init, nullptr) < 0) {
return false;
}
s_globalInitialized = true;
return true;
}
static void DestroySlot(XvidDecoderSlot& slot) {
if (slot.m_handle) {
xvid_decore(slot.m_handle, XVID_DEC_DESTROY, nullptr, nullptr);
slot.m_handle = nullptr;
}
}
int32_t InitializeDivxDecoder(int32_t decoder, int32_t width, int32_t height) {
if (!ValidSlot(decoder) || !GlobalInitialize()) {
return 1;
}
XvidDecoderSlot& slot = s_slots[decoder];
DestroySlot(slot);
xvid_dec_create_t create;
memset(&create, 0, sizeof(create));
create.version = XVID_VERSION;
create.width = width;
create.height = height;
if (xvid_decore(nullptr, XVID_DEC_CREATE, &create, nullptr) < 0) {
return 1;
}
slot.m_handle = create.handle;
slot.m_width = width;
slot.m_height = height;
return 0;
}
int32_t SetOutputFormat(int32_t decoder, int32_t format, int32_t width, int32_t height) {
if (!ValidSlot(decoder) || !s_slots[decoder].m_handle) {
return 1;
}
s_slots[decoder].m_width = width;
s_slots[decoder].m_height = height;
return 0;
}
int32_t DivxDecode(int32_t decoder, DivxDecodeFrame* frame, int32_t flags) {
if (!ValidSlot(decoder) || !s_slots[decoder].m_handle || !frame) {
return 1;
}
XvidDecoderSlot& slot = s_slots[decoder];
xvid_dec_frame_t decode;
memset(&decode, 0, sizeof(decode));
decode.version = XVID_VERSION;
decode.general = XVID_LOWDELAY;
decode.bitstream = const_cast<void*>(frame->m_input);
decode.length = static_cast<int>(frame->m_inputSize);
if (frame->m_render && frame->m_output) {
decode.output.csp = XVID_CSP_BGRA | XVID_CSP_VFLIP;
decode.output.plane[0] = frame->m_output;
decode.output.stride[0] = slot.m_width * 4;
} else {
decode.output.csp = XVID_CSP_NULL;
}
if (xvid_decore(slot.m_handle, XVID_DEC_DECODE, &decode, nullptr) < 0) {
return 1;
}
return 0;
}
int32_t UnInitializeDivxDecoder(int32_t decoder) {
if (!ValidSlot(decoder) || !s_slots[decoder].m_handle) {
return 1;
}
DestroySlot(s_slots[decoder]);
return 0;
}