├── .gitattributes ├── .gitignore ├── README.md ├── ReplaceImport.h ├── bink2w64.cpp ├── bink2w64.def ├── bink2w64.sln ├── bink2w64_asm.asm └── binkw64.vcxproj /.gitattributes: -------------------------------------------------------------------------------- 1 | ############################################################################### 2 | # Set default behavior to automatically normalize line endings. 3 | ############################################################################### 4 | * text=auto 5 | 6 | ############################################################################### 7 | # Set default behavior for command prompt diff. 8 | # 9 | # This is need for earlier builds of msysgit that does not have it on by 10 | # default for csharp files. 11 | # Note: This is only used by command line 12 | ############################################################################### 13 | #*.cs diff=csharp 14 | 15 | ############################################################################### 16 | # Set the merge driver for project and solution files 17 | # 18 | # Merging from the command prompt will add diff markers to the files if there 19 | # are conflicts (Merging from VS is not affected by the settings below, in VS 20 | # the diff markers are never inserted). Diff markers may cause the following 21 | # file extensions to fail to load in VS. An alternative would be to treat 22 | # these files as binary and thus will always conflict and require user 23 | # intervention with every merge. To do so, just uncomment the entries below 24 | ############################################################################### 25 | #*.sln merge=binary 26 | #*.csproj merge=binary 27 | #*.vbproj merge=binary 28 | #*.vcxproj merge=binary 29 | #*.vcproj merge=binary 30 | #*.dbproj merge=binary 31 | #*.fsproj merge=binary 32 | #*.lsproj merge=binary 33 | #*.wixproj merge=binary 34 | #*.modelproj merge=binary 35 | #*.sqlproj merge=binary 36 | #*.wwaproj merge=binary 37 | 38 | ############################################################################### 39 | # behavior for image files 40 | # 41 | # image files are treated as binary by default. 42 | ############################################################################### 43 | #*.jpg binary 44 | #*.png binary 45 | #*.gif binary 46 | 47 | ############################################################################### 48 | # diff behavior for common document formats 49 | # 50 | # Convert binary document formats to text before diffing them. This feature 51 | # is only available from the command line. Turn it on by uncommenting the 52 | # entries below. 53 | ############################################################################### 54 | #*.doc diff=astextplain 55 | #*.DOC diff=astextplain 56 | #*.docx diff=astextplain 57 | #*.DOCX diff=astextplain 58 | #*.dot diff=astextplain 59 | #*.DOT diff=astextplain 60 | #*.pdf diff=astextplain 61 | #*.PDF diff=astextplain 62 | #*.rtf diff=astextplain 63 | #*.RTF diff=astextplain 64 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | ## Ignore Visual Studio temporary files, build results, and 2 | ## files generated by popular Visual Studio add-ons. 3 | 4 | # User-specific files 5 | *.suo 6 | *.user 7 | *.userosscache 8 | *.sln.docstates 9 | 10 | # User-specific files (MonoDevelop/Xamarin Studio) 11 | *.userprefs 12 | 13 | # Build results 14 | [Dd]ebug/ 15 | [Dd]ebugPublic/ 16 | [Rr]elease/ 17 | [Rr]eleases/ 18 | x64/ 19 | x86/ 20 | bld/ 21 | [Bb]in/ 22 | [Oo]bj/ 23 | [Ll]og/ 24 | 25 | # Visual Studio 2015 cache/options directory 26 | .vs/ 27 | # Uncomment if you have tasks that create the project's static files in wwwroot 28 | #wwwroot/ 29 | 30 | # MSTest test Results 31 | [Tt]est[Rr]esult*/ 32 | [Bb]uild[Ll]og.* 33 | 34 | # NUNIT 35 | *.VisualState.xml 36 | TestResult.xml 37 | 38 | # Build Results of an ATL Project 39 | [Dd]ebugPS/ 40 | [Rr]eleasePS/ 41 | dlldata.c 42 | 43 | # DNX 44 | project.lock.json 45 | project.fragment.lock.json 46 | artifacts/ 47 | 48 | *_i.c 49 | *_p.c 50 | *_i.h 51 | *.ilk 52 | *.meta 53 | *.obj 54 | *.pch 55 | *.pdb 56 | *.pgc 57 | *.pgd 58 | *.rsp 59 | *.sbr 60 | *.tlb 61 | *.tli 62 | *.tlh 63 | *.tmp 64 | *.tmp_proj 65 | *.log 66 | *.vspscc 67 | *.vssscc 68 | .builds 69 | *.pidb 70 | *.svclog 71 | *.scc 72 | 73 | # Chutzpah Test files 74 | _Chutzpah* 75 | 76 | # Visual C++ cache files 77 | ipch/ 78 | *.aps 79 | *.ncb 80 | *.opendb 81 | *.opensdf 82 | *.sdf 83 | *.cachefile 84 | *.VC.db 85 | *.VC.VC.opendb 86 | 87 | # Visual Studio profiler 88 | *.psess 89 | *.vsp 90 | *.vspx 91 | *.sap 92 | 93 | # TFS 2012 Local Workspace 94 | $tf/ 95 | 96 | # Guidance Automation Toolkit 97 | *.gpState 98 | 99 | # ReSharper is a .NET coding add-in 100 | _ReSharper*/ 101 | *.[Rr]e[Ss]harper 102 | *.DotSettings.user 103 | 104 | # JustCode is a .NET coding add-in 105 | .JustCode 106 | 107 | # TeamCity is a build add-in 108 | _TeamCity* 109 | 110 | # DotCover is a Code Coverage Tool 111 | *.dotCover 112 | 113 | # NCrunch 114 | _NCrunch_* 115 | .*crunch*.local.xml 116 | nCrunchTemp_* 117 | 118 | # MightyMoose 119 | *.mm.* 120 | AutoTest.Net/ 121 | 122 | # Web workbench (sass) 123 | .sass-cache/ 124 | 125 | # Installshield output folder 126 | [Ee]xpress/ 127 | 128 | # DocProject is a documentation generator add-in 129 | DocProject/buildhelp/ 130 | DocProject/Help/*.HxT 131 | DocProject/Help/*.HxC 132 | DocProject/Help/*.hhc 133 | DocProject/Help/*.hhk 134 | DocProject/Help/*.hhp 135 | DocProject/Help/Html2 136 | DocProject/Help/html 137 | 138 | # Click-Once directory 139 | publish/ 140 | 141 | # Publish Web Output 142 | *.[Pp]ublish.xml 143 | *.azurePubxml 144 | # TODO: Comment the next line if you want to checkin your web deploy settings 145 | # but database connection strings (with potential passwords) will be unencrypted 146 | #*.pubxml 147 | *.publishproj 148 | 149 | # Microsoft Azure Web App publish settings. Comment the next line if you want to 150 | # checkin your Azure Web App publish settings, but sensitive information contained 151 | # in these scripts will be unencrypted 152 | PublishScripts/ 153 | 154 | # NuGet Packages 155 | *.nupkg 156 | # The packages folder can be ignored because of Package Restore 157 | **/packages/* 158 | # except build/, which is used as an MSBuild target. 159 | !**/packages/build/ 160 | # Uncomment if necessary however generally it will be regenerated when needed 161 | #!**/packages/repositories.config 162 | # NuGet v3's project.json files produces more ignoreable files 163 | *.nuget.props 164 | *.nuget.targets 165 | 166 | # Microsoft Azure Build Output 167 | csx/ 168 | *.build.csdef 169 | 170 | # Microsoft Azure Emulator 171 | ecf/ 172 | rcf/ 173 | 174 | # Windows Store app package directories and files 175 | AppPackages/ 176 | BundleArtifacts/ 177 | Package.StoreAssociation.xml 178 | _pkginfo.txt 179 | 180 | # Visual Studio cache files 181 | # files ending in .cache can be ignored 182 | *.[Cc]ache 183 | # but keep track of directories ending in .cache 184 | !*.[Cc]ache/ 185 | 186 | # Others 187 | ClientBin/ 188 | ~$* 189 | *~ 190 | *.dbmdl 191 | *.dbproj.schemaview 192 | *.jfm 193 | *.pfx 194 | *.publishsettings 195 | node_modules/ 196 | orleans.codegen.cs 197 | 198 | # Since there are multiple workflows, uncomment next line to ignore bower_components 199 | # (https://github.com/github/gitignore/pull/1529#issuecomment-104372622) 200 | #bower_components/ 201 | 202 | # RIA/Silverlight projects 203 | Generated_Code/ 204 | 205 | # Backup & report files from converting an old project file 206 | # to a newer Visual Studio version. Backup files are not needed, 207 | # because we have git ;-) 208 | _UpgradeReport_Files/ 209 | Backup*/ 210 | UpgradeLog*.XML 211 | UpgradeLog*.htm 212 | 213 | # SQL Server files 214 | *.mdf 215 | *.ldf 216 | 217 | # Business Intelligence projects 218 | *.rdl.data 219 | *.bim.layout 220 | *.bim_*.settings 221 | 222 | # Microsoft Fakes 223 | FakesAssemblies/ 224 | 225 | # GhostDoc plugin setting file 226 | *.GhostDoc.xml 227 | 228 | # Node.js Tools for Visual Studio 229 | .ntvs_analysis.dat 230 | 231 | # Visual Studio 6 build log 232 | *.plg 233 | 234 | # Visual Studio 6 workspace options file 235 | *.opt 236 | 237 | # Visual Studio LightSwitch build output 238 | **/*.HTMLClient/GeneratedArtifacts 239 | **/*.DesktopClient/GeneratedArtifacts 240 | **/*.DesktopClient/ModelManifest.xml 241 | **/*.Server/GeneratedArtifacts 242 | **/*.Server/ModelManifest.xml 243 | _Pvt_Extensions 244 | 245 | # Paket dependency manager 246 | .paket/paket.exe 247 | paket-files/ 248 | 249 | # FAKE - F# Make 250 | .fake/ 251 | 252 | # JetBrains Rider 253 | .idea/ 254 | *.sln.iml 255 | 256 | # CodeRush 257 | .cr/ 258 | 259 | # Python Tools for Visual Studio (PTVS) 260 | __pycache__/ 261 | *.pyc -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # DLLPluginLoader 2 | A DLL loader for all kinds of PC video games(Fallout4, Divinity:Original Sin 2 and more) which use bink2w64.dll to load custom .dll plugin into game.   3 | #### Credits: meh321. 4 | -------------------------------------------------------------------------------- /ReplaceImport.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | struct ReplaceImport 4 | { 5 | static int Replace(const char * dllName, const char * funcName, PROC newFunc, PROC* oldFunc) 6 | { 7 | HMODULE mainModule = GetModuleHandle(NULL); 8 | if (mainModule == NULL) 9 | return 1; 10 | 11 | PIMAGE_IMPORT_DESCRIPTOR pImportDesc = NULL; 12 | { 13 | ULONG Size = 0; 14 | pImportDesc = (PIMAGE_IMPORT_DESCRIPTOR)ImageDirectoryEntryToData(mainModule, TRUE, IMAGE_DIRECTORY_ENTRY_IMPORT, &Size); 15 | } 16 | 17 | if (pImportDesc == NULL) 18 | return 2; 19 | 20 | for (; pImportDesc->Name; pImportDesc++) 21 | { 22 | if (_stricmp((PSTR)((ULONGLONG)mainModule + pImportDesc->Name), dllName)) 23 | continue; 24 | 25 | PIMAGE_THUNK_DATA pThunk = (PIMAGE_THUNK_DATA)((ULONGLONG)mainModule + pImportDesc->OriginalFirstThunk); 26 | PROC * pIat = (PROC*)((ULONGLONG)mainModule + pImportDesc->FirstThunk); 27 | for (; pThunk->u1.Function; pThunk++, pIat++) 28 | { 29 | if ((pThunk->u1.Ordinal & IMAGE_ORDINAL_FLAG)) 30 | { 31 | 32 | } 33 | else 34 | { 35 | PIMAGE_IMPORT_BY_NAME pImport = (PIMAGE_IMPORT_BY_NAME)((ULONGLONG)mainModule + pThunk->u1.AddressOfData); 36 | if (strcmp(pImport->Name, funcName) == 0) 37 | { 38 | *oldFunc = *pIat; 39 | DWORD oldPt = 0; 40 | if (!VirtualProtect(pIat, sizeof(void*), PAGE_READWRITE, &oldPt)) 41 | return 3; 42 | *pIat = newFunc; 43 | VirtualProtect(pIat, sizeof(void*), oldPt, &oldPt); 44 | return 0; 45 | } 46 | } 47 | } 48 | 49 | return 4; 50 | } 51 | return 5; 52 | } 53 | }; 54 | 55 | -------------------------------------------------------------------------------- /bink2w64.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | #include "ReplaceImport.h" 6 | 7 | 8 | std::vector sImportFunctionNames = 9 | { 10 | "BinkAllocateFrameBuffers", 11 | "BinkClose", 12 | "BinkCloseTrack", 13 | "BinkControlBackgroundIO", 14 | "BinkCopyToBuffer", 15 | "BinkCopyToBufferRect", 16 | "BinkDoFrame", 17 | "BinkDoFrameAsync", 18 | "BinkDoFrameAsyncMulti", 19 | "BinkDoFrameAsyncWait", 20 | "BinkDoFramePlane", 21 | "BinkFreeGlobals", 22 | "BinkGetError", 23 | "BinkGetFrameBuffersInfo", 24 | "BinkGetGPUDataBuffersInfo", 25 | "BinkGetKeyFrame", 26 | "BinkGetPlatformInfo", 27 | "BinkGetRealtime", 28 | "BinkGetRects", 29 | "BinkGetSummary", 30 | "BinkGetTrackData", 31 | "BinkGetTrackID", 32 | "BinkGetTrackMaxSize", 33 | "BinkGetTrackType", 34 | "BinkGoto", 35 | "BinkLogoAddress", 36 | "BinkNextFrame", 37 | "BinkOpen", 38 | "BinkOpenDirectSound", 39 | "BinkOpenMiles", 40 | "BinkOpenTrack", 41 | "BinkOpenWaveOut", 42 | "BinkOpenWithOptions", 43 | "BinkOpenXAudio2", 44 | "BinkOpenXAudio27", 45 | "BinkOpenXAudio28", 46 | "BinkPause", 47 | "BinkRegisterFrameBuffers", 48 | "BinkRegisterGPUDataBuffers", 49 | "BinkRequestStopAsyncThread", 50 | "BinkRequestStopAsyncThreadsMulti", 51 | "BinkService", 52 | "BinkSetError", 53 | "BinkSetFileOffset", 54 | "BinkSetFrameRate", 55 | "BinkSetIO", 56 | "BinkSetIOSize", 57 | "BinkSetMemory", 58 | "BinkSetOSFileCallbacks", 59 | "BinkSetPan", 60 | "BinkSetSimulate", 61 | "BinkSetSoundOnOff", 62 | "BinkSetSoundSystem", 63 | "BinkSetSoundSystem2", 64 | "BinkSetSoundTrack", 65 | "BinkSetSpeakerVolumes", 66 | "BinkSetVideoOnOff", 67 | "BinkSetVolume", 68 | "BinkSetWillLoop", 69 | "BinkShouldSkip", 70 | "BinkStartAsyncThread", 71 | "BinkUtilCPUs", 72 | "BinkUtilFree", 73 | "BinkUtilMalloc", 74 | "BinkUtilMutexCreate", 75 | "BinkUtilMutexDestroy", 76 | "BinkUtilMutexLock", 77 | "BinkUtilMutexLockTimeOut", 78 | "BinkUtilMutexUnlock", 79 | "BinkWait", 80 | "BinkWaitStopAsyncThread", 81 | "BinkWaitStopAsyncThreadsMulti", 82 | "RADTimerRead" 83 | }; 84 | 85 | extern "C" uintptr_t iImportFunctions[73] = { 0 }; 86 | 87 | HINSTANCE pOriginalHinst = nullptr; 88 | HINSTANCE pWarpperHinst = nullptr; 89 | std::vector loadedPlugins; 90 | 91 | PROC Init_Original = nullptr; 92 | 93 | 94 | std::string GetPluginsDirectory() 95 | { 96 | return "NativeMods\\"; 97 | } 98 | 99 | void Error(const char * msg) 100 | { 101 | MessageBoxA(nullptr, msg, "NativeModLoader", 0); 102 | } 103 | 104 | int LoadDLLPlugin(const char * path) 105 | { 106 | int state = -1; 107 | __try 108 | { 109 | HINSTANCE plugin = LoadLibraryA(path); 110 | if (!plugin) 111 | return 0; 112 | 113 | int ok = 1; 114 | FARPROC fnInit = GetProcAddress(plugin, "Init"); 115 | if (fnInit != nullptr) 116 | { 117 | state = -2; 118 | ((void(__cdecl *)())fnInit)(); 119 | ok = 2; 120 | } 121 | 122 | loadedPlugins.push_back(plugin); 123 | return ok; 124 | } 125 | __except (EXCEPTION_EXECUTE_HANDLER) 126 | { 127 | 128 | } 129 | 130 | return state; 131 | } 132 | 133 | 134 | void LoadLib() 135 | { 136 | static bool isLoaded = false; 137 | if (!isLoaded) 138 | { 139 | isLoaded = true; 140 | 141 | std::ofstream fLog = std::ofstream("NativeModLoader.log"); 142 | WIN32_FIND_DATA wfd; 143 | std::string dir = GetPluginsDirectory(); 144 | std::string search_dir = dir + "*.dll"; 145 | HANDLE hFind = FindFirstFileA(search_dir.c_str(), &wfd); 146 | if (hFind != INVALID_HANDLE_VALUE) 147 | { 148 | int i_error = 0; 149 | do 150 | { 151 | if ((wfd.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) != 0) 152 | continue; 153 | 154 | std::string name = wfd.cFileName; 155 | name = dir + name; 156 | 157 | if (fLog.good()) 158 | fLog << "Checking \"" << name.c_str() << "\" ... "; 159 | 160 | int result = LoadDLLPlugin(name.c_str()); 161 | switch (result) 162 | { 163 | case 2: 164 | { 165 | if (fLog.good()) 166 | fLog << "OK - loaded and called Init().\n"; 167 | break; 168 | } 169 | 170 | case 1: 171 | { 172 | if (fLog.good()) 173 | fLog << "OK - loaded.\n"; 174 | break; 175 | } 176 | 177 | case 0: 178 | { 179 | if (fLog.good()) 180 | fLog << "LoadLibrary failed!\n"; 181 | i_error = 1; 182 | std::string err = "LoadLibrary failed on "; 183 | err = err + name; 184 | Error(err.c_str()); 185 | break; 186 | } 187 | 188 | case -1: 189 | { 190 | if (fLog.good()) 191 | fLog << "LoadLibrary crashed! This means there's a problem in the plugin DLL file.\n"; 192 | i_error = 1; 193 | std::string err = "LoadLibrary crashed on "; 194 | err = err + name; 195 | err = err + ". This means there's a problem in the plugin DLL file. Contact the author of that plugin."; 196 | Error(err.c_str()); 197 | break; 198 | } 199 | 200 | case -2: 201 | { 202 | if (fLog.good()) 203 | fLog << "Init() crashed! This means there's a problem in the plugin DLL file.\n"; 204 | i_error = 1; 205 | std::string err = "Init() crashed on "; 206 | err = err + name; 207 | err = err + ". This means there's a problem in the plugin DLL file. Contact the author of that plugin."; 208 | Error(err.c_str()); 209 | break; 210 | } 211 | } 212 | } while (i_error == 0 && FindNextFileA(hFind, &wfd)); 213 | 214 | FindClose(hFind); 215 | } 216 | else 217 | { 218 | if (fLog.good()) 219 | fLog << "Failed to get search handle to \"" << search_dir.c_str() << "\"!\n"; 220 | } 221 | } 222 | } 223 | 224 | PVOID Init_Hook(PVOID arg1, PVOID arg2) 225 | { 226 | LoadLib(); 227 | 228 | return ((PVOID(*)(PVOID, PVOID))Init_Original)(arg1, arg2); 229 | } 230 | 231 | 232 | BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved) 233 | { 234 | pWarpperHinst = hinstDLL; 235 | if (fdwReason == DLL_PROCESS_ATTACH) 236 | { 237 | pOriginalHinst = LoadLibraryA("bink2w64_original.dll"); 238 | if (!pOriginalHinst) 239 | { 240 | Error("Failed to load bink2w64_.dll!"); 241 | return FALSE; 242 | } 243 | 244 | for (size_t i = 0; i < sImportFunctionNames.size(); i++) 245 | iImportFunctions[i] = reinterpret_cast(GetProcAddress(pOriginalHinst, sImportFunctionNames[i])); 246 | 247 | int result = ReplaceImport::Replace("api-ms-win-crt-runtime-l1-1-0.dll", "_initterm_e", (PROC)Init_Hook, &Init_Original); 248 | switch (result) 249 | { 250 | case 0: break; 251 | case 1: Error("Failed to get handle to main module!"); break; 252 | case 2: Error("Failed to find import table in executable!"); break; 253 | case 3: Error("Failed to change protection flags on memory page!"); break; 254 | case 4: Error("Failed to find API function in module!"); break; 255 | case 5: Error("Failed to find module!"); break; 256 | default: Error("Unknown error occurred!"); break; 257 | } 258 | } 259 | else if (fdwReason == DLL_PROCESS_DETACH) 260 | { 261 | FreeLibrary(pOriginalHinst); 262 | 263 | if (!loadedPlugins.empty()) 264 | { 265 | for(auto plugin : loadedPlugins) 266 | FreeLibrary(plugin); 267 | loadedPlugins.clear(); 268 | } 269 | } 270 | return TRUE; 271 | } 272 | 273 | extern "C" void BinkAllocateFrameBuffers(); 274 | extern "C" void BinkClose(); 275 | extern "C" void BinkCloseTrack(); 276 | extern "C" void BinkControlBackgroundIO(); 277 | extern "C" void BinkCopyToBuffer(); 278 | extern "C" void BinkCopyToBufferRect(); 279 | extern "C" void BinkDoFrame(); 280 | extern "C" void BinkDoFrameAsync(); 281 | extern "C" void BinkDoFrameAsyncMulti(); 282 | extern "C" void BinkDoFrameAsyncWait(); 283 | extern "C" void BinkDoFramePlane(); 284 | extern "C" void BinkFreeGlobals(); 285 | extern "C" void BinkGetError(); 286 | extern "C" void BinkGetFrameBuffersInfo(); 287 | extern "C" void BinkGetGPUDataBuffersInfo(); 288 | extern "C" void BinkGetKeyFrame(); 289 | extern "C" void BinkGetPlatformInfo(); 290 | extern "C" void BinkGetRealtime(); 291 | extern "C" void BinkGetRects(); 292 | extern "C" void BinkGetSummary(); 293 | extern "C" void BinkGetTrackData(); 294 | extern "C" void BinkGetTrackID(); 295 | extern "C" void BinkGetTrackMaxSize(); 296 | extern "C" void BinkGetTrackType(); 297 | extern "C" void BinkGoto(); 298 | extern "C" void BinkLogoAddress(); 299 | extern "C" void BinkNextFrame(); 300 | extern "C" void BinkOpen(); 301 | extern "C" void BinkOpenDirectSound(); 302 | extern "C" void BinkOpenMiles(); 303 | extern "C" void BinkOpenTrack(); 304 | extern "C" void BinkOpenWaveOut(); 305 | extern "C" void BinkOpenWithOptions(); 306 | extern "C" void BinkOpenXAudio2(); 307 | extern "C" void BinkOpenXAudio27(); 308 | extern "C" void BinkOpenXAudio28(); 309 | extern "C" void BinkPause(); 310 | extern "C" void BinkRegisterFrameBuffers(); 311 | extern "C" void BinkRegisterGPUDataBuffers(); 312 | extern "C" void BinkRequestStopAsyncThread(); 313 | extern "C" void BinkRequestStopAsyncThreadsMulti(); 314 | extern "C" void BinkService(); 315 | extern "C" void BinkSetError(); 316 | extern "C" void BinkSetFileOffset(); 317 | extern "C" void BinkSetFrameRate(); 318 | extern "C" void BinkSetIO(); 319 | extern "C" void BinkSetIOSize(); 320 | extern "C" void BinkSetMemory(); 321 | extern "C" void BinkSetOSFileCallbacks(); 322 | extern "C" void BinkSetPan(); 323 | extern "C" void BinkSetSimulate(); 324 | extern "C" void BinkSetSoundOnOff(); 325 | extern "C" void BinkSetSoundSystem(); 326 | extern "C" void BinkSetSoundSystem2(); 327 | extern "C" void BinkSetSoundTrack(); 328 | extern "C" void BinkSetSpeakerVolumes(); 329 | extern "C" void BinkSetVideoOnOff(); 330 | extern "C" void BinkSetVolume(); 331 | extern "C" void BinkSetWillLoop(); 332 | extern "C" void BinkShouldSkip(); 333 | extern "C" void BinkStartAsyncThread(); 334 | extern "C" void BinkUtilCPUs(); 335 | extern "C" void BinkUtilFree(); 336 | extern "C" void BinkUtilMalloc(); 337 | extern "C" void BinkUtilMutexCreate(); 338 | extern "C" void BinkUtilMutexDestroy(); 339 | extern "C" void BinkUtilMutexLock(); 340 | extern "C" void BinkUtilMutexLockTimeOut(); 341 | extern "C" void BinkUtilMutexUnlock(); 342 | extern "C" void BinkWait(); 343 | extern "C" void BinkWaitStopAsyncThread(); 344 | extern "C" void BinkWaitStopAsyncThreadsMulti(); 345 | extern "C" void RADTimerRead(); 346 | -------------------------------------------------------------------------------- /bink2w64.def: -------------------------------------------------------------------------------- 1 | LIBRARY bink2w64.dll 2 | EXPORTS 3 | BinkAllocateFrameBuffers @1 4 | BinkClose @2 5 | BinkCloseTrack @3 6 | BinkControlBackgroundIO @4 7 | BinkCopyToBuffer @5 8 | BinkCopyToBufferRect @6 9 | BinkDoFrame @7 10 | BinkDoFrameAsync @8 11 | BinkDoFrameAsyncMulti @9 12 | BinkDoFrameAsyncWait @10 13 | BinkDoFramePlane @11 14 | BinkFreeGlobals @12 15 | BinkGetError @13 16 | BinkGetFrameBuffersInfo @14 17 | BinkGetGPUDataBuffersInfo @15 18 | BinkGetKeyFrame @16 19 | BinkGetPlatformInfo @17 20 | BinkGetRealtime @18 21 | BinkGetRects @19 22 | BinkGetSummary @20 23 | BinkGetTrackData @21 24 | BinkGetTrackID @22 25 | BinkGetTrackMaxSize @23 26 | BinkGetTrackType @24 27 | BinkGoto @25 28 | BinkLogoAddress @26 29 | BinkNextFrame @27 30 | BinkOpen @28 31 | BinkOpenDirectSound @29 32 | BinkOpenMiles @30 33 | BinkOpenTrack @31 34 | BinkOpenWaveOut @32 35 | BinkOpenWithOptions @33 36 | BinkOpenXAudio2 @34 37 | BinkOpenXAudio27 @35 38 | BinkOpenXAudio28 @36 39 | BinkPause @37 40 | BinkRegisterFrameBuffers @38 41 | BinkRegisterGPUDataBuffers @39 42 | BinkRequestStopAsyncThread @40 43 | BinkRequestStopAsyncThreadsMulti @41 44 | BinkService @42 45 | BinkSetError @43 46 | BinkSetFileOffset @44 47 | BinkSetFrameRate @45 48 | BinkSetIO @46 49 | BinkSetIOSize @47 50 | BinkSetMemory @48 51 | BinkSetOSFileCallbacks @49 52 | BinkSetPan @50 53 | BinkSetSimulate @51 54 | BinkSetSoundOnOff @52 55 | BinkSetSoundSystem @53 56 | BinkSetSoundSystem2 @54 57 | BinkSetSoundTrack @55 58 | BinkSetSpeakerVolumes @56 59 | BinkSetVideoOnOff @57 60 | BinkSetVolume @58 61 | BinkSetWillLoop @59 62 | BinkShouldSkip @60 63 | BinkStartAsyncThread @61 64 | BinkUtilCPUs @62 65 | BinkUtilFree @63 66 | BinkUtilMalloc @64 67 | BinkUtilMutexCreate @65 68 | BinkUtilMutexDestroy @66 69 | BinkUtilMutexLock @67 70 | BinkUtilMutexLockTimeOut @68 71 | BinkUtilMutexUnlock @69 72 | BinkWait @70 73 | BinkWaitStopAsyncThread @71 74 | BinkWaitStopAsyncThreadsMulti @72 75 | RADTimerRead @73 76 | -------------------------------------------------------------------------------- /bink2w64.sln: -------------------------------------------------------------------------------- 1 |  2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio 15 4 | VisualStudioVersion = 15.0.27004.2002 5 | MinimumVisualStudioVersion = 10.0.40219.1 6 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "bink2w64", "binkw64.vcxproj", "{3941E9F8-2E29-4D69-8717-F74562ED5301}" 7 | EndProject 8 | Global 9 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 10 | Debug|x64 = Debug|x64 11 | Debug|x86 = Debug|x86 12 | Release|x64 = Release|x64 13 | Release|x86 = Release|x86 14 | EndGlobalSection 15 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 16 | {3941E9F8-2E29-4D69-8717-F74562ED5301}.Debug|x64.ActiveCfg = Debug|x64 17 | {3941E9F8-2E29-4D69-8717-F74562ED5301}.Debug|x64.Build.0 = Debug|x64 18 | {3941E9F8-2E29-4D69-8717-F74562ED5301}.Debug|x86.ActiveCfg = Debug|Win32 19 | {3941E9F8-2E29-4D69-8717-F74562ED5301}.Debug|x86.Build.0 = Debug|Win32 20 | {3941E9F8-2E29-4D69-8717-F74562ED5301}.Release|x64.ActiveCfg = Release|x64 21 | {3941E9F8-2E29-4D69-8717-F74562ED5301}.Release|x64.Build.0 = Release|x64 22 | {3941E9F8-2E29-4D69-8717-F74562ED5301}.Release|x86.ActiveCfg = Release|Win32 23 | {3941E9F8-2E29-4D69-8717-F74562ED5301}.Release|x86.Build.0 = Release|Win32 24 | EndGlobalSection 25 | GlobalSection(SolutionProperties) = preSolution 26 | HideSolutionNode = FALSE 27 | EndGlobalSection 28 | GlobalSection(ExtensibilityGlobals) = postSolution 29 | SolutionGuid = {69DDB003-2A41-4BE6-AB18-6BFD0AF1BCE1} 30 | EndGlobalSection 31 | EndGlobal 32 | -------------------------------------------------------------------------------- /bink2w64_asm.asm: -------------------------------------------------------------------------------- 1 | .code 2 | extern iImportFunctions:QWORD 3 | BinkAllocateFrameBuffers PROC 4 | jmp iImportFunctions[0*8] 5 | BinkAllocateFrameBuffers ENDP 6 | BinkClose PROC 7 | jmp iImportFunctions[1*8] 8 | BinkClose ENDP 9 | BinkCloseTrack PROC 10 | jmp iImportFunctions[2*8] 11 | BinkCloseTrack ENDP 12 | BinkControlBackgroundIO PROC 13 | jmp iImportFunctions[3*8] 14 | BinkControlBackgroundIO ENDP 15 | BinkCopyToBuffer PROC 16 | jmp iImportFunctions[4*8] 17 | BinkCopyToBuffer ENDP 18 | BinkCopyToBufferRect PROC 19 | jmp iImportFunctions[5*8] 20 | BinkCopyToBufferRect ENDP 21 | BinkDoFrame PROC 22 | jmp iImportFunctions[6*8] 23 | BinkDoFrame ENDP 24 | BinkDoFrameAsync PROC 25 | jmp iImportFunctions[7*8] 26 | BinkDoFrameAsync ENDP 27 | BinkDoFrameAsyncMulti PROC 28 | jmp iImportFunctions[8*8] 29 | BinkDoFrameAsyncMulti ENDP 30 | BinkDoFrameAsyncWait PROC 31 | jmp iImportFunctions[9*8] 32 | BinkDoFrameAsyncWait ENDP 33 | BinkDoFramePlane PROC 34 | jmp iImportFunctions[10*8] 35 | BinkDoFramePlane ENDP 36 | BinkFreeGlobals PROC 37 | jmp iImportFunctions[11*8] 38 | BinkFreeGlobals ENDP 39 | BinkGetError PROC 40 | jmp iImportFunctions[12*8] 41 | BinkGetError ENDP 42 | BinkGetFrameBuffersInfo PROC 43 | jmp iImportFunctions[13*8] 44 | BinkGetFrameBuffersInfo ENDP 45 | BinkGetGPUDataBuffersInfo PROC 46 | jmp iImportFunctions[14*8] 47 | BinkGetGPUDataBuffersInfo ENDP 48 | BinkGetKeyFrame PROC 49 | jmp iImportFunctions[15*8] 50 | BinkGetKeyFrame ENDP 51 | BinkGetPlatformInfo PROC 52 | jmp iImportFunctions[16*8] 53 | BinkGetPlatformInfo ENDP 54 | BinkGetRealtime PROC 55 | jmp iImportFunctions[17*8] 56 | BinkGetRealtime ENDP 57 | BinkGetRects PROC 58 | jmp iImportFunctions[18*8] 59 | BinkGetRects ENDP 60 | BinkGetSummary PROC 61 | jmp iImportFunctions[19*8] 62 | BinkGetSummary ENDP 63 | BinkGetTrackData PROC 64 | jmp iImportFunctions[20*8] 65 | BinkGetTrackData ENDP 66 | BinkGetTrackID PROC 67 | jmp iImportFunctions[21*8] 68 | BinkGetTrackID ENDP 69 | BinkGetTrackMaxSize PROC 70 | jmp iImportFunctions[22*8] 71 | BinkGetTrackMaxSize ENDP 72 | BinkGetTrackType PROC 73 | jmp iImportFunctions[23*8] 74 | BinkGetTrackType ENDP 75 | BinkGoto PROC 76 | jmp iImportFunctions[24*8] 77 | BinkGoto ENDP 78 | BinkLogoAddress PROC 79 | jmp iImportFunctions[25*8] 80 | BinkLogoAddress ENDP 81 | BinkNextFrame PROC 82 | jmp iImportFunctions[26*8] 83 | BinkNextFrame ENDP 84 | BinkOpen PROC 85 | jmp iImportFunctions[27*8] 86 | BinkOpen ENDP 87 | BinkOpenDirectSound PROC 88 | jmp iImportFunctions[28*8] 89 | BinkOpenDirectSound ENDP 90 | BinkOpenMiles PROC 91 | jmp iImportFunctions[29*8] 92 | BinkOpenMiles ENDP 93 | BinkOpenTrack PROC 94 | jmp iImportFunctions[30*8] 95 | BinkOpenTrack ENDP 96 | BinkOpenWaveOut PROC 97 | jmp iImportFunctions[31*8] 98 | BinkOpenWaveOut ENDP 99 | BinkOpenWithOptions PROC 100 | jmp iImportFunctions[32*8] 101 | BinkOpenWithOptions ENDP 102 | BinkOpenXAudio2 PROC 103 | jmp iImportFunctions[33*8] 104 | BinkOpenXAudio2 ENDP 105 | BinkOpenXAudio27 PROC 106 | jmp iImportFunctions[34*8] 107 | BinkOpenXAudio27 ENDP 108 | BinkOpenXAudio28 PROC 109 | jmp iImportFunctions[35*8] 110 | BinkOpenXAudio28 ENDP 111 | BinkPause PROC 112 | jmp iImportFunctions[36*8] 113 | BinkPause ENDP 114 | BinkRegisterFrameBuffers PROC 115 | jmp iImportFunctions[37*8] 116 | BinkRegisterFrameBuffers ENDP 117 | BinkRegisterGPUDataBuffers PROC 118 | jmp iImportFunctions[38*8] 119 | BinkRegisterGPUDataBuffers ENDP 120 | BinkRequestStopAsyncThread PROC 121 | jmp iImportFunctions[39*8] 122 | BinkRequestStopAsyncThread ENDP 123 | BinkRequestStopAsyncThreadsMulti PROC 124 | jmp iImportFunctions[40*8] 125 | BinkRequestStopAsyncThreadsMulti ENDP 126 | BinkService PROC 127 | jmp iImportFunctions[41*8] 128 | BinkService ENDP 129 | BinkSetError PROC 130 | jmp iImportFunctions[42*8] 131 | BinkSetError ENDP 132 | BinkSetFileOffset PROC 133 | jmp iImportFunctions[43*8] 134 | BinkSetFileOffset ENDP 135 | BinkSetFrameRate PROC 136 | jmp iImportFunctions[44*8] 137 | BinkSetFrameRate ENDP 138 | BinkSetIO PROC 139 | jmp iImportFunctions[45*8] 140 | BinkSetIO ENDP 141 | BinkSetIOSize PROC 142 | jmp iImportFunctions[46*8] 143 | BinkSetIOSize ENDP 144 | BinkSetMemory PROC 145 | jmp iImportFunctions[47*8] 146 | BinkSetMemory ENDP 147 | BinkSetOSFileCallbacks PROC 148 | jmp iImportFunctions[48*8] 149 | BinkSetOSFileCallbacks ENDP 150 | BinkSetPan PROC 151 | jmp iImportFunctions[49*8] 152 | BinkSetPan ENDP 153 | BinkSetSimulate PROC 154 | jmp iImportFunctions[50*8] 155 | BinkSetSimulate ENDP 156 | BinkSetSoundOnOff PROC 157 | jmp iImportFunctions[51*8] 158 | BinkSetSoundOnOff ENDP 159 | BinkSetSoundSystem PROC 160 | jmp iImportFunctions[52*8] 161 | BinkSetSoundSystem ENDP 162 | BinkSetSoundSystem2 PROC 163 | jmp iImportFunctions[53*8] 164 | BinkSetSoundSystem2 ENDP 165 | BinkSetSoundTrack PROC 166 | jmp iImportFunctions[54*8] 167 | BinkSetSoundTrack ENDP 168 | BinkSetSpeakerVolumes PROC 169 | jmp iImportFunctions[55*8] 170 | BinkSetSpeakerVolumes ENDP 171 | BinkSetVideoOnOff PROC 172 | jmp iImportFunctions[56*8] 173 | BinkSetVideoOnOff ENDP 174 | BinkSetVolume PROC 175 | jmp iImportFunctions[57*8] 176 | BinkSetVolume ENDP 177 | BinkSetWillLoop PROC 178 | jmp iImportFunctions[58*8] 179 | BinkSetWillLoop ENDP 180 | BinkShouldSkip PROC 181 | jmp iImportFunctions[59*8] 182 | BinkShouldSkip ENDP 183 | BinkStartAsyncThread PROC 184 | jmp iImportFunctions[60*8] 185 | BinkStartAsyncThread ENDP 186 | BinkUtilCPUs PROC 187 | jmp iImportFunctions[61*8] 188 | BinkUtilCPUs ENDP 189 | BinkUtilFree PROC 190 | jmp iImportFunctions[62*8] 191 | BinkUtilFree ENDP 192 | BinkUtilMalloc PROC 193 | jmp iImportFunctions[63*8] 194 | BinkUtilMalloc ENDP 195 | BinkUtilMutexCreate PROC 196 | jmp iImportFunctions[64*8] 197 | BinkUtilMutexCreate ENDP 198 | BinkUtilMutexDestroy PROC 199 | jmp iImportFunctions[65*8] 200 | BinkUtilMutexDestroy ENDP 201 | BinkUtilMutexLock PROC 202 | jmp iImportFunctions[66*8] 203 | BinkUtilMutexLock ENDP 204 | BinkUtilMutexLockTimeOut PROC 205 | jmp iImportFunctions[67*8] 206 | BinkUtilMutexLockTimeOut ENDP 207 | BinkUtilMutexUnlock PROC 208 | jmp iImportFunctions[68*8] 209 | BinkUtilMutexUnlock ENDP 210 | BinkWait PROC 211 | jmp iImportFunctions[69*8] 212 | BinkWait ENDP 213 | BinkWaitStopAsyncThread PROC 214 | jmp iImportFunctions[70*8] 215 | BinkWaitStopAsyncThread ENDP 216 | BinkWaitStopAsyncThreadsMulti PROC 217 | jmp iImportFunctions[71*8] 218 | BinkWaitStopAsyncThreadsMulti ENDP 219 | RADTimerRead PROC 220 | jmp iImportFunctions[72*8] 221 | RADTimerRead ENDP 222 | end 223 | -------------------------------------------------------------------------------- /binkw64.vcxproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | Debug 6 | Win32 7 | 8 | 9 | Debug 10 | x64 11 | 12 | 13 | Release 14 | Win32 15 | 16 | 17 | Release 18 | x64 19 | 20 | 21 | 22 | {3941E9F8-2E29-4D69-8717-F74562ED5301} 23 | Win32Proj 24 | binkw64 25 | 10.0.16299.0 26 | bink2w64 27 | 28 | 29 | 30 | DynamicLibrary 31 | true 32 | NotSet 33 | v141 34 | 35 | 36 | DynamicLibrary 37 | true 38 | NotSet 39 | v141 40 | 41 | 42 | DynamicLibrary 43 | false 44 | true 45 | MultiByte 46 | v141 47 | 48 | 49 | DynamicLibrary 50 | false 51 | true 52 | NotSet 53 | v141 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | true 74 | 75 | 76 | true 77 | 78 | 79 | false 80 | 81 | 82 | false 83 | false 84 | 85 | 86 | 87 | 88 | 89 | Level3 90 | Disabled 91 | WIN32;_DEBUG;_WINDOWS;_USRDLL;BINKW64_EXPORTS;%(PreprocessorDefinitions) 92 | 93 | 94 | Windows 95 | true 96 | binkw64.def 97 | 98 | 99 | 100 | 101 | 102 | 103 | Level3 104 | Disabled 105 | WIN32;_DEBUG;_WINDOWS;_USRDLL;BINKW64_EXPORTS;%(PreprocessorDefinitions) 106 | 107 | 108 | Windows 109 | true 110 | binkw64.def 111 | 112 | 113 | 114 | 115 | Level3 116 | 117 | 118 | MaxSpeed 119 | true 120 | true 121 | WIN32;NDEBUG;_WINDOWS;_USRDLL;BINKW64_EXPORTS;%(PreprocessorDefinitions) 122 | 123 | 124 | Windows 125 | true 126 | true 127 | true 128 | binkw64.def 129 | 130 | 131 | 132 | 133 | Level3 134 | 135 | 136 | MaxSpeed 137 | true 138 | true 139 | WIN32;NDEBUG;_WINDOWS;_USRDLL;BINKW64_EXPORTS;%(PreprocessorDefinitions) 140 | MultiThreaded 141 | 142 | 143 | Windows 144 | true 145 | true 146 | true 147 | bink2w64.def 148 | Dbghelp.lib;%(AdditionalDependencies) 149 | 150 | 151 | 152 | 153 | 154 | 155 | 156 | 157 | Document 158 | 159 | 160 | 161 | 162 | 163 | 164 | 165 | 166 | 167 | --------------------------------------------------------------------------------