From 24c41411dacc04d05ab3c340ece313ce35263e8f Mon Sep 17 00:00:00 2001 From: "C.Ponapalt" Date: Thu, 16 Jan 2025 05:08:50 +0900 Subject: [PATCH] SAORI loadu func --- aya5.rc | 13 ++++--------- lib.h | 19 +++++++------------ lib1.cpp | 33 ++++++++++++++++++++++++++------- manifest.cpp | 2 +- 4 files changed, 38 insertions(+), 29 deletions(-) diff --git a/aya5.rc b/aya5.rc index 93e58c11..4c362ebb 100644 --- a/aya5.rc +++ b/aya5.rc @@ -13,7 +13,7 @@ #undef APSTUDIO_READONLY_SYMBOLS ///////////////////////////////////////////////////////////////////////////// -// ���{�� resources +// { resources #if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_JPN) #ifdef _WIN32 @@ -28,7 +28,7 @@ LANGUAGE LANG_JAPANESE, SUBLANG_DEFAULT // VS_VERSION_INFO VERSIONINFO - FILEVERSION 5,71,10,0 + FILEVERSION 5,71,11,0 PRODUCTVERSION 5,0,0,0 FILEFLAGSMASK 0x3fL #ifdef _DEBUG @@ -47,7 +47,7 @@ BEGIN VALUE "Comments", "YAYA\0" VALUE "CompanyName", "YAYA Development Team\0" VALUE "FileDescription", "yaya\0" - VALUE "FileVersion", "5, 71, 10, 0\0" + VALUE "FileVersion", "5, 71, 11, 0\0" VALUE "InternalName", "Yet Another AYA5\0" VALUE "LegalCopyright", " \0" VALUE "LegalTrademarks", " \0" @@ -98,17 +98,12 @@ END // MESSAGETXT // -#ifndef AYA_RES_NO_LANG - CLASSICAL-CHINESE MESSAGETXT MOVEABLE PURE "messagetxt\\classical-chinese.txt" ENGLISH MESSAGETXT MOVEABLE PURE "messagetxt\\english.txt" JAPANESE MESSAGETXT MOVEABLE PURE "messagetxt\\japanese.txt" SIMPLIFIED-CHINESE MESSAGETXT MOVEABLE PURE "messagetxt\\simplified-chinese.txt" TRADITIONAL-CHINESE MESSAGETXT MOVEABLE PURE "messagetxt\\traditional-chinese.txt" - -#endif //AYA_RES_NO_LANG - -#endif // ���{�� resources +#endif // { resources ///////////////////////////////////////////////////////////////////////////// diff --git a/lib.h b/lib.h index fc53ca64..27630a81 100644 --- a/lib.h +++ b/lib.h @@ -24,21 +24,18 @@ class CAyaVM; -class CLib1 -{ -protected: - yaya::string_t name; + #if defined(WIN32) typedef HMODULE module_t; - - bool (*loadlib)(yaya::global_t h, long len); - bool (*unloadlib)(void); #elif defined(POSIX) typedef void* module_t; - - int (*loadlib)(char* h, long len); - int (*unloadlib)(void); #endif + + +class CLib1 +{ +protected: + yaya::string_t name; yaya::global_t (*requestlib)(yaya::global_t h, long *len); module_t hDLL; @@ -56,8 +53,6 @@ class CLib1 name = n; charset = cs; hDLL = NULL; - loadlib = NULL; - unloadlib = NULL; requestlib = NULL; isAlreadyLoaded = false; } diff --git a/lib1.cpp b/lib1.cpp index d970246c..b94e04e5 100644 --- a/lib1.cpp +++ b/lib1.cpp @@ -40,7 +40,6 @@ #endif //////////////////////////////////////// - #if defined(POSIX) static std::string str_getenv(const std::string& name) { char* var = getenv(name.c_str()); @@ -208,14 +207,30 @@ int CLib1::Load(void) if (hDLL == NULL) return 0; + // AhX擾 if ( ! isAlreadyLoaded ) { - if (loadlib == NULL) + bool (*loadlib)(yaya::global_t h, long len) = NULL; + int charset = CHARSET_UTF8; + + if (loadlib == NULL) { + loadlib = (bool (*)(HGLOBAL h, long len))GetProcAddress(hDLL, "loadu"); + } + if (loadlib == NULL) { + loadlib = (bool (*)(HGLOBAL h, long len))GetProcAddress(hDLL, "_loadu"); + } + + if (loadlib == NULL) { loadlib = (bool (*)(HGLOBAL h, long len))GetProcAddress(hDLL, "load"); - if (loadlib == NULL) + charset = CHARSET_DEFAULT; + } + if (loadlib == NULL) { loadlib = (bool (*)(HGLOBAL h, long len))GetProcAddress(hDLL, "_load"); - if (loadlib == NULL) + charset = CHARSET_DEFAULT; + } + if (loadlib == NULL) { return 0; + } // DLLpX쐬 wchar_t drive[_MAX_DRIVE], dir[_MAX_DIR], fname[_MAX_FNAME], ext[_MAX_EXT]; @@ -224,7 +239,7 @@ int CLib1::Load(void) dllpath += dir; // pXMBCSɕϊ - char *t_dllpath = Ccct::Ucs2ToMbcs(dllpath, CHARSET_DEFAULT); + char *t_dllpath = Ccct::Ucs2ToMbcs(dllpath, charset); if (t_dllpath == NULL) return 0; @@ -255,6 +270,8 @@ int CLib1::Load(void) { } // AhX擾 + int (*loadlib)(char* h, long len) = NULL; + if (loadlib == NULL) loadlib = (int(*)(char*,long))dlsym(hDLL, "load"); if (loadlib == NULL) { @@ -299,6 +316,8 @@ int CLib1::Unload(void) // AhX擾 if ( ! isAlreadyLoaded ) { + bool (*unloadlib)(void) = NULL; + if (unloadlib == NULL) unloadlib = (bool (*)(void))GetProcAddress(hDLL, "unload"); if (unloadlib == NULL) @@ -319,6 +338,8 @@ int CLib1::Unload(void) { } // AhX擾 + int (*unloadlib)(void) = NULL; + if (unloadlib == NULL) unloadlib = (int(*)(void))dlsym(hDLL, "unload"); if (unloadlib == NULL) { @@ -343,8 +364,6 @@ void CLib1::Release(void) if (hDLL == NULL) return; - loadlib = NULL; - unloadlib = NULL; requestlib = NULL; FreeLibrary(hDLL); diff --git a/manifest.cpp b/manifest.cpp index b7b5daa9..ccb074dc 100644 --- a/manifest.cpp +++ b/manifest.cpp @@ -8,7 +8,7 @@ #include "manifest.h" const yaya::char_t *aya_name = L"YAYA"; -const yaya::char_t *aya_version = L"Tc571-10"; +const yaya::char_t *aya_version = L"Tc571-11"; const yaya::char_t *aya_author = L"umeici/The Maintenance Shop";