Skip to content

Commit

Permalink
Merge branch 'master' into pd-upscaler
Browse files Browse the repository at this point in the history
  • Loading branch information
praydog committed Oct 13, 2024
2 parents c2e7f46 + 9a65668 commit 1f6fca2
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 10 deletions.
10 changes: 8 additions & 2 deletions .github/workflows/dev-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -56,14 +56,20 @@ jobs:
with:
path: ${{github.workspace}}/artifacts

- name: Set padded run number
run: |
$paddedRunNumber = "{0:D5}" -f ${{ github.run_number }}
echo "RUN_NUMBER=$paddedRunNumber" >> $env:GITHUB_ENV
shell: powershell

- name: Create Release
uses: ncipollo/release-action@6c75be85e571768fa31b40abf38de58ba0397db5
with:
repo: REFramework-nightly
owner: praydog
token: ${{ secrets.REPO_TOKEN }}
name: ${{format('REF Nightly {0} ({1})', github.run_number, github.sha)}}
tag: ${{format('nightly-{0}-{1}', github.run_number, github.sha)}}
name: ${{format('REF Nightly {0} ({1})', env.RUN_NUMBER, github.sha)}}
tag: ${{format('nightly-{0}-{1}', env.RUN_NUMBER, github.sha)}}
artifacts: ${{github.workspace}}/artifacts/**/*.zip
makeLatest: true
bodyFile: ${{github.workspace}}/nightly-body.md
Expand Down
7 changes: 5 additions & 2 deletions shared/sdk/SF6Utility.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,11 @@ enum class EGameMode : uint8_t {
ONLINE_TRAINING = 18,
TEAMBATTLE = 19,
EXAM_CPU_MATCH = 20,
REPLAY = 21,
SPECTATE = 22,
CABINET_CPU_MATCH = 21,
LEARNING_AI_MATCH = 22,
LEARNING_AI_SPECTATE = 23,
REPLAY = 24,
SPECTATE = 25,
};

enum class HUD_GROUP_TYPE : uint8_t {
Expand Down
21 changes: 15 additions & 6 deletions src/mods/LooseFileLoader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -224,21 +224,30 @@ bool LooseFileLoader::handle_path(const wchar_t* path, size_t hash) {
bool exists_on_disk{false};

if (m_enable_file_cache) {
// Intended to get rid of mutex usage which can be a bottleneck
static thread_local std::unordered_set<size_t> files_on_disk_local{};
static thread_local std::unordered_set<size_t> seen_files_local{};

{
std::shared_lock _{m_files_on_disk_mutex};
exists_on_disk = m_files_on_disk.contains(hash);
exists_in_cache = exists_on_disk || m_seen_files.contains(hash);
// No need to lock a mutex as these are thread_local
exists_on_disk = files_on_disk_local.contains(hash);
exists_in_cache = exists_on_disk || seen_files_local.contains(hash);
}

if (!exists_in_cache) {
// TODO: refine this with mixed shared and unique locks
// This shouldnt be a huge performance issue for now
std::unique_lock _{m_files_on_disk_mutex};

if (std::filesystem::exists(path)) {
m_files_on_disk.insert(hash);
// Purpose of this is to only hit the disk once per unique file
if (m_files_on_disk.contains(hash) || std::filesystem::exists(path)) {
m_files_on_disk.insert(hash); // Global
files_on_disk_local.insert(hash); // Thread local
exists_on_disk = true;
}

m_seen_files.insert(hash);
m_seen_files.insert(hash); // Global
seen_files_local.insert(hash); // Thread local
++m_uncached_hits;
} else {
++m_cache_hits;
Expand Down
4 changes: 4 additions & 0 deletions src/mods/ScriptRunner.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -783,6 +783,8 @@ void ScriptRunner::on_config_save(utility::Config& cfg) {
}

void ScriptRunner::hook_battle_rule() {
// Removed for now as it seems to cause some weird issues with matchmaking
#if 0
if (m_attempted_hook_battle_rule) {
return;
}
Expand Down Expand Up @@ -828,13 +830,15 @@ void ScriptRunner::hook_battle_rule() {
return HookManager::PreHookResult::CALL_ORIGINAL;
},
[this](uintptr_t& ret_val, sdk::RETypeDefinition* ret_ty, uintptr_t ret_addr) -> void {
// DONT set this, it probably breaks something now
auto bt = this->get_last_battle_type();

if (bt.has_value()) {
sdk::sf6::set_game_mode((sdk::sf6::EGameMode)bt.value());
}
});
}
#endif
}

void ScriptRunner::on_frame() {
Expand Down

0 comments on commit 1f6fca2

Please sign in to comment.