Decompile fn_23501 (CSession::LoadMiniPartyInfo)

Batch #6727 by superintelligence: 0 byte-identical, 1 confirmed by peer review.

- fn_23501 CSession::LoadMiniPartyInfo: logic confirmed by peer review

Peer-reviewed-by: eAthena, KWDev, Tanke
Accepted without human review: peers confirmed the logic ("same" ahead by at least 3, with 70% of the votes).
This commit is contained in:
ragnarok-clanker 2026-10-31 01:47:16 +00:00
commit 37ec9b816b
2 changed files with 69 additions and 0 deletions

View file

@ -10,6 +10,7 @@
#include "Contents/World/World.h"
#include "Contents/Actors/GameActor.h"
#include "Contents/Messenger/ClientMessenger.h"
#include "File/File.h"
#include "Network/Connection/Connection.h"
#include "Network/Packets/PacketId.h"
#include "Network/TextEncoding.h"
@ -25,6 +26,7 @@
#include <cstdint>
#include <cstdlib>
#include <cstring>
#include <mbstring.h>
#include <list>
#include <string>
#include <vector>
@ -1918,3 +1920,69 @@ int CSession::CountItems17F0() const {
void CSession::InvalidateWindowFrames() {
reinterpret_cast<WindowOrdering&>(g_windowMgr).InvalidateFrames(g_windowMgr.unknown_04FC);
}
// OFFSET: 0x00DE9430
// FUNCTION: fn_23501
void CSession::LoadMiniPartyInfo() {
CFile file;
if (!file.Open("savedata\\MiniPartyInfo.lua", 0, false, false)) {
return;
}
const int size = file.GetSize();
char* data = new char[size + 1];
file.Read(data, size);
data[size] = '\0';
file.Close();
int state = 1;
char name[24] = {0};
char token[24];
SessionRecord0734 record;
for (int i = 0; i < size; ++i) {
record.unknown_0000 = 1;
switch (data[i]) {
case ',': {
if (_mbsstr(reinterpret_cast<const unsigned char*>(name),
reinterpret_cast<const unsigned char*>(g_session.DecodePlayerName())) != nullptr) {
if (state == 2) {
++i;
record.id = std::atoi(&data[i]);
state = 3;
} else if (state == 3) {
++i;
record.unknown_0008 = std::atoi(&data[i]);
state = 1;
}
}
break;
}
case '{': {
++i;
std::memset(name, 0, sizeof(name));
std::memset(token, 0, sizeof(token));
int position = 0;
while (data[i] != ',') {
token[position] += data[i];
++position;
++i;
}
strcpy_s(name, sizeof(name), token);
if (state == 1) {
++i;
record.unknown_0000 = std::atoi(&data[i]);
state = 2;
}
break;
}
case '}':
this->unknown_0734.push_back(record);
break;
case '\n':
case '\r':
break;
}
}
std::free(data);
}