multiplier bits now functional

main
Síle Ekaterin Liszka 2021-05-24 00:13:38 -05:00
parent 37b66bab1a
commit b6e652ee18
3 changed files with 61 additions and 0 deletions

View File

@ -7,3 +7,8 @@ enum Job {
}; };
const long int job_innates = 0x156138; const long int job_innates = 0x156138;
const long int monster_block = 0x14D228;
const long int form_block = 0x14FAA8;
// XP Offset = 14D234 - 14D228 = 0xC
// XP little-endian; 0xC D
// Gil little-endian; 0xE F

View File

@ -218,6 +218,7 @@ void Exdeath::btnApply_clicked(bool trigger) {
if (chkPassages->isChecked() || chkPitfalls->isChecked() || chkLiteStep->isChecked() || chkDash->isChecked() || chkLearning->isChecked()) { if (chkPassages->isChecked() || chkPitfalls->isChecked() || chkLiteStep->isChecked() || chkDash->isChecked() || chkLearning->isChecked()) {
applyInnates(target); applyInnates(target);
} }
applyMultipliers(target);
target->close(); target->close();
} }
@ -285,3 +286,57 @@ void Exdeath::applyInnates(QFile *file) {
file->write(temp, 2); file->write(temp, 2);
} }
} }
void Exdeath::applyMultipliers(QFile *file) {
// go go gadget vomit bag!
int XP = butsXP->checkedButton()->text().data()[0].digitValue();
int AP = butsAP->checkedButton()->text().data()[0].digitValue();
int Gil = butsGil->checkedButton()->text().data()[0].digitValue();
if (XP == AP == Gil == 1) {
return;
}
for (int i = 0; i < 725; i++) {
char temp[2];
unsigned short data = 0;
// XP
file->seek(monster_block + (i * 36) + 0xC);
file->read(temp, 2);
data = (temp[1] << 8) + temp[0];
if ((data * XP) > 65535) {
data = 65535;
} else {
data *= XP;
}
temp[1] = (data >> 8) & 0xFF;
temp[0] = data & 0xFF;
file->seek(monster_block + (i * 36) + 0xC);
file->write(temp, 2);
// Gil
file->seek(monster_block + (i * 36) + 0xE);
file->read(temp, 2);
data = (temp[1] << 8) + temp[0];
if ((data * Gil) > 65535) {
data = 65535;
} else {
data *= Gil;
}
temp[1] = (data >> 8) & 0xFF;
temp[0] = data & 0xFF;
file->seek(monster_block + (i * 36) + 0xE);
file->write(temp, 2);
}
for (int i = 0; i < 512; i++) {
char temp[2];
file->seek(form_block + (i * 28) + 2);
file->read(temp, 1);
if ((temp[0] * AP) > 255) {
temp[0] = -1; // 255, but this API doesn't support unsigned char.
} else {
temp[0] *= AP;
}
file->seek(form_block + (i * 28) + 2);
file->write(temp, 1);
}
}

View File

@ -85,6 +85,7 @@ private:
void btnApply_clicked(bool trigger); void btnApply_clicked(bool trigger);
void applyPatch(QFile *file, QString patch); void applyPatch(QFile *file, QString patch);
void applyInnates(QFile *file); void applyInnates(QFile *file);
void applyMultipliers(QFile *file);
}; };
#endif #endif