Skip to content
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
2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:
run: |
call "C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Auxiliary\Build\vcvars32.bat"
cl -c /GS- /GF /O2 vorbisFile.cpp
link /dll /nodefaultlib /entry:_DllMainCRTStartup@12 vorbisFile.obj Kernel32.lib LIBCMT.LIB libvcruntime.lib libucrt.lib libcpmt.lib
link /dll /nodefaultlib /entry:_DllMainCRTStartup@12 vorbisFile.obj Kernel32.lib User32.lib LIBCMT.LIB libvcruntime.lib libucrt.lib libcpmt.lib

- name: Upload artifact
uses: actions/upload-artifact@v6
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jobs:
run: |
call "C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Auxiliary\Build\vcvars32.bat"
cl -c /GS- /GF /O2 vorbisFile.cpp
link /dll /nodefaultlib /entry:_DllMainCRTStartup@12 vorbisFile.obj Kernel32.lib LIBCMT.LIB libvcruntime.lib libucrt.lib libcpmt.lib
link /dll /nodefaultlib /entry:_DllMainCRTStartup@12 vorbisFile.obj Kernel32.lib User32.lib LIBCMT.LIB libvcruntime.lib libucrt.lib libcpmt.lib

- name: Create Release
uses: ncipollo/release-action@main
Expand Down
35 changes: 34 additions & 1 deletion vorbisFile.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,21 @@ __declspec(dllexport, naked) int ov_time_seek_page(void* vf, double pos)

}

void ShowErrorAndExit(const char * format, ...)
{
char buffer[4096];

va_list vl;
va_start(vl, format);

_vsnprintf_s(buffer, _countof(buffer), _TRUNCATE, format, vl);

MessageBoxA(NULL, buffer, "Silent ASI loader error", MB_OK);
ExitProcess(NULL);

va_end(vl);
}

struct ExcludedEntry {
char* entry;
ExcludedEntry* prev;
Expand Down Expand Up @@ -275,8 +290,23 @@ void LoadPlugins()
}
}

// Prevent loading of ASI plugins with the same file name
for (auto& plugin : pluginsToBeLoaded)
{
for (auto& plugin2 : pluginsToBeLoaded)
{
if (&plugin != &plugin2 && !_stricmp(plugin.pluginFilename.c_str(), plugin2.pluginFilename.c_str()))
ShowErrorAndExit("An ASI with name %s exists in more than one directory.\n\nDirectories:\n%s\n%s",
plugin.pluginFilename.c_str(),
plugin.dirPath.c_str(), plugin2.dirPath.c_str()
);
}
}

// Load ASI plugins
std::sort(pluginsToBeLoaded.begin(), pluginsToBeLoaded.end(), [](tPluginToBeLoaded& a, tPluginToBeLoaded& b) { return a.pluginFilename < b.pluginFilename; });
std::sort(pluginsToBeLoaded.begin(), pluginsToBeLoaded.end(), [](tPluginToBeLoaded& a, tPluginToBeLoaded& b) {
return _stricmp(a.pluginFilename.c_str(), b.pluginFilename.c_str()) < 0;
});

for (auto& plugin : pluginsToBeLoaded)
{
Expand All @@ -285,6 +315,9 @@ void LoadPlugins()
// MessageBoxA(NULL, pluginPath, "Test", MB_OK);
LoadLibraryA(pluginPath);
}

// Use if debugging
// ExitProcess(NULL);
}

// Unprotect the module NOW (CLEO 4.1.1.30f crash fix)
Expand Down