Skip to content

Commit

Permalink
Removed rest of callback code
Browse files Browse the repository at this point in the history
Why wasn't yarn.lock present before?
  • Loading branch information
Aragas committed Nov 5, 2024
1 parent 9d16531 commit e49e31b
Show file tree
Hide file tree
Showing 4 changed files with 5,285 additions and 57 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,6 @@ namespace Bannerlord::LauncherManager
FunctionReference FGetProfileById;
FunctionReference FGetActiveGameId;
FunctionReference FSetGameParameters;
FunctionReference FGetLoadOrder;
FunctionReference FSetLoadOrder;
FunctionReference FSendNotification;
FunctionReference FSendDialog;
FunctionReference FGetInstallPath;
Expand Down Expand Up @@ -182,37 +180,6 @@ namespace Bannerlord::LauncherManager
return Create(return_value_void{Copy(GetErrorMessage(e))});
}
}
static return_value_json *getLoadOrder(void *p_owner) noexcept
{
try
{
const auto manager = static_cast<const LauncherManager *const>(p_owner);
const auto env = manager->Env();

const auto result = manager->FGetLoadOrder({}).As<Object>();
return Create(return_value_json{nullptr, Copy(JSONStringify(env, result).Utf16Value())});
}
catch (const Napi::Error &e)
{
return Create(return_value_json{Copy(GetErrorMessage(e)), nullptr});
}
}
static return_value_void *setLoadOrder(void *p_owner, char16_t *p_load_order) noexcept
{
try
{
const auto manager = static_cast<const LauncherManager *const>(p_owner);
const auto env = manager->Env();

const auto loadOrder = JSONParse(env, p_load_order == nullptr ? String::New(env, "") : String::New(env, p_load_order));
manager->FSetLoadOrder({loadOrder});
return Create(return_value_void{nullptr});
}
catch (const Napi::Error &e)
{
return Create(return_value_void{Copy(GetErrorMessage(e))});
}
}
static return_value_void *sendNotification(void *p_owner, char16_t *p_id, char16_t *p_type, char16_t *p_message, uint32_t displayMs) noexcept
{
try
Expand Down Expand Up @@ -485,25 +452,21 @@ namespace Bannerlord::LauncherManager
{
const auto env = info.Env();
this->FSetGameParameters = Persistent(info[0].As<Function>());
this->FGetLoadOrder = Persistent(info[1].As<Function>());
this->FSetLoadOrder = Persistent(info[2].As<Function>());
this->FSendNotification = Persistent(info[3].As<Function>());
this->FSendDialog = Persistent(info[4].As<Function>());
this->FGetInstallPath = Persistent(info[5].As<Function>());
this->FReadFileContent = Persistent(info[6].As<Function>());
this->FWriteFileContent = Persistent(info[7].As<Function>());
this->FReadDirectoryFileList = Persistent(info[8].As<Function>());
this->FReadDirectoryList = Persistent(info[9].As<Function>());
this->FGetAllModuleViewModels = Persistent(info[10].As<Function>());
this->FGetModuleViewModels = Persistent(info[11].As<Function>());
this->FSetModuleViewModels = Persistent(info[12].As<Function>());
this->FGetOptions = Persistent(info[13].As<Function>());
this->FGetState = Persistent(info[14].As<Function>());
this->FSendNotification = Persistent(info[1].As<Function>());
this->FSendDialog = Persistent(info[2].As<Function>());
this->FGetInstallPath = Persistent(info[3].As<Function>());
this->FReadFileContent = Persistent(info[4].As<Function>());
this->FWriteFileContent = Persistent(info[5].As<Function>());
this->FReadDirectoryFileList = Persistent(info[6].As<Function>());
this->FReadDirectoryList = Persistent(info[7].As<Function>());
this->FGetAllModuleViewModels = Persistent(info[8].As<Function>());
this->FGetModuleViewModels = Persistent(info[9].As<Function>());
this->FSetModuleViewModels = Persistent(info[10].As<Function>());
this->FGetOptions = Persistent(info[11].As<Function>());
this->FGetState = Persistent(info[12].As<Function>());

const auto result = ve_create_handler(this,

Check failure on line 468 in src/Bannerlord.LauncherManager.Native.TypeScript/src/Bannerlord.LauncherManager.hpp

View workflow job for this annotation

GitHub Actions / Publish on NPM and GPR

'Bannerlord::LauncherManager::Native::ve_create_handler': function does not take 14 arguments
setGameParameters,
getLoadOrder,
setLoadOrder,
sendNotification,
sendDialog,
getInstallPath,
Expand All @@ -522,8 +485,6 @@ namespace Bannerlord::LauncherManager
LauncherManager::~LauncherManager()
{
this->FSetGameParameters.Unref();
this->FGetLoadOrder.Unref();
this->FSetLoadOrder.Unref();
this->FSendNotification.Unref();
this->FSendDialog.Unref();
this->FGetInstallPath.Unref();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@ export class NativeLauncherManager implements LauncherManagerWithoutConstructor

public constructor(
setGameParameters: (executable: string, gameParameters: string[]) => void,
getLoadOrder: () => types.LoadOrder,
setLoadOrder: (loadOrder: types.LoadOrder) => void,
sendNotification: (id: string, type: types.NotificationType, message: string, delayMS: number) => void,
sendDialog: (type: types.DialogType, title: string, message: string, filters: types.FileFilter[]) => Promise<string>,
getInstallPath: () => string,
Expand All @@ -25,8 +23,6 @@ export class NativeLauncherManager implements LauncherManagerWithoutConstructor
const addon: types.INativeExtension = require('./../../launchermanager.node');
this.manager = new addon.LauncherManager(
setGameParameters,
getLoadOrder,
setLoadOrder,
sendNotification,
sendDialog,
getInstallPath,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@ import { ModuleInfoExtended, ModuleInfoExtendedWithMetadata } from "./Bannerlord
export interface INativeExtension {
LauncherManager: new (
setGameParameters: (executable: string, gameParameters: string[]) => void,
getLoadOrder: () => LoadOrder,
setLoadOrder: (loadOrder: LoadOrder) => void,
sendNotification: (id: string, type: NotificationType, message: string, delayMS: number) => void,
sendDialog: (type: DialogType, title: string, message: string, filters: FileFilter[]) => Promise<string>,
getInstallPath: () => string,
Expand Down
Loading

0 comments on commit e49e31b

Please sign in to comment.