https://github.com/armoha/eudplib/blob/f10e069e0008afa3d473b673c4078b6d8765d105/src/eudplib/eudlib/wireframe/wireframe.py#L167
class InitialWireframe:
@classmethod
def init(cls):
ut.ep_assert(
not has_already_started(),
"Can't use EUDOnStart here. See https://cafe.naver.com/edac/69262",
)
if not cls._collected:
cls._collected = True
eud_onstart2(cls._init)
An assert statement in InitialWireframe.init() is too strict and placed before if statement, raising compile error on normal cases:
// example code
function foo() {
if (Is64BitWireframe()) {}
}
EUDOnStart(foo);
real world example: https://cafe.naver.com/edac/139300
def _SetEWaitCP(cp, val, *, _t=[]):
from eudplib.core.curpl import GetCPCache
cpcache = GetCPCache()
if not _t:
PushTriggerScope()
fend = Forward()
fstart = RawTrigger(
actions=[
SetMemoryX(fend + 388, SetTo, 0, 1),
SetMemoryX(fend + 2376, SetTo, 0, 0x10001),
SetMemoryX(fend + 2404, SetTo, 0, 0xFF000000),
cpcache.SetDest(EPD(0x6509B0)),
]
)
if ignore64:
if not InitialWireframe._collected:
InitialWireframe.init()
from eudplib.eudlib.wireframe.wireframe import is64bit
# InitialWireframe.init()가 EUDOnStart에서 실행되면 컴파일 오류 발생함... assert문 위치 문제
RawTrigger(
# conditions=Is64BitWireframe(),
conditions=is64bit.IsSet(),
actions=SetMemoryX(fend + 2404, SetTo, 2 << 24, 0xFF000000),
)
# .......
def init_resource_line(*, _t=[]):
if _t:
return
if ignore64:
# EUDOnStart2로 등록된 함수에서 또 EUDOnStart로 함수를 추가하는 건 금지돼있어서
# 컴파일 오류 방지를 위해 추가
InitialWireframe.init()
def _f():
SetEWait(0xD7DCD8, 0x80000000)
DoActions(SetMemoryXEPD(EPD(0x640B60-2+218*11), SetTo, 0x02020000, 0xFFFF0000))
_t.append(_f)
EUDOnStart(_f)
def f_displayResourceText(format_string, *args):
init_resource_line()
if EUDIf()(IsUserCP()):
f_sprintf(0x640B60 + 2 + 218 * 11, format_string, *args)
EUDEndIf()
init_resource_line calls EUDOnStart with function which calls _SetEWaitCP, where Is64BitWireframe() raises compile error.
https://github.com/armoha/eudplib/blob/f10e069e0008afa3d473b673c4078b6d8765d105/src/eudplib/eudlib/wireframe/wireframe.py#L167
An assert statement in
InitialWireframe.init()is too strict and placed before if statement, raising compile error on normal cases:real world example: https://cafe.naver.com/edac/139300
init_resource_linecallsEUDOnStartwith function which calls_SetEWaitCP, whereIs64BitWireframe()raises compile error.