Commit c23c19fa authored by nanahira's avatar nanahira

merge subdir in server

parents d0417aae de3fe3f2
...@@ -71,7 +71,13 @@ bool DataManager::LoadDB(const char* file) { ...@@ -71,7 +71,13 @@ bool DataManager::LoadDB(const char* file) {
return true; return true;
} }
bool DataManager::LoadStrings(const char* file) { bool DataManager::LoadStrings(const char* file) {
#ifdef _WIN32
wchar_t fname[1024];
BufferIO::DecodeUTF8(file, fname);
FILE* fp = _wfopen(fname, L"r");
#else
FILE* fp = fopen(file, "r"); FILE* fp = fopen(file, "r");
#endif // _WIN32
if(!fp) if(!fp)
return false; return false;
char linebuf[256]; char linebuf[256];
......
...@@ -13,7 +13,13 @@ DeckManager deckManager; ...@@ -13,7 +13,13 @@ DeckManager deckManager;
void DeckManager::LoadLFListSingle(const char* path) { void DeckManager::LoadLFListSingle(const char* path) {
LFList* cur = NULL; LFList* cur = NULL;
#ifdef _WIN32
wchar_t fname[1024];
BufferIO::DecodeUTF8(path, fname);
FILE* fp = _wfopen(fname, L"r");
#else
FILE* fp = fopen(path, "r"); FILE* fp = fopen(path, "r");
#endif // _WIN32
char linebuf[256]; char linebuf[256];
wchar_t strBuffer[256]; wchar_t strBuffer[256];
if(fp) { if(fp) {
...@@ -52,42 +58,15 @@ void DeckManager::LoadLFListSingle(const char* path) { ...@@ -52,42 +58,15 @@ void DeckManager::LoadLFListSingle(const char* path) {
fclose(fp); fclose(fp);
} }
} }
void DeckManager::LoadLFListDirectry(const char* path) {
char fpath[1000];
sprintf(fpath, "%s/lflist.conf", path);
LoadLFListSingle(fpath);
}
void DeckManager::LoadLFList() { void DeckManager::LoadLFList() {
LoadLFListSingle("expansions/lflist.conf"); LoadLFListSingle("expansions/lflist.conf");
#ifdef _WIN32 FileSystem::TraversalDir("./expansions", [this](const char* name, bool isdir) {
char fpath[1000]; if(isdir && strcmp(name, ".") && strcmp(name, "..")) {
WIN32_FIND_DATAW fdataw; char fpath[1024];
HANDLE fh = FindFirstFileW(L"./expansions/*", &fdataw); sprintf(fpath, "./expansions/%s/lflist.conf", name);
if(fh != INVALID_HANDLE_VALUE) { LoadLFListSingle(fpath);
do {
if(wcscmp(L".",fdataw.cFileName) != 0 && wcscmp(L"..",fdataw.cFileName) != 0 && fdataw.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) {
char fname[780];
BufferIO::EncodeUTF8(fdataw.cFileName, fname);
sprintf(fpath, "./expansions/%s", fname);
LoadLFListDirectry(fpath);
}
} while(FindNextFileW(fh, &fdataw));
FindClose(fh);
}
#else
DIR * dir;
struct dirent * dirp;
if((dir = opendir("./expansions/")) != NULL) {
while((dirp = readdir(dir)) != NULL) {
if (strcmp(".", dirp->d_name) == 0 || strcmp("..", dirp->d_name) == 0 || dirp->d_type != DT_DIR)
continue;
char filepath[1000];
sprintf(filepath, "./expansions/%s", dirp->d_name);
LoadLFListDirectry(filepath);
}
closedir(dir);
} }
#endif });
LoadLFListSingle("lflist.conf"); LoadLFListSingle("lflist.conf");
LFList nolimit; LFList nolimit;
myswprintf(nolimit.listName, L"N/A"); myswprintf(nolimit.listName, L"N/A");
......
...@@ -36,7 +36,6 @@ public: ...@@ -36,7 +36,6 @@ public:
std::vector<LFList> _lfList; std::vector<LFList> _lfList;
void LoadLFListSingle(const char* path); void LoadLFListSingle(const char* path);
void LoadLFListDirectry(const char* path);
void LoadLFList(); void LoadLFList();
wchar_t* GetLFListName(int lfhash); wchar_t* GetLFListName(int lfhash);
int CheckDeck(Deck& deck, int lfhash, bool allow_ocg, bool allow_tcg); int CheckDeck(Deck& deck, int lfhash, bool allow_ocg, bool allow_tcg);
......
...@@ -1045,107 +1045,33 @@ void Game::SetStaticText(irr::gui::IGUIStaticText* pControl, u32 cWidth, irr::gu ...@@ -1045,107 +1045,33 @@ void Game::SetStaticText(irr::gui::IGUIStaticText* pControl, u32 cWidth, irr::gu
#endif //YGOPRO_SERVER_MODE #endif //YGOPRO_SERVER_MODE
void Game::LoadExpansionDB() { void Game::LoadExpansionDB() {
LoadExpansionDBDirectry("./expansions"); LoadExpansionDBDirectry("./expansions");
#ifdef _WIN32 FileSystem::TraversalDir("./expansions", [this](const char* name, bool isdir) {
char fpath[1000]; if(isdir && strcmp(name, ".") && strcmp(name, "..")) {
WIN32_FIND_DATAW fdataw; char subdir[1024];
HANDLE fh = FindFirstFileW(L"./expansions/*", &fdataw); sprintf(subdir, "./expansions/%s", name);
if(fh != INVALID_HANDLE_VALUE) { LoadExpansionDBDirectry(subdir);
do {
if(wcscmp(L".",fdataw.cFileName) != 0 && wcscmp(L"..",fdataw.cFileName) != 0 && fdataw.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) {
char fname[780];
BufferIO::EncodeUTF8(fdataw.cFileName, fname);
sprintf(fpath, "./expansions/%s", fname);
LoadExpansionDBDirectry(fpath);
} }
} while(FindNextFileW(fh, &fdataw)); });
FindClose(fh);
}
#else
DIR * dir;
struct dirent * dirp;
if((dir = opendir("./expansions/")) != NULL) {
while((dirp = readdir(dir)) != NULL) {
if (strcmp(".", dirp->d_name) == 0 || strcmp("..", dirp->d_name) == 0 || dirp->d_type != DT_DIR)
continue;
char filepath[1000];
sprintf(filepath, "./expansions/%s/", dirp->d_name);
LoadExpansionDBDirectry(filepath);
}
closedir(dir);
}
#endif
} }
void Game::LoadExpansionDBDirectry(const char* path) { void Game::LoadExpansionDBDirectry(const char* path) {
#ifdef _WIN32 FileSystem::TraversalDir(path, [path](const char* name, bool isdir) {
char fpath[1000]; if(!isdir && strrchr(name, '.') && !mystrncasecmp(strrchr(name, '.'), ".cdb", 4)) {
wchar_t wpath1[1000]; char fpath[1024];
wchar_t wpath2[1000]; sprintf(fpath, "%s/%s", path, name);
BufferIO::DecodeUTF8(path, wpath1);
myswprintf(wpath2, L"%ls/*.cdb", wpath1);
WIN32_FIND_DATAW fdataw;
HANDLE fh = FindFirstFileW(wpath2, &fdataw);
if(fh != INVALID_HANDLE_VALUE) {
do {
if(!(fdataw.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)) {
char fname[780];
BufferIO::EncodeUTF8(fdataw.cFileName, fname);
sprintf(fpath, "%s/%s", path, fname);
dataManager.LoadDB(fpath); dataManager.LoadDB(fpath);
} }
} while(FindNextFileW(fh, &fdataw));
FindClose(fh);
}
#else
DIR * dir;
struct dirent * dirp;
if((dir = opendir(path)) != NULL) {
while((dirp = readdir(dir)) != NULL) {
size_t len = strlen(dirp->d_name);
if(len < 5 || strcasecmp(dirp->d_name + len - 4, ".cdb") != 0)
continue;
char filepath[1000];
sprintf(filepath, "%s/%s", path, dirp->d_name);
dataManager.LoadDB(filepath);
}
}); });
} }
#ifndef YGOPRO_SERVER_MODE #ifndef YGOPRO_SERVER_MODE
void Game::LoadExpansionStrings() { void Game::LoadExpansionStrings() {
LoadExpansionStringsDirectry("./expansions"); dataManager.LoadStrings("./expansions/strings.conf");
#ifdef _WIN32 FileSystem::TraversalDir("./expansions", [](const char* name, bool isdir) {
char fpath[1000]; if(isdir && strcmp(name, ".") && strcmp(name, "..")) {
WIN32_FIND_DATAW fdataw; char fpath[1024];
HANDLE fh = FindFirstFileW(L"./expansions/*", &fdataw); sprintf(fpath, "./expansions/%s/strings.conf", name);
if(fh != INVALID_HANDLE_VALUE) {
do {
if(wcscmp(L".",fdataw.cFileName) != 0 && wcscmp(L"..",fdataw.cFileName) != 0 && fdataw.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) {
char fname[780];
BufferIO::EncodeUTF8(fdataw.cFileName, fname);
sprintf(fpath, "./expansions/%s", fname);
LoadExpansionStringsDirectry(fpath);
}
} while(FindNextFileW(fh, &fdataw));
FindClose(fh);
}
#else
DIR * dir;
struct dirent * dirp;
if((dir = opendir("./expansions/")) != NULL) {
while((dirp = readdir(dir)) != NULL) {
if (strcmp(".", dirp->d_name) == 0 || strcmp("..", dirp->d_name) == 0 || dirp->d_type != DT_DIR)
continue;
char filepath[1000];
sprintf(filepath, "./expansions/%s/", dirp->d_name);
LoadExpansionStringsDirectry(filepath);
}
closedir(dir);
}
#endif
}
void Game::LoadExpansionStringsDirectry(const char* path) {
char fpath[1000];
sprintf(fpath, "%s/strings.conf", path);
dataManager.LoadStrings(fpath); dataManager.LoadStrings(fpath);
}
});
} }
void Game::RefreshDeck(irr::gui::IGUIComboBox* cbDeck) { void Game::RefreshDeck(irr::gui::IGUIComboBox* cbDeck) {
cbDeck->clear(); cbDeck->clear();
......
...@@ -144,7 +144,6 @@ public: ...@@ -144,7 +144,6 @@ public:
void LoadExpansionDB(); void LoadExpansionDB();
void LoadExpansionDBDirectry(const char* path); void LoadExpansionDBDirectry(const char* path);
void LoadExpansionStrings(); void LoadExpansionStrings();
void LoadExpansionStringsDirectry(const char* path);
void RefreshDeck(irr::gui::IGUIComboBox* cbDeck); void RefreshDeck(irr::gui::IGUIComboBox* cbDeck);
void RefreshReplay(); void RefreshReplay();
void RefreshSingleplay(); void RefreshSingleplay();
......
...@@ -271,23 +271,30 @@ void imageScaleNNAA(irr::video::IImage *src, irr::video::IImage *dest) { ...@@ -271,23 +271,30 @@ void imageScaleNNAA(irr::video::IImage *src, irr::video::IImage *dest) {
} }
} }
irr::video::ITexture* ImageManager::GetTextureFromFile(char* file, s32 width, s32 height) { irr::video::ITexture* ImageManager::GetTextureFromFile(char* file, s32 width, s32 height) {
#ifdef _WIN32
wchar_t name[1024];
BufferIO::DecodeUTF8(file, name);
#else
char* name = file;
#endif // _WIN32
if(mainGame->gameConf.use_image_scale) { if(mainGame->gameConf.use_image_scale) {
irr::video::ITexture* texture; irr::video::ITexture* texture;
irr::video::IImage* srcimg = driver->createImageFromFile(file); irr::video::IImage* srcimg = driver->createImageFromFile(name);
if(srcimg == NULL) if(srcimg == NULL)
return NULL; return NULL;
if(srcimg->getDimension() == irr::core::dimension2d<u32>(width, height)) { if(srcimg->getDimension() == irr::core::dimension2d<u32>(width, height)) {
texture = driver->addTexture(file, srcimg); texture = driver->addTexture(name, srcimg);
} else { } else {
video::IImage *destimg = driver->createImage(srcimg->getColorFormat(), irr::core::dimension2d<u32>(width, height)); video::IImage *destimg = driver->createImage(srcimg->getColorFormat(), irr::core::dimension2d<u32>(width, height));
imageScaleNNAA(srcimg, destimg); imageScaleNNAA(srcimg, destimg);
texture = driver->addTexture(file, destimg); texture = driver->addTexture(name, destimg);
destimg->drop(); destimg->drop();
} }
srcimg->drop(); srcimg->drop();
return texture; return texture;
} else { } else {
return driver->getTexture(file); return driver->getTexture(name);
} }
} }
irr::video::ITexture* ImageManager::GetTextureUnknown(s32 width, s32 height, int index) { irr::video::ITexture* ImageManager::GetTextureUnknown(s32 width, s32 height, int index) {
...@@ -299,39 +306,18 @@ irr::video::ITexture* ImageManager::GetTextureExpansions(char* file, s32 width, ...@@ -299,39 +306,18 @@ irr::video::ITexture* ImageManager::GetTextureExpansions(char* file, s32 width,
irr::video::ITexture* img = GetTextureExpansionsDirectry("./expansions", file, width, height); irr::video::ITexture* img = GetTextureExpansionsDirectry("./expansions", file, width, height);
if(img != NULL) if(img != NULL)
return img; return img;
#ifdef _WIN32 bool find = false;
char fpath[1000]; FileSystem::TraversalDir("./expansions", [this, file, width, height, &img, &find](const char* name, bool isdir) {
WIN32_FIND_DATAW fdataw; if(!find && isdir && strcmp(name, ".") && strcmp(name, "..")) {
HANDLE fh = FindFirstFileW(L"./expansions/*", &fdataw); char subdir[1024];
if(fh != INVALID_HANDLE_VALUE) { sprintf(subdir, "./expansions/%s", name);
do { img = GetTextureExpansionsDirectry(subdir, file, width, height);
if(wcscmp(L".",fdataw.cFileName) != 0 && wcscmp(L"..",fdataw.cFileName) != 0 && fdataw.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) { if(img)
char fname[780]; find = true;
BufferIO::EncodeUTF8(fdataw.cFileName, fname);
sprintf(fpath, "./expansions/%s", fname);
img = GetTextureExpansionsDirectry(fpath, file, width, height);
if(img != NULL)
return img;
} }
} while(FindNextFileW(fh, &fdataw)); });
FindClose(fh); if(find)
}
#else
DIR * dir;
struct dirent * dirp;
if((dir = opendir("./expansions/")) != NULL) {
while((dirp = readdir(dir)) != NULL) {
if (strcmp(".", dirp->d_name) == 0 || strcmp("..", dirp->d_name) == 0 || dirp->d_type != DT_DIR)
continue;
char filepath[1000];
sprintf(filepath, "./expansions/%s/", dirp->d_name);
img = GetTextureExpansionsDirectry(filepath, file, width, height);
if(img != NULL)
return img; return img;
}
closedir(dir);
}
#endif
return img; return img;
} }
irr::video::ITexture* ImageManager::GetTextureExpansionsDirectry(const char* path, char* file, s32 width, s32 height) { irr::video::ITexture* ImageManager::GetTextureExpansionsDirectry(const char* path, char* file, s32 width, s32 height) {
......
...@@ -952,39 +952,18 @@ byte* ReplayMode::ScriptReaderEx(const char* script_name, int* slen) { ...@@ -952,39 +952,18 @@ byte* ReplayMode::ScriptReaderEx(const char* script_name, int* slen) {
buffer = ScriptReaderExDirectry("./beta", script_name, slen); buffer = ScriptReaderExDirectry("./beta", script_name, slen);
if(buffer) if(buffer)
return buffer; return buffer;
#ifdef _WIN32 bool find = false;
char fpath[1000]; FileSystem::TraversalDir("./expansions", [script_name, slen, &buffer, &find](const char* name, bool isdir) {
WIN32_FIND_DATAW fdataw; if(!find && isdir && strcmp(name, ".") && strcmp(name, "..")) {
HANDLE fh = FindFirstFileW(L"./expansions/*", &fdataw); char subdir[1024];
if(fh != INVALID_HANDLE_VALUE) { sprintf(subdir, "./expansions/%s", name);
do { buffer = ScriptReaderExDirectry(subdir, script_name, slen);
if(wcscmp(L".",fdataw.cFileName) != 0 && wcscmp(L"..",fdataw.cFileName) != 0 && fdataw.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) {
char fname[780];
BufferIO::EncodeUTF8(fdataw.cFileName, fname);
sprintf(fpath, "./expansions/%s", fname);
buffer = ScriptReaderExDirectry(fpath, script_name, slen);
if(buffer) if(buffer)
return buffer; find = true;
} }
} while(FindNextFileW(fh, &fdataw)); });
FindClose(fh); if(find)
}
#else
DIR * dir;
struct dirent * dirp;
if((dir = opendir("./expansions/")) != NULL) {
while((dirp = readdir(dir)) != NULL) {
if (strcmp(".", dirp->d_name) == 0 || strcmp("..", dirp->d_name) == 0 || dirp->d_type != DT_DIR)
continue;
char filepath[1000];
sprintf(filepath, "./expansions/%s/", dirp->d_name);
buffer = ScriptReaderExDirectry(filepath, script_name, slen);
if(buffer)
return buffer; return buffer;
}
closedir(dir);
}
#endif
return default_script_reader(script_name, slen); return default_script_reader(script_name, slen);
} }
byte* ReplayMode::ScriptReaderExDirectry(const char* path, const char* script_name, int* slen, int pre_len) { byte* ReplayMode::ScriptReaderExDirectry(const char* path, const char* script_name, int* slen, int pre_len) {
......
...@@ -2135,39 +2135,18 @@ byte* SingleDuel::ScriptReaderEx(const char* script_name, int* slen) { ...@@ -2135,39 +2135,18 @@ byte* SingleDuel::ScriptReaderEx(const char* script_name, int* slen) {
buffer = ScriptReaderExDirectry("./beta", script_name, slen); buffer = ScriptReaderExDirectry("./beta", script_name, slen);
if(buffer) if(buffer)
return buffer; return buffer;
#ifdef _WIN32 bool find = false;
char fpath[1000]; FileSystem::TraversalDir("./expansions", [script_name, slen, &buffer, &find](const char* name, bool isdir) {
WIN32_FIND_DATAW fdataw; if(!find && isdir && strcmp(name, ".") && strcmp(name, "..")) {
HANDLE fh = FindFirstFileW(L"./expansions/*", &fdataw); char subdir[1024];
if(fh != INVALID_HANDLE_VALUE) { sprintf(subdir, "./expansions/%s", name);
do { buffer = ScriptReaderExDirectry(subdir, script_name, slen);
if(wcscmp(L".",fdataw.cFileName) != 0 && wcscmp(L"..",fdataw.cFileName) != 0 && fdataw.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) {
char fname[780];
BufferIO::EncodeUTF8(fdataw.cFileName, fname);
sprintf(fpath, "./expansions/%s", fname);
buffer = ScriptReaderExDirectry(fpath, script_name, slen);
if(buffer) if(buffer)
return buffer; find = true;
}
} while(FindNextFileW(fh, &fdataw));
FindClose(fh);
} }
#else });
DIR * dir; if(find)
struct dirent * dirp;
if((dir = opendir("./expansions/")) != NULL) {
while((dirp = readdir(dir)) != NULL) {
if (strcmp(".", dirp->d_name) == 0 || strcmp("..", dirp->d_name) == 0 || dirp->d_type != DT_DIR)
continue;
char filepath[1000];
sprintf(filepath, "./expansions/%s/", dirp->d_name);
buffer = ScriptReaderExDirectry(filepath, script_name, slen);
if(buffer)
return buffer; return buffer;
}
closedir(dir);
}
#endif
return default_script_reader(script_name, slen); return default_script_reader(script_name, slen);
} }
byte* SingleDuel::ScriptReaderExDirectry(const char* path, const char* script_name, int* slen, int pre_len) { byte* SingleDuel::ScriptReaderExDirectry(const char* path, const char* script_name, int* slen, int pre_len) {
......
...@@ -872,45 +872,23 @@ byte* SingleMode::ScriptReaderEx(const char* script_name, int* slen) { ...@@ -872,45 +872,23 @@ byte* SingleMode::ScriptReaderEx(const char* script_name, int* slen) {
buffer = ScriptReaderExDirectry("./beta", script_name, slen); buffer = ScriptReaderExDirectry("./beta", script_name, slen);
if(buffer) if(buffer)
return buffer; return buffer;
#ifdef _WIN32 bool find = false;
char fpath[1000]; FileSystem::TraversalDir("./expansions", [script_name, slen, &buffer, &find](const char* name, bool isdir) {
WIN32_FIND_DATAW fdataw; if(!find && isdir && strcmp(name, ".") && strcmp(name, "..")) {
HANDLE fh = FindFirstFileW(L"./expansions/*", &fdataw); char subdir[1024];
if(fh != INVALID_HANDLE_VALUE) { sprintf(subdir, "./expansions/%s", name);
do { buffer = ScriptReaderExDirectry(subdir, script_name, slen);
if(wcscmp(L".",fdataw.cFileName) != 0 && wcscmp(L"..",fdataw.cFileName) != 0 && fdataw.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) {
char fname[780];
BufferIO::EncodeUTF8(fdataw.cFileName, fname);
sprintf(fpath, "./expansions/%s", fname);
buffer = ScriptReaderExDirectry(fpath, script_name, slen);
if(buffer) if(buffer)
return buffer; find = true;
} }
} while(FindNextFileW(fh, &fdataw)); });
FindClose(fh); if(find)
}
#else
DIR * dir;
struct dirent * dirp;
if((dir = opendir("./expansions/")) != NULL) {
while((dirp = readdir(dir)) != NULL) {
if (strcmp(".", dirp->d_name) == 0 || strcmp("..", dirp->d_name) == 0 || dirp->d_type != DT_DIR)
continue;
char filepath[1000];
sprintf(filepath, "./expansions/%s/", dirp->d_name);
buffer = ScriptReaderExDirectry(filepath, script_name, slen);
if(buffer)
return buffer; return buffer;
}
closedir(dir);
}
#endif
return ScriptReader(script_name, slen); return ScriptReader(script_name, slen);
} }
byte* SingleMode::ScriptReaderExDirectry(const char* path, const char* script_name, int* slen, int pre_len) { byte* SingleMode::ScriptReaderExDirectry(const char* path, const char* script_name, int* slen, int pre_len) {
char sname[256]; char sname[256];
strcpy(sname, path); sprintf(sname, "%s%s", path, script_name + pre_len); //default script name: ./script/c%d.lua
strcat(sname, script_name + pre_len);//default script name: ./script/c%d.lua
return ScriptReader(sname, slen); return ScriptReader(sname, slen);
} }
byte* SingleMode::ScriptReader(const char* script_name, int* slen) { byte* SingleMode::ScriptReader(const char* script_name, int* slen) {
......
...@@ -2295,39 +2295,18 @@ byte* TagDuel::ScriptReaderEx(const char* script_name, int* slen) { ...@@ -2295,39 +2295,18 @@ byte* TagDuel::ScriptReaderEx(const char* script_name, int* slen) {
buffer = ScriptReaderExDirectry("./beta", script_name, slen); buffer = ScriptReaderExDirectry("./beta", script_name, slen);
if(buffer) if(buffer)
return buffer; return buffer;
#ifdef _WIN32 bool find = false;
char fpath[1000]; FileSystem::TraversalDir("./expansions", [script_name, slen, &buffer, &find](const char* name, bool isdir) {
WIN32_FIND_DATAW fdataw; if(!find && isdir && strcmp(name, ".") && strcmp(name, "..")) {
HANDLE fh = FindFirstFileW(L"./expansions/*", &fdataw); char subdir[1024];
if(fh != INVALID_HANDLE_VALUE) { sprintf(subdir, "./expansions/%s", name);
do { buffer = ScriptReaderExDirectry(subdir, script_name, slen);
if(wcscmp(L".",fdataw.cFileName) != 0 && wcscmp(L"..",fdataw.cFileName) != 0 && fdataw.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) {
char fname[780];
BufferIO::EncodeUTF8(fdataw.cFileName, fname);
sprintf(fpath, "./expansions/%s", fname);
buffer = ScriptReaderExDirectry(fpath, script_name, slen);
if(buffer) if(buffer)
return buffer; find = true;
}
} while(FindNextFileW(fh, &fdataw));
FindClose(fh);
} }
#else });
DIR * dir; if(find)
struct dirent * dirp;
if((dir = opendir("./expansions/")) != NULL) {
while((dirp = readdir(dir)) != NULL) {
if (strcmp(".", dirp->d_name) == 0 || strcmp("..", dirp->d_name) == 0 || dirp->d_type != DT_DIR)
continue;
char filepath[1000];
sprintf(filepath, "./expansions/%s/", dirp->d_name);
buffer = ScriptReaderExDirectry(filepath, script_name, slen);
if(buffer)
return buffer; return buffer;
}
closedir(dir);
}
#endif
return default_script_reader(script_name, slen); return default_script_reader(script_name, slen);
} }
byte* TagDuel::ScriptReaderExDirectry(const char* path, const char* script_name, int* slen, int pre_len) { byte* TagDuel::ScriptReaderExDirectry(const char* path, const char* script_name, int* slen, int pre_len) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment