1
0
mirror of https://github.com/originalnicodr/CinematicUnityExplorer.git synced 2025-07-18 09:27:57 +08:00

Add support to 32bit igcsdof. (#91)

Add support to 32bit igcsdof.
This commit is contained in:
Sebastián A.
2024-10-05 12:56:40 -03:00
committed by GitHub
parent 6c493aaf7d
commit 78bf2fc634
5 changed files with 38 additions and 13 deletions

View File

@ -131,3 +131,9 @@ jobs:
with:
name: UnityIGCSConnector.dll
path: ./Release/UnityIGCSConnector.dll
- name: Upload Unity IGCS Connector 32bit
uses: actions/upload-artifact@v3
with:
name: UnityIGCSConnector.32.dll
path: ./Release/UnityIGCSConnector.32.dll

View File

@ -76,13 +76,19 @@
<PostBuildEventUseInBuild>false</PostBuildEventUseInBuild>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<TargetName>UnityIGCSConnector</TargetName>
<TargetName>UnityIGCSConnector.32</TargetName>
<OutDir>$(SolutionDir)..\$(Configuration)\</OutDir>
<PostBuildEventUseInBuild>false</PostBuildEventUseInBuild>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<TargetName>UnityIGCSConnector</TargetName>
<OutDir>$(SolutionDir)..\$(Configuration)\</OutDir>
<PostBuildEventUseInBuild>false</PostBuildEventUseInBuild>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<TargetName>UnityIGCSConnector</TargetName>
<TargetName>UnityIGCSConnector.32</TargetName>
<OutDir>$(SolutionDir)..\$(Configuration)\</OutDir>
<PostBuildEventUseInBuild>false</PostBuildEventUseInBuild>
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<ClCompile>
@ -90,7 +96,7 @@
<SDLCheck>true</SDLCheck>
<PreprocessorDefinitions>WIN32;_DEBUG;UNITYIGCSCONNECTOR_EXPORTS;_WINDOWS;_USRDLL;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ConformanceMode>true</ConformanceMode>
<PrecompiledHeader>Use</PrecompiledHeader>
<PrecompiledHeader>NotUsing</PrecompiledHeader>
<PrecompiledHeaderFile>pch.h</PrecompiledHeaderFile>
</ClCompile>
<Link>
@ -107,7 +113,7 @@
<SDLCheck>true</SDLCheck>
<PreprocessorDefinitions>WIN32;NDEBUG;UNITYIGCSCONNECTOR_EXPORTS;_WINDOWS;_USRDLL;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ConformanceMode>true</ConformanceMode>
<PrecompiledHeader>Use</PrecompiledHeader>
<PrecompiledHeader>NotUsing</PrecompiledHeader>
<PrecompiledHeaderFile>pch.h</PrecompiledHeaderFile>
</ClCompile>
<Link>
@ -164,4 +170,4 @@
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
</Project>
</Project>

View File

@ -19,7 +19,7 @@ SessionCallback GlobalEndSession = NULL;
// There are things that only needs to be run once.
static int first_initialization = 1;
EXPOSE int IGCS_StartScreenshotSession(uint8_t _ignore) {
EXPOSE int __cdecl IGCS_StartScreenshotSession(uint8_t _ignore) {
if (GlobalStartSession) {
GlobalStartSession();
printf("Called StartSession\n");
@ -27,12 +27,12 @@ EXPOSE int IGCS_StartScreenshotSession(uint8_t _ignore) {
return 0;
}
EXPOSE void IGCS_EndScreenshotSession() {
EXPOSE void __cdecl IGCS_EndScreenshotSession() {
GlobalEndSession();
printf("Called EndSession\n");
}
EXPOSE uint8_t* U_IGCS_Initialize(MoveCameraCallback cb, SessionCallback start_cb, SessionCallback end_cb) {
EXPOSE uint8_t* __cdecl U_IGCS_Initialize(MoveCameraCallback cb, SessionCallback start_cb, SessionCallback end_cb) {
AllocConsole();
printf("Initializing callback\n");
GlobalCallback = cb;
@ -40,7 +40,11 @@ EXPOSE uint8_t* U_IGCS_Initialize(MoveCameraCallback cb, SessionCallback start_c
GlobalEndSession = end_cb;
// Load IGCS
#ifdef _M_IX86
HMODULE igcs = LoadLibraryA("IgcsConnector.addon32");
#else
HMODULE igcs = LoadLibraryA("IgcsConnector.addon64");
#endif
if (!igcs) {
MessageBoxA(
@ -69,9 +73,9 @@ EXPOSE uint8_t* U_IGCS_Initialize(MoveCameraCallback cb, SessionCallback start_c
}
EXPOSE void IGCS_MoveCameraPanorama() {}
EXPOSE void __cdecl IGCS_MoveCameraPanorama() {}
EXPOSE void IGCS_MoveCameraMultishot(float step_left, float step_up, float fov, int from_start) {
EXPOSE void __cdecl IGCS_MoveCameraMultishot(float step_left, float step_up, float fov, int from_start) {
GlobalCallback(step_left, step_up, fov, from_start);
return;
}

View File

@ -1,3 +1,6 @@
# ----------- Build UnityIGCSConnector ------------
msbuild.exe UnityIGCSConnector/UnityIGCSConnector.sln -p:Configuration=Release
msbuild.exe UnityIGCSConnector/UnityIGCSConnector.sln -p:Configuration=Release -p:Platform=x64
msbuild.exe UnityIGCSConnector/UnityIGCSConnector.sln -p:Configuration=Release -p:Platform=x86

View File

@ -22,8 +22,13 @@ namespace CinematicUnityExplorer.Cinematic
public class UnityIGCSConnector
{
// UnityIGCSConnector.dll definitions.
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
private delegate void MoveCameraCallback(float step_left, float step_up, float fov, int from_start);
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
private delegate void SessionCallback();
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
private delegate IntPtr U_IGCS_Initialize(MoveCameraCallback callback, SessionCallback start_cb, SessionCallback end_cb);
// Store the initial position when a session start in IGCSDof.
@ -118,10 +123,11 @@ namespace CinematicUnityExplorer.Cinematic
public UnityIGCSConnector()
{
var lib = NativeMethods.LoadLibrary(@"UnityIGCSConnector.dll");
var libraryName = IntPtr.Size == 8 ? @"UnityIGCSConnector.dll" : @"UnityIGCSConnector.32.dll";
var lib = NativeMethods.LoadLibrary(libraryName);
if (lib == IntPtr.Zero)
{
ExplorerCore.LogWarning("UnityIGCSConnector.dll was not found so IGCSDof will not be available");
ExplorerCore.LogWarning($"{libraryName} was not found so IGCSDof will not be available");
return;
}