Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions example_community_patch_settings_da.toml
Original file line number Diff line number Diff line change
Expand Up @@ -644,6 +644,11 @@ auto_confirm_discovery = true
# Open the bulk gift claim flyout automatically
auto_open_bulk_claim_flyout = false

# EXPERIMENTAL: Allow officer presets to be reordered in the presets screen
# Shift-click a preset's edit-name button to move it up; Ctrl-click to move it down
# The chosen order is stored locally and does not change Scopely's preset slots
allow_officer_preset_reordering = false

# Forhindr "Escape" i at spørge, om spillet skal afsluttes
disable_escape_exit = true

Expand Down
5 changes: 5 additions & 0 deletions example_community_patch_settings_de.toml
Original file line number Diff line number Diff line change
Expand Up @@ -644,6 +644,11 @@ auto_confirm_discovery = true
# Open the bulk gift claim flyout automatically
auto_open_bulk_claim_flyout = false

# EXPERIMENTAL: Allow officer presets to be reordered in the presets screen
# Shift-click a preset's edit-name button to move it up; Ctrl-click to move it down
# The chosen order is stored locally and does not change Scopely's preset slots
allow_officer_preset_reordering = false

# Verhindert, dass die Escape-Taste zum Beenden des Spiels auffordert
disable_escape_exit = true

Expand Down
5 changes: 5 additions & 0 deletions example_community_patch_settings_en-GB-x-cockney.toml
Original file line number Diff line number Diff line change
Expand Up @@ -644,6 +644,11 @@ auto_confirm_discovery = true
# Open the bulk gift claim flyout automatically
auto_open_bulk_claim_flyout = false

# EXPERIMENTAL: Allow officer presets to be reordered in the presets screen
# Shift-click a preset's edit-name button to move it up; Ctrl-click to move it down
# The chosen order is stored locally and does not change Scopely's preset slots
allow_officer_preset_reordering = false

# Prevent "escape" from prompting to exit the game
disable_escape_exit = true

Expand Down
5 changes: 5 additions & 0 deletions example_community_patch_settings_en-x-minionese.toml
Original file line number Diff line number Diff line change
Expand Up @@ -644,6 +644,11 @@ auto_confirm_discovery = true
# Open the bulk gift claim flyout automatically
auto_open_bulk_claim_flyout = false

# EXPERIMENTAL: Allow officer presets to be reordered in the presets screen
# Shift-click a preset's edit-name button to move it up; Ctrl-click to move it down
# The chosen order is stored locally and does not change Scopely's preset slots
allow_officer_preset_reordering = false

# Prevent "escape" from prompting to exit the game
disable_escape_exit = true

Expand Down
7 changes: 7 additions & 0 deletions example_community_patch_settings_en.toml
Original file line number Diff line number Diff line change
Expand Up @@ -263,6 +263,8 @@ loadingtiphooks = true
doubleclickassignshiphooks = true
forbiddentechconfirmhooks = true
audioeventhooks = true
# Install local preset ordering hooks; the feature remains opt-in under [ui]
officerpresetreorderhooks = true
freeresizehooks = true
game_version = true
giftsbulkclaimhooks = true
Expand Down Expand Up @@ -655,6 +657,11 @@ auto_confirm_discovery = true
# Open the bulk gift claim flyout automatically
auto_open_bulk_claim_flyout = false

# EXPERIMENTAL: Allow officer presets to be reordered in the presets screen
# Shift-click a preset's edit-name button to move it up; Ctrl-click (Command on Mac) moves it down
# The chosen order is stored locally and does not change Scopely's preset slots
allow_officer_preset_reordering = false

# Prevent "escape" from prompting to exit the game
disable_escape_exit = true

Expand Down
5 changes: 5 additions & 0 deletions example_community_patch_settings_es.toml
Original file line number Diff line number Diff line change
Expand Up @@ -644,6 +644,11 @@ auto_confirm_discovery = true
# Open the bulk gift claim flyout automatically
auto_open_bulk_claim_flyout = false

# EXPERIMENTAL: Allow officer presets to be reordered in the presets screen
# Shift-click a preset's edit-name button to move it up; Ctrl-click to move it down
# The chosen order is stored locally and does not change Scopely's preset slots
allow_officer_preset_reordering = false

# Impide que "Escape" pregunte si deseas salir del juego
disable_escape_exit = true

Expand Down
5 changes: 5 additions & 0 deletions example_community_patch_settings_fr.toml
Original file line number Diff line number Diff line change
Expand Up @@ -644,6 +644,11 @@ auto_confirm_discovery = true
# Open the bulk gift claim flyout automatically
auto_open_bulk_claim_flyout = false

# EXPERIMENTAL: Allow officer presets to be reordered in the presets screen
# Shift-click a preset's edit-name button to move it up; Ctrl-click to move it down
# The chosen order is stored locally and does not change Scopely's preset slots
allow_officer_preset_reordering = false

# Empêcher "échap" de proposer de quitter le jeu
disable_escape_exit = true

Expand Down
5 changes: 5 additions & 0 deletions example_community_patch_settings_nl.toml
Original file line number Diff line number Diff line change
Expand Up @@ -644,6 +644,11 @@ auto_confirm_discovery = true
# Open the bulk gift claim flyout automatically
auto_open_bulk_claim_flyout = false

# EXPERIMENTAL: Allow officer presets to be reordered in the presets screen
# Shift-click a preset's edit-name button to move it up; Ctrl-click to move it down
# The chosen order is stored locally and does not change Scopely's preset slots
allow_officer_preset_reordering = false

# Zorgt ervoor dat het gebruiken van "escape" het spel niet sluit
disable_escape_exit = true

Expand Down
5 changes: 5 additions & 0 deletions example_community_patch_settings_ru.toml
Original file line number Diff line number Diff line change
Expand Up @@ -644,6 +644,11 @@ auto_confirm_discovery = true
# Open the bulk gift claim flyout automatically
auto_open_bulk_claim_flyout = false

# EXPERIMENTAL: Allow officer presets to be reordered in the presets screen
# Shift-click a preset's edit-name button to move it up; Ctrl-click to move it down
# The chosen order is stored locally and does not change Scopely's preset slots
allow_officer_preset_reordering = false

# Не показывать запрос выхода из игры при нажатии Escape
disable_escape_exit = true

Expand Down
5 changes: 5 additions & 0 deletions example_community_patch_settings_tlh.toml
Original file line number Diff line number Diff line change
Expand Up @@ -644,6 +644,11 @@ auto_confirm_discovery = true
# Open the bulk gift claim flyout automatically
auto_open_bulk_claim_flyout = false

# EXPERIMENTAL: Allow officer presets to be reordered in the presets screen
# Shift-click a preset's edit-name button to move it up; Ctrl-click to move it down
# The chosen order is stored locally and does not change Scopely's preset slots
allow_officer_preset_reordering = false

# Prevent "escape" vo' prompting Daq exit game
disable_escape_exit = true

Expand Down
6 changes: 5 additions & 1 deletion mods/src/config.cc
Original file line number Diff line number Diff line change
Expand Up @@ -925,6 +925,8 @@ void Config::Load()
get_config_or_default(config, parsed, "patches", "forbiddentechconfirmhooks", DCP::forbiddentechconfirmhooks, write_config);
this->installAudioEventHooks =
get_config_or_default(config, parsed, "patches", "audioeventhooks", DCP::audioeventhooks, write_config);
this->installOfficerPresetReorderHooks = get_config_or_default(
config, parsed, "patches", "officerpresetreorderhooks", DCP::officerpresetreorderhooks, write_config);
this->installInstantCargoCounterHooks =
get_config_or_default(config, parsed, "patches", "instantcargocounterhooks", DCP::instantcargocounterhooks, write_config);
this->installCargoFormatHooks =
Expand Down Expand Up @@ -1036,7 +1038,9 @@ void Config::Load()
}
}
this->auto_open_bulk_claim_flyout = get_config_or_default(config, parsed, "ui", "auto_open_bulk_claim_flyout",
DCU::auto_open_bulk_claim_flyout, write_config);
DCU::auto_open_bulk_claim_flyout, write_config);
this->allow_officer_preset_reordering = get_config_or_default(
config, parsed, "ui", "allow_officer_preset_reordering", DCU::allow_officer_preset_reordering, write_config);

read_daily_bulk_claim_factions(config, parsed, this->daily_bulk_claim_factions, DCU::daily_bulk_claim_factions,
write_config);
Expand Down
6 changes: 4 additions & 2 deletions mods/src/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -213,8 +213,9 @@ class Config final
bool disable_toast_banners;
bool trace_audio_events;
std::vector<std::string> disabled_audio_events;
bool auto_open_bulk_claim_flyout;
bool auto_confirm_ft_upgrade;
bool auto_open_bulk_claim_flyout;
bool allow_officer_preset_reordering;
bool auto_confirm_ft_upgrade;

std::vector<std::string> daily_bulk_claim_factions;

Expand Down Expand Up @@ -278,6 +279,7 @@ class Config final
bool installForbiddenTechConfirmationHooks;
bool installInstantWarpConfirmationHooks;
bool installAudioEventHooks;
bool installOfficerPresetReorderHooks;

std::string config_settings_url;
std::string config_assets_url_override;
Expand Down
2 changes: 2 additions & 0 deletions mods/src/defaultconfig.h
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,7 @@ namespace Patches
constexpr bool doubleclickassignshiphooks = true;
constexpr bool forbiddentechconfirmhooks = true;
constexpr bool audioeventhooks = true;
constexpr bool officerpresetreorderhooks = true;
constexpr bool instantcargocounterhooks = true;
constexpr bool cargoformathooks = true; // on by default: cargo number precision override
constexpr bool officersorthooks = true; // restore Below Deck Ability sort option
Expand Down Expand Up @@ -246,6 +247,7 @@ namespace UI
constexpr bool auto_confirm_discovery = true;
constexpr bool auto_confirm_ft_upgrade = false;
constexpr bool auto_open_bulk_claim_flyout = false;
constexpr bool allow_officer_preset_reordering = false;
constexpr const char* daily_bulk_claim_factions = "";
constexpr bool daily_bulk_claim_toggle_default_on = false;
constexpr bool disable_escape_exit = true;
Expand Down
44 changes: 44 additions & 0 deletions mods/src/il2cpp/method_contract.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
#pragma once

#include "il2cpp-functions.h"
#include <il2cpp-tabledefs.h>
#include <cstring>
#include <initializer_list>

namespace method_contract
{
inline bool Type(const Il2CppType* type, const char* name)
{
if (!type || type->byref) return false;
auto* actual = il2cpp_type_get_name(type);
const bool matches = actual && std::strcmp(actual, name) == 0;
il2cpp_free(actual);
return matches;
}

// Resolve the entire managed signature, including static/instance dispatch.
// A renamed, ambiguous or generic method is not a compatible callback.
inline const MethodInfo* Resolve(Il2CppClass* cls, const char* name, bool is_static,
const char* result, std::initializer_list<const char*> parameters)
{
if (!cls) return nullptr;
const MethodInfo* found = nullptr;
void* iterator = nullptr;
while (auto* method = il2cpp_class_get_methods(cls, &iterator)) {
if (std::strcmp(method->name, name) != 0 || !method->methodPointer || method->is_generic || method->is_inflated
|| bool(method->flags & METHOD_ATTRIBUTE_STATIC) != is_static
|| method->parameters_count != parameters.size() || !Type(method->return_type, result)) continue;
bool matches = true;
unsigned i = 0;
for (auto* parameter : parameters)
matches = Type(method->parameters[i++], parameter) && matches;
if (!matches) continue;
if (found) return nullptr;
found = method;
}
return found;
}

inline void* Pointer(const MethodInfo* method)
{ return method ? reinterpret_cast<void*>(method->methodPointer) : nullptr; }
} // namespace method_contract
Loading
Loading