Decompile 2 functions in Source/Contents/SkinInfo.cpp, Source/Contents/SkinCatalog.cpp, ...
Batch #1877 by Yommy: 0 byte-identical, 2 confirmed by peer review. - fn_09691 CSkinMgr::Select: logic confirmed by peer review - fn_09689 CSkinMgr::Refresh: logic confirmed by peer review Reviewed-by: ragnarok-clanker Adds to the build: Source/Contents/SkinCatalog.cpp
This commit is contained in:
parent
3898d6613a
commit
5167f6ba82
4 changed files with 125 additions and 0 deletions
111
Source/Contents/SkinCatalog.cpp
Normal file
111
Source/Contents/SkinCatalog.cpp
Normal file
|
|
@ -0,0 +1,111 @@
|
||||||
|
#include "Contents/SkinMgr.h"
|
||||||
|
#include "Network/TextEncoding.h"
|
||||||
|
#include "Utility/Text/GroupedInteger.h"
|
||||||
|
|
||||||
|
#include <cstring>
|
||||||
|
#include <string>
|
||||||
|
#include <windows.h>
|
||||||
|
|
||||||
|
// GLOBAL: gl_24533
|
||||||
|
const char* g_skinDirectoryPrefix = "..\\..\\skin\\";
|
||||||
|
// GLOBAL: gl_24534
|
||||||
|
const char* g_skinArchivePrefix = "..\\..\\_tmpskin_\\";
|
||||||
|
|
||||||
|
// OFFSET: 0x007E1120
|
||||||
|
// FUNCTION: fn_09689
|
||||||
|
void CSkinMgr::Refresh() {
|
||||||
|
this->prefixes.clear();
|
||||||
|
this->names.clear();
|
||||||
|
this->archives.clear();
|
||||||
|
this->selected = -1;
|
||||||
|
|
||||||
|
WIN32_FIND_DATAA findData;
|
||||||
|
std::memset(&findData, 0, sizeof(findData));
|
||||||
|
HANDLE find = FindFirstFileA(".\\skin\\*.*", &findData);
|
||||||
|
if (find == INVALID_HANDLE_VALUE) {
|
||||||
|
FindClose(find);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
const std::string current = ".";
|
||||||
|
const std::string parent = "..";
|
||||||
|
int index = 0;
|
||||||
|
|
||||||
|
if (current != findData.cFileName && parent != findData.cFileName && (findData.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)) {
|
||||||
|
std::string path = g_skinDirectoryPrefix;
|
||||||
|
path += findData.cFileName;
|
||||||
|
path += "\\";
|
||||||
|
this->prefixes.push_back(path.c_str());
|
||||||
|
this->names.push_back(findData.cFileName);
|
||||||
|
this->archives.push_back(0);
|
||||||
|
this->prepared.push_back(0);
|
||||||
|
|
||||||
|
if (this->m_name == findData.cFileName) {
|
||||||
|
this->selected = index;
|
||||||
|
}
|
||||||
|
++index;
|
||||||
|
} else if (current != findData.cFileName && parent != findData.cFileName) {
|
||||||
|
std::string extension = ReverseFindChar(findData.cFileName, '.');
|
||||||
|
LowercaseText(extension);
|
||||||
|
|
||||||
|
if (extension == ".zip") {
|
||||||
|
std::string path = g_skinArchivePrefix;
|
||||||
|
path += findData.cFileName;
|
||||||
|
path.resize(path.size() - 4);
|
||||||
|
path += "\\";
|
||||||
|
this->prefixes.push_back(path.c_str());
|
||||||
|
|
||||||
|
std::string name = findData.cFileName;
|
||||||
|
name.resize(name.size() - 4);
|
||||||
|
this->names.push_back(name.c_str());
|
||||||
|
this->archives.push_back(1);
|
||||||
|
this->prepared.push_back(0);
|
||||||
|
|
||||||
|
if (this->m_name == name) {
|
||||||
|
this->selected = index;
|
||||||
|
}
|
||||||
|
++index;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
while (FindNextFileA(find, &findData)) {
|
||||||
|
if (current != findData.cFileName && parent != findData.cFileName && (findData.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)) {
|
||||||
|
std::string path = g_skinDirectoryPrefix;
|
||||||
|
path += findData.cFileName;
|
||||||
|
path += "\\";
|
||||||
|
this->prefixes.push_back(path.c_str());
|
||||||
|
this->names.push_back(findData.cFileName);
|
||||||
|
this->archives.push_back(0);
|
||||||
|
this->prepared.push_back(0);
|
||||||
|
|
||||||
|
if (this->m_name == findData.cFileName) {
|
||||||
|
this->selected = index;
|
||||||
|
}
|
||||||
|
++index;
|
||||||
|
} else if (current != findData.cFileName && parent != findData.cFileName) {
|
||||||
|
std::string extension = ReverseFindChar(findData.cFileName, '.');
|
||||||
|
LowercaseText(extension);
|
||||||
|
|
||||||
|
if (extension == ".zip") {
|
||||||
|
std::string path = g_skinArchivePrefix;
|
||||||
|
path += findData.cFileName;
|
||||||
|
path.resize(path.size() - 4);
|
||||||
|
path += "\\";
|
||||||
|
this->prefixes.push_back(path.c_str());
|
||||||
|
|
||||||
|
std::string name = findData.cFileName;
|
||||||
|
name.resize(name.size() - 4);
|
||||||
|
this->names.push_back(name.c_str());
|
||||||
|
this->archives.push_back(1);
|
||||||
|
this->prepared.push_back(0);
|
||||||
|
|
||||||
|
if (this->m_name == name) {
|
||||||
|
this->selected = index;
|
||||||
|
}
|
||||||
|
++index;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
FindClose(find);
|
||||||
|
}
|
||||||
|
|
@ -1,4 +1,5 @@
|
||||||
#include "Contents/SkinMgr.h"
|
#include "Contents/SkinMgr.h"
|
||||||
|
#include "Resource/ResourceMgr.h"
|
||||||
|
|
||||||
#include <cstdio>
|
#include <cstdio>
|
||||||
#include <direct.h>
|
#include <direct.h>
|
||||||
|
|
@ -11,6 +12,16 @@ bool CSkinMgr::Selected() const {
|
||||||
return this->selected > -1;
|
return this->selected > -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// OFFSET: 0x007E2140
|
||||||
|
// FUNCTION: fn_09691
|
||||||
|
void CSkinMgr::Select(int index) {
|
||||||
|
const int previous = this->selected;
|
||||||
|
this->selected = index;
|
||||||
|
if (previous != index) {
|
||||||
|
ResourceMgr::Instance().ClearUnused("bmp");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// OFFSET: 0x007E1020
|
// OFFSET: 0x007E1020
|
||||||
// FUNCTION: fn_09686
|
// FUNCTION: fn_09686
|
||||||
const char* CSkinMgr::Name() const {
|
const char* CSkinMgr::Name() const {
|
||||||
|
|
|
||||||
|
|
@ -21,10 +21,12 @@ public:
|
||||||
CSkinMgr();
|
CSkinMgr();
|
||||||
|
|
||||||
bool Selected() const;
|
bool Selected() const;
|
||||||
|
void Select(int index);
|
||||||
const char* Prefix() const;
|
const char* Prefix() const;
|
||||||
const char* Name() const;
|
const char* Name() const;
|
||||||
const char* Name(int index) const;
|
const char* Name(int index) const;
|
||||||
void Prepare();
|
void Prepare();
|
||||||
|
void Refresh();
|
||||||
};
|
};
|
||||||
|
|
||||||
#if defined(_WIN32) && !defined(_WIN64)
|
#if defined(_WIN32) && !defined(_WIN64)
|
||||||
|
|
|
||||||
|
|
@ -421,6 +421,7 @@
|
||||||
"Source/Contents/Skills/SkillLevelConfig.cpp": 4,
|
"Source/Contents/Skills/SkillLevelConfig.cpp": 4,
|
||||||
"Source/Contents/Skills/SkillLevelRegistry.cpp": 4,
|
"Source/Contents/Skills/SkillLevelRegistry.cpp": 4,
|
||||||
"Source/Contents/Skills/SkillTreeScript.cpp": 4,
|
"Source/Contents/Skills/SkillTreeScript.cpp": 4,
|
||||||
|
"Source/Contents/SkinCatalog.cpp": 4,
|
||||||
"Source/Contents/SkinInfo.cpp": 3,
|
"Source/Contents/SkinInfo.cpp": 3,
|
||||||
"Source/Contents/SkinMgr.cpp": 4,
|
"Source/Contents/SkinMgr.cpp": 4,
|
||||||
"Source/Contents/Sound/SoundConfiguration.cpp": 4,
|
"Source/Contents/Sound/SoundConfiguration.cpp": 4,
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue