Skip to content

Commit

Permalink
Change namespace
Browse files Browse the repository at this point in the history
  • Loading branch information
esuo1198 committed Apr 23, 2024
1 parent 3920cc2 commit 849bbab
Show file tree
Hide file tree
Showing 9 changed files with 43 additions and 43 deletions.
6 changes: 3 additions & 3 deletions meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -66,12 +66,12 @@ library(
'src/helpers.cpp',
'src/poll.cpp',
'src/bnusio.cpp',
'src/patches/jp_nov_2020.cpp',
'src/patches/jp_apr_2023.cpp',
'src/patches/cn_jun_2023.cpp',
'src/patches/audio.cpp',
'src/patches/qr.cpp',
'src/patches/amauth.cpp',
'src/patches/versions/JPN08.cpp',
'src/patches/versions/JPN39.cpp',
'src/patches/versions/CHN00.cpp',
],
name_prefix: ''
)
6 changes: 3 additions & 3 deletions src/constants.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

enum class GameVersion : XXH64_hash_t {
UNKNOWN = 0,
JP_NOV_2020 = 0x67C0F3042746D488,
JP_APR_2023 = 0x49F643ADB6B18705,
CN_JUN_2023 = 0xA7EE39F2CC2C57C8,
JPN08 = 0x67C0F3042746D488,
JPN39 = 0x49F643ADB6B18705,
CHN00 = 0xA7EE39F2CC2C57C8,
};
24 changes: 12 additions & 12 deletions src/dllmain.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -73,9 +73,9 @@ GetGameVersion () {
free (buf);

switch (gameVersion) {
case GameVersion::JP_NOV_2020:
case GameVersion::JP_APR_2023:
case GameVersion::CN_JUN_2023: break;
case GameVersion::JPN08:
case GameVersion::JPN39:
case GameVersion::CHN00: break;
default: MessageBoxA (nullptr, "Unknown game version", nullptr, MB_OK); ExitProcess (0);
}
}
Expand Down Expand Up @@ -132,12 +132,12 @@ DllMain (HMODULE module, DWORD reason, LPVOID reserved) {

if (version == "auto") {
GetGameVersion ();
} else if (version == "jp_nov_2020") {
gameVersion = GameVersion::JP_NOV_2020;
} else if (version == "jp_apr_2023") {
gameVersion = GameVersion::JP_APR_2023;
} else if (version == "cn_jun_2023") {
gameVersion = GameVersion::CN_JUN_2023;
} else if (version == "JPN08") {
gameVersion = GameVersion::JPN08;
} else if (version == "JPN39") {
gameVersion = GameVersion::JPN39;
} else if (version == "CHN00") {
gameVersion = GameVersion::CHN00;
} else {
MessageBoxA (nullptr, "Unknown patch version", nullptr, MB_OK);
ExitProcess (0);
Expand Down Expand Up @@ -186,9 +186,9 @@ DllMain (HMODULE module, DWORD reason, LPVOID reserved) {

switch (gameVersion) {
case GameVersion::UNKNOWN: break;
case GameVersion::JP_NOV_2020: patches::JP_NOV_2020::Init (); break;
case GameVersion::JP_APR_2023: patches::JP_APR_2023::Init (); break;
case GameVersion::CN_JUN_2023: patches::CN_JUN_2023::Init (); break;
case GameVersion::JPN08: patches::JPN08::Init (); break;
case GameVersion::JPN39: patches::JPN39::Init (); break;
case GameVersion::CHN00: patches::CHN00::Init (); break;
}
}
return true;
Expand Down
6 changes: 3 additions & 3 deletions src/patches/audio.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -51,17 +51,17 @@ Init () {
}

switch (gameVersion) {
case GameVersion::JP_NOV_2020: {
case GameVersion::JPN08: {
INSTALL_HOOK_DYNAMIC (NUSCDeviceInit, ASLR (0x140692E00));
INSTALL_HOOK_DYNAMIC (LoadASIODriver, ASLR (0x14069B750));
break;
}
case GameVersion::JP_APR_2023: {
case GameVersion::JPN39: {
INSTALL_HOOK_DYNAMIC (NUSCDeviceInit, ASLR (0x1407C8620));
INSTALL_HOOK_DYNAMIC (LoadASIODriver, ASLR (0x1407D0F70));
break;
}
case GameVersion::CN_JUN_2023: {
case GameVersion::CHN00: {
INSTALL_HOOK_DYNAMIC (NUSCDeviceInit, ASLR (0x140777F70));
INSTALL_HOOK_DYNAMIC (LoadASIODriver, ASLR (0x1407808C0));
break;
Expand Down
12 changes: 6 additions & 6 deletions src/patches/patches.h
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
namespace patches {
namespace JP_NOV_2020 {
namespace JPN08 {
void Init ();
} // namespace JP_NOV_2020
namespace JP_APR_2023 {
} // namespace JPN08
namespace JPN39 {
void Init ();
} // namespace JP_APR_2023
namespace CN_JUN_2023 {
} // namespace JPN39
namespace CHN00 {
void Init ();
} // namespace CN_JUN_2023
} // namespace CHN00
namespace Audio {
void Init ();
} // namespace Audio
Expand Down
10 changes: 5 additions & 5 deletions src/patches/qr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -197,15 +197,15 @@ Update () {
if (!qrEnabled) return;
if (gState == State::Ready) {
if (IsButtonTapped (CARD_INSERT_1)) {
if (gameVersion != GameVersion::CN_JUN_2023) return;
if (gameVersion != GameVersion::CHN00) return;

std::cout << "Insert" << std::endl;
accessCode = "BNTTCNID";
accessCode += accessCode1;
gState = State::CopyWait;
gMode = Mode::Card;
} else if (IsButtonTapped (CARD_INSERT_2)) {
if (gameVersion != GameVersion::CN_JUN_2023) return;
if (gameVersion != GameVersion::CHN00) return;

std::cout << "Insert" << std::endl;
accessCode = "BNTTCNID";
Expand Down Expand Up @@ -267,7 +267,7 @@ Init () {
SetConsoleOutputCP (CP_UTF8);
auto amHandle = (u64)GetModuleHandle ("AMFrameWork.dll");
switch (gameVersion) {
case GameVersion::JP_NOV_2020: {
case GameVersion::JPN08: {
INSTALL_HOOK_DYNAMIC (qrInit, (LPVOID)(amHandle + 0x1BA00));
INSTALL_HOOK_DYNAMIC (qrRead, (LPVOID)(amHandle + 0x1BC20));
INSTALL_HOOK_DYNAMIC (qrClose, (LPVOID)(amHandle + 0x1BBD0));
Expand All @@ -279,7 +279,7 @@ Init () {
INSTALL_HOOK_DYNAMIC (copy_data, (LPVOID)(amHandle + 0x1C2A0));
break;
}
case GameVersion::JP_APR_2023: {
case GameVersion::JPN39: {
INSTALL_HOOK_DYNAMIC (qrInit, (LPVOID)(amHandle + 0x1EDC0));
INSTALL_HOOK_DYNAMIC (qrRead, (LPVOID)(amHandle + 0x1EFB0));
INSTALL_HOOK_DYNAMIC (qrClose, (LPVOID)(amHandle + 0x1EF60));
Expand All @@ -291,7 +291,7 @@ Init () {
INSTALL_HOOK_DYNAMIC (copy_data, (LPVOID)(amHandle + 0x1F630));
break;
}
case GameVersion::CN_JUN_2023: {
case GameVersion::CHN00: {
INSTALL_HOOK_DYNAMIC (qrInit, (LPVOID)(amHandle + 0x161B0));
INSTALL_HOOK_DYNAMIC (qrRead, (LPVOID)(amHandle + 0x163A0));
INSTALL_HOOK_DYNAMIC (qrClose, (LPVOID)(amHandle + 0x16350));
Expand Down
10 changes: 5 additions & 5 deletions src/patches/cn_jun_2023.cpp → src/patches/versions/CHN00.cpp
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
#include "../patches.h"
#include "helpers.h"
#include "patches.h"
#include <safetyhook.hpp>

extern std::string chassisId;

namespace patches::CN_JUN_2023 {
namespace patches::CHN00 {

u8 *haspBuffer;
HOOK (i32, HaspDecrypt, PROC_ADDRESS ("hasp_windows_x64.dll", "hasp_decrypt")) { return 0; }
Expand Down Expand Up @@ -133,8 +133,8 @@ Init () {
xRes = readConfigInt (res, "x", xRes);
yRes = readConfigInt (res, "y", yRes);
}
vsync = readConfigBool (patches, "vsync", vsync);
unlockSongs = readConfigBool (patches, "unlock_songs", unlockSongs);
vsync = readConfigBool (patches, "vsync", vsync);
unlockSongs = readConfigBool (patches, "unlock_songs", unlockSongs);
auto cn_jun_2023 = openConfigSection (patches, "cn_jun_2023");
if (cn_jun_2023) {
fixLanguage = readConfigBool (cn_jun_2023, "fix_language", fixLanguage);
Expand Down Expand Up @@ -220,4 +220,4 @@ Init () {
patches::Audio::Init ();
patches::Qr::Init ();
}
} // namespace patches::CN_JUN_2023
} // namespace patches::CHN00
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#include "../patches.h"
#include "helpers.h"
#include "patches.h"
#include <safetyhook.hpp>

extern u64 song_data_size;
Expand All @@ -11,7 +11,7 @@ extern void *song_data;
instruction, (u8)(u64)(location), (u8)((u64)(location) >> 8), (u8)((u64)(location) >> 16), (u8)((u64)(location) >> 24), (u8)((u64)(location) >> 32), (u8)((u64)(location) >> 40), \
(u8)((u64)(location) >> 48), (u8)((u64)(location) >> 56)

namespace patches::JP_NOV_2020 {
namespace patches::JPN08 {

HOOK_DYNAMIC (char, __fastcall, AMFWTerminate, i64) { return 0; }

Expand Down Expand Up @@ -179,4 +179,4 @@ Init () {
patches::Qr::Init ();
patches::AmAuth::Init ();
}
} // namespace patches::JP_NOV_2020
} // namespace patches::JPN08
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
#include "../patches.h"
#include "helpers.h"
#include "patches.h"
#include <safetyhook.hpp>

namespace patches::JP_APR_2023 {
namespace patches::JPN39 {

HOOK_DYNAMIC (char, __fastcall, AMFWTerminate, i64) { return 0; }

Expand Down Expand Up @@ -138,4 +138,4 @@ Init () {
patches::Qr::Init ();
patches::AmAuth::Init ();
}
} // namespace patches::JP_APR_2023
} // namespace patches::JPN39

0 comments on commit 849bbab

Please sign in to comment.