Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

allow mods to load biks that aren't already present in r2/media #137

Merged
merged 2 commits into from
Aug 20, 2022
Merged
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
7 changes: 6 additions & 1 deletion NorthstarDedicatedTest/clientvideooverrides.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#include "pch.h"
#include "clientvideooverrides.h"
#include "modmanager.h"
#include "nsmem.h"

typedef void* (*BinkOpenType)(const char* path, uint32_t flags);
BinkOpenType BinkOpen;
Expand Down Expand Up @@ -31,8 +32,12 @@ void* BinkOpenHook(const char* path, uint32_t flags)
return BinkOpen(path, flags);
}

void InitialiseClientVideoOverrides(HMODULE baseAddress)
void InitialiseEngineClientVideoOverrides(HMODULE baseAddress)
{
// remove engine check for whether the bik we're trying to load exists in r2/media, as this will fail for biks in mods
// note: the check in engine is actually unnecessary, so it's just useless in practice and we lose nothing by removing it
NSMem::NOP((uintptr_t)baseAddress + 0x459AD, 6);

HookEnabler hook;
ENABLER_CREATEHOOK(
hook, GetProcAddress(GetModuleHandleA("bink2w64.dll"), "BinkOpen"), &BinkOpenHook, reinterpret_cast<LPVOID*>(&BinkOpen));
Expand Down
2 changes: 1 addition & 1 deletion NorthstarDedicatedTest/clientvideooverrides.h
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
#pragma once
void InitialiseClientVideoOverrides(HMODULE baseAddress);
void InitialiseEngineClientVideoOverrides(HMODULE baseAddress);
2 changes: 1 addition & 1 deletion NorthstarDedicatedTest/dllmain.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -252,7 +252,7 @@ bool InitialiseNorthstar()
AddDllLoadCallbackForClient("client.dll", InitialiseClientChatHooks);
AddDllLoadCallbackForClient("client.dll", InitialiseLocalChatWriter);
AddDllLoadCallbackForClient("client.dll", InitialiseScriptServerToClientStringCommands);
AddDllLoadCallbackForClient("client.dll", InitialiseClientVideoOverrides);
AddDllLoadCallbackForClient("engine.dll", InitialiseEngineClientVideoOverrides);
AddDllLoadCallbackForClient("engine.dll", InitialiseEngineClientRUIHooks);
AddDllLoadCallbackForClient("engine.dll", InitialiseDebugOverlay);
// audio hooks
Expand Down