mirror of
https://github.com/azahar-emu/ArticSetupTool
synced 2025-11-06 15:10:01 +01:00
Check proper deviceID and update spec to latest Azahar
This commit is contained in:
parent
67a76a8db3
commit
665a12e416
2
Makefile
2
Makefile
@ -1,6 +1,6 @@
|
||||
VERSION_MAJOR := 1
|
||||
VERSION_MINOR := 0
|
||||
VERSION_REVISION := 1
|
||||
VERSION_REVISION := 2
|
||||
|
||||
all:
|
||||
mkdir -p plugin/build
|
||||
|
||||
@ -26,7 +26,7 @@ LIBRARIES := ctru
|
||||
|
||||
VERSION_MAJOR := 1
|
||||
VERSION_MINOR := 0
|
||||
VERSION_MICRO := 1
|
||||
VERSION_MICRO := 2
|
||||
|
||||
BUILD_FLAGS := -march=armv6k -mtune=mpcore -mfloat-abi=hard
|
||||
BUILD_FLAGS_CC := -g -Wall -Wno-strict-aliasing -O3 -mword-relocations \
|
||||
|
||||
@ -150,12 +150,12 @@ void Logger::Handler() {
|
||||
printf("[I] %s\n", log.string.c_str());
|
||||
break;
|
||||
case PendingLog::Type::WARNING:
|
||||
topScreenConsole.fg = 19;
|
||||
topScreenConsole.fg = 3;
|
||||
printf("[W] %s\n", log.string.c_str());
|
||||
topScreenConsole.fg = 0;
|
||||
break;
|
||||
case PendingLog::Type::ERROR:
|
||||
topScreenConsole.fg = 17;
|
||||
topScreenConsole.fg = 1;
|
||||
printf("[E] %s\n", log.string.c_str());
|
||||
topScreenConsole.fg = 0;
|
||||
break;
|
||||
|
||||
@ -127,6 +127,12 @@ bool launchPlugin() {
|
||||
return true;
|
||||
}
|
||||
|
||||
bool checkEmulator() {
|
||||
s64 out = 0;
|
||||
svcGetSystemInfo(&out, 0x20000, 0);
|
||||
return out != 0;
|
||||
}
|
||||
|
||||
PrintConsole topScreenConsole, bottomScreenConsole;
|
||||
int transferedBytes = 0;
|
||||
void Main() {
|
||||
@ -148,14 +154,20 @@ void Main() {
|
||||
consoleSelect(&topScreenConsole);
|
||||
consoleClear();
|
||||
|
||||
bool isEmulator = checkEmulator();
|
||||
|
||||
{
|
||||
CTRPluginFramework::BCLIM((void*)__data_logo_bin, __data_logo_bin_size).Render(CTRPluginFramework::Rect<int>((320 - 128) / 2, (240 - 128) / 2, 128, 128));
|
||||
}
|
||||
logger.Raw(false, "\n Azahar Artic Setup v%d.%d.%d\n", VERSION_MAJOR, VERSION_MINOR, VERSION_REVISION);
|
||||
logger.Raw(false, " Press A to launch setup tool.");
|
||||
logger.Raw(false, isEmulator ? " " : " Press A to launch setup tool.");
|
||||
logger.Raw(false, " Press B or START to exit.");
|
||||
logger.Raw(true, "");
|
||||
logger.Info("Welcome to Azahar Artic Setup Tool!\n Only use this tool with Azahar Emulator\n\n Check bottom screen for controls.");
|
||||
|
||||
if (isEmulator) {
|
||||
logger.Error("This tool can only be used on a real console.");
|
||||
}
|
||||
|
||||
bool do_jump = false;
|
||||
while (aptMainLoop())
|
||||
@ -170,7 +182,7 @@ void Main() {
|
||||
break;
|
||||
}
|
||||
|
||||
if (kDown & KEY_A) {
|
||||
if ((kDown & KEY_A) && !isEmulator) {
|
||||
logger.Info("Launching Azahar Artic Setup");
|
||||
bool done = extractPlugin() && launchPlugin();
|
||||
if (done) {
|
||||
|
||||
@ -1 +1 @@
|
||||
Subproject commit faa3a2d62172fd0964a495a8b4143827cad1b0db
|
||||
Subproject commit eca355a4961f7550f8a1d1a7e1d3b90e34a7b920
|
||||
@ -16,7 +16,7 @@ SOURCES := ArticProtocol/sources sources sources/CTRPluginFramework
|
||||
|
||||
VERSION_MAJOR := 1
|
||||
VERSION_MINOR := 0
|
||||
VERSION_REVISION := 1
|
||||
VERSION_REVISION := 2
|
||||
SERVER_PORT := 5543
|
||||
|
||||
IP := 19
|
||||
|
||||
@ -15,7 +15,7 @@ extern "C" {
|
||||
}
|
||||
|
||||
extern bool isControllerMode;
|
||||
constexpr u32 INITIAL_SETUP_APP_VERSION = 0;
|
||||
constexpr u32 INITIAL_SETUP_APP_VERSION = 1;
|
||||
|
||||
enum class HandleType {
|
||||
FILE,
|
||||
@ -523,10 +523,25 @@ namespace ArticFunctions {
|
||||
}
|
||||
|
||||
void System_IsAzaharInitialSetup(ArticProtocolServer::MethodInterface& mi) {
|
||||
// This function is stubbed, only kept for compatibility reasons
|
||||
|
||||
bool good = true;
|
||||
|
||||
if (good) mi.FinishInputParameters();
|
||||
|
||||
logger.Error("Tool and Azahar version mismatch.\n Please check for updates.");
|
||||
|
||||
mi.FinishGood(-1);
|
||||
}
|
||||
|
||||
void System_ArticSetupVersion(ArticProtocolServer::MethodInterface& mi) {
|
||||
bool good = true;
|
||||
s32 expected;
|
||||
|
||||
if (good) good = mi.GetParameterS32(expected);
|
||||
|
||||
if (good) mi.FinishInputParameters();
|
||||
|
||||
ArticProtocolCommon::Buffer* ret_buf = mi.ReserveResultBuffer(0, 4);
|
||||
if (!ret_buf) {
|
||||
return;
|
||||
@ -534,6 +549,37 @@ namespace ArticFunctions {
|
||||
reinterpret_cast<u32*>(ret_buf->data)[0] = INITIAL_SETUP_APP_VERSION;
|
||||
isAzaharCalled = true;
|
||||
|
||||
if ((u32)expected != INITIAL_SETUP_APP_VERSION) {
|
||||
logger.Error("Tool and Azahar version mismatch.\n Please check for updates.");
|
||||
}
|
||||
|
||||
mi.FinishGood(0);
|
||||
}
|
||||
|
||||
void System_ReportDeviceID(ArticProtocolServer::MethodInterface& mi) {
|
||||
bool good = true;
|
||||
s32 deviceID;
|
||||
|
||||
if (good) good = mi.GetParameterS32(deviceID);
|
||||
|
||||
if (good) mi.FinishInputParameters();
|
||||
|
||||
Result res = amInit();
|
||||
if (R_FAILED(res)) {
|
||||
mi.FinishGood(res);
|
||||
return;
|
||||
}
|
||||
|
||||
u32 myDeviceID;
|
||||
res = AM_GetDeviceId(&myDeviceID);
|
||||
amExit();
|
||||
|
||||
if ((u32)deviceID != myDeviceID) {
|
||||
logger.Error("Azahar is linked to a different console than this one. Please unlink your previous console from emulator settings before continuing.");
|
||||
mi.FinishGood(-1);
|
||||
return;
|
||||
}
|
||||
|
||||
mi.FinishGood(0);
|
||||
}
|
||||
|
||||
@ -898,6 +944,8 @@ namespace ArticFunctions {
|
||||
{METHOD_NAME("FSDIR_Close"), FSDIR_Close_},
|
||||
|
||||
{METHOD_NAME("System_IsAzaharInitialSetup"), System_IsAzaharInitialSetup},
|
||||
{METHOD_NAME("System_ArticSetupVersion"), System_ArticSetupVersion},
|
||||
{METHOD_NAME("System_ReportDeviceID"), System_ReportDeviceID},
|
||||
{METHOD_NAME("System_GetSystemFile"), System_GetSystemFile},
|
||||
{METHOD_NAME("System_GetNIM"), System_GetNIM},
|
||||
};
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user