Skip to content

Commit

Permalink
Fixes non-touch UserImages issue
Browse files Browse the repository at this point in the history
- fixed wrong frame count when scanning GCI
  • Loading branch information
cruzjuniel committed Jan 25, 2024
1 parent 3422278 commit 109610a
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 4 deletions.
10 changes: 8 additions & 2 deletions src/gfx4desp32.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1536,9 +1536,11 @@ void gfx4desp32::_Open4dGFX(String file4d, bool scan) {
tuih[n] = (GCIread() << 8) + GCIread();
if (!(scan))
cdv[n] = GCIread();
GCIread(); // dummy read to move pointer
if (!(scan))
int frms = GCIread();
if (!(scan)) gciobjframes[n] = 0;
if (frms != 0 && !(scan)) {
gciobjframes[n] = (GCIread() << 8) + GCIread();
}
}
}

Expand Down Expand Up @@ -2013,6 +2015,10 @@ void gfx4desp32::UserImages(uint16_t uisnb, int16_t framenb) {
if (framenb > (gciobjframes[uisnb] - 1) || framenb < 0) {
outofrange(tuix[uisnb], tuiy[uisnb], tuiw[uisnb], tuih[uisnb]);
}
else {
DrawWidget(tuiIndex[uisnb], tuix[uisnb], tuiy[uisnb], tuiw[uisnb], tuih[uisnb], framenb, 0,
true, cdv[uisnb]);
}
ScrollEnable(setemp);
}

Expand Down
6 changes: 4 additions & 2 deletions src/gfx4desp32_touch.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -241,9 +241,11 @@ void gfx4desp32_touch::_Open4dGFX(String file4d, bool scan) {
tuih[n] = (GCIread() << 8) + GCIread();
if (!(scan))
cdv[n] = GCIread();
/*int coldepth = */GCIread();
if (!(scan))
int frms = GCIread();
if (!(scan)) gciobjframes[n] = 0;
if (frms != 0 && !(scan)) {
gciobjframes[n] = (GCIread() << 8) + GCIread();
}
}
}

Expand Down

0 comments on commit 109610a

Please sign in to comment.