Skip to content

Commit ded5ebc

Browse files
committed
add config stub
1 parent 9536438 commit ded5ebc

File tree

5 files changed

+46
-9
lines changed

5 files changed

+46
-9
lines changed

src/Plugins.Win32.SDLAudio/CMakeLists.txt

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,13 @@ SPDX-License-Identifier: GPL-2.0-or-later
55
]===]
66

77
add_library(Mupen64RR.Plugins.Win32.SDLAudio MODULE
8-
"Config.hpp"
98
"Main.cpp"
10-
"Main.hpp"
119
"Main_Win32.cpp"
12-
"Main_Win32.hpp"
1310
"SDLBackend.cpp"
11+
12+
"Config.hpp"
13+
"Main.hpp"
14+
"Main_Win32.hpp"
1415
"SDLBackend.hpp"
1516
)
1617
set_target_properties(Mupen64RR.Plugins.Win32.SDLAudio PROPERTIES
@@ -20,7 +21,7 @@ set_target_properties(Mupen64RR.Plugins.Win32.SDLAudio PROPERTIES
2021
LIBRARY_OUTPUT_DIRECTORY "${MUPEN64RR_PLUGIN_OUT_DIR}"
2122
PDB_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}"
2223
)
23-
target_link_libraries(Mupen64RR.Plugins.Win32.SDLAudio PRIVATE
24+
target_link_libraries(Mupen64RR.Plugins.Win32.SDLAudio PRIVATE
2425
Mupen64RR.Plugins.Win32.Common
2526
SDL3::SDL3
2627
)
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
2+
#include "Config_Win32.hpp"
3+
4+
namespace SDLAudio {
5+
void show_config_win32(HWND parent, Config &config) {
6+
7+
}
8+
}
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
#pragma once
2+
3+
#include "Config.hpp"
4+
5+
namespace SDLAudio {
6+
void show_config_win32(HWND parent, Config& config);
7+
}

src/Plugins.Win32.SDLAudio/Main_Win32.cpp

Lines changed: 23 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,34 @@
11
#include "Main_Win32.hpp"
22
#include <Views.Win32/ViewPlugin.h>
3+
#include <filesystem>
4+
#include <libloaderapi.h>
5+
#include <minwindef.h>
6+
#include <string>
7+
#include <vector>
38
#include <winnt.h>
49

510
HMODULE g_dll_handle = nullptr;
11+
std::filesystem::path g_dll_path {};
612

713
BOOL __stdcall DllMain(HMODULE hmod, DWORD reason, LPVOID)
814
{
9-
if (reason == DLL_PROCESS_ATTACH) {
10-
g_dll_handle = hmod;
11-
}
12-
return TRUE;
15+
if (reason == DLL_PROCESS_ATTACH)
16+
{
17+
g_dll_handle = hmod;
18+
19+
std::vector<wchar_t> dll_path_buf(MAX_PATH, L'\0');
20+
DWORD gmfn_rc = GetModuleFileNameW(hmod, dll_path_buf.data(), dll_path_buf.size());
21+
22+
// If the buffer isn't long enough, double the buffer size until it fits
23+
while (gmfn_rc == dll_path_buf.size()) {
24+
dll_path_buf.resize(dll_path_buf.size() * 2);
25+
gmfn_rc = GetModuleFileNameW(hmod, dll_path_buf.data(), dll_path_buf.size());
26+
}
27+
28+
// set the DLL path
29+
g_dll_path = std::filesystem::path(dll_path_buf.data());
30+
}
31+
return TRUE;
1332
}
1433
EXPORT void CALL DllAbout(void *hParent)
1534
{
Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
#pragma once
22

33
#include <CommonPCH.h>
4+
#include <filesystem>
45
#include "Main.hpp"
56

6-
extern HMODULE g_dll_handle;
7+
extern HMODULE g_dll_handle;
8+
extern std::filesystem::path g_dll_path;

0 commit comments

Comments
 (0)