Howdy, Stranger!

It looks like you're new here. Sign in or register to get started.

If you have any questions, reports, suggestions, or requests about Live2D, please send them to this forum.
※We cannot guarantee statements or answers from Live2D staff. Thank you for your understanding in advance.
 
Live2D Cubism
Cubism Products and Downloads
Cubism product manuals and tutorials
Cubism Editor Manual    Cubism Editor Tutorial    Cubism SDK Manual    Cubism SDK Tutorial
[Notice of Holidays]
Please note that our staff will not be available from 2024/Dec/28 - 2025/Jan/5 JST.
The Live2D Creators Forum will remain open during the holidays.
Submissions that require a response will be answered after we reopen for business.
Please note that it will take longer than usual to respond to your request.

Can cause csmReviveMocInPlace return nullptr when I use csmGetSizeofModel?

edited July 2023 in Help
#include
#include
#include

int main(int argc,char ** argv)
{
for(auto i=0;i<100000;i++)
{
auto file = fopen("../../../CubismSDK/Core/Haru/Haru.moc3", "rb");
fseek(file, 0, SEEK_END);
auto len = ftell(file);
fseek(file, 0, SEEK_SET);
auto data = std::vector<uint8_t>(len);
auto readLen = fread(data.data(), sizeof(uint8_t), len, file);
if (len != readLen)
{
printf("No!");
}

auto moc = csmReviveMocInPlace(data.data(), len);
if (!moc)
{
printf("moc is nullptr!");
}

auto modelSize = csmGetSizeofModel(moc);

printf("%d\n", i);
fclose(file);
}
}

--------------------------------------------------------------------
I run my example.Not add csmGetSizeofModel's function can work.But I add csmGetSizeofModel will csmReviveMocInPlace return null and print my log "moc is nullptr!".

Comments

Sign In or Register to comment.