Setting entity.graphics_variation above 256 does not give any error

This subforum contains all the issues which we already resolved.
Post Reply
Boodals
Long Handed Inserter
Long Handed Inserter
Posts: 89
Joined: Sun Feb 11, 2018 7:10 pm
Contact:

Setting entity.graphics_variation above 256 does not give any error

Post by Boodals » Sun Sep 23, 2018 7:20 pm

Title.

Image
(not that you really need the proof)

According to Bilka on Discord: "it checks the bounds on an uint16", but it seems to be cast to a uint8 (which matches what the API says). Setting entity.graphics_variation to a value above 256 appears to set the variation to X % 256, I expect because of the casting losing the higher byte.
Again, according to Bilka, "this was done because of this bug report", and "theoretically you can load a range of uint32 variations". Seems like the whole thing is pretty inconsistent..

Additionally, there are no errors when creating a prototype with more than 256 graphics variations.

Edit: Found a related CTD:
If I have exactly 256 graphics variations, I get a crash when trying to create the entity.

Code: Select all

 111.593 Error CrashHandler.cpp:373: Exception Code: c0000094, Address: 0x00007ff744e6068f
ModuleBase: 0x00007ff744c60000, ImageSize: 013d9000, RelativeAddress: 0020068f
 111.593 Error CrashHandler.cpp:393: Exception Context:
rax=00000000556baf55, rbx=000002ddfc503cd0, rcx=0000000000000000,
rdx=0000000000000000, rsi=000002dcd29bc700, rdi=000002ddfc503cd0,
rip=00007ff744e6068f, rsp=000000f168d1e8f0, rbp=00007ff745b15ce8,
 r8=00000000556baf55,  r9=000002dca2736050, r10=0000000058c51fcf,
r11=0000000000000100, r12=0000000000000000, r13=000000007fffffff,
r14=000000007fffffff, r15=0000000000000000
 111.593 Crashed in E:\Steam Games\steamapps\common\Factorio\bin\x64\Factorio.exe (0x00007ff744c60000 - 0x00007ff746039000)
Factorio crashed. Generating symbolized stacktrace, please wait ...
c:\cygwin64\tmp\factorio-build-rlyqnq\libraries\stackwalker\stackwalker.cpp (924): StackWalker::ShowCallstack
c:\cygwin64\tmp\factorio-build-rlyqnq\src\util\logger.cpp (408): Logger::writeStacktrace
c:\cygwin64\tmp\factorio-build-rlyqnq\src\util\logger.cpp (521): Logger::logStacktrace
c:\cygwin64\tmp\factorio-build-rlyqnq\src\util\crashhandler.cpp (169): CrashHandler::writeStackTrace
c:\cygwin64\tmp\factorio-build-rlyqnq\src\util\crashhandler.cpp (420): CrashHandler::SehHandler
ERROR: SymGetLineFromAddr64, GetLastError: 487 (Address: 00007FFE137595C0)
00007FFE137595C0 (KERNELBASE): (filename not available): UnhandledExceptionFilter
ERROR: SymGetLineFromAddr64, GetLastError: 487 (Address: 00007FFE16EE884F)
00007FFE16EE884F (ntdll): (filename not available): memset
ERROR: SymGetLineFromAddr64, GetLastError: 487 (Address: 00007FFE16ED1146)
00007FFE16ED1146 (ntdll): (filename not available): _C_specific_handler
ERROR: SymGetLineFromAddr64, GetLastError: 487 (Address: 00007FFE16EE4E6D)
00007FFE16EE4E6D (ntdll): (filename not available): _chkstk
ERROR: SymGetLineFromAddr64, GetLastError: 487 (Address: 00007FFE16E66058)
00007FFE16E66058 (ntdll): (filename not available): RtlWalkFrameChain
ERROR: SymGetLineFromAddr64, GetLastError: 487 (Address: 00007FFE16EE3D9E)
00007FFE16EE3D9E (ntdll): (filename not available): KiUserExceptionDispatcher
c:\cygwin64\tmp\factorio-build-rlyqnq\src\entity\simpleentitywithowner.cpp (28): SimpleEntityWithOwner::SimpleEntityWithOwner
c:\cygwin64\tmp\factorio-build-rlyqnq\src\entity\simpleentitywithownerprototype.cpp (22): SimpleEntityWithOwnerPrototype::createInternal
c:\cygwin64\tmp\factorio-build-rlyqnq\src\entity\entityprototype.cpp (503): EntityPrototype::create
c:\cygwin64\tmp\factorio-build-rlyqnq\src\util\luahelper.cpp (2277): LuaHelper::createEntity
c:\cygwin64\tmp\factorio-build-rlyqnq\src\script\luasurface.cpp (1280): LuaSurface::luaCreateEntity
c:\cygwin64\tmp\factorio-build-rlyqnq\src\script\luabinder.hpp (326): LuaBinder<LuaLogisticPoint>::callWrapper
c:\cygwin64\tmp\factorio-build-rlyqnq\libraries\lua\ldo.c (319): luaD_precall
c:\cygwin64\tmp\factorio-build-rlyqnq\libraries\lua\lvm.c (710): luaV_execute
c:\cygwin64\tmp\factorio-build-rlyqnq\libraries\lua\lapi.c (1018): f_call
c:\cygwin64\tmp\factorio-build-rlyqnq\libraries\lua\ldo.c (131): luaD_rawrunprotected
c:\cygwin64\tmp\factorio-build-rlyqnq\libraries\lua\ldo.c (590): luaD_pcall
c:\cygwin64\tmp\factorio-build-rlyqnq\src\script\luagamescript.cpp (4362): LuaGameScript::signallingPCall
c:\cygwin64\tmp\factorio-build-rlyqnq\src\script\luagamescript.cpp (771): LuaGameScript::runEventHandler
c:\cygwin64\tmp\factorio-build-rlyqnq\src\script\luaeventdispatcher.cpp (485): LuaEventDispatcher::run<InputAction>
c:\cygwin64\tmp\factorio-build-rlyqnq\src\script\luacontext.cpp (167): LuaContext::actionPerformed
c:\cygwin64\tmp\factorio-build-rlyqnq\src\input\inputhandler.cpp (56): InputHandler::flushActions
c:\cygwin64\tmp\factorio-build-rlyqnq\src\gameactionhandler.cpp (309): GameActionHandler::update
c:\cygwin64\tmp\factorio-build-rlyqnq\src\mainloop.cpp (1001): MainLoop::gameUpdateStep
c:\cygwin64\tmp\factorio-build-rlyqnq\src\mainloop.cpp (874): MainLoop::gameUpdateLoop
c:\cygwin64\tmp\factorio-build-rlyqnq\src\util\workerthread.cpp (36): WorkerThread::loop
c:\program files (x86)\microsoft visual studio\2017\buildtools\vc\tools\msvc\14.12.25827\include\thr\xthread (232): std::_LaunchPad<std::unique_ptr<std::tuple<void (__cdecl RouterBase::*)(void) __ptr64,ServerRouter * __ptr64>,std::default_delete<std::tuple<void (__cdecl RouterBase::*)(void) __ptr64,ServerRouter * __ptr64> > > >::_Go
c:\program files (x86)\microsoft visual studio\2017\buildtools\vc\tools\msvc\14.12.25827\include\thr\xthread (211): std::_Pad::_Call_func
d:\th\minkernel\crts\ucrt\src\appcrt\startup\thread.cpp (115): thread_start<unsigned int (__cdecl*)(void * __ptr64)>
ERROR: SymGetLineFromAddr64, GetLastError: 487 (Address: 00007FFE16311FE4)
00007FFE16311FE4 (KERNEL32): (filename not available): BaseThreadInitThunk
ERROR: SymGetLineFromAddr64, GetLastError: 487 (Address: 00007FFE16EACB31)
00007FFE16EACB31 (ntdll): (filename not available): RtlUserThreadStart
Stack trace logging done
 112.634 Error CrashHandler.cpp:174: Map tick at moment of crash: 118
 112.634 Error Util.cpp:67: Unexpected error occurred. If you're running the latest version of the game you can help us solve the problem by posting the contents of the log file on the Factorio forums.
Please also include the save file(s), any mods you may be using, and any steps you know of to reproduce the crash.

Rseding91
Factorio Staff
Factorio Staff
Posts: 9473
Joined: Wed Jun 11, 2014 5:23 am
Contact:

Re: Setting entity.graphics_variation above 256 does not give any error

Post by Rseding91 » Wed Sep 26, 2018 1:30 am

Thanks for the report. It's now fixed for 0.17.
If you want to get ahold of me I'm almost always on Discord.

Post Reply

Return to “Resolved Problems and Bugs”

Who is online

Users browsing this forum: No registered users