WJ_ENABLE_OPTIONAL_SOUND_SCRIPT_SYSERR_FIX

Kayıtlı
1 Yıl 9 Ay 11 Gün
Katılım
10 Ocak 2025
Konular
5
Mesajlar
21
Tepkime puanı
16
Online süresi
3h 25m
Puan
13
Konum
Türkiye
Web sitesi
www.zyncra.shop
Kısaca ne işe yaradığını yazayım, konuya bakanlar için. Client bir hareket ya da efekt yüklerken aynı isimde bir ses dosyası arıyor, çoğunun ses dosyası olmadığı için bulamayınca syserr basıyor. Bu düzeltme önce dosyanın pack te olup olmadığına bakıyor, varsa yüklüyor, böylece syserr deki o satırlar gidiyor.

Kodlar GameLib/RaceMotionData.cpp içindeki LoadMotionData ve EffectLib/EffectData.cpp içindeki LoadScript fonksiyonlarında. Fonksiyonun tamamını değiştirmek yerine sadece LoadSoundScriptData satırını bulup define içindeki halini koymanız yeterli, kendi dosyanızdaki başka eklemeleri kaybetmeyin.

Define konudaki gibi sadece bir dosyanın başına yazılırsa EffectData.cpp tarafı çalışmaz. Locale_inc.h içine ekleyin:
Kod:
#define WJ_ENABLE_OPTIONAL_SOUND_SCRIPT_SYSERR_FIX

Tek yan etkisi, gerçekten olması gereken bir ses dosyası eksikse bunu artık syserr de görmezsiniz.

İyi forumlar.


C++:
#define WJ_ENABLE_OPTIONAL_SOUND_SCRIPT_SYSERR_FIX


#ifdef WJ_ENABLE_OPTIONAL_SOUND_SCRIPT_SYSERR_FIX
#include "../EterPack/EterPackManager.h"
#endif



bool CRaceMotionData::LoadMotionData(const char * c_szFileName)
{
    const float c_fFrameTime = 1.0f / g_fGameFPS;

    CTextFileLoader* pkTextFileLoader=CTextFileLoader::Cache(c_szFileName);
    if (!pkTextFileLoader)
        return false;

    CTextFileLoader& rkTextFileLoader=*pkTextFileLoader;

    if (rkTextFileLoader.IsEmpty())
        return false;

    rkTextFileLoader.SetTop();

    if (!rkTextFileLoader.GetTokenString("motionfilename", &m_strMotionFileName))
        return false;

    if (!rkTextFileLoader.GetTokenFloat("motionduration", &m_fMotionDuration))
        return false;

    CTokenVector * pTokenVector;

    if (rkTextFileLoader.GetTokenVector("accumulation", &pTokenVector))
    {
        if (pTokenVector->size() != 3)
        {
            TraceError("CRaceMotioNData::LoadMotionData : syntax error on accumulation, vector size %d", pTokenVector->size());
            return false;
        }

        TPixelPosition pos(atof(pTokenVector->at(0).c_str()),
                           atof(pTokenVector->at(1).c_str()),
                           atof(pTokenVector->at(2).c_str()));

        SetAccumulationPosition(pos);
    }

    std::string strNodeName;
    for (DWORD i = 0; i < rkTextFileLoader.GetChildNodeCount(); ++i)
    {
        CTextFileLoader::CGotoChild GotoChild(&rkTextFileLoader, i);

        rkTextFileLoader.GetCurrentNodeName(&strNodeName);

        if (0 == strNodeName.compare("comboinputdata"))
        {
            m_isComboMotion = TRUE;

            if (!rkTextFileLoader.GetTokenFloat("preinputtime", &m_ComboInputData.fInputStartTime))
                return false;
            if (!rkTextFileLoader.GetTokenFloat("directinputtime", &m_ComboInputData.fNextComboTime))
                return false;
            if (!rkTextFileLoader.GetTokenFloat("inputlimittime", &m_ComboInputData.fInputEndTime))
                return false;
        }
        else if (0 == strNodeName.compare("attackingdata"))
        {
            m_isAttackingMotion = TRUE;

            if (!NRaceData::LoadMotionAttackData(rkTextFileLoader, &m_MotionAttackData))
                return false;
        }
        else if (0 == strNodeName.compare("loopdata"))
        {
            m_isLoopMotion = TRUE;
            if (!rkTextFileLoader.GetTokenInteger("motionloopcount", &m_iLoopCount))
            {
                m_iLoopCount = -1;
            }
            if (!rkTextFileLoader.GetTokenInteger("loopcancelenable", &m_bCancelEnableSkill))
            {
                m_bCancelEnableSkill = FALSE;
            }
            if (!rkTextFileLoader.GetTokenFloat("loopstarttime", &m_fLoopStartTime))
                return false;
            if (!rkTextFileLoader.GetTokenFloat("loopendtime", &m_fLoopEndTime))
                return false;
        }
        else if (0 == strNodeName.compare("motioneventdata"))
        {
            DWORD dwMotionEventDataCount;

            if (!rkTextFileLoader.GetTokenDoubleWord("motioneventdatacount", &dwMotionEventDataCount))
                continue;

            stl_wipe(m_MotionEventDataVector);

            m_MotionEventDataVector.resize(dwMotionEventDataCount, NULL);

            for (DWORD j = 0; j < m_MotionEventDataVector.size(); ++j)
            {
                if (!rkTextFileLoader.SetChildNode("event", j))
                    return false;

                int iType;
                if (!rkTextFileLoader.GetTokenInteger("motioneventtype", &iType))
                    return false;

                TMotionEventData * pData = NULL;
                switch (iType)
                {
                    case MOTION_EVENT_TYPE_FLY:
                        pData = new TMotionFlyEventData;
                        break;
                    case MOTION_EVENT_TYPE_EFFECT:
                        pData = new TMotionEffectEventData;
                        break;
                    case MOTION_EVENT_TYPE_SCREEN_WAVING:
                        pData = new TScreenWavingEventData;
                        break;
                    case MOTION_EVENT_TYPE_SPECIAL_ATTACKING:
                        pData = new TMotionAttackingEventData;
                        m_hasSplashEvent = TRUE;
                        break;
                    case MOTION_EVENT_TYPE_SOUND:
                        pData = new TMotionSoundEventData;
                        break;
                    case MOTION_EVENT_TYPE_CHARACTER_SHOW:
                        pData = new TMotionCharacterShowEventData;
                        break;
                    case MOTION_EVENT_TYPE_CHARACTER_HIDE:
                        pData = new TMotionCharacterHideEventData;
                        break;
                    case MOTION_EVENT_TYPE_WARP:
                        pData = new TMotionWarpEventData;
                        break;
                    case MOTION_EVENT_TYPE_EFFECT_TO_TARGET:
                        pData = new TMotionEffectToTargetEventData;
                        break;
                    default:
                        assert(!" CRaceMotionData::LoadMotionData - Strange Event Type");
                        return false;
                        break;
                }
                m_MotionEventDataVector[j] = pData;
                m_MotionEventDataVector[j]->Load(rkTextFileLoader);
                m_MotionEventDataVector[j]->iType = iType;
                if (!rkTextFileLoader.GetTokenFloat("startingtime", &m_MotionEventDataVector[j]->fStartingTime))
                    return false;

                m_MotionEventDataVector[j]->dwFrame = (m_MotionEventDataVector[j]->fStartingTime / c_fFrameTime);

                rkTextFileLoader.SetParentNode();
            }
        }
    }

    std::string strSoundFileNameTemp=c_szFileName;
    strSoundFileNameTemp = CFileNameHelper::NoExtension(strSoundFileNameTemp);
    strSoundFileNameTemp+= ".mss";

    if (strSoundFileNameTemp.length() > 13)
    {
        const char * c_szHeader = &strSoundFileNameTemp[13];

        m_strSoundScriptDataFileName = "sound/";
        m_strSoundScriptDataFileName += c_szHeader;

#ifdef WJ_ENABLE_OPTIONAL_SOUND_SCRIPT_SYSERR_FIX
        if (CEterPackManager::Instance().isExist(m_strSoundScriptDataFileName.c_str()))
            LoadSoundScriptData(m_strSoundScriptDataFileName.c_str());
#else
        LoadSoundScriptData(m_strSoundScriptDataFileName.c_str());
#endif
    }

    return true;
}




#ifdef WJ_ENABLE_OPTIONAL_SOUND_SCRIPT_SYSERR_FIX
#include "../EterPack/EterPackManager.h"
#endif
bool CEffectData::LoadScript(const char * c_szFileName)
{
    m_strFileName = c_szFileName;
    CFileNameHelper::StringPath(m_strFileName);

    CTextFileLoader TextFileLoader;
    if (!TextFileLoader.Load(c_szFileName))
        return false;

    TextFileLoader.SetTop();

    if (!TextFileLoader.GetTokenFloat("boundingsphereradius", &m_fBoundingSphereRadius))
    {
        m_fBoundingSphereRadius = 0.0f;
    }

    if (!TextFileLoader.GetTokenVector3("boundingsphereposition", &m_v3BoundingSpherePosition))
    {
        m_v3BoundingSpherePosition.x = m_v3BoundingSpherePosition.y = m_v3BoundingSpherePosition.z = 0.0f;
    }

    for (DWORD i = 0; i < TextFileLoader.GetChildNodeCount(); ++i)
    {
        if (!TextFileLoader.SetChildNode(i))
            continue;

        std::string strName;

        if (!TextFileLoader.GetCurrentNodeName(&strName))
            continue;

        if (0 == strName.compare("mesh"))
        {
            CEffectMeshScript * pMesh = AllocMesh();
            pMesh->Clear();
            pMesh->LoadScript(TextFileLoader);
        }
        else if (0 == strName.compare("particle"))
        {
            CParticleSystemData * pParticleSystemData = AllocParticle();
            pParticleSystemData->Clear();
            pParticleSystemData->LoadScript(TextFileLoader);
        }

        TextFileLoader.SetParentNode();
    }

    std::string strPathHeader = "d:/ymir work/";
    std::string strNoExtensionName = CFileNameHelper::NoExtension(m_strFileName);
    int iPos = strNoExtensionName.find(strPathHeader.c_str());
    if (iPos >= 0)
        if (strNoExtensionName.size() > strPathHeader.size())
        {
            std::string strSoundFileName;
            strSoundFileName = "sound/";
            strSoundFileName += &strNoExtensionName[strPathHeader.size()];
            strSoundFileName += ".mss";

#ifdef WJ_ENABLE_OPTIONAL_SOUND_SCRIPT_SYSERR_FIX
            if (CEterPackManager::Instance().isExist(strSoundFileName.c_str()))
                LoadSoundScriptData(strSoundFileName.c_str());
#else
            LoadSoundScriptData(strSoundFileName.c_str());
#endif
        }

    return true;
}
 
Geri
Üst