-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
# Conflicts: # projects/Core/messages/message_controller.h # projects/Randomizer/randomizer.cpp # projects/Randomizer/seed/legacy_parser/parser.cpp
- Loading branch information
Showing
29 changed files
with
2,519 additions
and
63 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
#include <Core/api/game/game.h> | ||
#include <Core/api/system/save_files.h> | ||
#include <Core/utils/byte_stream.h> | ||
#include <Modloader/app/methods/Grdk/Wrapper.h> | ||
#include <Modloader/app/methods/SaveGameController.h> | ||
#include <Modloader/app/methods/System/IO/File.h> | ||
|
||
using namespace app::classes; | ||
|
||
namespace core::api::save_files { | ||
app::Byte__Array* get_byte_array(int slot_index, int backup_index) { | ||
if (Grdk::Wrapper::get_InitializedOk()) { // Handle GRDK (Xbox Account) saves | ||
return Grdk::Wrapper::Load_1(slot_index, backup_index); | ||
} | ||
|
||
auto save_info = SaveGameController::GetSaveFileInfo(game::save_controller(), slot_index, backup_index); | ||
|
||
return System::IO::File::ReadAllBytes( | ||
backup_index >= 0 | ||
? save_info->fields.m_FullBackupSaveFilePath | ||
: save_info->fields.m_FullSaveFilePath | ||
); | ||
} | ||
|
||
std::vector<std::byte> get_bytes(int slot_index, int backup_index) { | ||
return utils::ByteStream(get_byte_array(slot_index, backup_index)).peek_to_end(); | ||
} | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
#pragma once | ||
|
||
#include <vector> | ||
|
||
namespace core::api::save_files { | ||
/** | ||
* Get the on-disk save data for a save file. | ||
* @param slot_index Save slot index | ||
* @param backup_index Backup slot index. Set this to -1 to request the current game save file. | ||
* @return Pointer to an il2cpp array of System.Byte. | ||
*/ | ||
CORE_DLLEXPORT app::Byte__Array* get_byte_array(int slot_index, int backup_index = -1); | ||
|
||
/** | ||
* Get the on-disk save data for a save file. | ||
* @param slot_index Save slot index | ||
* @param backup_index Backup slot index. Set this to -1 to request the current game save file. | ||
* @return Byte vector containing the on-disk save data | ||
*/ | ||
CORE_DLLEXPORT std::vector<std::byte> get_bytes(int slot_index, int backup_index = -1); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
#pragma once | ||
|
||
#include <string_view> | ||
#include <string> | ||
#include <vector> | ||
#include <Core/macros.h> | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
#include <Modloader/console_logging_handler.h> | ||
|
||
#include "windows_api/console.h" | ||
|
||
namespace modloader { | ||
std::string get_message_type_prefix(MessageType type) { | ||
switch (type) { | ||
case MessageType::Error: | ||
return "\033[91mERROR\033[0m"; | ||
case MessageType::Warning: | ||
return "\033[93mWARN \033[0m"; | ||
case MessageType::Info: | ||
return "\033[92mINFO \033[0m"; | ||
case MessageType::Debug: | ||
return "\033[97mDEBUG\033[0m"; | ||
} | ||
|
||
return "UNKWN"; | ||
} | ||
|
||
void ConsoleLoggingHandler::write(MessageType type, std::string const& group, std::string const& message) { | ||
modloader::win::console::console_send( | ||
std::format("{} \033[95m{}\033[0m: {}", get_message_type_prefix(type), group, message) | ||
); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
#pragma once | ||
|
||
#include <Modloader/modloader.h> | ||
|
||
#include <filesystem> | ||
#include <fstream> | ||
#include <mutex> | ||
|
||
namespace modloader { | ||
class ConsoleLoggingHandler final : public ILoggingHandler { | ||
public: | ||
explicit ConsoleLoggingHandler() {}; | ||
|
||
void write(MessageType type, std::string const& group, std::string const& message) override; | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.