diff --git a/game_compatibility.md b/game_compatibility.md index 7aad3ad..84b44a0 100644 --- a/game_compatibility.md +++ b/game_compatibility.md @@ -55,7 +55,7 @@ Game Compatibility | Rance 5D - The Lonely Girl (MangaGamer) | Supported | | | 俺の下であがけ | Unknown | | | 楽園行 | Unknown | | -| 妻みぐい2 | Supported | Opening demo is not supported | +| 妻みぐい2 | Supported | | | シェル・クレイル | Supported | | | ナイトデーモン | Supported | | | 学園KING | Supported | From アリスCD | diff --git a/modules/tDemo/tDemo.c b/modules/tDemo/tDemo.c index 2dfe750..c127e9c 100644 --- a/modules/tDemo/tDemo.c +++ b/modules/tDemo/tDemo.c @@ -1,3 +1,23 @@ +/* + * Copyright (C) 1997-1998 Masaki Chikama (Wren) + * 1998- + * 2024 kichikuou + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * +*/ #include "config.h" #include @@ -7,6 +27,16 @@ #include "xsystem35.h" #include "modules.h" #include "nact.h" +#include "alk.h" +#include "input.h" +#include "bgm.h" +#include "sdl_core.h" +#include "ngraph.h" +#include "cg.h" +#include "jpeg.h" + +#define TDEMO_MUSIC_NO 1 +#define FPS 30 static void Init() { int p1 = getCaliValue(); @@ -16,7 +46,7 @@ static void Init() { *var = 1; - DEBUG_COMMAND_YET("tDemo.Init %d,%d,%d,%p:", p1, p2, p3, var); + DEBUG_COMMAND("tDemo.Init %d,%d,%d,%p:", p1, p2, p3, var); } static void SetKeyCancelFlag() { @@ -33,7 +63,46 @@ static void SetLoopFlag() { } static void Run() { - DEBUG_COMMAND_YET("tDemo.Run:"); + alk_t *alk = alk_new("tDEMO.alk"); + if (!alk) { + WARNING("Cannot open tDEMO.alk"); + return; + } + + while (sys_getInputInfo()); // wait for key up + + musbgm_play(TDEMO_MUSIC_NO, 0, 100); + + uint32_t start = sdl_getTicks(); + while (!nact->is_quit) { + int i = (sdl_getTicks() - start) / (1000 / FPS); + if (i >= alk->datanum) + break; + + cgdata *cg = jpeg_extract(alk->entries[i].data, alk->entries[i].size); + if (cg) { + gr_drawimage24(sf0, cg, 0, 0); + ags_updateFull(); + cgdata_free(cg); + } else { + WARNING("Cannot decode CG %d", i); + } + + int wait_ms = (i + 1) * (1000 / FPS) - (sdl_getTicks() - start); + if (wait_ms > 0) { + if (sys_keywait(wait_ms, KEYWAIT_CANCELABLE)) + break; + } else { + if (sys_getInputInfo()) + break; + } + } + + musbgm_stop(TDEMO_MUSIC_NO, 0); + + alk_free(alk); + + DEBUG_COMMAND("tDemo.Run:"); } static const ModuleFunc functions[] = {