Skip to content

Commit

Permalink
SAORI loadu func
Browse files Browse the repository at this point in the history
  • Loading branch information
ponapalt committed Jan 15, 2025
1 parent 78c55b9 commit 24c4141
Show file tree
Hide file tree
Showing 4 changed files with 38 additions and 29 deletions.
13 changes: 4 additions & 9 deletions aya5.rc
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
#undef APSTUDIO_READONLY_SYMBOLS

/////////////////////////////////////////////////////////////////////////////
// ���{�� resources
// ���{�� resources

#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_JPN)
#ifdef _WIN32
Expand All @@ -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
Expand All @@ -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"
Expand Down Expand Up @@ -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
/////////////////////////////////////////////////////////////////////////////


Expand Down
19 changes: 7 additions & 12 deletions lib.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -56,8 +53,6 @@ class CLib1
name = n;
charset = cs;
hDLL = NULL;
loadlib = NULL;
unloadlib = NULL;
requestlib = NULL;
isAlreadyLoaded = false;
}
Expand Down
33 changes: 26 additions & 7 deletions lib1.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@
#endif
////////////////////////////////////////


#if defined(POSIX)
static std::string str_getenv(const std::string& name) {
char* var = getenv(name.c_str());
Expand Down Expand Up @@ -208,14 +207,30 @@ int CLib1::Load(void)
if (hDLL == NULL)
return 0;


// アドレス取得
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;
}

// DLLパス文字列作成
wchar_t drive[_MAX_DRIVE], dir[_MAX_DIR], fname[_MAX_FNAME], ext[_MAX_EXT];
Expand All @@ -224,7 +239,7 @@ int CLib1::Load(void)
dllpath += dir;

// パス文字列をMBCSに変換
char *t_dllpath = Ccct::Ucs2ToMbcs(dllpath, CHARSET_DEFAULT);
char *t_dllpath = Ccct::Ucs2ToMbcs(dllpath, charset);
if (t_dllpath == NULL)
return 0;

Expand Down Expand Up @@ -255,6 +270,8 @@ int CLib1::Load(void) {
}

// アドレス取得
int (*loadlib)(char* h, long len) = NULL;

if (loadlib == NULL)
loadlib = (int(*)(char*,long))dlsym(hDLL, "load");
if (loadlib == NULL) {
Expand Down Expand Up @@ -299,6 +316,8 @@ int CLib1::Unload(void)

// アドレス取得
if ( ! isAlreadyLoaded ) {
bool (*unloadlib)(void) = NULL;

if (unloadlib == NULL)
unloadlib = (bool (*)(void))GetProcAddress(hDLL, "unload");
if (unloadlib == NULL)
Expand All @@ -319,6 +338,8 @@ int CLib1::Unload(void) {
}

// アドレス取得
int (*unloadlib)(void) = NULL;

if (unloadlib == NULL)
unloadlib = (int(*)(void))dlsym(hDLL, "unload");
if (unloadlib == NULL) {
Expand All @@ -343,8 +364,6 @@ void CLib1::Release(void)
if (hDLL == NULL)
return;

loadlib = NULL;
unloadlib = NULL;
requestlib = NULL;

FreeLibrary(hDLL);
Expand Down
2 changes: 1 addition & 1 deletion manifest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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";


Expand Down

0 comments on commit 24c4141

Please sign in to comment.