Repository navigation
Conversation
dayfine
left a comment
There was a problem hiding this comment.
Reviewed SHA: c43d9e9
Verdict
NEEDS_REWORK
First-pass review (agent), own diff against plza/upstream/s1-05, at the infra bar (CommonTools). Code health job passes; CI at review time: build/no-tabs pass, Fork Draft CI ubuntu / build pending. Files are CRLF; the watcher uses the Mutex/LockGuard wrappers and atomics correctly for one inference thread plus readers. I checked fade_of_screen on an empty frame: image_stats gives NaN averages, so it reads NONE, not black - fine.
High
- Nothing implements
ScreenEventObserverand nothing outside tests constructs aScreenEventWatcher, here or anywhere up to the chain tip (944abe8; the only non-test mention isPokemon_ScreenObservation.h, which bridges it). Infra with no implementer is the hardest kind to review: whether the eleven events, the observer'snowparameter and the 256-change log are the right shape can only be judged against a real game's detectors. Name the PR that adds the first observer (PLZA?) in the description, or land this with it.
Medium
- Game vocabulary in a shared module (T9):
ScreenEventTypes.h/ScreenFades.hare inCommonToolsbut speak Pokemon tile games and the Switch -WarpFade("warp"), "a cave exit's white, with no battle after it", "a cave mouth's dim fade", "a dim cave floor (mean about 46 a channel)",LOCATION_BANNER("an observer given an expected map reports only that map's"),SWITCH_HOME_MENU(a console concept in a console-agnostic folder). Either keep the generic part here (fade black/white, dialog/choice box, screen still) with neutral names (ScreenFade, "a screen-wide fade"), and move the rest toPokemon/orNintendoSwitch/, or say in the header why a closed, shared enum is the intended design (every new game's event means editing CommonTools). ScreenEventsreimplementsstd::bitset<SCREEN_EVENT_COUNT>(has,set(event, bool),merge,bits,from_bits), plus a hand-keptSCREEN_EVENT_COUNT = 11with astatic_assert. A thin wrapper overstd::bitset(or at leastset/resetinstead ofset(event, bool on), a bool parameter per TotW #94) would be less to review. Ifuint32_tis needed for the atomics, say so on the class.ScreenEvents.cppdefines the functions of four headers (ScreenEventTypes.h,ScreenFades.h,ScreenEventLog.h,ScreenEvents.h). For infra, one .cpp per header so each piece's dependencies are visible (the fade code pullsImageStats/SolidColorTestinto the log's translation unit).
Low
ScreenEventWatcher::reset()clearsm_seen,m_stopped_onand the log in three separate steps; a frame processed in between leaves them inconsistent. Fine ifreset()is only called between actions - say so in its comment.ScreenEventObserver::observe(frame, now): the watcher always passesframe.timestampasnow, and the comment says "the caller's clock". If observers should always use the frame's time, drop the parameter; otherwise say when they differ.ScreenEventLog(size_t capacity = SCREEN_EVENT_LOG_CAPACITY)and the "a minute or more of a busy scene" estimate: fine, butrecord()documents "nowmust not go back in time" without checking it; oneif(or a note that callers own it).ScreenEvents_Tests.cppexpect_equalis the same helper asPokemon_TestExpect.hlater in the chain (#537); one of them should go when the chain settles (CommonTools cannot include Pokemon, so the shared one belongs here or inCommon/Cpp/TestRunners).
No brace-style, tabs, Qt, std::filesystem or raw-thread issues; SourceFiles.cmake lists every new file.
|
Review fixes, tip 1: the description now names the first observer, PLZA's, in the PLZA program PR (batch 2). |
Depends on #533
Adds CommonTools/ScreenEvents: what the screen shows (a fade, a location banner, a dialogue box, a battle starting) as events every game shares, with their timed log and fade reading. Each game implements ScreenEventObserver with its own detectors (the first is PLZA's; Used by the PLZA program PR (batch 2)), and the judgements built on these events are the same for all of them. Tests: the ScreenEvents suite (synthetic frames), built and run by Fork Draft CI. Part of the re-split of #522/#524/#525 into reviewable steps; review fixes are new commits on the PR that owns each problem, merged up the chain.