0
\$\begingroup\$

I'm using cocos2d-x on windows10 UWP project. I use the SimpleAudioEngine to load the music:

CocosDenshion::SimpleAudioEngine::getInstance()->playBackgroundMusic("level_music1.wav",true);

On the close button handler I use the end method: CocosDenshion::SimpleAudioEngine::getInstance()->end;

When I run the debugger a second time I get these exceptions:

Exception thrown at 0x765F3E28 (KernelBase.dll) in MiniGolf.exe: 0x000006BA: The RPC server is unavailable. Exception thrown at 0x765F3E28 (KernelBase.dll) in MiniGolf.exe: 0x0000000E: Not enough storage is available to complete this operation. Assert failed: getFileSize should be override by platform FileUtils Assertion failed!

only if I rename the file to say like "level_music.wav" it works again but failed again the second time so I have to constantly rename it to work.

\$\endgroup\$
1
\$\begingroup\$

this is an old bug which is fixed in cocos2d-x 3.10 and you can read more about it in here:

the bug is caused by a missing getFileSize() method implementation in the winrt file.

to fixe the bug just download the last version of cocos2d-x or add the fixe code manually by yourself by going to cocos2d\cocos\platform\winrt then open up CCFileUtilsWinRT.h and add this method signature to CCFileUtilsWinRT class in the public section:

virtual long getFileSize(const std::string &filepath);

then in the same directery open up CCFileUtilsWinRT.cpp and add the method implementation like this:

long CCFileUtilsWinRT::getFileSize(const std::string &filepath)
{
    WIN32_FILE_ATTRIBUTE_DATA fad;
    if (!GetFileAttributesEx(StringUtf8ToWideChar(filepath).c_str(), GetFileExInfoStandard, &fad))
    {
        return 0; // error condition, could call GetLastError to find out more
    }
    LARGE_INTEGER size;
    size.HighPart = fad.nFileSizeHigh;
    size.LowPart = fad.nFileSizeLow;
    return (long)size.QuadPart;
}
| improve this answer | |
\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.