rodecomp/Source/Contents/SkinInfo.cpp
ragnarok-clanker a47d20f8be Reconstruct readable C++ and organize cohesive source subsystems
Administrative source import: native x86 compilation passed for 423 authored units. Source placement and submission states are migrated separately; this commit does not imply peer acceptance.

Previous head: 35d2a8cb36
Payload SHA256: 592f016d2730c5593bb653aa054c1e5f76a6df72c8f5a09e66f74876e2e33dee
2026-10-25 07:42:41 +00:00

72 lines
1.6 KiB
C++

#include "Contents/SkinInfo.h"
#include <cstdio>
#include <direct.h>
#include <io.h>
#include <process.h>
// OFFSET: 0x007E2130
// FUNCTION: fn_09690
bool SkinInfo::Selected() const {
return this->selected > -1;
}
// OFFSET: 0x007E1020
// FUNCTION: fn_09686
const char* SkinInfo::Name() const {
if (this->selected == -1) {
return "";
}
return this->names[this->selected].c_str();
}
// OFFSET: 0x007E1060
// FUNCTION: fn_09687
const char* SkinInfo::Prefix() const {
if (this->selected == -1) {
return "";
}
return this->prefixes[this->selected].c_str();
}
// OFFSET: 0x007E10E0
// FUNCTION: fn_09688
const char* SkinInfo::Name(int index) const {
if (index == -1) {
return "";
}
return this->names[index].c_str();
}
// OFFSET: 0x007E0C40
// FUNCTION: fn_09683
void SkinInfo::Prepare() {
if (this->selected == -1 || this->archives[this->selected] == 0 || this->prepared[this->selected] != 0) {
return;
}
char directory[2048];
std::sprintf(directory, "%s\\_tmpskin_", this->applicationDirectory);
const std::string target = std::string(directory) + "\\" + this->names[this->selected];
if (_access(target.c_str(), 0) == 0) {
return;
}
if (_access(directory, 0) != 0 && _mkdir(directory) != 0) {
return;
}
if (_access(target.c_str(), 0) != 0 && _mkdir(target.c_str()) != 0) {
return;
}
const std::string input = std::string("skin/") + this->names[this->selected];
const std::string output = std::string("_tmpskin_/") + this->names[this->selected];
_spawnl(_P_WAIT, "runzip.exe", "runzip.exe", "-n", input.c_str(), "-d", output.c_str(), nullptr);
this->prepared[this->selected] = 1;
}