suzukiplan / tohovgs-pico

東方VGS実機版
GNU General Public License v3.0
0 stars 0 forks source link

vgssdk-pico対応 #14

Closed suzukiplan closed 1 year ago

suzukiplan commented 1 year ago

vgssdk-pico へ対応することでパソコン(Mac or Linux)でシミュレータによる東方VGS実機版のデバッグに対応する。

suzukiplan commented 1 year ago

Linux でリンクが通らず原因を調査中...

g++ -o app vgssdk_sdl2.o lz4.o rom_bgm.o rom_k8x12S_jisx0201.o rom_k8x12S_jisx0208.o rom_small_font.o rom_songlist.o vgstone.o app.o -L/usr/local/lib -lSDL2
/usr/bin/ld: app.o:(.data.rel.ro._ZTI12TopBoardView[_ZTI12TopBoardView]+0x10): undefined reference to `typeinfo for View'
/usr/bin/ld: app.o:(.data.rel.ro._ZTI12KeyboardView[_ZTI12KeyboardView]+0x10): undefined reference to `typeinfo for View'
/usr/bin/ld: app.o:(.data.rel.ro._ZTI11SeekbarView[_ZTI11SeekbarView]+0x10): undefined reference to `typeinfo for View'
/usr/bin/ld: app.o:(.data.rel.ro._ZTI12SongListView[_ZTI12SongListView]+0x10): undefined reference to `typeinfo for View'
collect2: error: ld returned 1 exit status
make: *** [Makefile:23: all] Error 1

抽象クラス View の派生クラスで undefined reference to 'typeinfo for View' となっている :thinking:

suzukiplan commented 1 year ago

単純なお行儀の問題(virtual なメソッドを純粋な abstract 関数とするには 0 を代入する必要がある)

diff --git a/src/app.cpp b/src/app.cpp
index 0d847fa..4cd8b57 100644
--- a/src/app.cpp
+++ b/src/app.cpp
@@ -146,9 +146,9 @@ class View
         pos.h = h;
     }

-    virtual void onTouchStart(int tx, int ty);
-    virtual void onTouchMove(int tx, int ty);
-    virtual void onTouchEnd(int tx, int ty);
+    virtual void onTouchStart(int tx, int ty) = 0;
+    virtual void onTouchMove(int tx, int ty) = 0;
+    virtual void onTouchEnd(int tx, int ty) = 0;
 };
suzukiplan commented 1 year ago

ひとまずコンパイルは通ったが描画が微妙にうまく行っていない(viewport関連がバグっていそう)

Screenshot from 2023-09-30 12-19-56

suzukiplan commented 1 year ago

lineH, lineV は width, height を指定する仕様だったのでその修正で表示はうまくいくようになった

Screenshot from 2023-09-30 15-20-28

suzukiplan commented 1 year ago

実機向けにビルドしてみたところ vgs_setup or setup 内でハングアップしている模様(画面描画は正常にされているが、本体LEDが点灯したまま消灯しない状態)

suzukiplan commented 1 year ago

commit https://github.com/suzukiplan/tohovgs-pico/pull/14/commits/8e1970d724735744337c65e8cd13a21a4e431ee2 でとりあえずハングアップしなくなり、タッチ操作ができる。

ただし、まだ色々と不完全な状態で、以下のような現象を確認している

suzukiplan commented 1 year ago

simulator (SDL2/Linux) は問題なく動作しているので TFT_eSPI の使い方の問題だと思われる

suzukiplan commented 1 year ago

commit https://github.com/suzukiplan/tohovgs-pico/pull/14/commits/41b72eb713f037b08e0dec35c645139f52a8caed で実機でも正常に動作するようになった。 VGSDEcoder は 108KB の大きなバッファを確保している関係で、ヒープ領域の上限サイズを超えていたことが原因だと考えられる(なので、スタティック領域に移すことで治った)。

suzukiplan commented 1 year ago

あとはmacOSで正常に動いたらマージしても良さそう