From 9a1f1c77a642c627e38b9eb2a38336df3b3f088b Mon Sep 17 00:00:00 2001 From: kichikuou Date: Thu, 4 Jun 2020 19:11:29 +0900 Subject: [PATCH] Static link DLL modules We only support a fixed set of modules, so dynamic linking isn't really necessary. This paves the way for running System3.9 games on more platforms. NIGHTDLL is temporarily disabled, because many symbols conflict with the SACT module. --- CMakeLists.txt | 6 +- modules/AliceLogo/AliceLogo.c | 14 +- modules/AliceLogo/CMakeLists.txt | 3 - modules/CMakeLists.txt | 114 ++++++-- modules/Confirm/CMakeLists.txt | 3 - modules/Confirm/Confirm.c | 18 +- modules/Gpx/CMakeLists.txt | 5 - modules/Gpx/Gpx.c | 166 +++++++---- modules/Math/CMakeLists.txt | 3 - modules/Math/Math.c | 18 +- modules/MsgSkip/CMakeLists.txt | 3 - modules/MsgSkip/MsgSkip.c | 29 +- modules/NIGHTDLL/CMakeLists.txt | 21 -- modules/NightDemonDemo/CMakeLists.txt | 9 - modules/NightDemonDemo/NightDemonDemo.c | 16 +- modules/RandMT/CMakeLists.txt | 3 - modules/RandMT/RandMT.c | 15 +- modules/SACT/CMakeLists.txt | 35 --- modules/SACT/SACT.c | 366 ++++++++++++++++-------- modules/ShArray/CMakeLists.txt | 3 - modules/ShArray/ShArray.c | 168 +++++++---- modules/ShCalc/CMakeLists.txt | 3 - modules/ShCalc/ShCalc.c | 75 +++-- modules/ShGraph/CMakeLists.txt | 3 - modules/ShGraph/ShGraph.c | 42 ++- modules/ShPort/CMakeLists.txt | 3 - modules/ShPort/ShPort.c | 32 ++- modules/ShSound/CMakeLists.txt | 6 - modules/ShSound/ShSound.c | 54 ++-- modules/ShString/CMakeLists.txt | 3 - modules/ShString/ShString.c | 36 ++- modules/dDemo/CMakeLists.txt | 5 - modules/dDemo/dDemo.c | 18 +- modules/eDemo/CMakeLists.txt | 3 - modules/eDemo/eDemo.c | 21 +- modules/eeDemo/CMakeLists.txt | 3 - modules/eeDemo/eeDemo.c | 18 +- modules/lib/CMakeLists.txt | 2 - modules/modules.c | 84 ++++++ modules/modules.h | 61 ++++ modules/nDEMO/CMakeLists.txt | 3 - modules/nDEMO/nDEMO.c | 17 +- modules/nDEMOE/CMakeLists.txt | 3 - modules/nDEMOE/nDEMOE.c | 14 +- modules/oDEMO/CMakeLists.txt | 3 - modules/oDEMO/oDEMO.c | 18 +- modules/oujimisc/CMakeLists.txt | 3 - modules/oujimisc/oujimisc.c | 42 ++- modules/tDemo/CMakeLists.txt | 3 - modules/tDemo/tDemo.c | 17 +- src/CMakeLists.txt | 13 - src/cmd2F60.c | 24 +- src/s39ain.c | 41 +-- src/s39ain.h | 5 +- 54 files changed, 1101 insertions(+), 595 deletions(-) delete mode 100644 modules/AliceLogo/CMakeLists.txt delete mode 100644 modules/Confirm/CMakeLists.txt delete mode 100644 modules/Gpx/CMakeLists.txt delete mode 100644 modules/Math/CMakeLists.txt delete mode 100644 modules/MsgSkip/CMakeLists.txt delete mode 100644 modules/NIGHTDLL/CMakeLists.txt delete mode 100644 modules/NightDemonDemo/CMakeLists.txt delete mode 100644 modules/RandMT/CMakeLists.txt delete mode 100644 modules/SACT/CMakeLists.txt delete mode 100644 modules/ShArray/CMakeLists.txt delete mode 100644 modules/ShCalc/CMakeLists.txt delete mode 100644 modules/ShGraph/CMakeLists.txt delete mode 100644 modules/ShPort/CMakeLists.txt delete mode 100644 modules/ShSound/CMakeLists.txt delete mode 100644 modules/ShString/CMakeLists.txt delete mode 100644 modules/dDemo/CMakeLists.txt delete mode 100644 modules/eDemo/CMakeLists.txt delete mode 100644 modules/eeDemo/CMakeLists.txt create mode 100644 modules/modules.c create mode 100644 modules/modules.h delete mode 100644 modules/nDEMO/CMakeLists.txt delete mode 100644 modules/nDEMOE/CMakeLists.txt delete mode 100644 modules/oDEMO/CMakeLists.txt delete mode 100644 modules/oujimisc/CMakeLists.txt delete mode 100644 modules/tDemo/CMakeLists.txt diff --git a/CMakeLists.txt b/CMakeLists.txt index 57d2e95..8d02430 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -50,10 +50,7 @@ else() TEST_BIG_ENDIAN(WORDS_BIGENDIAN) if (NOT DEFINED ENABLE_MODULES) - check_library_exists(dl dlopen "" ENABLE_MODULES) - endif() - if (ENABLE_MODULES) - link_libraries(dl) + set(ENABLE_MODULES 1) endif() find_package(ZLIB REQUIRED) @@ -269,4 +266,5 @@ endif() if (ENABLE_MODULES) add_subdirectory(modules) + target_link_libraries(xsystem35 PRIVATE modules) endif() diff --git a/modules/AliceLogo/AliceLogo.c b/modules/AliceLogo/AliceLogo.c index 01ddb4b..320e3c9 100644 --- a/modules/AliceLogo/AliceLogo.c +++ b/modules/AliceLogo/AliceLogo.c @@ -5,9 +5,10 @@ #include "portab.h" #include "system.h" #include "xsystem35.h" +#include "modules.h" #include "nact.h" -void Init() { +static void Init() { int p1 = getCaliValue(); /* ISys3x */ int p2 = getCaliValue(); /* IWinMsg */ int p3 = getCaliValue(); /* ITimer */ @@ -18,17 +19,24 @@ void Init() { DEBUG_COMMAND_YET("AliceLogo.Init %d,%d,%d,%p:\n", p1, p2, p3, var); } -void SetWaveNum() { +static void SetWaveNum() { int p1 = getCaliValue(); int p2 = getCaliValue(); DEBUG_COMMAND_YET("AliceLogo.SetWaveNum %d,%d:\n", p1, p2); } -void Run() { +static void Run() { int p1 = getCaliValue(); int p2 = getCaliValue(); DEBUG_COMMAND_YET("AliceLogo.Run %d,%d:\n", p1, p2); } +static const ModuleFunc functions[] = { + {"Init", Init}, + {"Run", Run}, + {"SetWaveNum", SetWaveNum}, +}; + +const Module module_AliceLogo = {"AliceLogo", functions, sizeof(functions) / sizeof(ModuleFunc)}; diff --git a/modules/AliceLogo/CMakeLists.txt b/modules/AliceLogo/CMakeLists.txt deleted file mode 100644 index 6305b8b..0000000 --- a/modules/AliceLogo/CMakeLists.txt +++ /dev/null @@ -1,3 +0,0 @@ -add_library(AliceLogo MODULE AliceLogo.c) - -install(TARGETS AliceLogo DESTINATION lib/xsystem35) diff --git a/modules/CMakeLists.txt b/modules/CMakeLists.txt index 606b7f1..28880e6 100644 --- a/modules/CMakeLists.txt +++ b/modules/CMakeLists.txt @@ -1,33 +1,89 @@ -set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}) - -if (APPLE) - add_link_options("SHELL:-undefined dynamic_lookup") -endif() - include_directories(${CMAKE_SOURCE_DIR}/src) add_subdirectory(lib) -add_subdirectory(AliceLogo) -add_subdirectory(Confirm) -add_subdirectory(Gpx) -add_subdirectory(Math) -add_subdirectory(MsgSkip) -add_subdirectory(NIGHTDLL) -add_subdirectory(NightDemonDemo) -add_subdirectory(RandMT) -add_subdirectory(SACT) -add_subdirectory(ShArray) -add_subdirectory(ShCalc) -add_subdirectory(ShGraph) -add_subdirectory(ShPort) -add_subdirectory(ShSound) -add_subdirectory(ShString) -add_subdirectory(dDemo) -add_subdirectory(eDemo) -add_subdirectory(eeDemo) -add_subdirectory(nDEMO) -add_subdirectory(nDEMOE) -add_subdirectory(oDEMO) -add_subdirectory(oujimisc) -add_subdirectory(tDemo) +add_library(modules STATIC + modules.c + AliceLogo/AliceLogo.c + Confirm/Confirm.c + Gpx/Gpx.c + Gpx/effectcopy.c + Math/Math.c + MsgSkip/MsgSkip.c +# Tentatively disabled because many symbols in NIGHTDLL conflict with SACT. +# NIGHTDLL/NIGHTDLL.c +# NIGHTDLL/nt_scenario.c +# NIGHTDLL/sactcg.c +# NIGHTDLL/sactstring.c +# NIGHTDLL/sprite.c +# NIGHTDLL/sprite_draw.c +# NIGHTDLL/sprite_update.c +# NIGHTDLL/sprite_eupdate.c +# NIGHTDLL/nt_event.c +# NIGHTDLL/nt_msg.c +# NIGHTDLL/nt_sel.c +# NIGHTDLL/nt_graph.c +# NIGHTDLL/nt_sound.c + NightDemonDemo/NightDemonDemo.c + RandMT/RandMT.c + SACT/SACT.c + SACT/sactcg.c + SACT/sactsound.c + SACT/sactbgm.c + SACT/sacttimer.c + SACT/sactstring.c + SACT/sactcrypto.c + SACT/sactchart.c + SACT/sactamask.c + SACT/sactlog.c + SACT/sprite.c + SACT/sprite_event.c + SACT/sprite_tevent.c + SACT/sprite_move.c + SACT/sprite_anime.c + SACT/sprite_get.c + SACT/sprite_put.c + SACT/sprite_switch.c + SACT/sprite_sel.c + SACT/sprite_msg.c + SACT/sprite_draw.c + SACT/sprite_update.c + SACT/sprite_eupdate.c + SACT/sprite_quake.c + SACT/sprite_keywait.c + SACT/screen_quake.c + SACT/sprite_xmenu.c + ShArray/ShArray.c + ShCalc/ShCalc.c + ShGraph/ShGraph.c + ShPort/ShPort.c + ShSound/ShSound.c + ShString/ShString.c + dDemo/dDemo.c + eDemo/eDemo.c + eeDemo/eeDemo.c + nDEMO/nDEMO.c + nDEMOE/nDEMOE.c + oDEMO/oDEMO.c + oujimisc/oujimisc.c + tDemo/tDemo.c + ) + +target_include_directories(modules PUBLIC .) + +target_compile_options(modules PRIVATE -Wno-pointer-sign -Wno-invalid-source-encoding) +target_link_libraries(modules PRIVATE graph alk drawtext list) + +if (SDL2MIXER_FOUND) + target_link_libraries(modules PRIVATE PkgConfig::SDL2MIXER) +endif() + +include(FindJPEG) +if (JPEG_FOUND) + target_compile_definitions(modules PRIVATE HAVE_JPEG) + target_sources(modules PRIVATE + NightDemonDemo/ndd.c + NightDemonDemo/jpeg2surface.c + ) + target_link_libraries(modules PRIVATE JPEG::JPEG) +endif() diff --git a/modules/Confirm/CMakeLists.txt b/modules/Confirm/CMakeLists.txt deleted file mode 100644 index da73d84..0000000 --- a/modules/Confirm/CMakeLists.txt +++ /dev/null @@ -1,3 +0,0 @@ -add_library(Confirm MODULE Confirm.c) - -install(TARGETS Confirm DESTINATION lib/xsystem35) diff --git a/modules/Confirm/Confirm.c b/modules/Confirm/Confirm.c index 85cd48e..6e1a427 100644 --- a/modules/Confirm/Confirm.c +++ b/modules/Confirm/Confirm.c @@ -5,14 +5,15 @@ #include "portab.h" #include "system.h" #include "xsystem35.h" +#include "modules.h" #include "nact.h" -void Init() { +static void Init() { int p1 = getCaliValue(); DEBUG_COMMAND_YET("Confirm.Init %d:\n", p1); } -void ExistKeyFile() { +static void ExistKeyFile() { char *p1 = sys_getString(0); int *p2 = getCaliVariable(); int *var = getCaliVariable(); @@ -22,7 +23,7 @@ void ExistKeyFile() { DEBUG_COMMAND_YET("Confirm.ExistKeyFile %s,%p,%p:\n",p1, p2, var); } -void CheckProtectFile() { +static void CheckProtectFile() { char *p1 = sys_getString(0); int *p2 = getCaliVariable(); int *var = getCaliVariable(); @@ -32,7 +33,7 @@ void CheckProtectFile() { DEBUG_COMMAND_YET("Confirm.CheckProtectFile %s,%p,%p:\n", p1,p2,var); } -void CreateKeyFile() { +static void CreateKeyFile() { char *p1 = sys_getString(0); int *p2 = getCaliVariable(); int *var = getCaliVariable(); @@ -41,3 +42,12 @@ void CreateKeyFile() { DEBUG_COMMAND_YET("Confirm.CreateKeyFile %s,%p,%p:\n", p1,p2,var); } + +static const ModuleFunc functions[] = { + {"CheckProtectFile", CheckProtectFile}, + {"CreateKeyFile", CreateKeyFile}, + {"ExistKeyFile", ExistKeyFile}, + {"Init", Init}, +}; + +const Module module_Confirm = {"Confirm", functions, sizeof(functions) / sizeof(ModuleFunc)}; diff --git a/modules/Gpx/CMakeLists.txt b/modules/Gpx/CMakeLists.txt deleted file mode 100644 index 38efb59..0000000 --- a/modules/Gpx/CMakeLists.txt +++ /dev/null @@ -1,5 +0,0 @@ -add_library(Gpx MODULE Gpx.c effectcopy.c) - -target_link_libraries(Gpx PRIVATE graph) - -install(TARGETS Gpx DESTINATION lib/xsystem35) diff --git a/modules/Gpx/Gpx.c b/modules/Gpx/Gpx.c index e616b61..1edab58 100644 --- a/modules/Gpx/Gpx.c +++ b/modules/Gpx/Gpx.c @@ -33,6 +33,7 @@ #include "portab.h" #include "system.h" #include "xsystem35.h" +#include "modules.h" #include "nact.h" #include "ags.h" #include "cg.h" @@ -125,7 +126,7 @@ static int load_cg_main(int no) { return sf->no; } -void Init() { +static void Init() { /* Gpx.Init(): Gpx モジュールの初期化 */ @@ -140,7 +141,7 @@ void Init() { DEBUG_COMMAND("Gpx.Init %d:\n", p1); } -void Create() { +static void Create() { /* Gpx.Create(): 新規 surface の作成(PixelとAlphaマップの両方) @@ -171,7 +172,7 @@ void Create() { DEBUG_COMMAND("Gpx.Create %p,%d,%d,%d:\n", var, width, height, bpp); } -void CreatePixelOnly() { +static void CreatePixelOnly() { /* Gpx.CreatePixelOnly(): 新規 surface の作成(Pixelのみ) @@ -199,7 +200,7 @@ void CreatePixelOnly() { DEBUG_COMMAND("Gpx.CreatePixelOnly %d,%d,%d,%d:\n", *var, width, height, bpp); } -void CreateAMapOnly() { +static void CreateAMapOnly() { /* Gpx.CreateAMapOnly(): 新規 surface の作成(AlphaMapのみ) @@ -225,7 +226,7 @@ void CreateAMapOnly() { DEBUG_COMMAND("Gpx.CreateAMapOnly %p,%d,%d:\n", var, width, height); } -void IsSurface() { +static void IsSurface() { /* Gpx.IsSurface(): 指定の番号の surface が surface かどうか (pixel と alpha の両方のデータを持つ)を調べる @@ -248,7 +249,7 @@ void IsSurface() { DEBUG_COMMAND("Gpx.IsSurface %d,%p:\n", p1, var); } -void IsPixel() { +static void IsPixel() { /* Gpx.IsPixel(): 指定の番号の surface が pixelデータかどうかを調べる @@ -270,7 +271,7 @@ void IsPixel() { DEBUG_COMMAND("Gpx.IsPixel %d,%p:\n", p1, var); } -void IsAlpha() { +static void IsAlpha() { /* Gpx.IsAlpha(): 指定の番号の surface が alpha mapかどうかを調べる @@ -292,7 +293,7 @@ void IsAlpha() { DEBUG_COMMAND("Gpx.IsAlpha %d,%p:\n", p1, var); } -void GetWidth() { +static void GetWidth() { /* Gpx.GetWidth(): 指定の番号の surface の幅を取得する @@ -314,7 +315,7 @@ void GetWidth() { DEBUG_COMMAND("Gpx.GetWidth %d,%d:\n", p1, *var); } -void GetHeight() { +static void GetHeight() { /* Gpx.GetWidth(): 指定の番号の surface の高さを取得する @@ -336,13 +337,13 @@ void GetHeight() { DEBUG_COMMAND("Gpx.GetHeight %d,%d:\n", p1, *var); } -void GetCreatedSurface() { /* not used ? */ +static void GetCreatedSurface() { /* not used ? */ int *var = getCaliVariable(); DEBUG_COMMAND_YET("Gpx.GetCreatedSurface %p:\n", var); } -void LoadCG() { +static void LoadCG() { /* Gpx.LoadCG(): 新規 surface を作成してその上に CG を load @@ -357,21 +358,21 @@ void LoadCG() { DEBUG_COMMAND("Gpx.LoadCG %p,%d (%d):\n", var, p1, *var); } -void GetCGPosX() { /* not useed ? */ +static void GetCGPosX() { /* not useed ? */ int *var = getCaliVariable(); int p1 = getCaliValue(); DEBUG_COMMAND_YET("Gpx.GetCgPosX %p,%d:\n", var, p1); } -void GetCGPosY() { /* not useed ? */ +static void GetCGPosY() { /* not useed ? */ int *var = getCaliVariable(); int p1 = getCaliValue(); DEBUG_COMMAND_YET("Gpx.GetCgPosY %p,%d:\n", var, p1); } -void Free() { +static void Free() { /* Gpx.Free(): 指定の surface を開放する @@ -386,7 +387,7 @@ void Free() { } } -void FreeAll() { +static void FreeAll() { /* Gpx.FreeAll(): 全ての surface を開放する */ @@ -395,7 +396,7 @@ void FreeAll() { DEBUG_COMMAND("Gpx.FreeAll:\n"); } -void Copy() { +static void Copy() { /* Gpx.Copy(): 指定 surface 領域のコピー @@ -426,7 +427,7 @@ void Copy() { gr_copy(dst, dx, dy, src, sx, sy, sw, sh); } -void CopyBright() { /* not used ? */ +static void CopyBright() { /* not used ? */ int p1 = getCaliValue(); int p2 = getCaliValue(); int p3 = getCaliValue(); @@ -440,7 +441,7 @@ void CopyBright() { /* not used ? */ DEBUG_COMMAND_YET("Gpx.CopyBright %d,%d,%d,%d,%d,%d,%d,%d,%d:\n", p1, p2, p3, p4, p5, p6, p7, p8, p9); } -void CopyAMap() { +static void CopyAMap() { /* Gpx.CopyAMap(): 指定 surface の alpha map 領域のコピー @@ -471,7 +472,7 @@ void CopyAMap() { gr_copy_alpha_map(dst, dx, dy, src, sx, sy, sw, sh); } -void Blend() { /* not used ? */ +static void Blend() { /* not used ? */ int p1 = getCaliValue(); int p2 = getCaliValue(); int p3 = getCaliValue(); @@ -485,7 +486,7 @@ void Blend() { /* not used ? */ DEBUG_COMMAND_YET("Gpx.Blend %d,%d,%d,%d,%d,%d,%d,%d,%d:\n", p1, p2, p3, p4, p5, p6, p7, p8, p9); } -void BlendSrcBright() { /* not used ? */ +static void BlendSrcBright() { /* not used ? */ int p1 = getCaliValue(); int p2 = getCaliValue(); int p3 = getCaliValue(); @@ -500,7 +501,7 @@ void BlendSrcBright() { /* not used ? */ DEBUG_COMMAND_YET("Gpx.BlendSrcBright %d,%d,%d,%d,%d,%d,%d,%d,%d,%d:\n", p1, p2, p3, p4, p5, p6, p7, p8, p9, p10); } -void BlendAddSatur() { /* not used ? */ +static void BlendAddSatur() { /* not used ? */ int p1 = getCaliValue(); int p2 = getCaliValue(); int p3 = getCaliValue(); @@ -513,7 +514,7 @@ void BlendAddSatur() { /* not used ? */ DEBUG_COMMAND_YET("Gpx.BlendAddStatur %d,%d,%d,%d,%d,%d,%d,%d:\n", p1, p2, p3, p4, p5, p6, p7, p8); } -void BlendAMap() { +static void BlendAMap() { /* Gpx.BlendAMap(): 転送元の alpha map を参照して 指定領域を alpha blend @@ -544,7 +545,7 @@ void BlendAMap() { gr_blend_alpha_map(dst, dx, dy, src, sx, sy, sw, sh); } -void BlendAMapSrcOnly() { /* not used ? */ +static void BlendAMapSrcOnly() { /* not used ? */ int p1 = getCaliValue(); int p2 = getCaliValue(); int p3 = getCaliValue(); @@ -557,7 +558,7 @@ void BlendAMapSrcOnly() { /* not used ? */ DEBUG_COMMAND_YET("Gpx.BlendAMapSrcOnly %d,%d,%d,%d,%d,%d,%d,%d:\n", p1, p2, p3, p4, p5, p6, p7, p8); } -void BlendAMapColor() { /* not used ? */ +static void BlendAMapColor() { /* not used ? */ int p1 = getCaliValue(); int p2 = getCaliValue(); int p3 = getCaliValue(); @@ -573,7 +574,7 @@ void BlendAMapColor() { /* not used ? */ DEBUG_COMMAND_YET("Gpx.BlendAMapColor %d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d:\n", p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11); } -void BlendAMapColorAlpha() { /* not used ? */ +static void BlendAMapColorAlpha() { /* not used ? */ int p1 = getCaliValue(); int p2 = getCaliValue(); int p3 = getCaliValue(); @@ -590,7 +591,7 @@ void BlendAMapColorAlpha() { /* not used ? */ DEBUG_COMMAND_YET("Gpx.BlendAMapColorAlpha %d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d:\n", p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11, p12); } -void BlendAMapAlpha() { /* not used ? */ +static void BlendAMapAlpha() { /* not used ? */ int p1 = getCaliValue(); int p2 = getCaliValue(); int p3 = getCaliValue(); @@ -604,7 +605,7 @@ void BlendAMapAlpha() { /* not used ? */ DEBUG_COMMAND_YET("Gpx.BlendAMapAlpha %d,%d,%d,%d,%d,%d,%d,%d,%d:\n", p1, p2, p3, p4, p5, p6, p7, p8, p9); } -void BlendAMapBright() { /* not used ? */ +static void BlendAMapBright() { /* not used ? */ int p1 = getCaliValue(); int p2 = getCaliValue(); int p3 = getCaliValue(); @@ -618,7 +619,7 @@ void BlendAMapBright() { /* not used ? */ DEBUG_COMMAND_YET("Gpx.BlendAMapBright %d,%d,%d,%d,%d,%d,%d,%d,%d:\n", p1, p2, p3, p4, p5, p6, p7, p8, p9); } -void BlendAMapAlphaSrcBright() { /* not used ? */ +static void BlendAMapAlphaSrcBright() { /* not used ? */ int p1 = getCaliValue(); int p2 = getCaliValue(); int p3 = getCaliValue(); @@ -633,7 +634,7 @@ void BlendAMapAlphaSrcBright() { /* not used ? */ DEBUG_COMMAND_YET("Gpx.BlendAMapBright %d,%d,%d,%d,%d,%d,%d,%d,%d,%d:\n", p1, p2, p3, p4, p5, p6, p7, p8, p9, p10); } -void BlendUseAMapColor() { /* not used ? */ +static void BlendUseAMapColor() { /* not used ? */ int p1 = getCaliValue(); int p2 = getCaliValue(); int p3 = getCaliValue(); @@ -650,7 +651,7 @@ void BlendUseAMapColor() { /* not used ? */ DEBUG_COMMAND_YET("Gpx.BlendUseAMapColor %d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d:\n", p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11, p12); } -void BlendScreen() { /* not used ? */ +static void BlendScreen() { /* not used ? */ int p1 = getCaliValue(); int p2 = getCaliValue(); int p3 = getCaliValue(); @@ -663,7 +664,7 @@ void BlendScreen() { /* not used ? */ DEBUG_COMMAND_YET("Gpx.BlendScreen %d,%d,%d,%d,%d,%d,%d,%d:\n", p1, p2, p3, p4, p5, p6, p7, p8); } -void BlendMultiply() { /* not used ? */ +static void BlendMultiply() { /* not used ? */ int p1 = getCaliValue(); int p2 = getCaliValue(); int p3 = getCaliValue(); @@ -676,7 +677,7 @@ void BlendMultiply() { /* not used ? */ DEBUG_COMMAND_YET("Gpx.BlendMultiply %d,%d,%d,%d,%d,%d,%d,%d:\n", p1, p2, p3, p4, p5, p6, p7, p8); } -void BlendScreenAlpha() { /* not used ? */ +static void BlendScreenAlpha() { /* not used ? */ int p1 = getCaliValue(); int p2 = getCaliValue(); int p3 = getCaliValue(); @@ -690,7 +691,7 @@ void BlendScreenAlpha() { /* not used ? */ DEBUG_COMMAND_YET("Gpx.BlendScreenAlpha %d,%d,%d,%d,%d,%d,%d,%d,%d:\n", p1, p2, p3, p4, p5, p6, p7, p8, p9); } -void Fill() { +static void Fill() { /* Gpx.Fill(): 指定領域の塗りつぶし @@ -720,7 +721,7 @@ void Fill() { gr_fill(dst, dx, dy, dw, dh, r, g, b); } -void FillAlphaColor() { /* not used ? */ +static void FillAlphaColor() { /* not used ? */ int ds = getCaliValue(); int dx = getCaliValue(); int dy = getCaliValue(); @@ -739,7 +740,7 @@ void FillAlphaColor() { /* not used ? */ gr_fill_alpha_color(dst, dx, dy, dw, dh, r, g, b, lv); } -void FillAMap() { /* not used ? */ +static void FillAMap() { /* not used ? */ int p1 = getCaliValue(); int p2 = getCaliValue(); int p3 = getCaliValue(); @@ -750,7 +751,7 @@ void FillAMap() { /* not used ? */ DEBUG_COMMAND_YET("Gpx.FillAMap %d,%d,%d,%d,%d,%d:\n", p1, p2, p3, p4, p5, p6); } -void FillAMapOverBorder() { +static void FillAMapOverBorder() { /* Gpx.FillAMapOverBorder(): 矩形領域中の 閾値以上の alpha 値を持つ ものを指定の alpha 値に置き換え。 @@ -772,13 +773,13 @@ void FillAMapOverBorder() { int d = getCaliValue(); surface_t *dst; - DEBUG_COMMAND("Gpx.BlendAMapOverBorder %d,%d,%d,%d,%d,%d,%d:\n", ds, dx, dy, dw, dh, s, d); + DEBUG_COMMAND("Gpx.FillAMapOverBorder %d,%d,%d,%d,%d,%d,%d:\n", ds, dx, dy, dw, dh, s, d); dst = sf_get(ds); gr_fill_alpha_overborder(dst, dx, dy, dw, dh, s, d); } -void FillAMapUnderBorder() { /* not used ? */ +static void FillAMapUnderBorder() { /* not used ? */ int p1 = getCaliValue(); int p2 = getCaliValue(); int p3 = getCaliValue(); @@ -787,10 +788,10 @@ void FillAMapUnderBorder() { /* not used ? */ int p6 = getCaliValue(); int p7 = getCaliValue(); - DEBUG_COMMAND_YET("Gpx.BlendAMapUnderBorder %d,%d,%d,%d,%d,%d,%d:\n", p1, p2, p3, p4, p5, p6, p7); + DEBUG_COMMAND_YET("Gpx.FillAMapUnderBorder %d,%d,%d,%d,%d,%d,%d:\n", p1, p2, p3, p4, p5, p6, p7); } -void SaturDP_DPxSA() { /* not used ? */ +static void SaturDP_DPxSA() { /* not used ? */ int p1 = getCaliValue(); int p2 = getCaliValue(); int p3 = getCaliValue(); @@ -803,7 +804,7 @@ void SaturDP_DPxSA() { /* not used ? */ DEBUG_COMMAND_YET("Gpx.SaturDP_DPxSA %d,%d,%d,%d,%d,%d,%d,%d:\n", p1, p2, p3, p4, p5, p6, p7, p8); } -void ScreenDA_DAxSA() { /* not used ? */ +static void ScreenDA_DAxSA() { /* not used ? */ int p1 = getCaliValue(); int p2 = getCaliValue(); int p3 = getCaliValue(); @@ -816,7 +817,7 @@ void ScreenDA_DAxSA() { /* not used ? */ DEBUG_COMMAND_YET("Gpx.ScreenDA_DAxSA %d,%d,%d,%d,%d,%d,%d,%d:\n", p1, p2, p3, p4, p5, p6, p7, p8); } -void AddDA_DAxSA() { /* not used ? */ +static void AddDA_DAxSA() { /* not used ? */ int p1 = getCaliValue(); int p2 = getCaliValue(); int p3 = getCaliValue(); @@ -829,7 +830,7 @@ void AddDA_DAxSA() { /* not used ? */ DEBUG_COMMAND_YET("Gpx.AddDA_DAxSA %d,%d,%d,%d,%d,%d,%d,%d:\n", p1, p2, p3, p4, p5, p6, p7, p8); } -void SpriteCopyAMap() { +static void SpriteCopyAMap() { /* Gpx.SpriteCopyAMap(): 指定の alpha 値以外の領域の alpha map コピー @@ -863,7 +864,7 @@ void SpriteCopyAMap() { } -void BrightDestOnly() { +static void BrightDestOnly() { /* Gpx.BrightDestOnly(): 指定領域の明るさを設定 @@ -890,7 +891,7 @@ void BrightDestOnly() { gr_bright_dst_only(dst, dx, dy, dw, dh, r); } -void CopyTextureWrap() { /* not used ? */ +static void CopyTextureWrap() { /* not used ? */ int p1 = getCaliValue(); int p2 = getCaliValue(); int p3 = getCaliValue(); @@ -907,7 +908,7 @@ void CopyTextureWrap() { /* not used ? */ DEBUG_COMMAND_YET("Gpx.CopyTextureWrap %d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d:\n", p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11, p12); } -void CopyTextureWrapAlpha() { /* not used ? */ +static void CopyTextureWrapAlpha() { /* not used ? */ int p1 = getCaliValue(); int p2 = getCaliValue(); int p3 = getCaliValue(); @@ -925,7 +926,7 @@ void CopyTextureWrapAlpha() { /* not used ? */ DEBUG_COMMAND_YET("Gpx.CopyTextureWrapAlpha %d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d:\n", p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11, p12, p13); } -void CopyStretch() { +static void CopyStretch() { /* Gpx.CopyStretch(): 拡大・縮小 @@ -959,7 +960,7 @@ void CopyStretch() { gr_copy_stretch(dst, dx, dy, dw, dh, src, sx, sy, sw, sh); } -void CopyStretchBlend() { /* not used ? */ +static void CopyStretchBlend() { /* not used ? */ int p1 = getCaliValue(); int p2 = getCaliValue(); int p3 = getCaliValue(); @@ -975,7 +976,7 @@ void CopyStretchBlend() { /* not used ? */ DEBUG_COMMAND_YET("Gpx.CopyStretchBlend %d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d:\n", p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11); } -void CopyStretchBlendAMap() { +static void CopyStretchBlendAMap() { /* Gpx.CopyStretchBlendAMap(): 拡大・縮小しながら alpha blend @@ -1010,7 +1011,7 @@ void CopyStretchBlendAMap() { gr_copy_stretch_blend_alpha_map(dst, dx, dy, dw, dh, src, sx, sy, sw, sh); } -void StretchBlendScreen2x2() { /* not used ? */ +static void StretchBlendScreen2x2() { /* not used ? */ int p1 = getCaliValue(); int p2 = getCaliValue(); int p3 = getCaliValue(); @@ -1024,7 +1025,7 @@ void StretchBlendScreen2x2() { /* not used ? */ } -void StretchBlendScreen2x2WDS() { +static void StretchBlendScreen2x2WDS() { /* Gpx.StretchBlenfScreen2x2WDS(): 2枚の surface を縦横2倍に拡大しつつ alpha blend (飽和加算)する @@ -1063,7 +1064,7 @@ void StretchBlendScreen2x2WDS() { gr_blend_alpha_wds_stretch2x2(src1, sx1, sy1, src2, sx2, sy2, sw, sh, dst, dx, dy); } -void BlendScreenWDS() { +static void BlendScreenWDS() { /* Gpx.BlendScreenWDS(): 飽和加算 alpha blend @@ -1101,7 +1102,7 @@ void BlendScreenWDS() { gr_blend_alpha_wds(src1, sx1, sy1, src2, sx2, sy2, sw, sh, dst, dx, dy); } -void EffectCopy() { +static void EffectCopy() { /* Gpx.EffectCopy(): 効果つき領域コピー @@ -1169,8 +1170,65 @@ void EffectCopy() { } -void SetClickCancelFlag() { /* not used ? */ +static void SetClickCancelFlag() { /* not used ? */ int p1 = getCaliValue(); DEBUG_COMMAND_YET("Gpx.SetClikCancelFlag %d:\n", p1); } + +static const ModuleFunc functions[] = { + {"AddDA_DAxSA", AddDA_DAxSA}, + {"Blend", Blend}, + {"BlendAMap", BlendAMap}, + {"BlendAMapAlpha", BlendAMapAlpha}, + {"BlendAMapAlphaSrcBright", BlendAMapAlphaSrcBright}, + {"BlendAMapBright", BlendAMapBright}, + {"BlendAMapColor", BlendAMapColor}, + {"BlendAMapColorAlpha", BlendAMapColorAlpha}, + {"BlendAMapSrcOnly", BlendAMapSrcOnly}, + {"BlendAddSatur", BlendAddSatur}, + {"BlendMultiply", BlendMultiply}, + {"BlendScreen", BlendScreen}, + {"BlendScreenAlpha", BlendScreenAlpha}, + {"BlendScreenWDS", BlendScreenWDS}, + {"BlendSrcBright", BlendSrcBright}, + {"BlendUseAMapColor", BlendUseAMapColor}, + {"BrightDestOnly", BrightDestOnly}, + {"Copy", Copy}, + {"CopyAMap", CopyAMap}, + {"CopyBright", CopyBright}, + {"CopyStretch", CopyStretch}, + {"CopyStretchBlend", CopyStretchBlend}, + {"CopyStretchBlendAMap", CopyStretchBlendAMap}, + {"CopyTextureWrap", CopyTextureWrap}, + {"CopyTextureWrapAlpha", CopyTextureWrapAlpha}, + {"Create", Create}, + {"CreateAMapOnly", CreateAMapOnly}, + {"CreatePixelOnly", CreatePixelOnly}, + {"EffectCopy", EffectCopy}, + {"Fill", Fill}, + {"FillAMap", FillAMap}, + {"FillAMapOverBorder", FillAMapOverBorder}, + {"FillAMapUnderBorder", FillAMapUnderBorder}, + {"FillAlphaColor", FillAlphaColor}, + {"Free", Free}, + {"FreeAll", FreeAll}, + {"GetCGPosX", GetCGPosX}, + {"GetCGPosY", GetCGPosY}, + {"GetCreatedSurface", GetCreatedSurface}, + {"GetHeight", GetHeight}, + {"GetWidth", GetWidth}, + {"Init", Init}, + {"IsAlpha", IsAlpha}, + {"IsPixel", IsPixel}, + {"IsSurface", IsSurface}, + {"LoadCG", LoadCG}, + {"SaturDP_DPxSA", SaturDP_DPxSA}, + {"ScreenDA_DAxSA", ScreenDA_DAxSA}, + {"SetClickCancelFlag", SetClickCancelFlag}, + {"SpriteCopyAMap", SpriteCopyAMap}, + {"StretchBlendScreen2x2", StretchBlendScreen2x2}, + {"StretchBlendScreen2x2WDS", StretchBlendScreen2x2WDS}, +}; + +const Module module_Gpx = {"Gpx", functions, sizeof(functions) / sizeof(ModuleFunc)}; diff --git a/modules/Math/CMakeLists.txt b/modules/Math/CMakeLists.txt deleted file mode 100644 index 4122de3..0000000 --- a/modules/Math/CMakeLists.txt +++ /dev/null @@ -1,3 +0,0 @@ -add_library(Math MODULE Math.c) - -install(TARGETS Math DESTINATION lib/xsystem35) diff --git a/modules/Math/Math.c b/modules/Math/Math.c index 1ff6590..703c594 100644 --- a/modules/Math/Math.c +++ b/modules/Math/Math.c @@ -28,12 +28,13 @@ #include "portab.h" #include "system.h" #include "xsystem35.h" +#include "modules.h" #include "nact.h" #include "randMT.h" static int numtblmax; -void RandMTInit() { +static void RandMTInit() { /* (おそらく Mersenne Twister使用の) 乱数初期化 @@ -44,7 +45,7 @@ void RandMTInit() { DEBUG_COMMAND("Math.RandMTInit %d:\n", p1); } -void RandMTGet() { +static void RandMTGet() { /* 1 から num までの乱数を生成 @@ -63,7 +64,7 @@ void RandMTGet() { DEBUG_COMMAND("Math.RandMTGet %d,%p:\n", num, var); } -void RandMTMakeNumTable() { +static void RandMTMakeNumTable() { /* 乱数テーブルの最大値を設定 @@ -76,7 +77,7 @@ void RandMTMakeNumTable() { DEBUG_COMMAND("Math.RandMTMakeNumTable %d:\n", p1); } -void RandMTGetNumTable() { +static void RandMTGetNumTable() { /* 乱数テーブルから値を取得 @@ -88,3 +89,12 @@ void RandMTGetNumTable() { DEBUG_COMMAND("Math.RandMTGetNumTable %d:\n", *var); } + +static const ModuleFunc functions[] = { + {"RandMTGet", RandMTGet}, + {"RandMTGetNumTable", RandMTGetNumTable}, + {"RandMTInit", RandMTInit}, + {"RandMTMakeNumTable", RandMTMakeNumTable}, +}; + +const Module module_Math = {"Math", functions, sizeof(functions) / sizeof(ModuleFunc)}; diff --git a/modules/MsgSkip/CMakeLists.txt b/modules/MsgSkip/CMakeLists.txt deleted file mode 100644 index 6dc4037..0000000 --- a/modules/MsgSkip/CMakeLists.txt +++ /dev/null @@ -1,3 +0,0 @@ -add_library(MsgSkip MODULE MsgSkip.c) - -install(TARGETS MsgSkip DESTINATION lib/xsystem35) diff --git a/modules/MsgSkip/MsgSkip.c b/modules/MsgSkip/MsgSkip.c index 85feb19..c0fc585 100644 --- a/modules/MsgSkip/MsgSkip.c +++ b/modules/MsgSkip/MsgSkip.c @@ -6,12 +6,13 @@ #include "portab.h" #include "system.h" #include "xsystem35.h" +#include "modules.h" #include "nact.h" #include "message.h" static char *msgskipfile; -void Init() { +static void Init() { int *p1 = getCaliVariable(); int p2 = getCaliValue(); /* ISys3x */ int p3 = getCaliValue(); @@ -21,7 +22,7 @@ void Init() { DEBUG_COMMAND_YET("MsgSkip.Init %p,%d,%d,%d:\n", p1, p2, p3, p4); } -void Start() { +static void Start() { int *p1 = getCaliVariable(); int p2 = getCaliValue(); @@ -30,40 +31,52 @@ void Start() { DEBUG_COMMAND_YET("MsgSkip.Start %p,%d:\n", p1, p2); } -void SetValid() { +static void SetValid() { int p1 = getCaliValue(); DEBUG_COMMAND("MsgSkip.SetValid %d:\n", p1); } -void GetValid() { +static void GetValid() { int *p1 = getCaliVariable(); DEBUG_COMMAND_YET("MsgSkip.GetValid %p:\n", p1); } -void SetAction() { +static void SetAction() { int p1 = getCaliValue(); DEBUG_COMMAND("MsgSkip.SetAcion %d:\n", p1); } -void GetAction() { +static void GetAction() { int *p1 = getCaliVariable(); DEBUG_COMMAND_YET("MsgSkip.GetAcion %p:\n", p1); } -void PushStr() { +static void PushStr() { int p1 = getCaliValue(); DEBUG_COMMAND_YET("MsgSkip.PushStr %d:\n", p1); } -void PopStr() { +static void PopStr() { int p1 = getCaliValue(); DEBUG_COMMAND_YET("MsgSkip.PopStr %d:\n", p1); } +static const ModuleFunc functions[] = { + {"GetAction", GetAction}, + {"GetValid", GetValid}, + {"Init", Init}, + {"PopStr", PopStr}, + {"PushStr", PushStr}, + {"SetAction", SetAction}, + {"SetValid", SetValid}, + {"Start", Start}, +}; + +const Module module_MsgSkip = {"MsgSkip", functions, sizeof(functions) / sizeof(ModuleFunc)}; diff --git a/modules/NIGHTDLL/CMakeLists.txt b/modules/NIGHTDLL/CMakeLists.txt deleted file mode 100644 index 0f938d1..0000000 --- a/modules/NIGHTDLL/CMakeLists.txt +++ /dev/null @@ -1,21 +0,0 @@ -add_library(NIGHTDLL MODULE - NIGHTDLL.c - nt_scenario.c - sactcg.c - sactstring.c - sprite.c - sprite_draw.c - sprite_update.c - sprite_eupdate.c - nt_event.c - nt_msg.c - nt_sel.c - nt_graph.c - nt_sound.c - ) - -target_compile_options(NIGHTDLL PRIVATE -Wno-pointer-sign -Wno-invalid-source-encoding) - -target_link_libraries(NIGHTDLL PRIVATE graph drawtext list) - -install(TARGETS NIGHTDLL DESTINATION lib/xsystem35) diff --git a/modules/NightDemonDemo/CMakeLists.txt b/modules/NightDemonDemo/CMakeLists.txt deleted file mode 100644 index 01a4cde..0000000 --- a/modules/NightDemonDemo/CMakeLists.txt +++ /dev/null @@ -1,9 +0,0 @@ -include(FindJPEG) - -if (JPEG_FOUND) - add_library(NightDemonDemo MODULE NightDemonDemo.c ndd.c jpeg2surface.c) - - target_link_libraries(NightDemonDemo PRIVATE graph alk JPEG::JPEG) - - install(TARGETS NightDemonDemo DESTINATION lib/xsystem35) -endif() diff --git a/modules/NightDemonDemo/NightDemonDemo.c b/modules/NightDemonDemo/NightDemonDemo.c index 43fa50a..48be00f 100644 --- a/modules/NightDemonDemo/NightDemonDemo.c +++ b/modules/NightDemonDemo/NightDemonDemo.c @@ -28,28 +28,40 @@ #include "portab.h" #include "system.h" #include "xsystem35.h" +#include "modules.h" #include "nact.h" extern void ndd_init(char *files[], int n); extern void ndd_run(int demonum); -void Init() { +static void Init() { int p1 = getCaliValue(); /* ISys3x */ int p2 = getCaliValue(); /* IWinMsg */ int p3 = getCaliValue(); /* ITimer */ int *var = getCaliVariable(); +#ifdef HAVE_JPEG ndd_init(nact->files.alk, 4); +#endif *var = 1; DEBUG_COMMAND("NightDemonDemo.Init %d,%d,%d,%p:\n", p1, p2, p3, var); } -void Run() { +static void Run() { int p1 = getCaliValue(); // デモ番号 0,1,2 int p2 = getCaliValue(); +#ifdef HAVE_JPEG ndd_run(p1); +#endif DEBUG_COMMAND("NightDemonDemo.Run %d,%d:\n", p1, p2); } + +static const ModuleFunc functions[] = { + {"Init", Init}, + {"Run", Run}, +}; + +const Module module_NightDemonDemo = {"NightDemonDemo", functions, sizeof(functions) / sizeof(ModuleFunc)}; diff --git a/modules/RandMT/CMakeLists.txt b/modules/RandMT/CMakeLists.txt deleted file mode 100644 index 92389ac..0000000 --- a/modules/RandMT/CMakeLists.txt +++ /dev/null @@ -1,3 +0,0 @@ -add_library(RandMT MODULE RandMT.c) - -install(TARGETS RandMT DESTINATION lib/xsystem35) diff --git a/modules/RandMT/RandMT.c b/modules/RandMT/RandMT.c index 67954de..3d2044f 100644 --- a/modules/RandMT/RandMT.c +++ b/modules/RandMT/RandMT.c @@ -28,10 +28,11 @@ #include "portab.h" #include "system.h" #include "xsystem35.h" +#include "modules.h" #include "nact.h" #include "randMT.h" -void Init() { +static void Init() { /* 乱数初期化 @@ -42,7 +43,7 @@ void Init() { DEBUG_COMMAND_YET("RandMT.Init %p:\n", p1); } -void Get() { +static void Get() { /* 1 から num までの乱数を生成 @@ -61,10 +62,18 @@ void Get() { DEBUG_COMMAND_YET("RandMT.Get %d,%p:\n", num, var); } -void GetNoOverlap() { /* not used ? */ +static void GetNoOverlap() { /* not used ? */ int p1 = getCaliValue(); int p2 = getCaliValue(); int *var1 = getCaliVariable(); DEBUG_COMMAND_YET("RandMT.GetNoOverlap %p:\n", p1); } + +static const ModuleFunc functions[] = { + {"Get", Get}, + {"GetNoOverlap", GetNoOverlap}, + {"Init", Init}, +}; + +const Module module_RandMT = {"RandMT", functions, sizeof(functions) / sizeof(ModuleFunc)}; diff --git a/modules/SACT/CMakeLists.txt b/modules/SACT/CMakeLists.txt deleted file mode 100644 index 31c8f93..0000000 --- a/modules/SACT/CMakeLists.txt +++ /dev/null @@ -1,35 +0,0 @@ -add_library(SACT MODULE - SACT.c - sactcg.c - sactsound.c - sactbgm.c - sacttimer.c - sactstring.c - sactcrypto.c - sactchart.c - sactamask.c - sactlog.c - sprite.c - sprite_event.c - sprite_tevent.c - sprite_move.c - sprite_anime.c - sprite_get.c - sprite_put.c - sprite_switch.c - sprite_sel.c - sprite_msg.c - sprite_draw.c - sprite_update.c - sprite_eupdate.c - sprite_quake.c - sprite_keywait.c - screen_quake.c - sprite_xmenu.c - ) - -target_compile_options(SACT PRIVATE -Wno-pointer-sign -Wno-invalid-source-encoding) - -target_link_libraries(SACT PRIVATE graph drawtext list) - -install(TARGETS SACT DESTINATION lib/xsystem35) diff --git a/modules/SACT/SACT.c b/modules/SACT/SACT.c index a8275aa..d3b4ac9 100644 --- a/modules/SACT/SACT.c +++ b/modules/SACT/SACT.c @@ -32,6 +32,7 @@ #include "xsystem35.h" #include "gametitle.h" #include "message.h" +#include "modules.h" #include "nact.h" #include "sact.h" #include "sprite.h" @@ -98,7 +99,7 @@ extern char *xsys35_sact01; * SACT.Init (1.0~) * SACT全体の初期化 */ -void Init() { +static void Init() { int p1 = getCaliValue(); /* ISys3x */ // ゲームタイトルによるバージョン設定 @@ -153,7 +154,7 @@ void Init() { * @param wNumCG3: クリックしたときのCG番号 * @param wType: スプライトのタイプ */ -void CreateSprite() { +static void CreateSprite() { int wNum = getCaliValue(); int wNumCG1 = getCaliValue(); int wNumCG2 = getCaliValue(); @@ -174,7 +175,7 @@ void CreateSprite() { * @param wWidth: スプライトの幅 * @param wHeight: スプライトの高さ */ -void CreateTextSprite() { +static void CreateTextSprite() { int wNum = getCaliValue(); int wX = getCaliValue(); int wY = getCaliValue(); @@ -191,7 +192,7 @@ void CreateTextSprite() { * 壁紙(画面背景)として表示するCGの設定 * @param wNum: 壁紙(背景)として表示するCGの番号 */ -void SetWallPaper() { +static void SetWallPaper() { int wNum = getCaliValue(); sp_set_wall_paper(wNum); @@ -203,7 +204,7 @@ void SetWallPaper() { * SACT.Clear (1.0~) * 全スプライト削除(~SP_CLR) */ -void Clear() { +static void Clear() { sp_free_all(); DEBUG_COMMAND_YET("SACT.Clear:\n"); @@ -214,7 +215,7 @@ void Clear() { * スプライトの削除 * @param wNum: 削除するスプライト番号 */ -void Delete() { +static void Delete() { int wNum = getCaliValue(); sp_free(wNum); @@ -228,7 +229,7 @@ void Delete() { * @param wNum: 先頭スプライト番号 * @param wCount: 範囲 */ -void SpriteDeleteCount() { +static void SpriteDeleteCount() { int wNum = getCaliValue(); int wCount = getCaliValue(); int i; @@ -244,7 +245,7 @@ void SpriteDeleteCount() { * SACT.Draw (1.0~) * 現在設定されているスプライト状態を画面に反映(~SP_UPDATE) */ -void Draw() { +static void Draw() { sp_update_all(TRUE); DEBUG_COMMAND_YET("SACT.Draw:\n"); @@ -257,7 +258,7 @@ void Draw() { * @param wEffectTime: エフェクトの時間(1/100秒単位) * @param wEffectKey: キー抜け設定 (1.1~) (1で有効) */ -void DrawEffect() { +static void DrawEffect() { int wType = getCaliValue(); int wEffectTime = getCaliValue(); int wEffectkey = 1; @@ -278,7 +279,7 @@ void DrawEffect() { * @param wEffectTime: エフェクトの時間(1/100秒単位) * @param wEffectKey: キー抜け設定 */ -void DrawEffectAlphaMap() { +static void DrawEffectAlphaMap() { int nIndexAlphaMap = getCaliValue(); int wEffectTime = getCaliValue(); int wEffectKey = getCaliValue(); @@ -299,7 +300,7 @@ void DrawEffectAlphaMap() { * @param wCount: 時間(1/100秒) * @param nfKeyEnable: キー抜け (1で有効) (1.1~) */ -void QuakeScreen() { +static void QuakeScreen() { int wType = getCaliValue(); int wParam1 = getCaliValue(); int wParam2 = getCaliValue(); @@ -321,7 +322,7 @@ void QuakeScreen() { * @param wX: 原点にするX座標の位置 * @param wY: 原点にするY座標の位置 */ -void SetOrigin() { +static void SetOrigin() { int wX = getCaliValue(); int wY = getCaliValue(); @@ -338,7 +339,7 @@ void SetOrigin() { * @param wCount: 表示する個数 * @param wShow: 0:非表示, 1:表示 */ -void SetShow() { +static void SetShow() { int wNum = getCaliValue(); int wCount = getCaliValue(); int wShow = getCaliValue(); @@ -355,7 +356,7 @@ void SetShow() { * @param wCount: 表示する個数 * @param nBlendRate: ブレンド率 */ -void SetBlendRate() { +static void SetBlendRate() { int wNum = getCaliValue(); int wCount = getCaliValue(); int nBlendRate = getCaliValue(); @@ -372,7 +373,7 @@ void SetBlendRate() { * @param wX: 表示X座標 * @param wY: 表示Y座標 */ -void SetPos() { +static void SetPos() { int wNum = getCaliValue(); int wX = getCaliValue(); int wY = getCaliValue(); @@ -389,7 +390,7 @@ void SetPos() { * @param wX: 表示X座標 * @param wY: 表示Y座標 */ -void SetMove() { +static void SetMove() { int wNum = getCaliValue(); int wX = getCaliValue(); int wY = getCaliValue(); @@ -405,7 +406,7 @@ void SetMove() { * @param wNum: スプライト番号 * @param wTime: 移動を完了するまでの時間(1/100秒単位) */ -void SetMoveTime() { +static void SetMoveTime() { int wNum = getCaliValue(); int wTime = getCaliValue(); @@ -420,7 +421,7 @@ void SetMoveTime() { * @param wNum: スプライト番号 * @param wSpeed: 移動速度(デフォルトを100%とした%指定) */ -void SetMoveSpeed() { +static void SetMoveSpeed() { int wNum = getCaliValue(); int wSpeed = getCaliValue(); @@ -436,7 +437,7 @@ void SetMoveSpeed() { * @param wCount: 範囲 * @param wSpeed: 移動速度(デフォルトを100%とした%指定) */ -void SetMoveSpeedCount() { +static void SetMoveSpeedCount() { int wNum = getCaliValue(); int wCount = getCaliValue(); int wSpeed = getCaliValue(); @@ -456,7 +457,7 @@ void SetMoveSpeedCount() { * @param wCount: 範囲 * @param nTime: 間隔 */ -void SetSpriteAnimeTimeInterval() { +static void SetSpriteAnimeTimeInterval() { int wNum = getCaliValue(); int wCount = getCaliValue(); int nTime = getCaliValue(); @@ -474,7 +475,7 @@ void SetSpriteAnimeTimeInterval() { * キー入力待ちでZキーが押されたときに表示OFFになるスプライトの登録 * @param wNum: スプライト番号 */ -void AddZKeyHideSprite() { +static void AddZKeyHideSprite() { int wNum = getCaliValue(); sp_add_zkey_hidesprite(wNum); @@ -486,7 +487,7 @@ void AddZKeyHideSprite() { * SACT.ClearZKeyHideSprite (1.0~) * AddZKeyHideSpriteで登録したスプライト番号を全てクリア */ -void ClearZKeyHideSprite() { +static void ClearZKeyHideSprite() { sp_clear_zkey_hidesprite_all(); DEBUG_COMMAND_YET("SACT.ClearZKeyHideSprite:\n"); @@ -499,7 +500,7 @@ void ClearZKeyHideSprite() { * @param wNum: スプライト番号 * @param wIndex: 固定する状態番号(1-3) */ -void SpriteFreeze() { +static void SpriteFreeze() { int wNum = getCaliValue(); int wIndex = getCaliValue(); @@ -513,7 +514,7 @@ void SpriteFreeze() { * Freezeしたスプライト状態を解除 * @param wNum: スプライト番号 */ -void SpriteThaw() { +static void SpriteThaw() { int wNum = getCaliValue(); sp_thaw_sprite(wNum); @@ -528,7 +529,7 @@ void SpriteThaw() { * @param wCount: 範囲 * @param wIndex: 固定する状態番号 */ -void SpriteFreezeCount() { +static void SpriteFreezeCount() { int wNum = getCaliValue(); int wCount = getCaliValue(); int wIndex = getCaliValue(); @@ -547,7 +548,7 @@ void SpriteFreezeCount() { * @param wNum: 先頭スプライト番号 * @param wCount: 範囲 */ -void SpriteThawCount() { +static void SpriteThawCount() { int wNum = getCaliValue(); int wCount = getCaliValue(); int i; @@ -564,7 +565,7 @@ void SpriteThawCount() { * QuakeSpriteで揺らすスプライトを追加 * @param wNum: スプライト番号 */ -void QuakeSpriteAdd() { +static void QuakeSpriteAdd() { int wNum = getCaliValue(); sp_add_quakesprite(wNum); @@ -576,7 +577,7 @@ void QuakeSpriteAdd() { * SACT.QuakeSpriteReset (1.0~) * QuakeSpriteAddの設定を全て解除 */ -void QuakeSpriteReset() { +static void QuakeSpriteReset() { sp_clear_quakesprite_all(); DEBUG_COMMAND_YET("SACT.QuakeSpriteReset:\n"); } @@ -591,7 +592,7 @@ void QuakeSpriteReset() { * @param wCount: 時間(1/100秒) * @param nfKeyEnable: (1.1~): キーキャンセルあり(=1) */ -void QuakeSprite() { +static void QuakeSprite() { int wType = getCaliValue(); int wAmplitudeX = getCaliValue(); int wAmplitudeY = getCaliValue(); @@ -613,7 +614,7 @@ void QuakeSprite() { * @param wNum: スプライト番号 * @param var: 登録状態を返す変数 0: 未登録, 1:既登録 */ -void QuerySpriteIsExist() { +static void QuerySpriteIsExist() { int wNum = getCaliValue(); int *var = getCaliVariable(); @@ -631,7 +632,7 @@ void QuerySpriteIsExist() { * @param vCG2: CG2(ない場合は0) * @param vCG3: CG3(ない場合は0) */ -void QuerySpriteInfo() { +static void QuerySpriteInfo() { int wNum = getCaliValue(); int *vType = getCaliVariable(); int *vCG1 = getCaliVariable(); @@ -649,7 +650,7 @@ void QuerySpriteInfo() { * @param wNum: スプライト番号 * @param vShow: 0:非表示, 1:表示 */ -void QuerySpriteShow() { +static void QuerySpriteShow() { int wNum = getCaliValue(); int *vShow = getCaliVariable(); @@ -665,7 +666,7 @@ void QuerySpriteShow() { * @param vX: X座標 * @param vY: Y座標 */ -void QuerySpritePos() { +static void QuerySpritePos() { int wNum = getCaliValue(); int *vX = getCaliVariable(); int *vY = getCaliVariable(); @@ -682,7 +683,7 @@ void QuerySpritePos() { * @param vWidth: スプライトの幅 * @param vHeight: スプライトの高さ */ -void QuerySpriteSize() { +static void QuerySpriteSize() { int wNum = getCaliValue(); int *vWidth = getCaliVariable(); int *vHeight = getCaliVariable(); @@ -699,7 +700,7 @@ void QuerySpriteSize() { * @param pwX: * @param pwY: */ -void QueryTextPos() { +static void QueryTextPos() { int wNum = getCaliValue(); int *vX = getCaliVariable(); int *vY = getCaliVariable(); @@ -713,7 +714,7 @@ void QueryTextPos() { * SCAT.CG_Clear (1.0~) * CG_Createで作成したCGを全て削除 */ -void CG_Clear() { +static void CG_Clear() { scg_freeall(); DEBUG_COMMAND_YET("SACT.CG_Clear:\n"); @@ -724,7 +725,7 @@ void CG_Clear() { * CG_Createで作成したCGを削除 * @param wNumCG: 削除するCG番号 */ -void CG_Reset() { +static void CG_Reset() { int wNumCG = getCaliValue(); scg_free(wNumCG); @@ -739,7 +740,7 @@ void CG_Reset() { * @param vType: CGの種類, 0: 未使用, 1:リンクされている, 2: CG_SETで作成 * 3: CG_REVERSEで作成, 4: CG_STRETCHで作成 */ -void CG_QueryType() { +static void CG_QueryType() { int wNumCG = getCaliValue(); int *vType = getCaliVariable(); @@ -755,7 +756,7 @@ void CG_QueryType() { * @param vWidth: 幅 * @param vHeight: 高さ */ -void CG_QuerySize() { +static void CG_QuerySize() { int wNumCG = getCaliValue(); int *vWidth = getCaliVariable(); int *vHeight = getCaliVariable(); @@ -771,7 +772,7 @@ void CG_QuerySize() { * @param wNumCG: CG番号 * @param vBpp: CGのbpp */ -void CG_QueryBpp() { +static void CG_QueryBpp() { int wNumCG = getCaliValue(); int *vBpp = getCaliVariable(); @@ -786,7 +787,7 @@ void CG_QueryBpp() { * @param wNumCG: CG番号 * @param vMask: 0/1 */ -void CG_ExistAlphaMap() { +static void CG_ExistAlphaMap() { int wNumCG = getCaliValue(); int *vMask = getCaliVariable(); @@ -806,7 +807,7 @@ void CG_ExistAlphaMap() { * @param wB: RGB値の青(0-255) * @param wBlendRate: ブレンド率(0-255) */ -void CG_Create() { +static void CG_Create() { int wNumCG = getCaliValue(); int wWidth = getCaliValue(); int wHeight = getCaliValue(); @@ -828,7 +829,7 @@ void CG_Create() { * @param wReverseX: X方向の反転スイッチ(0:反転しない、1:反転する) * @param wReverseY: Y方向の反転スイッチ(0:反転しない、1:反転する) */ -void CG_CreateReverse() { +static void CG_CreateReverse() { int wNumCG = getCaliValue(); int wNumSrcCG = getCaliValue(); int wReverseX = getCaliValue(); @@ -847,7 +848,7 @@ void CG_CreateReverse() { * @param wHeight: 作成するCGの高さ * @param wNumSrcCG: 元になるCGの番号 */ -void CG_CreateStretch() { +static void CG_CreateStretch() { int wNumCG = getCaliValue(); int wWidth = getCaliValue(); int wHeight = getCaliValue(); @@ -868,7 +869,7 @@ void CG_CreateStretch() { * @param wNumBlendCG: 上に重ね合わせるCG * @param wAlphaMapMode: αマップの作成モード */ -void CG_CreateBlend() { +static void CG_CreateBlend() { int wNumDstCG = getCaliValue(); int wNumBaseCG = getCaliValue(); int wX = getCaliValue(); @@ -891,7 +892,7 @@ void CG_CreateBlend() { * @param wB: 文字のB値(0-255) * @param wText: 描画する文字列変数の番号 */ -void CG_CreateText() { +static void CG_CreateText() { int wNumCG = getCaliValue(); int wSize = getCaliValue(); int wR = getCaliValue(); @@ -917,7 +918,7 @@ void CG_CreateText() { * 0:ゼロ埋めしない 1:ゼロ埋めする * @param wValue: 描画する値 */ -void CG_CreateTextNum() { +static void CG_CreateTextNum() { int wNumCG = getCaliValue(); int wSize = getCaliValue(); int wR = getCaliValue(); @@ -938,7 +939,7 @@ void CG_CreateTextNum() { * @param wNumDst: 複写先のCG番号 * @param wNumSrc: 複写元のCG番号 */ -void CG_Copy() { +static void CG_Copy() { int wNumDst = getCaliValue(); int wNumSrc = getCaliValue(); @@ -957,7 +958,7 @@ void CG_Copy() { * @param wWidth: カット幅 * @param wHeight: カット高さ */ -void CG_Cut() { +static void CG_Cut() { int wNumDstCG = getCaliValue(); int wNumSrcCG = getCaliValue(); int wX = getCaliValue(); @@ -981,7 +982,7 @@ void CG_Cut() { * @param wWidth: カット幅 * @param wHeight: カット高さ */ -void CG_PartCopy() { +static void CG_PartCopy() { int wNumDstCG = getCaliValue(); int wNumSrcCG = getCaliValue(); int wX = getCaliValue(); @@ -999,7 +1000,7 @@ void CG_PartCopy() { * 通常キー入力待ち * @param vKey: 入力されたキー */ -void WaitKeySimple() { +static void WaitKeySimple() { int *vKey = getCaliVariable(); DEBUG_COMMAND_YET("SACT.WaitKeySimple %d:\n", vKey); @@ -1027,7 +1028,7 @@ void WaitKeySimple() { * @param wMessageMark2: スプライト番号2(アニメーションスプライト) * @param wMessageLength: (1.2~) */ -void WaitKeyMessage() { +static void WaitKeyMessage() { int wMessageMark1 = getCaliValue(); int wMessageMark2 = getCaliValue(); int wMessageLength = 0; @@ -1049,7 +1050,7 @@ void WaitKeyMessage() { * @param vRsv1: 予約 * @param vRsv2: 予約 */ -void WaitKeySprite() { +static void WaitKeySprite() { int *vOK = getCaliVariable(); int *vRND = getCaliVariable(); int *vRsv1 = getCaliVariable(); @@ -1068,7 +1069,7 @@ void WaitKeySprite() { * @param nKeyCode: * @param vResult: */ -void PeekKey() { +static void PeekKey() { int nKeyCode = getCaliValue(); int *vResult = getCaliVariable(); @@ -1080,7 +1081,7 @@ void PeekKey() { * SACT.WaitKeySKipKeyUp (1.0~) * 文字送りキーが押されっぱなしの時、離されるまで待つ */ -void WaitMsgSkipKeyUp() { +static void WaitMsgSkipKeyUp() { WARNING("NOT IMPLEMENTED\n"); DEBUG_COMMAND_YET("SACT.WaitMsgSkipKeyUp:\n"); } @@ -1092,7 +1093,7 @@ void WaitMsgSkipKeyUp() { * @param vD03: タイムアウトした場合=1, しない場合=0 * @param wTime: タイムアウト時間 (1/100sec) */ -void WaitKeySimpleTimeOut() { +static void WaitKeySimpleTimeOut() { int *vRND = getCaliVariable(); int *vD03 = getCaliVariable(); int wTime = getCaliValue(); @@ -1124,7 +1125,7 @@ void WaitKeySimpleTimeOut() { * @param vD03: タイムアウトした場合=1, しない場合=0 * @param wTime: タイムアウト時間 (1/100sec) */ -void WaitKeySpriteTimeOut() { +static void WaitKeySpriteTimeOut() { int *vOK = getCaliVariable(); int *vRND = getCaliVariable(); int *vD01 = getCaliVariable(); @@ -1142,7 +1143,7 @@ void WaitKeySpriteTimeOut() { * ?????? * @param vSkip: */ -void QueryMessageSkip() { +static void QueryMessageSkip() { int *vSkip = getCaliVariable(); *vSkip = get_skipMode() ? 1 : 0; @@ -1156,7 +1157,7 @@ void QueryMessageSkip() { * @param sstr: 変換元文字列番号 * @param dstr: 変換先文字列番号 */ -void RegistReplaceString() { +static void RegistReplaceString() { int sstr = getCaliValue(); int dstr = getCaliValue(); @@ -1181,7 +1182,7 @@ void RegistReplaceString() { * @param wMessageAlign: 行そろえ (1.1~) * @param vMessageLength: ??? (1.2~) */ -void MessageOutput() { +static void MessageOutput() { int wMessageSpriteNumber = getCaliValue(); int wMessageSize = getCaliValue(); int wMessageColorR = getCaliValue(); @@ -1225,7 +1226,7 @@ void MessageOutput() { * @param wRubyLineSpace: ルビ文字とメッセージの行間スペース * @param vLength: ??? (1.2~) */ -void MessageOutputEx() { +static void MessageOutputEx() { int wMessageSpriteNumber = getCaliValue(); int wMessageSize = getCaliValue(); int wMessageColorR = getCaliValue(); @@ -1255,7 +1256,7 @@ void MessageOutputEx() { * @param wMessageSpriteNumber: メッセージスプライト番号 * @param wMessageSize: フォントの大きさ (~MES_SIZE|~MES_SET) */ -void MessageNewLine() { +static void MessageNewLine() { int wMessageSpriteNumber = getCaliValue(); int wMessageSize = getCaliValue(); @@ -1269,7 +1270,7 @@ void MessageNewLine() { * メッセージ領域の消去(Aコマンド相当) * @param wMessageSpriteNumber: メッセージスプライト番号 */ -void MessageClear() { +static void MessageClear() { int wMessageSpriteNumber = getCaliValue(); smsg_clear(wMessageSpriteNumber); @@ -1282,7 +1283,7 @@ void MessageClear() { * メッセージが残っている場合 wResult に 0 を返す? * @param wResult: 結果を返す変数 */ -void MessageIsEmpty() { +static void MessageIsEmpty() { int *wResult = getCaliVariable(); *wResult = smsg_is_empty(); @@ -1296,7 +1297,7 @@ void MessageIsEmpty() { * @param vCount: 取得した行数 * @param nTopStringNum: バッファを取得する文字列変数の最初 */ -void MessagePeek() { +static void MessagePeek() { int *vCount = getCaliVariable(); int nTopStringNum = getCaliValue(); @@ -1309,7 +1310,7 @@ void MessagePeek() { * SACT.Log_Stop (1.2~) * ログ採取停止 */ -void Log_Stop() { +static void Log_Stop() { sact.logging = FALSE; DEBUG_COMMAND_YET("SACT.Log_Stop:\n"); } @@ -1318,7 +1319,7 @@ void Log_Stop() { * SACT.Log_Start (1.2~) * ログ採取開始 */ -void Log_Start() { +static void Log_Start() { sact.logging = TRUE; DEBUG_COMMAND_YET("SACT.Log_Start:\n"); } @@ -1327,7 +1328,7 @@ void Log_Start() { * SACT.MenuClear (1.0~) * SACT内部の選択肢情報をクリア */ -void MenuClear() { +static void MenuClear() { ssel_clear(); DEBUG_COMMAND_YET("SACT.MenuClear:\n"); @@ -1339,7 +1340,7 @@ void MenuClear() { * @param nString: 登録する文字列変数番号 * @param wI: 登録する位置 (1-) */ -void MenuAdd() { +static void MenuAdd() { int nString = getCaliValue(); int wI = getCaliValue(); @@ -1359,7 +1360,7 @@ void MenuAdd() { * @param wChoiceAutoMoveCursor: オープン時に自動的に移動する選択肢の番号 * @param nAlign: 行そろえ (0:左, 1:中央, 2: 右) (1.1~) */ -void MenuOpen() { +static void MenuOpen() { int *wMenuResult = getCaliVariable(); int wNum = getCaliValue(); int wChoiceSize = getCaliValue(); @@ -1382,7 +1383,7 @@ void MenuOpen() { * SACT内部に文字列変数をプッシュ * @param nString: 文字列変数番号 */ -void PushString() { +static void PushString() { int nString = getCaliValue(); sstr_push(nString); @@ -1395,7 +1396,7 @@ void PushString() { * SACT内部にプッシュした文字列変数をポップ * @param nString: 文字列変数番号 */ -void PopString() { +static void PopString() { int nString = getCaliValue(); sstr_pop(nString); @@ -1416,7 +1417,7 @@ void PopString() { * @param nIndex: 数字(0-9) * @param nCG: 数字に対応するCG番号 */ -void Numeral_SetCG() { +static void Numeral_SetCG() { int nNum = getCaliValue(); int nIndex = getCaliValue(); int nCG = getCaliValue(); @@ -1433,7 +1434,7 @@ void Numeral_SetCG() { * @param nIndex: 数字(0-9) * @param vCG: 設定されているCG番号を返す変数 */ -void Numeral_GetCG() { +static void Numeral_GetCG() { int nNum = getCaliValue(); int nIndex = getCaliValue(); int *vCG = getCaliVariable(); @@ -1450,7 +1451,7 @@ void Numeral_GetCG() { * @param nX: 表示X座標 * @param ny: 表示Y座標 */ -void Numeral_SetPos() { +static void Numeral_SetPos() { int nNum = getCaliValue(); int nX = getCaliValue(); int nY = getCaliValue(); @@ -1467,7 +1468,7 @@ void Numeral_SetPos() { * @param vX: X座標を格納する変数 * @param vY: Y座標を格納する変数 */ -void Numeral_GetPos() { +static void Numeral_GetPos() { int nNum = getCaliValue(); int *vX = getCaliVariable(); int *vY = getCaliVariable(); @@ -1483,7 +1484,7 @@ void Numeral_GetPos() { * @param nNum: スプライト番号 * @param nSpan: 間隔 */ -void Numeral_SetSpan() { +static void Numeral_SetSpan() { int nNum = getCaliValue(); int nSpan = getCaliValue(); @@ -1498,7 +1499,7 @@ void Numeral_SetSpan() { * @param nNum: スプライト番号 * @param vSpan: 値を格納する変数 */ -void Numeral_GetSpan() { +static void Numeral_GetSpan() { int nNum = getCaliValue(); int *vSpan = getCaliVariable(); @@ -1511,7 +1512,7 @@ void Numeral_GetSpan() { * SACT.ExpSp_Clear (1.0~) * 説明スプライト設定クリア */ -void ExpSp_Clear() { +static void ExpSp_Clear() { DEBUG_COMMAND_YET("SACT.ExpSp_Clear:\n"); sp_exp_clear(); @@ -1523,7 +1524,7 @@ void ExpSp_Clear() { * @param wNumSP1: スイッチスプライト * @param wNumSP2: 説明スプライト */ -void ExpSp_Add() { +static void ExpSp_Add() { int wNumSP1 = getCaliValue(); int wNumSP2 = getCaliValue(); @@ -1537,7 +1538,7 @@ void ExpSp_Add() { * 説明スプライト削除 * @param wNum: スプライト番号 */ -void ExpSp_Del() { +static void ExpSp_Del() { int wNum = getCaliValue(); sp_exp_del(wNum); @@ -1551,7 +1552,7 @@ void ExpSp_Del() { * @param wTimerID: タイマーID * @param wCount: リセットする値 */ -void TimerSet() { +static void TimerSet() { int wTimerID = getCaliValue(); int wCount = getCaliValue(); @@ -1566,7 +1567,7 @@ void TimerSet() { * @param wTimerID: タイマーID * @param vRND: 取得する変数 */ -void TimerGet() { +static void TimerGet() { int wTimerID = getCaliValue(); int *vRND = getCaliVariable(); @@ -1581,7 +1582,7 @@ void TimerGet() { * @param wTimerID: タイマーID * @param wCount: 指定カウント */ -void TimerWait() { +static void TimerWait() { int wTimerID = getCaliValue(); int wCount = getCaliValue(); @@ -1597,7 +1598,7 @@ void TimerWait() { * 指定時間、すべての動作を停止 * @param nCount: 時間(1/100秒単位) */ -void Wait() { +static void Wait() { int wCount = getCaliValue(); sys_keywait(wCount*10, FALSE); @@ -1610,7 +1611,7 @@ void Wait() { * サウンド直接再生 (~SOUND_PLAY) * @param wNum: 再生する番号 */ -void SoundPlay() { +static void SoundPlay() { int wNum = getCaliValue(); ssnd_play(wNum); @@ -1624,7 +1625,7 @@ void SoundPlay() { * @param wNum: 停止する番号 * @param wFadeTime: 停止するまでの時間 (1/100sec) */ -void SoundStop() { +static void SoundStop() { int wNum = getCaliValue(); int wFadeTime = getCaliValue(); @@ -1639,7 +1640,7 @@ void SoundStop() { * @param wNum: 停止する番号 * @param wFadeTime: 停止するまでの時間 (1/100sec) */ -void SoundStopAll() { +static void SoundStopAll() { int wFadeTime = getCaliValue(); ssnd_stopall(wFadeTime); @@ -1652,7 +1653,7 @@ void SoundStopAll() { * ヘッダで指定された時間or再生終了まで待つ (~SOUND_WAIT) * @param wNum: 指定番号 */ -void SoundWait() { +static void SoundWait() { int wNum = getCaliValue(); ssnd_wait(wNum); @@ -1666,7 +1667,7 @@ void SoundWait() { * @param wNum: 指定番号 * @param vKey: キャンセルキー */ -void SoundWaitKey() { +static void SoundWaitKey() { int wNum = getCaliValue(); int *vKey = getCaliVariable(); @@ -1680,7 +1681,7 @@ void SoundWaitKey() { * 再生の準備をする(~SOUND_PREPARE) * @param wNum: 再生する番号 */ -void SoundPrepare() { +static void SoundPrepare() { int wNum = getCaliValue(); ssnd_prepare(wNum); @@ -1693,7 +1694,7 @@ void SoundPrepare() { * 再生の準備をする(左右反転) (~SOUND_PREPARE_LR) * @param wNum: 再生する番号 */ -void SoundPrepareLR() { +static void SoundPrepareLR() { int wNum = getCaliValue(); ssnd_prepareLRrev(wNum); @@ -1706,7 +1707,7 @@ void SoundPrepareLR() { * 左右反転して再生 (~SOUND_PLAY_LR) * @param wNum: 再生する番号 */ -void SoundPlayLR() { +static void SoundPlayLR() { int wNum = getCaliValue(); ssnd_playLRrev(wNum); @@ -1723,7 +1724,7 @@ void SoundPlayLR() { * @param wNumWave2: Sound2 * @param wNumWave3: Sound3 */ -void SpriteSound() { +static void SpriteSound() { int wNumSP = getCaliValue(); int nCount = getCaliValue(); int wNumWave1 = getCaliValue(); @@ -1742,7 +1743,7 @@ void SpriteSound() { * SACT.SpriteSoundWait (1.0~) * SpriteSoundで設定したすべての音の再生終了まで待つ (~SP_SOUND_WAIT) */ -void SpriteSoundWait() { +static void SpriteSoundWait() { DEBUG_COMMAND_YET("SACT.SpriteSoundWait:\n"); sp_sound_wait(); @@ -1753,7 +1754,7 @@ void SpriteSoundWait() { * 範囲外をクリックしたときの音 (~SPRITE_SOUND_OB) * @param wNumWave: 再生する番号、0でクリア */ -void SpriteSoundOB() { +static void SpriteSoundOB() { int wNumWave = getCaliValue(); sp_sound_ob(wNumWave); @@ -1767,7 +1768,7 @@ void SpriteSoundOB() { * @param wNum: 番号 * @param vRND: 0:ない、1:ある */ -void MusicCheck() { +static void MusicCheck() { int wNum = getCaliValue(); int *vRND = getCaliVariable(); @@ -1782,7 +1783,7 @@ void MusicCheck() { * @param wNum: 音楽番号 * @param vRND: 取得した長さを格納する変数 */ -void MusicGetLength() { +static void MusicGetLength() { int wNum = getCaliValue(); int *vRND = getCaliVariable(); @@ -1797,7 +1798,7 @@ void MusicGetLength() { * @param wNum: 音楽番号 * @param vRND: 取得した位置を格納する変数 */ -void MusicGetPos() { +static void MusicGetPos() { int wNum = getCaliValue(); int *vRND = getCaliVariable(); @@ -1813,7 +1814,7 @@ void MusicGetPos() { * @param wFadeTime: フェードイン時間(1/100秒) * @param wVolume: 音量(0-100) */ -void MusicPlay() { +static void MusicPlay() { int wNum = getCaliValue(); int wFadeTime = getCaliValue(); int wVolume = getCaliValue(); @@ -1829,7 +1830,7 @@ void MusicPlay() { * @param wNum: 音楽番号 * @param wFadeTime: 終了するまでの時間(1/100秒) */ -void MusicStop() { +static void MusicStop() { int wNum = getCaliValue(); int wFadeTime = getCaliValue(); @@ -1843,7 +1844,7 @@ void MusicStop() { * すべての音楽を停止 * @param wFadeTime: 終了するまでの時間(1/100秒) */ -void MusicStopAll() { +static void MusicStopAll() { int wFadeTime = getCaliValue(); smus_stopall(wFadeTime); @@ -1858,7 +1859,7 @@ void MusicStopAll() { * @param wFadeTime: フェード時間(1/100秒) * @param wVolume: 音量 (1-100) */ -void MusicFade() { +static void MusicFade() { int wNum = getCaliValue(); int wFadeTime = getCaliValue(); int wVolume = getCaliValue(); @@ -1874,7 +1875,7 @@ void MusicFade() { * @param wNum: 音楽番号 * @param nTimeOut: (1.1~) */ -void MusicWait() { +static void MusicWait() { int wNum = getCaliValue(); int nTimeOut = 0; @@ -1894,7 +1895,7 @@ void MusicWait() { * @param wNum: 音楽番号 * @param wIndex: 位置マーク番号 */ -void MusicWaitPos() { +static void MusicWaitPos() { int wNum = getCaliValue(); int wIndex = getCaliValue(); @@ -1909,7 +1910,7 @@ void MusicWaitPos() { * @param wNum: チャンネル番号 * @param vRND: リンク番号(未使用=0) */ -void SoundGetLinkNum() { +static void SoundGetLinkNum() { int wNum = getCaliValue(); int *vRND = getCaliVariable(); @@ -1930,7 +1931,7 @@ void SoundGetLinkNum() { * * pos = ((pos2-pos1) / (val2-val1)) * (val-val1) + pos1 */ -void ChartPos() { +static void ChartPos() { int *pos = getCaliVariable(); int pos1 = getCaliValue(); int pos2 = getCaliValue(); @@ -1951,7 +1952,7 @@ void ChartPos() { * @param zeropad: 0: ゼロ埋めしない, 1: ゼロ埋めする * @param num: 変換する数値 */ -void NumToStr() { +static void NumToStr() { int strno = getCaliValue(); int fig = getCaliValue(); int zeropad = getCaliValue(); @@ -1965,7 +1966,7 @@ void NumToStr() { /** * SACT.Maze_Create (1.0~) */ -void Maze_Create() { +static void Maze_Create() { int p1 = getCaliValue(); int p2 = getCaliValue(); @@ -1977,7 +1978,7 @@ void Maze_Create() { /** * SACT.Maze_Get (1.0~) */ -void Maze_Get() { +static void Maze_Get() { int *p1 = getCaliVariable(); int p2 = getCaliValue(); int p3 = getCaliValue(); @@ -1990,7 +1991,7 @@ void Maze_Get() { /** * SACT.EncryptWORD (1.0~) */ -void EncryptWORD() { +static void EncryptWORD() { int *array = getCaliVariable(); int num = getCaliValue(); int key = getCaliValue(); @@ -2003,7 +2004,7 @@ void EncryptWORD() { /** * SACT.DecryptWORD (1.0~) */ -void DecryptWORD() { +static void DecryptWORD() { int *array = getCaliVariable(); int num = getCaliValue(); int key = getCaliValue(); @@ -2016,7 +2017,7 @@ void DecryptWORD() { /** * SACT.EncryptString (1.0~) */ -void EncryptString() { +static void EncryptString() { int p1 = getCaliValue(); int p2 = getCaliValue(); @@ -2028,7 +2029,7 @@ void EncryptString() { /** * SACT.DecryptString (1.0~) */ -void DecryptString() { +static void DecryptString() { int p1 = getCaliValue(); int p2 = getCaliValue(); @@ -2041,7 +2042,7 @@ void DecryptString() { * SACT.XMenuClear (1.0~) * 拡張メニュー初期化 */ -void XMenuClear() { +static void XMenuClear() { spxm_clear(); DEBUG_COMMAND_YET("SACT.XMenuClear:\n"); @@ -2053,7 +2054,7 @@ void XMenuClear() { * @param nRegiNum: 拡張メニューの内部インデックス番号 * @param nMenuID: 選択されたときに返す番号(ID) */ -void XMenuRegister() { +static void XMenuRegister() { int nRegiNum = getCaliValue(); int nMenuID = getCaliValue(); @@ -2068,7 +2069,7 @@ void XMenuRegister() { * @param nRegiNum: 内部インデックス番号 * @param vMenuID: 登録されているIDを格納する変数 */ -void XMenuGetNum() { +static void XMenuGetNum() { int nRegiNum = getCaliValue(); int *vMenuID = getCaliVariable(); @@ -2083,7 +2084,7 @@ void XMenuGetNum() { * @param nRegiNum: 内部インデックス番号 * @param strno: コピー先文字列変数番号 */ -void XMenuGetText() { +static void XMenuGetText() { int nRegiNum = getCaliValue(); int strno = getCaliValue(); @@ -2096,7 +2097,7 @@ void XMenuGetText() { * SACT.XMenuTitleRegister (1.0~) * 現在バッファにある文字列を拡張メニューのタイトルとして登録 */ -void XMenuTitleRegister() { +static void XMenuTitleRegister() { spxm_titlereg(); DEBUG_COMMAND_YET("SACT.XMenuTitleRegister:\n"); @@ -2107,10 +2108,135 @@ void XMenuTitleRegister() { * 拡張メニューのタイトルを指定の文字列変数にコピー * @param strno: コピー先文字列変数番号 */ -void XMenuTitleGet() { +static void XMenuTitleGet() { int strno = getCaliValue(); spxm_titleget(strno); DEBUG_COMMAND_YET("SACT.XMenuTitleGet %d:\n", strno); } + +static const ModuleFunc functions[] = { + {"AddZKeyHideSprite", AddZKeyHideSprite}, + {"CG_Clear", CG_Clear}, + {"CG_Copy", CG_Copy}, + {"CG_Create", CG_Create}, + {"CG_CreateBlend", CG_CreateBlend}, + {"CG_CreateReverse", CG_CreateReverse}, + {"CG_CreateStretch", CG_CreateStretch}, + {"CG_CreateText", CG_CreateText}, + {"CG_CreateTextNum", CG_CreateTextNum}, + {"CG_Cut", CG_Cut}, + {"CG_ExistAlphaMap", CG_ExistAlphaMap}, + {"CG_PartCopy", CG_PartCopy}, + {"CG_QueryBpp", CG_QueryBpp}, + {"CG_QuerySize", CG_QuerySize}, + {"CG_QueryType", CG_QueryType}, + {"CG_Reset", CG_Reset}, + {"ChartPos", ChartPos}, + {"Clear", Clear}, + {"ClearZKeyHideSprite", ClearZKeyHideSprite}, + {"CreateSprite", CreateSprite}, + {"CreateTextSprite", CreateTextSprite}, + {"DecryptString", DecryptString}, + {"DecryptWORD", DecryptWORD}, + {"Delete", Delete}, + {"Draw", Draw}, + {"DrawEffect", DrawEffect}, + {"DrawEffectAlphaMap", DrawEffectAlphaMap}, + {"EncryptString", EncryptString}, + {"EncryptWORD", EncryptWORD}, + {"ExpSp_Add", ExpSp_Add}, + {"ExpSp_Clear", ExpSp_Clear}, + {"ExpSp_Del", ExpSp_Del}, + {"Init", Init}, + {"Log_Start", Log_Start}, + {"Log_Stop", Log_Stop}, + {"Maze_Create", Maze_Create}, + {"Maze_Get", Maze_Get}, + {"MenuAdd", MenuAdd}, + {"MenuClear", MenuClear}, + {"MenuOpen", MenuOpen}, + {"MessageClear", MessageClear}, + {"MessageIsEmpty", MessageIsEmpty}, + {"MessageNewLine", MessageNewLine}, + {"MessageOutput", MessageOutput}, + {"MessageOutputEx", MessageOutputEx}, + {"MessagePeek", MessagePeek}, + {"MusicCheck", MusicCheck}, + {"MusicFade", MusicFade}, + {"MusicGetLength", MusicGetLength}, + {"MusicGetPos", MusicGetPos}, + {"MusicPlay", MusicPlay}, + {"MusicStop", MusicStop}, + {"MusicStopAll", MusicStopAll}, + {"MusicWait", MusicWait}, + {"MusicWaitPos", MusicWaitPos}, + {"NumToStr", NumToStr}, + {"Numeral_GetCG", Numeral_GetCG}, + {"Numeral_GetPos", Numeral_GetPos}, + {"Numeral_GetSpan", Numeral_GetSpan}, + {"Numeral_SetCG", Numeral_SetCG}, + {"Numeral_SetPos", Numeral_SetPos}, + {"Numeral_SetSpan", Numeral_SetSpan}, + {"PeekKey", PeekKey}, + {"PopString", PopString}, + {"PushString", PushString}, + {"QuakeScreen", QuakeScreen}, + {"QuakeSprite", QuakeSprite}, + {"QuakeSpriteAdd", QuakeSpriteAdd}, + {"QuakeSpriteReset", QuakeSpriteReset}, + {"QueryMessageSkip", QueryMessageSkip}, + {"QuerySpriteInfo", QuerySpriteInfo}, + {"QuerySpriteIsExist", QuerySpriteIsExist}, + {"QuerySpritePos", QuerySpritePos}, + {"QuerySpriteShow", QuerySpriteShow}, + {"QuerySpriteSize", QuerySpriteSize}, + {"QueryTextPos", QueryTextPos}, + {"RegistReplaceString", RegistReplaceString}, + {"SetBlendRate", SetBlendRate}, + {"SetMove", SetMove}, + {"SetMoveSpeed", SetMoveSpeed}, + {"SetMoveSpeedCount", SetMoveSpeedCount}, + {"SetMoveTime", SetMoveTime}, + {"SetOrigin", SetOrigin}, + {"SetPos", SetPos}, + {"SetShow", SetShow}, + {"SetSpriteAnimeTimeInterval", SetSpriteAnimeTimeInterval}, + {"SetWallPaper", SetWallPaper}, + {"SoundGetLinkNum", SoundGetLinkNum}, + {"SoundPlay", SoundPlay}, + {"SoundPlayLR", SoundPlayLR}, + {"SoundPrepare", SoundPrepare}, + {"SoundPrepareLR", SoundPrepareLR}, + {"SoundStop", SoundStop}, + {"SoundStopAll", SoundStopAll}, + {"SoundWait", SoundWait}, + {"SoundWaitKey", SoundWaitKey}, + {"SpriteDeleteCount", SpriteDeleteCount}, + {"SpriteFreeze", SpriteFreeze}, + {"SpriteFreezeCount", SpriteFreezeCount}, + {"SpriteSound", SpriteSound}, + {"SpriteSoundOB", SpriteSoundOB}, + {"SpriteSoundWait", SpriteSoundWait}, + {"SpriteThaw", SpriteThaw}, + {"SpriteThawCount", SpriteThawCount}, + {"TimerGet", TimerGet}, + {"TimerSet", TimerSet}, + {"TimerWait", TimerWait}, + {"Wait", Wait}, + {"WaitKeyMessage", WaitKeyMessage}, + {"WaitKeySimple", WaitKeySimple}, + {"WaitKeySimpleTimeOut", WaitKeySimpleTimeOut}, + {"WaitKeySprite", WaitKeySprite}, + {"WaitKeySpriteTimeOut", WaitKeySpriteTimeOut}, + {"WaitMsgSkipKeyUp", WaitMsgSkipKeyUp}, + {"XMenuClear", XMenuClear}, + {"XMenuGetNum", XMenuGetNum}, + {"XMenuGetText", XMenuGetText}, + {"XMenuRegister", XMenuRegister}, + {"XMenuTitleGet", XMenuTitleGet}, + {"XMenuTitleRegister", XMenuTitleRegister}, +}; + +const Module module_SACT = {"SACT", functions, sizeof(functions) / sizeof(ModuleFunc)}; diff --git a/modules/ShArray/CMakeLists.txt b/modules/ShArray/CMakeLists.txt deleted file mode 100644 index 86671ad..0000000 --- a/modules/ShArray/CMakeLists.txt +++ /dev/null @@ -1,3 +0,0 @@ -add_library(ShArray MODULE ShArray.c) - -install(TARGETS ShArray DESTINATION lib/xsystem35) diff --git a/modules/ShArray/ShArray.c b/modules/ShArray/ShArray.c index 694be81..920bf4c 100644 --- a/modules/ShArray/ShArray.c +++ b/modules/ShArray/ShArray.c @@ -31,9 +31,10 @@ #include "portab.h" #include "system.h" #include "xsystem35.h" +#include "modules.h" #include "nact.h" -void GetAtArray(void) { /* 0 */ +static void GetAtArray(void) { /* 0 */ /* 配列から演算しながら値を取り出す @@ -79,7 +80,7 @@ void GetAtArray(void) { /* 0 */ *vResult = j; } -void AddAtArray(void) { /* 1 */ +static void AddAtArray(void) { /* 1 */ /* 配列1に配列2を足す。65535 を超えたら 65535 に。 @@ -105,7 +106,7 @@ void AddAtArray(void) { /* 1 */ } } -void SubAtArray(void) { /* 2 */ +static void SubAtArray(void) { /* 2 */ /* 配列1から配列2を引く。負になったら0をかく @@ -131,7 +132,7 @@ void SubAtArray(void) { /* 2 */ } } -void MulAtArray(void) { /* 3 */ +static void MulAtArray(void) { /* 3 */ /* 配列1に配列2をかけて、配列1に格納、65535まで。 @@ -157,7 +158,7 @@ void MulAtArray(void) { /* 3 */ } } -void DivAtArray(void) { /* 4 */ +static void DivAtArray(void) { /* 4 */ /* 配列1を配列2で割って、配列1に格納、65535まで。 @@ -187,7 +188,7 @@ void DivAtArray(void) { /* 4 */ } } -void MinAtArray(void) { /* 5 */ +static void MinAtArray(void) { /* 5 */ /* 配列 vAry1 の中身を配列 vAry2 で下限に設定する @@ -210,7 +211,7 @@ void MinAtArray(void) { /* 5 */ } } -void MaxAtArray(void) { /* 6 */ +static void MaxAtArray(void) { /* 6 */ /* 配列 vAry1 の中身を配列 vAry2 で上限に設定する @@ -233,7 +234,7 @@ void MaxAtArray(void) { /* 6 */ } } -void AndNumArray(void) { /* 7 */ +static void AndNumArray(void) { /* 7 */ /* 配列のデータと val で AND をとる @@ -254,7 +255,7 @@ void AndNumArray(void) { /* 7 */ } } -void OrNumArray(void) { /* 8 */ +static void OrNumArray(void) { /* 8 */ /* 配列のデータと val で OR をとる @@ -275,7 +276,7 @@ void OrNumArray(void) { /* 8 */ } } -void XorNumArray(void) { /* 9 */ +static void XorNumArray(void) { /* 9 */ /* 配列のデータと val で XOR をとる @@ -296,7 +297,7 @@ void XorNumArray(void) { /* 9 */ } } -void SetEquArray(void) { /* 10 */ +static void SetEquArray(void) { /* 10 */ /* 配列が val と等しければ 配列 vResults に 1 を、そうでなければ 0 を代入 @@ -320,7 +321,7 @@ void SetEquArray(void) { /* 10 */ } } -void SetNotArray(void) { /* 11 */ +static void SetNotArray(void) { /* 11 */ /* 配列が val と等しくなければ配列 vResults に 1 を、そうでなければ 0 を代入 @@ -344,7 +345,7 @@ void SetNotArray(void) { /* 11 */ } } -void SetLowArray(void) { /* 12 */ +static void SetLowArray(void) { /* 12 */ /* 配列データが val よりも小さければ vResult に 1 をセット @@ -367,7 +368,7 @@ void SetLowArray(void) { /* 12 */ } } -void SetHighArray(void) { /* 13 */ +static void SetHighArray(void) { /* 13 */ /* 配列データが val よりも大きければ vResult に 1 をセット @@ -390,7 +391,7 @@ void SetHighArray(void) { /* 13 */ } } -void SetRangeArray(void) { /* 14 */ +static void SetRangeArray(void) { /* 14 */ /* 配列データがある範囲(min〜max)にあるかチェック @@ -417,7 +418,7 @@ void SetRangeArray(void) { /* 14 */ } } -void SetAndEquArray(void) { /* 15 */ +static void SetAndEquArray(void) { /* 15 */ /* 配列 vAry と mask との AND をとって val に等しければ 配列 vResults に1を、等しくなければ 0 を書く @@ -444,7 +445,7 @@ void SetAndEquArray(void) { /* 15 */ } } -void AndEquArray(void) { /* 16 */ +static void AndEquArray(void) { /* 16 */ /* 配列 vAry 中で val と同じならば、vResult と 1 の AND を 違うならば 0 をかく。 @@ -468,7 +469,7 @@ void AndEquArray(void) { /* 16 */ } } -void AndNotArray(void) { /* 17 */ +static void AndNotArray(void) { /* 17 */ /* 配列 vAry 中で val と等しくないならば、vResult と 1 の AND を 違う場合は 0 をかく。 @@ -492,7 +493,7 @@ void AndNotArray(void) { /* 17 */ } } -void AndLowArray(void) { /* 18 */ +static void AndLowArray(void) { /* 18 */ /* 配列 vAry が min よりも小さいならば、vResult と 1 の AND を そうでないならば 0 をかく。 @@ -516,7 +517,7 @@ void AndLowArray(void) { /* 18 */ } } -void AndHighArray(void) { /* 19 */ +static void AndHighArray(void) { /* 19 */ /* 配列 vAry が min よりも大きいならば、vResult と 1 の AND を そうでないならば 0 をかく。 @@ -540,7 +541,7 @@ void AndHighArray(void) { /* 19 */ } } -void AndRangeArray(void) { /* 20 */ +static void AndRangeArray(void) { /* 20 */ /* vAry が min から max にある場合、vResults と 1 の AND を そうでなければ 0 をかく。 @@ -566,7 +567,7 @@ void AndRangeArray(void) { /* 20 */ } } -void AndAndEquArray(void) { /* 21 */ +static void AndAndEquArray(void) { /* 21 */ /* 配列 vAry と mask との AND をとって val に等しければ 配列 vResults と1の AND、等しくなければ 0 を書く @@ -593,7 +594,7 @@ void AndAndEquArray(void) { /* 21 */ } } -void OrEquArray(void) { /* 22 */ +static void OrEquArray(void) { /* 22 */ int p1 = getCaliValue(); int p2 = getCaliValue(); int p3 = getCaliValue(); @@ -602,7 +603,7 @@ void OrEquArray(void) { /* 22 */ DEBUG_COMMAND_YET("ShArray.OrEquArray: %d,%d,%d,%d:\n", p1, p2, p3, p4); } -void OrNotArray(void) { /* 23 */ +static void OrNotArray(void) { /* 23 */ /* 配列の値が val と等しくなければ vResult に 1 を書き込む @@ -626,7 +627,7 @@ void OrNotArray(void) { /* 23 */ } } -void OrLowArray(void) { /* 24 */ +static void OrLowArray(void) { /* 24 */ int p1 = getCaliValue(); int p2 = getCaliValue(); int p3 = getCaliValue(); @@ -635,7 +636,7 @@ void OrLowArray(void) { /* 24 */ DEBUG_COMMAND_YET("ShArray.OrLowArray: %d,%d,%d,%d:\n", p1, p2, p3, p4); } -void OrHighArray(void) { /* 25 */ +static void OrHighArray(void) { /* 25 */ int p1 = getCaliValue(); int p2 = getCaliValue(); int p3 = getCaliValue(); @@ -644,7 +645,7 @@ void OrHighArray(void) { /* 25 */ DEBUG_COMMAND_YET("ShArray.OrHighArray: %d,%d,%d,%d:\n", p1, p2, p3, p4); } -void OrRangeArray(void) { /* 26 */ +static void OrRangeArray(void) { /* 26 */ int p1 = getCaliValue(); int p2 = getCaliValue(); int p3 = getCaliValue(); @@ -654,7 +655,7 @@ void OrRangeArray(void) { /* 26 */ DEBUG_COMMAND_YET("ShArray.OrRangeArray: %d,%d,%d,%d,%d:\n", p1, p2, p3, p4,p5); } -void OrAndEquArray(void) { /* 27 */ +static void OrAndEquArray(void) { /* 27 */ int p1 = getCaliValue(); int p2 = getCaliValue(); int p3 = getCaliValue(); @@ -664,7 +665,7 @@ void OrAndEquArray(void) { /* 27 */ DEBUG_COMMAND_YET("ShArray.OrAndEquArray: %d,%d,%d,%d,%d:\n", p1, p2, p3, p4,p5); } -void EnumEquArray(void) { /* 28 */ +static void EnumEquArray(void) { /* 28 */ /* 配列のデータ中に val と同じデータを数を vResult に返す @@ -689,7 +690,7 @@ void EnumEquArray(void) { /* 28 */ } } -void EnumEquArray2(void) { /* 29 */ +static void EnumEquArray2(void) { /* 29 */ int p1 = getCaliValue(); int p2 = getCaliValue(); int p3 = getCaliValue(); @@ -700,7 +701,7 @@ void EnumEquArray2(void) { /* 29 */ DEBUG_COMMAND_YET("ShArray.EnumEquArray2: %d,%d,%d,%d,%d,%d:\n", p1, p2, p3, p4, p5, p6); } -void EnumEquNotArray2(void) { /* 30 */ +static void EnumEquNotArray2(void) { /* 30 */ /* 配列1が val1 に等しく、配列2がval2 に等しくないものの数を vResult に返す。 @@ -732,7 +733,7 @@ void EnumEquNotArray2(void) { /* 30 */ } } -void EnumNotArray(void) { /* 31 */ +static void EnumNotArray(void) { /* 31 */ /* 配列のなかで val と等しくないものの個数を返す @@ -759,7 +760,7 @@ void EnumNotArray(void) { /* 31 */ } } -void EnumNotArray2(void) { /* 32 */ +static void EnumNotArray2(void) { /* 32 */ int p1 = getCaliValue(); int p2 = getCaliValue(); int p3 = getCaliValue(); @@ -770,7 +771,7 @@ void EnumNotArray2(void) { /* 32 */ DEBUG_COMMAND_YET("ShArray.EnumNotArray2: %d,%d,%d,%d,%d,%d:\n", p1, p2, p3, p4, p5, p6); } -void EnumLowArray(void) { /* 33 */ +static void EnumLowArray(void) { /* 33 */ int p1 = getCaliValue(); int p2 = getCaliValue(); int p3 = getCaliValue(); @@ -779,7 +780,7 @@ void EnumLowArray(void) { /* 33 */ DEBUG_COMMAND_YET("ShArray.EnumLowArray: %d,%d,%d,%d:\n", p1, p2, p3, p4); } -void EnumHighArray(void) { /* 34 */ +static void EnumHighArray(void) { /* 34 */ int p1 = getCaliValue(); int p2 = getCaliValue(); int p3 = getCaliValue(); @@ -788,7 +789,7 @@ void EnumHighArray(void) { /* 34 */ DEBUG_COMMAND_YET("ShArray.EnumHighArray: %d,%d,%d,%d:\n", p1, p2, p3, p4); } -void EnumRangeArray(void) { /* 35 */ +static void EnumRangeArray(void) { /* 35 */ /* 配列の値のうちが min と max の間あるものの数を vResult に返す @@ -818,7 +819,7 @@ void EnumRangeArray(void) { /* 35 */ } -void GrepEquArray(void) { /* 36 */ +static void GrepEquArray(void) { /* 36 */ /* 配列の値が val と等しければ vLastMatch に一致した index を返し vResult に 1 を返す @@ -850,7 +851,7 @@ void GrepEquArray(void) { /* 36 */ } } -void GrepNotArray(void) { /* 37 */ +static void GrepNotArray(void) { /* 37 */ /* 配列の値が val と等しくなければ vLastMatch にその index を返し vResult に 1 を返す @@ -882,7 +883,7 @@ void GrepNotArray(void) { /* 37 */ } } -void GrepEquArray2(void) { /* 38 */ +static void GrepEquArray2(void) { /* 38 */ int p1 = getCaliValue(); int p2 = getCaliValue(); int p3 = getCaliValue(); @@ -894,7 +895,7 @@ void GrepEquArray2(void) { /* 38 */ DEBUG_COMMAND_YET("ShArray.GrepEquArray2: %d,%d,%d,%d,%d,%d,%d:\n", p1, p2, p3, p4, p5, p6, p7); } -void GrepNotArray2(void) { /* 39 */ +static void GrepNotArray2(void) { /* 39 */ int p1 = getCaliValue(); int p2 = getCaliValue(); int p3 = getCaliValue(); @@ -906,7 +907,7 @@ void GrepNotArray2(void) { /* 39 */ DEBUG_COMMAND_YET("ShArray.GrepNotArray2: %d,%d,%d,%d,%d,%d,%d:\n", p1, p2, p3, p4, p5, p6, p7); } -void GrepEquNotArray2(void) { /* 40 */ +static void GrepEquNotArray2(void) { /* 40 */ int p1 = getCaliValue(); int p2 = getCaliValue(); int p3 = getCaliValue(); @@ -918,7 +919,7 @@ void GrepEquNotArray2(void) { /* 40 */ DEBUG_COMMAND_YET("ShArray.GrepEquNotArray2: %d,%d,%d,%d,%d,%d,%d:\n", p1, p2, p3, p4, p5, p6, p7); } -void GrepLowArray(void) { /* 41 */ +static void GrepLowArray(void) { /* 41 */ /* 配列の値が min よりも小さければ vMatch に一致した index を返し vResult に 1 を返す @@ -950,7 +951,7 @@ void GrepLowArray(void) { /* 41 */ } } -void GrepHighArray(void) { /* 42 */ +static void GrepHighArray(void) { /* 42 */ /* 配列の値が min よりも大きければ vMatch に一致した index を返し vResult に 1 を返す @@ -982,7 +983,7 @@ void GrepHighArray(void) { /* 42 */ } } -void GrepRangeArray(void) { /* 43 */ +static void GrepRangeArray(void) { /* 43 */ /* 配列の値が max と min の間にあれば vMatch に一致した index を返し vResult に 1 を返す @@ -1016,7 +1017,7 @@ void GrepRangeArray(void) { /* 43 */ } } -void GrepLowOrderArray(void) { /* 44 */ +static void GrepLowOrderArray(void) { /* 44 */ /* 配列 vAry の中で minよりも大きく、 max よりも小さいもの のうち、最も小さいものの index を vLastMatch に返す。 @@ -1067,7 +1068,7 @@ void GrepLowOrderArray(void) { /* 44 */ } -void GrepHighOrderArray(void) { /* 45 */ +static void GrepHighOrderArray(void) { /* 45 */ /* 配列 vAry の中で minよりも大きく、 max よりも小さいもの のうち、最も大きいものの index を vLastMatch に返す。 @@ -1117,7 +1118,7 @@ void GrepHighOrderArray(void) { /* 45 */ } } -void ChangeEquArray(void) { /* 46 */ +static void ChangeEquArray(void) { /* 46 */ int *vAry = getCaliVariable(); int cnt = getCaliValue(); int src = getCaliValue(); @@ -1134,7 +1135,7 @@ void ChangeEquArray(void) { /* 46 */ } } -void ChangeNotArray(void) { /* 47 */ +static void ChangeNotArray(void) { /* 47 */ int p1 = getCaliValue(); int p2 = getCaliValue(); int p3 = getCaliValue(); @@ -1143,7 +1144,7 @@ void ChangeNotArray(void) { /* 47 */ DEBUG_COMMAND_YET("ShArray.ChangeNotArray: %d,%d,%d,%d:\n", p1, p2, p3, p4); } -void ChangeLowArray(void) { /* 48 */ +static void ChangeLowArray(void) { /* 48 */ int p1 = getCaliValue(); int p2 = getCaliValue(); int p3 = getCaliValue(); @@ -1152,7 +1153,7 @@ void ChangeLowArray(void) { /* 48 */ DEBUG_COMMAND_YET("ShArray.ChangeLowArray: %d,%d,%d,%d:\n", p1, p2, p3, p4); } -void ChangeHighArray(void) { /* 49 */ +static void ChangeHighArray(void) { /* 49 */ int p1 = getCaliValue(); int p2 = getCaliValue(); int p3 = getCaliValue(); @@ -1161,7 +1162,7 @@ void ChangeHighArray(void) { /* 49 */ DEBUG_COMMAND_YET("ShArray.ChangeHighArray: %d,%d,%d,%d:\n", p1, p2, p3, p4); } -void ChangeRangeArray(void) { /* 50 */ +static void ChangeRangeArray(void) { /* 50 */ /* 配列内データが min から max の間にあるときは val で置き換え @@ -1188,7 +1189,7 @@ void ChangeRangeArray(void) { /* 50 */ } } -void CopyArrayToRect(void) { /* 51 */ +static void CopyArrayToRect(void) { /* 51 */ /* vSrc の sw * sh の領域を vDst の dx,dy の位置にコピー @@ -1222,7 +1223,7 @@ void CopyArrayToRect(void) { /* 51 */ } } -void CopyRectToArray(void) { /* 52 */ +static void CopyRectToArray(void) { /* 52 */ /* vSrc の sw * sh の領域を vDst の dx,dy の位置にコピー @@ -1256,7 +1257,7 @@ void CopyRectToArray(void) { /* 52 */ } } -void ChangeSecretArray(void) { /* 53 */ +static void ChangeSecretArray(void) { /* 53 */ /* 良く分からないが、データをコード化しているようだ @@ -1340,3 +1341,62 @@ void ChangeSecretArray(void) { /* 53 */ break; } } + +static const ModuleFunc functions[] = { + {"AddAtArray", AddAtArray}, + {"AndAndEquArray", AndAndEquArray}, + {"AndEquArray", AndEquArray}, + {"AndHighArray", AndHighArray}, + {"AndLowArray", AndLowArray}, + {"AndNotArray", AndNotArray}, + {"AndNumArray", AndNumArray}, + {"AndRangeArray", AndRangeArray}, + {"ChangeEquArray", ChangeEquArray}, + {"ChangeHighArray", ChangeHighArray}, + {"ChangeLowArray", ChangeLowArray}, + {"ChangeNotArray", ChangeNotArray}, + {"ChangeRangeArray", ChangeRangeArray}, + {"ChangeSecretArray", ChangeSecretArray}, + {"CopyArrayToRect", CopyArrayToRect}, + {"CopyRectToArray", CopyRectToArray}, + {"DivAtArray", DivAtArray}, + {"EnumEquArray", EnumEquArray}, + {"EnumEquArray2", EnumEquArray2}, + {"EnumEquNotArray2", EnumEquNotArray2}, + {"EnumHighArray", EnumHighArray}, + {"EnumLowArray", EnumLowArray}, + {"EnumNotArray", EnumNotArray}, + {"EnumNotArray2", EnumNotArray2}, + {"EnumRangeArray", EnumRangeArray}, + {"GetAtArray", GetAtArray}, + {"GrepEquArray", GrepEquArray}, + {"GrepEquArray2", GrepEquArray2}, + {"GrepEquNotArray2", GrepEquNotArray2}, + {"GrepHighArray", GrepHighArray}, + {"GrepHighOrderArray", GrepHighOrderArray}, + {"GrepLowArray", GrepLowArray}, + {"GrepLowOrderArray", GrepLowOrderArray}, + {"GrepNotArray", GrepNotArray}, + {"GrepNotArray2", GrepNotArray2}, + {"GrepRangeArray", GrepRangeArray}, + {"MaxAtArray", MaxAtArray}, + {"MinAtArray", MinAtArray}, + {"MulAtArray", MulAtArray}, + {"OrAndEquArray", OrAndEquArray}, + {"OrEquArray", OrEquArray}, + {"OrHighArray", OrHighArray}, + {"OrLowArray", OrLowArray}, + {"OrNotArray", OrNotArray}, + {"OrNumArray", OrNumArray}, + {"OrRangeArray", OrRangeArray}, + {"SetAndEquArray", SetAndEquArray}, + {"SetEquArray", SetEquArray}, + {"SetHighArray", SetHighArray}, + {"SetLowArray", SetLowArray}, + {"SetNotArray", SetNotArray}, + {"SetRangeArray", SetRangeArray}, + {"SubAtArray", SubAtArray}, + {"XorNumArray", XorNumArray}, +}; + +const Module module_ShArray = {"ShArray", functions, sizeof(functions) / sizeof(ModuleFunc)}; diff --git a/modules/ShCalc/CMakeLists.txt b/modules/ShCalc/CMakeLists.txt deleted file mode 100644 index b1bf505..0000000 --- a/modules/ShCalc/CMakeLists.txt +++ /dev/null @@ -1,3 +0,0 @@ -add_library(ShCalc MODULE ShCalc.c) - -install(TARGETS ShCalc DESTINATION lib/xsystem35) diff --git a/modules/ShCalc/ShCalc.c b/modules/ShCalc/ShCalc.c index d29d44e..4bade56 100644 --- a/modules/ShCalc/ShCalc.c +++ b/modules/ShCalc/ShCalc.c @@ -34,6 +34,7 @@ #include "nact.h" #include "system.h" #include "xsystem35.h" +#include "modules.h" #include "randMT.h" static int numbase; @@ -51,7 +52,7 @@ static int64_t div64(int64_t a1, int64_t a2) { return a1 / a2; } -void SetIntNumBase(void) { /* 0 */ +static void SetIntNumBase(void) { /* 0 */ /* 64 bit 演算のための倍数をセット @@ -65,7 +66,7 @@ void SetIntNumBase(void) { /* 0 */ } -void SetIntNum16(void) { /* 1 */ +static void SetIntNum16(void) { /* 1 */ /* 64 bit 演算のための数値をセット @@ -78,13 +79,13 @@ void SetIntNum16(void) { /* 1 */ DEBUG_COMMAND("ShCalc.SetIntNum16 %p:\n", var); } -void SetIntNum32(void) { /* 2 */ +static void SetIntNum32(void) { /* 2 */ int p1 = getCaliValue(); DEBUG_COMMAND_YET("ShCalc.SetIntNum32: %d:\n", p1); } -void GetIntNum16(void) { /* 3 */ +static void GetIntNum16(void) { /* 3 */ /* 64 bit 演算した結果を得る @@ -104,13 +105,13 @@ void GetIntNum16(void) { /* 3 */ DEBUG_COMMAND("ShCalc.GetIntNum16 %d:\n", var); } -void GetIntNum32(void) { /* 4 */ +static void GetIntNum32(void) { /* 4 */ int p1 = getCaliValue(); DEBUG_COMMAND_YET("ShCalc.GetIntNum32: %d:\n", p1); } -void AddIntNum16(void) { /* 5 */ +static void AddIntNum16(void) { /* 5 */ /* 64 bit 加算 @@ -123,25 +124,25 @@ void AddIntNum16(void) { /* 5 */ DEBUG_COMMAND("ShCalc.AddIntNum16 %p:\n", var); } -void AddIntNum32(void) { /* 6 */ +static void AddIntNum32(void) { /* 6 */ int p1 = getCaliValue(); DEBUG_COMMAND_YET("ShCalc.AddIntNum32: %d:\n", p1); } -void SubIntNum16(void) { /* 7 */ +static void SubIntNum16(void) { /* 7 */ int p1 = getCaliValue(); DEBUG_COMMAND_YET("ShCalc.SubIntNum16: %d:\n", p1); } -void SubIntNum32(void) { /* 8 */ +static void SubIntNum32(void) { /* 8 */ int p1 = getCaliValue(); DEBUG_COMMAND_YET("ShCalc.SubIntNum32: %d:\n", p1); } -void MulIntNum16(void) { /* 9 */ +static void MulIntNum16(void) { /* 9 */ /* 64 bit 乗算 @@ -154,13 +155,13 @@ void MulIntNum16(void) { /* 9 */ DEBUG_COMMAND("ShCalc.MulIntNum16: %p:\n", var); } -void MulIntNum32(void) { /* 10 */ +static void MulIntNum32(void) { /* 10 */ int p1 = getCaliValue(); DEBUG_COMMAND_YET("ShCalc.MulIntNum32: %d:\n", p1); } -void DivIntNum16(void) { /* 11 */ +static void DivIntNum16(void) { /* 11 */ /* 64 bit 除算 @@ -177,13 +178,13 @@ void DivIntNum16(void) { /* 11 */ DEBUG_COMMAND("ShCalc.DivIntNum16 %p:\n", var); } -void DivIntNum32(void) { /* 12 */ +static void DivIntNum32(void) { /* 12 */ int p1 = getCaliValue(); DEBUG_COMMAND_YET("ShCalc.DivIntNum32: %d:\n", p1); } -void CmpIntNum16(void) { /* 13 */ +static void CmpIntNum16(void) { /* 13 */ int p1 = getCaliValue(); int p2 = getCaliValue(); int p3 = getCaliValue(); @@ -191,7 +192,7 @@ void CmpIntNum16(void) { /* 13 */ DEBUG_COMMAND_YET("ShCalc.CmpIntNum16: %d,%d,%d:\n", p1, p2, p3); } -void CmpIntNum32(void) { /* 14 */ +static void CmpIntNum32(void) { /* 14 */ int p1 = getCaliValue(); int p2 = getCaliValue(); int p3 = getCaliValue(); @@ -199,7 +200,7 @@ void CmpIntNum32(void) { /* 14 */ DEBUG_COMMAND_YET("ShCalc.CmpIntNum32: %d,%d,%d:\n", p1, p2, p3); } -void GetLengthNum16(void) { /* 15 */ +static void GetLengthNum16(void) { /* 15 */ /* 数値の桁数を返す var: 数値 @@ -223,14 +224,14 @@ void GetLengthNum16(void) { /* 15 */ DEBUG_COMMAND("ShCalc.GetLengthNum16 %p,%p:\n", var, vResult); } -void GetLengthNum32(void) { /* 16 */ +static void GetLengthNum32(void) { /* 16 */ int p1 = getCaliValue(); int p2 = getCaliValue(); DEBUG_COMMAND_YET("ShCalc.GetLengthNum32: %d,%d:\n", p1, p2); } -void NumToRate(void) { /* 17 */ +static void NumToRate(void) { /* 17 */ /* p1 * (p3/p2) の演算結果を返す。 @@ -262,7 +263,7 @@ void NumToRate(void) { /* 17 */ } -void NumToRateNum(void) { /* 18 */ +static void NumToRateNum(void) { /* 18 */ /* p1 * (p2/p3) の演算結果を返す。 @@ -293,7 +294,7 @@ void NumToRateNum(void) { /* 18 */ DEBUG_COMMAND("ShCalc.NumToRateNum %d,%d,%d,%d,%p:\n", p1, p2, p3, flag, vResult); } -void SetRandomSeed() { +static void SetRandomSeed() { /* 乱数の種の設定 @@ -306,7 +307,7 @@ void SetRandomSeed() { DEBUG_COMMAND("ShCalc.SetRandomSeed %d:\n", seed); } -void GetRandomNumA() { +static void GetRandomNumA() { int num = getCaliValue(); int *var = getCaliVariable(); @@ -319,7 +320,7 @@ void GetRandomNumA() { DEBUG_COMMAND("ShCalc.GetRandomNumA %d,%p:\n", num, var); } -void NumToBit() { +static void NumToBit() { /* 2^(beki-1) @@ -341,7 +342,7 @@ void NumToBit() { DEBUG_COMMAND("ShCalc.NumToBit %d,%p:\n", beki, var); } -void BitToNum() { +static void BitToNum() { /* val -> var 1 -> 1 @@ -374,3 +375,31 @@ void BitToNum() { (*var)++; } } + +static const ModuleFunc functions[] = { + {"AddIntNum16", AddIntNum16}, + {"AddIntNum32", AddIntNum32}, + {"BitToNum", BitToNum}, + {"CmpIntNum16", CmpIntNum16}, + {"CmpIntNum32", CmpIntNum32}, + {"DivIntNum16", DivIntNum16}, + {"DivIntNum32", DivIntNum32}, + {"GetIntNum16", GetIntNum16}, + {"GetIntNum32", GetIntNum32}, + {"GetLengthNum16", GetLengthNum16}, + {"GetLengthNum32", GetLengthNum32}, + {"GetRandomNumA", GetRandomNumA}, + {"MulIntNum16", MulIntNum16}, + {"MulIntNum32", MulIntNum32}, + {"NumToBit", NumToBit}, + {"NumToRate", NumToRate}, + {"NumToRateNum", NumToRateNum}, + {"SetIntNum16", SetIntNum16}, + {"SetIntNum32", SetIntNum32}, + {"SetIntNumBase", SetIntNumBase}, + {"SetRandomSeed", SetRandomSeed}, + {"SubIntNum16", SubIntNum16}, + {"SubIntNum32", SubIntNum32}, +}; + +const Module module_ShCalc = {"ShCalc", functions, sizeof(functions) / sizeof(ModuleFunc)}; diff --git a/modules/ShGraph/CMakeLists.txt b/modules/ShGraph/CMakeLists.txt deleted file mode 100644 index 8b14e8b..0000000 --- a/modules/ShGraph/CMakeLists.txt +++ /dev/null @@ -1,3 +0,0 @@ -add_library(ShGraph MODULE ShGraph.c) - -install(TARGETS ShGraph DESTINATION lib/xsystem35) diff --git a/modules/ShGraph/ShGraph.c b/modules/ShGraph/ShGraph.c index 5405504..ad2bbb6 100644 --- a/modules/ShGraph/ShGraph.c +++ b/modules/ShGraph/ShGraph.c @@ -32,6 +32,7 @@ #include "portab.h" #include "system.h" #include "xsystem35.h" +#include "modules.h" #include "nact.h" #include "ags.h" #include "counter.h" @@ -89,7 +90,7 @@ static struct _s2 s2[SLOT]; static int* add_p5[SLOT]; /* どこまでアニメーションのコマが進んだか */ -void Init() { +static void Init() { /* モジュール初期化 */ @@ -98,13 +99,13 @@ void Init() { DEBUG_COMMAND("ShGraph.Init %d:\n", p1); } -void GetSurfaceData() { +static void GetSurfaceData() { int p1 = getCaliValue(); /* ISurface */ DEBUG_COMMAND_YET("ShGraph.GetSurfaceData %d:\n", p1); } -void ChangeEquColor() { +static void ChangeEquColor() { int p1 = getCaliValue(); int p2 = getCaliValue(); int p3 = getCaliValue(); @@ -116,7 +117,7 @@ void ChangeEquColor() { DEBUG_COMMAND_YET("ShGraph.ChangeEquColor %d,%d,%d,%d,%p,%p,%d:\n", p1, p2, p3, p4, p5, p6, p7); } -void ChangeNotColor() { +static void ChangeNotColor() { /* 指定の領域が src と等しくなければ dst に塗りつぶす @@ -228,7 +229,7 @@ void ChangeNotColor() { lastslotが0の場合は 7 で指定したところまで。 */ -void ResetAnimeData() { +static void ResetAnimeData() { /* アニメーション用の各種データをクリア @@ -253,7 +254,7 @@ void ResetAnimeData() { } -void SetAnimeSrc() { +static void SetAnimeSrc() { /* アニメーションの各パターンのソース領域の設定 @@ -296,7 +297,7 @@ void SetAnimeSrc() { src[no].b = b; } -void SetAnimeDst() { +static void SetAnimeDst() { /* アニメーションの描画先設定 @@ -331,7 +332,7 @@ void SetAnimeDst() { s2[no].w_1000A8A2 = 0; } -void AddAnimeData() { +static void AddAnimeData() { /* アニメーション各種設定 @@ -375,7 +376,7 @@ void AddAnimeData() { add_p5[i] = p5; } -void AddAnimeRemain() { +static void AddAnimeRemain() { /* アニメーション各種設定 @@ -401,7 +402,7 @@ void AddAnimeRemain() { } } -void SetAnimeRect() { +static void SetAnimeRect() { /* アニメーション描画領域設定 @@ -423,7 +424,7 @@ void SetAnimeRect() { maprect.height = h; } -void SetAnimeBack() { +static void SetAnimeBack() { /* アニメーション背景領域設定 @@ -451,7 +452,7 @@ void SetAnimeBack() { mapback_p6 = p6; } -void PlayAnimeData() { +static void PlayAnimeData() { /* 実際にアニメーションを実行 @@ -641,3 +642,20 @@ static void copy_sprite(int sx, int sy, int width, int height, int dx, int dy, i } } } + +static const ModuleFunc functions[] = { + {"AddAnimeData", AddAnimeData}, + {"AddAnimeRemain", AddAnimeRemain}, + {"ChangeEquColor", ChangeEquColor}, + {"ChangeNotColor", ChangeNotColor}, + {"GetSurfaceData", GetSurfaceData}, + {"Init", Init}, + {"PlayAnimeData", PlayAnimeData}, + {"ResetAnimeData", ResetAnimeData}, + {"SetAnimeBack", SetAnimeBack}, + {"SetAnimeDst", SetAnimeDst}, + {"SetAnimeRect", SetAnimeRect}, + {"SetAnimeSrc", SetAnimeSrc}, +}; + +const Module module_ShGraph = {"ShGraph", functions, sizeof(functions) / sizeof(ModuleFunc)}; diff --git a/modules/ShPort/CMakeLists.txt b/modules/ShPort/CMakeLists.txt deleted file mode 100644 index 09d0e24..0000000 --- a/modules/ShPort/CMakeLists.txt +++ /dev/null @@ -1,3 +0,0 @@ -add_library(ShPort MODULE ShPort.c) - -install(TARGETS ShPort DESTINATION lib/xsystem35) diff --git a/modules/ShPort/ShPort.c b/modules/ShPort/ShPort.c index ddca4e0..dede7e1 100644 --- a/modules/ShPort/ShPort.c +++ b/modules/ShPort/ShPort.c @@ -34,13 +34,14 @@ #include "nact.h" #include "system.h" #include "xsystem35.h" +#include "modules.h" #include "graphicsdevice.h" // キー変換テーブル #define KEYMAP_MAX 8 static BYTE *keymap[KEYMAP_MAX]; -void OutputMessageBox(void) { /* 0 */ +static void OutputMessageBox(void) { /* 0 */ int p1 = getCaliValue(); int p2 = getCaliValue(); int p3 = getCaliValue(); @@ -51,7 +52,7 @@ void OutputMessageBox(void) { /* 0 */ DEBUG_COMMAND_YET("ShPort.OutputMessageBox: %d,%d,%d,%d,%d,%d:\n", p1, p2, p3, p3, p4, p5, p6); } -void InputListNum(void) { /* 1 */ +static void InputListNum(void) { /* 1 */ int p1 = getCaliValue(); int p2 = getCaliValue(); int p3 = getCaliValue(); @@ -68,7 +69,7 @@ void InputListNum(void) { /* 1 */ * ShPortサブシステム全体の初期化 * @param p1: ISys3x */ -void Init(void) { +static void Init(void) { int p1 = getCaliValue(); DEBUG_COMMAND_YET("ShPort.Init: %d:\n", p1); @@ -79,7 +80,7 @@ void Init(void) { * 指定のキーコードマップの初期化 * @param no: キーコードマップの番号(1~) */ -void InitKeyStatus(void) { +static void InitKeyStatus(void) { int no = getCaliValue(); if (no >= KEYMAP_MAX) { @@ -103,7 +104,7 @@ void InitKeyStatus(void) { * @param key: キーコード * @param func: 機能キーコード */ -void SetKeyStatus(void) { +static void SetKeyStatus(void) { int no = getCaliValue(); int key = getCaliValue(); int func = getCaliValue(); @@ -124,7 +125,7 @@ void SetKeyStatus(void) { * @param no: マップ番号 * @param var: 押下キーに対応する機能コードを返す変数 */ -void GetKeyStatus(void) { +static void GetKeyStatus(void) { int no = getCaliValue(); int *var = getCaliVariable(); int i; @@ -142,7 +143,7 @@ void GetKeyStatus(void) { DEBUG_COMMAND("ShPort.GetKeyStatus: %d,%p:\n", no, var); } -void InputListString(void) { +static void InputListString(void) { int p1 = getCaliValue(); int p2 = getCaliValue(); int p3 = getCaliValue(); @@ -154,7 +155,7 @@ void InputListString(void) { DEBUG_COMMAND_YET("ShPort.InputListString: %d,%d,%d,%d,%d,%d,%d:\n", p1, p2, p3, p3, p4, p5, p6, p7); } -void InputOpenFile(void) { +static void InputOpenFile(void) { int p1 = getCaliValue(); int p2 = getCaliValue(); int p3 = getCaliValue(); @@ -166,7 +167,7 @@ void InputOpenFile(void) { DEBUG_COMMAND_YET("ShPort.InputOpenFile: %d,%d,%d,%d,%d,%d,%d:\n", p1, p2, p3, p3, p4, p5, p6, p7); } -void InputSaveFile(void) { +static void InputSaveFile(void) { int p1 = getCaliValue(); int p2 = getCaliValue(); int p3 = getCaliValue(); @@ -178,3 +179,16 @@ void InputSaveFile(void) { DEBUG_COMMAND_YET("ShPort.InputSaveFile: %d,%d,%d,%d,%d,%d,%d:\n", p1, p2, p3, p3, p4, p5, p6, p7); } +static const ModuleFunc functions[] = { + {"GetKeyStatus", GetKeyStatus}, + {"Init", Init}, + {"InitKeyStatus", InitKeyStatus}, + {"InputListNum", InputListNum}, + {"InputListString", InputListString}, + {"InputOpenFile", InputOpenFile}, + {"InputSaveFile", InputSaveFile}, + {"OutputMessageBox", OutputMessageBox}, + {"SetKeyStatus", SetKeyStatus}, +}; + +const Module module_ShPort = {"ShPort", functions, sizeof(functions) / sizeof(ModuleFunc)}; diff --git a/modules/ShSound/CMakeLists.txt b/modules/ShSound/CMakeLists.txt deleted file mode 100644 index 6927ed2..0000000 --- a/modules/ShSound/CMakeLists.txt +++ /dev/null @@ -1,6 +0,0 @@ -add_library(ShSound MODULE ShSound.c) -if (SDL2MIXER_FOUND) - target_link_libraries(ShSound PRIVATE PkgConfig::SDL2MIXER) -endif() - -install(TARGETS ShSound DESTINATION lib/xsystem35) diff --git a/modules/ShSound/ShSound.c b/modules/ShSound/ShSound.c index f880a71..9cc6ade 100644 --- a/modules/ShSound/ShSound.c +++ b/modules/ShSound/ShSound.c @@ -29,6 +29,7 @@ #include "portab.h" #include "xsystem35.h" +#include "modules.h" #include "nact.h" #include "dri.h" #include "ald_manager.h" @@ -41,7 +42,7 @@ static Mix_Chunk *chunk; #endif -void Init() { +static void Init() { /* モジュール初期化 */ @@ -50,7 +51,7 @@ void Init() { DEBUG_COMMAND("ShSound.Init %d:\n", p1); } -void wavLoad() { +static void wavLoad() { /* 指定のスロットにPCMファイルをロード @@ -65,7 +66,7 @@ void wavLoad() { mus_wav_load(slot, no); } -void wavUnload() { +static void wavUnload() { /* 指定のスロットのPCMファイルを削除 @@ -78,7 +79,7 @@ void wavUnload() { DEBUG_COMMAND("ShSound.wavUnload %d:\n",slot); } -void wavUnloadRange() { +static void wavUnloadRange() { /* 指定のスロット(複数)のPCMファイルを削除 @@ -96,7 +97,7 @@ void wavUnloadRange() { DEBUG_COMMAND("ShSound.wavUnloadRange %d,%d:\n", slot, range); } -void wavUnloadAll() { +static void wavUnloadAll() { /* すべてのスロットのPCMファイルを削除 */ @@ -109,7 +110,7 @@ void wavUnloadAll() { DEBUG_COMMAND("ShSound.wavUnloadAll:\n"); } -void wavLoadMemory() { +static void wavLoadMemory() { /* 指定の番号の WAV ファイルをメモリ上に読み込み @@ -124,7 +125,7 @@ void wavLoadMemory() { DEBUG_COMMAND("ShSound.wavLoadMemory %d:\n", no); } -void wavSendMemory() { +static void wavSendMemory() { /* wavLoadMemory で読み込んだデータを指定のスロットに投入 @@ -142,7 +143,7 @@ void wavSendMemory() { DEBUG_COMMAND("ShSound.wavSendMemory %d:\n", slot); } -void wavFadeVolumeMemory() { +static void wavFadeVolumeMemory() { /* wavLoadMemory で読み込んだデータのボリュームのフェード @@ -161,7 +162,7 @@ void wavFadeVolumeMemory() { DEBUG_COMMAND("ShSound.wavFadeVolumeMemory %d,%d:\n", start, range); } -void wavReversePanMemory() { +static void wavReversePanMemory() { /* wavLoadMemoryで読み込んだデータの左右のチャンネルを反転 */ @@ -175,7 +176,7 @@ void wavReversePanMemory() { DEBUG_COMMAND("ShSound.wavReversePanMemory:\n"); } -void wavPlay() { +static void wavPlay() { /* 指定のスロットのPCMを再生 @@ -190,7 +191,7 @@ void wavPlay() { DEBUG_COMMAND("ShSound.wavPlay %d, %d:\n", slot, loop); } -void wavPlayRing() { +static void wavPlayRing() { /* 指定の範囲のスロットのPCMを呼ばれる毎に繰り返し @@ -208,7 +209,7 @@ void wavPlayRing() { DEBUG_COMMAND("ShSound.wavPlayRing %d,%d,%d:\n", start, cnt, *cur); } -void wavStop() { +static void wavStop() { /* 指定のスロットの再生を停止 @@ -221,7 +222,7 @@ void wavStop() { mus_wav_stop(slot); } -void wavStopAll() { +static void wavStopAll() { /* 全てのスロットの再生を停止 */ @@ -234,7 +235,7 @@ void wavStopAll() { DEBUG_COMMAND("ShSound.wavStopAll:\n"); } -void wavPause() { +static void wavPause() { /* 指定のスロットの再生を一時停止 @@ -245,7 +246,7 @@ void wavPause() { DEBUG_COMMAND_YET("ShSound.wavPause %d:\n", slot); } -void wavIsPlay() { +static void wavIsPlay() { /* 指定のスロットが再生中かどうかを調べる @@ -260,7 +261,7 @@ void wavIsPlay() { DEBUG_COMMAND("ShSound.wavIsPlay %d,%p:\n", slot, result); } -void wavIsPlayRange() { +static void wavIsPlayRange() { /* 指定の範囲のスロットが再生中かどうかを調べる @@ -281,3 +282,24 @@ void wavIsPlayRange() { DEBUG_COMMAND("ShSound.wavIsPlayRange %d,%d,%p:\n", slot, range, result); } + +static const ModuleFunc functions[] = { + {"Init", Init}, + {"wavFadeVolumeMemory", wavFadeVolumeMemory}, + {"wavIsPlay", wavIsPlay}, + {"wavIsPlayRange", wavIsPlayRange}, + {"wavLoad", wavLoad}, + {"wavLoadMemory", wavLoadMemory}, + {"wavPause", wavPause}, + {"wavPlay", wavPlay}, + {"wavPlayRing", wavPlayRing}, + {"wavReversePanMemory", wavReversePanMemory}, + {"wavSendMemory", wavSendMemory}, + {"wavStop", wavStop}, + {"wavStopAll", wavStopAll}, + {"wavUnload", wavUnload}, + {"wavUnloadAll", wavUnloadAll}, + {"wavUnloadRange", wavUnloadRange}, +}; + +const Module module_ShSound = {"ShSound", functions, sizeof(functions) / sizeof(ModuleFunc)}; diff --git a/modules/ShString/CMakeLists.txt b/modules/ShString/CMakeLists.txt deleted file mode 100644 index 3e7af6f..0000000 --- a/modules/ShString/CMakeLists.txt +++ /dev/null @@ -1,3 +0,0 @@ -add_library(ShString MODULE ShString.c) - -install(TARGETS ShString DESTINATION lib/xsystem35) diff --git a/modules/ShString/ShString.c b/modules/ShString/ShString.c index 608d859..06e0495 100644 --- a/modules/ShString/ShString.c +++ b/modules/ShString/ShString.c @@ -34,10 +34,11 @@ #include "nact.h" #include "system.h" #include "xsystem35.h" +#include "modules.h" #include "variable.h" #include "ags.h" -void ExchangeString(void) { +static void ExchangeString(void) { /* 文字列(target)中の一部(pat)を別の文字列(patr)で置き換える */ @@ -66,35 +67,35 @@ void ExchangeString(void) { v_strcpy(target -1, dst); } -void SetNum16String(void) { /* 1 */ +static void SetNum16String(void) { /* 1 */ int p1 = getCaliValue(); int p2 = getCaliValue(); DEBUG_COMMAND_YET("ShString.SetNum16String: %d,%d:\n", p1, p2); } -void SetNum16HalfString(void) { /* 2 */ +static void SetNum16HalfString(void) { /* 2 */ int p1 = getCaliValue(); int p2 = getCaliValue(); DEBUG_COMMAND_YET("ShString.SetNum16HalfString: %d,%d:\n", p1, p2); } -void SetNum32String(void) { /* 3 */ +static void SetNum32String(void) { /* 3 */ int p1 = getCaliValue(); int p2 = getCaliValue(); DEBUG_COMMAND_YET("ShString.SetNum32String: %d,%d:\n", p1, p2); } -void SetNum32HalfString(void) { /* 4 */ +static void SetNum32HalfString(void) { /* 4 */ int p1 = getCaliValue(); int p2 = getCaliValue(); DEBUG_COMMAND_YET("ShString.SetNum32HalfString: %d,%d:\n", p1, p2); } -void GetArrayString(void) { /* 5 */ +static void GetArrayString(void) { /* 5 */ int p1 = getCaliValue(); int p2 = getCaliValue(); int p3 = getCaliValue(); @@ -102,7 +103,7 @@ void GetArrayString(void) { /* 5 */ DEBUG_COMMAND_YET("ShString.GetArrayString: %d,%d,%d:\n", p1, p2, p3); } -void SetWindowTitle(void) { /* 6 */ +static void SetWindowTitle(void) { /* 6 */ int strno = getCaliValue(); int p2 = getCaliValue(); /* ISys3xSystem */ @@ -111,7 +112,7 @@ void SetWindowTitle(void) { /* 6 */ DEBUG_COMMAND("ShString.SetWindowTitle: %d,%d:\n", strno, p2); } -void FillString() { +static void FillString() { /* 指定の番号の文字列を他の文字列にコピー @@ -133,7 +134,7 @@ void FillString() { DEBUG_COMMAND("ShString.FillString: %d,%d,%d,%d:\n", st, cnt, src, p4); } -void SetStringNum16(void) { +static void SetStringNum16(void) { /* 文字列を数値に変換 大文字、小文字、混在可 @@ -173,9 +174,24 @@ void SetStringNum16(void) { *var = atoi(_dst); } -void SetStringNum32(void) { +static void SetStringNum32(void) { int p1 = getCaliValue(); int *p2 = getCaliVariable(); DEBUG_COMMAND_YET("ShString.SetStringNum32: %d,%p:\n", p1, p2); } + +static const ModuleFunc functions[] = { + {"ExchangeString", ExchangeString}, + {"FillString", FillString}, + {"GetArrayString", GetArrayString}, + {"SetNum16HalfString", SetNum16HalfString}, + {"SetNum16String", SetNum16String}, + {"SetNum32HalfString", SetNum32HalfString}, + {"SetNum32String", SetNum32String}, + {"SetStringNum16", SetStringNum16}, + {"SetStringNum32", SetStringNum32}, + {"SetWindowTitle", SetWindowTitle}, +}; + +const Module module_ShString = {"ShString", functions, sizeof(functions) / sizeof(ModuleFunc)}; diff --git a/modules/dDemo/CMakeLists.txt b/modules/dDemo/CMakeLists.txt deleted file mode 100644 index c01e40b..0000000 --- a/modules/dDemo/CMakeLists.txt +++ /dev/null @@ -1,5 +0,0 @@ -add_library(dDemo MODULE dDemo.c) - -target_link_libraries(dDemo PRIVATE graph alk) - -install(TARGETS dDemo DESTINATION lib/xsystem35) diff --git a/modules/dDemo/dDemo.c b/modules/dDemo/dDemo.c index 165d758..144aaff 100644 --- a/modules/dDemo/dDemo.c +++ b/modules/dDemo/dDemo.c @@ -7,6 +7,7 @@ #include "portab.h" #include "system.h" #include "xsystem35.h" +#include "modules.h" #include "nact.h" #include "input.h" #include "music.h" @@ -17,7 +18,7 @@ static struct ddemo dd; #include "scene.c" #endif -void Init() { +static void Init() { int p1 = getCaliValue(); int p2 = getCaliValue(); int p3 = getCaliValue(); @@ -31,20 +32,20 @@ void Init() { DEBUG_COMMAND_YET("dDemo.Init %d,%d,%d,%p:\n", p1, p2, p3, var); } -void SetKeyCancelFlag() { +static void SetKeyCancelFlag() { int cancelflag = getCaliValue(); DEBUG_COMMAND_YET("dDemo.SetKeyCancelFlag %d:\n", cancelflag); } -void SetLoopFlag() { +static void SetLoopFlag() { /* Loop Flag */ int loopflag = getCaliValue(); /* 0 なら無限繰り返し */ DEBUG_COMMAND_YET("dDemo.SetLoopFlag %d:\n", loopflag); } -void Run() { +static void Run() { DEBUG_COMMAND_YET("dDemo.Run:\n"); #ifdef DDEMODEV @@ -58,3 +59,12 @@ void Run() { mus_cdrom_stop(); #endif } + +static const ModuleFunc functions[] = { + {"Init", Init}, + {"Run", Run}, + {"SetKeyCancelFlag", SetKeyCancelFlag}, + {"SetLoopFlag", SetLoopFlag}, +}; + +const Module module_dDemo = {"dDemo", functions, sizeof(functions) / sizeof(ModuleFunc)}; diff --git a/modules/eDemo/CMakeLists.txt b/modules/eDemo/CMakeLists.txt deleted file mode 100644 index f0f6b32..0000000 --- a/modules/eDemo/CMakeLists.txt +++ /dev/null @@ -1,3 +0,0 @@ -add_library(eDemo MODULE eDemo.c) - -install(TARGETS eDemo DESTINATION lib/xsystem35) diff --git a/modules/eDemo/eDemo.c b/modules/eDemo/eDemo.c index f0d1b4a..ed02284 100644 --- a/modules/eDemo/eDemo.c +++ b/modules/eDemo/eDemo.c @@ -5,10 +5,11 @@ #include "portab.h" #include "system.h" #include "xsystem35.h" +#include "modules.h" #include "nact.h" -void Init() { +static void Init() { int p1 = getCaliValue(); int p2 = getCaliValue(); int p3 = getCaliValue(); @@ -19,26 +20,36 @@ void Init() { DEBUG_COMMAND_YET("eDEMO.Init %d,%d,%d,%p:\n", p1, p2, p3, var); } -void SetKeyCancelFlag() { +static void SetKeyCancelFlag() { int cancelflag = getCaliValue(); DEBUG_COMMAND_YET("eDEMO.SetKeyCancelFlag %d:\n", cancelflag); } -void SetLoopFlag() { +static void SetLoopFlag() { /* Loop Flag */ int loopflag = getCaliValue(); /* 0 なら無限繰り返し */ DEBUG_COMMAND_YET("eDEMO.SetLoopFlag %d:\n", loopflag); } -void SetDrawStaffFlag() { +static void SetDrawStaffFlag() { /* Loop Flag */ int staffflag = getCaliValue(); DEBUG_COMMAND_YET("eDEMO.SetDrawStaffFlag %d:\n", staffflag); } -void Run() { +static void Run() { DEBUG_COMMAND_YET("eDEMO.Run:\n"); } + +static const ModuleFunc functions[] = { + {"Init", Init}, + {"Run", Run}, + {"SetDrawStaffFlag", SetDrawStaffFlag}, + {"SetKeyCancelFlag", SetKeyCancelFlag}, + {"SetLoopFlag", SetLoopFlag}, +}; + +const Module module_eDemo = {"eDemo", functions, sizeof(functions) / sizeof(ModuleFunc)}; diff --git a/modules/eeDemo/CMakeLists.txt b/modules/eeDemo/CMakeLists.txt deleted file mode 100644 index 6259197..0000000 --- a/modules/eeDemo/CMakeLists.txt +++ /dev/null @@ -1,3 +0,0 @@ -add_library(eeDemo MODULE eeDemo.c) - -install(TARGETS eeDemo DESTINATION lib/xsystem35) diff --git a/modules/eeDemo/eeDemo.c b/modules/eeDemo/eeDemo.c index 9ba3eeb..db40078 100644 --- a/modules/eeDemo/eeDemo.c +++ b/modules/eeDemo/eeDemo.c @@ -5,10 +5,11 @@ #include "portab.h" #include "system.h" #include "xsystem35.h" +#include "modules.h" #include "nact.h" -void Init() { +static void Init() { int p1 = getCaliValue(); int p2 = getCaliValue(); int p3 = getCaliValue(); @@ -19,21 +20,30 @@ void Init() { DEBUG_COMMAND_YET("eeDEMO.Init %d,%d,%d,%p:\n", p1, p2, p3, var); } -void SetKeyCancelFlag() { +static void SetKeyCancelFlag() { int cancelflag = getCaliValue(); DEBUG_COMMAND_YET("eeDEMO.SetKeyCancelFlag %d:\n", cancelflag); } -void SetLoopFlag() { +static void SetLoopFlag() { /* Loop Flag */ int loopflag = getCaliValue(); /* 0 なら無限繰り返し */ DEBUG_COMMAND_YET("eeDEMO.SetLoopFlag %d:\n", loopflag); } -void Run() { +static void Run() { int p1 = getCaliValue(); DEBUG_COMMAND_YET("eeDEMO.Run %d:\n", p1); } + +static const ModuleFunc functions[] = { + {"Init", Init}, + {"Run", Run}, + {"SetKeyCancelFlag", SetKeyCancelFlag}, + {"SetLoopFlag", SetLoopFlag}, +}; + +const Module module_eeDemo = {"eeDemo", functions, sizeof(functions) / sizeof(ModuleFunc)}; diff --git a/modules/lib/CMakeLists.txt b/modules/lib/CMakeLists.txt index 218ab87..766099c 100644 --- a/modules/lib/CMakeLists.txt +++ b/modules/lib/CMakeLists.txt @@ -1,5 +1,3 @@ -set(CMAKE_POSITION_INDEPENDENT_CODE ON) - add_library(graph STATIC graph.c surface.c diff --git a/modules/modules.c b/modules/modules.c new file mode 100644 index 0000000..547e226 --- /dev/null +++ b/modules/modules.c @@ -0,0 +1,84 @@ +/* + * Copyright (C) 2020 + * + * 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 +#include + +#include "system.h" +#include "s39ain.h" +#include "modules.h" + +static const Module *modules[] = { + &module_AliceLogo, + &module_Confirm, + &module_Gpx, + &module_Math, + &module_MsgSkip, + // &module_NIGHTDLL, + &module_NightDemonDemo, + &module_RandMT, + &module_SACT, + &module_ShArray, + &module_ShCalc, + &module_ShGraph, + &module_ShPort, + &module_ShSound, + &module_ShString, + &module_dDemo, + &module_eDemo, + &module_eeDemo, + &module_nDEMO, + &module_nDEMOE, + &module_oDEMO, + &module_oujimisc, + &module_tDemo, + NULL +}; + +static int compare_name(const void *f1, const void *f2) { + return strcmp(((const ModuleFunc *)f1)->name, + ((const ModuleFunc *)f2)->name); +} + +static void resolve_func(S39AIN_DLLFN *func, const Module *mod) { + ModuleFunc key = {.name = func->name}; + ModuleFunc *mf = bsearch(&key, mod->funcs, mod->nfunc, sizeof(ModuleFunc), compare_name); + + if (mf) + func->entrypoint = mf->entrypoint; + else + WARNING("Cannot resolve DLL function %s.%s\n", mod->name, func->name); +} + +int resolve_module(S39AIN_DLLINF *dll) { + if (dll->function_num == 0) + return OK; + + for (const Module **mod = modules; *mod; mod++) { + if (strcasecmp((*mod)->name, dll->name) == 0) { + for (int i = 0; i < dll->function_num; i++) + resolve_func(&dll->function[i], *mod); + return OK; + } + } + WARNING("Cannot resolve DLL: %s\n", dll->name); + return NG; +} diff --git a/modules/modules.h b/modules/modules.h new file mode 100644 index 0000000..0b8e551 --- /dev/null +++ b/modules/modules.h @@ -0,0 +1,61 @@ +/* + * Copyright (C) 2020 + * + * 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 + * +*/ + +#ifndef __MODULES_H__ +#define __MODULES_H__ + +typedef struct { + const char *name; + void (*entrypoint)(void); +} ModuleFunc; + +typedef struct { + const char *name; + const ModuleFunc *funcs; // must be sorted by name + int nfunc; +} Module; + +extern const Module module_AliceLogo; +extern const Module module_Confirm; +extern const Module module_Gpx; +extern const Module module_Math; +extern const Module module_MsgSkip; +extern const Module module_NIGHTDLL; +extern const Module module_NightDemonDemo; +extern const Module module_RandMT; +extern const Module module_SACT; +extern const Module module_ShArray; +extern const Module module_ShCalc; +extern const Module module_ShGraph; +extern const Module module_ShPort; +extern const Module module_ShSound; +extern const Module module_ShString; +extern const Module module_dDemo; +extern const Module module_eDemo; +extern const Module module_eeDemo; +extern const Module module_nDEMO; +extern const Module module_nDEMOE; +extern const Module module_oDEMO; +extern const Module module_oujimisc; +extern const Module module_tDemo; + +struct S39AIN_DLLINF; +int resolve_module(struct S39AIN_DLLINF *dll); + +#endif /* __MODULES_H__ */ diff --git a/modules/nDEMO/CMakeLists.txt b/modules/nDEMO/CMakeLists.txt deleted file mode 100644 index 39fc0d6..0000000 --- a/modules/nDEMO/CMakeLists.txt +++ /dev/null @@ -1,3 +0,0 @@ -add_library(nDEMO MODULE nDEMO.c) - -install(TARGETS nDEMO DESTINATION lib/xsystem35) diff --git a/modules/nDEMO/nDEMO.c b/modules/nDEMO/nDEMO.c index 46afe04..f01814c 100644 --- a/modules/nDEMO/nDEMO.c +++ b/modules/nDEMO/nDEMO.c @@ -5,9 +5,10 @@ #include "portab.h" #include "system.h" #include "xsystem35.h" +#include "modules.h" #include "nact.h" -void Init() { +static void Init() { int p1 = getCaliValue(); /* ISys3x */ int p2 = getCaliValue(); /* IWinMsg */ int p3 = getCaliValue(); /* ITimer */ @@ -18,19 +19,27 @@ void Init() { DEBUG_COMMAND_YET("nDEMO.Init %p:\n", var); } -void SetKeyCancelFlag() { +static void SetKeyCancelFlag() { int p1 = getCaliValue(); DEBUG_COMMAND_YET("nDEMO.SetKeyCancelFlag %d:\n", p1); } -void SetLoopFlag() { +static void SetLoopFlag() { int p1 = getCaliValue(); DEBUG_COMMAND_YET("nDEMO.SetLoopFlag %d:\n", p1); } -void Run() { +static void Run() { DEBUG_COMMAND_YET("nDEMO.Run:\n"); } +static const ModuleFunc functions[] = { + {"Init", Init}, + {"Run", Run}, + {"SetKeyCancelFlag", SetKeyCancelFlag}, + {"SetLoopFlag", SetLoopFlag}, +}; + +const Module module_nDEMO = {"nDEMO", functions, sizeof(functions) / sizeof(ModuleFunc)}; diff --git a/modules/nDEMOE/CMakeLists.txt b/modules/nDEMOE/CMakeLists.txt deleted file mode 100644 index 8521a77..0000000 --- a/modules/nDEMOE/CMakeLists.txt +++ /dev/null @@ -1,3 +0,0 @@ -add_library(nDEMOE MODULE nDEMOE.c) - -install(TARGETS nDEMOE DESTINATION lib/xsystem35) diff --git a/modules/nDEMOE/nDEMOE.c b/modules/nDEMOE/nDEMOE.c index 8edcd46..4d01ff3 100644 --- a/modules/nDEMOE/nDEMOE.c +++ b/modules/nDEMOE/nDEMOE.c @@ -5,9 +5,10 @@ #include "portab.h" #include "system.h" #include "xsystem35.h" +#include "modules.h" #include "nact.h" -void Init() { +static void Init() { int p1 = getCaliValue(); int p2 = getCaliValue(); int p3 = getCaliValue(); @@ -16,13 +17,20 @@ void Init() { DEBUG_COMMAND_YET("nDEMOE.Init %p:\n", var); } -void SetKeyCancelFlag() { +static void SetKeyCancelFlag() { int p1 = getCaliValue(); DEBUG_COMMAND_YET("nDEMOE.SetKeyCancelFlag %d:\n", p1); } -void Run() { +static void Run() { DEBUG_COMMAND_YET("nDEMOE.Run:\n"); } +static const ModuleFunc functions[] = { + {"Init", Init}, + {"Run", Run}, + {"SetKeyCancelFlag", SetKeyCancelFlag}, +}; + +const Module module_nDEMOE = {"nDEMOE", functions, sizeof(functions) / sizeof(ModuleFunc)}; diff --git a/modules/oDEMO/CMakeLists.txt b/modules/oDEMO/CMakeLists.txt deleted file mode 100644 index 106616b..0000000 --- a/modules/oDEMO/CMakeLists.txt +++ /dev/null @@ -1,3 +0,0 @@ -add_library(oDEMO MODULE oDEMO.c) - -install(TARGETS oDEMO DESTINATION lib/xsystem35) diff --git a/modules/oDEMO/oDEMO.c b/modules/oDEMO/oDEMO.c index 626fe1a..76d6336 100644 --- a/modules/oDEMO/oDEMO.c +++ b/modules/oDEMO/oDEMO.c @@ -5,10 +5,11 @@ #include "portab.h" #include "system.h" #include "xsystem35.h" +#include "modules.h" #include "nact.h" -void Init() { +static void Init() { int p1 = getCaliValue(); int p2 = getCaliValue(); int p3 = getCaliValue(); @@ -19,19 +20,28 @@ void Init() { DEBUG_COMMAND_YET("oDEMO.Init %d,%d,%d,%p:\n", p1, p2, p3, var); } -void SetKeyCancelFlag() { +static void SetKeyCancelFlag() { int cancelflag = getCaliValue(); DEBUG_COMMAND_YET("oDEMO.SetKeyCancelFlag %d:\n", cancelflag); } -void SetLoopFlag() { +static void SetLoopFlag() { /* Loop Flag */ int loopflag = getCaliValue(); /* 0 なら無限繰り返し */ DEBUG_COMMAND_YET("oDEMO.SetLoopFlag %d:\n", loopflag); } -void Run() { +static void Run() { DEBUG_COMMAND_YET("oDEMO.Run:\n"); } + +static const ModuleFunc functions[] = { + {"Init", Init}, + {"Run", Run}, + {"SetKeyCancelFlag", SetKeyCancelFlag}, + {"SetLoopFlag", SetLoopFlag}, +}; + +const Module module_oDEMO = {"oDEMO", functions, sizeof(functions) / sizeof(ModuleFunc)}; diff --git a/modules/oujimisc/CMakeLists.txt b/modules/oujimisc/CMakeLists.txt deleted file mode 100644 index 9ddebb0..0000000 --- a/modules/oujimisc/CMakeLists.txt +++ /dev/null @@ -1,3 +0,0 @@ -add_library(oujimisc MODULE oujimisc.c) - -install(TARGETS oujimisc DESTINATION lib/xsystem35) diff --git a/modules/oujimisc/oujimisc.c b/modules/oujimisc/oujimisc.c index 14d7699..9f398ab 100644 --- a/modules/oujimisc/oujimisc.c +++ b/modules/oujimisc/oujimisc.c @@ -5,9 +5,10 @@ #include "portab.h" #include "system.h" #include "xsystem35.h" +#include "modules.h" #include "nact.h" -void MakeMapSetParam() { +static void MakeMapSetParam() { int p1 = getCaliValue(); int p2 = getCaliValue(); int p3 = getCaliValue(); @@ -16,7 +17,7 @@ void MakeMapSetParam() { DEBUG_COMMAND_YET("oujimisc.MakeMapSetParam %d,%d,%d,%d:\n", p1,p2,p3,p4); } -void MakeMapSetChipParam() { +static void MakeMapSetChipParam() { int p1 = getCaliValue(); int p2 = getCaliValue(); int p3 = getCaliValue(); @@ -27,7 +28,7 @@ void MakeMapSetChipParam() { } -void MakeMapDraw() { +static void MakeMapDraw() { int p1 = getCaliValue(); /* ISys3xDIB */ int p2 = getCaliValue(); int p3 = getCaliValue(); @@ -40,13 +41,13 @@ void MakeMapDraw() { DEBUG_COMMAND_YET("oujimisc.MakeMapDraw %d,%d,%d,%d,%d,%p,%p,%p:\n", p1,p2,p3,p4,p5,p6,p7,p8); } -void MakeMapInit() { +static void MakeMapInit() { int p1 = getCaliValue(); /* ISys3x */ DEBUG_COMMAND_YET("oujimisc.MakeMapInit %d:\n", p1); } -void DrawNumber() { +static void DrawNumber() { int p1 = getCaliValue(); /* ISys3xDIB */ int p2 = getCaliValue(); int p3 = getCaliValue(); @@ -59,18 +60,18 @@ void DrawNumber() { DEBUG_COMMAND_YET("oujimisc.DrawNumber %d,%d,%d,%d,%d,%d,%d,%d:\n", p1,p2,p3,p4,p5,p6,p7,p8); } -void TempMapCreateShadow() { +static void TempMapCreateShadow() { DEBUG_COMMAND_YET("oujimisc.TempMapCreateShadow:\n"); } -void TempMapInit() { +static void TempMapInit() { int p1 = getCaliValue(); /* ISys3x */ int p2 = getCaliValue(); DEBUG_COMMAND_YET("oujimisc.TempMapInit %d,%d:\n", p1,p2); } -void TempMapLoadToShadow() { +static void TempMapLoadToShadow() { int p1 = getCaliValue(); int *p2 = getCaliVariable(); int *p3 = getCaliVariable(); @@ -80,7 +81,7 @@ void TempMapLoadToShadow() { DEBUG_COMMAND_YET("oujimisc.TempMapLoadToShadow %d,%p,%p,%p,%d:\n", p1,p2,p3,p4,p5); } -void TempMapSaveToShadow() { +static void TempMapSaveToShadow() { int p1 = getCaliValue(); int *p2 = getCaliVariable(); int *p3 = getCaliVariable(); @@ -90,19 +91,19 @@ void TempMapSaveToShadow() { DEBUG_COMMAND_YET("oujimisc.TempMapSaveToShadow %d,%p,%p,%p,%d:\n", p1,p2,p3,p4,p5); } -void TempMapFileSave() { +static void TempMapFileSave() { int p1 = getCaliValue(); DEBUG_COMMAND_YET("oujimisc.TempMapFileSave %d:\n", p1); } -void TempMapFileLoad() { +static void TempMapFileLoad() { int p1 = getCaliValue(); DEBUG_COMMAND_YET("oujimisc.TempMapFileLoad %d:\n", p1); } -void CalcMoveDiffer() { +static void CalcMoveDiffer() { int *p1 = getCaliVariable(); int *p2 = getCaliVariable(); int p3 = getCaliValue(); @@ -114,3 +115,20 @@ void CalcMoveDiffer() { DEBUG_COMMAND_YET("oujimisc.CalcMoveDiffer %p,%p,%d,%d,%d,%d,%p,%d:\n", p1,p2,p3,p4,p5,p6,p7,p8); } + +static const ModuleFunc functions[] = { + {"CalcMoveDiffer", CalcMoveDiffer}, + {"DrawNumber", DrawNumber}, + {"MakeMapDraw", MakeMapDraw}, + {"MakeMapInit", MakeMapInit}, + {"MakeMapSetChipParam", MakeMapSetChipParam}, + {"MakeMapSetParam", MakeMapSetParam}, + {"TempMapCreateShadow", TempMapCreateShadow}, + {"TempMapFileLoad", TempMapFileLoad}, + {"TempMapFileSave", TempMapFileSave}, + {"TempMapInit", TempMapInit}, + {"TempMapLoadToShadow", TempMapLoadToShadow}, + {"TempMapSaveToShadow", TempMapSaveToShadow}, +}; + +const Module module_oujimisc = {"oujimisc", functions, sizeof(functions) / sizeof(ModuleFunc)}; diff --git a/modules/tDemo/CMakeLists.txt b/modules/tDemo/CMakeLists.txt deleted file mode 100644 index e574918..0000000 --- a/modules/tDemo/CMakeLists.txt +++ /dev/null @@ -1,3 +0,0 @@ -add_library(tDemo MODULE tDemo.c) - -install(TARGETS tDemo DESTINATION lib/xsystem35) diff --git a/modules/tDemo/tDemo.c b/modules/tDemo/tDemo.c index ccdcd05..042453e 100644 --- a/modules/tDemo/tDemo.c +++ b/modules/tDemo/tDemo.c @@ -5,9 +5,10 @@ #include "portab.h" #include "system.h" #include "xsystem35.h" +#include "modules.h" #include "nact.h" -void Init() { +static void Init() { int p1 = getCaliValue(); int p2 = getCaliValue(); int p3 = getCaliValue(); @@ -18,20 +19,28 @@ void Init() { DEBUG_COMMAND_YET("tDemo.Init %d,%d,%d,%p:\n", p1, p2, p3, var); } -void SetKeyCancelFlag() { +static void SetKeyCancelFlag() { int cancelflag = getCaliValue(); DEBUG_COMMAND_YET("tDemo.SetKeyCancelFlag %d:\n", cancelflag); } -void SetLoopFlag() { +static void SetLoopFlag() { /* Loop Flag */ int loopflag = getCaliValue(); /* 0 なら無限繰り返し */ DEBUG_COMMAND_YET("tDemo.SetLoopFlag %d:\n", loopflag); } -void Run() { +static void Run() { DEBUG_COMMAND_YET("tDemo.Run:\n"); } +static const ModuleFunc functions[] = { + {"Init", Init}, + {"Run", Run}, + {"SetKeyCancelFlag", SetKeyCancelFlag}, + {"SetLoopFlag", SetLoopFlag}, +}; + +const Module module_tDemo = {"tDemo", functions, sizeof(functions) / sizeof(ModuleFunc)}; diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index f57805f..1d40225 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -1,12 +1,3 @@ -if (ENABLE_MODULES) - set(CMAKE_BUILD_RPATH ${CMAKE_CURRENT_BINARY_DIR}/../modules) - if (APPLE) - set(CMAKE_INSTALL_RPATH @loader_path/../lib/xsystem35) - else() - set(CMAKE_INSTALL_RPATH $ORIGIN/../lib/xsystem35) - endif() -endif() - if (ANDROID) add_library(xsystem35 SHARED) else() @@ -60,10 +51,6 @@ target_sources(xsystem35 PRIVATE target_sources(xsystem35 PRIVATE network.c) -if (ENABLE_MODULES) - target_link_libraries(xsystem35 PRIVATE -rdynamic) -endif() - if (EMSCRIPTEN) set(LIBS "SHELL:-s USE_ZLIB=1 -s USE_FREETYPE=1 -s USE_SDL=2") diff --git a/src/cmd2F60.c b/src/cmd2F60.c index f64db9c..dba697a 100644 --- a/src/cmd2F60.c +++ b/src/cmd2F60.c @@ -28,12 +28,8 @@ #include "nact.h" #include "s39ain.h" #include "xsystem35.h" -#ifdef ENABLE_MODULES -#include -#endif #define dll nact->ain.dll -#define msgi nact->ain.msg typedef void *entrypoint (void); @@ -46,21 +42,15 @@ void commands2F60() { if (dll == NULL) { SYSERROR("No DLL initilized\n"); } - + if (dll + type == NULL) goto eexit; - - if (dll[type].handle == NULL) goto eexit; - + if (dll[type].function_num < fnum) goto eexit; - - if (dll[type].function[fnum].name == NULL) goto eexit; - - function = dlsym(dll[type].handle, dll[type].function[fnum].name); - - if (function) { - (*function)(); - return; - } + + if (dll[type].function[fnum].entrypoint == NULL) goto eexit; + + dll[type].function[fnum].entrypoint(); + return; #endif eexit: diff --git a/src/s39ain.c b/src/s39ain.c index f29d55c..0c4be0b 100644 --- a/src/s39ain.c +++ b/src/s39ain.c @@ -34,14 +34,13 @@ #include "xsystem35.h" #ifdef ENABLE_MODULES -#include +#include "modules.h" #endif /* short cut */ #define dll nact->ain.dll #define msg nact->ain.msg #define fnc nact->ain.fnc -#define path_to_dll nact->ain.path_to_dll #define path_to_ain nact->ain.path_to_ain #define dllnum nact->ain.dllnum #define fncnum nact->ain.fncnum @@ -62,13 +61,6 @@ int s39ain_init(void) { return NG; } - if (path_to_dll == NULL) { - char path[512]; - getcwd(path, 400); - strcat(path, "/modules"); - path_to_dll = strdup(path); - } - if (NULL == (fp = fopen(path_to_ain, "rb"))) { WARNING("fail to open %s\n", path_to_ain); return NG; @@ -136,6 +128,7 @@ int s39ain_init(void) { dll[i].function[j].argv[k] = LittleEndian_getDW(p, 0); p += 4; } + dll[i].function[j].entrypoint = NULL; } } @@ -176,30 +169,12 @@ int s39ain_init(void) { p += strlen(p) + 1; } } - -#ifndef ENABLE_MODULES - free(buf); - return dllnum == 0 ? OK : NG; -#else - - /* open dll */ - for (i = 0; i < dllnum; i++) { - char soname[64]; - void *handle; - - if (dll[i].function_num == 0) continue; - - snprintf(soname, sizeof(soname), "lib%s.so", dll[i].name); - handle = dlopen(soname, RTLD_NOW); - - if (handle == NULL) { - SYSERROR("dlopen: %s(%s)\n", dlerror(), dll[i].name); - } - - dll[i].handle = handle; - } - + free(buf); + +#ifdef ENABLE_MODULES + for (i = 0; i < dllnum; i++) + resolve_module(&dll[i]); +#endif return OK; -#endif // ENABLE_MODULES } diff --git a/src/s39ain.h b/src/s39ain.h index b8c3c62..6eb7b82 100644 --- a/src/s39ain.h +++ b/src/s39ain.h @@ -31,11 +31,11 @@ typedef struct { char *name; /* 関数名 */ int argc; /* 関数の引数の数 */ int *argv; /* 関数の引数のそれぞれの種類 */ + void (*entrypoint)(void); } S39AIN_DLLFN; /* DLL 情報 */ -typedef struct { - void *handle; /* DLL handler */ +typedef struct S39AIN_DLLINF { char *name; /* DLL 名 */ int function_num; /* 関数の数 */ S39AIN_DLLFN *function; /* 関数本体 */ @@ -51,7 +51,6 @@ typedef struct { /* System39.ain 全体の情報 */ typedef struct { char *path_to_ain; /* system39.ain へのパス */ - char *path_to_dll; /* DLL モジュールへのパス */ int dllnum; /* DLL の数 */ int fncnum; /* FUNC の数 */