diff --git a/main/source/init/tasks.cpp b/main/source/init/tasks.cpp index 53a7aa654..03a7ede26 100644 --- a/main/source/init/tasks.cpp +++ b/main/source/init/tasks.cpp @@ -45,18 +45,6 @@ namespace hex::init { return true; } - static bool downloadInformation() { - hex::Net net; - - auto tip = net.getString(ImHexApiURL + "/tip"s, 200).get(); - if (tip.code != 200) - return false; - - ImHexApi::System::impl::addInitArgument("tip-of-the-day", tip.body); - - return true; - } - bool createDirectories() { bool result = true; @@ -319,7 +307,6 @@ namespace hex::init { { "Loading settings", loadSettings, false }, { "Loading plugins", loadPlugins, false }, { "Checking for updates", checkForUpdates, true }, - { "Downloading information", downloadInformation, true }, { "Loading fonts", loadFonts, true }, }; } diff --git a/plugins/builtin/romfs/tips.json b/plugins/builtin/romfs/tips.json new file mode 100644 index 000000000..e17ea73e3 --- /dev/null +++ b/plugins/builtin/romfs/tips.json @@ -0,0 +1,23 @@ +[ + { + "name" : "ImHex", + "tips" : [ + "Try pressing CTRL + Shift + P to open the command palette!", + "The data processor allows pre-processing of the binary input data before it's displayed without modifying the original data.", + "Take a closer look at the Splash screen :)", + "Check out the WerWolv/ImHex-Patterns repository for pre-made patterns and more!", + "ImHex can be easily extended with plugins through its API." + ] + }, + { + "name" : "Reverse Engineering", + "tips" : [ + "Reverse Engineering a foreign file format becomes a lot easier if you know some values that should be stored in there.", + "Ghidra, binwalk, Unicorn, x86dbg, DetectItEasy, Dependencies and CheatEngine are other fantastic and free reverse engineering tools!", + "ALWAYS read the documentation if there is one. It will save you a lot of time.", + "Tools are what you make of them, practice makes perfect.", + "Looking for patterns and repeating structures in binary data is always a good start.", + "The entropy graph is an easy way to quickly figure out where interesting data is stored and if the data is encrypted or compressed." + ] + } +] diff --git a/plugins/builtin/source/content/welcome_screen.cpp b/plugins/builtin/source/content/welcome_screen.cpp index d9cc3660e..be5f3d7a7 100644 --- a/plugins/builtin/source/content/welcome_screen.cpp +++ b/plugins/builtin/source/content/welcome_screen.cpp @@ -22,6 +22,7 @@ #include #include #include +#include namespace hex::plugin::builtin { @@ -549,8 +550,17 @@ namespace hex::plugin::builtin { } } - if (ImHexApi::System::getInitArguments().contains("tip-of-the-day")) { - s_tipOfTheDay = ImHexApi::System::getInitArguments()["tip-of-the-day"]; + auto tipsData = romfs::get("tips.json"); + if(tipsData.valid()){ + auto tipsCategories = nlohmann::json::parse(tipsData.string()); + + auto now = std::chrono::system_clock::now(); + auto days_since_epoch = std::chrono::duration_cast(now.time_since_epoch()); + std::mt19937 random(days_since_epoch.count()); + + auto chosenCategory = tipsCategories[random()%tipsCategories.size()]["tips"]; + auto chosenTip = chosenCategory[random()%chosenCategory.size()]; + s_tipOfTheDay = chosenTip.get(); bool showTipOfTheDay = ContentRegistry::Settings::read("hex.builtin.setting.general", "hex.builtin.setting.general.show_tips", 1); if (showTipOfTheDay)