mirror of
https://github.com/geode-sdk/geode.git
synced 2024-11-14 19:15:05 -05:00
make Bootstrapper and proxyLoader actually show error boxes
This commit is contained in:
parent
dbf8c4af22
commit
523c75e521
4 changed files with 40 additions and 6 deletions
|
@ -1,6 +1,6 @@
|
|||
cmake_minimum_required(VERSION 3.21 FATAL_ERROR)
|
||||
|
||||
set(GEODE_VERSION 0.4.0)
|
||||
set(GEODE_VERSION 0.4.1)
|
||||
|
||||
project(geode-sdk VERSION ${GEODE_VERSION} LANGUAGES CXX C)
|
||||
|
||||
|
|
|
@ -1,6 +1,10 @@
|
|||
#include <Windows.h>
|
||||
#include "../../../filesystem/fs/filesystem.hpp"
|
||||
|
||||
void showError(std::string const& error) {
|
||||
MessageBoxA(nullptr, error.c_str(), "Error Loading Geode", MB_ICONERROR);
|
||||
}
|
||||
|
||||
DWORD WINAPI load(PVOID _) {
|
||||
auto workingDir = ghc::filesystem::current_path();
|
||||
auto updatesDir = workingDir / "geode" / "update";
|
||||
|
@ -13,7 +17,10 @@ DWORD WINAPI load(PVOID _) {
|
|||
updatesDir / "Geode.dll",
|
||||
workingDir / "Geode.dll", error
|
||||
);
|
||||
if (error) return error.value();
|
||||
if (error) {
|
||||
showError("Unable to update Geode: Unable to move Geode.dll - " + error.message());
|
||||
return error.value();
|
||||
}
|
||||
}
|
||||
|
||||
if (ghc::filesystem::exists(updatesDir / "resources", error) && !error) {
|
||||
|
@ -21,10 +28,17 @@ DWORD WINAPI load(PVOID _) {
|
|||
updatesDir / "resources",
|
||||
resourcesDir / "geode.loader", error
|
||||
);
|
||||
if (error) return error.value();
|
||||
if (error) {
|
||||
showError("Unable to update Geode resources: " + error.message());
|
||||
return error.value();
|
||||
}
|
||||
}
|
||||
|
||||
LoadLibraryA("Geode.dll");
|
||||
if (!LoadLibraryW(L"Geode.dll")) {
|
||||
showError("Unable to load Geode (code " + std::to_string(GetLastError()) + ")");
|
||||
return 1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
@ -6,10 +6,22 @@ set_target_properties(ProxyLoader PROPERTIES
|
|||
OUTPUT_NAME "XInput9_1_0"
|
||||
RUNTIME_OUTPUT_DIRECTORY "${GEODE_BIN_PATH}/nightly"
|
||||
LIBRARY_OUTPUT_DIRECTORY "${GEODE_BIN_PATH}/nightly"
|
||||
LIBRARY_OUTPUT_DIRECTORY_RELWITHDEBINFO "${GEODE_BIN_PATH}/nightly"
|
||||
RUNTIME_OUTPUT_DIRECTORY_RELWITHDEBINFO "${GEODE_BIN_PATH}/nightly"
|
||||
ARCHIVE_OUTPUT_DIRECTORY_RELWITHDEBINFO "${GEODE_BIN_PATH}/nightly"
|
||||
LIBRARY_OUTPUT_DIRECTORY_RELEASE "${GEODE_BIN_PATH}/nightly"
|
||||
RUNTIME_OUTPUT_DIRECTORY_RELEASE "${GEODE_BIN_PATH}/nightly"
|
||||
ARCHIVE_OUTPUT_DIRECTORY_RELEASE "${GEODE_BIN_PATH}/nightly"
|
||||
LIBRARY_OUTPUT_DIRECTORY_MINSIZEREL "${GEODE_BIN_PATH}/nightly"
|
||||
RUNTIME_OUTPUT_DIRECTORY_MINSIZEREL "${GEODE_BIN_PATH}/nightly"
|
||||
ARCHIVE_OUTPUT_DIRECTORY_MINSIZEREL "${GEODE_BIN_PATH}/nightly"
|
||||
LIBRARY_OUTPUT_DIRECTORY "${GEODE_BIN_PATH}/nightly"
|
||||
RUNTIME_OUTPUT_DIRECTORY "${GEODE_BIN_PATH}/nightly"
|
||||
ARCHIVE_OUTPUT_DIRECTORY "${GEODE_BIN_PATH}/nightly"
|
||||
)
|
||||
|
||||
add_library(Bootstrapper SHARED Bootstrapper.cpp)
|
||||
set_target_properties(ProxyLoader PROPERTIES
|
||||
set_target_properties(Bootstrapper PROPERTIES
|
||||
PREFIX ""
|
||||
OUTPUT_NAME "GeodeBootstrapper"
|
||||
RUNTIME_OUTPUT_DIRECTORY "${GEODE_BIN_PATH}/nightly"
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
#include <Windows.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#pragma comment(linker, "/export:XInputGetState=xinput1_4.XInputGetState")
|
||||
#pragma comment(linker, "/export:XInputSetState=xinput1_4.XInputSetState")
|
||||
|
@ -11,7 +12,14 @@ DWORD XInputGetDSoundAudioDeviceGuids(DWORD user, GUID* render, GUID* capture) {
|
|||
#pragma comment(linker, "/export:XInputGetDSoundAudioDeviceGuids=_XInputGetDSoundAudioDeviceGuids")
|
||||
|
||||
DWORD WINAPI load(PVOID _) {
|
||||
LoadLibraryA("GeodeBootstrapper.dll");
|
||||
if (!LoadLibraryW(L"GeodeBootstrapper.dll")) {
|
||||
char msg[256];
|
||||
sprintf(msg,
|
||||
"Unable to load Geode: Unable to load "
|
||||
"bootstrapper (error code %d)", GetLastError()
|
||||
);
|
||||
MessageBoxA(NULL, msg, "Error Loading Geode", MB_ICONERROR);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue