diff --git a/Forms/mainwindow.ui b/Forms/mainwindow.ui index 7dd4dca..1fe6c34 100644 --- a/Forms/mainwindow.ui +++ b/Forms/mainwindow.ui @@ -86,7 +86,7 @@ - 0 + 2 @@ -709,19 +709,6 @@ Shops - - - - Qt::Horizontal - - - - 40 - 20 - - - - @@ -732,27 +719,53 @@ - - + + - <html><head/><body><p>On the island, Leila originally buys items for 1/80 of the price they'll be sold at. With this code enabled, Leila will buy items for their sell price.</p><p><span style=" font-weight:600;">Note: </span><span style=" text-decoration: underline;">This may only be visible to you and not other players.</span></p></body></html> + <html><head/><body><p>The Nooklings originally buys items for ⅕ of the price they'll be sold at. With this enabled, the Nooklings will buy items for their sell price.</p><p><span style=" font-weight:600;">Note: </span><span style=" text-decoration: underline;">This may only be visible to you and not other players.</span></p></body></html> - Leila Buys Items For Their Sell Price + Nooklings Buy Items For Their Sell Price - - + + - <html><head/><body><p>The Nooklings originally buys items for ⅕ of the price they'll be sold at. With this enabled, the Nooklings will buy items for their sell price.</p><p><span style=" font-weight:600;">Note: </span><span style=" text-decoration: underline;">This may only be visible to you and not other players.</span></p></body></html> + <html><head/><body><p>Enabling this makes shops pay the same price for native fruit as they do for foreign fruit.</p><p>E.g. If oranges was your native fruit, 1 orange will now sell for 500 bells instead of 100 bells.</p><p><span style=" font-weight:600;">Note: </span><span style=" text-decoration: underline;">This may only be visible to you and not other players.</span></p></body></html> - Nooklings Buy Items For Their Sell Price + Shops Buy Native Fruit For Same Price As Foreign Fruit - + + + + <html><head/><body><p>This patch allows you to change the time it takes for Cyrus to customise an item. This patch behaves differently depending on the state of the checkbox:</p><p><span style=" font-weight:600; text-decoration: underline;">Unchecked</span>: No changes.</p><p><span style=" font-weight:600; text-decoration: underline;">Partially Checked</span>: Items are instantly customised and can be collected right after giving to Cyrus.</p><p><span style=" font-weight:600; text-decoration: underline;">Fully Checked</span>: You can instead specify a custom time (in seconds) it takes for items to get customised.</p><p>Credit to Poyo for the save offsets used to create this patch :)</p></body></html> + + + Change Cyrus Customisation Time + + + true + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + <html><head/><body><p>This allows you to customise the opening hours of shops to your liking!</p><p><span style=" font-weight:600;">Note: </span><span style=" text-decoration: underline;">This may only be visible to you and not other players.</span></p></body></html> @@ -762,17 +775,17 @@ - - + + - <html><head/><body><p>Enabling this makes shops pay the same price for native fruit as they do for foreign fruit.</p><p>E.g. If oranges was your native fruit, 1 orange will now sell for 500 bells instead of 100 bells.</p><p><span style=" font-weight:600;">Note: </span><span style=" text-decoration: underline;">This may only be visible to you and not other players.</span></p></body></html> + <html><head/><body><p>On the island, Leila originally buys items for 1/80 of the price they'll be sold at. With this code enabled, Leila will buy items for their sell price.</p><p><span style=" font-weight:600;">Note: </span><span style=" text-decoration: underline;">This may only be visible to you and not other players.</span></p></body></html> - Shops Buy Native Fruit For Same Price As Foreign Fruit + Leila Buys Items For Their Sell Price - + Qt::Vertical @@ -785,6 +798,41 @@ + + + + true + + + QFrame::StyledPanel + + + Days: 00 | Hours: 00 | Mins: 25 | Seconds: 00 + + + Qt::AlignCenter + + + Qt::NoTextInteraction + + + + + + + false + + + 999999 + + + Qt::AlignCenter + + + Enter Amount In Seconds (Default Is 1500). + + + diff --git a/Headers/mainwindow.h b/Headers/mainwindow.h index 796b43d..62cf512 100644 --- a/Headers/mainwindow.h +++ b/Headers/mainwindow.h @@ -28,6 +28,9 @@ private slots: void on_actionAbout_triggered(); void on_BTN_Remapper_clicked(); void on_BTN_ItemPriceChanger_clicked(); + void on_dial_CameraZoomOut_valueChanged(int value); + void on_CB_CyrusCustoms_stateChanged(int arg1); + void on_LE_CustomiseSeconds_textChanged(const QString &arg1); /* Debug Stuff */ void on_actionEnableAll_triggered(); @@ -35,8 +38,6 @@ private slots: void on_actionSetup_OutDir_triggered(); void on_actionQuick_Open_EUR_triggered(); - void on_dial_CameraZoomOut_valueChanged(int value); - private: Ui::MainWindow *ui = nullptr; QString dir = "\0"; diff --git a/Headers/patch.h b/Headers/patch.h index ce3d251..7a490bb 100644 --- a/Headers/patch.h +++ b/Headers/patch.h @@ -131,10 +131,7 @@ extern Patch CmdKeyboard_ChangeTime; extern Patch CmdKeyboard_DupeAll; extern Patch CmdKeyboard_ClearInv; -extern Patch NativeFruitPrice; -extern Patch ReeseBuy; -extern Patch NooklingsBuy; -extern Patch LeilaBuy; +/* Exefs->General */ extern Patch Confetti; extern Patch CherryBlossom; extern Patch Weather; @@ -172,6 +169,13 @@ extern Patch InstantText; extern Patch CameraZoomOut; extern Patch CmdKeyboardHook; +/* Exefs->Shops */ +extern Patch NativeFruitPrice; +extern Patch ReeseBuy; +extern Patch NooklingsBuy; +extern Patch LeilaBuy; +extern Patch InstantCyrusCustoms; + /* Shop Times: Addresses are start of function */ extern Patch Retail; extern Patch Nooklings; diff --git a/Sources/game.cpp b/Sources/game.cpp index fc57b93..055be46 100644 --- a/Sources/game.cpp +++ b/Sources/game.cpp @@ -296,6 +296,16 @@ bool Game::ApplyPatches(Ui::MainWindow *mainui, File *codebin) { if(mainui->CB_LeilaBuy->isChecked()) res |= LeilaBuy.Apply(codebin); + if (mainui->CB_CyrusCustoms->checkState() == Qt::Checked) { //Can do custom time + bool success = false; + quint32 val = mainui->CB_CyrusCustoms->text().toUInt(&success, 10); + res |= !PatchCode(codebin, InstantCyrusCustoms.m_Offset+0xF4, (success == true ? val : 1500)); + } + + else if (mainui->CB_CyrusCustoms->checkState() == Qt::PartiallyChecked) { //Instant customisation + res |= InstantCyrusCustoms.Apply(codebin); + } + /* Exefs->Utilities */ if(mainui->CB_RegionPass->isChecked()) res |= RegionCheck.Apply(codebin); diff --git a/Sources/mainwindow.cpp b/Sources/mainwindow.cpp index 3a5f865..d67ae1e 100644 --- a/Sources/mainwindow.cpp +++ b/Sources/mainwindow.cpp @@ -211,6 +211,35 @@ void MainWindow::on_dial_CameraZoomOut_valueChanged(int value) } +void MainWindow::on_CB_CyrusCustoms_stateChanged(int arg1) +{ + ui->LE_CustomiseSeconds->setEnabled(false); //Nothing or Instant Unlock (nocheck or partially checked) + + if (arg1 == Qt::Checked) { //Custom value + ui->LE_CustomiseSeconds->setEnabled(true); + } +} + +void MainWindow::on_LE_CustomiseSeconds_textChanged(const QString &arg1) +{ + static constexpr char lblText[] = "Days: %02d | Hours: %02d | Mins: %02d | Seconds: %02d"; + bool res = false; + quint32 days = 0, hours = 0, mins = 0, secs = 1; + quint32 val = arg1.toUInt(&res, 10); + + if (res == true) { + secs = val%60; + mins = val/(60); + hours = mins/60; + mins %= 60; + days = hours/24; + hours%= 24; + } + + ui->LBL_CustomiseParsed->setText(QString::asprintf(lblText, days,hours,mins,secs)); +} + + /* Debug Stuff */ void MainWindow::on_actionEnableAll_triggered() { diff --git a/Sources/patch.cpp b/Sources/patch.cpp index 8e8765a..e640e74 100644 --- a/Sources/patch.cpp +++ b/Sources/patch.cpp @@ -168,6 +168,11 @@ static const QVector Permit100Pattern2 = { //+0x8 0x81, 0x10, 0x82, 0xE1, 0x07, 0x30, 0xCC, 0xE3 }; +static const QVector InstantCyrusCustomsPattern = { //+0 +0x03, 0x70, 0xA0, 0xE1, 0x27, 0x00, 0x00, 0x2A, +0x04, 0x20, 0x85, 0xE0, 0x01, 0x00, 0xA0, 0xE3 +}; + //Check if button is newly pressed static const QVector hidKeysDownPattern = { // -0x30 for function start 0x00, 0x00, 0xA0, 0x93, 0x04, 0x00, 0x90, 0xE5, @@ -348,10 +353,6 @@ Patch CmdKeyboard_DupeAll; Patch CmdKeyboard_ClearInv; /* Exefs->General */ -Patch NativeFruitPrice; -Patch ReeseBuy; -Patch NooklingsBuy; -Patch LeilaBuy; Patch Confetti; //Pattern: 16 5B 84 E2 AC 50 85 E2 00 00 95 E5 00 00 50 E3 + 0x8 Patch CherryBlossom; //Pattern: 10 D0 4D E2 02 00 A0 E3 16 6B 84 E2 AC 60 86 E2 + 0x8 Patch Weather; //Pattern: 1st find of [06 10 41 E2 00 00 51 E3 18 10 81 B2 34 00 50 E3] + 0x88 @@ -390,6 +391,13 @@ Patch InstantText; //Pattern: 08 10 8D E5 08 10 8D E2 04 00 A0 E1 + 0x48 Patch CameraZoomOut; //Float; Pattern: 05 1A C0 ED 06 0A 80 ED 0A 1A 80 ED 0B 3A C0 ED 1E FF 2F E1 + 0x14 Patch CmdKeyboardHook; +/* Exefs->Shops */ +Patch NativeFruitPrice; +Patch ReeseBuy; +Patch NooklingsBuy; +Patch LeilaBuy; +Patch InstantCyrusCustoms; //Pattern: 03 70 A0 E1 27 00 00 2A 04 20 85 E0 01 00 A0 E3 + 0 + /* Shop Times: Addresses are start of function */ Patch Retail; Patch Nooklings; //Pattern: 00 10 A0 E1 14 00 D4 E5 04 40 91 E5 @@ -539,10 +547,6 @@ void Patch::Init(void) { qDebug() << "End Button Remap Utils"; /* Exefs->General */ - NativeFruitPrice = Patch(0x30576C, 0x3056AC, 0x3056B8, KOR, 0x30576C, 0x305714, 0x3056B8, WAKOR, NOPVec); - ReeseBuy = Patch(0x768EE0, 0x76A740, 0x769748, KOR, 0x768EB8, 0x769724, 0x769720, WAKOR, NOPVec); - NooklingsBuy = Patch(0x769148, 0x76A9A8, 0x7699B0, KOR, 0x769120, 0x76998C, 0x769988, WAKOR, QVector({{0xE1A041A0, 0}, {NOP, 8}})); - LeilaBuy = Patch(0x768884, 0x76A0E4, 0x7690EC, KOR, 0x76885C, 0x7690C8, 0x7690C4, WAKOR, QVector({{0xE1A00004,0}})); Confetti = Patch(ConfettiPattern, QVector({{0xE3A00001, 0}, {0xE3A00078, 0x30}}), 8); CherryBlossom = Patch(CherryBPattern, QVector({{0xE3A00001, 0}, {0xE3A00001, 0x28}, {0xE3A00004, 0x50}, {0xE3A01001, 0x60}}), 0x10); Weather = Patch(0x62E728, 0x62FC30, 0x62EC68, KOR, 0x62E728, 0x62F158, 0x62EC68, WAKOR, QVector({{0xE3A00000,0}})); //Pattern: 1st find of [06 10 41 E2 00 00 51 E3 18 10 81 B2 34 00 50 E3] + 0x88 @@ -585,6 +589,15 @@ void Patch::Init(void) { CmdKeyboardHook = Patch(CmdKeyboardHookPattern, QVector({{0xE3A00000, 0}, {0xE3500000, 4}, {0xE59F6064, 8}, {0x15960000, 0xC}}), static_cast(-0x10)); qDebug() << "End Exefs->Utilities"; + /* Exefs->Shops */ + NativeFruitPrice = Patch(0x30576C, 0x3056AC, 0x3056B8, KOR, 0x30576C, 0x305714, 0x3056B8, WAKOR, NOPVec); + ReeseBuy = Patch(0x768EE0, 0x76A740, 0x769748, KOR, 0x768EB8, 0x769724, 0x769720, WAKOR, NOPVec); + NooklingsBuy = Patch(0x769148, 0x76A9A8, 0x7699B0, KOR, 0x769120, 0x76998C, 0x769988, WAKOR, QVector({{0xE1A041A0, 0}, {NOP, 8}})); + LeilaBuy = Patch(0x768884, 0x76A0E4, 0x7690EC, KOR, 0x76885C, 0x7690C8, 0x7690C4, WAKOR, QVector({{0xE1A00004,0}})); + InstantCyrusCustoms=Patch(InstantCyrusCustomsPattern, QVector({{0xE1A07002, 0}, {0xE3A00000, 0xC}}),0); + qDebug() << "End Exefs->Shops"; + + /* Shop Times: Addresses are start of function */ Retail = Patch(0x309310, 0x30929C, 0x309298, KOR, 0x309310, 0x309384, 0x309298, WAKOR, FFVec); Nooklings = Patch(0x710054, 0x7118A0, 0x7108A8, KOR, 0x71002C, 0x710D50, 0x710880, WAKOR, FFVec); //Pattern: 00 10 A0 E1 14 00 D4 E5 04 40 91 E5